@@ -197,75 +197,124 @@ class MainActivity : ComponentActivity() {
197
197
val rebootViewModel = mainViewModel.reboot
198
198
BackHandler (enabled = mainViewModel.isRefreshing, onBack = {})
199
199
val slotContentA: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
200
+ val slotSuffix = " _a"
200
201
val slotViewModel = slotViewModelA
201
- if (slotViewModel!! .wasFlashSuccess != null && listOf (" slot_a " , " slot" ).any { navController.currentDestination!! .route.equals(it) }) {
202
+ if (slotViewModel!! .wasFlashSuccess != null && listOf (" slot{slotSuffix} " , " slot" ).any { navController.currentDestination!! .route.equals(it) }) {
202
203
slotViewModel.clearFlash(this @MainActivity)
203
204
}
204
205
RefreshableScreen (mainViewModel, navController, swipeEnabled = true ) {
205
- SlotContent (slotViewModel, " _a " , navController)
206
+ SlotContent (slotViewModel, slotSuffix , navController)
206
207
}
207
208
208
209
}
209
210
val slotContentB: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
211
+ val slotSuffix = " _b"
210
212
val slotViewModel = slotViewModelB
211
- if (slotViewModel!! .wasFlashSuccess != null && listOf (" slot_b " , " slot" ).any { navController.currentDestination!! .route.equals(it) }) {
213
+ if (slotViewModel!! .wasFlashSuccess != null && listOf (" slot{slotSuffix} " , " slot" ).any { navController.currentDestination!! .route.equals(it) }) {
212
214
slotViewModel.clearFlash(this @MainActivity)
213
215
}
214
216
RefreshableScreen (mainViewModel, navController, swipeEnabled = true ) {
215
- SlotContent (slotViewModel, " _b" , navController)
217
+ SlotContent (slotViewModel, slotSuffix, navController)
218
+ }
219
+
220
+ }
221
+ val slotContent: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
222
+ val slotSuffix = " "
223
+ val slotViewModel = slotViewModelA
224
+ if (slotViewModel!! .wasFlashSuccess != null && listOf (" slot{slotSuffix}" , " slot" ).any { navController.currentDestination!! .route.equals(it) }) {
225
+ slotViewModel.clearFlash(this @MainActivity)
226
+ }
227
+ RefreshableScreen (mainViewModel, navController, swipeEnabled = true ) {
228
+ SlotContent (slotViewModel, slotSuffix, navController)
216
229
}
217
230
218
231
}
219
232
val slotFlashContentA: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
233
+ val slotSuffix = " _a"
220
234
val slotViewModel = slotViewModelA
221
235
RefreshableScreen (mainViewModel, navController) {
222
- SlotFlashContent (slotViewModel!! , " _a " , navController)
236
+ SlotFlashContent (slotViewModel!! , slotSuffix , navController)
223
237
}
224
238
}
225
239
val slotFlashContentB: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
240
+ val slotSuffix = " _b"
226
241
val slotViewModel = slotViewModelB
227
242
RefreshableScreen (mainViewModel, navController) {
228
- SlotFlashContent (slotViewModel!! , " _b" , navController)
243
+ SlotFlashContent (slotViewModel!! , slotSuffix, navController)
244
+ }
245
+ }
246
+ val slotFlashContent: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
247
+ val slotSuffix = " "
248
+ val slotViewModel = slotViewModelA
249
+ RefreshableScreen (mainViewModel, navController) {
250
+ SlotFlashContent (slotViewModel!! , slotSuffix, navController)
229
251
}
230
252
}
231
253
val slotBackupsContentA: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
254
+ val slotSuffix = " _a"
232
255
val slotViewModel = slotViewModelA
233
256
if (backStackEntry.arguments?.getString(" backupId" ) != null ) {
234
257
backupsViewModel.currentBackup = backStackEntry.arguments?.getString(" backupId" )
235
258
} else {
236
259
backupsViewModel.clearCurrent()
237
260
}
238
261
RefreshableScreen (mainViewModel, navController) {
239
- SlotBackupsContent (slotViewModel!! , backupsViewModel, " _a " , navController)
262
+ SlotBackupsContent (slotViewModel!! , backupsViewModel, slotSuffix , navController)
240
263
}
241
264
}
242
265
val slotBackupsContentB: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
266
+ val slotSuffix = " _b"
243
267
val slotViewModel = slotViewModelB
244
268
if (backStackEntry.arguments?.getString(" backupId" ) != null ) {
245
269
backupsViewModel.currentBackup = backStackEntry.arguments?.getString(" backupId" )
246
270
} else {
247
271
backupsViewModel.clearCurrent()
248
272
}
249
273
RefreshableScreen (mainViewModel, navController) {
250
- SlotBackupsContent (slotViewModel!! , backupsViewModel, " _b" , navController)
274
+ SlotBackupsContent (slotViewModel!! , backupsViewModel, slotSuffix, navController)
275
+ }
276
+ }
277
+ val slotBackupsContent: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
278
+ val slotSuffix = " "
279
+ val slotViewModel = slotViewModelA
280
+ if (backStackEntry.arguments?.getString(" backupId" ) != null ) {
281
+ backupsViewModel.currentBackup = backStackEntry.arguments?.getString(" backupId" )
282
+ } else {
283
+ backupsViewModel.clearCurrent()
284
+ }
285
+ RefreshableScreen (mainViewModel, navController) {
286
+ SlotBackupsContent (slotViewModel!! , backupsViewModel, slotSuffix, navController)
251
287
}
252
288
}
253
289
val slotBackupFlashContentA: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
290
+ val slotSuffix = " _a"
254
291
val slotViewModel = slotViewModelA
255
292
backupsViewModel.currentBackup = backStackEntry.arguments?.getString(" backupId" )
256
293
if (backupsViewModel.backups.containsKey(backupsViewModel.currentBackup)) {
257
294
RefreshableScreen (mainViewModel, navController) {
258
- SlotFlashContent (slotViewModel!! , " _a " , navController)
295
+ SlotFlashContent (slotViewModel!! , slotSuffix , navController)
259
296
}
260
297
}
261
298
262
299
}
263
300
val slotBackupFlashContentB: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
301
+ val slotSuffix = " _b"
264
302
val slotViewModel = slotViewModelB
265
303
backupsViewModel.currentBackup = backStackEntry.arguments?.getString(" backupId" )
266
304
if (backupsViewModel.backups.containsKey(backupsViewModel.currentBackup)) {
267
305
RefreshableScreen (mainViewModel, navController) {
268
- SlotFlashContent (slotViewModel!! , " _b" , navController)
306
+ SlotFlashContent (slotViewModel!! , slotSuffix, navController)
307
+ }
308
+ }
309
+
310
+ }
311
+ val slotBackupFlashContent: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
312
+ val slotSuffix = " "
313
+ val slotViewModel = slotViewModelA
314
+ backupsViewModel.currentBackup = backStackEntry.arguments?.getString(" backupId" )
315
+ if (backupsViewModel.backups.containsKey(backupsViewModel.currentBackup)) {
316
+ RefreshableScreen (mainViewModel, navController) {
317
+ SlotFlashContent (slotViewModel!! , slotSuffix, navController)
269
318
}
270
319
}
271
320
0 commit comments