Search in sources :

Example 1 with ApplicationAccessToken

use of rxreddit.model.ApplicationAccessToken in project RxReddit by damien5314.

the class AndroidAccessTokenManager method getSavedApplicationAccessToken.

private ApplicationAccessToken getSavedApplicationAccessToken() {
    SharedPreferences sp = context.getSharedPreferences(PREFS_APPLICATION_ACCESS_TOKEN, Context.MODE_PRIVATE);
    if (!sp.contains(PREF_ACCESS_TOKEN))
        return null;
    ApplicationAccessToken token = new ApplicationAccessToken();
    token.setToken(sp.getString(PREF_ACCESS_TOKEN, null));
    token.setTokenType(sp.getString(PREF_TOKEN_TYPE, null));
    token.setExpiration(sp.getLong(PREF_EXPIRATION, 0));
    token.setScope(sp.getString(PREF_SCOPE, null));
    token.setRefreshToken(sp.getString(PREF_REFRESH_TOKEN, null));
    return token;
}
Also used : ApplicationAccessToken(rxreddit.model.ApplicationAccessToken) SharedPreferences(android.content.SharedPreferences)

Aggregations

SharedPreferences (android.content.SharedPreferences)1 ApplicationAccessToken (rxreddit.model.ApplicationAccessToken)1