@Override public void success(Result<OAuth2Token> result) { final AppSession session = new AppSession(result.data); // set session in manager, manager makes session active if there is no active session appSessionManager.setSession(session.getId(), session); if (callback != null) { callback.success(new Result<>(session, result.response)); } }
@Override public String serialize(AppSession session) { if (session != null && session.getAuthToken() != null) { try { return gson.toJson(session); } catch (Exception e) { Fabric.getLogger().d(TwitterCore.TAG, "Failed to serialize session " + e.getMessage()); } } return ""; }