Skip to content

Commit 9a8f51b

Browse files
committed
fix: show snackbar when space image upload fails
1 parent 0749466 commit 9a8f51b

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎owncloudApp/src/main/java/com/owncloud/android/presentation/spaces/SpacesListFragment.kt‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,17 @@ class SpacesListFragment :
247247
val remotePath = SPACE_CONFIG_DIR + selectedImageName
248248
val matchedTransfer = transfersWithSpace.map { it.first }.find { it.remotePath == remotePath }
249249

250-
if (matchedTransfer != null && matchedTransfer.status == TransferStatus.TRANSFER_SUCCEEDED &&
251-
lastUpdatedRemotePath != matchedTransfer.remotePath) {
252-
spacesListViewModel.editSpaceImage(currentSpace.id, matchedTransfer.remotePath)
253-
lastUpdatedRemotePath = matchedTransfer.remotePath
250+
if (matchedTransfer != null && lastUpdatedRemotePath != matchedTransfer.remotePath) {
251+
when(matchedTransfer.status) {
252+
TransferStatus.TRANSFER_SUCCEEDED -> {
253+
spacesListViewModel.editSpaceImage(currentSpace.id, matchedTransfer.remotePath)
254+
lastUpdatedRemotePath = matchedTransfer.remotePath
255+
}
256+
TransferStatus.TRANSFER_FAILED -> {
257+
showMessageInSnackbar(getString(R.string.edit_space_image_failed))
258+
}
259+
else -> { }
260+
}
254261
}
255262
}
256263

0 commit comments

Comments
 (0)