Search in sources :

Example 1 with AccountStore

use of com.funstill.kelefun.config.AccountStore in project keleFanfou by kelefun.

the class LoginActivity method saveAccount.

private void saveAccount(OAuthToken auth, UserInfo info) {
    AccountStore store = new AccountStore(this);
    store.saveAccount(auth, info);
}
Also used : AccountStore(com.funstill.kelefun.config.AccountStore)

Example 2 with AccountStore

use of com.funstill.kelefun.config.AccountStore in project keleFanfou by kelefun.

the class StartActivity method isLogin.

// 启动app时判断是否已登录
private boolean isLogin() {
    AccountStore store = new AccountStore(this);
    AccountInfo accountInfo = store.readAccount();
    return accountInfo.isVerified();
}
Also used : AccountStore(com.funstill.kelefun.config.AccountStore) AccountInfo(com.funstill.kelefun.config.AccountInfo)

Example 3 with AccountStore

use of com.funstill.kelefun.config.AccountStore in project keleFanfou by kelefun.

the class AccountService method saveUserInfo.

public void saveUserInfo(Context mContext) {
    Retrofit retrofit = BaseRetrofit.retrofit(new SignInterceptor());
    AccountApi api = retrofit.create(AccountApi.class);
    Call<UserInfo> call = api.verifyCred();
    try {
        UserInfo userInfo = call.execute().body();
        new AccountStore(mContext).saveAccount(userInfo);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : BaseRetrofit(com.funstill.kelefun.http.BaseRetrofit) Retrofit(retrofit2.Retrofit) AccountApi(com.funstill.kelefun.data.api.AccountApi) AccountStore(com.funstill.kelefun.config.AccountStore) SignInterceptor(com.funstill.kelefun.http.SignInterceptor) UserInfo(com.funstill.kelefun.data.model.UserInfo) IOException(java.io.IOException)

Aggregations

AccountStore (com.funstill.kelefun.config.AccountStore)3 AccountInfo (com.funstill.kelefun.config.AccountInfo)1 AccountApi (com.funstill.kelefun.data.api.AccountApi)1 UserInfo (com.funstill.kelefun.data.model.UserInfo)1 BaseRetrofit (com.funstill.kelefun.http.BaseRetrofit)1 SignInterceptor (com.funstill.kelefun.http.SignInterceptor)1 IOException (java.io.IOException)1 Retrofit (retrofit2.Retrofit)1