BugFix for now showing the error message when the phone can't open the file

This commit is contained in:
Vitor Pamplona
2023-05-01 20:43:14 -04:00
parent 82a2586eab
commit 7d620cd89a
@@ -61,11 +61,13 @@ open class NewMediaModel : ViewModel() {
contentResolver.openInputStream(uri)?.use { contentResolver.openInputStream(uri)?.use {
createNIP95Record(it.readBytes(), contentType, description) createNIP95Record(it.readBytes(), contentType, description)
} }
?: viewModelScope.launch { ?: run {
imageUploadingError.emit("Failed to upload the image / video") viewModelScope.launch {
isUploadingImage = false imageUploadingError.emit("Failed to upload the image / video")
uploadingPercentage.value = 0.00f isUploadingImage = false
uploadingDescription.value = null uploadingPercentage.value = 0.00f
uploadingDescription.value = null
}
} }
} else { } else {
uploadingPercentage.value = 0.1f uploadingPercentage.value = 0.1f