mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 23:25:45 +03:00
better null checks for tokens
This commit is contained in:
parent
3ce114760f
commit
745ad3b9e9
1 changed files with 4 additions and 4 deletions
|
@ -93,10 +93,10 @@ namespace Bit.App.Services
|
||||||
public bool TokenExpired => DateTime.UtcNow < TokenExpiration;
|
public bool TokenExpired => DateTime.UtcNow < TokenExpiration;
|
||||||
public TimeSpan TokenTimeRemaining => TokenExpiration - DateTime.UtcNow;
|
public TimeSpan TokenTimeRemaining => TokenExpiration - DateTime.UtcNow;
|
||||||
public bool TokenNeedsRefresh => TokenTimeRemaining.TotalMinutes < 5;
|
public bool TokenNeedsRefresh => TokenTimeRemaining.TotalMinutes < 5;
|
||||||
public string TokenUserId => DecodeToken()?["sub"].Value<string>();
|
public string TokenUserId => DecodeToken()?["sub"]?.Value<string>();
|
||||||
public string TokenEmail => DecodeToken()?["email"].Value<string>();
|
public string TokenEmail => DecodeToken()?["email"]?.Value<string>();
|
||||||
public string TokenName => DecodeToken()?["name"].Value<string>();
|
public string TokenName => DecodeToken()?["name"]?.Value<string>();
|
||||||
public bool TokenPremium => (DecodeToken()?["premium"].Value<bool?>()).GetValueOrDefault(false);
|
public bool TokenPremium => DecodeToken()?["premium"]?.Value<bool>() ?? false;
|
||||||
|
|
||||||
public string RefreshToken
|
public string RefreshToken
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue