122 lines
5.6 KiB
Java
122 lines
5.6 KiB
Java
package com.ubt.jimu.user.presenter;
|
|
|
|
import android.content.Context;
|
|
import com.ubt.jimu.base.entities.ApiStatus;
|
|
import com.ubt.jimu.base.entities.TokenBean;
|
|
import com.ubt.jimu.base.http.ApiResultException;
|
|
import com.ubt.jimu.base.http.IApiObserver;
|
|
import com.ubt.jimu.user.contract.ResetPasswordContract$Presenter;
|
|
import com.ubt.jimu.user.contract.ResetPasswordContract$View;
|
|
import com.ubt.jimu.user.repository.UserRepository;
|
|
import com.ubt.jimu.utils.LocaleUtils;
|
|
import com.ubt.jimu.utils.RxSchedulers;
|
|
import io.reactivex.Observable;
|
|
import io.reactivex.ObservableEmitter;
|
|
import io.reactivex.ObservableOnSubscribe;
|
|
import io.reactivex.Observer;
|
|
import io.reactivex.disposables.CompositeDisposable;
|
|
import io.reactivex.disposables.Disposable;
|
|
import io.reactivex.functions.Function;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class ResetPasswordPresenter implements ResetPasswordContract$Presenter {
|
|
private Context a;
|
|
private ResetPasswordContract$View b;
|
|
private CompositeDisposable c;
|
|
|
|
public ResetPasswordPresenter(Context context, ResetPasswordContract$View resetPasswordContract$View) {
|
|
this.a = context;
|
|
this.b = resetPasswordContract$View;
|
|
this.b.setPresenter(this);
|
|
this.c = new CompositeDisposable();
|
|
}
|
|
|
|
@Override // com.ubt.jimu.user.contract.ResetPasswordContract$Presenter
|
|
public void a(String str, int i) {
|
|
UserRepository.a(str, str.contains("@") ? 1 : 0, i).compose(RxSchedulers.a()).subscribe(new IApiObserver<ApiStatus>(this.a) { // from class: com.ubt.jimu.user.presenter.ResetPasswordPresenter.1
|
|
@Override // com.ubt.jimu.base.http.IApiObserver, io.reactivex.Observer
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public void onNext(ApiStatus apiStatus) {
|
|
super.onNext(apiStatus);
|
|
ResetPasswordPresenter.this.b.b(apiStatus);
|
|
}
|
|
|
|
@Override // com.ubt.jimu.base.http.IApiObserver
|
|
public void onApiError(ApiResultException apiResultException) {
|
|
ResetPasswordPresenter.this.b.e(apiResultException.getMessage());
|
|
}
|
|
|
|
@Override // com.ubt.jimu.base.http.IApiObserver, io.reactivex.Observer
|
|
public void onSubscribe(Disposable disposable) {
|
|
super.onSubscribe(disposable);
|
|
ResetPasswordPresenter.this.c.b(disposable);
|
|
}
|
|
});
|
|
}
|
|
|
|
@Override // com.ubt.jimu.user.contract.ResetPasswordContract$Presenter
|
|
public void b() {
|
|
Observable.create(new ObservableOnSubscribe<String>() { // from class: com.ubt.jimu.user.presenter.ResetPasswordPresenter.5
|
|
@Override // io.reactivex.ObservableOnSubscribe
|
|
public void subscribe(ObservableEmitter<String> observableEmitter) throws Exception {
|
|
observableEmitter.onNext(LocaleUtils.a(ResetPasswordPresenter.this.a));
|
|
observableEmitter.onComplete();
|
|
}
|
|
}).compose(RxSchedulers.a()).subscribe(new Observer<String>() { // from class: com.ubt.jimu.user.presenter.ResetPasswordPresenter.4
|
|
@Override // io.reactivex.Observer
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public void onNext(String str) {
|
|
ResetPasswordPresenter.this.b.c(str);
|
|
}
|
|
|
|
@Override // io.reactivex.Observer
|
|
public void onComplete() {
|
|
}
|
|
|
|
@Override // io.reactivex.Observer
|
|
public void onError(Throwable th) {
|
|
}
|
|
|
|
@Override // io.reactivex.Observer
|
|
public void onSubscribe(Disposable disposable) {
|
|
ResetPasswordPresenter.this.c.b(disposable);
|
|
}
|
|
});
|
|
}
|
|
|
|
@Override // com.ubt.jimu.user.contract.ResetPasswordContract$Presenter
|
|
public void a(String str, final String str2, String str3) {
|
|
UserRepository.a(str, str3, str.contains("@") ? 1 : 0).flatMap(new Function<TokenBean, Observable<ApiStatus>>(this) { // from class: com.ubt.jimu.user.presenter.ResetPasswordPresenter.3
|
|
@Override // io.reactivex.functions.Function
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public Observable<ApiStatus> apply(TokenBean tokenBean) throws Exception {
|
|
return UserRepository.a(str2, tokenBean.getToken(), String.valueOf(tokenBean.getUserId()));
|
|
}
|
|
}).compose(RxSchedulers.a()).subscribe(new IApiObserver<ApiStatus>(this.a) { // from class: com.ubt.jimu.user.presenter.ResetPasswordPresenter.2
|
|
@Override // com.ubt.jimu.base.http.IApiObserver, io.reactivex.Observer
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public void onNext(ApiStatus apiStatus) {
|
|
super.onNext(apiStatus);
|
|
ResetPasswordPresenter.this.b.d(apiStatus);
|
|
}
|
|
|
|
@Override // com.ubt.jimu.base.http.IApiObserver
|
|
public void onApiError(ApiResultException apiResultException) {
|
|
ResetPasswordPresenter.this.b.g(apiResultException.getMessage());
|
|
}
|
|
|
|
@Override // com.ubt.jimu.base.http.IApiObserver, io.reactivex.Observer
|
|
public void onError(Throwable th) {
|
|
super.onError(th);
|
|
ResetPasswordPresenter.this.b.g(th.getMessage());
|
|
}
|
|
|
|
@Override // com.ubt.jimu.base.http.IApiObserver, io.reactivex.Observer
|
|
public void onSubscribe(Disposable disposable) {
|
|
super.onSubscribe(disposable);
|
|
ResetPasswordPresenter.this.c.b(disposable);
|
|
}
|
|
});
|
|
}
|
|
}
|