Don't show buttons when user doesn't have access.

This commit is contained in:
jimiatnymbl 2022-01-08 23:31:27 -07:00
parent 09101569b5
commit 572963e28f
4 changed files with 39 additions and 19 deletions

View File

@ -82,6 +82,12 @@ sub setupLabels()
recordSeriesButtonBackground.height = boundingRect.height + 20
m.recordSeriesOutline.width = recordSeriesButtonBackground.width
m.recordSeriesOutline.height = recordSeriesButtonBackground.height
m.userCanRecord = get_user_setting("livetv.canrecord")
if m.userCanRecord = "false"
m.recordButton.visible = false
m.recordSeriesButton.visible = false
end if
end sub
sub updateLabels(recordText = "Record", recordSeriesText = "Record Series")
@ -304,24 +310,26 @@ function onKeyEvent(key as string, press as boolean) as boolean
return true
end if
if key = "right" and m.viewChannelButton.hasFocus()
m.recordButton.setFocus(true)
m.viewChannelOutline.visible = false
m.recordOutline.visible = true
return true
else if key = "right" and m.recordButton.hasFocus()
m.recordSeriesButton.setFocus(true)
m.recordOutline.visible = false
m.recordSeriesOutline.visible = true
else if key = "left" and m.recordSeriesButton.hasFocus()
m.recordButton.setFocus(true)
m.recordOutline.visible = true
m.recordSeriesOutline.visible = false
else if key = "left" and m.recordButton.hasFocus()
m.viewChannelButton.setFocus(true)
m.viewChannelOutline.visible = true
m.recordOutline.visible = false
return true
if m.userCanRecord = "true"
if key = "right" and m.viewChannelButton.hasFocus()
m.recordButton.setFocus(true)
m.viewChannelOutline.visible = false
m.recordOutline.visible = true
return true
else if key = "right" and m.recordButton.hasFocus()
m.recordSeriesButton.setFocus(true)
m.recordOutline.visible = false
m.recordSeriesOutline.visible = true
else if key = "left" and m.recordSeriesButton.hasFocus()
m.recordButton.setFocus(true)
m.recordOutline.visible = true
m.recordSeriesOutline.visible = false
else if key = "left" and m.recordButton.hasFocus()
m.viewChannelButton.setFocus(true)
m.viewChannelOutline.visible = true
m.recordOutline.visible = false
return true
end if
end if
if key = "up" or key = "down"

View File

@ -83,4 +83,5 @@
</interface>
<script type="text/brightscript" uri="ProgramDetails.brs" />
<script type="text/brightscript" uri="pkg:/source/utils/misc.brs" />
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
</component>

View File

@ -376,6 +376,7 @@ function LoginFlow(startOver = false as boolean)
if get_setting("active_user") <> invalid
m.user = AboutMe()
LoadUserPreferences()
LoadUserAbilities(m.user)
SendPerformanceBeacon("AppDialogComplete") ' Roku Performance monitoring - Dialog Closed
return true
end if
@ -399,6 +400,7 @@ function LoginFlow(startOver = false as boolean)
end if
LoadUserPreferences()
LoadUserAbilities(m.user)
m.global.sceneManager.callFunc("clearScenes")
'Send Device Profile information to server

View File

@ -147,3 +147,12 @@ sub LoadUserPreferences()
unset_user_setting("display.livetv.landing")
end if
end sub
sub LoadUserAbilities(user)
' Only have one thing we're checking now, but in the future it could be more...
if user.Policy.EnableLiveTvManagement = true
set_user_setting("livetv.canrecord", "true")
else
set_user_setting("livetv.canrecord", "false")
end if
end sub