100 lines
3.9 KiB
Java
100 lines
3.9 KiB
Java
package com.ubt.jimu.community.activity.presenter;
|
|
|
|
import android.content.Context;
|
|
import com.ubt.jimu.R;
|
|
import com.ubt.jimu.base.entities.UComment;
|
|
import com.ubt.jimu.base.http.ApiConstants;
|
|
import com.ubt.jimu.community.activity.contract.CommentContract$Presenter;
|
|
import com.ubt.jimu.community.activity.contract.CommentContract$View;
|
|
import com.ubt.jimu.community.activity.repository.ActivityRepository;
|
|
import com.ubt.jimu.utils.NetWorkUtil;
|
|
import com.ubt.jimu.utils.RxSchedulers;
|
|
import com.unity3d.ads.adunit.AdUnitActivity;
|
|
import io.reactivex.Observer;
|
|
import io.reactivex.disposables.CompositeDisposable;
|
|
import io.reactivex.disposables.Disposable;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class CommentPresenter implements CommentContract$Presenter {
|
|
private Context a;
|
|
private CommentContract$View b;
|
|
private CompositeDisposable c;
|
|
|
|
public CommentPresenter(Context context, CommentContract$View commentContract$View) {
|
|
this.a = context;
|
|
this.b = commentContract$View;
|
|
this.b.setPresenter(this);
|
|
this.c = new CompositeDisposable();
|
|
}
|
|
|
|
@Override // com.ubt.jimu.community.activity.contract.CommentContract$Presenter
|
|
public void c(long j, long j2) {
|
|
if (!NetWorkUtil.b(this.a)) {
|
|
this.b.a(this.a.getString(R.string.network_error));
|
|
return;
|
|
}
|
|
Map<String, String> basicParams = ApiConstants.getBasicParams();
|
|
basicParams.put("userId", String.valueOf(j));
|
|
basicParams.put("commentId", String.valueOf(j2));
|
|
ActivityRepository.b(basicParams).compose(RxSchedulers.a()).subscribe(new Observer<String>() { // from class: com.ubt.jimu.community.activity.presenter.CommentPresenter.2
|
|
@Override // io.reactivex.Observer
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public void onNext(String str) {
|
|
CommentPresenter.this.b.d(str);
|
|
}
|
|
|
|
@Override // io.reactivex.Observer
|
|
public void onComplete() {
|
|
}
|
|
|
|
@Override // io.reactivex.Observer
|
|
public void onError(Throwable th) {
|
|
CommentPresenter.this.b.a(th.getMessage());
|
|
}
|
|
|
|
@Override // io.reactivex.Observer
|
|
public void onSubscribe(Disposable disposable) {
|
|
CommentPresenter.this.c.b(disposable);
|
|
}
|
|
});
|
|
}
|
|
|
|
@Override // com.ubt.jimu.community.activity.contract.CommentContract$Presenter
|
|
public void a(long j, long j2, int i, int i2) {
|
|
if (!NetWorkUtil.b(this.a)) {
|
|
this.b.a(this.a.getString(R.string.network_error));
|
|
return;
|
|
}
|
|
Map<String, String> basicParams = ApiConstants.getBasicParams();
|
|
basicParams.put(AdUnitActivity.EXTRA_ACTIVITY_ID, String.valueOf(j));
|
|
basicParams.put("pageIndex", String.valueOf(i));
|
|
basicParams.put("pageSize", String.valueOf(i2));
|
|
if (j2 > 0) {
|
|
basicParams.put("userId", String.valueOf(j2));
|
|
}
|
|
ActivityRepository.a(basicParams).compose(RxSchedulers.a()).subscribe(new Observer<List<UComment>>() { // from class: com.ubt.jimu.community.activity.presenter.CommentPresenter.1
|
|
@Override // io.reactivex.Observer
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public void onNext(List<UComment> list) {
|
|
CommentPresenter.this.b.s(list);
|
|
}
|
|
|
|
@Override // io.reactivex.Observer
|
|
public void onComplete() {
|
|
}
|
|
|
|
@Override // io.reactivex.Observer
|
|
public void onError(Throwable th) {
|
|
CommentPresenter.this.b.a(th.getMessage());
|
|
}
|
|
|
|
@Override // io.reactivex.Observer
|
|
public void onSubscribe(Disposable disposable) {
|
|
CommentPresenter.this.c.b(disposable);
|
|
}
|
|
});
|
|
}
|
|
}
|