Skip to content

Commit

Permalink
修复bug
Browse files Browse the repository at this point in the history
  • Loading branch information
muxiannian committed Nov 8, 2019
1 parent f59e285 commit 887edf8
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 36 deletions.
Binary file modified .idea/caches/gradle_models.ser
Binary file not shown.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
+ **新增静默下载更新的方式,实现进入App直接后台下载,下载完成后弹出安装页面(静默安装需要Root权限,而且体验很不好,不做支持)(2019-10-25 18:09:05添加)。**

### 新版本说明
+ 2019-11-08 18:13:56更新版本,版本号为:v2.0.4
+ 修复静默下载时网络环境为数据网络的时候无法下载的问题
+ 修复其他问题

+ 2019-11-04 12:38:12更新版本,版本号为:v2.0.3
+ 新增配置DownloadConnection的入口,可切换文件下载器的内核
+ 提供了配置Okhttp3作为下载器的demo,在demo中提供了OkHttp3Connection的实现,并提供信任所有证书的工具类SSLUtils,可解决https根证书不被信任导致无法下载的问题
Expand Down
3 changes: 2 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ dependencies {
implementation 'com.blankj:utilcode:1.25.9'

//使用jitpack
// implementation 'com.github.MZCretin:AutoUpdateProject:v2.0.0'
// implementation 'com.github.MZCretin:AutoUpdateProject:v2.0.4'

//使用本地库依赖
implementation project(':cretinautoupdatelibrary')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,28 +94,30 @@ public static String getAppRootPath() {
* @param okText
*/
public static void showDialog(Activity activity, String msg, final OnDialogClickListener clickListener, boolean cancelable, String title, String cancelText, String okText) {
new AlertDialog.Builder(activity, R.style.AlertDialog)
.setTitle(title)
.setMessage(msg)
.setPositiveButton(okText, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (clickListener != null) {
clickListener.onOkClick(dialog);
if (!activity.isFinishing()) {
new AlertDialog.Builder(activity, R.style.AlertDialog)
.setTitle(title)
.setMessage(msg)
.setPositiveButton(okText, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (clickListener != null) {
clickListener.onOkClick(dialog);
}
}
}
})
.setNegativeButton(cancelText, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (clickListener != null) {
clickListener.onCancelClick(dialog);
})
.setNegativeButton(cancelText, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (clickListener != null) {
clickListener.onCancelClick(dialog);
}
}
}
})
.setCancelable(cancelable)
.create()
.show();
})
.setCancelable(cancelable)
.create()
.show();
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,26 @@ private void checkDownload() {
if (AppUpdateUtils.getInstance().getUpdateConfig().isShowNotification())
startService(new Intent(this, UpdateService.class));

if (!NetWorkUtils.getCurrentNetType(this).equals("wifi")) {
AppUtils.showDialog(this, ResUtils.getString(R.string.wifi_tips), new OnDialogClickListener() {
@Override
public void onOkClick(DialogInterface dialog) {
dialog.dismiss();
//下载
doDownload();
}

@Override
public void onCancelClick(DialogInterface dialog) {
dialog.dismiss();
}
}, true, ResUtils.getString(R.string.tips), ResUtils.getString(R.string.cancel), ResUtils.getString(R.string.confirm));
} else {
if (AppUpdateUtils.getInstance().getUpdateConfig().isAutoDownloadBackground()) {
doDownload();
} else {
if (!NetWorkUtils.getCurrentNetType(this).equals("wifi")) {
AppUtils.showDialog(this, ResUtils.getString(R.string.wifi_tips), new OnDialogClickListener() {
@Override
public void onOkClick(DialogInterface dialog) {
dialog.dismiss();
//下载
doDownload();
}

@Override
public void onCancelClick(DialogInterface dialog) {
dialog.dismiss();
}
}, true, ResUtils.getString(R.string.tips), ResUtils.getString(R.string.cancel), ResUtils.getString(R.string.confirm));
} else {
doDownload();
}
}
}

Expand Down

0 comments on commit 887edf8

Please sign in to comment.