android, desktop: better handling of URI's (#3450)

This commit is contained in:
Stanislav Dmitrenko
2023-11-25 00:19:31 +08:00
committed by GitHub
parent 8ce9dd7ab6
commit f9b5c673c5
15 changed files with 47 additions and 39 deletions
@@ -4,6 +4,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter
import com.google.accompanist.insets.navigationBarsWithImePadding
import java.io.File
actual fun Modifier.navigationBarsWithImePadding(): Modifier = navigationBarsWithImePadding()
@@ -19,7 +20,7 @@ actual fun ProvideWindowInsets(
@Composable
actual fun Modifier.desktopOnExternalDrag(
enabled: Boolean,
onFiles: (List<String>) -> Unit,
onFiles: (List<File>) -> Unit,
onImage: (Painter) -> Unit,
onText: (String) -> Unit
): Modifier = this
@@ -71,7 +71,7 @@ actual class VideoPlayer actual constructor(
private fun start(seek: Long? = null, onProgressUpdate: (position: Long?, state: TrackState) -> Unit): Boolean {
val filepath = getAppFilePath(uri)
if (filepath == null || !File(filepath).exists()) {
Log.e(TAG, "No such file: $uri")
Log.e(TAG, "No such file: $filepath")
brokenVideo.value = true
return false
}