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 recordSeriesButtonBackground.height = boundingRect.height + 20
m.recordSeriesOutline.width = recordSeriesButtonBackground.width m.recordSeriesOutline.width = recordSeriesButtonBackground.width
m.recordSeriesOutline.height = recordSeriesButtonBackground.height 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 end sub
sub updateLabels(recordText = "Record", recordSeriesText = "Record Series") sub updateLabels(recordText = "Record", recordSeriesText = "Record Series")
@ -304,24 +310,26 @@ function onKeyEvent(key as string, press as boolean) as boolean
return true return true
end if end if
if key = "right" and m.viewChannelButton.hasFocus() if m.userCanRecord = "true"
m.recordButton.setFocus(true) if key = "right" and m.viewChannelButton.hasFocus()
m.viewChannelOutline.visible = false m.recordButton.setFocus(true)
m.recordOutline.visible = true m.viewChannelOutline.visible = false
return true m.recordOutline.visible = true
else if key = "right" and m.recordButton.hasFocus() return true
m.recordSeriesButton.setFocus(true) else if key = "right" and m.recordButton.hasFocus()
m.recordOutline.visible = false m.recordSeriesButton.setFocus(true)
m.recordSeriesOutline.visible = true m.recordOutline.visible = false
else if key = "left" and m.recordSeriesButton.hasFocus() m.recordSeriesOutline.visible = true
m.recordButton.setFocus(true) else if key = "left" and m.recordSeriesButton.hasFocus()
m.recordOutline.visible = true m.recordButton.setFocus(true)
m.recordSeriesOutline.visible = false m.recordOutline.visible = true
else if key = "left" and m.recordButton.hasFocus() m.recordSeriesOutline.visible = false
m.viewChannelButton.setFocus(true) else if key = "left" and m.recordButton.hasFocus()
m.viewChannelOutline.visible = true m.viewChannelButton.setFocus(true)
m.recordOutline.visible = false m.viewChannelOutline.visible = true
return true m.recordOutline.visible = false
return true
end if
end if end if
if key = "up" or key = "down" if key = "up" or key = "down"

View File

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

View File

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

View File

@ -146,4 +146,13 @@ sub LoadUserPreferences()
else else
unset_user_setting("display.livetv.landing") unset_user_setting("display.livetv.landing")
end if end if
end sub 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