@@ -73,8 +73,6 @@ struct NotificationsViewRouter: NotificationsViewRouting {
73
73
nodeHierarchy: nodeHierarchy,
74
74
isInRubbishBin: isInRubbishBin
75
75
)
76
-
77
- cancelRootSearchIfNeeded ( in: navigationController)
78
76
}
79
77
80
78
private func selectTabController( in mainTBC: MainTabBarController , isOwnNode: Bool ) {
@@ -98,31 +96,57 @@ struct NotificationsViewRouter: NotificationsViewRouting {
98
96
nodeHierarchy: [ NodeEntity ] ,
99
97
isInRubbishBin: Bool
100
98
) {
101
- Task { @MainActor in
102
- let factory = CloudDriveViewControllerFactory . make ( nc: navigationController)
103
-
104
- nodeHierarchy. dropLast ( ) . forEach { node in
105
- guard let intermediateVC = factory. buildBare (
106
- parentNode: node,
107
- config: . init( displayMode: . cloudDrive)
108
- ) else {
109
- return
110
- }
111
- navigationController. addChild ( intermediateVC)
112
- }
113
-
114
- if let lastNode = nodeHierarchy. last {
115
- let displayMode : DisplayMode = isInRubbishBin ? . rubbishBin : . cloudDrive
116
- guard let lastVC = factory. buildBare (
117
- parentNode: lastNode,
118
- config: . init( displayMode: displayMode)
119
- ) else {
120
- return
121
- }
122
-
123
- navigationController. pushViewController ( lastVC, animated: false )
99
+ let factory = CloudDriveViewControllerFactory . make ( nc: navigationController)
100
+
101
+ pushIntermediateNodes (
102
+ in: navigationController,
103
+ using: factory,
104
+ nodeHierarchy: nodeHierarchy. dropLast ( )
105
+ )
106
+
107
+ pushCloudDriveViewController (
108
+ nodeHierarchy. last,
109
+ in: navigationController,
110
+ using: factory,
111
+ isInRubbishBin: isInRubbishBin
112
+ )
113
+
114
+ cancelRootSearchIfNeeded ( in: navigationController)
115
+ }
116
+
117
+ private func pushIntermediateNodes(
118
+ in navigationController: UINavigationController ,
119
+ using factory: CloudDriveViewControllerFactory ,
120
+ nodeHierarchy: [ NodeEntity ]
121
+ ) {
122
+ nodeHierarchy. forEach { node in
123
+ guard let intermediateVC = factory. buildBare (
124
+ parentNode: node,
125
+ config: . init( displayMode: . cloudDrive)
126
+ ) else {
127
+ return
124
128
}
129
+ intermediateVC. navigationItem. backButtonTitle = " "
130
+ navigationController. addChild ( intermediateVC)
131
+ }
132
+ }
133
+
134
+ private func pushCloudDriveViewController(
135
+ _ node: NodeEntity ? ,
136
+ in navigationController: UINavigationController ,
137
+ using factory: CloudDriveViewControllerFactory ,
138
+ isInRubbishBin: Bool
139
+ ) {
140
+ let displayMode : DisplayMode = isInRubbishBin ? . rubbishBin : . cloudDrive
141
+
142
+ guard let node, let lastVC = factory. buildBare (
143
+ parentNode: node,
144
+ config: . init( displayMode: displayMode)
145
+ ) else {
146
+ return
125
147
}
148
+ lastVC. navigationItem. backButtonTitle = " "
149
+ navigationController. pushViewController ( lastVC, animated: false )
126
150
}
127
151
128
152
private func resetCurrentNavigationController( ) {
0 commit comments