feat: 获取32位组件和插件的接口数据

This commit is contained in:
yangfei
2024-01-04 14:35:50 +08:00
parent 7c666bfeb0
commit 5387bfd9bc
5 changed files with 90 additions and 0 deletions

View File

@ -25,6 +25,7 @@ import com.gh.gamecenter.core.utils.UrlFilterUtils;
import com.gh.gamecenter.entity.GameGuidePopupEntity;
import com.gh.gamecenter.entity.NewApiSettingsEntity;
import com.gh.gamecenter.entity.NewSettingsEntity;
import com.gh.gamecenter.entity.VNewSetting;
import com.gh.gamecenter.entity.VSetting;
import com.gh.gamecenter.feature.entity.NewsEntity;
import com.gh.gamecenter.feature.entity.SettingsEntity;
@ -73,6 +74,7 @@ public class Config {
private static NewApiSettingsEntity.NightMode mNightModeSetting;
private static SimulatorEntity mNewSimulatorEntity;
private static VSetting mVSetting;
private static VNewSetting mVNewSetting;
private static GameGuidePopupEntity mGameGuidePopupEntity;
private static SharedPreferences mDefaultSharedPreferences;
@ -306,6 +308,20 @@ public class Config {
return mVSetting;
}
public static VNewSetting getVNewSettingEntity() {
if (mVNewSetting == null) {
try {
String json = SPUtils.getString(Constants.SP_V_NEW_SETTINGS);
if (!TextUtils.isEmpty(json)) {
mVNewSetting = GsonUtils.fromJson(json, VNewSetting.class);
}
} catch (Exception e) {
e.printStackTrace();
}
}
return mVNewSetting;
}
/**
* 请求网络数据,尝试刷新畅玩相关配置
*/
@ -326,6 +342,23 @@ public class Config {
});
}
@SuppressLint("CheckResult")
public static void getNewSetting() {
RetrofitManager.getInstance()
.getVApi().getNewSettings(BuildConfig.VERSION_NAME, Build.VERSION.SDK_INT)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new BiResponse<VNewSetting>() {
@Override
public void onSuccess(VNewSetting data) {
// TODO: test
data.getVa().getArch32().setUrl("https://dev-app-static.796697.com/va/apk/2024/01/04/com.gh.gamecenter.addon_2.0.0-debug_20000_0.0.10_1704335165.apk");
mVNewSetting = data;
SPUtils.setString(Constants.SP_V_NEW_SETTINGS, GsonUtils.toJson(data));
}
});
}
@Nullable
public static GameGuidePopupEntity getGameGuidePopupEntity() {
return mGameGuidePopupEntity;
@ -404,6 +437,7 @@ public class Config {
});
refreshVSettingEntity();
getNewSetting();
RetrofitManager.getInstance()
.getApi().getGameGuidePopup(Build.MANUFACTURER, Build.VERSION.RELEASE, Build.MODEL, channel, BuildConfig.VERSION_NAME)