diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6dc58197..9a7e2750 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [Unreleased]
+
+### Added
+
+- Ability to hide annoucement messages
+
## [0.35.4] - 2025-01-07
### Added
diff --git a/package.json b/package.json
index 87a9ba8b..ba9a3868 100644
--- a/package.json
+++ b/package.json
@@ -65,6 +65,7 @@
"update-deps": "npx npm-check-updates --deep --upgrade --install always --reject @sveltejs/vite-plugin-svelte,svelte,vite,@vitejs/plugin-legacy",
"registry:write": "node tools/registry.js --input registry.json",
"registry:read": "node tools/registry.js --output registry.json",
- "registry:clear": "node tools/registry.js --clear"
+ "registry:clear": "node tools/registry.js --clear",
+ "restart-app": "node tools/restart-app.js --app-id dev"
}
}
diff --git a/playlet-lib/src/components/Dialog/DialogUtils.bs b/playlet-lib/src/components/Dialog/DialogUtils.bs
index 840547bf..5f97c965 100644
--- a/playlet-lib/src/components/Dialog/DialogUtils.bs
+++ b/playlet-lib/src/components/Dialog/DialogUtils.bs
@@ -1,4 +1,6 @@
import "pkg:/source/utils/Locale.bs"
+import "pkg:/source/utils/RegistryUtils.bs"
+import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
namespace DialogUtils
@@ -91,4 +93,58 @@ namespace DialogUtils
return dialog
end function
+ function ShowDialogOnce(options as object) as object
+ messageId = ValidString(options.messageId)
+ hasMessageId = messageId <> ""
+
+ if hasMessageId
+ messages = RegistryUtils.Read(RegistryUtils.MESSAGES)
+ if not StringUtils.IsNullOrEmpty(messages)
+ messages = ParseJson(messages)
+ if IsAssociativeArray(messages)
+ savedMessageId = ValidString(messages["messageId"])
+ if savedMessageId = messageId
+ return invalid
+ end if
+ end if
+ end if
+ end if
+
+ options.buttons = [
+ Tr(Locale.Buttons.OK)
+ `${Tr(Locale.Buttons.OK)} - ${Tr(Locale.Buttons.DotNotShowAgain)}`
+ ]
+
+ dialog = ShowDialogEx(options)
+ if dialog = invalid
+ return invalid
+ end if
+
+ dialog.AddFields({
+ "messageId": messageId
+ })
+
+ dialog.ObserveField("buttonSelected", FuncName(OnShowDialogOnceButtonSelected))
+ return dialog
+ end function
+
+ function OnShowDialogOnceButtonSelected(event as object) as void
+ buttonSelected = event.getData()
+ if buttonSelected <> 1
+ return
+ end if
+
+ dialog = event.GetRoSGNode()
+ messageId = dialog.messageId
+ if messageId = ""
+ return
+ end if
+
+ messages = {
+ "messageId": messageId
+ }
+
+ RegistryUtils.Write(RegistryUtils.MESSAGES, FormatJson(messages))
+ end function
+
end namespace
diff --git a/playlet-lib/src/components/MainScene.bs b/playlet-lib/src/components/MainScene.bs
index 513c1b03..b0b8c76a 100644
--- a/playlet-lib/src/components/MainScene.bs
+++ b/playlet-lib/src/components/MainScene.bs
@@ -35,7 +35,8 @@ function StartWebServer()
end function
function ShowAnnouncement()
- DialogUtils.ShowDialogEx({
+ DialogUtils.ShowDialogOnce({
+ messageId: "1736288537"
title: "Announcement - Playlet backend"
message: [
"An experimental built-in backend has been added to Playlet."
diff --git a/playlet-lib/src/components/MainScene.transpiled.brs b/playlet-lib/src/components/MainScene.transpiled.brs
index 42346bac..e0248b04 100644
--- a/playlet-lib/src/components/MainScene.transpiled.brs
+++ b/playlet-lib/src/components/MainScene.transpiled.brs
@@ -34,7 +34,8 @@ function StartWebServer()
end function
function ShowAnnouncement()
- DialogUtils_ShowDialogEx({
+ DialogUtils_ShowDialogOnce({
+ messageId: "1736288537"
title: "Announcement - Playlet backend"
message: [
"An experimental built-in backend has been added to Playlet."
diff --git a/playlet-lib/src/components/MainScene.transpiled.xml b/playlet-lib/src/components/MainScene.transpiled.xml
index 6ac902d9..21db3095 100644
--- a/playlet-lib/src/components/MainScene.transpiled.xml
+++ b/playlet-lib/src/components/MainScene.transpiled.xml
@@ -17,6 +17,7 @@
+
diff --git a/playlet-lib/src/locale/en_US/translations.ts b/playlet-lib/src/locale/en_US/translations.ts
index 9fe2f9a4..b4d6bbc9 100644
--- a/playlet-lib/src/locale/en_US/translations.ts
+++ b/playlet-lib/src/locale/en_US/translations.ts
@@ -36,6 +36,10 @@
OK
OK
+
+ Do not show again
+ Do not show again
+
Activate
Activate
diff --git a/playlet-lib/src/source/utils/Locale.bs b/playlet-lib/src/source/utils/Locale.bs
index 894edf7d..490e99bb 100644
--- a/playlet-lib/src/source/utils/Locale.bs
+++ b/playlet-lib/src/source/utils/Locale.bs
@@ -14,6 +14,7 @@ namespace Locale
@locale
enum Buttons
OK = "OK"
+ DotNotShowAgain = "Do not show again"
Activate = "Activate"
InUse = "In Use"
Login = "Login"
diff --git a/playlet-lib/src/source/utils/RegistryUtils.bs b/playlet-lib/src/source/utils/RegistryUtils.bs
index ffa10fad..5780af61 100644
--- a/playlet-lib/src/source/utils/RegistryUtils.bs
+++ b/playlet-lib/src/source/utils/RegistryUtils.bs
@@ -8,6 +8,7 @@ namespace RegistryUtils
const SEARCH_HISTORY = "search_history"
const PLAYLET_LIB_URLS = "playlet_lib_urls"
const BOOKMARKS = "bookmarks"
+ const MESSAGES = "messages"
const LAST_LOUNGE_DATA = "last_lounge_data"
diff --git a/tools/restart-app.js b/tools/restart-app.js
new file mode 100644
index 00000000..596e1563
--- /dev/null
+++ b/tools/restart-app.js
@@ -0,0 +1,24 @@
+// Restarts the Roku app
+
+const { ArgumentParser } = require('argparse');
+const getEnvVars = require('./get-env-vars');
+
+const config = getEnvVars(['ROKU_DEV_TARGET']);
+
+(async () => {
+ const parser = new ArgumentParser({
+ description: 'Restart Roku app using ECP'
+ });
+
+ parser.add_argument('--app-id', { help: 'App Id' });
+
+ const args = parser.parse_args();
+ const appId = args.app_id
+
+ const url = `http://${config.ROKU_DEV_TARGET}:8060/launch/${appId}?restart=true`;
+ console.log("Restarting app", appId);
+ await fetch(url, {
+ method: 'POST',
+ body: '',
+ });
+})();