Fixes: Only close the upload screen if the video upload is a success on the Media tab

This commit is contained in:
Vitor Pamplona
2025-01-05 11:22:15 -05:00
parent 617f1ba2a6
commit d0a9c1ccd0
2 changed files with 3 additions and 2 deletions

View File

@@ -83,6 +83,7 @@ open class NewMediaModel : ViewModel() {
fun upload( fun upload(
context: Context, context: Context,
relayList: List<RelaySetupInfo>, relayList: List<RelaySetupInfo>,
onSucess: () -> Unit,
onError: (String, String) -> Unit, onError: (String, String) -> Unit,
) { ) {
viewModelScope.launch { viewModelScope.launch {
@@ -196,6 +197,7 @@ open class NewMediaModel : ViewModel() {
videoJobs.joinAll() videoJobs.joinAll()
imageJobs.joinAll() imageJobs.joinAll()
onSucess()
onceUploaded() onceUploaded()
cancelModel() cancelModel()
} else { } else {

View File

@@ -140,8 +140,7 @@ fun NewMediaView(
PostButton( PostButton(
onPost = { onPost = {
onClose() postViewModel.upload(context, relayList, onClose, accountViewModel::toast)
postViewModel.upload(context, relayList, onError = accountViewModel::toast)
postViewModel.selectedServer?.let { postViewModel.selectedServer?.let {
if (it.type != ServerType.NIP95) { if (it.type != ServerType.NIP95) {
account.settings.changeDefaultFileServer(it) account.settings.changeDefaultFileServer(it)