From 617f1ba2a6510510526a3c5a813f3fb91da01986 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Sun, 5 Jan 2025 11:21:32 -0500 Subject: [PATCH] Fixes the extra empty kind 20 post when uploading videos. --- .../amethyst/ui/actions/NewMediaModel.kt | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 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 b38c72f73..4533f58ec 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 @@ -171,22 +171,26 @@ open class NewMediaModel : ViewModel() { } val imageJobs = - listOf( - viewModelScope.launch(Dispatchers.IO) { - withTimeoutOrNull(30000) { - suspendCancellableCoroutine { continuation -> - account?.sendAllAsOnePictureEvent( - imageUrls, - caption, - sensitiveContent, - relayList, - ) { - continuation.resume(true) + if (imageUrls.isNotEmpty()) { + listOf( + viewModelScope.launch(Dispatchers.IO) { + withTimeoutOrNull(30000) { + suspendCancellableCoroutine { continuation -> + account?.sendAllAsOnePictureEvent( + imageUrls, + caption, + sensitiveContent, + relayList, + ) { + continuation.resume(true) + } } } - } - }, - ) + }, + ) + } else { + emptyList() + } nip95jobs.joinAll() videoJobs.joinAll()