Parcourir la source

升级app时继承渠道

zengjiebin il y a 7 ans
Parent
commit
eef27537a2
1 fichiers modifiés avec 9 ajouts et 0 suppressions
  1. 9 0
      app/src/main/java/com/sheep/gamegroup/util/SysAppUtil.java

+ 9 - 0
app/src/main/java/com/sheep/gamegroup/util/SysAppUtil.java

@@ -494,6 +494,15 @@ public class SysAppUtil {
                     .setBtnLeftText(file.exists() ? "立即安装" : "立即更新").setBtnLeftNotDissDialog(true).setBtnLeftOnClickListener(new View.OnClickListener() {
                 private void installApk(File file){
                     if(file != null && file.exists()) {
+                        //升级后继承渠道
+                        String channel = ChannelContent.getInstance().getChannel_name();
+                        try {
+                            if(!TextUtils.isEmpty(channel) && !ZipChannelUtil.isAddQUA(file)){
+                                ZipChannelUtil.writeQUA(file, channel);
+                            }
+                        } catch (IOException e) {
+                            e.printStackTrace();
+                        }
                         ApkUtils.installApk(SheepApp.getInstance(), file.getAbsolutePath());
                     }
                 }