diff --git a/README.md b/README.md index d9e220f..f3372f9 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ #### 不同的地方 #### 1. 跳过md5验证 -2. 待更新... +2. 可设置,是否提示“已经是最新版了” +3. 待更新... ## 使用步骤 ## #### Step 1. Add the JitPack repository to your build file #### @@ -17,5 +18,5 @@ } #### Step 2. Add the dependency #### dependencies { - compile 'com.github.andShine:update:1.2.1' + compile 'com.github.andShine:update:1.2.2' } diff --git a/library/src/main/java/com/andshine/update/library/UpdateAgent.java b/library/src/main/java/com/andshine/update/library/UpdateAgent.java index 849fa46..2979ca1 100644 --- a/library/src/main/java/com/andshine/update/library/UpdateAgent.java +++ b/library/src/main/java/com/andshine/update/library/UpdateAgent.java @@ -194,7 +194,6 @@ public void check() { } - void doCheck() { new AsyncTask() { @Override @@ -223,7 +222,9 @@ void doCheckFinish() { if (info == null) { doFailure(new UpdateError(UpdateError.CHECK_UNKNOWN)); } else if (!info.hasUpdate) { - doFailure(new UpdateError(UpdateError.UPDATE_NO_NEWER)); + if (info.isShowMsg) { + doFailure(new UpdateError(UpdateError.UPDATE_NO_NEWER)); + } } else if (UpdateUtil.isIgnore(mContext, info.md5)) { doFailure(new UpdateError(UpdateError.UPDATE_IGNORED)); } else { diff --git a/library/src/main/java/com/andshine/update/library/UpdateInfo.java b/library/src/main/java/com/andshine/update/library/UpdateInfo.java index c34668e..f597bd6 100644 --- a/library/src/main/java/com/andshine/update/library/UpdateInfo.java +++ b/library/src/main/java/com/andshine/update/library/UpdateInfo.java @@ -30,6 +30,8 @@ public class UpdateInfo { public boolean isAutoInstall = true; // 是否可忽略该版本 public boolean isIgnorable = true; + // 是否提示“已是最新版” + public boolean isShowMsg = true; // 一天内最大提示次数,<1时不限 public int maxTimes = 0; @@ -61,6 +63,7 @@ private static UpdateInfo parse(JSONObject o) { info.isForce = o.optBoolean("isForce", false); info.isAutoInstall = o.optBoolean("isAutoInstall", !info.isSilent); info.isIgnorable = o.optBoolean("isIgnorable", true); + info.isShowMsg = o.optBoolean("isShowMsg", true); info.versionCode = o.optInt("versionCode", 0); info.versionName = o.optString("versionName");