Update dependencies

This commit is contained in:
vfsfitvnm 2022-06-27 21:14:50 +02:00
parent 1606885f71
commit 697c6b6379
6 changed files with 22 additions and 21 deletions

View file

@ -208,7 +208,7 @@ val Database.internal: RoomDatabase
get() = DatabaseInitializer.Instance
fun Database.checkpoint() {
internal.openHelper.writableDatabase.run {
internal.getOpenHelper().writableDatabase.run {
query("PRAGMA journal_mode").use { cursor ->
if (cursor.moveToFirst()) {
when (cursor.getString(0).lowercase()) {

View file

@ -195,7 +195,7 @@ class PlayerService : Service(), Player.Listener, PlaybackStatsListener.Callback
val mediaItemIndex = player.currentMediaItemIndex
val mediaItemPosition = player.currentPosition
Database.internal.queryExecutor.execute {
Database.internal.getQueryExecutor().execute {
Database.clearQueue()
Database.insertQueue(
mediaItems.mapIndexed { index, mediaItem ->
@ -226,7 +226,7 @@ class PlayerService : Service(), Player.Listener, PlaybackStatsListener.Callback
val mediaItem =
eventTime.timeline.getWindow(eventTime.windowIndex, Timeline.Window()).mediaItem
Database.internal.queryExecutor.execute {
Database.internal.getQueryExecutor().execute {
Database.incrementTotalPlayTimeMs(mediaItem.mediaId, playbackStats.totalPlayTimeMs)
}
}
@ -443,7 +443,7 @@ class PlayerService : Service(), Player.Listener, PlaybackStatsListener.Callback
}
mediaItem?.let {
Database.internal.queryExecutor.execute {
Database.internal.getQueryExecutor().execute {
Database.insert(it)
}
}

View file

@ -37,8 +37,7 @@ import kotlinx.coroutines.launch
fun InFavoritesMediaItemMenu(
song: SongWithInfo,
modifier: Modifier = Modifier,
// https://issuetracker.google.com/issues/226410236
onDismiss: () -> Unit = LocalMenuState.current.let { it::hide }
onDismiss: (() -> Unit)? = null
) {
val coroutineScope = rememberCoroutineScope()
@ -59,9 +58,9 @@ fun InFavoritesMediaItemMenu(
fun InHistoryMediaItemMenu(
song: SongWithInfo,
modifier: Modifier = Modifier,
// https://issuetracker.google.com/issues/226410236
onDismiss: () -> Unit = LocalMenuState.current.let { it::hide }
onDismiss: (() -> Unit)? = null
) {
val menuState = LocalMenuState.current
val binder = LocalPlayerServiceBinder.current
val coroutineScope = rememberCoroutineScope()
@ -77,7 +76,7 @@ fun InHistoryMediaItemMenu(
isDeletingFromDatabase = false
},
onConfirm = {
onDismiss()
(onDismiss ?: menuState::hide).invoke()
binder?.cache?.removeResource(song.song.id)
coroutineScope.launch(Dispatchers.IO) {
Database.delete(song.song)
@ -103,8 +102,7 @@ fun InPlaylistMediaItemMenu(
positionInPlaylist: Int,
song: SongWithInfo,
modifier: Modifier = Modifier,
// https://issuetracker.google.com/issues/226410236
onDismiss: () -> Unit = LocalMenuState.current.let { it::hide }
onDismiss: (() -> Unit)? = null
) {
val coroutineScope = rememberCoroutineScope()
@ -137,17 +135,17 @@ fun InPlaylistMediaItemMenu(
fun NonQueuedMediaItemMenu(
mediaItem: MediaItem,
modifier: Modifier = Modifier,
// https://issuetracker.google.com/issues/226410236
onDismiss: () -> Unit = LocalMenuState.current.let { it::hide },
onDismiss: (() -> Unit)? = null,
onRemoveFromPlaylist: (() -> Unit)? = null,
onDeleteFromDatabase: (() -> Unit)? = null,
onRemoveFromFavorites: (() -> Unit)? = null,
) {
val menuState = LocalMenuState.current
val binder = LocalPlayerServiceBinder.current
BaseMediaItemMenu(
mediaItem = mediaItem,
onDismiss = onDismiss,
onDismiss = onDismiss ?: menuState::hide,
onStartRadio = {
binder?.player?.forcePlay(mediaItem)
binder?.setupRadio(
@ -179,15 +177,15 @@ fun QueuedMediaItemMenu(
mediaItem: MediaItem,
indexInQueue: Int,
modifier: Modifier = Modifier,
// https://issuetracker.google.com/issues/226410236
onDismiss: () -> Unit = LocalMenuState.current.let { it::hide },
onDismiss: (() -> Unit)? = null,
onGlobalRouteEmitted: (() -> Unit)? = null
) {
val menuState = LocalMenuState.current
val player = LocalPlayerServiceBinder.current?.player
BaseMediaItemMenu(
mediaItem = mediaItem,
onDismiss = onDismiss,
onDismiss = onDismiss ?: menuState::hide,
onRemoveFromQueue = {
player?.removeMediaItem(indexInQueue)
},

View file

@ -1,6 +1,7 @@
package it.vfsfitvnm.vimusic.ui.screens
import android.net.Uri
import android.util.Log
import androidx.compose.animation.*
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image
@ -85,6 +86,8 @@ fun HomeScreen() {
}
}.collectAsState(initial = emptyList(), context = Dispatchers.IO)
Log.d("HomeScreen", "songCollection: ${songCollection.size}")
RouteHandler(
listenToGlobalEmitter = true,
transitionSpec = {

View file

@ -77,7 +77,7 @@ fun BackupAndRestoreScreen() {
Database.checkpoint()
context.applicationContext.contentResolver.openOutputStream(uri)
?.use { outputStream ->
FileInputStream(Database.internal.openHelper.writableDatabase.path).use { inputStream ->
FileInputStream(Database.internal.getOpenHelper().writableDatabase.path).use { inputStream ->
inputStream.copyTo(outputStream)
}
}
@ -91,7 +91,7 @@ fun BackupAndRestoreScreen() {
coroutineScope.launch(Dispatchers.IO) {
Database.internal.close()
FileOutputStream(Database.internal.openHelper.writableDatabase.path).use { outputStream ->
FileOutputStream(Database.internal.getOpenHelper().writableDatabase.path).use { outputStream ->
context.applicationContext.contentResolver.openInputStream(uri)
?.use { inputStream ->
inputStream.copyTo(outputStream)

View file

@ -28,10 +28,10 @@ dependencyResolutionManagement {
alias("compose-coil").to("io.coil-kt", "coil-compose").version("2.1.0")
version("accompanist", "0.24.10-beta")
version("accompanist", "0.24.12-rc")
alias("accompanist-systemuicontroller").to("com.google.accompanist", "accompanist-systemuicontroller").versionRef("accompanist")
version("room", "2.5.0-alpha01")
version("room", "2.5.0-alpha02")
alias("room").to("androidx.room", "room-ktx").versionRef("room")
alias("room-compiler").to("androidx.room", "room-compiler").versionRef("room")