kopia lustrzana https://github.com/ryukoposting/Signal-Android
rodzic
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue