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