File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed
app/src/main/kotlin/com/metrolist/music/ui Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ fun CreatePlaylistDialog(
4444 onDismiss : () -> Unit ,
4545 initialTextFieldValue : String? = null,
4646 allowSyncing : Boolean = true,
47+ onPlaylistCreated : ((String ) -> Unit )? = null,
4748) {
4849 val database = LocalDatabase .current
4950 val coroutineScope = rememberCoroutineScope()
@@ -67,16 +68,18 @@ fun CreatePlaylistDialog(
6768 return @launch
6869 } else null
6970
71+ val playlistEntity = PlaylistEntity (
72+ name = playlistName,
73+ browseId = browseId,
74+ bookmarkedAt = LocalDateTime .now(),
75+ isEditable = true ,
76+ )
77+
7078 database.query {
71- insert(
72- PlaylistEntity (
73- name = playlistName,
74- browseId = browseId,
75- bookmarkedAt = LocalDateTime .now(),
76- isEditable = true ,
77- )
78- )
79+ insert(playlistEntity)
7980 }
81+
82+ onPlaylistCreated?.invoke(playlistEntity.id)
8083 }
8184 },
8285 extraContent = {
Original file line number Diff line number Diff line change @@ -206,7 +206,11 @@ fun LibraryPlaylistsScreen(
206206 CreatePlaylistDialog (
207207 onDismiss = { showCreatePlaylistDialog = false },
208208 initialTextFieldValue = initialTextFieldValue,
209- allowSyncing = allowSyncing
209+ allowSyncing = allowSyncing,
210+ onPlaylistCreated = { playlistId ->
211+ showCreatePlaylistDialog = false
212+ navController.navigate(" local_playlist/$playlistId " )
213+ }
210214 )
211215 }
212216
You can’t perform that action at this time.
0 commit comments