1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-06-30 11:14:51 +02:00

better null checks for tokens

This commit is contained in:
Kyle Spearrin 2017-07-31 10:23:39 -04:00
parent 3ce114760f
commit 745ad3b9e9

View File

@ -93,10 +93,10 @@ namespace Bit.App.Services
public bool TokenExpired => DateTime.UtcNow < TokenExpiration;
public TimeSpan TokenTimeRemaining => TokenExpiration - DateTime.UtcNow;
public bool TokenNeedsRefresh => TokenTimeRemaining.TotalMinutes < 5;
public string TokenUserId => DecodeToken()?["sub"].Value<string>();
public string TokenEmail => DecodeToken()?["email"].Value<string>();
public string TokenName => DecodeToken()?["name"].Value<string>();
public bool TokenPremium => (DecodeToken()?["premium"].Value<bool?>()).GetValueOrDefault(false);
public string TokenUserId => DecodeToken()?["sub"]?.Value<string>();
public string TokenEmail => DecodeToken()?["email"]?.Value<string>();
public string TokenName => DecodeToken()?["name"]?.Value<string>();
public bool TokenPremium => DecodeToken()?["premium"]?.Value<bool>() ?? false;
public string RefreshToken
{