mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
android, desktop: more relaxed way of showing alerts for encryption/decryption errors (#4085)
This commit is contained in:
committed by
GitHub
parent
2b7f3099a6
commit
9e2a3fe848
@@ -2701,6 +2701,7 @@ data class CryptoFile(
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Unable to decrypt crypto file: " + e.stackTraceToString())
|
||||
AlertManager.shared.showAlertMsg(title = generalGetString(MR.strings.error), text = e.stackTraceToString())
|
||||
return null
|
||||
}
|
||||
return tmpFile.toURI()
|
||||
}
|
||||
|
||||
+5
-2
@@ -146,7 +146,7 @@ fun ImageFullScreenView(imageProvider: () -> ImageGalleryProvider, close: () ->
|
||||
onDispose { playersToRelease.add(decrypted) }
|
||||
}
|
||||
} else if (media.fileSource != null) {
|
||||
VideoViewEncrypted(uriDecrypted, media.fileSource, preview)
|
||||
VideoViewEncrypted(uriDecrypted, media.fileSource, preview, close)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -163,10 +163,13 @@ fun ImageFullScreenView(imageProvider: () -> ImageGalleryProvider, close: () ->
|
||||
expect fun FullScreenImageView(modifier: Modifier, data: ByteArray, imageBitmap: ImageBitmap)
|
||||
|
||||
@Composable
|
||||
private fun VideoViewEncrypted(uriUnencrypted: MutableState<URI?>, fileSource: CryptoFile, defaultPreview: ImageBitmap) {
|
||||
private fun VideoViewEncrypted(uriUnencrypted: MutableState<URI?>, fileSource: CryptoFile, defaultPreview: ImageBitmap, close: () -> Unit) {
|
||||
LaunchedEffect(Unit) {
|
||||
withBGApi {
|
||||
uriUnencrypted.value = fileSource.decryptedGetOrCreate()
|
||||
if (uriUnencrypted.value == null) {
|
||||
close()
|
||||
}
|
||||
}
|
||||
}
|
||||
Box(contentAlignment = Alignment.Center) {
|
||||
|
||||
Reference in New Issue
Block a user