From 5ea6e11345bd56521251b573d202e8a84cef82f3 Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Sat, 21 Jun 2025 07:05:55 -0400 Subject: [PATCH] Announcement --- CHANGELOG.md | 5 ++++ .../src/components/Dialog/DialogUtils.bs | 18 ++++++++++++- playlet-lib/src/components/MainScene.bs | 26 ++++++++++++------- .../src/components/MainScene.transpiled.brs | 25 +++++++++++------- playlet-web/src/lib/Screens/InfoScreen.svelte | 19 ++++++++++++-- 5 files changed, 72 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b91b0df..73311832 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Improve performance of video bookmarks, by avoiding `/player` endpoint and caching results +- Github link to create new issue not working in web app due to url being too long + +### Changed + +- Added instructions to use web app as a workaround to current errors ## [0.40.5] - 2025-06-19 diff --git a/playlet-lib/src/components/Dialog/DialogUtils.bs b/playlet-lib/src/components/Dialog/DialogUtils.bs index 5f97c965..e649d637 100644 --- a/playlet-lib/src/components/Dialog/DialogUtils.bs +++ b/playlet-lib/src/components/Dialog/DialogUtils.bs @@ -23,12 +23,28 @@ namespace DialogUtils if options.DoesExist("message") message = options.message - if GetInterface(message, "ifArray") = invalid + if IsString(message) message = message.Tokenize(`\n`).ToArray() end if dialog.message = message end if + if options.DoesExist("bulletText") + bulletText = options.bulletText + if IsString(bulletText) + bulletText = bulletText.Tokenize(`\n`).ToArray() + end if + dialog.bulletText = bulletText + end if + + if options.DoesExist("bottomMessage") + bottomMessage = options.bottomMessage + if IsString(bottomMessage) + bottomMessage = bottomMessage.Tokenize(`\n`).ToArray() + end if + dialog.bottomMessage = bottomMessage + end if + if options.DoesExist("title") dialog.title = options.title end if diff --git a/playlet-lib/src/components/MainScene.bs b/playlet-lib/src/components/MainScene.bs index f9dd031a..1fdc3658 100644 --- a/playlet-lib/src/components/MainScene.bs +++ b/playlet-lib/src/components/MainScene.bs @@ -33,7 +33,7 @@ function SetScenePalette(scene as object) as void scene.palette = palette end function -const HAS_ANNOUNCEMENT = false +const HAS_ANNOUNCEMENT = true function MainSceneContainerChanged() AutoBindSceneGraph() @@ -62,18 +62,26 @@ function StartWebServer() end function function ShowAnnouncement() as boolean + deviceInfo = CreateObject("roDeviceInfo") + deviceName = deviceInfo.GetFriendlyName() + dialog = DialogUtils.ShowDialogOnce({ - messageId: "1747362859" - title: "Announcement - YouTube account support" + messageId: "1750501488" + title: "Web app workaround" 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." + "If you're experiencing issues playing videos, please consider this workaround while we work on a fix:" + ] + bulletText: [ + `Go to the "Remote" screen, and scan the QR code to open the web app in your browser.` + `Tap the video you want to play.` + `Select the "Play on ${deviceName} (ytjs)" button.` + ] + bottomMessage: [ + "Apologies for the inconvenience, and thank you for your patience!" + "Issue link: https://github.com/iBicha/playlet/issues/626" ] alwaysOnTop: true - marginWidth: 180 + large: true }) if dialog = invalid diff --git a/playlet-lib/src/components/MainScene.transpiled.brs b/playlet-lib/src/components/MainScene.transpiled.brs index a25ec44d..80e62e0a 100644 --- a/playlet-lib/src/components/MainScene.transpiled.brs +++ b/playlet-lib/src/components/MainScene.transpiled.brs @@ -38,7 +38,7 @@ function MainSceneContainerChanged() StartWebServer() HideLoadingScreen() InitEcpArgs() - if false + if true if not ShowAnnouncement() m.scene.signalBeacon("AppLaunchComplete") end if @@ -58,18 +58,25 @@ function StartWebServer() end function function ShowAnnouncement() as boolean + deviceInfo = CreateObject("roDeviceInfo") + deviceName = deviceInfo.GetFriendlyName() dialog = DialogUtils_ShowDialogOnce({ - messageId: "1747362859" - title: "Announcement - YouTube account support" + messageId: "1750501488" + title: "Web app workaround" message: [ - "YouTube account support is now available in Playlet!" - "Subscriptions, playlists, watch history and " + chr(34) + "Recommended" + chr(34) + " are now available in the app." - "If you encounter any issues, please report them on GitHub." - "https://github.com/iBicha/playlet/issues" - "Thank you." + "If you're experiencing issues playing videos, please consider this workaround while we work on a fix:" + ] + bulletText: [ + "Go to the " + chr(34) + "Remote" + chr(34) + " screen, and scan the QR code to open the web app in your browser." + "Tap the video you want to play." + ("Select the " + chr(34) + "Play on " + bslib_toString(deviceName) + " (ytjs)" + chr(34) + " button.") + ] + bottomMessage: [ + "Apologies for the inconvenience, and thank you for your patience!" + "Issue link: https://github.com/iBicha/playlet/issues/626" ] alwaysOnTop: true - marginWidth: 180 + large: true }) if dialog = invalid return false diff --git a/playlet-web/src/lib/Screens/InfoScreen.svelte b/playlet-web/src/lib/Screens/InfoScreen.svelte index 0b73b0be..60e963b3 100644 --- a/playlet-web/src/lib/Screens/InfoScreen.svelte +++ b/playlet-web/src/lib/Screens/InfoScreen.svelte @@ -138,8 +138,23 @@ ${JSON.stringify(profilesInfo, null, 2)} } function createGithubIssueUrl() { - const body = encodeURIComponent(createFeedbackBody()); - return `https://github.com/iBicha/playlet/issues/new?title=${feedbackTitle}&body=${body}`; + const body = createFeedbackBody(); + let bodyEncoded = encodeURIComponent(body); + + // Github url known limit is 8192 + // Limit body, otherwise URL might be too long + // This is an body arbitrary limit, that should keep us under the 8192 limit + const encodedBodyLimit = 8000; + const bodyLimit = 4200; + if (bodyEncoded.length > encodedBodyLimit) { + bodyEncoded = encodeURIComponent( + body.substring(0, bodyLimit) + "\n\n[...truncated]" + ); + } + + const url = `https://github.com/iBicha/playlet/issues/new?title=${feedbackTitle}&body=${bodyEncoded}`; + console.log("Github URL length:", url.length); + return url; } function createMailToUrl() {