1:羽声新版本
This commit is contained in:
@@ -3,40 +3,63 @@ package com.xscm.modulelogin.present;
|
||||
import android.content.Context;
|
||||
|
||||
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.bean.UserBean;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
import com.xscm.moduleutil.utils.cos.CosUploadManager;
|
||||
import com.xscm.moduleutil.utils.oss.OSSOperUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class ImproveInfoPresenter extends BasePresenter<ImproveInfoContacts.View> implements ImproveInfoContacts.IImproveInfoPre {
|
||||
ImproveInfoContacts.View mView;
|
||||
public ImproveInfoPresenter(ImproveInfoContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
mView = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadFile(File file, int type) {
|
||||
MvpRef.get().showLoadings("上传中...");
|
||||
String url = OSSOperUtils.getPath(file, type);
|
||||
OSSOperUtils.newInstance().putObjectMethod(url, file.getPath(), new OSSOperUtils.OssCallback() {
|
||||
CosUploadManager.getInstance().upParameters(url,file.getPath(), new CosUploadManager.UploadCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
if (isViewAttach()) {
|
||||
MvpRef.get().disLoadings();
|
||||
MvpRef.get().upLoadSuccess(OSSOperUtils.AliYunOSSURLFile + url, type);
|
||||
public void onSuccess(String url) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().disLoadings();
|
||||
MvpRef.get().upLoadSuccess(url, type);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
if (isViewAttach()) {
|
||||
MvpRef.get().disLoadings();
|
||||
}
|
||||
public void onFailure(Exception e) {
|
||||
ToastUtils.show("上传失败");
|
||||
MvpRef.get().disLoadings();
|
||||
}
|
||||
});
|
||||
|
||||
// OSSOperUtils.newInstance().putObjectMethod(url, file.getPath(), new OSSOperUtils.OssCallback() {
|
||||
// @Override
|
||||
// public void onSuccess() {
|
||||
// if (isViewAttach()) {
|
||||
// MvpRef.get().disLoadings();
|
||||
// MvpRef.get().upLoadSuccess(OSSOperUtils.AliYunOSSURLFile + url, type);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFail() {
|
||||
// if (isViewAttach()) {
|
||||
// MvpRef.get().disLoadings();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user