@Test public void nothingPersisted() { assertEquals(null, localCognitoTokenStore.getCognitoToken()); }
@Nullable public Cognito getCognitoToken() { final SharedPreferences preferences = sharedPreferences.get(); final String token = preferences.getString(KEY_COGNITO_TOKEN, null); final String identityId = preferences.getString(KEY_COGNITO_IDENTITY_ID, null); final long expirationTimeStamp = preferences.getLong(KEY_COGNITO_TOKEN_EXPIRATION, -1); if (token == null || identityId == null) { return null; } else { return new Cognito(token, identityId, new Date(expirationTimeStamp)); } }
LocalCognitoTokenStore { @Nullable public Cognito getCognitoToken() { final SharedPreferences preferences = sharedPreferences.get(); final String token = preferences.getString(KEY_COGNITO_TOKEN, null); final String identityId = preferences.getString(KEY_COGNITO_IDENTITY_ID, null); final long expirationTimeStamp = preferences.getLong(KEY_COGNITO_TOKEN_EXPIRATION, -1); if (token == null || identityId == null) { return null; } else { return new Cognito(token, identityId, new Date(expirationTimeStamp)); } } }
LocalCognitoTokenStore { @Nullable public Cognito getCognitoToken() { final SharedPreferences preferences = sharedPreferences.get(); final String token = preferences.getString(KEY_COGNITO_TOKEN, null); final String identityId = preferences.getString(KEY_COGNITO_IDENTITY_ID, null); final long expirationTimeStamp = preferences.getLong(KEY_COGNITO_TOKEN_EXPIRATION, -1); if (token == null || identityId == null) { return null; } else { return new Cognito(token, identityId, new Date(expirationTimeStamp)); } } @Inject  LocalCognitoTokenStore(@NonNull Lazy<SharedPreferences> sharedPreferences); }
LocalCognitoTokenStore { @Nullable public Cognito getCognitoToken() { final SharedPreferences preferences = sharedPreferences.get(); final String token = preferences.getString(KEY_COGNITO_TOKEN, null); final String identityId = preferences.getString(KEY_COGNITO_IDENTITY_ID, null); final long expirationTimeStamp = preferences.getLong(KEY_COGNITO_TOKEN_EXPIRATION, -1); if (token == null || identityId == null) { return null; } else { return new Cognito(token, identityId, new Date(expirationTimeStamp)); } } @Inject  LocalCognitoTokenStore(@NonNull Lazy<SharedPreferences> sharedPreferences); @Nullable Cognito getCognitoToken(); void persist(@Nullable Cognito cognito); }
LocalCognitoTokenStore { @Nullable public Cognito getCognitoToken() { final SharedPreferences preferences = sharedPreferences.get(); final String token = preferences.getString(KEY_COGNITO_TOKEN, null); final String identityId = preferences.getString(KEY_COGNITO_IDENTITY_ID, null); final long expirationTimeStamp = preferences.getLong(KEY_COGNITO_TOKEN_EXPIRATION, -1); if (token == null || identityId == null) { return null; } else { return new Cognito(token, identityId, new Date(expirationTimeStamp)); } } @Inject  LocalCognitoTokenStore(@NonNull Lazy<SharedPreferences> sharedPreferences); @Nullable Cognito getCognitoToken(); void persist(@Nullable Cognito cognito);  }