[CHANGES]
This commit is contained in:
@@ -5,9 +5,9 @@
|
||||
<ForcedLoadingOverlay Visible="_isLoading"/>
|
||||
|
||||
@{
|
||||
var client = PreparingClient?.YouTubeClient;
|
||||
var client = ClientChannel?.YouTubeClient;
|
||||
var clientState = client?.State;
|
||||
var channel = PreparingClient?.Channel;
|
||||
var channel = ClientChannel?.Channel;
|
||||
var avatar = channel?.AvatarImages.FirstOrDefault();
|
||||
var banner = channel?.BannerImages.FirstOrDefault();
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ namespace Manager.App.Components.Dialogs
|
||||
{
|
||||
[CascadingParameter] private IMudDialogInstance? MudDialog { get; set; }
|
||||
[Parameter] public string DefaultUserAgent { get; set; } = "";
|
||||
private ClientPrep? PreparingClient { get; set; }
|
||||
private ClientChannel? ClientChannel { get; set; }
|
||||
private CookieCollection ImportCookies { get; set; } = [];
|
||||
private bool _isLoading;
|
||||
private AccountImportSteps _steps = AccountImportSteps.Authenticate;
|
||||
@@ -21,7 +21,7 @@ namespace Manager.App.Components.Dialogs
|
||||
|
||||
private bool CanSave()
|
||||
{
|
||||
return PreparingClient?.YouTubeClient?.State?.LoggedIn == true;
|
||||
return ClientChannel?.YouTubeClient?.State?.LoggedIn == true;
|
||||
}
|
||||
|
||||
private bool CanContinue()
|
||||
@@ -35,7 +35,7 @@ namespace Manager.App.Components.Dialogs
|
||||
}
|
||||
break;
|
||||
case AccountImportSteps.Validate:
|
||||
if (PreparingClient?.YouTubeClient?.State?.LoggedIn == true)
|
||||
if (ClientChannel?.YouTubeClient?.State?.LoggedIn == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ namespace Manager.App.Components.Dialogs
|
||||
case AccountImportSteps.Validate:
|
||||
if (CanSave())
|
||||
{
|
||||
MudDialog?.Close(DialogResult.Ok(PreparingClient));
|
||||
MudDialog?.Close(DialogResult.Ok(ClientChannel));
|
||||
await InvokeAsync(StateHasChanged);
|
||||
return;
|
||||
}
|
||||
@@ -88,8 +88,8 @@ namespace Manager.App.Components.Dialogs
|
||||
|
||||
private void ClearPreparedClient()
|
||||
{
|
||||
PreparingClient?.YouTubeClient?.Dispose();
|
||||
PreparingClient = null;
|
||||
ClientChannel?.YouTubeClient?.Dispose();
|
||||
ClientChannel = null;
|
||||
ImportCookies.Clear();
|
||||
_steps = AccountImportSteps.Authenticate;
|
||||
StateHasChanged();
|
||||
@@ -142,24 +142,24 @@ namespace Manager.App.Components.Dialogs
|
||||
private async Task BuildClient()
|
||||
{
|
||||
_isLoading = true;
|
||||
PreparingClient = new ClientPrep();
|
||||
ClientChannel = new ClientChannel();
|
||||
var clientResult = await YouTubeClient.CreateAsync(ImportCookies, DefaultUserAgent);
|
||||
if (clientResult.IsSuccess)
|
||||
{
|
||||
PreparingClient.YouTubeClient = clientResult.Value;
|
||||
ClientChannel.YouTubeClient = clientResult.Value;
|
||||
}
|
||||
|
||||
if (PreparingClient.YouTubeClient == null)
|
||||
if (ClientChannel.YouTubeClient == null)
|
||||
{
|
||||
SnackbarService.Add("Failed to get client!", Severity.Error);
|
||||
_isLoading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var accountResult = await PreparingClient.YouTubeClient.GetChannelByIdAsync(PreparingClient.YouTubeClient.Id);
|
||||
var accountResult = await ClientChannel.YouTubeClient.GetChannelByIdAsync(ClientChannel.YouTubeClient.Id);
|
||||
if (accountResult.IsSuccess)
|
||||
{
|
||||
PreparingClient.Channel = accountResult.Value;
|
||||
ClientChannel.Channel = accountResult.Value;
|
||||
}
|
||||
_isLoading = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
@@ -29,7 +29,7 @@ public partial class Channels : ComponentBase
|
||||
return;
|
||||
}
|
||||
|
||||
var clientPrep = (ClientPrep)result.Data;
|
||||
var clientPrep = (ClientChannel)result.Data;
|
||||
if (clientPrep?.YouTubeClient == null)
|
||||
{
|
||||
return;
|
||||
|
Reference in New Issue
Block a user