fix: allow photo deletion in PHOTON tab regardless of result code
This commit is contained in:
1 parent
9598e7ca9f
commit
24c45e8b5f
2 files changed
+6
-6
No files matched your search
@@ -116,15 +116,15 @@ fun GalleryDetailScreen(
|
||||
val deletePhotoLauncher = rememberLauncherForActivityResult(
|
||||
ActivityResultContracts.StartIntentSenderForResult()
|
||||
) { result ->
|
||||
if (result.resultCode == Activity.RESULT_OK) {
|
||||
// User confirmed deletion, delete internal photo
|
||||
if (result.resultCode == Activity.RESULT_OK || viewModel.selectedTab == GalleryTab.PHOTON) {
|
||||
// User confirmed deletion or we are in PHOTON tab (delete internal photo anyway)
|
||||
viewModel.deletePhotoAfterConfirmation { success ->
|
||||
if (success && viewModel.currentPhotos.value.isEmpty()) {
|
||||
onBack()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// User cancelled deletion
|
||||
// User cancelled deletion in SYSTEM tab
|
||||
viewModel.clearDeleteRequest()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,11 +121,11 @@ fun GalleryScreen(
|
||||
val batchDeleteLauncher = rememberLauncherForActivityResult(
|
||||
ActivityResultContracts.StartIntentSenderForResult()
|
||||
) { result ->
|
||||
if (result.resultCode == Activity.RESULT_OK) {
|
||||
// User confirmed deletion, delete internal photos
|
||||
if (result.resultCode == Activity.RESULT_OK || viewModel.selectedTab == GalleryTab.PHOTON) {
|
||||
// User confirmed deletion or we are in PHOTON tab (delete internal photos anyway)
|
||||
viewModel.deleteBatchPhotosAfterConfirmation()
|
||||
} else {
|
||||
// User cancelled deletion
|
||||
// User cancelled deletion in SYSTEM tab
|
||||
viewModel.clearBatchDeleteRequest()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user