Announcements - do not show again
This commit is contained in:
1 parent
fbac4ab959
commit
ec941d64dc
10 files changed
+99
-3
No files matched your search
@@ -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
|
||||
@@ -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."
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/StringUtils.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/Logging.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/components/Dialog/DialogUtils.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/RegistryUtils.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/bslib.brs" />
|
||||
<children>
|
||||
<Logger id="Logger" />
|
||||
|
||||
@@ -36,6 +36,10 @@
|
||||
<source>OK</source>
|
||||
<translation>OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Do not show again</source>
|
||||
<translation>Do not show again</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Activate</source>
|
||||
<translation>Activate</translation>
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace Locale
|
||||
@locale
|
||||
enum Buttons
|
||||
OK = "OK"
|
||||
DotNotShowAgain = "Do not show again"
|
||||
Activate = "Activate"
|
||||
InUse = "In Use"
|
||||
Login = "Login"
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
Reference in new issue
Block a user