import "pkg:/source/api/ApiClient.bs"
' The whole app is routed (pre-login SetServerScreen / UserSelect / LoginScene via loginRouter;
' Home / ItemDetails / SearchResults self-wire under the router). What remains here are two
' router-agnostic helpers that don't belong to any one view: a performance beacon and the
' resume/start-over playback dialog. (SaveServerList / DeleteFromServerList live in
' source/utils/config.bs.)
' Roku Performance monitoring
sub SendPerformanceBeacon(signalName as string)
if m.global.appLoaded = false
m.scene.signalBeacon(signalName)
end if
end sub
'Opens dialog asking user if they want to resume video or start playback over only on the home screen
sub playbackOptionDialog(time as longinteger)
resumeData = [
translate(translationKeys.MessageResumePlayingAt, [ticksToHuman(time)]),
translate(translationKeys.LabelStartOverFromTheBeginning)
]
stopLoadingSpinner()
' Claim this dialog for main.bs's isDataReturned handler. The shared isDataReturned field
' is also used by routed views (ItemDetails delete / mark-watched) via scoped observers;
' the pending flag is how main.bs tells "my resume/start-over dialog" apart from theirs so
' it doesn't cancel their spinner or replay a stale queue hold.
m.global.sceneManager.isPendingPlaybackOptions = true
m.global.sceneManager.callFunc("showConfirmationDialog", translate(translationKeys.LabelPlaybackOptions), [], resumeData)
end sub