Version 3.0.369

This commit is contained in:
Anja 2023-07-19 10:10:36 +02:00
parent 1a58bf58d3
commit f5cf9bb22f
70 changed files with 1130 additions and 773 deletions

View file

@ -1,4 +1,3 @@
using System;
using System.ComponentModel;
using System.Threading.Tasks;
@ -43,6 +42,47 @@ namespace TINK.ViewModel.Account
/// <summary> Reference on the tink app instance. </summary>
private ITinkApp TinkApp { get; }
/// <summary> Used to block more than on copri requests at a given time.</summary>
private bool isIdle = true;
/// <summary>
/// True if any action can be performed (logout etc.)
/// </summary>
public virtual bool IsIdle
{
get => isIdle;
set
{
if (value == isIdle)
return;
Log.ForContext<AccountPageViewModel>().Debug($"Switch value of {nameof(IsIdle)} to {value}.");
isIdle = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsIdle)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsProcessWithRunningProcessView)));
}
}
public bool IsProcessWithRunningProcessView => !isIdle;
/// <summary> Holds info about current action. </summary>
private string statusInfoText;
/// <summary> Holds info about current action. </summary>
public string StatusInfoText
{
get => statusInfoText;
set
{
if (value == statusInfoText)
return;
Log.ForContext<LoginPageViewModel>().Debug($"Switch value of {nameof(StatusInfoText)} to {value}.");
statusInfoText = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(StatusInfoText)));
}
}
/// <summary> Constructs a settings page view model object.</summary>
/// <param name="tinkApp"> Reference to tink app model.</param>
/// <param name="p_oUser"></param>
@ -261,6 +301,8 @@ namespace TINK.ViewModel.Account
/// </summary>
public async Task Logout()
{
StatusInfoText = AppResources.ActivityTextOneMomentPlease;
IsIdle = false;
try
{
// Backup logout message before logout.
@ -284,6 +326,9 @@ namespace TINK.ViewModel.Account
// Restart polling again.
await m_oViewUpdateManager.StartUpdateAyncPeridically(Polling.ToImmutable());
IsIdle = true;
StatusInfoText = string.Empty;
return;
}
catch (Exception l_oException)
@ -303,6 +348,9 @@ namespace TINK.ViewModel.Account
// Restart polling again.
await m_oViewUpdateManager.StartUpdateAyncPeridically(Polling.ToImmutable());
IsIdle = true;
StatusInfoText = string.Empty;
return;
}
@ -314,8 +362,12 @@ namespace TINK.ViewModel.Account
catch (Exception p_oException)
{
Log.Error("An unexpected error occurred displaying log out page. {@Exception}", p_oException);
IsIdle = true;
StatusInfoText = string.Empty;
return;
}
try
{
// Switch to map view after log out.
@ -328,8 +380,14 @@ namespace TINK.ViewModel.Account
catch (Exception p_oException)
{
Log.Error("An unexpected error occurred switching back to map page after displaying log out page. {@Exception}", p_oException);
IsIdle = true;
StatusInfoText = string.Empty;
return;
}
IsIdle = true;
StatusInfoText = string.Empty;
}
/// <summary>