mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-05-21 00:16:35 +02:00
Version 3.0.338
This commit is contained in:
parent
573fe77e12
commit
0468955d49
751 changed files with 62747 additions and 60672 deletions
|
@ -6,68 +6,68 @@ using Xamarin.Essentials;
|
|||
|
||||
namespace TINK.Model.User.Account
|
||||
{
|
||||
public class Store : IStore
|
||||
{
|
||||
/// <summary> Holds id of the debug level key. </summary>
|
||||
private const string KEY_DEBUGLEVEL = "DebugLevel";
|
||||
public class Store : IStore
|
||||
{
|
||||
/// <summary> Holds id of the debug level key. </summary>
|
||||
private const string KEY_DEBUGLEVEL = "DebugLevel";
|
||||
|
||||
/// <summary> Holds the id of the session. </summary>
|
||||
private const string KEY_SESSIONCOOKIE = "SessionCookie";
|
||||
/// <summary> Holds the id of the session. </summary>
|
||||
private const string KEY_SESSIONCOOKIE = "SessionCookie";
|
||||
|
||||
/// <summary> Holds id of the mail address key. </summary>
|
||||
private const string KEY_MAILADDRESS = "MailAddress";
|
||||
/// <summary> Holds id of the mail address key. </summary>
|
||||
private const string KEY_MAILADDRESS = "MailAddress";
|
||||
|
||||
/// <summary> Holds key for flag is agb acknowledged. </summary>
|
||||
private const string KEY_ISAGBACKNOWLEDGED = "IsAgbAcknowledged";
|
||||
/// <summary> Holds key for flag is agb acknowledged. </summary>
|
||||
private const string KEY_ISAGBACKNOWLEDGED = "IsAgbAcknowledged";
|
||||
|
||||
public IAccount Delete(IAccount account)
|
||||
{
|
||||
SecureStorage.RemoveAll();
|
||||
return new EmptyAccount();
|
||||
}
|
||||
public IAccount Delete(IAccount account)
|
||||
{
|
||||
SecureStorage.RemoveAll();
|
||||
return new EmptyAccount();
|
||||
}
|
||||
|
||||
public async Task<IAccount> Load()
|
||||
{
|
||||
public async Task<IAccount> Load()
|
||||
{
|
||||
|
||||
var mail = string.Empty;
|
||||
var isAgbAcknowledged = Account.DEFAULTISAGBACKNOWLEDGED;
|
||||
var sessionCookie = string.Empty;
|
||||
var debugLevel = Permissions.None;
|
||||
var mail = string.Empty;
|
||||
var isAgbAcknowledged = Account.DEFAULTISAGBACKNOWLEDGED;
|
||||
var sessionCookie = string.Empty;
|
||||
var debugLevel = Permissions.None;
|
||||
|
||||
try
|
||||
{
|
||||
mail = await SecureStorage.GetAsync(KEY_MAILADDRESS);
|
||||
bool.TryParse(await SecureStorage.GetAsync(KEY_ISAGBACKNOWLEDGED), out isAgbAcknowledged);
|
||||
sessionCookie = await SecureStorage.GetAsync(KEY_SESSIONCOOKIE);
|
||||
Enum.TryParse(await SecureStorage.GetAsync(KEY_DEBUGLEVEL), out debugLevel);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.ForContext<Store>().Error("Loading account from store failed. {Exception}", exception);
|
||||
}
|
||||
try
|
||||
{
|
||||
mail = await SecureStorage.GetAsync(KEY_MAILADDRESS);
|
||||
bool.TryParse(await SecureStorage.GetAsync(KEY_ISAGBACKNOWLEDGED), out isAgbAcknowledged);
|
||||
sessionCookie = await SecureStorage.GetAsync(KEY_SESSIONCOOKIE);
|
||||
Enum.TryParse(await SecureStorage.GetAsync(KEY_DEBUGLEVEL), out debugLevel);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.ForContext<Store>().Error("Loading account from store failed. {Exception}", exception);
|
||||
}
|
||||
|
||||
return new Account(
|
||||
mail,
|
||||
string.Empty,
|
||||
isAgbAcknowledged,
|
||||
sessionCookie,
|
||||
new List<string>(),
|
||||
debugLevel);
|
||||
}
|
||||
return new Account(
|
||||
mail,
|
||||
string.Empty,
|
||||
isAgbAcknowledged,
|
||||
sessionCookie,
|
||||
new List<string>(),
|
||||
debugLevel);
|
||||
}
|
||||
|
||||
public async Task Save(IAccount mailAndPwd)
|
||||
{
|
||||
try
|
||||
{
|
||||
await SecureStorage.SetAsync(KEY_MAILADDRESS, mailAndPwd.Mail);
|
||||
await SecureStorage.SetAsync(KEY_ISAGBACKNOWLEDGED, mailAndPwd.IsAgbAcknowledged.ToString());
|
||||
await SecureStorage.SetAsync(KEY_SESSIONCOOKIE, mailAndPwd.SessionCookie);
|
||||
await SecureStorage.SetAsync(KEY_DEBUGLEVEL, mailAndPwd.DebugLevel.ToString());
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.ForContext<Store>().Error("Saving account from store failed. {Exception}", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
public async Task Save(IAccount mailAndPwd)
|
||||
{
|
||||
try
|
||||
{
|
||||
await SecureStorage.SetAsync(KEY_MAILADDRESS, mailAndPwd.Mail);
|
||||
await SecureStorage.SetAsync(KEY_ISAGBACKNOWLEDGED, mailAndPwd.IsAgbAcknowledged.ToString());
|
||||
await SecureStorage.SetAsync(KEY_SESSIONCOOKIE, mailAndPwd.SessionCookie);
|
||||
await SecureStorage.SetAsync(KEY_DEBUGLEVEL, mailAndPwd.DebugLevel.ToString());
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.ForContext<Store>().Error("Saving account from store failed. {Exception}", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue