Refactor code to coordinator (IOS-241)

This commit is contained in:
Nathan Mattes 2024-07-10 07:38:13 +02:00
parent ed4a003a74
commit c79e26b7e5
2 changed files with 4 additions and 9 deletions

View File

@ -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)

View File

@ -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)
}
}