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,6 +310,7 @@ function onKeyEvent(key as string, press as boolean) as boolean
return true return true
end if end if
if m.userCanRecord = "true"
if key = "right" and m.viewChannelButton.hasFocus() if key = "right" and m.viewChannelButton.hasFocus()
m.recordButton.setFocus(true) m.recordButton.setFocus(true)
m.viewChannelOutline.visible = false m.viewChannelOutline.visible = false
@ -323,6 +330,7 @@ function onKeyEvent(key as string, press as boolean) as boolean
m.recordOutline.visible = false m.recordOutline.visible = false
return true return true
end if end if
end if
if key = "up" or key = "down" if key = "up" or key = "down"
return true return true

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

@ -147,3 +147,12 @@ sub LoadUserPreferences()
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