Skip to content

Commit

Permalink
可设置,是否提示“已经是最新版了”
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyaoyao committed Nov 8, 2017
1 parent ce4d0dd commit a5eeccb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

#### 不同的地方 ####
1. 跳过md5验证
2. 待更新...
2. 可设置,是否提示“已经是最新版了”
3. 待更新...

## 使用步骤 ##
#### Step 1. Add the JitPack repository to your build file ####
Expand All @@ -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'
}
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ public void check() {
}



void doCheck() {
new AsyncTask<String, Void, Void>() {
@Override
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class UpdateInfo {
public boolean isAutoInstall = true;
// 是否可忽略该版本
public boolean isIgnorable = true;
// 是否提示“已是最新版”
public boolean isShowMsg = true;
// 一天内最大提示次数,<1时不限
public int maxTimes = 0;

Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit a5eeccb

Please sign in to comment.