Fix an issue with login token not being stored

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-12-11 12:12:45 +01:00
parent 8f88dc9c9e
commit d59403bc97

View File

@ -71,7 +71,9 @@ import javax.inject.Inject;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import autodagger.AutoInjector; import autodagger.AutoInjector;
import butterknife.BindView; import butterknife.BindView;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import io.requery.Persistable; import io.requery.Persistable;
import io.requery.reactivex.ReactiveEntityStore; import io.requery.reactivex.ReactiveEntityStore;
@ -359,20 +361,23 @@ public class WebViewLoginController extends BaseController {
if (!TextUtils.isEmpty(protocol)) { if (!TextUtils.isEmpty(protocol)) {
bundle.putString(BundleKeys.KEY_ORIGINAL_PROTOCOL, protocol); bundle.putString(BundleKeys.KEY_ORIGINAL_PROTOCOL, protocol);
} }
getRouter().pushController(RouterTransaction.with(new AccountVerificationController getRouter().pushController(RouterTransaction.with(new AccountVerificationController
(bundle)).pushChangeHandler(new HorizontalChangeHandler()) (bundle)).pushChangeHandler(new HorizontalChangeHandler())
.popChangeHandler(new HorizontalChangeHandler())); .popChangeHandler(new HorizontalChangeHandler()));
} else { } else {
if (isPasswordUpdate) { if (isPasswordUpdate) {
if (currentUser != null) { if (currentUser != null) {
userQueryDisposable = userUtils.createOrUpdateUser(null, null, userQueryDisposable = userUtils.createOrUpdateUser(null, loginData.getToken(),
null, null, null, true, null, null, null, true,
null, currentUser.getId(), null, appPreferences.getTemporaryClientCertAlias(), null). null, currentUser.getId(), null, appPreferences.getTemporaryClientCertAlias(), null)
subscribe(userEntity -> { .subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(userEntity -> {
if (finalMessageType != null) { if (finalMessageType != null) {
ApplicationWideMessageHolder.getInstance().setMessageType(finalMessageType); ApplicationWideMessageHolder.getInstance().setMessageType(finalMessageType);
} }
getRouter().popToRoot(); getRouter().popCurrentController();
}, throwable -> dispose(), }, throwable -> dispose(),
this::dispose); this::dispose);
} }