Feature/yt oauth (#550)
* feature flag * Move view * Service selection UI * tweak * tweak
This commit is contained in:
1 parent
4acc1bd0c6
commit
3cb3c4b8ab
19 files changed
+250
-19
No files matched your search
@@ -0,0 +1,5 @@
|
||||
<component name="BackendTypeContentNode" extends="ContentNode">
|
||||
<interface>
|
||||
<field id="backendLogoUri" type="uri" />
|
||||
</interface>
|
||||
</component>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
function OnContentSet() as void
|
||||
content = m.top.itemContent
|
||||
if content = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
m.top.backendName = content.title
|
||||
m.top.backendLogoUri = content.backendLogoUri
|
||||
end function
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<component name="BackendTypeRowListCell" extends="Group">
|
||||
<interface>
|
||||
<field id="itemContent" type="node" onChange="OnContentSet" />
|
||||
<field id="backendName" type="string" alias="BackendNameLabel.text" />
|
||||
<field id="backendLogoUri" type="uri" alias="BackendLogoPoster.uri" />
|
||||
</interface>
|
||||
|
||||
<children>
|
||||
<Group translation="[20,20]">
|
||||
<Poster
|
||||
id="BackendLogoPoster"
|
||||
width="160"
|
||||
height="160"
|
||||
translation="[20,20]">
|
||||
</Poster>
|
||||
<Label
|
||||
id="BackendNameLabel"
|
||||
width="200"
|
||||
horizAlign="center"
|
||||
translation="[0,240]">
|
||||
</Label>
|
||||
</Group>
|
||||
</children>
|
||||
</component>
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/RemoteKeys.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.rowList = m.top.FindNode("BackendRowList")
|
||||
m.rowList.ObserveField("rowItemSelected", FuncName(OnRowItemSelected))
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
if not m.top.focus
|
||||
return
|
||||
end if
|
||||
|
||||
NodeSetFocus(m.rowList, true)
|
||||
end function
|
||||
|
||||
function OnKeyEvent(key as string, press as boolean) as boolean
|
||||
if key = RemoteKeys.Options or key = RemoteKeys.Play or key = RemoteKeys.Pause or key = RemoteKeys.PlayOnly
|
||||
' A pass-through to the app controller, so it can toggle picture-in-picture and pause/play
|
||||
return false
|
||||
end if
|
||||
|
||||
if key = RemoteKeys.Back and press
|
||||
Close()
|
||||
return true
|
||||
end if
|
||||
|
||||
return true
|
||||
end function
|
||||
|
||||
function Close()
|
||||
m.top.appController@.PopScreen()
|
||||
end function
|
||||
|
||||
function OnRowItemSelected(event as object) as void
|
||||
index = event.GetData()
|
||||
if index = invalid or index.count() <> 2
|
||||
LogWarn("Invalid index:", index)
|
||||
return
|
||||
end if
|
||||
|
||||
Close()
|
||||
|
||||
content = m.rowList.content
|
||||
|
||||
rowIndex = index[0]
|
||||
rowItemIndex = index[1]
|
||||
|
||||
row = content.GetChild(rowIndex)
|
||||
rowItem = row.GetChild(rowItemIndex)
|
||||
|
||||
m.top.selectedBackendType = rowItem.id
|
||||
end function
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
<component name="BackendTypeSelectionView" extends="Group" includes="AutoBind,Focus">
|
||||
<interface>
|
||||
<field id="selectedBackendType" type="string" />
|
||||
<field id="appController" type="node" bind="/AppController" />
|
||||
</interface>
|
||||
<children>
|
||||
<Rectangle
|
||||
width="1280"
|
||||
height="720"
|
||||
color="#000000"
|
||||
opacity="0.5">
|
||||
</Rectangle>
|
||||
|
||||
<Rectangle
|
||||
width="720"
|
||||
height="420"
|
||||
translation="[280,150]"
|
||||
color="#242424">
|
||||
<Label
|
||||
width="720"
|
||||
horizAlign="center"
|
||||
translation="[0,38]"
|
||||
text="Select a service to login">
|
||||
<Font role="font" uri="font:SystemFontFile" size="24" />
|
||||
</Label>
|
||||
|
||||
<RowList
|
||||
id="BackendRowList"
|
||||
translation="[120,100]"
|
||||
numRows="2"
|
||||
rowitemSize="[[240,240]]"
|
||||
rowItemSpacing="[[0,0]]"
|
||||
itemSize="[500,500]"
|
||||
itemComponentName="BackendTypeRowListCell"
|
||||
rowFocusAnimationStyle="floatingfocus"
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png">
|
||||
<ContentNode role="content">
|
||||
<ContentNode>
|
||||
<BackendTypeContentNode id="BackendTypeYouTube" title="YouTube" backendLogoUri="pkg:/images/youtube-logo.png" />
|
||||
<BackendTypeContentNode id="BackendTypeInvidious" title="Invidious" backendLogoUri="pkg:/images/invidious-logo.png" />
|
||||
</ContentNode>
|
||||
</ContentNode>
|
||||
</RowList>
|
||||
</Rectangle>
|
||||
</children>
|
||||
</component>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
namespace BackendTypeSelectionViewUtils
|
||||
|
||||
function Open(appController as object) as object
|
||||
backendTypeSelectionView = CreateObject("roSGNode", "BackendTypeSelectionView")
|
||||
|
||||
appController@.PushScreen(backendTypeSelectionView)
|
||||
backendTypeSelectionView@.BindNode()
|
||||
return backendTypeSelectionView
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -1,2 +0,0 @@
|
||||
<component name="ProfileRowList" extends="RowList">
|
||||
</component>
|
||||
@@ -1,7 +1,9 @@
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/components/ProfileView/ProfileViewUtils.bs"
|
||||
import "pkg:/components/Screens/ProfileScreen/BackendTypeSelectionView/BackendTypeSelectionViewUtils.bs"
|
||||
import "pkg:/components/Screens/ProfileScreen/ProfileView/ProfileViewUtils.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/RemoteKeys.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
@@ -38,26 +40,58 @@ function OnRowItemSelected() as void
|
||||
row = m.profileRowList.content.GetChild(0)
|
||||
selectedProfile = row.GetChild(index)
|
||||
if selectedProfile.type = "login"
|
||||
invidiousInstance = m.preferences["invidious.instance"]
|
||||
if StringUtils.IsNullOrEmpty(invidiousInstance)
|
||||
DialogUtils.ShowDialogEx({
|
||||
title: "No Invidious Instance"
|
||||
message: [
|
||||
"Playlet built-in backend does not support login yet.",
|
||||
"Can only login if an Invidious instance is set in the settings."
|
||||
]
|
||||
})
|
||||
#if YT_OAUTH_SUPPORT
|
||||
backendTypeSelectionView = BackendTypeSelectionViewUtils.Open(m.appController)
|
||||
backendTypeSelectionView.observeFieldScoped("selectedBackendType", FuncName(OnBackEndSelected))
|
||||
return
|
||||
end if
|
||||
dialog = CreateObject("roSGNode", "LoginDialog")
|
||||
dialog@.BindNode()
|
||||
m.top.getScene().dialog = dialog
|
||||
return
|
||||
#else
|
||||
LoginWithInvidious()
|
||||
return
|
||||
#end if
|
||||
end if
|
||||
|
||||
ProfileViewUtils.Open(selectedProfile, m.appController)
|
||||
end function
|
||||
|
||||
function OnBackEndSelected(event as object) as void
|
||||
backendTypeSelectionView = event.GetRoSGNode()
|
||||
backendTypeSelectionView.unobserveFieldScoped("selectedBackendType")
|
||||
|
||||
selectedBackendType = event.getData()
|
||||
if selectedBackendType = "BackendTypeInvidious"
|
||||
LoginWithInvidious()
|
||||
else if selectedBackendType = "BackendTypeYouTube"
|
||||
LoginWithYouTube()
|
||||
else
|
||||
LogError("Unknown backend type:", selectedBackendType)
|
||||
end if
|
||||
end function
|
||||
|
||||
function LoginWithInvidious() as void
|
||||
invidiousInstance = m.preferences["invidious.instance"]
|
||||
if StringUtils.IsNullOrEmpty(invidiousInstance)
|
||||
DialogUtils.ShowDialogEx({
|
||||
title: "No Invidious Instance"
|
||||
message: [
|
||||
"Playlet built-in backend does not support login yet.",
|
||||
"Can only login if an Invidious instance is set in the settings."
|
||||
]
|
||||
})
|
||||
return
|
||||
end if
|
||||
|
||||
dialog = CreateObject("roSGNode", "LoginDialog")
|
||||
dialog@.BindNode()
|
||||
m.top.getScene().dialog = dialog
|
||||
end function
|
||||
|
||||
function LoginWithYouTube() as void
|
||||
DialogUtils.ShowDialogEx({
|
||||
title: "YouTube"
|
||||
message: ["Not implemented yet."]
|
||||
})
|
||||
end function
|
||||
|
||||
function OnCurrentProfileChanged() as void
|
||||
currentProfile = m.profilesService.currentProfile
|
||||
if currentProfile = invalid
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</interface>
|
||||
|
||||
<children>
|
||||
<ProfileRowList
|
||||
<RowList
|
||||
id="ProfileRowList"
|
||||
translation="[0,160]"
|
||||
numRows="2"
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="512pt" height="512pt" version="1.0" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<g>
|
||||
<path d="m247.17 455.95c-19.792-0.78921-38.719-4.2564-57.154-10.47-60.968-20.55-108.68-68.579-127-127.86-7.8955-25.538-10.062-53.943-6.2586-82.067 3.7105-27.439 13.603-53.515 29.342-77.344 12.069-18.273 29.138-36.277 47.228-49.816 36.891-27.61 85.944-42.49 132.38-40.157 25.88 1.3001 49.939 6.765 73.106 16.606 8.1948 3.481 20.024 9.6845 27.696 14.525 14.15 8.9272 22.367 15.498 34.482 27.573 13.254 13.211 22.128 24.276 30.398 37.906 7.2081 11.879 14.099 27.15 18.229 40.397 1.5996 5.1305 4.442 16.456 5.6852 22.653 2.3908 11.917 2.6998 15.722 2.7049 33.312 6e-3 18.515-0.46256 24.413-2.9166 36.758-9.3274 46.92-35.58 88.167-74.872 117.64-22.814 17.112-50.027 29.535-78.547 35.858-16.714 3.7059-35.421 5.2453-54.498 4.4846zm-35.1-78.786c-5.3e-4 -0.52647-0.0741-2.0564-0.16311-3.3999l-0.16178-2.4427-4.7018-0.26271c-4.0477-0.22614-4.7968-0.33363-5.3847-0.77253-2.0235-1.5108-1.4679-6.0695 2.2494-18.457 0.8637-2.8781 3.3371-11.321 5.4966-18.762 2.1594-7.4409 5.2002-17.836 6.7573-23.101 1.5571-5.2648 4.1948-14.282 5.8615-20.038 1.6667-5.7562 3.6145-12.4 4.3284-14.764 0.71391-2.3641 3.2583-11.037 5.6542-19.272 4.9475-17.007 8.1626-27.723 8.9438-29.811 0.51852-1.3858 0.54785-1.4139 0.99761-0.95317 0.25486 0.26106 3.8462 7.3667 7.9807 15.79 4.1345 8.4236 13.089 26.573 19.898 40.331 17.188 34.73 37.849 76.578 43.261 87.622l4.5356 9.257 11.359-0.0895c6.2475-0.0492 11.615-0.19623 11.929-0.32672 0.5614-0.23385 0.54167-0.2959-1.3723-4.3176-1.068-2.2442-8.1436-16.601-15.724-31.904-48.687-98.293-61.22-123.86-67.889-138.48-4.7022-10.309-6.9031-14.807-7.7139-15.762-0.82931-0.97742-1.6319-1.0638-2.3704-0.25525-1.1993 1.313-4.1046 10.063-9.3869 28.27-2.0569 7.0899-6.5372 22.425-9.9562 34.077-6.6396 22.629-8.5182 29.037-14.33 48.883-2.0354 6.9495-4.7977 16.369-6.1385 20.931-1.3408 4.5628-4.033 13.81-5.9826 20.549-4.304 14.877-6.136 20.889-7.3886 24.25-2.1371 5.7334-2.5723 6.3292-4.9216 6.7384-0.88855 0.15472-2.4102 0.28196-3.3815 0.28275-2.1993 3e-3 -3.5494 0.36339-4.0558 1.0863-0.42176 0.60215-0.56421 4.8802-0.18251 5.4812 0.20573 0.32388 2.4672 0.37414 23.34 0.51873l8.6151 0.0597-7e-4 -0.95723zm36.751-205.59c4.3282-0.92335 8.4607-4.943 9.4374-9.1796 0.36569-1.5862 0.32543-4.9758-0.077-6.4799-0.85108-3.1813-3.2688-6.291-6.039-7.7675-3.8111-2.0313-9.456-2.0295-13.272 5e-3 -5.9828 3.1888-8.1556 11.089-4.7878 17.408 2.6995 5.0648 8.3611 7.3754 14.738 6.015z" fill="#f0f0f0" stroke-width=".025526" />
|
||||
</g>
|
||||
<g transform="matrix(.069892 0 0 -.069892 44.236 474.48)">
|
||||
<path d="m2787 4669c-124-65-123-255 3-319 86-44 196-16 247 62 58 87 26 211-67 258-51 26-132 26-183-1z" fill="#00b6f0" stroke="#00b6f0" stroke-width="4.25" />
|
||||
<path d="m2882 4108c-12-16-63-166-102-303-30-104-101-350-165-565-20-69-58-199-85-290-26-91-64-221-85-290-20-69-58-199-85-290-26-91-64-221-85-290-20-69-57-195-81-280-59-207-93-299-115-310-10-6-35-10-56-10-73 0-84-8-81-54l3-41 228-3 228-2-3 47-3 48-73 3c-66 3-74 5-84 27-13 28 0 104 37 225 13 41 47 156 75 255s66 230 85 290c18 61 56 191 85 290 28 99 66 230 85 290 18 61 56 191 85 290 85 297 123 419 131 429 5 5 17-11 28-35 10-24 192-393 403-819s447-902 523-1058l139-282h168c92 0 168 4 168 8s-75 158-166 342c-588 1183-969 1958-1033 2100-29 63-69 151-89 195-44 95-58 110-80 83z" fill="#575757" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.3 KiB |
@@ -0,0 +1,11 @@
|
||||
{
|
||||
inputHash: '339be7a03116276ba83ce7b1bb905e40',
|
||||
outputs: [
|
||||
{
|
||||
outputFilePath: 'images/invidious-logo.png',
|
||||
outputHash: '31fcb0fb5d7506ba6e742a31497ca052',
|
||||
width: 256,
|
||||
height: 256,
|
||||
},
|
||||
],
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
@@ -0,0 +1,15 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" id="yt-ringo2-svg_yt14" width="93" height="20" viewBox="0 0 93 20" focusable="false" aria-hidden="true" style="pointer-events: none; display: inherit; width: 100%; height: 100%;">
|
||||
<g>
|
||||
<path d="M14.4848 20C14.4848 20 23.5695 20 25.8229 19.4C27.0917 19.06 28.0459 18.08 28.3808 16.87C29 14.65 29 9.98 29 9.98C29 9.98 29 5.34 28.3808 3.14C28.0459 1.9 27.0917 0.94 25.8229 0.61C23.5695 0 14.4848 0 14.4848 0C14.4848 0 5.42037 0 3.17711 0.61C1.9286 0.94 0.954148 1.9 0.59888 3.14C0 5.34 0 9.98 0 9.98C0 9.98 0 14.65 0.59888 16.87C0.954148 18.08 1.9286 19.06 3.17711 19.4C5.42037 20 14.4848 20 14.4848 20Z" fill="#FF0033"></path>
|
||||
<path d="M19 10L11.5 5.75V14.25L19 10Z" fill="white"></path>
|
||||
</g>
|
||||
<g id="youtube-paths_yt14" fill="white">
|
||||
<path d="M37.1384 18.8999V13.4399L40.6084 2.09994H38.0184L36.6984 7.24994C36.3984 8.42994 36.1284 9.65994 35.9284 10.7999H35.7684C35.6584 9.79994 35.3384 8.48994 35.0184 7.22994L33.7384 2.09994H31.1484L34.5684 13.4399V18.8999H37.1384Z"></path>
|
||||
<path d="M44.1003 6.29994C41.0703 6.29994 40.0303 8.04994 40.0303 11.8199V13.6099C40.0303 16.9899 40.6803 19.1099 44.0403 19.1099C47.3503 19.1099 48.0603 17.0899 48.0603 13.6099V11.8199C48.0603 8.44994 47.3803 6.29994 44.1003 6.29994ZM45.3903 14.7199C45.3903 16.3599 45.1003 17.3899 44.0503 17.3899C43.0203 17.3899 42.7303 16.3499 42.7303 14.7199V10.6799C42.7303 9.27994 42.9303 8.02994 44.0503 8.02994C45.2303 8.02994 45.3903 9.34994 45.3903 10.6799V14.7199Z"></path>
|
||||
<path d="M52.2713 19.0899C53.7313 19.0899 54.6413 18.4799 55.3913 17.3799H55.5013L55.6113 18.8999H57.6012V6.53994H54.9613V16.4699C54.6812 16.9599 54.0312 17.3199 53.4212 17.3199C52.6512 17.3199 52.4113 16.7099 52.4113 15.6899V6.53994H49.7812V15.8099C49.7812 17.8199 50.3613 19.0899 52.2713 19.0899Z"></path>
|
||||
<path d="M62.8261 18.8999V4.14994H65.8661V2.09994H57.1761V4.14994H60.2161V18.8999H62.8261Z"></path>
|
||||
<path d="M67.8728 19.0899C69.3328 19.0899 70.2428 18.4799 70.9928 17.3799H71.1028L71.2128 18.8999H73.2028V6.53994H70.5628V16.4699C70.2828 16.9599 69.6328 17.3199 69.0228 17.3199C68.2528 17.3199 68.0128 16.7099 68.0128 15.6899V6.53994H65.3828V15.8099C65.3828 17.8199 65.9628 19.0899 67.8728 19.0899Z"></path>
|
||||
<path d="M80.6744 6.26994C79.3944 6.26994 78.4744 6.82994 77.8644 7.73994H77.7344C77.8144 6.53994 77.8744 5.51994 77.8744 4.70994V1.43994H75.3244L75.3144 12.1799L75.3244 18.8999H77.5444L77.7344 17.6999H77.8044C78.3944 18.5099 79.3044 19.0199 80.5144 19.0199C82.5244 19.0199 83.3844 17.2899 83.3844 13.6099V11.6999C83.3844 8.25994 82.9944 6.26994 80.6744 6.26994ZM80.7644 13.6099C80.7644 15.9099 80.4244 17.2799 79.3544 17.2799C78.8544 17.2799 78.1644 17.0399 77.8544 16.5899V9.23994C78.1244 8.53994 78.7244 8.02994 79.3944 8.02994C80.4744 8.02994 80.7644 9.33994 80.7644 11.7299V13.6099Z"></path>
|
||||
<path d="M92.6517 11.4999C92.6517 8.51994 92.3517 6.30994 88.9217 6.30994C85.6917 6.30994 84.9717 8.45994 84.9717 11.6199V13.7899C84.9717 16.8699 85.6317 19.1099 88.8417 19.1099C91.3817 19.1099 92.6917 17.8399 92.5417 15.3799L90.2917 15.2599C90.2617 16.7799 89.9117 17.3999 88.9017 17.3999C87.6317 17.3999 87.5717 16.1899 87.5717 14.3899V13.5499H92.6517V11.4999ZM88.8617 7.96994C90.0817 7.96994 90.1717 9.11994 90.1717 11.0699V12.0799H87.5717V11.0699C87.5717 9.13994 87.6517 7.96994 88.8617 7.96994Z"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.3 KiB |
@@ -0,0 +1,11 @@
|
||||
{
|
||||
inputHash: '38d7d7e95f79456ccb7a29aef004dd73',
|
||||
outputs: [
|
||||
{
|
||||
outputFilePath: 'images/youtube-logo.png',
|
||||
outputHash: 'a015e471b97c7ffbbd012b4c9b9e0624',
|
||||
width: 256,
|
||||
height: 256,
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -13,4 +13,4 @@ hidden=1
|
||||
|
||||
git_commit_sha=unknown
|
||||
|
||||
bs_const=DEBUG=false
|
||||
bs_const=DEBUG=false;YT_OAUTH_SUPPORT=false
|
||||
Reference in new issue
Block a user