version:2.0.1

update:更新不需要获取批次情况也会删除多余app,更新高德地图获取失败的时候返回错误信息
fix:
add:
This commit is contained in:
2021-05-12 18:25:17 +08:00
parent 2702ddab42
commit 01fc196429
5 changed files with 63 additions and 62 deletions

View File

@@ -280,11 +280,13 @@ public class MainPresenter implements MainContact.Presenter {
}
@SuppressLint("NewApi")
private void updateDevicesInfo(Context context) {
synchronized private void updateDevicesInfo(Context context) {
String address = String.valueOf(SPUtils.get(context, "AmapAddress", "-"));
if ("-".equals(address)) {
address = (String) SPUtils.get(context, "AmapError", "-");
}
String longitude = String.valueOf(SPUtils.get(context, "longitude", "0"));
String latitude = String.valueOf(SPUtils.get(context, "latitude", "0"));
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("address", address);
jsonObject.addProperty("longitude", longitude);
@@ -393,7 +395,7 @@ public class MainPresenter implements MainContact.Presenter {
mView.setAliasFinished();
}
private void SetAlias(){
private void SetAlias() {
TagAliasOperatorHelper.TagAliasBean tagAliasBean = new TagAliasOperatorHelper.TagAliasBean();
tagAliasBean.action = ACTION_SET;
sequence++;
@@ -441,7 +443,7 @@ public class MainPresenter implements MainContact.Presenter {
});
}
private void setTag(String batch){
private void setTag(String batch) {
Set set = new HashSet();
set.add(batch);
TagAliasOperatorHelper.TagAliasBean tagAliasBean = new TagAliasOperatorHelper.TagAliasBean();
@@ -663,52 +665,52 @@ public class MainPresenter implements MainContact.Presenter {
}
int locked = Settings.System.getInt(mContext.getContentResolver(), "qch_unlock_ipad", 1);
if (locked == 0) {
NetInterfaceManager.getInstance()
.getBatchObservable()
.observeOn(Schedulers.io())
.subscribe(new Observer<ResponseBody>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("getDeviceBatch", "onSubscribe: ");
}
@Override
public void onNext(@NonNull ResponseBody responseBody) {
Log.e("getDeviceBatch", "onNext: ");
try {
String respons = responseBody.string();
JSONObject jsonObject = JSON.parseObject(respons);
int code = jsonObject.getInteger("code");
if (code == 200) {
String data = jsonObject.getString("data");
List<Batch> batchList = JSON.parseArray(data, Batch.class);
if (null != batchList && batchList.size() > 1) {
Log.e("getDeviceBatch", "onNext: " + "deleteOtherApp");
if (!BuildConfig.DEBUG) {
JGYUtils.getInstance().deleteOtherApp(packageList);
}
} else {
Log.e("getDeviceBatch", "批次为空");
Log.e("getDeviceBatch", "onNext: respons:" + respons);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void onError(@NonNull Throwable e) {
Log.e("getDeviceBatch", "onError: " + e.getMessage());
onComplete();
}
@Override
public void onComplete() {
Log.e("getDeviceBatch", "onComplete: ");
mView.getDeviceBatchFinished();
}
});
// NetInterfaceManager.getInstance()
// .getBatchObservable()
// .observeOn(Schedulers.io())
// .subscribe(new Observer<ResponseBody>() {
// @Override
// public void onSubscribe(@NonNull Disposable d) {
// Log.e("getDeviceBatch", "onSubscribe: ");
// }
//
// @Override
// public void onNext(@NonNull ResponseBody responseBody) {
// Log.e("getDeviceBatch", "onNext: ");
// try {
// String respons = responseBody.string();
// JSONObject jsonObject = JSON.parseObject(respons);
// int code = jsonObject.getInteger("code");
// if (code == 200) {
// String data = jsonObject.getString("data");
// List<Batch> batchList = JSON.parseArray(data, Batch.class);
// if (null != batchList && batchList.size() > 1) {
// Log.e("getDeviceBatch", "onNext: " + "deleteOtherApp");
if (!BuildConfig.DEBUG) {
JGYUtils.getInstance().deleteOtherApp(packageList);
}
// } else {
// Log.e("getDeviceBatch", "批次为空");
// Log.e("getDeviceBatch", "onNext: respons:" + respons);
// }
// }
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// @Override
// public void onError(@NonNull Throwable e) {
// Log.e("getDeviceBatch", "onError: " + e.getMessage());
// onComplete();
// }
//
// @Override
// public void onComplete() {
// Log.e("getDeviceBatch", "onComplete: ");
// mView.getDeviceBatchFinished();
// }
// });
}
}

View File

@@ -69,8 +69,8 @@ public class AmapManager {
sb.append("定位失败" + "\n");
SPUtils.put(mContext, "AmapError", aMapLocation.getErrorInfo());
}
Log.e("AmapAddress", (String) SPUtils.get(mContext, "AmapAddress", ""));
Log.e("AmapError", (String) SPUtils.get(mContext, "AmapError", ""));
Log.e("AmapAddress", (String) SPUtils.get(mContext, "AmapAddress", "-"));
Log.e("AmapError", (String) SPUtils.get(mContext, "AmapError", "-"));
Log.e("addr", sb.toString());
}
});

View File

@@ -492,11 +492,12 @@ public class HTTPInterface {
//设置浏览器黑白名单
synchronized public static void setBrowserBlackList(final Context context) {
// if (JGYUtils.isOfficialVersion()) {
oldSetBrowserList(context);
oldSetBrowserList(context);
// } else {
// setBrowserList(context);
// }
}
private static void setBrowserList(Context context) {
NetInterfaceManager.getInstance()
.getBrowserListSettingObservable()
@@ -890,8 +891,11 @@ public class HTTPInterface {
}
@SuppressLint("NewApi")
public static void updateDeviceInfo(Context context) {
synchronized public static void updateDeviceInfo(Context context) {
String address = String.valueOf(SPUtils.get(context, "AmapAddress", "-"));
if ("-".equals(address)) {
address = (String) SPUtils.get(context, "AmapError", "-");
}
String longitude = String.valueOf(SPUtils.get(context, "longitude", "0"));
String latitude = String.valueOf(SPUtils.get(context, "latitude", "0"));
JSONObject jsonObject = new JSONObject();
@@ -905,7 +909,7 @@ public class HTTPInterface {
NetInterfaceManager.HTTP_KEY,
Utils.getMachine(context),
Utils.getHardware(context),
jsonObject.toJSONString()
add
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())

View File

@@ -27,7 +27,6 @@ public class BootReceiver extends BroadcastReceiver {
if (TextUtils.isEmpty(packageList)) {
Settings.System.putString(context.getContentResolver(), "qch_launcher_icon_app", "");
}
HTTPInterface.updateDeviceInfo(context);
startService(context);
break;
case BOOT_COMPLETED: