Skip to content

Commit

Permalink
Remove useless snackbar in importFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyDL-Infomaniak committed May 23, 2024
1 parent b64f0c9 commit 2fbd6d4
Showing 1 changed file with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ class ImportFilesDialog : DialogFragment() {
val errorCount = importCount - successCount

if (errorCount > 0) {
if (isLowMemory()) {
showSnackbar(R.string.uploadOutOfMemoryError, showAboveFab = true)
val errorMessage = if (isLowMemory()) {
getString(R.string.uploadOutOfMemoryError)
} else {
val errorMessage = resources.getQuantityString(R.plurals.snackBarUploadError, errorCount, errorCount)
showSnackbar(errorMessage, showAboveFab = true)
resources.getQuantityString(R.plurals.snackBarUploadError, errorCount, errorCount)
}

showSnackbar(errorMessage, showAboveFab = true)
}

if (successCount > 0) mainViewModel.refreshActivities.value = true
Expand All @@ -100,15 +101,6 @@ class ImportFilesDialog : DialogFragment() {
}
}

if (errorCount > 0) {
withContext(Dispatchers.Main) {
showSnackbar(
title = resources.getQuantityString(R.plurals.snackBarUploadError, errorCount, errorCount),
showAboveFab = true,
)
}
}

lifecycle.withResumed {
dismiss()
}
Expand All @@ -118,7 +110,7 @@ class ImportFilesDialog : DialogFragment() {
private suspend fun initUpload(uri: Uri) = withContext(Dispatchers.IO) {
requireContext().contentResolver.query(uri, null, null, null, null)?.use { cursor ->
if (isLowMemory()) return@withContext

if (cursor.moveToFirst()) {
val fileName = cursor.getFileName(uri)
val (fileCreatedAt, fileModifiedAt) = getFileDates(cursor)
Expand Down

0 comments on commit 2fbd6d4

Please sign in to comment.