Export screen: stop using toasts for save errors

This commit is contained in:
Pierre-Yves Nicolas
2026-01-30 09:22:21 +01:00
parent f32b4f8799
commit a5b20c22c0
2 changed files with 3 additions and 7 deletions

View File

@@ -317,11 +317,6 @@ class MainActivity : ComponentActivity() {
exportViewModel.onRequestSave(context) exportViewModel.onRequestSave(context)
} }
} }
is ExportEvent.SaveError -> {
val text = getString(R.string.error_save)
Toast.makeText(context, text, Toast.LENGTH_SHORT).show()
}
} }
} }
} }

View File

@@ -54,7 +54,6 @@ import kotlin.coroutines.suspendCoroutine
sealed interface ExportEvent { sealed interface ExportEvent {
data object RequestSave : ExportEvent data object RequestSave : ExportEvent
data object SaveError : ExportEvent
} }
class ExportViewModel(container: AppContainer, val imageRepository: ImageRepository): ViewModel() { class ExportViewModel(container: AppContainer, val imageRepository: ImageRepository): ViewModel() {
@@ -208,7 +207,9 @@ class ExportViewModel(container: AppContainer, val imageRepository: ImageReposit
} }
} catch (e: Exception) { } catch (e: Exception) {
logger.e("FairScan", "Failed to save PDF", e) logger.e("FairScan", "Failed to save PDF", e)
_events.emit(ExportEvent.SaveError) _uiState.update {
it.copy(errorMessage = context.getString(R.string.error_save))
}
} finally { } finally {
_uiState.update { it.copy(isSaving = false) } _uiState.update { it.copy(isSaving = false) }
} }