Working version
This commit is contained in:
parent
2aece6ef5d
commit
a0feb86bbf
|
@ -349,6 +349,7 @@ function LoginFlow(startOver = false as boolean)
|
|||
m.global.sceneManager.callFunc("clearScenes")
|
||||
return false
|
||||
end if
|
||||
SaveServerList()
|
||||
end if
|
||||
|
||||
if get_setting("active_user") = invalid
|
||||
|
@ -374,7 +375,6 @@ function LoginFlow(startOver = false as boolean)
|
|||
get_token(userSelected, "")
|
||||
if get_setting("active_user") <> invalid
|
||||
m.user = AboutMe()
|
||||
SaveServerList()
|
||||
LoadUserPreferences()
|
||||
SendPerformanceBeacon("AppDialogComplete") ' Roku Performance monitoring - Dialog Closed
|
||||
return true
|
||||
|
@ -397,7 +397,6 @@ function LoginFlow(startOver = false as boolean)
|
|||
goto start_login
|
||||
end if
|
||||
|
||||
SaveServerList()
|
||||
LoadUserPreferences()
|
||||
m.global.sceneManager.callFunc("clearScenes")
|
||||
|
||||
|
@ -412,22 +411,30 @@ end function
|
|||
sub SaveServerList()
|
||||
'Save off this server to our list of saved servers for easier navigation between servers
|
||||
server = get_setting("server")
|
||||
alreadySaved = false
|
||||
saved = get_setting("saved_servers")
|
||||
if saved <> invalid
|
||||
entryCount = 0
|
||||
addNewEntry = true
|
||||
savedServers = { serverList: [] }
|
||||
if saved <> invalid
|
||||
savedServers = ParseJson(saved)
|
||||
for each item in savedServers.serverList
|
||||
if item.baseUrl = LCase(server) 'Saved server data is always lowercase
|
||||
alreadySaved = true
|
||||
exit for
|
||||
end if
|
||||
end for
|
||||
if alreadySaved = false
|
||||
savedServers.serverList.Push({ name: m.serverSelection, baseUrl: LCase(server), username: m.user.name, iconUrl: "pkg:/images/logo-icon120.jpg", iconWidth: 120, iconHeight: 120 })
|
||||
entryCount = savedServers.serverList.Count()
|
||||
if savedServers.serverList <> invalid and entryCount > 0
|
||||
for each item in savedServers.serverList
|
||||
if item.baseUrl = LCase(server) 'Saved server data is always lowercase
|
||||
addNewEntry = false
|
||||
exit for
|
||||
end if
|
||||
end for
|
||||
end if
|
||||
end if
|
||||
|
||||
if addNewEntry
|
||||
if entryCount = 0
|
||||
set_setting("saved_servers", FormatJson({ serverList: [{ name: m.serverSelection, baseUrl: LCase(server), iconUrl: "pkg:/images/logo-icon120.jpg", iconWidth: 120, iconHeight: 120 }] }))
|
||||
else
|
||||
savedServers.serverList.Push({ name: m.serverSelection, baseUrl: LCase(server), iconUrl: "pkg:/images/logo-icon120.jpg", iconWidth: 120, iconHeight: 120 })
|
||||
set_setting("saved_servers", FormatJson(savedServers))
|
||||
end if
|
||||
else
|
||||
set_setting("saved_servers", FormatJson({ serverList: [{ name: m.serverSelection, baseUrl: LCase(server), username: m.user.name, iconUrl: "pkg:/images/logo-icon120.jpg", iconWidth: 120, iconHeight: 120 }] }))
|
||||
end if
|
||||
end sub
|
||||
|
||||
|
|
|
@ -370,17 +370,18 @@ sub UpdateSavedServerList()
|
|||
end if
|
||||
|
||||
saved = get_setting("saved_servers")
|
||||
if saved <> invalid
|
||||
if saved <> invalid
|
||||
savedServers = ParseJson(saved)
|
||||
newServers = { serverList: [] }
|
||||
for each item in savedServers.serverList
|
||||
if item.baseUrl = LCase(server) and item.username = username ' Saved server data is always lowercase
|
||||
item.password = password
|
||||
end if
|
||||
newServers.serverList.Push(item)
|
||||
end for
|
||||
set_setting("saved_servers", FormatJson(newServers))
|
||||
else
|
||||
set_setting("saved_servers", FormatJson({ serverList: [{ name: "Saved", baseUrl: LCase(server), username: username, password: password, iconUrl: "pkg:/images/logo-icon120.jpg", iconWidth: 120, iconHeight: 120 }] }))
|
||||
if savedServers.serverList <> invalid and savedServers.serverList.Count() > 0
|
||||
newServers = { serverList: [] }
|
||||
for each item in savedServers.serverList
|
||||
if item.baseUrl = LCase(server) ' Saved server data is always lowercase
|
||||
item.username = username
|
||||
item.password = password
|
||||
end if
|
||||
newServers.serverList.Push(item)
|
||||
end for
|
||||
set_setting("saved_servers", FormatJson(newServers))
|
||||
end if
|
||||
end if
|
||||
end sub
|
||||
|
|
Loading…
Reference in New Issue
Block a user