mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
fix: remove if-condition to prevent hiding top card and refactor code
This commit is contained in:
parent
1e1e5d763f
commit
07a71cbef2
1 changed files with 22 additions and 25 deletions
|
|
@ -146,11 +146,7 @@ class UploadPresenter @Inject internal constructor(
|
||||||
|
|
||||||
override fun deletePictureAtIndex(index: Int) {
|
override fun deletePictureAtIndex(index: Int) {
|
||||||
val uploadableFiles = view.getUploadableFiles()
|
val uploadableFiles = view.getUploadableFiles()
|
||||||
if (index == uploadableFiles!!.size - 1) {
|
uploadableFiles?.let {
|
||||||
// If the next fragment to be shown is not one of the MediaDetailsFragment
|
|
||||||
// lets hide the top card so that it doesn't appear on the other fragments
|
|
||||||
view.showHideTopCard(false)
|
|
||||||
}
|
|
||||||
view.setImageCancelled(true)
|
view.setImageCancelled(true)
|
||||||
repository.deletePicture(uploadableFiles[index].getFilePath())
|
repository.deletePicture(uploadableFiles[index].getFilePath())
|
||||||
if (uploadableFiles.size == 1) {
|
if (uploadableFiles.size == 1) {
|
||||||
|
|
@ -175,6 +171,7 @@ class UploadPresenter @Inject internal constructor(
|
||||||
//In case lets update the number of uploadable media
|
//In case lets update the number of uploadable media
|
||||||
view.updateTopCardTitle()
|
view.updateTopCardTitle()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onAttachView(view: UploadContract.View) {
|
override fun onAttachView(view: UploadContract.View) {
|
||||||
this.view = view
|
this.view = view
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue