Search in sources :

Example 1 with GoToMainFromRegister

use of net.iGap.model.GoToMainFromRegister in project iGap-Android by KianIranian-STDG.

the class RegisterRepository method getUserInfo.

private void getUserInfo() {
    Log.wtf(this.getClass().getName(), "getUserInfo");
    G.onUserInfoResponse = new OnUserInfoResponse() {

        @Override
        public void onUserInfo(final ProtoGlobal.RegisteredUser user, String identity) {
            if (user.getId() == userId) {
                AccountManager.getInstance().updateCurrentNickName(user.getDisplayName());
                AccountManager.getInstance().updatePhoneNumber(String.valueOf(user.getPhone()));
                DbManager.getInstance().doRealmTask(realm -> {
                    realm.executeTransactionAsync(realm1 -> RealmUserInfo.putOrUpdate(realm1, user), () -> G.onUserInfoResponse = null);
                });
                if (newUser) {
                    goToSyncContactPageForNewUser.postValue(userId);
                } else {
                    goToMainPage.postValue(new GoToMainFromRegister(forgetTwoStepVerification, userId));
                }
            }
        }

        @Override
        public void onUserInfoTimeOut() {
            requestUserInfo();
        }

        @Override
        public void onUserInfoError(int majorCode, int minorCode) {
        }
    };
}
Also used : MutableLiveData(androidx.lifecycle.MutableLiveData) WebSocketClient(net.iGap.WebSocketClient) OnReceiveInfoLocation(net.iGap.observers.interfaces.OnReceiveInfoLocation) RequestInfoLocation(net.iGap.request.RequestInfoLocation) GoToMainFromRegister(net.iGap.model.GoToMainFromRegister) AccountManager(net.iGap.module.accountManager.AccountManager) TwoStepVerificationVerifyPassword(net.iGap.observers.interfaces.TwoStepVerificationVerifyPassword) ProtoUserVerify(net.iGap.proto.ProtoUserVerify) OnUserRegistration(net.iGap.observers.interfaces.OnUserRegistration) RequestUserLogin(net.iGap.request.RequestUserLogin) OnUserProfileSetRepresentative(net.iGap.observers.interfaces.OnUserProfileSetRepresentative) RequestUserProfileSetRepresentative(net.iGap.request.RequestUserProfileSetRepresentative) G(net.iGap.G) OnUserInfoResponse(net.iGap.observers.interfaces.OnUserInfoResponse) RealmUserInfo(net.iGap.realm.RealmUserInfo) LocationModel(net.iGap.model.LocationModel) Handler(android.os.Handler) TwoStepVerificationGetPasswordDetail(net.iGap.observers.interfaces.TwoStepVerificationGetPasswordDetail) RequestInfoPage(net.iGap.request.RequestInfoPage) OnUserVerification(net.iGap.observers.interfaces.OnUserVerification) RequestWrapper(net.iGap.request.RequestWrapper) RequestUserInfo(net.iGap.request.RequestUserInfo) Log(android.util.Log) RequestUserProfileSetNickname(net.iGap.request.RequestUserProfileSetNickname) UserPasswordDetail(net.iGap.model.UserPasswordDetail) ProtoUserRegister(net.iGap.proto.ProtoUserRegister) HelperTracker(net.iGap.helper.HelperTracker) BuildConfig(net.iGap.BuildConfig) SingleLiveEvent(net.iGap.module.SingleLiveEvent) RequestUserTwoStepVerificationGetPasswordDetail(net.iGap.request.RequestUserTwoStepVerificationGetPasswordDetail) BotInit(net.iGap.module.BotInit) RealmAvatar(net.iGap.realm.RealmAvatar) OnInfoCountryResponse(net.iGap.observers.interfaces.OnInfoCountryResponse) List(java.util.List) RequestInfoCountry(net.iGap.request.RequestInfoCountry) HelperString(net.iGap.helper.HelperString) ProtoGlobal(net.iGap.proto.ProtoGlobal) RequestQueue(net.iGap.request.RequestQueue) OnUserProfileSetNickNameResponse(net.iGap.observers.interfaces.OnUserProfileSetNickNameResponse) ProtoRequest(net.iGap.proto.ProtoRequest) RequestUserTwoStepVerificationVerifyPassword(net.iGap.request.RequestUserTwoStepVerificationVerifyPassword) NotNull(org.jetbrains.annotations.NotNull) DbManager(net.iGap.module.accountManager.DbManager) OnUserLogin(net.iGap.observers.interfaces.OnUserLogin) OnUserInfoResponse(net.iGap.observers.interfaces.OnUserInfoResponse) GoToMainFromRegister(net.iGap.model.GoToMainFromRegister) ProtoGlobal(net.iGap.proto.ProtoGlobal) HelperString(net.iGap.helper.HelperString)

Aggregations

Handler (android.os.Handler)1 Log (android.util.Log)1 MutableLiveData (androidx.lifecycle.MutableLiveData)1 List (java.util.List)1 BuildConfig (net.iGap.BuildConfig)1 G (net.iGap.G)1 WebSocketClient (net.iGap.WebSocketClient)1 HelperString (net.iGap.helper.HelperString)1 HelperTracker (net.iGap.helper.HelperTracker)1 GoToMainFromRegister (net.iGap.model.GoToMainFromRegister)1 LocationModel (net.iGap.model.LocationModel)1 UserPasswordDetail (net.iGap.model.UserPasswordDetail)1 BotInit (net.iGap.module.BotInit)1 SingleLiveEvent (net.iGap.module.SingleLiveEvent)1 AccountManager (net.iGap.module.accountManager.AccountManager)1 DbManager (net.iGap.module.accountManager.DbManager)1 OnInfoCountryResponse (net.iGap.observers.interfaces.OnInfoCountryResponse)1 OnReceiveInfoLocation (net.iGap.observers.interfaces.OnReceiveInfoLocation)1 OnUserInfoResponse (net.iGap.observers.interfaces.OnUserInfoResponse)1 OnUserLogin (net.iGap.observers.interfaces.OnUserLogin)1