Skip to content

Commit

Permalink
Close dialog when casting a video (#85)
Browse files Browse the repository at this point in the history
* Close dialog when casting a video

* Refactor, and fix issue with keyboard dialog

* Changelog
  • Loading branch information
iBicha authored Jun 25, 2023
1 parent 4433514 commit 3223fbd
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added launch argument `clearPlayletLibUrls`
- If the dev menu is used to load a custom Playlet lib url, but the lib does not have a functionality to revert back, `curl -d '' "http://$ROKU_DEV_TARGET:8060/launch/dev?clearPlayletLibUrls=true"` can be used to remove the custom lib, and revert to using default.

### Fixed

- Issue where a dialog remains on screen when a video was cast from web app

### Changed

- SponsorBlock segments are not skipped by default, except for sponsor segments
Expand Down
6 changes: 6 additions & 0 deletions playlet-lib/src/components/MainScene.bs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ end function
function OnWebServerCommand()
if m.serverTask.command.StartsWith("play:")
sender = m.videoContainer.sender ?? m.currentFocued
if m.videoContainer.fullscreen
dialog = m.top.getScene().dialog
if dialog <> invalid
dialog.close = true
end if
end if
PlayVideo(m.serverTask.command.Mid(5), { sender: sender })
end if
end function
Expand Down
3 changes: 1 addition & 2 deletions playlet-lib/src/components/SettingsScreen/BooleanControl.bs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,5 @@ function OnFocusChanged()
end function

function OnkeyEvent(key as string, press as boolean) as boolean
settingsScreen = m.top.getScene().findNode("SettingsScreen")
return settingsScreen@.OnkeyEvent(key, press)
return m.top.settings@.OnkeyEvent(key, press)
end function
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,5 @@ function OnDialogButtonSelected()
end function

function OnkeyEvent(key as string, press as boolean) as boolean
settingsScreen = m.top.getScene().findNode("SettingsScreen")
return settingsScreen@.OnkeyEvent(key, press)
return m.top.settings@.OnkeyEvent(key, press)
end function
3 changes: 1 addition & 2 deletions playlet-lib/src/components/SettingsScreen/RadioControl.bs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ function OnFocusChanged()
end function

function OnkeyEvent(key as string, press as boolean) as boolean
settingsScreen = m.top.getScene().findNode("SettingsScreen")
return settingsScreen@.OnkeyEvent(key, press)
return m.top.settings@.OnkeyEvent(key, press)
end function

function OnOptionsChanged()
Expand Down
15 changes: 10 additions & 5 deletions playlet-lib/src/components/SettingsScreen/StringControl.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ function Init()
m.top.observeField("focusedChild", "OnFocusChanged")
m.top.observeField("value", "OnValueChanged")
m.top.observeField("settings", "OnSettingsScreen")
m.keyboardWasClosedByButton = false
end function

function OnSettingsScreen()
Expand All @@ -23,8 +24,7 @@ function OnValueChanged()
end function

function OnkeyEvent(key as string, press as boolean) as boolean
settingsScreen = m.top.getScene().findNode("SettingsScreen")
return settingsScreen@.OnkeyEvent(key, press)
return m.top.settings@.OnkeyEvent(key, press)
end function

function ShowEditKeyboard()
Expand All @@ -45,10 +45,15 @@ function OnButtonSelected(event as object)
if buttonSelected = 0
m.top.value = keyboard.text
end if
m.keyboardWasClosedByButton = true
keyboard.close = true
end function

function OnKeyboardClosed()
settingsScreen = m.top.getScene().findNode("SettingsScreen")
settingsScreen@.MenuNavigate(-1)
function OnKeyboardClosed() as void
' The keyboard was closed by something else (like cast from web app)
' In this case, we do nothing, since the focus might be moved to the video player
if not m.keyboardWasClosedByButton
return
end if
m.top.settings@.MenuNavigate(-1)
end function
1 change: 1 addition & 0 deletions playlet-lib/src/components/VideoPlayer/Video.bs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function CloseVideo(setFocus = true as boolean)
videoContainer.sender.SetFocus(true)
end if
end if
videoContainer.sender = invalid
SponsorBlockNotifcationSetVisible(false)
end function

Expand Down

0 comments on commit 3223fbd

Please sign in to comment.