From 3b3fbc53e6bb620a97a38a7c9d76dcb6c3238b06 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 20 Oct 2018 12:03:18 -0400 Subject: [PATCH] Replace most storyboards with XIBs --- Tusker.xcodeproj/project.pbxproj | 60 ++--- Tusker/AppDelegate.swift | 42 ++-- Tusker/Controllers/MastodonController.swift | 1 + Tusker/Info.plist | 2 - Tusker/Screens/Compose/Compose.storyboard | 232 ------------------ .../Compose/ComposeViewController.swift | 54 ++-- .../Screens/Compose/ComposeViewController.xib | 200 +++++++++++++++ .../Conversation/Conversation.storyboard | 30 --- ... => ConversationTableViewController.swift} | 21 +- .../Screens/Large Image/LargeImage.storyboard | 152 ------------ .../LargeImageViewController.swift | 50 ++-- .../Large Image/LargeImageViewController.xib | 130 ++++++++++ .../Screens/Main/Base.lproj/Main.storyboard | 27 -- .../Main/MainTabBarViewController.swift | 13 +- .../Notifications/Notifications.storyboard | 55 ----- .../NotificationsTableViewController.swift | 34 +-- .../Screens/Onboarding/Onboarding.storyboard | 68 ----- .../Onboarding/OnboardingViewController.swift | 8 + .../Onboarding/OnboardingViewController.xib | 63 +++++ Tusker/Screens/Profile/Profile.storyboard | 44 ---- .../Profile/ProfileTableViewController.swift | 36 +-- Tusker/Screens/Timeline/Timeline.storyboard | 53 ---- .../TimelineTableViewController.swift | 54 ++-- Tusker/Shortcuts/UserActivityManager.swift | 2 +- Tusker/TuskerNavigationDelegate.swift | 21 +- Tusker/XCallbackURL/XCBActions.swift | 12 +- 26 files changed, 591 insertions(+), 873 deletions(-) delete mode 100644 Tusker/Screens/Compose/Compose.storyboard create mode 100644 Tusker/Screens/Compose/ComposeViewController.xib delete mode 100644 Tusker/Screens/Conversation/Conversation.storyboard rename Tusker/Screens/Conversation/{ConversationViewController.swift => ConversationTableViewController.swift} (91%) delete mode 100644 Tusker/Screens/Large Image/LargeImage.storyboard create mode 100644 Tusker/Screens/Large Image/LargeImageViewController.xib delete mode 100644 Tusker/Screens/Main/Base.lproj/Main.storyboard delete mode 100644 Tusker/Screens/Notifications/Notifications.storyboard delete mode 100644 Tusker/Screens/Onboarding/Onboarding.storyboard create mode 100644 Tusker/Screens/Onboarding/OnboardingViewController.xib delete mode 100644 Tusker/Screens/Profile/Profile.storyboard delete mode 100644 Tusker/Screens/Timeline/Timeline.storyboard diff --git a/Tusker.xcodeproj/project.pbxproj b/Tusker.xcodeproj/project.pbxproj index 6d76fc70..2a749417 100644 --- a/Tusker.xcodeproj/project.pbxproj +++ b/Tusker.xcodeproj/project.pbxproj @@ -60,13 +60,13 @@ D621544821682A9D0003D87D /* TabsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D621544721682A9D0003D87D /* TabsTableViewController.swift */; }; D621544B21682AD30003D87D /* TabTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D621544A21682AD30003D87D /* TabTableViewCell.swift */; }; D621544D21682AD90003D87D /* TabTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D621544C21682AD90003D87D /* TabTableViewCell.xib */; }; + D6289E84217B795D0003D1D7 /* LargeImageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D6289E83217B795D0003D1D7 /* LargeImageViewController.xib */; }; D62D2422217AA7E1005076CC /* UserActivityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D62D2421217AA7E1005076CC /* UserActivityManager.swift */; }; D62D2424217ABF3F005076CC /* NSUserActivity+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D62D2423217ABF3F005076CC /* NSUserActivity+Extensions.swift */; }; D62D2426217ABF63005076CC /* UserActivityType.swift in Sources */ = {isa = PBXBuildFile; fileRef = D62D2425217ABF63005076CC /* UserActivityType.swift */; }; D6333B372137838300CE884A /* AttributedString+Trim.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6333B362137838300CE884A /* AttributedString+Trim.swift */; }; D6333B772138D94E00CE884A /* ComposeMediaView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6333B762138D94E00CE884A /* ComposeMediaView.swift */; }; D6333B792139AEFD00CE884A /* Date+TimeAgo.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6333B782139AEFD00CE884A /* Date+TimeAgo.swift */; }; - D641C771213CA9EC004B4513 /* Notifications.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D641C770213CA9EC004B4513 /* Notifications.storyboard */; }; D641C773213CAA25004B4513 /* NotificationsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D641C772213CAA25004B4513 /* NotificationsTableViewController.swift */; }; D641C777213CAA9E004B4513 /* ActionNotificationTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D641C776213CAA9E004B4513 /* ActionNotificationTableViewCell.swift */; }; D641C779213CAC56004B4513 /* ActionNotificationTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D641C778213CAC56004B4513 /* ActionNotificationTableViewCell.xib */; }; @@ -79,7 +79,6 @@ D646C958213B367000269FB5 /* LargeImageShrinkAnimationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D646C957213B367000269FB5 /* LargeImageShrinkAnimationController.swift */; }; D646C95A213B5D0500269FB5 /* LargeImageInteractionController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D646C959213B5D0500269FB5 /* LargeImageInteractionController.swift */; }; D64D0AAD2128D88B005A6F37 /* LocalData.swift in Sources */ = {isa = PBXBuildFile; fileRef = D64D0AAC2128D88B005A6F37 /* LocalData.swift */; }; - D64D0AAF2128D954005A6F37 /* Onboarding.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D64D0AAE2128D954005A6F37 /* Onboarding.storyboard */; }; D64D0AB12128D9AE005A6F37 /* OnboardingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D64D0AB02128D9AE005A6F37 /* OnboardingViewController.swift */; }; D64F80E2215875CC00BEF393 /* XCBActionType.swift in Sources */ = {isa = PBXBuildFile; fileRef = D64F80E1215875CC00BEF393 /* XCBActionType.swift */; }; D6538945214D6D7500E3CEFC /* TableViewSwipeActionProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6538944214D6D7500E3CEFC /* TableViewSwipeActionProvider.swift */; }; @@ -92,17 +91,14 @@ D663626821360E2C00C9CBA2 /* PreferencesTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D663626721360E2C00C9CBA2 /* PreferencesTableViewController.swift */; }; D663626A2136163000C9CBA2 /* PreferencesAdaptive.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66362692136163000C9CBA2 /* PreferencesAdaptive.swift */; }; D663626C21361C6700C9CBA2 /* Account+Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = D663626B21361C6700C9CBA2 /* Account+Preferences.swift */; }; - D663626F213632A000C9CBA2 /* Compose.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D663626E213632A000C9CBA2 /* Compose.storyboard */; }; D66362712136338600C9CBA2 /* ComposeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66362702136338600C9CBA2 /* ComposeViewController.swift */; }; D66362752137068A00C9CBA2 /* Visibility+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66362742137068A00C9CBA2 /* Visibility+Helpers.swift */; }; D667E5E12134937B0057A976 /* StatusTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D667E5E02134937B0057A976 /* StatusTableViewCell.xib */; }; - D667E5E3213499F70057A976 /* Profile.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D667E5E2213499F70057A976 /* Profile.storyboard */; }; D667E5E721349D4C0057A976 /* ProfileTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D667E5E621349D4C0057A976 /* ProfileTableViewController.swift */; }; D667E5E921349EE50057A976 /* ProfileHeaderTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D667E5E821349EE50057A976 /* ProfileHeaderTableViewCell.xib */; }; D667E5EB21349EF80057A976 /* ProfileHeaderTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D667E5EA21349EF80057A976 /* ProfileHeaderTableViewCell.swift */; }; D667E5F12134D5050057A976 /* UIViewController+Delegates.swift in Sources */ = {isa = PBXBuildFile; fileRef = D667E5F02134D5050057A976 /* UIViewController+Delegates.swift */; }; - D667E5F32135BC260057A976 /* Conversation.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D667E5F22135BC260057A976 /* Conversation.storyboard */; }; - D667E5F52135BCD50057A976 /* ConversationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D667E5F42135BCD50057A976 /* ConversationViewController.swift */; }; + D667E5F52135BCD50057A976 /* ConversationTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D667E5F42135BCD50057A976 /* ConversationTableViewController.swift */; }; D667E5F82135C3040057A976 /* Mastodon+Equatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D667E5F72135C3040057A976 /* Mastodon+Equatable.swift */; }; D6757A7C2157E01900721E32 /* XCBManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6757A7B2157E01900721E32 /* XCBManager.swift */; }; D6757A7E2157E02600721E32 /* XCBRequestSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6757A7D2157E02600721E32 /* XCBRequestSpec.swift */; }; @@ -110,6 +106,8 @@ D679C09F215850EF00DA27FE /* XCBActions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D679C09E215850EF00DA27FE /* XCBActions.swift */; }; D67E0513216438A7000E0927 /* AppearanceTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D67E0512216438A7000E0927 /* AppearanceTableViewController.swift */; }; D67E051521643C77000E0927 /* Tab.swift in Sources */ = {isa = PBXBuildFile; fileRef = D67E051421643C77000E0927 /* Tab.swift */; }; + D6A5FAF1217B7E05003DB2D9 /* ComposeViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D6A5FAF0217B7E05003DB2D9 /* ComposeViewController.xib */; }; + D6A5FAFB217B86CE003DB2D9 /* OnboardingViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D6A5FAFA217B86CE003DB2D9 /* OnboardingViewController.xib */; }; D6BED170212663DA00F02DA0 /* SwiftSoup.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D6BED16E212663DA00F02DA0 /* SwiftSoup.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; D6BED174212667E900F02DA0 /* StatusTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6BED173212667E900F02DA0 /* StatusTableViewCell.swift */; }; D6C693CA2161253F007D6A6D /* SilentActionPermissionsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C693C92161253F007D6A6D /* SilentActionPermissionsTableViewController.swift */; }; @@ -119,11 +117,9 @@ D6C693F92162E4DB007D6A6D /* StatusContentLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C693F82162E4DB007D6A6D /* StatusContentLabel.swift */; }; D6C693FC2162FE6F007D6A6D /* LoadingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C693FB2162FE6F007D6A6D /* LoadingViewController.swift */; }; D6C693FE2162FEEA007D6A6D /* UIViewController+Children.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C693FD2162FEEA007D6A6D /* UIViewController+Children.swift */; }; - D6C94D852139DFD800CB5196 /* LargeImage.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D6C94D842139DFD800CB5196 /* LargeImage.storyboard */; }; D6C94D872139E62700CB5196 /* LargeImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C94D862139E62700CB5196 /* LargeImageViewController.swift */; }; D6C94D892139E6EC00CB5196 /* AttachmentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C94D882139E6EC00CB5196 /* AttachmentView.swift */; }; D6D4DDD0212518A000E1C4BB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6D4DDCF212518A000E1C4BB /* AppDelegate.swift */; }; - D6D4DDD5212518A000E1C4BB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D6D4DDD3212518A000E1C4BB /* Main.storyboard */; }; D6D4DDD7212518A200E1C4BB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D6D4DDD6212518A200E1C4BB /* Assets.xcassets */; }; D6D4DDDA212518A200E1C4BB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D6D4DDD8212518A200E1C4BB /* LaunchScreen.storyboard */; }; D6D4DDE5212518A200E1C4BB /* TuskerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6D4DDE4212518A200E1C4BB /* TuskerTests.swift */; }; @@ -132,7 +128,6 @@ D6E6F26321603F8B006A8599 /* CharacterCounter.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E6F26221603F8B006A8599 /* CharacterCounter.swift */; }; D6E6F26521604242006A8599 /* CharacterCounterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E6F26421604242006A8599 /* CharacterCounterTests.swift */; }; D6F953EC212519E700CF0F2B /* TimelineTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6F953EB212519E700CF0F2B /* TimelineTableViewController.swift */; }; - D6F953EE21251A0700CF0F2B /* Timeline.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D6F953ED21251A0700CF0F2B /* Timeline.storyboard */; }; D6F953F021251A2900CF0F2B /* MastodonController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6F953EF21251A2900CF0F2B /* MastodonController.swift */; }; /* End PBXBuildFile section */ @@ -252,13 +247,13 @@ D621544721682A9D0003D87D /* TabsTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabsTableViewController.swift; sourceTree = ""; }; D621544A21682AD30003D87D /* TabTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabTableViewCell.swift; sourceTree = ""; }; D621544C21682AD90003D87D /* TabTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TabTableViewCell.xib; sourceTree = ""; }; + D6289E83217B795D0003D1D7 /* LargeImageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = LargeImageViewController.xib; sourceTree = ""; }; D62D2421217AA7E1005076CC /* UserActivityManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserActivityManager.swift; sourceTree = ""; }; D62D2423217ABF3F005076CC /* NSUserActivity+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSUserActivity+Extensions.swift"; sourceTree = ""; }; D62D2425217ABF63005076CC /* UserActivityType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserActivityType.swift; sourceTree = ""; }; D6333B362137838300CE884A /* AttributedString+Trim.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AttributedString+Trim.swift"; sourceTree = ""; }; D6333B762138D94E00CE884A /* ComposeMediaView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeMediaView.swift; sourceTree = ""; }; D6333B782139AEFD00CE884A /* Date+TimeAgo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+TimeAgo.swift"; sourceTree = ""; }; - D641C770213CA9EC004B4513 /* Notifications.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Notifications.storyboard; sourceTree = ""; }; D641C772213CAA25004B4513 /* NotificationsTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationsTableViewController.swift; sourceTree = ""; }; D641C776213CAA9E004B4513 /* ActionNotificationTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionNotificationTableViewCell.swift; sourceTree = ""; }; D641C778213CAC56004B4513 /* ActionNotificationTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ActionNotificationTableViewCell.xib; sourceTree = ""; }; @@ -271,7 +266,6 @@ D646C957213B367000269FB5 /* LargeImageShrinkAnimationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LargeImageShrinkAnimationController.swift; sourceTree = ""; }; D646C959213B5D0500269FB5 /* LargeImageInteractionController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LargeImageInteractionController.swift; sourceTree = ""; }; D64D0AAC2128D88B005A6F37 /* LocalData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalData.swift; sourceTree = ""; }; - D64D0AAE2128D954005A6F37 /* Onboarding.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Onboarding.storyboard; sourceTree = ""; }; D64D0AB02128D9AE005A6F37 /* OnboardingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingViewController.swift; sourceTree = ""; }; D64F80E1215875CC00BEF393 /* XCBActionType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCBActionType.swift; sourceTree = ""; }; D6538944214D6D7500E3CEFC /* TableViewSwipeActionProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewSwipeActionProvider.swift; sourceTree = ""; }; @@ -283,17 +277,14 @@ D663626721360E2C00C9CBA2 /* PreferencesTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesTableViewController.swift; sourceTree = ""; }; D66362692136163000C9CBA2 /* PreferencesAdaptive.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesAdaptive.swift; sourceTree = ""; }; D663626B21361C6700C9CBA2 /* Account+Preferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Account+Preferences.swift"; sourceTree = ""; }; - D663626E213632A000C9CBA2 /* Compose.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Compose.storyboard; sourceTree = ""; }; D66362702136338600C9CBA2 /* ComposeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeViewController.swift; sourceTree = ""; }; D66362742137068A00C9CBA2 /* Visibility+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Visibility+Helpers.swift"; sourceTree = ""; }; D667E5E02134937B0057A976 /* StatusTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = StatusTableViewCell.xib; sourceTree = ""; }; - D667E5E2213499F70057A976 /* Profile.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Profile.storyboard; sourceTree = ""; }; D667E5E621349D4C0057A976 /* ProfileTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileTableViewController.swift; sourceTree = ""; }; D667E5E821349EE50057A976 /* ProfileHeaderTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ProfileHeaderTableViewCell.xib; sourceTree = ""; }; D667E5EA21349EF80057A976 /* ProfileHeaderTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileHeaderTableViewCell.swift; sourceTree = ""; }; D667E5F02134D5050057A976 /* UIViewController+Delegates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Delegates.swift"; sourceTree = ""; }; - D667E5F22135BC260057A976 /* Conversation.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Conversation.storyboard; sourceTree = ""; }; - D667E5F42135BCD50057A976 /* ConversationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationViewController.swift; sourceTree = ""; }; + D667E5F42135BCD50057A976 /* ConversationTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationTableViewController.swift; sourceTree = ""; }; D667E5F72135C3040057A976 /* Mastodon+Equatable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Mastodon+Equatable.swift"; sourceTree = ""; }; D6757A7B2157E01900721E32 /* XCBManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCBManager.swift; sourceTree = ""; }; D6757A7D2157E02600721E32 /* XCBRequestSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCBRequestSpec.swift; sourceTree = ""; }; @@ -301,6 +292,8 @@ D679C09E215850EF00DA27FE /* XCBActions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCBActions.swift; sourceTree = ""; }; D67E0512216438A7000E0927 /* AppearanceTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppearanceTableViewController.swift; sourceTree = ""; }; D67E051421643C77000E0927 /* Tab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tab.swift; sourceTree = ""; }; + D6A5FAF0217B7E05003DB2D9 /* ComposeViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ComposeViewController.xib; sourceTree = ""; }; + D6A5FAFA217B86CE003DB2D9 /* OnboardingViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = OnboardingViewController.xib; sourceTree = ""; }; D6BED16E212663DA00F02DA0 /* SwiftSoup.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SwiftSoup.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D6BED173212667E900F02DA0 /* StatusTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusTableViewCell.swift; sourceTree = ""; }; D6C693C92161253F007D6A6D /* SilentActionPermissionsTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SilentActionPermissionsTableViewController.swift; sourceTree = ""; }; @@ -310,12 +303,10 @@ D6C693F82162E4DB007D6A6D /* StatusContentLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusContentLabel.swift; sourceTree = ""; }; D6C693FB2162FE6F007D6A6D /* LoadingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingViewController.swift; sourceTree = ""; }; D6C693FD2162FEEA007D6A6D /* UIViewController+Children.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Children.swift"; sourceTree = ""; }; - D6C94D842139DFD800CB5196 /* LargeImage.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LargeImage.storyboard; sourceTree = ""; }; D6C94D862139E62700CB5196 /* LargeImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LargeImageViewController.swift; sourceTree = ""; }; D6C94D882139E6EC00CB5196 /* AttachmentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttachmentView.swift; sourceTree = ""; }; D6D4DDCC212518A000E1C4BB /* Tusker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Tusker.app; sourceTree = BUILT_PRODUCTS_DIR; }; D6D4DDCF212518A000E1C4BB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - D6D4DDD4212518A000E1C4BB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; D6D4DDD6212518A200E1C4BB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; D6D4DDD9212518A200E1C4BB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; D6D4DDDB212518A200E1C4BB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -329,7 +320,6 @@ D6E6F26221603F8B006A8599 /* CharacterCounter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CharacterCounter.swift; sourceTree = ""; }; D6E6F26421604242006A8599 /* CharacterCounterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CharacterCounterTests.swift; sourceTree = ""; }; D6F953EB212519E700CF0F2B /* TimelineTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineTableViewController.swift; sourceTree = ""; }; - D6F953ED21251A0700CF0F2B /* Timeline.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Timeline.storyboard; sourceTree = ""; }; D6F953EF21251A2900CF0F2B /* MastodonController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonController.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -519,7 +509,6 @@ D641C781213DD7DD004B4513 /* Timeline */ = { isa = PBXGroup; children = ( - D6F953ED21251A0700CF0F2B /* Timeline.storyboard */, D6F953EB212519E700CF0F2B /* TimelineTableViewController.swift */, ); path = Timeline; @@ -528,7 +517,6 @@ D641C782213DD7F0004B4513 /* Main */ = { isa = PBXGroup; children = ( - D6D4DDD3212518A000E1C4BB /* Main.storyboard */, 04DACE8B212CB14B009840C4 /* MainTabBarViewController.swift */, ); path = Main; @@ -537,7 +525,7 @@ D641C783213DD7FE004B4513 /* Onboarding */ = { isa = PBXGroup; children = ( - D64D0AAE2128D954005A6F37 /* Onboarding.storyboard */, + D6A5FAFA217B86CE003DB2D9 /* OnboardingViewController.xib */, D64D0AB02128D9AE005A6F37 /* OnboardingViewController.swift */, ); path = Onboarding; @@ -546,7 +534,6 @@ D641C784213DD819004B4513 /* Profile */ = { isa = PBXGroup; children = ( - D667E5E2213499F70057A976 /* Profile.storyboard */, D667E5E621349D4C0057A976 /* ProfileTableViewController.swift */, ); path = Profile; @@ -555,8 +542,7 @@ D641C785213DD83B004B4513 /* Conversation */ = { isa = PBXGroup; children = ( - D667E5F22135BC260057A976 /* Conversation.storyboard */, - D667E5F42135BCD50057A976 /* ConversationViewController.swift */, + D667E5F42135BCD50057A976 /* ConversationTableViewController.swift */, ); path = Conversation; sourceTree = ""; @@ -564,7 +550,6 @@ D641C786213DD852004B4513 /* Notifications */ = { isa = PBXGroup; children = ( - D641C770213CA9EC004B4513 /* Notifications.storyboard */, D641C772213CAA25004B4513 /* NotificationsTableViewController.swift */, ); path = Notifications; @@ -573,7 +558,7 @@ D641C787213DD862004B4513 /* Compose */ = { isa = PBXGroup; children = ( - D663626E213632A000C9CBA2 /* Compose.storyboard */, + D6A5FAF0217B7E05003DB2D9 /* ComposeViewController.xib */, D66362702136338600C9CBA2 /* ComposeViewController.swift */, ); path = Compose; @@ -583,7 +568,7 @@ isa = PBXGroup; children = ( D646C954213B364600269FB5 /* Transitions */, - D6C94D842139DFD800CB5196 /* LargeImage.storyboard */, + D6289E83217B795D0003D1D7 /* LargeImageViewController.xib */, D6C94D862139E62700CB5196 /* LargeImageViewController.swift */, ); path = "Large Image"; @@ -1019,22 +1004,17 @@ buildActionMask = 2147483647; files = ( D641C779213CAC56004B4513 /* ActionNotificationTableViewCell.xib in Resources */, - D667E5F32135BC260057A976 /* Conversation.storyboard in Resources */, D667E5E921349EE50057A976 /* ProfileHeaderTableViewCell.xib in Resources */, D6C693CD2161257B007D6A6D /* SilentActionPermissionCell.xib in Resources */, D6D4DDDA212518A200E1C4BB /* LaunchScreen.storyboard in Resources */, - D64D0AAF2128D954005A6F37 /* Onboarding.storyboard in Resources */, D6D4DDD7212518A200E1C4BB /* Assets.xcassets in Resources */, D663625D2135C74800C9CBA2 /* ConversationMainStatusTableViewCell.xib in Resources */, - D6F953EE21251A0700CF0F2B /* Timeline.storyboard in Resources */, - D663626F213632A000C9CBA2 /* Compose.storyboard in Resources */, + D6A5FAFB217B86CE003DB2D9 /* OnboardingViewController.xib in Resources */, D641C77B213CB017004B4513 /* FollowNotificationTableViewCell.xib in Resources */, - D6C94D852139DFD800CB5196 /* LargeImage.storyboard in Resources */, - D6D4DDD5212518A000E1C4BB /* Main.storyboard in Resources */, - D667E5E3213499F70057A976 /* Profile.storyboard in Resources */, - D641C771213CA9EC004B4513 /* Notifications.storyboard in Resources */, + D6289E84217B795D0003D1D7 /* LargeImageViewController.xib in Resources */, D663626621360DD700C9CBA2 /* Preferences.storyboard in Resources */, D667E5E12134937B0057A976 /* StatusTableViewCell.xib in Resources */, + D6A5FAF1217B7E05003DB2D9 /* ComposeViewController.xib in Resources */, D621544D21682AD90003D87D /* TabTableViewCell.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1122,7 +1102,7 @@ D6757A822157E8FA00721E32 /* XCBSession.swift in Sources */, 04DACE8C212CB14B009840C4 /* MainTabBarViewController.swift in Sources */, D6C693F92162E4DB007D6A6D /* StatusContentLabel.swift in Sources */, - D667E5F52135BCD50057A976 /* ConversationViewController.swift in Sources */, + D667E5F52135BCD50057A976 /* ConversationTableViewController.swift in Sources */, D6F953F021251A2900CF0F2B /* MastodonController.swift in Sources */, D62D2426217ABF63005076CC /* UserActivityType.swift in Sources */, D66362712136338600C9CBA2 /* ComposeViewController.swift in Sources */, @@ -1232,14 +1212,6 @@ /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ - D6D4DDD3212518A000E1C4BB /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - D6D4DDD4212518A000E1C4BB /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; D6D4DDD8212518A200E1C4BB /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( diff --git a/Tusker/AppDelegate.swift b/Tusker/AppDelegate.swift index b87034d3..545f777c 100644 --- a/Tusker/AppDelegate.swift +++ b/Tusker/AppDelegate.swift @@ -14,16 +14,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - // Override point for customization after application launch. + window = UIWindow(frame: UIScreen.main.bounds) if LocalData.shared.onboardingComplete { - MastodonController.createClient() - MastodonController.getOwnAccount() - MastodonController.getOwnInstance() + showAppUI() } else { - showOnboarding() + showOnboardingUI() } + window!.makeKeyAndVisible() + return true } @@ -60,28 +60,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } + + func showAppUI() { + MastodonController.createClient() + MastodonController.getOwnAccount() + MastodonController.getOwnInstance() + + window!.rootViewController = MainTabBarViewController() + } + + func showOnboardingUI() { + let onboarding = OnboardingViewController() + onboarding.delegate = self + window!.rootViewController = onboarding + } } extension AppDelegate: OnboardingViewControllerDelegate { - func showOnboarding() { - if let window = self.window, - let onboardingViewController = UIStoryboard(name: "Onboarding", bundle: nil).instantiateInitialViewController() as? OnboardingViewController { - - onboardingViewController.delegate = self - window.makeKeyAndVisible() - window.rootViewController?.present(onboardingViewController, animated: true, completion: nil) - } - } - - func hideOnboarding() { - if let window = UIApplication.shared.keyWindow { - window.rootViewController?.dismiss(animated: true, completion: nil) - } - } - func didFinishOnboarding() { - hideOnboarding() LocalData.shared.onboardingComplete = true + showAppUI() } } diff --git a/Tusker/Controllers/MastodonController.swift b/Tusker/Controllers/MastodonController.swift index f74141a4..bf376e9b 100644 --- a/Tusker/Controllers/MastodonController.swift +++ b/Tusker/Controllers/MastodonController.swift @@ -59,6 +59,7 @@ class MastodonController { client.run(request) { response in guard case let .success(account, _) = response else { fatalError() } self.account = account + MastodonCache.add(account: account) completion?(account) } } diff --git a/Tusker/Info.plist b/Tusker/Info.plist index d5bd98bc..b5eaa2da 100644 --- a/Tusker/Info.plist +++ b/Tusker/Info.plist @@ -46,8 +46,6 @@ Post photos from the photo library. UILaunchStoryboardName LaunchScreen - UIMainStoryboardFile - Main UIRequiredDeviceCapabilities armv7 diff --git a/Tusker/Screens/Compose/Compose.storyboard b/Tusker/Screens/Compose/Compose.storyboard deleted file mode 100644 index f30fdfb3..00000000 --- a/Tusker/Screens/Compose/Compose.storyboard +++ /dev/null @@ -1,232 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tusker/Screens/Compose/ComposeViewController.swift b/Tusker/Screens/Compose/ComposeViewController.swift index 8ef8d2c1..82202c56 100644 --- a/Tusker/Screens/Compose/ComposeViewController.swift +++ b/Tusker/Screens/Compose/ComposeViewController.swift @@ -11,24 +11,6 @@ import Pachyderm import Intents class ComposeViewController: UIViewController { - - static func create(inReplyTo inReplyToID: String? = nil, mentioning: String? = nil, text: String? = nil) -> UIViewController { - guard let navigationController = UIStoryboard(name: "Compose", bundle: nil).instantiateInitialViewController() as? UINavigationController, - let composeVC = navigationController.topViewController as? ComposeViewController else { fatalError() } - composeVC.inReplyToID = inReplyToID - composeVC.mentioningAcct = mentioning - composeVC.text = text - return navigationController - } - - static func create(for session: XCBSession, mentioning: String? = nil, text: String? = nil) -> UIViewController { - guard let navigationController = UIStoryboard(name: "Compose", bundle: nil).instantiateInitialViewController() as? UINavigationController, - let composeVC = navigationController.topViewController as? ComposeViewController else { fatalError() } - composeVC.mentioningAcct = mentioning - composeVC.text = text - composeVC.xcbSession = session - return navigationController - } @IBOutlet weak var scrollView: UIScrollView! @IBOutlet weak var inReplyToContainerView: UIView! @@ -69,6 +51,18 @@ class ComposeViewController: UIViewController { var status: Status? + init(inReplyTo inReplyToID: String? = nil, mentioningAcct: String? = nil, text: String? = nil) { + super.init(nibName: "ComposeViewController", bundle: nil) + self.inReplyToID = inReplyToID + self.mentioningAcct = mentioningAcct + self.text = text + navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(cancelPressed)) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + override func viewDidLoad() { super.viewDidLoad() @@ -169,20 +163,11 @@ class ComposeViewController: UIViewController { } // MARK: - Navigation - - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + + override func dismiss(animated flag: Bool, completion: (() -> Void)? = nil) { statusTextView.resignFirstResponder() contentWarningTextField.resignFirstResponder() - - if segue.identifier == "postComplete" { - guard let status = status else { fatalError("postComplete segue can't occur without Status") } - guard let dest = segue.destination as? MainTabBarViewController, - let navController = dest.selectedViewController as? UINavigationController, - let topVC = navController.topViewController as? StatusTableViewCellDelegate else { return } - topVC.selected(status: status.id) - } else if segue.identifier == "cancel" { - xcbSession?.complete(with: .cancel) - } + super.dismiss(animated: flag, completion: completion) } // MARK: - Interaction @@ -285,7 +270,9 @@ class ComposeViewController: UIViewController { MastodonCache.add(status: status) DispatchQueue.main.async { self.progressView.step() - self.performSegue(withIdentifier: "postComplete", sender: self) + self.dismiss(animated: true) + // TODO: reorganize routing/navigation + (((self.presentingViewController as! MainTabBarViewController).selectedViewController as! UINavigationController).topViewController as! TuskerNavigationDelegate).selected(status: status.id) self.xcbSession?.complete(with: .success, additionalData: [ "statusURL": status.url?.absoluteString, @@ -304,6 +291,11 @@ class ComposeViewController: UIViewController { statusTextView.endEditing(false) } + @objc func cancelPressed() { + dismiss(animated: true) + xcbSession?.complete(with: .cancel) + } + } extension ComposeViewController: UITextFieldDelegate { diff --git a/Tusker/Screens/Compose/ComposeViewController.xib b/Tusker/Screens/Compose/ComposeViewController.xib new file mode 100644 index 00000000..97d35d3a --- /dev/null +++ b/Tusker/Screens/Compose/ComposeViewController.xib @@ -0,0 +1,200 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tusker/Screens/Conversation/Conversation.storyboard b/Tusker/Screens/Conversation/Conversation.storyboard deleted file mode 100644 index fa02c6b4..00000000 --- a/Tusker/Screens/Conversation/Conversation.storyboard +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tusker/Screens/Conversation/ConversationViewController.swift b/Tusker/Screens/Conversation/ConversationTableViewController.swift similarity index 91% rename from Tusker/Screens/Conversation/ConversationViewController.swift rename to Tusker/Screens/Conversation/ConversationTableViewController.swift index 01269cb5..404decb5 100644 --- a/Tusker/Screens/Conversation/ConversationViewController.swift +++ b/Tusker/Screens/Conversation/ConversationTableViewController.swift @@ -9,13 +9,7 @@ import UIKit import Pachyderm -class ConversationViewController: UITableViewController { - - static func create(for mainStatusID: String) -> ConversationViewController { - guard let conversationController = UIStoryboard(name: "Conversation", bundle: nil).instantiateInitialViewController() as? ConversationViewController else { fatalError() } - conversationController.mainStatusID = mainStatusID - return conversationController - } +class ConversationTableViewController: UITableViewController { var mainStatusID: String! @@ -27,6 +21,15 @@ class ConversationViewController: UITableViewController { } } + init(for mainStatusID: String) { + super.init(style: .plain) + self.mainStatusID = mainStatusID + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + override func viewDidLoad() { super.viewDidLoad() @@ -151,5 +154,5 @@ class ConversationViewController: UITableViewController { } -extension ConversationViewController: StatusTableViewCellDelegate {} -extension ConversationViewController: LargeImageViewControllerDelegate {} +extension ConversationTableViewController: StatusTableViewCellDelegate {} +extension ConversationTableViewController: LargeImageViewControllerDelegate {} diff --git a/Tusker/Screens/Large Image/LargeImage.storyboard b/Tusker/Screens/Large Image/LargeImage.storyboard deleted file mode 100644 index 1e5794e0..00000000 --- a/Tusker/Screens/Large Image/LargeImage.storyboard +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tusker/Screens/Large Image/LargeImageViewController.swift b/Tusker/Screens/Large Image/LargeImageViewController.swift index 01f762a1..18ba2ab3 100644 --- a/Tusker/Screens/Large Image/LargeImageViewController.swift +++ b/Tusker/Screens/Large Image/LargeImageViewController.swift @@ -15,25 +15,6 @@ protocol LargeImageViewControllerDelegate { class LargeImageViewController: UIViewController, UIScrollViewDelegate { - static func create(image: UIImage, description: String?, sourceView: UIView, sourceViewController: UIViewController) -> LargeImageViewController { - guard let vc = UIStoryboard(name: "LargeImage", bundle: nil).instantiateInitialViewController() as? LargeImageViewController else { fatalError() } - vc.image = image - vc.imageDescription = description - var frame = sourceView.convert(sourceView.bounds, to: sourceViewController.view) - if let scrollView = sourceViewController.view as? UIScrollView { - let scale = scrollView.zoomScale - let width = frame.width * scale - let height = frame.height * scale - let x = frame.minX * scale - scrollView.contentOffset.x + scrollView.frame.minX - let y = frame.minY * scale - scrollView.contentOffset.y + scrollView.frame.minY - frame = CGRect(x: x, y: y, width: width, height: height) - } - vc.originFrame = frame - vc.originCornerRadius = sourceView.layer.cornerRadius - vc.transitioningDelegate = sourceViewController - return vc - } - var delegate: LargeImageViewControllerDelegate? var originFrame: CGRect? @@ -83,6 +64,28 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate { return true } + init(image: UIImage, description: String?, sourceView: UIView, sourceViewController: UIViewController) { + super.init(nibName: "LargeImageViewController", bundle: nil) + self.image = image + self.imageDescription = description + var frame = sourceView.convert(sourceView.bounds, to: sourceViewController.view) + if let scrollView = sourceViewController.view as? UIScrollView { + let scale = scrollView.zoomScale + let width = frame.width * scale + let height = frame.height * scale + let x = frame.minX * scale - scrollView.contentOffset.x + scrollView.frame.minX + let y = frame.minY * scale - scrollView.contentOffset.y + scrollView.frame.minY + frame = CGRect(x: x, y: y, width: width, height: height) + } + self.originFrame = frame + self.originCornerRadius = sourceView.layer.cornerRadius + self.transitioningDelegate = sourceViewController + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + override func viewDidLoad() { super.viewDidLoad() @@ -97,6 +100,11 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate { } dismissInteractionController = LargeImageInteractionController(viewController: self) + + view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(scrollViewPressed(_:)))) + let doubleTap = UITapGestureRecognizer(target: self, action: #selector(scrollViewDoubleTapped(_:))) + doubleTap.numberOfTapsRequired = 2 + view.addGestureRecognizer(doubleTap) } @@ -176,7 +184,7 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate { } */ - @IBAction func scrollViewPressed(_ sender: UITapGestureRecognizer) { + @objc func scrollViewPressed(_ sender: UITapGestureRecognizer) { if scrollView.zoomScale > scrollView.minimumZoomScale { animateZoomOut() } else { @@ -184,7 +192,7 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate { } } - @IBAction func scrollViewDoubleTapped(_ recognizer: UITapGestureRecognizer) { + @objc func scrollViewDoubleTapped(_ recognizer: UITapGestureRecognizer) { if scrollView.zoomScale <= scrollView.minimumZoomScale { let point = recognizer.location(in: recognizer.view) let scale: CGFloat diff --git a/Tusker/Screens/Large Image/LargeImageViewController.xib b/Tusker/Screens/Large Image/LargeImageViewController.xib new file mode 100644 index 00000000..60b8f120 --- /dev/null +++ b/Tusker/Screens/Large Image/LargeImageViewController.xib @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tusker/Screens/Main/Base.lproj/Main.storyboard b/Tusker/Screens/Main/Base.lproj/Main.storyboard deleted file mode 100644 index 10e4025d..00000000 --- a/Tusker/Screens/Main/Base.lproj/Main.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tusker/Screens/Main/MainTabBarViewController.swift b/Tusker/Screens/Main/MainTabBarViewController.swift index 898f214f..cb8bd13d 100644 --- a/Tusker/Screens/Main/MainTabBarViewController.swift +++ b/Tusker/Screens/Main/MainTabBarViewController.swift @@ -31,20 +31,20 @@ class MainTabBarViewController: UITabBarController { func createVC(for tab: Tab) -> UIViewController { switch tab { case .home: - return TimelineTableViewController.create(for: .home) + return TimelineTableViewController(for: .home) case .federated: - return TimelineTableViewController.create(for: .public(local: false)) + return TimelineTableViewController(for: .public(local: false)) case .local: - return TimelineTableViewController.create(for: .public(local: true)) + return TimelineTableViewController(for: .public(local: true)) case .myProfile: - let myProfile = ProfileTableViewController.createForPending() + let myProfile = ProfileTableViewController(accountID: nil) myProfile.title = "My Profile" MastodonController.getOwnAccount { (account) in myProfile.accountID = account.id } return myProfile case .notifications: - return NotificationsTableViewController.create() + return embedInNavigationController(NotificationsTableViewController()) case .preferences: return PreferencesTableViewController.create() } @@ -67,8 +67,5 @@ class MainTabBarViewController: UITabBarController { // Pass the selected object to the new view controller. } */ - - @IBAction func unwindToTabBarController(segue: UIStoryboardSegue) { - } } diff --git a/Tusker/Screens/Notifications/Notifications.storyboard b/Tusker/Screens/Notifications/Notifications.storyboard deleted file mode 100644 index 25f4fb60..00000000 --- a/Tusker/Screens/Notifications/Notifications.storyboard +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tusker/Screens/Notifications/NotificationsTableViewController.swift b/Tusker/Screens/Notifications/NotificationsTableViewController.swift index 3ebdf596..5fd4ffe7 100644 --- a/Tusker/Screens/Notifications/NotificationsTableViewController.swift +++ b/Tusker/Screens/Notifications/NotificationsTableViewController.swift @@ -10,11 +10,6 @@ import UIKit import Pachyderm class NotificationsTableViewController: UITableViewController { - - static func create() -> UINavigationController { - guard let navigationController = UIStoryboard(name: "Notifications", bundle: nil).instantiateInitialViewController() as? UINavigationController else { fatalError() } - return navigationController - } var notifications: [Pachyderm.Notification] = [] { didSet { @@ -27,14 +22,19 @@ class NotificationsTableViewController: UITableViewController { var newer: RequestRange? var older: RequestRange? + init() { + super.init(style: .plain) + self.title = "Notifications" + self.refreshControl = UIRefreshControl() + refreshControl!.addTarget(self, action: #selector(refreshNotifications(_:)), for: .valueChanged) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + override func viewDidLoad() { super.viewDidLoad() - - // Uncomment the following line to preserve selection between presentations - // self.clearsSelectionOnViewWillAppear = false - - // Uncomment the following line to display an Edit button in the navigation bar for this view controller. - // self.navigationItem.rightBarButtonItem = self.editButtonItem tableView.rowHeight = UITableView.automaticDimension tableView.estimatedRowHeight = 140 @@ -67,16 +67,6 @@ class NotificationsTableViewController: UITableViewController { } } } - - /* - // MARK: - Navigation - - // In a storyboard-based application, you will often want to do a little preparation before navigation - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - // Get the new view controller using segue.destination. - // Pass the selected object to the new view controller. - } - */ // MARK: - Table view data source @@ -138,7 +128,7 @@ class NotificationsTableViewController: UITableViewController { return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.trailingSwipeActionsConfiguration() } - @IBAction func refreshNotifications(_ sender: Any) { + @objc func refreshNotifications(_ sender: Any) { guard let newer = newer else { return } let request = MastodonController.client.getNotifications(range: newer) diff --git a/Tusker/Screens/Onboarding/Onboarding.storyboard b/Tusker/Screens/Onboarding/Onboarding.storyboard deleted file mode 100644 index e1bd4d4d..00000000 --- a/Tusker/Screens/Onboarding/Onboarding.storyboard +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tusker/Screens/Onboarding/OnboardingViewController.swift b/Tusker/Screens/Onboarding/OnboardingViewController.swift index 67bcb45f..a6a2ebc6 100644 --- a/Tusker/Screens/Onboarding/OnboardingViewController.swift +++ b/Tusker/Screens/Onboarding/OnboardingViewController.swift @@ -23,6 +23,14 @@ class OnboardingViewController: UIViewController { var authenticationSession: ASWebAuthenticationSession? + init() { + super.init(nibName: "OnboardingViewController", bundle: nil) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + override func viewDidLoad() { super.viewDidLoad() } diff --git a/Tusker/Screens/Onboarding/OnboardingViewController.xib b/Tusker/Screens/Onboarding/OnboardingViewController.xib new file mode 100644 index 00000000..628c9e08 --- /dev/null +++ b/Tusker/Screens/Onboarding/OnboardingViewController.xib @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tusker/Screens/Profile/Profile.storyboard b/Tusker/Screens/Profile/Profile.storyboard deleted file mode 100644 index c51cae35..00000000 --- a/Tusker/Screens/Profile/Profile.storyboard +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tusker/Screens/Profile/ProfileTableViewController.swift b/Tusker/Screens/Profile/ProfileTableViewController.swift index aef336ab..256f56b9 100644 --- a/Tusker/Screens/Profile/ProfileTableViewController.swift +++ b/Tusker/Screens/Profile/ProfileTableViewController.swift @@ -11,23 +11,13 @@ import Pachyderm import SafariServices class ProfileTableViewController: UITableViewController, PreferencesAdaptive { - - static func create(for accountID: String) -> ProfileTableViewController { - guard let profileController = UIStoryboard(name: "Profile", bundle: nil).instantiateInitialViewController() as? ProfileTableViewController else { fatalError() } - profileController.accountID = accountID - return profileController - } - - static func createForPending() -> ProfileTableViewController { - guard let profileController = UIStoryboard(name: "Profile", bundle: nil).instantiateInitialViewController() as? ProfileTableViewController else { fatalError() } - profileController.accountID = nil - return profileController - } var accountID: String! { didSet { if shouldLoadOnAccountIDSet { - updateAccountUI() + DispatchQueue.main.async { + self.updateAccountUI() + } } } } @@ -46,6 +36,18 @@ class ProfileTableViewController: UITableViewController, PreferencesAdaptive { var shouldLoadOnAccountIDSet = false var loadingVC: LoadingViewController? = nil + init(accountID: String?) { + super.init(style: .plain) + self.accountID = accountID + self.refreshControl = UIRefreshControl() + refreshControl!.addTarget(self, action: #selector(refreshStatuses(_:)), for: .valueChanged) + navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .compose, target: self, action: #selector(composePressed(_:))) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemeneted") + } + override func viewDidLoad() { super.viewDidLoad() @@ -113,7 +115,7 @@ class ProfileTableViewController: UITableViewController, PreferencesAdaptive { UIApplication.shared.delegate!.window!!.rootViewController!.present(vc, animated: true) })) actions.append(UIPreviewAction(title: "Send Message", style: .default, handler: { (_, _) in - let vc = ComposeViewController.create(mentioning: account.acct) + let vc = UINavigationController(rootViewController: ComposeViewController(mentioningAcct: account.acct)) UIApplication.shared.delegate!.window!!.rootViewController!.present(vc, animated: true) })) } @@ -146,7 +148,7 @@ class ProfileTableViewController: UITableViewController, PreferencesAdaptive { func sendMessageMentioning() { guard let account = MastodonCache.account(for: accountID) else { fatalError("Missing cached account \(accountID!)") } - let vc = ComposeViewController.create(mentioning: account.acct) + let vc = UINavigationController(rootViewController: ComposeViewController(mentioningAcct: account.acct)) present(vc, animated: true) } @@ -221,7 +223,7 @@ class ProfileTableViewController: UITableViewController, PreferencesAdaptive { return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.trailingSwipeActionsConfiguration() } - @IBAction func refreshStatuses(_ sender: Any) { + @objc func refreshStatuses(_ sender: Any) { guard let newer = newer else { return } getStatuses(for: newer) { response in @@ -235,7 +237,7 @@ class ProfileTableViewController: UITableViewController, PreferencesAdaptive { } } - @IBAction func composePressed(_ sender: Any) { + @objc func composePressed(_ sender: Any) { sendMessageMentioning() } diff --git a/Tusker/Screens/Timeline/Timeline.storyboard b/Tusker/Screens/Timeline/Timeline.storyboard deleted file mode 100644 index d76dbea4..00000000 --- a/Tusker/Screens/Timeline/Timeline.storyboard +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tusker/Screens/Timeline/TimelineTableViewController.swift b/Tusker/Screens/Timeline/TimelineTableViewController.swift index 85efb7a0..23ed6653 100644 --- a/Tusker/Screens/Timeline/TimelineTableViewController.swift +++ b/Tusker/Screens/Timeline/TimelineTableViewController.swift @@ -10,28 +10,6 @@ import UIKit import Pachyderm class TimelineTableViewController: UITableViewController { - - static func create(for timeline: Timeline) -> TimelineTableViewController { - guard let timelineController = UIStoryboard(name: "Timeline", bundle: nil).instantiateInitialViewController() as? TimelineTableViewController else { fatalError() } - timelineController.timeline = timeline - - let title: String - switch timeline { - case .home: - title = "Home" - case let .public(local): - title = local ? "Local" : "Federated" - case let .tag(hashtag): - title = "#\(hashtag)" - case .list: - title = "List" - case .direct: - title = "Direct" - } - timelineController.title = title - - return timelineController - } lazy var favoriteActionImage: UIImage = UIGraphicsImageRenderer(size: CGSize(width: 30 * 137/131, height: 30)).image { _ in UIImage(named: "Favorite")!.draw(in: CGRect(x: 0, y: 0, width: 30 * 137/131, height: 30)) @@ -59,6 +37,32 @@ class TimelineTableViewController: UITableViewController { var newer: RequestRange? var older: RequestRange? + init(for timeline: Timeline) { + super.init(style: .plain) + self.timeline = timeline + + switch timeline { + case .home: + title = "Home" + case let .public(local): + title = local ? "Local" : "Federated" + case let .tag(hashtag): + title = "#\(hashtag)" + case .list: + title = "List" + case .direct: + title = "Direct" + } + + self.refreshControl = UIRefreshControl() + refreshControl!.addTarget(self, action: #selector(refreshStatuses(_:)), for: .valueChanged) + self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .compose, target: self, action: #selector(composePressed(_:))) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + override func viewDidLoad() { super.viewDidLoad() @@ -149,7 +153,7 @@ class TimelineTableViewController: UITableViewController { return (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.trailingSwipeActionsConfiguration() } - @IBAction func refreshStatuses(_ sender: Any) { + @objc func refreshStatuses(_ sender: Any) { guard let newer = newer else { return } let request = MastodonController.client.getStatuses(timeline: timeline, range: newer) @@ -167,6 +171,10 @@ class TimelineTableViewController: UITableViewController { } } + @objc func composePressed(_ sender: Any) { + compose() + } + } extension TimelineTableViewController: StatusTableViewCellDelegate {} diff --git a/Tusker/Shortcuts/UserActivityManager.swift b/Tusker/Shortcuts/UserActivityManager.swift index 13b263d8..a96bd4ab 100644 --- a/Tusker/Shortcuts/UserActivityManager.swift +++ b/Tusker/Shortcuts/UserActivityManager.swift @@ -41,7 +41,7 @@ class UserActivityManager { static func handleNewPost(activity: NSUserActivity) { // TODO: check not currently showing compose screen let mentioning = activity.userInfo?["mentioning"] as? String - presentModally(ComposeViewController.create(mentioning: mentioning), animated: true) + presentModally(UINavigationController(rootViewController: ComposeViewController(mentioningAcct: mentioning)), animated: true) } // MARK: - Check Notifications diff --git a/Tusker/TuskerNavigationDelegate.swift b/Tusker/TuskerNavigationDelegate.swift index d3cb4908..3d74c8da 100644 --- a/Tusker/TuskerNavigationDelegate.swift +++ b/Tusker/TuskerNavigationDelegate.swift @@ -31,6 +31,8 @@ protocol TuskerNavigationDelegate { func selected(status statusID: String) + func compose() + func reply(to statusID: String) func viewController(forImage image: UIImage, description: String?, animatingFrom originView: UIView) -> UIViewController @@ -45,7 +47,7 @@ protocol TuskerNavigationDelegate { extension TuskerNavigationDelegate where Self: UIViewController { func viewController(forAccount accountID: String) -> UIViewController { - return ProfileTableViewController.create(for: accountID) + return ProfileTableViewController(accountID: accountID) } func selected(account accountID: String) { @@ -63,7 +65,7 @@ extension TuskerNavigationDelegate where Self: UIViewController { } func viewController(forMention mention: Mention) -> UIViewController { - return ProfileTableViewController.create(for: mention.id) + return ProfileTableViewController(accountID: mention.id) } func selected(mention: Mention) { @@ -76,7 +78,7 @@ extension TuskerNavigationDelegate where Self: UIViewController { func viewController(forTag tag: Hashtag) -> UIViewController { let timeline = Timeline.tag(hashtag: tag.name) - return TimelineTableViewController.create(for: timeline) + return TimelineTableViewController(for: timeline) } func selected(tag: Hashtag) { @@ -97,12 +99,12 @@ extension TuskerNavigationDelegate where Self: UIViewController { } func viewController(forStatus statusID: String) -> UIViewController { - return ConversationViewController.create(for: statusID) + return ConversationTableViewController(for: statusID) } func selected(status statusID: String) { // don't open if the conversation is the same as the current one - if let conversationController = self as? ConversationViewController, + if let conversationController = self as? ConversationTableViewController, conversationController.mainStatusID == statusID { return } @@ -114,8 +116,13 @@ extension TuskerNavigationDelegate where Self: UIViewController { navigationController.pushViewController(vc, animated: true) } + func compose() { + let vc = UINavigationController(rootViewController: ComposeViewController()) + present(vc, animated: true) + } + func reply(to statusID: String) { - let vc = ComposeViewController.create(inReplyTo: statusID) + let vc = UINavigationController(rootViewController: ComposeViewController(inReplyTo: statusID)) present(vc, animated: true) } @@ -123,7 +130,7 @@ extension TuskerNavigationDelegate where Self: UIViewController { guard let self = self as? UIViewController & LargeImageViewControllerDelegate else { fatalError("Can't create large image view controller unless self is LargeImageViewControllerDelegate") } - let vc = LargeImageViewController.create(image: image, description: description, sourceView: originView, sourceViewController: self) + let vc = LargeImageViewController(image: image, description: description, sourceView: originView, sourceViewController: self) vc.delegate = self return vc } diff --git a/Tusker/XCallbackURL/XCBActions.swift b/Tusker/XCallbackURL/XCBActions.swift index a59da720..b947af94 100644 --- a/Tusker/XCallbackURL/XCBActions.swift +++ b/Tusker/XCallbackURL/XCBActions.swift @@ -111,7 +111,7 @@ struct XCBActions { // MARK: - Statuses static func showStatus(_ request: XCBRequest, _ session: XCBSession, _ silent: Bool?) { getStatus(from: request, session: session) { (status) in - let vc = ConversationViewController.create(for: status.id) + let vc = ConversationTableViewController(for: status.id) DispatchQueue.main.async { presentNav(vc, animated: true) } @@ -146,7 +146,9 @@ struct XCBActions { } } } else { - let vc = ComposeViewController.create(for: session, mentioning: mentioning, text: text) + let compose = ComposeViewController(mentioningAcct: mentioning, text: text) + compose.xcbSession = session + let vc = UINavigationController(rootViewController: compose) presentModally(vc, animated: true) } } @@ -211,7 +213,7 @@ struct XCBActions { if silent ?? false { performAction(status: status, completion: nil) } else { - let vc = ConversationViewController.create(for: status.id) + let vc = ConversationTableViewController(for: status.id) DispatchQueue.main.async { presentNav(vc, animated: true) } @@ -238,7 +240,7 @@ struct XCBActions { // MARK: - Accounts static func showAccount(_ request: XCBRequest, _ session: XCBSession, _ silent: Bool?) { getAccount(from: request, session: session) { (account) in - let vc = ProfileTableViewController.create(for: account.id) + let vc = ProfileTableViewController(accountID: account.id) DispatchQueue.main.async { presentNav(vc, animated: true) } @@ -295,7 +297,7 @@ struct XCBActions { if silent ?? false { performAction(account) } else { - let vc = ProfileTableViewController.create(for: account.id) + let vc = ProfileTableViewController(accountID: account.id) DispatchQueue.main.async { presentNav(vc, animated: true) }