diff --git a/components/ItemGrid2/ItemGrid2.brs b/components/ItemGrid2/ItemGrid2.brs
index 44309d0e..055a1647 100644
--- a/components/ItemGrid2/ItemGrid2.brs
+++ b/components/ItemGrid2/ItemGrid2.brs
@@ -60,6 +60,11 @@ sub loadInitialItems()
'For LiveTV, we want to "Fit" the item images, not zoom
m.top.imageDisplayMode = "scaleToFit"
+
+ if get_user_setting("display.livetv.landing") = "guide" then
+ showTvGuid()
+ end if
+
else if m.top.parentItem.collectionType = "CollectionFolder" then
' Non-recursive, to not show subfolder contents
m.loadItemsTask.recursive = false
@@ -117,7 +122,7 @@ sub SetUpOptions()
else if m.top.parentItem.collectionType = "livetv" then
options.views = [
{"Title": tr("Channels"), "Name": "livetv" },
- {"Title": tr("TV Guide"), "Name": "tvGuide" }
+ {"Title": tr("TV Guide"), "Name": "tvGuide", "Selected": get_user_setting("display.livetv.landing") = "guide" }
]
options.sort = [
{ "Title": tr("TITLE"), "Name": "SortName" }
@@ -268,13 +273,7 @@ end sub
sub optionsClosed()
if (m.options.view = "tvGuide") then
- m.top.signalBeacon("EPGLaunchInitiate") ' Required Roku Performance monitoring
- if m.tvGuide = invalid then
- m.tvGuide = createObject("roSGNode", "Schedule")
- endif
- m.tvGuide.observeField("watchChannel", "onChannelSelected")
- m.top.appendChild(m.tvGuide)
- m.tvGuide.lastFocus.setFocus(true)
+ showTVGuid()
return
else if m.tvGuide <> invalid then
' Try to hide the TV Guide
@@ -301,6 +300,15 @@ sub optionsClosed()
m.itemGrid.setFocus(true)
end sub
+sub showTVGuid()
+ m.top.signalBeacon("EPGLaunchInitiate") ' Required Roku Performance monitoring
+ if m.tvGuide = invalid then
+ m.tvGuide = createObject("roSGNode", "Schedule")
+ endif
+ m.tvGuide.observeField("watchChannel", "onChannelSelected")
+ m.top.appendChild(m.tvGuide)
+ m.tvGuide.lastFocus.setFocus(true)
+end sub
sub onChannelSelected(msg)
node = msg.getRoSGNode()
diff --git a/components/ItemGrid2/ItemGrid2.xml b/components/ItemGrid2/ItemGrid2.xml
index 88d9d45e..deadfee1 100644
--- a/components/ItemGrid2/ItemGrid2.xml
+++ b/components/ItemGrid2/ItemGrid2.xml
@@ -36,5 +36,6 @@
+
diff --git a/source/Main.brs b/source/Main.brs
index 6938442c..9bceaf6f 100644
--- a/source/Main.brs
+++ b/source/Main.brs
@@ -486,6 +486,7 @@ function LoginFlow(startOver = false as boolean)
get_token(userSelected, "")
if get_setting("active_user") <> invalid then
m.user = AboutMe()
+ LoadUserPreferences()
SendPerformanceBeacon("AppDialogComplete") ' Roku Performance monitoring - Dialog Closed
return true
end if
@@ -508,6 +509,7 @@ function LoginFlow(startOver = false as boolean)
goto start_login
end if
+ LoadUserPreferences()
wipe_groups()
'Send Device Profile information to server
diff --git a/source/api/userauth.brs b/source/api/userauth.brs
index 2f4fae68..ba44365d 100644
--- a/source/api/userauth.brs
+++ b/source/api/userauth.brs
@@ -67,3 +67,19 @@ function GetPublicUsers()
resp = APIRequest(url)
return getJson(resp)
end function
+
+' Load and parse Display Settings from server
+sub LoadUserPreferences()
+ id = get_setting("active_user")
+ ' Currently using client "emby", which is what website uses so we get same Display prefs as web.
+ ' May want to change to specific Roku display settings
+ url = Substitute("DisplayPreferences/usersettings?userId={0}&client=emby", id)
+ resp = APIRequest(url)
+ jsonResponse = getJson(resp)
+
+ if jsonResponse <> invalid and jsonResponse.CustomPrefs <> invalid and jsonResponse.CustomPrefs["landing-livetv"] <> invalid then
+ set_user_setting("display.livetv.landing", jsonResponse.CustomPrefs["landing-livetv"])
+ else
+ unset_user_setting("display.livetv.landing")
+ end if
+end sub
\ No newline at end of file