From 30449a2875cb9deeaccf8058d96707420a675f01 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 16 Apr 2023 13:47:48 -0400 Subject: [PATCH] Rename NewComposeHostingController to ComposeHostingController --- Tusker.xcodeproj/project.pbxproj | 8 ++++---- Tusker/Scenes/ComposeSceneDelegate.swift | 6 +++--- ...ntroller.swift => ComposeHostingController.swift} | 12 ++++++------ Tusker/Screens/Main/Duckable+Root.swift | 2 +- Tusker/Screens/Main/MainTabBarViewController.swift | 4 ++-- Tusker/TuskerNavigationDelegate.swift | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) rename Tusker/Screens/Compose/{NewComposeHostingController.swift => ComposeHostingController.swift} (95%) diff --git a/Tusker.xcodeproj/project.pbxproj b/Tusker.xcodeproj/project.pbxproj index 7a33d5a4..22ddb86f 100644 --- a/Tusker.xcodeproj/project.pbxproj +++ b/Tusker.xcodeproj/project.pbxproj @@ -276,7 +276,7 @@ D6BC9DD7232D7811002CA326 /* TimelinesPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6BC9DD6232D7811002CA326 /* TimelinesPageViewController.swift */; }; D6BC9DDA232D8BE5002CA326 /* SearchResultsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6BC9DD9232D8BE5002CA326 /* SearchResultsViewController.swift */; }; D6BD395929B64426005FFD2B /* ComposeUI in Frameworks */ = {isa = PBXBuildFile; productRef = D6BD395829B64426005FFD2B /* ComposeUI */; }; - D6BD395B29B64441005FFD2B /* NewComposeHostingController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6BD395A29B64441005FFD2B /* NewComposeHostingController.swift */; }; + D6BD395B29B64441005FFD2B /* ComposeHostingController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6BD395A29B64441005FFD2B /* ComposeHostingController.swift */; }; D6BEA245291A0EDE002F4D01 /* Duckable in Frameworks */ = {isa = PBXBuildFile; productRef = D6BEA244291A0EDE002F4D01 /* Duckable */; }; D6BEA247291A0F2D002F4D01 /* Duckable+Root.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6BEA246291A0F2D002F4D01 /* Duckable+Root.swift */; }; D6BED174212667E900F02DA0 /* TimelineStatusTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6BED173212667E900F02DA0 /* TimelineStatusTableViewCell.swift */; }; @@ -672,7 +672,7 @@ D6BC9DD6232D7811002CA326 /* TimelinesPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelinesPageViewController.swift; sourceTree = ""; }; D6BC9DD9232D8BE5002CA326 /* SearchResultsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchResultsViewController.swift; sourceTree = ""; }; D6BD395729B6441F005FFD2B /* ComposeUI */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = ComposeUI; path = Packages/ComposeUI; sourceTree = ""; }; - D6BD395A29B64441005FFD2B /* NewComposeHostingController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewComposeHostingController.swift; sourceTree = ""; }; + D6BD395A29B64441005FFD2B /* ComposeHostingController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeHostingController.swift; sourceTree = ""; }; D6BD395C29B789D5005FFD2B /* TuskerComponents */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = TuskerComponents; path = Packages/TuskerComponents; sourceTree = ""; }; D6BEA243291A0C83002F4D01 /* Duckable */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Duckable; path = Packages/Duckable; sourceTree = ""; }; D6BEA246291A0F2D002F4D01 /* Duckable+Root.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Duckable+Root.swift"; sourceTree = ""; }; @@ -1089,7 +1089,7 @@ children = ( D68232F62464F4FD00325FB8 /* ComposeDrawingViewController.swift */, D62275A724F1CA2800B82A16 /* ComposeReplyContentView.swift */, - D6BD395A29B64441005FFD2B /* NewComposeHostingController.swift */, + D6BD395A29B64441005FFD2B /* ComposeHostingController.swift */, ); path = Compose; sourceTree = ""; @@ -1923,7 +1923,7 @@ D6412B0324AFF6A600F5412E /* TabBarScrollableViewController.swift in Sources */, D6093FB725BE0CF3004811E6 /* TrendHistoryView.swift in Sources */, D6EBF01723C55E0D00AE061B /* UISceneSession+MastodonController.swift in Sources */, - D6BD395B29B64441005FFD2B /* NewComposeHostingController.swift in Sources */, + D6BD395B29B64441005FFD2B /* ComposeHostingController.swift in Sources */, D61F759229365C6C00C0B37F /* CollectionViewController.swift in Sources */, D6DD996B2998611A0015C962 /* SuggestedProfilesViewController.swift in Sources */, D6DD8FFD298495A8002AD3FD /* LogoutService.swift in Sources */, diff --git a/Tusker/Scenes/ComposeSceneDelegate.swift b/Tusker/Scenes/ComposeSceneDelegate.swift index 79c6fcae..339c6253 100644 --- a/Tusker/Scenes/ComposeSceneDelegate.swift +++ b/Tusker/Scenes/ComposeSceneDelegate.swift @@ -59,7 +59,7 @@ class ComposeSceneDelegate: UIResponder, UIWindowSceneDelegate, TuskerSceneDeleg session.mastodonController = controller controller.initialize() - let composeVC = NewComposeHostingController(draft: draft, mastodonController: controller) + let composeVC = ComposeHostingController(draft: draft, mastodonController: controller) composeVC.delegate = self let nav = EnhancedNavigationViewController(rootViewController: composeVC) @@ -81,7 +81,7 @@ class ComposeSceneDelegate: UIResponder, UIWindowSceneDelegate, TuskerSceneDeleg if let window = window, let nav = window.rootViewController as? UINavigationController, - let compose = nav.topViewController as? NewComposeHostingController { + let compose = nav.topViewController as? ComposeHostingController { scene.userActivity = UserActivityManager.editDraftActivity(id: compose.controller.draft.id, accountID: scene.session.mastodonController!.accountInfo!.id) } } @@ -109,7 +109,7 @@ class ComposeSceneDelegate: UIResponder, UIWindowSceneDelegate, TuskerSceneDeleg } -extension ComposeSceneDelegate: NewComposeHostingControllerDelegate { +extension ComposeSceneDelegate: ComposeHostingControllerDelegate { func dismissCompose(mode: DismissMode) -> Bool { let animation: UIWindowScene.DismissalAnimation switch mode { diff --git a/Tusker/Screens/Compose/NewComposeHostingController.swift b/Tusker/Screens/Compose/ComposeHostingController.swift similarity index 95% rename from Tusker/Screens/Compose/NewComposeHostingController.swift rename to Tusker/Screens/Compose/ComposeHostingController.swift index 77e3441a..8ccfdc9c 100644 --- a/Tusker/Screens/Compose/NewComposeHostingController.swift +++ b/Tusker/Screens/Compose/ComposeHostingController.swift @@ -1,5 +1,5 @@ // -// NewComposeHostingController.swift +// ComposeHostingController.swift // Tusker // // Created by Shadowfacts on 3/6/23. @@ -15,13 +15,13 @@ import Pachyderm import CoreData import Duckable -protocol NewComposeHostingControllerDelegate: AnyObject { +protocol ComposeHostingControllerDelegate: AnyObject { func dismissCompose(mode: DismissMode) -> Bool } -class NewComposeHostingController: UIHostingController, DuckableViewController { +class ComposeHostingController: UIHostingController, DuckableViewController { - weak var delegate: NewComposeHostingControllerDelegate? + weak var delegate: ComposeHostingControllerDelegate? weak var duckableDelegate: DuckableViewControllerDelegate? let controller: ComposeController @@ -200,7 +200,7 @@ extension MastodonController: ComposeMastodonContext { } } -extension NewComposeHostingController: PHPickerViewControllerDelegate { +extension ComposeHostingController: PHPickerViewControllerDelegate { func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) { dismiss(animated: true) @@ -209,7 +209,7 @@ extension NewComposeHostingController: PHPickerViewControllerDelegate { } } -extension NewComposeHostingController: ComposeDrawingViewControllerDelegate { +extension ComposeHostingController: ComposeDrawingViewControllerDelegate { func composeDrawingViewControllerClose(_ drawingController: ComposeDrawingViewController) { dismiss(animated: true) drawingCompletion = nil diff --git a/Tusker/Screens/Main/Duckable+Root.swift b/Tusker/Screens/Main/Duckable+Root.swift index a10e40bd..b349f104 100644 --- a/Tusker/Screens/Main/Duckable+Root.swift +++ b/Tusker/Screens/Main/Duckable+Root.swift @@ -14,7 +14,7 @@ import ComposeUI extension DuckableContainerViewController: TuskerRootViewController { func stateRestorationActivity() -> NSUserActivity? { var activity = (child as? TuskerRootViewController)?.stateRestorationActivity() - if let compose = duckedViewController as? NewComposeHostingController, + if let compose = duckedViewController as? ComposeHostingController, compose.controller.draft.hasContent { activity = UserActivityManager.addDuckedDraft(to: activity, draft: compose.controller.draft) } diff --git a/Tusker/Screens/Main/MainTabBarViewController.swift b/Tusker/Screens/Main/MainTabBarViewController.swift index f989444e..6fb73312 100644 --- a/Tusker/Screens/Main/MainTabBarViewController.swift +++ b/Tusker/Screens/Main/MainTabBarViewController.swift @@ -224,7 +224,7 @@ extension MainTabBarViewController { case .notifications: return NotificationsPageViewController(mastodonController: mastodonController) case .compose: - return NewComposeHostingController(draft: nil, mastodonController: mastodonController) + return ComposeHostingController(draft: nil, mastodonController: mastodonController) case .explore: return ExploreViewController(mastodonController: mastodonController) case .myProfile: @@ -274,7 +274,7 @@ extension MainTabBarViewController: StateRestorableViewController { func stateRestorationActivity() -> NSUserActivity? { var activity: NSUserActivity? if let presentedNav = presentedViewController as? UINavigationController, - let compose = presentedNav.viewControllers.first as? NewComposeHostingController { + let compose = presentedNav.viewControllers.first as? ComposeHostingController { let draft = compose.controller.draft activity = UserActivityManager.editDraftActivity(id: draft.id, accountID: draft.accountID) } else if let vc = (selectedViewController as! UINavigationController).topViewController as? StateRestorableViewController { diff --git a/Tusker/TuskerNavigationDelegate.swift b/Tusker/TuskerNavigationDelegate.swift index 29b57cde..f2f86b1c 100644 --- a/Tusker/TuskerNavigationDelegate.swift +++ b/Tusker/TuskerNavigationDelegate.swift @@ -98,7 +98,7 @@ extension TuskerNavigationDelegate { options.preferredPresentationStyle = .prominent UIApplication.shared.requestSceneSessionActivation(nil, userActivity: compose, options: options, errorHandler: nil) } else { - let compose = NewComposeHostingController(draft: draft, mastodonController: apiController) + let compose = ComposeHostingController(draft: draft, mastodonController: apiController) if #available(iOS 16.0, *), presentDuckable(compose, animated: animated, isDucked: isDucked) { return