From f89935a6f960ec1ad8b22d17493c12091ca27726 Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Fri, 27 Dec 2024 12:08:21 -0500 Subject: [PATCH] Refactor dialog, to keep announcements on top --- .../components/AppController/AppController.bs | 10 +++- .../src/components/ChannelView/ChannelView.bs | 11 +++- .../ContentNode/ChannelContentNode.bs | 7 ++- .../ContentNode/PlaylistContentNode.bs | 7 ++- .../src/components/Dialog/DialogUtils.bs | 59 +++++++++++++++---- .../src/components/Dialog/LoginDialog.xml | 1 + .../src/components/Dialog/SimpleDialog.xml | 3 + .../src/components/Dialog/TimedDialog.xml | 1 + playlet-lib/src/components/MainScene.bs | 31 ++++------ .../Screens/RemoteScreen/RemoteScreen.bs | 6 +- .../Screens/SearchScreen/SearchScreen.bs | 5 +- .../SettingsScreen/ClearCacheControl.bs | 5 +- .../ClearSearchHistoryControl.bs | 5 +- .../InvidiousInstanceTesting.bs | 6 +- .../InvidiousPublicInstances.bs | 6 +- .../Services/LoungeService/LoungeApi.bs | 25 ++++++-- .../ProfilesVerifyTokensTask.bs | 5 +- .../VideoFeed/VideoRowListRowContentTask.bs | 6 +- .../src/components/VideoPlayer/VideoPlayer.bs | 27 +++++++-- .../src/components/VideoQueue/VideoQueue.bs | 2 +- .../Middleware/RegistryRouter.bs | 13 ++-- 21 files changed, 179 insertions(+), 62 deletions(-) diff --git a/playlet-lib/src/components/AppController/AppController.bs b/playlet-lib/src/components/AppController/AppController.bs index 146d2b7f..af9fab19 100644 --- a/playlet-lib/src/components/AppController/AppController.bs +++ b/playlet-lib/src/components/AppController/AppController.bs @@ -132,8 +132,14 @@ function OnKeyEvent(key as string, press as boolean) as boolean return true end if end if - dialog = DialogUtils.ShowDialogButtons(Tr(Locale.Dialogs.ExitPlayletQuestion), Tr(Locale.Buttons.exit), [Tr(Locale.Buttons.exit), Tr(Locale.Buttons.Cancel)]) - dialog.observeField("buttonSelected", FuncName(OnExitDialog), ["buttonSelected"]) + dialog = DialogUtils.ShowDialogEx({ + message: Tr(Locale.Dialogs.ExitPlayletQuestion) + title: Tr(Locale.Buttons.exit) + buttons: [Tr(Locale.Buttons.exit), Tr(Locale.Buttons.Cancel)] + }) + if dialog <> invalid + dialog.observeField("buttonSelected", FuncName(OnExitDialog), ["buttonSelected"]) + end if return true end if diff --git a/playlet-lib/src/components/ChannelView/ChannelView.bs b/playlet-lib/src/components/ChannelView/ChannelView.bs index 1a33ac47..3af75542 100644 --- a/playlet-lib/src/components/ChannelView/ChannelView.bs +++ b/playlet-lib/src/components/ChannelView/ChannelView.bs @@ -359,13 +359,20 @@ function OnSubscriptionChanged() end if end function -function ShowSortDialog(title as string, sortOptions as object, feedContentNode as object) +function ShowSortDialog(title as string, sortOptions as object, feedContentNode as object) as void buttons = [] for i = 0 to sortOptions.Count() - 1 buttons.Push(Tr(sortOptions[i].title)) end for - dialog = DialogUtils.ShowDialogButtons("", title, buttons) + dialog = DialogUtils.ShowDialogEx({ + message: "" + title: title + buttons: buttons + }) + if dialog = invalid + return + end if dialog.addFields({ "feedContentNode": feedContentNode "sortOptions": sortOptions diff --git a/playlet-lib/src/components/ContentNode/ChannelContentNode.bs b/playlet-lib/src/components/ContentNode/ChannelContentNode.bs index 7f9e9a3e..84935ae5 100644 --- a/playlet-lib/src/components/ContentNode/ChannelContentNode.bs +++ b/playlet-lib/src/components/ContentNode/ChannelContentNode.bs @@ -41,7 +41,10 @@ function OnChannelContentTaskResult(output as object) as void LogError(error) authorId = output.task.input.content.authorId message = Tr(Locale.Dialogs.FailedToLoadChannel).Replace("%1", authorId) + `\n${error}` - DialogUtils.ShowDialog(message, Tr(Locale.Dialogs.ChannelLoadError), true) - return + DialogUtils.ShowDialogEx({ + message: message + title: Tr(Locale.Dialogs.ChannelLoadError) + large: true + }) end if end function diff --git a/playlet-lib/src/components/ContentNode/PlaylistContentNode.bs b/playlet-lib/src/components/ContentNode/PlaylistContentNode.bs index c35f2bee..880a9b57 100644 --- a/playlet-lib/src/components/ContentNode/PlaylistContentNode.bs +++ b/playlet-lib/src/components/ContentNode/PlaylistContentNode.bs @@ -50,7 +50,10 @@ function OnPlaylistContentTaskResult(output as object) as void LogError(error) playlistId = output.task.input.content.playlistId message = Tr(Locale.Dialogs.FailedToLoadPlaylist).Replace("%1", playlistId) + `\n${error}` - DialogUtils.ShowDialog(message, Tr(Locale.Dialogs.PlaylistLoadError), true) - return + DialogUtils.ShowDialogEx({ + message: message + title: Tr(Locale.Dialogs.PlaylistLoadError) + large: true + }) end if end function diff --git a/playlet-lib/src/components/Dialog/DialogUtils.bs b/playlet-lib/src/components/Dialog/DialogUtils.bs index 0f366413..7a46df47 100644 --- a/playlet-lib/src/components/Dialog/DialogUtils.bs +++ b/playlet-lib/src/components/Dialog/DialogUtils.bs @@ -1,31 +1,67 @@ import "pkg:/source/utils/Locale.bs" namespace DialogUtils - function ShowDialog(message as dynamic, title as string, large = false as boolean) as object - return ShowDialogButtons(message, title, [Tr(Locale.Buttons.OK)], large) - end function - function ShowDialogButtons(message as dynamic, title as string, buttons as object, large = false as boolean) as object - dialog = CreateObject("roSGNode", "SimpleDialog") - if GetInterface(message, "ifArray") = invalid - message = message.Tokenize(`\n`).ToArray() + function ShowDialogEx(options as object) as object + currentDialog = m.top.getScene().dialog + alwaysOnTop = false + if options.DoesExist("alwaysOnTop") + alwaysOnTop = options.alwaysOnTop end if - dialog.message = message - dialog.title = title - dialog.buttons = buttons - if large + + if currentDialog <> invalid and ValidBool(currentDialog.alwaysOnTop) + if not alwaysOnTop + return invalid + end if + end if + + dialog = CreateObject("roSGNode", "SimpleDialog") + dialog.alwaysOnTop = alwaysOnTop + + if options.DoesExist("message") + message = options.message + if GetInterface(message, "ifArray") = invalid + message = message.Tokenize(`\n`).ToArray() + end if + dialog.message = message + end if + + if options.DoesExist("title") + dialog.title = options.title + end if + + if options.DoesExist("buttons") + dialog.buttons = options.buttons + else + dialog.buttons = [Tr(Locale.Buttons.OK)] + end if + + if options.DoesExist("large") and options.large if m._deviceDisplayWidth = invalid deviceInfo = CreateObject("roDeviceInfo") displaySize = deviceInfo.GetDisplaySize() m._deviceDisplayWidth = displaySize.w end if dialog.width = m._deviceDisplayWidth - 100 + else if options.DoesExist("marginWidth") + if m._deviceDisplayWidth = invalid + deviceInfo = CreateObject("roDeviceInfo") + displaySize = deviceInfo.GetDisplaySize() + m._deviceDisplayWidth = displaySize.w + end if + dialog.width = m._deviceDisplayWidth - options.marginWidth end if + m.top.getScene().dialog = dialog return dialog end function function ShowTimedDialogButtons(message as dynamic, title as string, buttons as object, defaultButton as integer, timeoutSeconds as integer, large = false as boolean) as object + currentDialog = m.top.getScene().dialog + if currentDialog <> invalid and ValidBool(currentDialog.alwaysOnTop) + return invalid + end if + dialog = CreateObject("roSGNode", "TimedDialog") if GetInterface(message, "ifArray") = invalid message = message.Tokenize(`\n`).ToArray() @@ -53,4 +89,5 @@ namespace DialogUtils return dialog end function + end namespace diff --git a/playlet-lib/src/components/Dialog/LoginDialog.xml b/playlet-lib/src/components/Dialog/LoginDialog.xml index 6fb34038..a2f20801 100644 --- a/playlet-lib/src/components/Dialog/LoginDialog.xml +++ b/playlet-lib/src/components/Dialog/LoginDialog.xml @@ -3,6 +3,7 @@ + diff --git a/playlet-lib/src/components/Dialog/SimpleDialog.xml b/playlet-lib/src/components/Dialog/SimpleDialog.xml index 61c25573..af0b9539 100644 --- a/playlet-lib/src/components/Dialog/SimpleDialog.xml +++ b/playlet-lib/src/components/Dialog/SimpleDialog.xml @@ -1,2 +1,5 @@ + + + \ No newline at end of file diff --git a/playlet-lib/src/components/Dialog/TimedDialog.xml b/playlet-lib/src/components/Dialog/TimedDialog.xml index 703cd7d1..700c19fb 100644 --- a/playlet-lib/src/components/Dialog/TimedDialog.xml +++ b/playlet-lib/src/components/Dialog/TimedDialog.xml @@ -7,5 +7,6 @@ + \ No newline at end of file diff --git a/playlet-lib/src/components/MainScene.bs b/playlet-lib/src/components/MainScene.bs index 2a6a9fa3..5c8b9b07 100644 --- a/playlet-lib/src/components/MainScene.bs +++ b/playlet-lib/src/components/MainScene.bs @@ -3,6 +3,7 @@ import "pkg:/components/parts/AutoBind/AutoBind.part.bs" import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs" import "pkg:/source/utils/LoadingScreen.bs" import "pkg:/source/utils/Locale.bs" +import "pkg:/components/Dialog/DialogUtils.bs" function Init() m.scene = m.top.getScene() @@ -34,22 +35,16 @@ function StartWebServer() end function function ShowAnnouncement() - title = "Announcement - Playlet backend" - message = [ - "An experimental built-in backend has been added to Playlet." - "This allows you to access YouTube content without the need for an Invidious instance." - "To use it, go to the Settings > Invidious > Instance and set the field to empty (Edit, and delete the url)." - "Please note that it's missing some features and may not work as expected." - "Thank you for using Playlet!" - ] - - buttons = [Tr(Locale.Buttons.OK)] - dialog = CreateObject("roSGNode", "SimpleDialog") - dialog.title = title - dialog.message = message - dialog.buttons = buttons - deviceInfo = CreateObject("roDeviceInfo") - displaySize = deviceInfo.GetDisplaySize() - dialog.width = displaySize.w - 180 - m.top.getScene().dialog = dialog + DialogUtils.ShowDialogEx({ + title: "Announcement - Playlet backend" + message: [ + "An experimental built-in backend has been added to Playlet." + "This allows you to access YouTube content without the need for an Invidious instance." + "To use it, go to the Settings > Invidious > Instance and set the field to empty (Edit, and delete the url)." + "Please note that it's missing some features and may not work as expected." + "Thank you for using Playlet!" + ] + alwaysOnTop: true + marginWidth: 180 + }) end function diff --git a/playlet-lib/src/components/Screens/RemoteScreen/RemoteScreen.bs b/playlet-lib/src/components/Screens/RemoteScreen/RemoteScreen.bs index 6784cfce..8ac6616b 100644 --- a/playlet-lib/src/components/Screens/RemoteScreen/RemoteScreen.bs +++ b/playlet-lib/src/components/Screens/RemoteScreen/RemoteScreen.bs @@ -206,7 +206,11 @@ function OnLoungeGenerateManualPairingCodeTaskResult(output as object) as void LogError(error) message = Tr(Locale.RemoteScreen.FailedToGeneratePairingCode) + `\n${error}` - DialogUtils.ShowDialog(message, Tr(Locale.RemoteScreen.TvCodeError), true) + DialogUtils.ShowDialogEx({ + message: message + title: Tr(Locale.RemoteScreen.TvCodeError) + large: true + }) return end if diff --git a/playlet-lib/src/components/Screens/SearchScreen/SearchScreen.bs b/playlet-lib/src/components/Screens/SearchScreen/SearchScreen.bs index bfaf223a..5ced689f 100644 --- a/playlet-lib/src/components/Screens/SearchScreen/SearchScreen.bs +++ b/playlet-lib/src/components/Screens/SearchScreen/SearchScreen.bs @@ -242,7 +242,10 @@ function OnSearchContentReady() as void m.rowlist.UnobserveFieldScoped("someContentReady") if not m.rowlist.someContentReady - DialogUtils.ShowDialog(Tr(Locale.Dialogs.NoResultsFoundMessage), Tr(Locale.Dialogs.NoResultsFound)) + DialogUtils.ShowDialogEx({ + message: Tr(Locale.Dialogs.NoResultsFoundMessage) + title: Tr(Locale.Dialogs.NoResultsFound) + }) m.rowlist.feeds = invalid m.rowlist.focusable = false HideLoadingScreen() diff --git a/playlet-lib/src/components/Screens/SettingsScreen/ClearCacheControl.bs b/playlet-lib/src/components/Screens/SettingsScreen/ClearCacheControl.bs index a3231197..8c6316db 100644 --- a/playlet-lib/src/components/Screens/SettingsScreen/ClearCacheControl.bs +++ b/playlet-lib/src/components/Screens/SettingsScreen/ClearCacheControl.bs @@ -23,5 +23,8 @@ end function function OnButtonSelected() CacheUtils.Clear() - DialogUtils.ShowDialog(Tr(Locale.Settings.CacheCleared), Tr(Locale.Generic.Success)) + DialogUtils.ShowDialogEx({ + message: Tr(Locale.Settings.CacheCleared) + title: Tr(Locale.Generic.Success) + }) end function diff --git a/playlet-lib/src/components/Screens/SettingsScreen/ClearSearchHistoryControl.bs b/playlet-lib/src/components/Screens/SettingsScreen/ClearSearchHistoryControl.bs index c27b09ef..1b3c7926 100644 --- a/playlet-lib/src/components/Screens/SettingsScreen/ClearSearchHistoryControl.bs +++ b/playlet-lib/src/components/Screens/SettingsScreen/ClearSearchHistoryControl.bs @@ -23,5 +23,8 @@ end function function OnButtonSelected() SearchHistoryUtils.Clear() - DialogUtils.ShowDialog(Tr(Locale.Settings.SearchHistoryCleared), Tr(Locale.Generic.Success)) + DialogUtils.ShowDialogEx({ + message: Tr(Locale.Settings.SearchHistoryCleared) + title: Tr(Locale.Generic.Success) + }) end function diff --git a/playlet-lib/src/components/Screens/SettingsScreen/InvidiousInstance/InvidiousInstanceTesting/InvidiousInstanceTesting.bs b/playlet-lib/src/components/Screens/SettingsScreen/InvidiousInstance/InvidiousInstanceTesting/InvidiousInstanceTesting.bs index 8346c09b..630cfdcb 100644 --- a/playlet-lib/src/components/Screens/SettingsScreen/InvidiousInstance/InvidiousInstanceTesting/InvidiousInstanceTesting.bs +++ b/playlet-lib/src/components/Screens/SettingsScreen/InvidiousInstance/InvidiousInstanceTesting/InvidiousInstanceTesting.bs @@ -85,6 +85,8 @@ function ShowTestDetails() as void message += Tr(Locale.InvidiousTesting.TestDuration) + ": " + `${itemContent.duration}ms\n` message += Tr(Locale.InvidiousTesting.Details) + ": " + details - title = Tr(Locale.InvidiousTesting.Test) + ": " + itemContent.title - DialogUtils.ShowDialog(message, title) + DialogUtils.ShowDialogEx({ + message: message + title: Tr(Locale.InvidiousTesting.Test) + ": " + itemContent.title + }) end function diff --git a/playlet-lib/src/components/Screens/SettingsScreen/InvidiousInstance/InvidiousPublicInstances/InvidiousPublicInstances.bs b/playlet-lib/src/components/Screens/SettingsScreen/InvidiousInstance/InvidiousPublicInstances/InvidiousPublicInstances.bs index a6941a81..6d289da0 100644 --- a/playlet-lib/src/components/Screens/SettingsScreen/InvidiousInstance/InvidiousPublicInstances/InvidiousPublicInstances.bs +++ b/playlet-lib/src/components/Screens/SettingsScreen/InvidiousInstance/InvidiousPublicInstances/InvidiousPublicInstances.bs @@ -122,7 +122,11 @@ function OnInvidiousPublicInstancesTaskResults(output as object) as void LogError(output.error) message = Tr(Locale.Dialogs.FailedToLoadInvidiousPublicInstances) + `\n${error}` - DialogUtils.ShowDialog(message, Tr(Locale.Dialogs.InvidiousPublicInstancesLoadError), true) + DialogUtils.ShowDialogEx({ + message: message + title: Tr(Locale.Dialogs.InvidiousPublicInstancesLoadError) + large: true + }) m.failedLabel.visible = true m.refreshButton.visible = true diff --git a/playlet-lib/src/components/Services/LoungeService/LoungeApi.bs b/playlet-lib/src/components/Services/LoungeService/LoungeApi.bs index fc9444c8..40496561 100644 --- a/playlet-lib/src/components/Services/LoungeService/LoungeApi.bs +++ b/playlet-lib/src/components/Services/LoungeService/LoungeApi.bs @@ -104,7 +104,10 @@ class LoungeApi if not response.IsSuccess() error = Tr(Locale.Dialogs.LoungeFailedToGetScreenId) + `\n${response.ErrorMessage()}` LogError(error) - DialogUtils.ShowDialog(error, Tr(Locale.Dialogs.LoungeServiceSetupError)) + DialogUtils.ShowDialogEx({ + message: error + title: Tr(Locale.Dialogs.LoungeServiceSetupError) + }) return invalid end if @@ -112,7 +115,10 @@ class LoungeApi if not IsString(id) error = Tr(Locale.Dialogs.LoungeFailedToGetScreenId) + `\n` = Tr(Locale.Dialogs.LoungeNotAValidScreenId).Replace("%1", `${id}`) LogError(error) - DialogUtils.ShowDialog(error, Tr(Locale.Dialogs.LoungeServiceSetupError)) + DialogUtils.ShowDialogEx({ + message: error + title: Tr(Locale.Dialogs.LoungeServiceSetupError) + }) return invalid end if @@ -134,7 +140,10 @@ class LoungeApi if not response.IsSuccess() error = Tr(Locale.Dialogs.LoungeFailedToGetLoungeToken) + `\n${response.ErrorMessage()}` LogError(error) - DialogUtils.ShowDialog(error, Tr(Locale.Dialogs.LoungeServiceSetupError)) + DialogUtils.ShowDialogEx({ + message: error + title: Tr(Locale.Dialogs.LoungeServiceSetupError) + }) return invalid end if @@ -143,7 +152,10 @@ class LoungeApi if not IsArray(screens) or screens.Count() <> 1 error = Tr(Locale.Dialogs.LoungeFailedToGetLoungeToken) + `\n` + Tr(Locale.Dialogs.LoungeInvalidResponse).Replace("%1", `${json}`) LogError(error) - DialogUtils.ShowDialog(error, Tr(Locale.Dialogs.LoungeServiceSetupError)) + DialogUtils.ShowDialogEx({ + message: error + title: Tr(Locale.Dialogs.LoungeServiceSetupError) + }) return invalid end if @@ -180,7 +192,10 @@ class LoungeApi if not response.IsSuccess() error = Tr(Locale.Dialogs.LoungeFailedToGetSessionData) + `\n${response.ErrorMessage()}` LogError(error) - DialogUtils.ShowDialog(error, Tr(Locale.Dialogs.LoungeServiceSetupError)) + DialogUtils.ShowDialogEx({ + message: error + title: Tr(Locale.Dialogs.LoungeServiceSetupError) + }) return false end if diff --git a/playlet-lib/src/components/Services/ProfilesService/ProfilesVerifyTokensTask.bs b/playlet-lib/src/components/Services/ProfilesService/ProfilesVerifyTokensTask.bs index 1353521f..818c85f2 100644 --- a/playlet-lib/src/components/Services/ProfilesService/ProfilesVerifyTokensTask.bs +++ b/playlet-lib/src/components/Services/ProfilesService/ProfilesVerifyTokensTask.bs @@ -28,7 +28,10 @@ function ProfilesVerifyTokensTask(input as object) as object profileNames = profileNames.join(", ") message = Tr(Locale.Dialogs.UserLoggedOutMessage).Replace("\n", `\n`).Replace("%1", profileNames) - DialogUtils.ShowDialog(message, Tr(Locale.Dialogs.UserLoggedOut)) + DialogUtils.ShowDialogEx({ + message: message + title: Tr(Locale.Dialogs.UserLoggedOut) + }) return invalid end function diff --git a/playlet-lib/src/components/VideoFeed/VideoRowListRowContentTask.bs b/playlet-lib/src/components/VideoFeed/VideoRowListRowContentTask.bs index 64f677c4..b1c382f4 100644 --- a/playlet-lib/src/components/VideoFeed/VideoRowListRowContentTask.bs +++ b/playlet-lib/src/components/VideoFeed/VideoRowListRowContentTask.bs @@ -190,5 +190,9 @@ function HandleFeedLoadErrorDialog(error as object, rowList as object) as void if rowList.hasField("dispose") and rowList.dispose return end if - DialogUtils.ShowDialog(error, Tr(Locale.Dialogs.FailedToLoadFeed), true) + DialogUtils.ShowDialogEx({ + message: error + title: "Failed to load feed" + large: true + }) end function diff --git a/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs b/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs index db62aa27..63a123d0 100644 --- a/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs +++ b/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs @@ -179,7 +179,11 @@ function OnVideoContentTaskResults(output as object) as void buttons = [Tr(Locale.Buttons.PlayNextVideo), Tr(Locale.Buttons.Cancel)] dialog = DialogUtils.ShowTimedDialogButtons(message, title, buttons, 0, 10, true) - dialog.observeFieldScoped("wasClosed", FuncName(OnVideoContentTaskErrorDialogResponse)) + if dialog <> invalid + dialog.observeFieldScoped("wasClosed", FuncName(OnVideoContentTaskErrorDialogResponse)) + else + OnVideoContentTaskErrorDialogResponse(invalid) + end if Lounge.SendOnStateChange() return @@ -246,9 +250,12 @@ function OnPreviousPlayerState(event as object) as void end function function OnVideoContentTaskErrorDialogResponse(event as object) - dialog = event.getRoSGNode() - dialog.unobserveFieldScoped("wasClosed") - shouldPlayNext = dialog.actualButtonSelected = 0 + shouldPlayNext = false + if event <> invalid + dialog = event.getRoSGNode() + dialog.unobserveFieldScoped("wasClosed") + shouldPlayNext = dialog.actualButtonSelected = 0 + end if if not shouldPlayNext or not VideoQueueUtils.PlayNext(m.videoQueue, m.invidious, m.preferences) if m.top.isSameNode(m.videoQueue.player) @@ -294,7 +301,11 @@ function OnClose() catch error errorMessage = ErrorUtils.Format(error) LogError("Error stopping video:", errorMessage) - DialogUtils.ShowDialog(errorMessage, Tr(Locale.VideoPlayer.ErrorClosingVideo), true) + DialogUtils.ShowDialogEx({ + message: errorMessage + title: Tr(Locale.VideoPlayer.ErrorClosingVideo) + large: true + }) end try m.top.content = invalid @@ -383,7 +394,11 @@ function OnVideoPlayerStateChange() as void buttons = [Tr(Locale.Buttons.PlayNextVideo), Tr(Locale.Buttons.Cancel)] dialog = DialogUtils.ShowTimedDialogButtons(messageLines, title, buttons, 0, 10, true) - dialog.observeFieldScoped("wasClosed", FuncName(OnVideoContentTaskErrorDialogResponse)) + if dialog <> invalid + dialog.observeFieldScoped("wasClosed", FuncName(OnVideoContentTaskErrorDialogResponse)) + else + OnVideoContentTaskErrorDialogResponse(invalid) + end if m.ignoreNextFinishedState = true end if end function diff --git a/playlet-lib/src/components/VideoQueue/VideoQueue.bs b/playlet-lib/src/components/VideoQueue/VideoQueue.bs index 715ab500..b13e8f4a 100644 --- a/playlet-lib/src/components/VideoQueue/VideoQueue.bs +++ b/playlet-lib/src/components/VideoQueue/VideoQueue.bs @@ -373,7 +373,7 @@ function CreateVideoPlayer() as object NodeSetFocus(videoPlayer, true) dialog = m.top.getScene().dialog - if dialog <> invalid + if dialog <> invalid and not ValidBool(dialog.alwaysOnTop) dialog.close = true end if end if diff --git a/playlet-lib/src/components/Web/PlayletWebServer/Middleware/RegistryRouter.bs b/playlet-lib/src/components/Web/PlayletWebServer/Middleware/RegistryRouter.bs index a098be3b..158b1280 100644 --- a/playlet-lib/src/components/Web/PlayletWebServer/Middleware/RegistryRouter.bs +++ b/playlet-lib/src/components/Web/PlayletWebServer/Middleware/RegistryRouter.bs @@ -57,8 +57,14 @@ namespace Http message = `The code to export the registry data is: ${requestCode}. This code will expire in 2 minutes. If you did not request to export the registry, please close this dialog.` - dialog = DialogUtils.ShowDialog(message, "Export registry") - dialog.addField("isExportRegistryCodeDialog", "boolean", false) + dialog = DialogUtils.ShowDialogEx({ + message: message + title: "Export registry" + alwaysOnTop: true + }) + if dialog <> invalid + dialog.addField("isExportRegistryCodeDialog", "boolean", false) + end if response.Default(204, "OK") return true @@ -71,8 +77,7 @@ If you did not request to export the registry, please close this dialog.` requestCode = m.requestCode m.requestCode = invalid - scene = m.task.getScene() - dialog = scene.dialog + dialog = m.task.getScene().dialog if dialog = invalid or not dialog.hasField("isExportRegistryCodeDialog") response.Default(400, "Invalid code") return true