mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-22 05:47:28 +02:00
Version 3.0.270
This commit is contained in:
parent
67999ef4ae
commit
e0c75d5b37
81 changed files with 812 additions and 474 deletions
|
@ -49,6 +49,8 @@ namespace TINK.Model.User.Account
|
|||
/// </summary>
|
||||
public class Account : IAccount
|
||||
{
|
||||
public const bool DEFAULTISAGBACKNOWLEDGED = false;
|
||||
|
||||
/// <summary> Constructs an account object.</summary>
|
||||
/// <param name="mail">Mail address of the account holder.</param>
|
||||
/// <param name="password">Password.</param>
|
||||
|
@ -58,12 +60,14 @@ namespace TINK.Model.User.Account
|
|||
public Account(
|
||||
string mail,
|
||||
string password,
|
||||
bool isAgbAcknowledged,
|
||||
string sessionCookie,
|
||||
IEnumerable<string> bikeGroup,
|
||||
Permissions debugLevel = Permissions.None)
|
||||
{
|
||||
Mail = mail;
|
||||
Pwd = password;
|
||||
IsAgbAcknowledged = isAgbAcknowledged;
|
||||
SessionCookie = sessionCookie;
|
||||
DebugLevel = debugLevel;
|
||||
Group = bikeGroup != null
|
||||
|
@ -71,7 +75,7 @@ namespace TINK.Model.User.Account
|
|||
: throw new ArgumentException("Can not instantiate account object. Reference to group list must not be empty.");
|
||||
}
|
||||
|
||||
public Account(IAccount p_oSource) : this(p_oSource?.Mail, p_oSource?.Pwd, p_oSource?.SessionCookie, p_oSource?.Group, p_oSource?.DebugLevel ?? Permissions.None)
|
||||
public Account(IAccount source) : this(source?.Mail, source?.Pwd, source?.IsAgbAcknowledged ?? DEFAULTISAGBACKNOWLEDGED, source?.SessionCookie, source?.Group, source?.DebugLevel ?? Permissions.None)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -81,6 +85,9 @@ namespace TINK.Model.User.Account
|
|||
/// <summary>Password of to authenticate.</summary>
|
||||
public string Pwd { get; }
|
||||
|
||||
/// <summary>True if user acknowleged agbs.</summary>
|
||||
public bool IsAgbAcknowledged { get; }
|
||||
|
||||
/// <summary>Session cookie used to sign in to copri.</summary>
|
||||
public string SessionCookie { get; }
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace TINK.Model.User.Account
|
|||
public string Mail
|
||||
{
|
||||
get { return m_oAccount.Mail; }
|
||||
set { m_oAccount = new Account(value, m_oAccount.Pwd, m_oAccount.SessionCookie, m_oAccount.Group, m_oAccount.DebugLevel); }
|
||||
set { m_oAccount = new Account(value, m_oAccount.Pwd, m_oAccount.IsAgbAcknowledged, m_oAccount.SessionCookie, m_oAccount.Group, m_oAccount.DebugLevel); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -38,16 +38,19 @@ namespace TINK.Model.User.Account
|
|||
public string Pwd
|
||||
{
|
||||
get { return m_oAccount.Pwd; }
|
||||
set { m_oAccount = new Account(m_oAccount.Mail, value, m_oAccount.SessionCookie, m_oAccount.Group, m_oAccount.DebugLevel); }
|
||||
set { m_oAccount = new Account(m_oAccount.Mail, value, m_oAccount.IsAgbAcknowledged, m_oAccount.SessionCookie, m_oAccount.Group, m_oAccount.DebugLevel); }
|
||||
}
|
||||
|
||||
/// <summary>True if user acknowleged agbs.</summary>
|
||||
public bool IsAgbAcknowledged => m_oAccount.IsAgbAcknowledged;
|
||||
|
||||
/// <summary>
|
||||
/// Session cookie used to sign in to copri.
|
||||
/// </summary>
|
||||
public string SessionCookie
|
||||
{
|
||||
get { return m_oAccount.SessionCookie; }
|
||||
set { m_oAccount = new Account(m_oAccount.Mail, m_oAccount.Pwd, value, m_oAccount.Group, m_oAccount.DebugLevel); }
|
||||
set { m_oAccount = new Account(m_oAccount.Mail, m_oAccount.Pwd, m_oAccount.IsAgbAcknowledged, value, m_oAccount.Group, m_oAccount.DebugLevel); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -64,7 +67,7 @@ namespace TINK.Model.User.Account
|
|||
public Permissions DebugLevel
|
||||
{
|
||||
get { return m_oAccount.DebugLevel; }
|
||||
set { m_oAccount = new Account(m_oAccount.Mail, m_oAccount.Pwd, m_oAccount.SessionCookie, m_oAccount.Group, value); }
|
||||
set { m_oAccount = new Account(m_oAccount.Mail, m_oAccount.Pwd, m_oAccount.IsAgbAcknowledged, m_oAccount.SessionCookie, m_oAccount.Group, value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ namespace TINK.Model.User.Account
|
|||
|
||||
public string Pwd => null;
|
||||
|
||||
public bool IsAgbAcknowledged => false;
|
||||
|
||||
public string SessionCookie => null;
|
||||
|
||||
public Permissions DebugLevel => Permissions.None;
|
||||
|
|
|
@ -13,6 +13,9 @@ namespace TINK.Model.User.Account
|
|||
/// <summary>Password of the account.</summary>
|
||||
string Pwd { get; }
|
||||
|
||||
/// <summary>True if user acknowleged agbs.</summary>
|
||||
bool IsAgbAcknowledged { get; }
|
||||
|
||||
/// <summary>Session cookie used to sign in to copri.</summary>
|
||||
string SessionCookie { get; }
|
||||
|
||||
|
|
|
@ -17,6 +17,9 @@ namespace TINK.Model.User.Account
|
|||
/// <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";
|
||||
|
||||
public IAccount Delete(IAccount account)
|
||||
{
|
||||
SecureStorage.RemoveAll();
|
||||
|
@ -27,15 +30,16 @@ namespace TINK.Model.User.Account
|
|||
{
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -45,6 +49,7 @@ namespace TINK.Model.User.Account
|
|||
return new Account(
|
||||
mail,
|
||||
string.Empty,
|
||||
isAgbAcknowledged,
|
||||
sessionCookie,
|
||||
new List<string>(),
|
||||
debugLevel);
|
||||
|
@ -55,6 +60,7 @@ namespace TINK.Model.User.Account
|
|||
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());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue