@@ -197,75 +197,124 @@ class MainActivity : ComponentActivity() {
197197 val rebootViewModel = mainViewModel.reboot
198198 BackHandler (enabled = mainViewModel.isRefreshing, onBack = {})
199199 val slotContentA: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
200+ val slotSuffix = " _a"
200201 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) }) {
202203 slotViewModel.clearFlash(this @MainActivity)
203204 }
204205 RefreshableScreen (mainViewModel, navController, swipeEnabled = true ) {
205- SlotContent (slotViewModel, " _a " , navController)
206+ SlotContent (slotViewModel, slotSuffix , navController)
206207 }
207208
208209 }
209210 val slotContentB: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
211+ val slotSuffix = " _b"
210212 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) }) {
212214 slotViewModel.clearFlash(this @MainActivity)
213215 }
214216 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)
216229 }
217230
218231 }
219232 val slotFlashContentA: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
233+ val slotSuffix = " _a"
220234 val slotViewModel = slotViewModelA
221235 RefreshableScreen (mainViewModel, navController) {
222- SlotFlashContent (slotViewModel!! , " _a " , navController)
236+ SlotFlashContent (slotViewModel!! , slotSuffix , navController)
223237 }
224238 }
225239 val slotFlashContentB: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
240+ val slotSuffix = " _b"
226241 val slotViewModel = slotViewModelB
227242 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)
229251 }
230252 }
231253 val slotBackupsContentA: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
254+ val slotSuffix = " _a"
232255 val slotViewModel = slotViewModelA
233256 if (backStackEntry.arguments?.getString(" backupId" ) != null ) {
234257 backupsViewModel.currentBackup = backStackEntry.arguments?.getString(" backupId" )
235258 } else {
236259 backupsViewModel.clearCurrent()
237260 }
238261 RefreshableScreen (mainViewModel, navController) {
239- SlotBackupsContent (slotViewModel!! , backupsViewModel, " _a " , navController)
262+ SlotBackupsContent (slotViewModel!! , backupsViewModel, slotSuffix , navController)
240263 }
241264 }
242265 val slotBackupsContentB: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
266+ val slotSuffix = " _b"
243267 val slotViewModel = slotViewModelB
244268 if (backStackEntry.arguments?.getString(" backupId" ) != null ) {
245269 backupsViewModel.currentBackup = backStackEntry.arguments?.getString(" backupId" )
246270 } else {
247271 backupsViewModel.clearCurrent()
248272 }
249273 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)
251287 }
252288 }
253289 val slotBackupFlashContentA: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
290+ val slotSuffix = " _a"
254291 val slotViewModel = slotViewModelA
255292 backupsViewModel.currentBackup = backStackEntry.arguments?.getString(" backupId" )
256293 if (backupsViewModel.backups.containsKey(backupsViewModel.currentBackup)) {
257294 RefreshableScreen (mainViewModel, navController) {
258- SlotFlashContent (slotViewModel!! , " _a " , navController)
295+ SlotFlashContent (slotViewModel!! , slotSuffix , navController)
259296 }
260297 }
261298
262299 }
263300 val slotBackupFlashContentB: @Composable AnimatedVisibilityScope .(NavBackStackEntry ) -> Unit = { backStackEntry ->
301+ val slotSuffix = " _b"
264302 val slotViewModel = slotViewModelB
265303 backupsViewModel.currentBackup = backStackEntry.arguments?.getString(" backupId" )
266304 if (backupsViewModel.backups.containsKey(backupsViewModel.currentBackup)) {
267305 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)
269318 }
270319 }
271320
0 commit comments