@@ -290,10 +290,10 @@ final class DetailCoordinator: Coordinator {
290
290
navigationController. present ( controller, animated: true , completion: nil )
291
291
}
292
292
293
- func createPDFController( key: String , parentKey: String ? , library: Library , url: URL , page: Int ? = nil , preselectedAnnotationKey: String ? = nil ) -> NavigationViewController {
294
- let navigationController = NavigationViewController ( )
293
+ func createPDFController( key: String , parentKey: String ? , library: Library , url: URL , page: Int ? = nil , preselectedAnnotationKey: String ? = nil ) -> DetailNavigationViewController {
294
+ let navigationController = DetailNavigationViewController ( )
295
295
navigationController. modalPresentationStyle = . fullScreen
296
-
296
+
297
297
let coordinator = PDFCoordinator (
298
298
key: key,
299
299
parentKey: parentKey,
@@ -304,6 +304,7 @@ final class DetailCoordinator: Coordinator {
304
304
navigationController: navigationController,
305
305
controllers: controllers
306
306
)
307
+ navigationController. coordinator = coordinator
307
308
coordinator. parentCoordinator = self
308
309
childCoordinators. append ( coordinator)
309
310
coordinator. start ( animated: false )
@@ -315,10 +316,14 @@ final class DetailCoordinator: Coordinator {
315
316
guard let navigationController else { return }
316
317
controllers. userControllers? . openItemsController. open ( . pdf( libraryId: library. identifier, key: key) , for: sessionIdentifier)
317
318
318
- let viewControllerProvider : ( ) -> UIViewController = {
319
+ let viewControllerProvider : ( ) -> DetailNavigationViewController = {
319
320
self . createPDFController ( key: key, parentKey: parentKey, library: library, url: url)
320
321
}
321
322
if let presentedViewController = navigationController. presentedViewController {
323
+ if let presentedDetailNavigationController = presentedViewController as? DetailNavigationViewController {
324
+ presentedDetailNavigationController. replaceContents ( with: viewControllerProvider ( ) , animated: false )
325
+ return
326
+ }
322
327
guard let window = presentedViewController. view. window else { return }
323
328
show ( viewControllerProvider: viewControllerProvider, by: navigationController, in: window, animated: false )
324
329
return
@@ -471,8 +476,8 @@ extension DetailCoordinator: DetailItemsCoordinatorDelegate {
471
476
tags: [ Tag ] ,
472
477
title: NoteEditorState . TitleData ? ,
473
478
saveCallback: @escaping NoteEditorSaveCallback
474
- ) -> NavigationViewController {
475
- let navigationController = NavigationViewController ( )
479
+ ) -> DetailNavigationViewController {
480
+ let navigationController = DetailNavigationViewController ( )
476
481
navigationController. modalPresentationStyle = . fullScreen
477
482
navigationController. isModalInPresentation = true
478
483
@@ -487,6 +492,7 @@ extension DetailCoordinator: DetailItemsCoordinatorDelegate {
487
492
sessionIdentifier: sessionIdentifier,
488
493
controllers: controllers
489
494
)
495
+ navigationController. coordinator = coordinator
490
496
coordinator. parentCoordinator = self
491
497
childCoordinators. append ( coordinator)
492
498
coordinator. start ( animated: false )
@@ -947,10 +953,14 @@ extension DetailCoordinator: DetailNoteEditorCoordinatorDelegate {
947
953
controllers. userControllers? . openItemsController. open ( . note( libraryId: library. identifier, key: key) , for: sessionIdentifier)
948
954
}
949
955
950
- let viewControllerProvider : ( ) -> UIViewController = {
956
+ let viewControllerProvider : ( ) -> DetailNavigationViewController = {
951
957
self . createNoteController ( library: library, kind: kind, text: text, tags: tags, title: title, saveCallback: amendedSaveCallback)
952
958
}
953
959
if let presentedViewController = navigationController. presentedViewController {
960
+ if let presentedDetailNavigationController = presentedViewController as? DetailNavigationViewController {
961
+ presentedDetailNavigationController. replaceContents ( with: viewControllerProvider ( ) , animated: false )
962
+ return
963
+ }
954
964
guard let window = presentedViewController. view. window else { return }
955
965
show ( viewControllerProvider: viewControllerProvider, by: navigationController, in: window, animated: false )
956
966
return
0 commit comments