Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing event subscription for navigation #1205

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add missing navigation event subscription
  • Loading branch information
AnonymousWalker committed Mar 4, 2025
commit a6f37a45403eead9d99adfacf9c728da560401ed
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import org.slf4j.LoggerFactory
import org.wycliffeassociates.otter.common.data.OratureFileFormat
import org.wycliffeassociates.otter.common.domain.resourcecontainer.ImportResult
import org.wycliffeassociates.otter.jvm.controls.dialog.ProgressDialog
import org.wycliffeassociates.otter.jvm.controls.event.ChunkingStepSelectedEvent
import org.wycliffeassociates.otter.jvm.controls.event.ChunkingStepTransitionEvent
import org.wycliffeassociates.otter.jvm.controls.event.NavigateChapterEvent
import org.wycliffeassociates.otter.jvm.controls.event.ProjectImportFinishEvent
import org.wycliffeassociates.otter.jvm.controls.model.NotificationStatusType
Expand All @@ -60,6 +62,7 @@ class SourceAudioMissing : View() {
private val settingsViewModel: SettingsViewModel by inject()
private val importProjectViewModel: ImportProjectViewModel by inject()

private val eventSubscriptions = mutableListOf<EventRegistration>()
private val disposable = CompositeDisposable()

override val root = VBox().apply {
Expand Down Expand Up @@ -227,6 +230,7 @@ class SourceAudioMissing : View() {

override fun onDock() {
super.onDock()
logger.info("Consume (missing source audio) docked")
viewModel.loadingStepProperty.set(false)

importProjectViewModel.snackBarObservable
Expand All @@ -239,11 +243,26 @@ class SourceAudioMissing : View() {
)
)
}.addTo(disposable)

subscribeEvents()
}

override fun onUndock() {
super.onUndock()
disposable.clear()
unsubscribeEvents()
}


private fun subscribeEvents() {
subscribe<ChunkingStepSelectedEvent> {
FX.eventbus.fire(ChunkingStepTransitionEvent(it.step))
}.also { eventSubscriptions.add(it) }
}

private fun unsubscribeEvents() {
eventSubscriptions.forEach { it.unsubscribe() }
eventSubscriptions.clear()
}

private fun onDragOverHandler(): EventHandler<DragEvent> {
Expand Down
Loading