From ec4419177a9b6bd61bd0d0df2f297c641b1e6743 Mon Sep 17 00:00:00 2001 From: Darrell Cole Hill Date: Mon, 13 May 2024 08:56:08 -0400 Subject: [PATCH] Import verse fix (#1141) * Accounts for Completable and runs resetNarratableList on UI thread * Sets openLoadingModalProperty in runLater --- .../workbookapp/ui/narration/NarrationViewModel.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/jvm/workbookapp/src/main/kotlin/org/wycliffeassociates/otter/jvm/workbookapp/ui/narration/NarrationViewModel.kt b/jvm/workbookapp/src/main/kotlin/org/wycliffeassociates/otter/jvm/workbookapp/ui/narration/NarrationViewModel.kt index 587ec9c196..a0aa901d04 100644 --- a/jvm/workbookapp/src/main/kotlin/org/wycliffeassociates/otter/jvm/workbookapp/ui/narration/NarrationViewModel.kt +++ b/jvm/workbookapp/src/main/kotlin/org/wycliffeassociates/otter/jvm/workbookapp/ui/narration/NarrationViewModel.kt @@ -838,11 +838,15 @@ class NarrationViewModel : ViewModel() { fun importVerseAudio(verseIndex: Int, file: File) { showLoadingDialog() - narration.onEditVerse(verseIndex, file) - - resetNarratableList() - openLoadingModalProperty.set(false) + .doFinally { + runLater { + resetNarratableList() + openLoadingModalProperty.set(false) + } + } + .subscribeOn(Schedulers.io()) + .subscribe() } private fun stopPlayer() { @@ -1230,7 +1234,7 @@ class NarrationViewModel : ViewModel() { } } } - + private fun showLoadingDialog(messageKey: String = "savingProjectWait") { loadingModalTextProperty.set(messages[messageKey]) openLoadingModalProperty.set(true)