@@ -13,9 +13,9 @@ import androidx.navigation.compose.rememberNavController
13
13
import androidx.navigation.toRoute
14
14
import com.sosauce.cutemusic.data.actions.MetadataActions
15
15
import com.sosauce.cutemusic.data.actions.PlayerActions
16
- import com.sosauce.cutemusic.data.datastore.rememberAllBlacklistedFolders
17
16
import com.sosauce.cutemusic.ui.screens.album.AlbumDetailsScreen
18
17
import com.sosauce.cutemusic.ui.screens.album.AlbumsScreen
18
+ import com.sosauce.cutemusic.ui.screens.all_folders.AllFoldersScreen
19
19
import com.sosauce.cutemusic.ui.screens.artist.ArtistDetails
20
20
import com.sosauce.cutemusic.ui.screens.artist.ArtistsScreen
21
21
import com.sosauce.cutemusic.ui.screens.blacklisted.BlacklistedScreen
@@ -39,25 +39,21 @@ fun Nav() {
39
39
val viewModel = koinViewModel<MusicViewModel >()
40
40
val postViewModel = koinViewModel<PostViewModel >()
41
41
val metadataViewModel = koinViewModel<MetadataViewModel >()
42
- val blacklistedFolders by rememberAllBlacklistedFolders()
43
42
val musics = postViewModel.musics
44
43
val musicState by viewModel.musicState.collectAsStateWithLifecycle()
44
+ val folders = postViewModel.folders
45
45
46
46
47
47
SharedTransitionLayout {
48
-
49
- this
50
48
NavHost (
51
49
navController = navController,
52
50
startDestination = Screen .Main
53
51
) {
54
-
55
- this @SharedTransitionLayout
56
52
composable<Screen .Main > {
57
53
MainScreen (
58
54
musics = musics,
59
55
selectedIndex = viewModel.selectedItem,
60
- onNavigateTo = { navController.navigate(it) },
56
+ onNavigate = { navController.navigate(it) },
61
57
currentlyPlaying = musicState.currentlyPlaying,
62
58
isCurrentlyPlaying = musicState.isCurrentlyPlaying,
63
59
onShortClick = { viewModel.handlePlayerActions(PlayerActions .StartPlayback (it)) },
@@ -68,15 +64,16 @@ fun Nav() {
68
64
}
69
65
},
70
66
animatedVisibilityScope = this ,
71
- onLoadMetadata = { uri ->
67
+ onLoadMetadata = { path, uri ->
72
68
metadataViewModel.onHandleMetadataActions(MetadataActions .ClearState )
73
69
metadataViewModel.onHandleMetadataActions(
74
70
MetadataActions .LoadSong (
71
+ path,
75
72
uri
76
73
)
77
74
)
78
75
},
79
- isPlayerReady = viewModel .isPlayerReady() ,
76
+ isPlayerReady = musicState .isPlayerReady,
80
77
currentMusicUri = musicState.currentMusicUri,
81
78
onHandlePlayerAction = { viewModel.handlePlayerActions(it) },
82
79
onDeleteMusic = { uris, intentSender ->
@@ -124,7 +121,7 @@ fun Nav() {
124
121
},
125
122
currentlyPlaying = musicState.currentlyPlaying,
126
123
chargePVMAlbumSongs = postViewModel::albumSongs,
127
- isPlayerReady = viewModel .isPlayerReady() ,
124
+ isPlayerReady = musicState .isPlayerReady,
128
125
isPlaying = musicState.isCurrentlyPlaying,
129
126
onHandlePlayerActions = viewModel::handlePlayerActions,
130
127
onNavigate = { navController.navigate(it) },
@@ -157,7 +154,7 @@ fun Nav() {
157
154
onHandlePlayerActions = viewModel::handlePlayerActions,
158
155
isPlaying = musicState.isCurrentlyPlaying,
159
156
animatedVisibilityScope = this ,
160
- isPlayerReady = viewModel .isPlayerReady() ,
157
+ isPlayerReady = musicState .isPlayerReady,
161
158
onHandleSorting = { sortingType ->
162
159
postViewModel.handleFiltering(
163
160
listToHandle = ListToHandle .ARTISTS ,
@@ -245,6 +242,25 @@ fun Nav() {
245
242
)
246
243
}
247
244
}
245
+
246
+ composable<Screen .AllFolders > {
247
+ AllFoldersScreen (
248
+ musics = musics,
249
+ onNavigationItemClicked = { index, item ->
250
+ navController.navigate(item.navigateTo) {
251
+ viewModel.selectedItem = index
252
+ launchSingleTop = true
253
+ }
254
+ },
255
+ selectedIndex = viewModel.selectedItem,
256
+ onNavigate = { navController.navigate(it) },
257
+ currentlyPlaying = musicState.currentlyPlaying,
258
+ isCurrentlyPlaying = musicState.isCurrentlyPlaying,
259
+ onHandlePlayerActions = viewModel::handlePlayerActions,
260
+ isPlayerReady = musicState.isPlayerReady,
261
+ animatedVisibilityScope = this ,
262
+ )
263
+ }
248
264
}
249
265
}
250
266
}
0 commit comments