@@ -17,7 +17,7 @@ import UIKit
17
17
Application coordinator managing split view and two navigation contexts.
18
18
*/
19
19
final class ApplicationCoordinator : Coordinator , Presenting , @preconcurrency RootContainerViewControllerDelegate ,
20
- UISplitViewControllerDelegate , @ preconcurrency ApplicationRouterDelegate ,
20
+ UISplitViewControllerDelegate , ApplicationRouterDelegate ,
21
21
@preconcurrency NotificationManagerDelegate {
22
22
typealias RouteType = AppRoute
23
23
@@ -234,7 +234,7 @@ final class ApplicationCoordinator: Coordinator, Presenting, @preconcurrency Roo
234
234
func applicationRouter(
235
235
_ router: ApplicationRouter < RouteType > ,
236
236
handleSubNavigationWithContext context: RouteSubnavigationContext < RouteType > ,
237
- completion: @escaping @Sendable @ MainActor ( ) -> Void
237
+ completion: @escaping @Sendable ( ) -> Void
238
238
) {
239
239
switch context. route {
240
240
case let . settings( subRoute) :
@@ -309,10 +309,10 @@ final class ApplicationCoordinator: Coordinator, Presenting, @preconcurrency Roo
309
309
310
310
private func didDismissAccount( _ reason: AccountDismissReason ) {
311
311
if reason == . userLoggedOut {
312
- router. dismissAll ( . primary, animated: false )
312
+ router. dismiss ( group : . primary, animated: false )
313
313
continueFlow ( animated: false )
314
314
}
315
- router. dismiss ( . account, animated: true )
315
+ router. dismiss ( route : . account, animated: true )
316
316
}
317
317
318
318
private func presentTOS( animated: Bool , completion: @escaping ( Coordinator ) -> Void ) {
@@ -337,14 +337,13 @@ final class ApplicationCoordinator: Coordinator, Presenting, @preconcurrency Roo
337
337
)
338
338
339
339
coordinator. didFinish = { [ weak self] _ in
340
- self ? . router. dismiss ( . changelog, animated: animated)
340
+ self ? . router. dismiss ( route : . changelog, animated: animated)
341
341
}
342
342
343
343
coordinator. start ( animated: false )
344
+ presentChild ( coordinator, animated: animated)
344
345
345
- presentChild ( coordinator, animated: animated) {
346
- completion ( coordinator)
347
- }
346
+ completion ( coordinator)
348
347
}
349
348
350
349
private func presentMain( animated: Bool , completion: @escaping ( Coordinator ) -> Void ) {
@@ -389,7 +388,7 @@ final class ApplicationCoordinator: Coordinator, Presenting, @preconcurrency Roo
389
388
390
389
Task { @MainActor in
391
390
if shouldDismissOutOfTime ( ) {
392
- router. dismiss ( . outOfTime, animated: true )
391
+ router. dismiss ( route : . outOfTime, animated: true )
393
392
continueFlow ( animated: true )
394
393
}
395
394
}
@@ -411,12 +410,12 @@ final class ApplicationCoordinator: Coordinator, Presenting, @preconcurrency Roo
411
410
coordinator. didFinish = { [ weak self] in
412
411
guard let self else { return }
413
412
appPreferences. isShownOnboarding = true
414
- router. dismiss ( . welcome, animated: false )
413
+ router. dismiss ( route : . welcome, animated: false )
415
414
continueFlow ( animated: false )
416
415
}
417
416
coordinator. didLogout = { [ weak self] preferredAccountNumber in
418
417
guard let self else { return }
419
- router. dismissAll ( . primary, animated: true )
418
+ router. dismiss ( group : . primary, animated: true )
420
419
DispatchQueue . main. async {
421
420
self . continueFlow ( animated: true )
422
421
}
@@ -435,11 +434,11 @@ final class ApplicationCoordinator: Coordinator, Presenting, @preconcurrency Roo
435
434
436
435
private func presentSelectLocation( animated: Bool , completion: @escaping ( Coordinator ) -> Void ) {
437
436
let coordinator = makeLocationCoordinator ( forModalPresentation: true )
437
+
438
438
coordinator. start ( )
439
+ presentChild ( coordinator, animated: animated)
439
440
440
- presentChild ( coordinator, animated: animated) {
441
- completion ( coordinator)
442
- }
441
+ completion ( coordinator)
443
442
}
444
443
445
444
private func presentLogin( animated: Bool , completion: @escaping ( Coordinator ) -> Void ) {
@@ -477,14 +476,13 @@ final class ApplicationCoordinator: Coordinator, Presenting, @preconcurrency Roo
477
476
let coordinator = AlertCoordinator ( presentation: metadata. presentation)
478
477
479
478
coordinator. didFinish = { [ weak self] in
480
- self ? . router. dismiss ( context. route)
479
+ self ? . router. dismiss ( route : context. route)
481
480
}
482
481
483
482
coordinator. start ( )
483
+ metadata. context. presentChild ( coordinator, animated: animated)
484
484
485
- metadata. context. presentChild ( coordinator, animated: animated) {
486
- completion ( coordinator)
487
- }
485
+ completion ( coordinator)
488
486
}
489
487
490
488
private func makeTunnelCoordinator( ) -> TunnelCoordinator {
@@ -515,7 +513,7 @@ final class ApplicationCoordinator: Coordinator, Presenting, @preconcurrency Roo
515
513
516
514
locationCoordinator. didFinish = { [ weak self] _ in
517
515
if isModalPresentation {
518
- self ? . router. dismiss ( . selectLocation, animated: true )
516
+ self ? . router. dismiss ( route : . selectLocation, animated: true )
519
517
}
520
518
}
521
519
@@ -541,14 +539,11 @@ final class ApplicationCoordinator: Coordinator, Presenting, @preconcurrency Roo
541
539
542
540
coordinator. start ( animated: animated)
543
541
544
- presentChild (
545
- coordinator,
546
- animated: animated
547
- ) { [ weak self] in
548
- completion ( coordinator)
549
-
542
+ presentChild ( coordinator, animated: animated) { [ weak self] in
550
543
self ? . onShowAccount ? ( )
551
544
}
545
+
546
+ completion ( coordinator)
552
547
}
553
548
554
549
private func presentSettings(
@@ -579,7 +574,7 @@ final class ApplicationCoordinator: Coordinator, Presenting, @preconcurrency Roo
579
574
580
575
coordinator. didFinish = { [ weak self] _ in
581
576
Task { @MainActor in
582
- self ? . router. dismissAll ( . settings, animated: true )
577
+ self ? . router. dismiss ( group : . settings, animated: true )
583
578
}
584
579
}
585
580
@@ -590,13 +585,9 @@ final class ApplicationCoordinator: Coordinator, Presenting, @preconcurrency Roo
590
585
}
591
586
592
587
coordinator. start ( initialRoute: route)
588
+ presentChild ( coordinator, animated: animated)
593
589
594
- presentChild (
595
- coordinator,
596
- animated: animated
597
- ) {
598
- completion ( coordinator)
599
- }
590
+ completion ( coordinator)
600
591
}
601
592
602
593
private func presentDAITA( animated: Bool , completion: @escaping @Sendable ( Coordinator ) -> Void ) {
@@ -608,14 +599,13 @@ final class ApplicationCoordinator: Coordinator, Presenting, @preconcurrency Roo
608
599
)
609
600
610
601
coordinator. didFinish = { [ weak self] _ in
611
- self ? . router. dismiss ( . daita, animated: true )
602
+ self ? . router. dismiss ( route : . daita, animated: true )
612
603
}
613
604
614
605
coordinator. start ( animated: animated)
606
+ presentChild ( coordinator, animated: animated)
615
607
616
- presentChild ( coordinator, animated: animated) {
617
- completion ( coordinator)
618
- }
608
+ completion ( coordinator)
619
609
}
620
610
621
611
private func addTunnelObserver( ) {
@@ -654,7 +644,7 @@ final class ApplicationCoordinator: Coordinator, Presenting, @preconcurrency Roo
654
644
case ( true , false ) :
655
645
updateOutOfTimeTimer ( accountData: accountData)
656
646
continueFlow ( animated: true )
657
- router. dismiss ( . outOfTime, animated: true )
647
+ router. dismiss ( route : . outOfTime, animated: true )
658
648
// account was expired
659
649
case ( false , true ) :
660
650
router. present ( . outOfTime, animated: true )
@@ -757,7 +747,7 @@ final class ApplicationCoordinator: Coordinator, Presenting, @preconcurrency Roo
757
747
}
758
748
759
749
func splitViewControllerDidExpand( _ svc: UISplitViewController ) {
760
- router. dismissAll ( . selectLocation, animated: false )
750
+ router. dismiss ( group : . selectLocation, animated: false )
761
751
}
762
752
763
753
// MARK: - RootContainerViewControllerDelegate
@@ -836,4 +826,4 @@ extension DeviceState {
836
826
var splitViewMode : UISplitViewController . DisplayMode {
837
827
isLoggedIn ? UISplitViewController . DisplayMode. oneBesideSecondary : . secondaryOnly
838
828
}
839
- }
829
+ } // swiftlint:disable:this file_length
0 commit comments