This commit is contained in:
juntao
2020-08-26 18:10:43 +08:00
parent b47bcfc2c3
commit b8903e7814
4 changed files with 25 additions and 10 deletions

View File

@ -137,22 +137,25 @@ public class UpdateManager {
} else if (DownloadStatus.hijack.equals(downloadEntity.getStatus())) {
Utils.toast(mContext, "网络劫持,请稍后重试");
}
} else if (updateDialog != null && updateDialog.isShowing()) {
} else {
if (downloadEntity.getSize() != lastUpdateFileSize) {
lastUpdateFileSize = downloadEntity.getSize();
SPUtils.setLong(Constants.LAST_GHZS_UPDATE_FILE_SIZE, lastUpdateFileSize);
}
if (DownloadStatus.done.equals(downloadEntity.getStatus())) {
updateUpdateDialogView(true);
}
} else {
if (mContext instanceof MainActivity
&& AppManager.getInstance().getRecentActiveActivity() == mContext) {
if (updateDialog != null && updateDialog.isShowing()) {
if (DownloadStatus.done.equals(downloadEntity.getStatus())) {
showUpdateDialog(currentUpdateMd5);
updateUpdateDialogView(true);
}
} else {
if (mContext instanceof MainActivity
&& AppManager.getInstance().getRecentActiveActivity() == mContext) {
if (DownloadStatus.done.equals(downloadEntity.getStatus())) {
showUpdateDialog(currentUpdateMd5);
}
}
}
}
}
}
@ -235,7 +238,9 @@ public class UpdateManager {
if (appEntity.isForce() || isUpdateFileDownloaded(response)) {
showUpdateDialog(response);
} else {
createUpdate(response, true);
if (NetworkUtils.isWifiConnected(mContext)) {
createUpdate(response, true);
}
}
if (handler != null) {
Message message = new Message();