Export screen: stop using toasts for save errors
This commit is contained in:
@@ -317,11 +317,6 @@ class MainActivity : ComponentActivity() {
|
||||
exportViewModel.onRequestSave(context)
|
||||
}
|
||||
}
|
||||
|
||||
is ExportEvent.SaveError -> {
|
||||
val text = getString(R.string.error_save)
|
||||
Toast.makeText(context, text, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,6 @@ import kotlin.coroutines.suspendCoroutine
|
||||
|
||||
sealed interface ExportEvent {
|
||||
data object RequestSave : ExportEvent
|
||||
data object SaveError : ExportEvent
|
||||
}
|
||||
|
||||
class ExportViewModel(container: AppContainer, val imageRepository: ImageRepository): ViewModel() {
|
||||
@@ -208,7 +207,9 @@ class ExportViewModel(container: AppContainer, val imageRepository: ImageReposit
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
logger.e("FairScan", "Failed to save PDF", e)
|
||||
_events.emit(ExportEvent.SaveError)
|
||||
_uiState.update {
|
||||
it.copy(errorMessage = context.getString(R.string.error_save))
|
||||
}
|
||||
} finally {
|
||||
_uiState.update { it.copy(isSaving = false) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user