import "pkg:/components/Dialog/DialogUtils.bs" import "pkg:/components/EcpArgs.bs" 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" function Init() m.scene = m.top.getScene() SetScenePalette(m.scene) ' At this point, the "MainScene" node is not yet added to the scene, and does not have a parent yet. ' Let's wait until it has one. m.MainSceneContainer = m.scene.findNode("MainSceneContainer") m.MainSceneContainer.ObserveField("change", FuncName(MainSceneContainerChanged)) end function function SetScenePalette(scene as object) as void palette = scene.palette if palette <> invalid return end if palette = CreateObject("roSGNode", "RSGPalette") palette.colors = { DialogBackgroundColor: "#242424FF" DialogFocusColor: "#CECECEFF" DialogFocusItemColor: "#202020FF" DialogSecondaryTextColor: "#EBEBEBFF" DialogSecondaryItemColor: "#FF1C30FF" DialogTextColor: "#EBEBEBFF" } scene.palette = palette end function const HAS_ANNOUNCEMENT = false function MainSceneContainerChanged() AutoBindSceneGraph() StartWebServer() HideLoadingScreen() InitEcpArgs() if HAS_ANNOUNCEMENT if not ShowAnnouncement() m.scene.signalBeacon("AppLaunchComplete") end if else m.scene.signalBeacon("AppLaunchComplete") end if CopyLoadingMessagesToCache() end function function StartWebServer() m.loungeService = m.top.findNode("LoungeService") m.loungeService@.StartService() m.webServer = m.top.findNode("WebServer") m.webServer@.StartServer() m.dialServer = m.top.findNode("DialServer") m.dialServer@.StartServer() end function function ShowAnnouncement() as boolean dialog = DialogUtils.ShowDialogOnce({ messageId: "1747362859" title: "Announcement - YouTube account support" message: [ "YouTube account support is now available in Playlet!" `Subscriptions, playlists, watch history and "Recommended" are now available in the app.` "If you encounter any issues, please report them on GitHub." "https://github.com/iBicha/playlet/issues" "Thank you." ] alwaysOnTop: true marginWidth: 180 }) if dialog = invalid return false end if m.scene.signalBeacon("AppDialogInitiate") dialog.observeField("wasClosed", FuncName(OnAnnouncementDialogClosed)) return true end function function OnAnnouncementDialogClosed() m.scene.signalBeacon("AppDialogComplete") m.scene.signalBeacon("AppLaunchComplete") end function