From d0a9c1ccd03c72b76043860f3e55a10f0742217f Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Sun, 5 Jan 2025 11:22:15 -0500 Subject: [PATCH] Fixes: Only close the upload screen if the video upload is a success on the Media tab --- .../com/vitorpamplona/amethyst/ui/actions/NewMediaModel.kt | 2 ++ .../java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaModel.kt index 4533f58ec..f818db786 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaModel.kt @@ -83,6 +83,7 @@ open class NewMediaModel : ViewModel() { fun upload( context: Context, relayList: List, + onSucess: () -> Unit, onError: (String, String) -> Unit, ) { viewModelScope.launch { @@ -196,6 +197,7 @@ open class NewMediaModel : ViewModel() { videoJobs.joinAll() imageJobs.joinAll() + onSucess() onceUploaded() cancelModel() } else { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt index 47f35746c..833417c6e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewMediaView.kt @@ -140,8 +140,7 @@ fun NewMediaView( PostButton( onPost = { - onClose() - postViewModel.upload(context, relayList, onError = accountViewModel::toast) + postViewModel.upload(context, relayList, onClose, accountViewModel::toast) postViewModel.selectedServer?.let { if (it.type != ServerType.NIP95) { account.settings.changeDefaultFileServer(it)