【光环助手V5.2.0】小米等设备第三方安装引导功能-客户端 https://git.ghzs.com/pm/halo-app-issues/-/issues/1410

This commit is contained in:
leafwai
2021-08-23 15:37:35 +08:00
parent c1f6ef35f2
commit ce2c6bed0a
11 changed files with 198 additions and 4 deletions

View File

@ -1,5 +1,6 @@
package com.gh.common.constant;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
@ -12,6 +13,7 @@ import com.gh.common.util.PackageUtils;
import com.gh.common.util.SPUtils;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.SuggestionActivity;
import com.gh.gamecenter.entity.GameGuidePopupEntity;
import com.gh.gamecenter.entity.NewSettingsEntity;
import com.gh.gamecenter.entity.NewsEntity;
import com.gh.gamecenter.entity.SettingsEntity;
@ -27,6 +29,7 @@ import org.greenrobot.eventbus.EventBus;
import java.util.List;
import androidx.annotation.Nullable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
@ -68,6 +71,7 @@ public class Config {
private static SettingsEntity mSettingsEntity;
private static NewSettingsEntity mNewSettingsEntity;
private static GameGuidePopupEntity mGameGuidePopupEntity;
public static final String FIX_DOWNLOAD_KEY = "isFixDownload";
public static final String FIX_PLUGIN_KEY = "isFixPlugin";
@ -225,6 +229,21 @@ public class Config {
return mNewSettingsEntity;
}
@Nullable
public static GameGuidePopupEntity getGameGuidePopupEntityEntity() {
if (mGameGuidePopupEntity == null) {
try {
String json = SPUtils.getString(Constants.SP_GAME_DETAIL_INSTALL_GUIDE_CONTENT);
if (!TextUtils.isEmpty(json)) {
mGameGuidePopupEntity = GsonUtils.fromJson(json, GameGuidePopupEntity.class);
}
} catch (Exception e) {
e.printStackTrace();
}
}
return mGameGuidePopupEntity;
}
private static boolean isExistDownloadFilter() {
if (getSettings() == null || getSettings().getDownload() == null || getSettings().getDownload().size() == 0) {
return false;
@ -277,6 +296,7 @@ public class Config {
editor.apply();
}
@SuppressLint("CheckResult")
public static void getGhzsSettings() {
String channel = HaloApp.getInstance().getChannel();
RetrofitManager.getInstance(HaloApp.getInstance().getApplication())
@ -312,5 +332,17 @@ public class Config {
SPUtils.setString(Constants.SP_NEW_SETTINGS, GsonUtils.toJson(data));
}
});
RetrofitManager.getInstance(HaloApp.getInstance().getApplication())
.getApi().getGameGuidePopup(Build.MANUFACTURER, Build.VERSION.RELEASE, Build.MODEL, channel, Constants.API_VERSION)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new BiResponse<GameGuidePopupEntity>() {
@Override
public void onSuccess(GameGuidePopupEntity data) {
mGameGuidePopupEntity = data;
SPUtils.setString(Constants.SP_GAME_DETAIL_INSTALL_GUIDE_CONTENT, GsonUtils.toJson(data));
}
});
}
}