Skip to content

Commit

Permalink
fix ignore update bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MZCretin committed Dec 8, 2017
1 parent b7bc828 commit f3801ee
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
3 changes: 0 additions & 3 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void onCreate() {
CretinAutoUpdateUtils.Builder builder = new CretinAutoUpdateUtils.Builder()
.setBaseUrl("http://www.cretinzp.com/system/versioninfo")
.setIgnoreThisVersion(true)
.setShowType(CretinAutoUpdateUtils.Builder.TYPE_DIALOG_WITH_BACK_DOWN)
.setShowType(CretinAutoUpdateUtils.Builder.TYPE_DIALOG)
.setIconRes(R.mipmap.logo)
.showLog(true)
.setRequestMethod(CretinAutoUpdateUtils.Builder.METHOD_GET)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public void destroy() {
//不要忘了这一步
if ( mContext != null && intent != null )
mContext.stopService(intent);
if ( mContext != null && receiver != null ){
if ( mContext != null && receiver != null ) {
mContext.unregisterReceiver(receiver);
receiver = null;
}
Expand Down Expand Up @@ -295,7 +295,16 @@ protected void onPostExecute(UpdateEntity data) {
}
} else if ( data.isForceUpdate == 0 ) {
if ( data.versionCode > getVersionCode(mContext) ) {
showUpdateDialog(data, false, true);
String dataVersion = data.versionName;
if ( !TextUtils.isEmpty(dataVersion) ) {
List listCodes = loadArray();
if ( !listCodes.contains(dataVersion) ) {
//没有设置为已忽略
showUpdateDialog(data, false, true);
} else {
Log.e("cretinautoupdatelibrary", "自动更新library已经忽略此版本");
}
}
}
}
} else {
Expand Down

0 comments on commit f3801ee

Please sign in to comment.