|
|
@@ -429,13 +429,13 @@ public class SysAppUtil {
|
|
|
* 显示升级对话框
|
|
|
* @param ignoreMd5 用户手动时传null;进入主要界面时不要传null,传保存的忽略md5值,为空字符串时传""
|
|
|
*/
|
|
|
- public static void showVersionInfo(final String ignoreMd5) {
|
|
|
+ public static void showVersionInfo(Activity activity, final String ignoreMd5) {
|
|
|
/**
|
|
|
*游戏认证过来的不提示升级
|
|
|
*/
|
|
|
if(!TextUtils.isEmpty(SheepApp.getInstance().getGamePackgeName()))
|
|
|
return;
|
|
|
- showVersionInfo(ignoreMd5, null);
|
|
|
+ showVersionInfo(activity, ignoreMd5, null);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -443,7 +443,7 @@ public class SysAppUtil {
|
|
|
* @param ignoreMd5 用户手动时传null;进入主要界面时不要传null,传保存的忽略md5值,为空字符串时传""
|
|
|
* @param action1 动作完成后的回调
|
|
|
*/
|
|
|
- public static void showVersionInfo(final String ignoreMd5, final Action1<Integer> action1) {
|
|
|
+ public static void showVersionInfo(Activity activity, final String ignoreMd5, final Action1<Integer> action1) {
|
|
|
if(!ConfigUtil.getInstance().isUpgrade()) {
|
|
|
if(action1 != null)
|
|
|
action1.call(0);
|
|
|
@@ -460,13 +460,13 @@ public class SysAppUtil {
|
|
|
}
|
|
|
// checkUpdateNewVersion(ignoreMd5, action1);
|
|
|
if(TestUtil.isSheep()) {
|
|
|
- checkUpdateNewVersion(ignoreMd5, action1);
|
|
|
+ checkUpdateNewVersion(activity, ignoreMd5, action1);
|
|
|
} else if(!TestUtil.isDev()) {
|
|
|
TestUtil.checkUpdateFromJenkins(ignoreMd5, action1);
|
|
|
}
|
|
|
}
|
|
|
//通过接口检查更新
|
|
|
- public static void checkUpdateNewVersion(final String ignoreMd5, final Action1<Integer> action1) {
|
|
|
+ public static void checkUpdateNewVersion(Activity activity, final String ignoreMd5, final Action1<Integer> action1) {
|
|
|
SheepApp.getInstance().getNetComponent().getApiService().getNewVersion(SheepApp.getInstance().getConnectAddress().getVersionType())
|
|
|
.subscribeOn(Schedulers.io())
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
@@ -474,7 +474,7 @@ public class SysAppUtil {
|
|
|
@Override
|
|
|
public void onNext(BaseMessage baseMessage) {
|
|
|
Version version = baseMessage.getData(Version.class);
|
|
|
- loadVersion(ignoreMd5, action1, version);
|
|
|
+ loadVersion(activity, ignoreMd5, action1, version);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -488,7 +488,7 @@ public class SysAppUtil {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- private static void loadVersion(final String ignoreMd5, final Action1<Integer> action1, final Version version) {
|
|
|
+ private static void loadVersion(Activity activity, final String ignoreMd5, final Action1<Integer> action1, final Version version) {
|
|
|
if(version == null){
|
|
|
if(ignoreMd5 == null)
|
|
|
G.showToast("当前版本为最新版本,无需更新");
|
|
|
@@ -537,11 +537,11 @@ public class SysAppUtil {
|
|
|
if(action1 != null)
|
|
|
action1.call(0);
|
|
|
} else {//有新版本
|
|
|
- showUpgradeByVersion(version, action1);
|
|
|
+ showUpgradeByVersion(activity, version, action1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void showUpgradeByVersion(Version version, Action1<Integer> action1) {
|
|
|
+ public static void showUpgradeByVersion(Activity activity, Version version, Action1<Integer> action1) {
|
|
|
if(!TextUtils.isEmpty(version.getAddress()))
|
|
|
ACache.get(SheepApp.getInstance()).put("version_url", version.getAddress());
|
|
|
final String fileName = version.getMd5_address()+".apk";
|
|
|
@@ -616,7 +616,7 @@ public class SysAppUtil {
|
|
|
UPGRADE_DIALOG_BT.onEvent("action", ((TextView) view).getText());
|
|
|
});
|
|
|
}
|
|
|
- dialog = ViewUtil.showUpgradeDialog(SheepApp.getInstance(), dialogConfig);
|
|
|
+ dialog = ViewUtil.showUpgradeDialog(activity, dialogConfig);
|
|
|
dialog.setOnDismissListener(dialogInterface -> {
|
|
|
if (action1 != null)
|
|
|
action1.call(0);
|