From c79e26b7e598af53a1b78a00af69ecff4fcf54ae Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Wed, 10 Jul 2024 07:38:13 +0200 Subject: [PATCH] Refactor code to coordinator (IOS-241) --- Mastodon/Coordinator/SceneCoordinator.swift | 3 +++ .../Notification/NotificationViewController.swift | 10 +--------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Mastodon/Coordinator/SceneCoordinator.swift b/Mastodon/Coordinator/SceneCoordinator.swift index 0e9ff6f71..e80657a17 100644 --- a/Mastodon/Coordinator/SceneCoordinator.swift +++ b/Mastodon/Coordinator/SceneCoordinator.swift @@ -207,6 +207,7 @@ extension SceneCoordinator { case settings(setting: Setting) // Notifications + case notificationPolicy(viewModel: NotificationFilterViewModel) case notificationRequests(viewModel: NotificationRequestsViewModel) // report @@ -563,6 +564,8 @@ private extension SceneCoordinator { viewController = composeViewController case .notificationRequests(let viewModel): viewController = NotificationRequestsTableViewController(viewModel: viewModel) + case .notificationPolicy(let viewModel): + viewController = NotificationPolicyViewController(viewModel: viewModel) } setupDependency(for: viewController as? NeedsDependency) diff --git a/Mastodon/Scene/Notification/NotificationViewController.swift b/Mastodon/Scene/Notification/NotificationViewController.swift index 46fee81d0..cc18c80a1 100644 --- a/Mastodon/Scene/Notification/NotificationViewController.swift +++ b/Mastodon/Scene/Notification/NotificationViewController.swift @@ -127,16 +127,8 @@ extension NotificationViewController { newAccount: policy.filterNewAccounts, privateMentions: policy.filterPrivateMentions ) - //TODO: Move to SceneCoordinator, we'd need a new case for this - let notificationPolicyViewController = NotificationPolicyViewController(viewModel: policyViewModel) - notificationPolicyViewController.modalPresentationStyle = .formSheet - let navigationController = UINavigationController(rootViewController: notificationPolicyViewController) - if let sheet = navigationController.sheetPresentationController { - sheet.detents = [.medium(), .large()] - } - - present(navigationController, animated: true) + _ = coordinator.present(scene: .notificationPolicy(viewModel: policyViewModel), transition: .formSheet) } }