Bläddra i källkod

正式版本与测试版本更新方式区别开

zengjiebin 7 år sedan
förälder
incheckning
084a9158f1
1 ändrade filer med 35 tillägg och 16 borttagningar
  1. 35 16
      app/src/main/java/com/sheep/gamegroup/util/SysAppUtil.java

+ 35 - 16
app/src/main/java/com/sheep/gamegroup/util/SysAppUtil.java

@@ -400,22 +400,41 @@ public class SysAppUtil {
                                 action1.call(0);
                             return;
                         }
-                        if(ignoreMd5 != null && TextUtils.equals(ignoreMd5, version.getMd5_address()) && !version.isForceUpdate()){
-                            LogUtil.println("showVersionInfo", "忽略", ignoreMd5, version.getVersion_name());
-                            if(action1 != null)
-                                action1.call(0);
-                            return;
-                        }
-                        String fileMD5 = SysAppUtil.getConnectAdrressFileMD5();
-                        int versionCode = SysAppUtil.getAppVersionCode();
-                        if(versionCode == 0){
-                            if(ignoreMd5 == null)
-                                G.showToast(baseMessage);
-                            if(action1 != null)
-                                action1.call(0);
-                            return;
+                        boolean isNewApp;
+                        if(TestUtil.isSheep()) {
+                            if(ignoreMd5 != null && TextUtils.equals(ignoreMd5, version.getVersion_number()+"") && !version.isForceUpdate()){
+                                LogUtil.println("showVersionInfo", "忽略", ignoreMd5, version.getVersion_name());
+                                if(action1 != null)
+                                    action1.call(0);
+                                return;
+                            }
+                            int versionCode = SysAppUtil.getAppVersionCode();
+                            if (versionCode == 0) {
+                                if (ignoreMd5 == null)
+                                    G.showToast(baseMessage);
+                                if (action1 != null)
+                                    action1.call(0);
+                                return;
+                            }
+                            isNewApp = versionCode >= version.getVersion_number();
+                        } else {
+                            if(ignoreMd5 != null && TextUtils.equals(ignoreMd5, version.getMd5_address()) && !version.isForceUpdate()){
+                                LogUtil.println("showVersionInfo", "忽略", ignoreMd5, version.getVersion_name());
+                                if(action1 != null)
+                                    action1.call(0);
+                                return;
+                            }
+                            String fileMD5 = SysAppUtil.getConnectAdrressFileMD5();
+                            if (TextUtils.isEmpty(fileMD5)) {
+                                if (ignoreMd5 == null)
+                                    G.showToast(baseMessage);
+                                if (action1 != null)
+                                    action1.call(0);
+                                return;
+                            }
+                            isNewApp = fileMD5.equalsIgnoreCase(version.getMd5_address());
                         }
-                        if(versionCode >= version.getVersion_number()){//已经是最新版本
+                        if(isNewApp){//已经是最新版本
                             if(ignoreMd5 == null)
                                 G.showToast("当前版本为最新版本,无需更新");
                             if(action1 != null)
@@ -476,7 +495,7 @@ public class SysAppUtil {
                                 dialogConfig.setBtnRightText("下次更新").setBtnRightOnClickListener(new View.OnClickListener() {
                                     @Override
                                     public void onClick(View view) {
-                                        SpUtils.saveIgnoreMd5(version.getMd5_address());
+                                        SpUtils.saveIgnoreMd5(TestUtil.isSheep() ? version.getVersion_number()+"" : version.getMd5_address());
                                     }
                                 });
                             }