update:2020.06.03

fix:修复app禁止升级出现的问题
add:增加桌面图标隐藏功能
This commit is contained in:
2020-06-06 14:04:00 +08:00
parent 8cfdd8ae4f
commit c99f828dcf
15 changed files with 373 additions and 66 deletions

View File

@@ -29,6 +29,7 @@ import com.mjsheng.myappstore.network.HTTPInterface;
import com.mjsheng.myappstore.network.Network;
import com.mjsheng.myappstore.server.InitJpushServer;
import com.mjsheng.myappstore.utils.ApkUtils;
import com.mjsheng.myappstore.utils.Configure;
import com.mjsheng.myappstore.utils.MySQLData;
import com.mjsheng.myappstore.utils.SaveListUtils;
import com.mjsheng.myappstore.utils.ToastUtil;
@@ -90,7 +91,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
private final String HIDE_DESKTOP_ICON = "18";//隐藏桌面图标
private final String DISABLE_APP_SLIDE = "19";//隐藏桌面图标
private final String DISABLE_APP_SLIDE = "19";//禁止滑动
private Context mContext;
@@ -300,9 +301,13 @@ public class MyJPushReceiver extends BroadcastReceiver {
}
try {
JSONObject jSONObject = new JSONObject(s);
String app_name = jSONObject.optString("app_name");
String app_package = jSONObject.optString("app_package");
String app_url = jSONObject.optString("app_url");
int app_version_code = jSONObject.optInt("app_version_code");
com.alibaba.fastjson.JSONObject packageObj = new com.alibaba.fastjson.JSONObject();
packageObj.put("app_name", app_name);
packageObj.put("app_package", app_package);
Log.e("mymjsheng", "app_package::" + app_package);
Log.e("mymjsheng", "app_url::" + app_url);
SaveListUtils.addList(app_package);
@@ -318,8 +323,8 @@ public class MyJPushReceiver extends BroadcastReceiver {
if (!SaveListUtils.isDownLoading(app_url)) {
Aria.download(this)
.load(app_url)
.setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString(s) + ".apk")
.setExtendField(app_package)
.setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString(s) + ".apk", true)
.setExtendField(packageObj.toJSONString())
.create();
}
} else {
@@ -333,8 +338,8 @@ public class MyJPushReceiver extends BroadcastReceiver {
if (!SaveListUtils.isDownLoading(app_url)) {
Aria.download(this)
.load(app_url)
.setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString(s) + ".apk")
.setExtendField(app_package)
.setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString(s) + ".apk", true)
.setExtendField(packageObj.toJSONString())
.create();
}
}
@@ -346,14 +351,17 @@ public class MyJPushReceiver extends BroadcastReceiver {
}
private void getAppLimitApi() {
Network.getAppLimitApi().getAppLimitApi("YTM3YTAxNTJmMmZmNzkyM2E2YzIwZjlhZTc0NzNmMGI=", Utils.getSerial()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<ResponseBody>() {
Network.getAppLimitApi().getAppLimitApi(Configure.HTTP_KEY, Utils.getSerial()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<ResponseBody>() {
@Override
public void onComplete() {
}
@Override
public void onError(Throwable param1Throwable) {
Log.e("mjsheng", "getAppLimitApi=onError:");
}
@Override
public void onNext(ResponseBody param1ResponseBody) {
try {
String str1;
@@ -375,6 +383,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
}
}
@Override
public void onSubscribe(Disposable param1Disposable) {
}
});
@@ -530,6 +539,8 @@ public class MyJPushReceiver extends BroadcastReceiver {
ApkUtils.deleteApkInSilence(title);
}
}
getAppLimitApi();
HTTPInterface.getNetAndLaunchSetting(mContext);
break;
case MSG_SETTING:
if (!TextUtils.isEmpty(extras)) {
@@ -557,6 +568,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
// mContext.sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
getAppLimitApi();
doDownloadAndInstall(extras);
HTTPInterface.setHideDesktopIcon(mContext);
break;
case MSG_LOCK:
settingLock(extras);
@@ -579,10 +591,13 @@ public class MyJPushReceiver extends BroadcastReceiver {
com.alibaba.fastjson.JSONObject URI = JSON.parseObject(extras);
String versionCode = URI.getString("version_code");
String url = URI.getString("url");
com.alibaba.fastjson.JSONObject packageObj = new com.alibaba.fastjson.JSONObject();
packageObj.put("app_name", "教管易");
packageObj.put("app_package", "com.jiaoguanyi.store");
Aria.download(this)
.load(url) //读取下载地址
.setFilePath(PathUtils.getExternalDownloadsPath() + "/ygj/" + EncryptUtils.encryptMD5ToString("com.jiaoguanyi.store") + ".apk", true)
.setExtendField("com.jiaoguanyi.store")
.setExtendField(packageObj.toJSONString())
.create(); //启动下载}
break;
@@ -767,6 +782,8 @@ public class MyJPushReceiver extends BroadcastReceiver {
result = result + "," + store;
}
Settings.System.putString(mContext.getContentResolver(), "qch_app_forbid", result);
Log.e("mjsheng", "qch_app_forbid " + result);
} else {
Log.e("mjsheng", "writeAppPackageList is null:");
@@ -840,7 +857,7 @@ public class MyJPushReceiver extends BroadcastReceiver {
}
Settings.System.putString(this.mContext.getContentResolver(), "qch_app_forbid", result);
Settings.System.putString(this.mContext.getContentResolver(), "DeselectViewArray", s1);
Log.e("SystemSetting", "qch_app_forbid---------" + result);
Log.e("qch_app_forbid", "qch_app_forbid---------" + result);
Log.e("SystemSetting", "deselectViewArray---------" + s1);
return;
} else {

View File

@@ -13,6 +13,7 @@ import com.lzy.okgo.callback.StringCallback;
import com.mjsheng.myappstore.MyApplication;
import com.mjsheng.myappstore.bean.AppData;
import com.mjsheng.myappstore.bean.UploadAppInfo;
import com.mjsheng.myappstore.network.HTTPInterface;
import com.mjsheng.myappstore.network.Network;
import com.mjsheng.myappstore.network.api.UploadAppInfoApi;
import com.mjsheng.myappstore.utils.ApkUtils;
@@ -94,6 +95,9 @@ public class NewAppReceiver extends BroadcastReceiver {
context.sendBroadcast(intent1);
getAppInfo(context);
}
// MyApplication.getInstance().getWhitePackageList();
HTTPInterface.getNetAndLaunchSetting(context);
}