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