mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-28 20:54:38 +01:00
Fix early close when navigating back to camera-first capture.
Fixes #11729
This commit is contained in:
committed by
Alex Hart
parent
6499ed4637
commit
e2dc7fb5bf
@@ -179,6 +179,10 @@ class MediaSelectionViewModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun removeMedia(media: Media) {
|
fun removeMedia(media: Media) {
|
||||||
|
removeMedia(media, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun removeMedia(media: Media, suppressEmptyError: Boolean) {
|
||||||
val snapshot = store.state
|
val snapshot = store.state
|
||||||
val newMediaList = snapshot.selectedMedia - media
|
val newMediaList = snapshot.selectedMedia - media
|
||||||
val oldFocusIndex = snapshot.selectedMedia.indexOf(media)
|
val oldFocusIndex = snapshot.selectedMedia.indexOf(media)
|
||||||
@@ -197,7 +201,7 @@ class MediaSelectionViewModel(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newMediaList.isEmpty()) {
|
if (newMediaList.isEmpty() && !suppressEmptyError) {
|
||||||
mediaErrors.postValue(MediaValidator.FilterError.NO_ITEMS)
|
mediaErrors.postValue(MediaValidator.FilterError.NO_ITEMS)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,7 +220,7 @@ class MediaSelectionViewModel(
|
|||||||
fun removeCameraFirstCapture() {
|
fun removeCameraFirstCapture() {
|
||||||
val cameraFirstCapture: Media? = store.state.cameraFirstCapture
|
val cameraFirstCapture: Media? = store.state.cameraFirstCapture
|
||||||
if (cameraFirstCapture != null) {
|
if (cameraFirstCapture != null) {
|
||||||
removeMedia(cameraFirstCapture)
|
removeMedia(cameraFirstCapture, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user