Skip to content

Commit

Permalink
use a dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
AnonymousWalker committed Jan 13, 2025
1 parent 8560f90 commit 44d16a4
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,33 @@ class HomePageViewModel2 : ViewModel() {
}

fun generateBook(workbookDescriptor: WorkbookDescriptor) {
val loadingDialog = find<LoadingModal>().apply {
// show loading modal while flushing the delete queue to prevent navigating home
messageProperty.set("Generating")
orientationProperty.set(settingsViewModel.orientationProperty.value)
themeProperty.set(settingsViewModel.appColorMode.value)
}
loadingDialog.open()

val workbook = workbookRepo.get(
workbookDescriptor.sourceCollection,
workbookDescriptor.targetCollection
)
val projectGroup = selectedProjectGroupProperty.value
workbookDS.currentModeProperty.set(projectGroup.mode)
workbookDS.activeWorkbookProperty.set(workbook)
initializeProjectFiles(workbook)
updateWorkbookModifiedDate(workbook)

find<ImportAudioViewModel>()
.generateBook(workbookDescriptor)
.doOnComplete {
println("Finished generating for ${workbookDescriptor.slug}")
workbook.projectFilesAccessor.writeSelectedTakesFile(workbook, true)
workbookRepo.closeWorkbook(workbook)
runLater {
loadingDialog.close()
}
}
.subscribe()
}
Expand Down

0 comments on commit 44d16a4

Please sign in to comment.