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,12 +61,14 @@ 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 {
viewModelScope.launch {
imageUploadingError.emit("Failed to upload the image / video") imageUploadingError.emit("Failed to upload the image / video")
isUploadingImage = false isUploadingImage = false
uploadingPercentage.value = 0.00f uploadingPercentage.value = 0.00f
uploadingDescription.value = null uploadingDescription.value = null
} }
}
} else { } else {
uploadingPercentage.value = 0.1f uploadingPercentage.value = 0.1f
uploadingDescription.value = "Uploading" uploadingDescription.value = "Uploading"