Fix (#548)
This commit is contained in:
parent
fc6f494f0d
commit
397a516dc1
@ -237,6 +237,8 @@ namespace ApplicationServices
|
|||||||
archiver?.DeleteAllButNewestN(20);
|
archiver?.DeleteAllButNewestN(20);
|
||||||
|
|
||||||
foreach (var account in accounts)
|
foreach (var account in accounts)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// get APIs in serial b/c of logins. do NOT move inside of parallel (Task.WhenAll)
|
// get APIs in serial b/c of logins. do NOT move inside of parallel (Task.WhenAll)
|
||||||
var apiExtended = await apiExtendedfunc(account);
|
var apiExtended = await apiExtendedfunc(account);
|
||||||
@ -244,6 +246,12 @@ namespace ApplicationServices
|
|||||||
// add scanAccountAsync as a TASK: do not await
|
// add scanAccountAsync as a TASK: do not await
|
||||||
tasks.Add(scanAccountAsync(apiExtended, account, libraryOptions, archiver));
|
tasks.Add(scanAccountAsync(apiExtended, account, libraryOptions, archiver));
|
||||||
}
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
//Catch to allow other accounts to continue scanning.
|
||||||
|
Log.Logger.Error(ex, "Failed to scan account");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// import library in parallel
|
// import library in parallel
|
||||||
var arrayOfLists = await Task.WhenAll(tasks);
|
var arrayOfLists = await Task.WhenAll(tasks);
|
||||||
|
|||||||
@ -25,7 +25,7 @@ namespace LibationAvalonia.Dialogs.Login
|
|||||||
{
|
{
|
||||||
var dialog = new LoginChoiceEagerDialog(_account);
|
var dialog = new LoginChoiceEagerDialog(_account);
|
||||||
|
|
||||||
if (await dialog.ShowDialogAsync() is not DialogResult.OK)
|
if (await dialog.ShowDialogAsync() is not DialogResult.OK || string.IsNullOrWhiteSpace(dialog.Password))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
switch (dialog.LoginMethod)
|
switch (dialog.LoginMethod)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using Avalonia;
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace LibationAvalonia.Dialogs.Login
|
namespace LibationAvalonia.Dialogs.Login
|
||||||
{
|
{
|
||||||
@ -31,6 +32,17 @@ namespace LibationAvalonia.Dialogs.Login
|
|||||||
DataContext = this;
|
DataContext = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override async Task SaveAndCloseAsync()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(Password))
|
||||||
|
{
|
||||||
|
await MessageBox.Show(this, "Please enter your password");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await base.SaveAndCloseAsync();
|
||||||
|
}
|
||||||
|
|
||||||
public async void ExternalLoginLink_Tapped(object sender, Avalonia.Input.TappedEventArgs e)
|
public async void ExternalLoginLink_Tapped(object sender, Avalonia.Input.TappedEventArgs e)
|
||||||
{
|
{
|
||||||
LoginMethod = LoginMethod.External;
|
LoginMethod = LoginMethod.External;
|
||||||
|
|||||||
@ -427,6 +427,10 @@ namespace LibationAvalonia.ViewModels
|
|||||||
foreach (var r in removable)
|
foreach (var r in removable)
|
||||||
r.Remove = true;
|
r.Remove = true;
|
||||||
}
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
Serilog.Log.Information("Audible login attempt cancelled by user");
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await MessageBox.ShowAdminAlert(
|
await MessageBox.ShowAdminAlert(
|
||||||
|
|||||||
@ -32,6 +32,10 @@ namespace LibationAvalonia.Views
|
|||||||
{
|
{
|
||||||
await LibraryCommands.ImportAccountAsync(Dialogs.Login.AvaloniaLoginChoiceEager.ApiExtendedFunc, accounts);
|
await LibraryCommands.ImportAccountAsync(Dialogs.Login.AvaloniaLoginChoiceEager.ApiExtendedFunc, accounts);
|
||||||
}
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
Serilog.Log.Information("Audible login attempt cancelled by user");
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Serilog.Log.Logger.Error(ex, "Error invoking auto-scan");
|
Serilog.Log.Logger.Error(ex, "Error invoking auto-scan");
|
||||||
|
|||||||
@ -69,6 +69,10 @@ namespace LibationAvalonia.Views
|
|||||||
if (Configuration.Instance.ShowImportedStats && newAdded > 0)
|
if (Configuration.Instance.ShowImportedStats && newAdded > 0)
|
||||||
await MessageBox.Show($"Total processed: {totalProcessed}\r\nNew: {newAdded}");
|
await MessageBox.Show($"Total processed: {totalProcessed}\r\nNew: {newAdded}");
|
||||||
}
|
}
|
||||||
|
catch(OperationCanceledException)
|
||||||
|
{
|
||||||
|
Serilog.Log.Information("Audible login attempt cancelled by user");
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await MessageBox.ShowAdminAlert(
|
await MessageBox.ShowAdminAlert(
|
||||||
|
|||||||
@ -37,6 +37,12 @@ namespace LibationWinForms.Dialogs.Login
|
|||||||
Email = accountId;
|
Email = accountId;
|
||||||
Password = this.passwordTb.Text;
|
Password = this.passwordTb.Text;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(Password))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Please enter your password");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Serilog.Log.Logger.Information("Submit button clicked: {@DebugInfo}", new { email = Email?.ToMask(), passwordLength = Password.Length });
|
Serilog.Log.Logger.Information("Submit button clicked: {@DebugInfo}", new { email = Email?.ToMask(), passwordLength = Password.Length });
|
||||||
|
|
||||||
LoginMethod = AudibleApi.LoginMethod.Api;
|
LoginMethod = AudibleApi.LoginMethod.Api;
|
||||||
|
|||||||
@ -25,7 +25,7 @@ namespace LibationWinForms.Login
|
|||||||
{
|
{
|
||||||
using var dialog = new LoginChoiceEagerDialog(_account);
|
using var dialog = new LoginChoiceEagerDialog(_account);
|
||||||
|
|
||||||
if (!ShowDialog(dialog))
|
if (!ShowDialog(dialog) || string.IsNullOrWhiteSpace(dialog.Password))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
switch (dialog.LoginMethod)
|
switch (dialog.LoginMethod)
|
||||||
|
|||||||
@ -38,6 +38,10 @@ namespace LibationWinForms
|
|||||||
else
|
else
|
||||||
await importAsync();
|
await importAsync();
|
||||||
}
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
Serilog.Log.Information("Audible login attempt cancelled by user");
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Serilog.Log.Logger.Error(ex, "Error invoking auto-scan");
|
Serilog.Log.Logger.Error(ex, "Error invoking auto-scan");
|
||||||
|
|||||||
@ -80,6 +80,10 @@ namespace LibationWinForms
|
|||||||
if (Configuration.Instance.ShowImportedStats && newAdded > 0)
|
if (Configuration.Instance.ShowImportedStats && newAdded > 0)
|
||||||
MessageBox.Show($"Total processed: {totalProcessed}\r\nNew: {newAdded}");
|
MessageBox.Show($"Total processed: {totalProcessed}\r\nNew: {newAdded}");
|
||||||
}
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
Serilog.Log.Information("Audible login attempt cancelled by user");
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBoxLib.ShowAdminAlert(
|
MessageBoxLib.ShowAdminAlert(
|
||||||
|
|||||||
@ -288,6 +288,10 @@ namespace LibationWinForms.GridView
|
|||||||
|
|
||||||
productsGrid_RemovableCountChanged(this, null);
|
productsGrid_RemovableCountChanged(this, null);
|
||||||
}
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
Serilog.Log.Information("Audible login attempt cancelled by user");
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBoxLib.ShowAdminAlert(
|
MessageBoxLib.ShowAdminAlert(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user