Limit large dialogs to errors

This commit is contained in:
Brahim Hadriche committed 2023-07-29 20:48:00 -04:00
1 parent 151e108183
commit 6e0c1fb06a
2 files changed
+9 -7

No files matched your search

@@ -1,8 +1,8 @@
function ShowDialog(message as dynamic, title as string) as object
return ShowDialogButtons(message, title, ["Ok"])
function ShowDialog(message as dynamic, title as string, large = false as boolean) as object
return ShowDialogButtons(message, title, ["Ok"], large)
end function
function ShowDialogButtons(message as dynamic, title as string, buttons as object) as object
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(UnixNL()).ToArray()
@@ -10,9 +10,11 @@ function ShowDialogButtons(message as dynamic, title as string, buttons as objec
dialog.message = message
dialog.title = title
dialog.buttons = buttons
deviceInfo = CreateObject("roDeviceInfo")
displaySize = deviceInfo.GetDisplaySize()
dialog.width = displaySize.w - 100
if large
deviceInfo = CreateObject("roDeviceInfo")
displaySize = deviceInfo.GetDisplaySize()
dialog.width = displaySize.w - 100
end if
m.top.getScene().dialog = dialog
return dialog
end function
@@ -346,7 +346,7 @@ function OnVideoPlayerStateChange() as void
for each info in errorInfo
messageLines.push(`${info}: ${errorInfo[info]}`)
end for
ShowDialog(messageLines, `Error playing video ${m.top.videoId}`)
ShowDialog(messageLines, `Error playing video ${m.top.videoId}`, true)
CloseVideo()
end if
end function