@@ -13,7 +13,6 @@ final class DebugScreenCoordinator: BaseCoordinator {
1313 // MARK: - Private properties
1414
1515 private let router = MainRouter ( )
16- private let navigationController = UINavigationController ( )
1716
1817 // MARK: - Properties
1918
@@ -22,49 +21,48 @@ final class DebugScreenCoordinator: BaseCoordinator {
2221 // MARK: - Methods
2322
2423 override func start( ) {
25- var components : MainModuleComponents = MainModuleConfigurator ( ) . configure ( )
26- navigationController. setViewControllers ( [ components. view] , animated: false )
27- navigationController. modalPresentationStyle = . overFullScreen
28-
29- components. output. didModuleClosed = { [ weak self] in
30- self ? . navigationController. dismiss ( animated: true ,
31- completion: self ? . completionHandler)
32- }
33-
34- components. output. didActionOptionsShowed = { [ weak self] model in
35- self ? . showCacheCleaningActions ( model: model)
36- }
37-
38- router. present ( navigationController)
24+ showMainScreen ( )
3925 }
26+
4027}
4128
4229// MARK: - Private methods
4330
4431private extension DebugScreenCoordinator {
4532
33+ func showMainScreen( ) {
34+ let ( view, output) = MainModuleConfigurator ( ) . configure ( )
35+ output. didModuleClosed = { [ weak self] in
36+ self ? . router. dismissModule ( )
37+ }
38+ output. didActionOptionsShowed = { [ weak self] model in
39+ self ? . showCacheCleaningActions ( model: model)
40+ }
41+ output. didModuleDismissed = { [ weak self] in
42+ self ? . completionHandler ? ( )
43+ }
44+ router. present ( view)
45+ }
46+
4647 func showCacheCleaningActions( model: ActionsProviderModel ) {
4748 let actionsSheet = UIAlertController (
4849 title: nil ,
4950 message: model. message,
5051 preferredStyle: . actionSheet
5152 )
52-
5353 model. actions. forEach { action in
5454 actionsSheet. addAction ( UIAlertAction (
5555 title: action. title,
5656 style: . destructive) { _ in
5757 action. block ( )
5858 } )
5959 }
60-
6160 actionsSheet. addAction ( UIAlertAction (
6261 title: L10n . DebugScreenCoordinator. cancelAction,
6362 style: . cancel,
6463 handler: nil
6564 ) )
66-
67- self . navigationController. present ( actionsSheet, animated: true , completion: nil )
65+ router. present ( actionsSheet)
6866 }
6967
7068}
0 commit comments