More OAuth work (#551)

* More OAuth work

* Lint fix

* tweaks

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
This commit is contained in:
Brahim Hadricheandgithub-action linter authored and GitHub committed 2025-01-28 22:20:07 -05:00
1 parent 12231fe2ec
commit 29a3206f17
11 files changed
+382 -25

No files matched your search

@@ -24,24 +24,37 @@ function OnContentSet() as void
return
end if
m.top.circlePosterInnerUri = "pkg:/images/white-circle.png"
m.top.circlePosterInnerBlendColor = content.color
username = content.username
m.top.username = username
if not StringUtils.IsNullOrEmpty(username)
m.top.letter = UCase(username.Left(1))
else
thumbnail = content.thumbnail
if not StringUtils.IsNullOrEmpty(thumbnail)
m.top.circlePosterInnerUri = thumbnail
' bs:disable-next-line LINT3023
m.top.circlePosterInnerBlendColor = "#FFFFFFFF"
m.top.letter = ""
else
m.top.circlePosterInnerUri = "pkg:/images/white-circle.png"
m.top.circlePosterInnerBlendColor = content.color
if not StringUtils.IsNullOrEmpty(username)
m.top.letter = UCase(username.Left(1))
else
m.top.letter = ""
end if
end if
m.top.serverUrl = content.serverUrl
m.top.crownVisible = content.isSelected
backendType = content.type
if backendType = "invidious"
m.top.serverUrl = content.serverUrl
m.top.backendTypePosterUri = "pkg:/images/invidious-logo.png"
else if backendType = "youtube"
m.top.serverUrl = "YouTube"
m.top.backendTypePosterUri = "pkg:/images/youtube-logo.png"
else
m.top.serverUrl = ""
m.top.backendTypePosterUri = ""
end if
end function
@@ -61,7 +61,7 @@ function OnBackEndSelected(event as object) as void
if selectedBackendType = "BackendTypeInvidious"
LoginWithInvidious()
else if selectedBackendType = "BackendTypeYouTube"
LoginWithYouTube()
ShowLoginWithYouTubeDialog()
else
LogError("Unknown backend type:", selectedBackendType)
end if
@@ -85,11 +85,32 @@ function LoginWithInvidious() as void
m.top.getScene().dialog = dialog
end function
function LoginWithYouTube() as void
DialogUtils.ShowDialogEx({
title: "YouTube"
message: ["Not implemented yet."]
function ShowLoginWithYouTubeDialog() as void
' TODO:P2 localize
dialog = DialogUtils.ShowDialogEx({
title: "Disclaimer"
message: "Playlet authors acknowledge that all trademarks and registered trademarks mentioned in this application and related pages are the property of their respective owners. The use of these trademarks or trade names is for identification purposes only and does not imply any endorsement, affiliation, or sponsorship by the trademark owner."
buttons: [
Tr(Locale.Buttons.OK)
Tr(Locale.Buttons.Cancel)
]
})
dialog.ObserveField("buttonSelected", FuncName(OnLoginWithYouTubeDialogButtonSelected))
end function
function OnLoginWithYouTubeDialogButtonSelected(event as object) as void
buttonSelected = event.getData()
if buttonSelected <> 0
return
end if
LoginWithYouTube()
end function
function LoginWithYouTube() as void
dialog = CreateObject("roSGNode", "YouTubeLoginDialog")
dialog@.BindNode()
m.top.getScene().dialog = dialog
end function
function OnCurrentProfileChanged() as void
@@ -43,6 +43,16 @@ function OnContentSet() as void
end if
m.top.serverUrl = content.serverUrl
m.top.crownVisible = content.isSelected
backendType = content.type
if backendType = "invidious"
m.top.backendTypePosterUri = "pkg:/images/invidious-logo.png"
else if backendType = "youtube"
m.top.backendTypePosterUri = "pkg:/images/youtube-logo.png"
else
m.top.backendTypePosterUri = ""
end if
UpdateActivateButton()
end function
@@ -5,6 +5,7 @@
<field id="username" type="string" alias="UsernameLabel.text" />
<field id="serverUrl" type="string" alias="ServerLabel.text" />
<field id="circlePosterInnerUri" type="uri" alias="circlePosterInner.uri" />
<field id="backendTypePosterUri" type="uri" alias="backendTypePoster.uri" />
<field id="circlePosterInnerBlendColor" type="uri" alias="circlePosterInner.blendColor" />
<field id="crownVisible" type="boolean" alias="CrownPoster.visible" />
@@ -47,6 +48,12 @@
horizAlign="center">
<Font role="font" uri="font:SystemFontFile" size="120" />
</Label>
<Poster
id="backendTypePoster"
width="60"
height="60"
translation="[110,110]"
/>
</Poster>
<Poster
id="CrownPoster"