fix:修复文件上传回调不在主线程导致的上传特权卡流程失败问题(文件上传统一回调主线程)

This commit is contained in:
Max
2024-04-09 15:00:10 +08:00
parent 1e80959db6
commit 013ed0a39d
2 changed files with 3 additions and 2 deletions

View File

@@ -133,7 +133,6 @@ public class PublishPresenter extends BaseMvpPresenter<IPublishView> {
.flatMap((Function<String, SingleSource<String>>)
path -> FileModel.get().uploadFile(path))
.compose(bindUntilEvent(PresenterEvent.DESTROY))
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new DontWarnObserver<String>() {
@Override
public void acceptThrowable(String url, Throwable throwable) {

View File

@@ -14,6 +14,7 @@ import com.nnbc123.library.net.rxnet.RxNet;
import java.io.File;
import java.util.UUID;
import io.reactivex.Single;
import io.reactivex.android.schedulers.AndroidSchedulers;
import retrofit2.http.GET;
public class FileModel extends BaseModel implements IFileModel {
@@ -52,7 +53,8 @@ public class FileModel extends BaseModel implements IFileModel {
}
File finalFile = file;
String outName = UUID.randomUUID().toString() + PathUtils.INSTANCE.getSuffixType(finalFile.getName());
return getCosToken().flatMap(token -> CosClient.INSTANCE.upload(AppUtils.getApp(), finalFile, outName, token).map(cosXmlResult -> cosXmlResult.accessUrl));
return getCosToken().flatMap(token -> CosClient.INSTANCE.upload(AppUtils.getApp(), finalFile, outName, token).map(cosXmlResult -> cosXmlResult.accessUrl))
.observeOn(AndroidSchedulers.mainThread());
}
@Override