DownloadItemUtils.updateItem 参数简化

This commit is contained in:
huangzhuanghua
2017-02-13 11:31:52 +08:00
parent a29c0bd466
commit c292e79d94
17 changed files with 291 additions and 431 deletions

View File

@ -134,7 +134,7 @@ public class TokenUtils {
}).onErrorResumeNext(new Func1<Throwable, Observable<? extends String>>() {
@Override
public Observable<? extends String> call(Throwable throwable) {
return Observable.empty();
return Observable.error(throwable);
}
});
}
@ -142,7 +142,7 @@ public class TokenUtils {
}
// 检查设备信息是否已经上传完整
public static synchronized void checkDeviceInfo(final Context context) {
public static synchronized void checkDeviceInfo(Context context, String token) {
final SharedPreferences sp = context.getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);
final HashMap<String, String> params = new HashMap<>();
if (!sp.getBoolean("isUploadExtra", false)) {
@ -165,15 +165,10 @@ public class TokenUtils {
}
}
if (params.size() != 0) {
TokenUtils.getToken(context, true)
.flatMap(new Func1<String, Observable<ResponseBody>>() {
@Override
public Observable<ResponseBody> call(String token) {
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
new JSONObject(params).toString());
return RetrofitManager.getUser().postDevice(token, body, TokenUtils.getDeviceId(context));
}
}).subscribeOn(Schedulers.io())
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
new JSONObject(params).toString());
RetrofitManager.getUser().postDevice(token, body, TokenUtils.getDeviceId(context))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<ResponseBody>() {
@Override