feat: 光环工具服务APP多合一—客户端 https://jira.shanqu.cc/browse/GHZSCY-6476
This commit is contained in:
@ -26,6 +26,7 @@ import com.gh.gamecenter.core.utils.GsonUtils;
|
||||
import com.gh.gamecenter.core.utils.SPUtils;
|
||||
import com.gh.gamecenter.core.utils.UrlFilterUtils;
|
||||
import com.gh.gamecenter.entity.AppEntity;
|
||||
import com.gh.gamecenter.entity.FloatWindowSettingEntity;
|
||||
import com.gh.gamecenter.entity.GameGuidePopupEntity;
|
||||
import com.gh.gamecenter.entity.NewApiSettingsEntity;
|
||||
import com.gh.gamecenter.entity.NewSettingsEntity;
|
||||
@ -82,6 +83,8 @@ public class Config {
|
||||
private static VSetting mVSetting;
|
||||
private volatile static VNewSetting mVNewSetting;
|
||||
|
||||
private static FloatWindowSettingEntity mFloatWindowSetting;
|
||||
|
||||
private static AppEntity mNew32UpdateEntity;
|
||||
private static BehaviorSubject<VNewSetting> vNewSettingSubject = BehaviorSubject.create();
|
||||
private static GameGuidePopupEntity mGameGuidePopupEntity;
|
||||
@ -213,6 +216,21 @@ public class Config {
|
||||
}
|
||||
return mVNewSetting;
|
||||
}
|
||||
@Nullable
|
||||
public static FloatWindowSettingEntity getFloatWindowSettingEntity() {
|
||||
if (mFloatWindowSetting == null) {
|
||||
try {
|
||||
String json = SPUtils.getString(Constants.SP_FLOAT_WINDOW_SETTINGS);
|
||||
if (!TextUtils.isEmpty(json)) {
|
||||
mFloatWindowSetting = GsonUtils.fromJson(json, FloatWindowSettingEntity.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return mFloatWindowSetting;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
public static Observable<VNewSetting> getVNewSettingObservable() {
|
||||
@ -330,6 +348,7 @@ public class Config {
|
||||
|
||||
refreshVSettingEntity();
|
||||
getNewSetting();
|
||||
getFloatWindowSetting();
|
||||
|
||||
RetrofitManager.getInstance()
|
||||
.getApi().getGameGuidePopup(Build.MANUFACTURER, Build.VERSION.RELEASE, Build.MODEL, channel, BuildConfig.VERSION_NAME)
|
||||
@ -408,6 +427,20 @@ public class Config {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private static void getFloatWindowSetting() {
|
||||
RetrofitManager.getInstance().getNewApi()
|
||||
.getFloatWindowSettings()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new BiResponse<FloatWindowSettingEntity>() {
|
||||
@Override
|
||||
public void onSuccess(FloatWindowSettingEntity data) {
|
||||
mFloatWindowSetting = data;
|
||||
SPUtils.setString(Constants.SP_FLOAT_WINDOW_SETTINGS, GsonUtils.toJson(data));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void observePackageChange(NewApiSettingsEntity.PackageObserveActions packageObserveActions) {
|
||||
PackageChangeBroadcastReceiver receiver = new PackageChangeBroadcastReceiver(packageObserveActions);
|
||||
IntentFilter intentFilter = new IntentFilter();
|
||||
|
||||
@ -179,7 +179,8 @@ object DirectUtils {
|
||||
"bbs_section",
|
||||
"qa",
|
||||
"feedback",
|
||||
"toolkit"
|
||||
"toolkit",
|
||||
"float_window_game"
|
||||
)
|
||||
|
||||
fun directToLinkPage(
|
||||
@ -551,6 +552,22 @@ object DirectUtils {
|
||||
MiniGameItemHelper.launchMiniGame(it, Constants.WECHAT_MINI_GAME)
|
||||
}
|
||||
|
||||
"float_window_game" -> linkEntity.link?.let { link ->
|
||||
if (PackageUtils.isInstalled(context, Constants.TOOL_MAP_PACKAGE_NAME)) {
|
||||
val intent = Intent(
|
||||
Intent.ACTION_VIEW,
|
||||
Uri.parse("ghtoolmap://floatWindow")
|
||||
).also {
|
||||
it.addCategory(Intent.CATEGORY_DEFAULT)
|
||||
it.addCategory(Intent.CATEGORY_BROWSABLE)
|
||||
it.putExtra("gameId", linkEntity.link)
|
||||
}
|
||||
context.startActivity(intent)
|
||||
} else {
|
||||
directToGameDetail(context, Config.getFloatWindowSettingEntity()?.gameId ?: "")
|
||||
}
|
||||
}
|
||||
|
||||
"" -> {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
class FloatWindowSettingEntity(
|
||||
/**
|
||||
* 光环工具服务APP的游戏ID
|
||||
*/
|
||||
@SerializedName("game_id")
|
||||
var gameId: String? = ""
|
||||
)
|
||||
@ -29,6 +29,7 @@ import com.gh.gamecenter.entity.DialogEntity;
|
||||
import com.gh.gamecenter.entity.DiscoveryGameCardEntity;
|
||||
import com.gh.gamecenter.entity.DiscoveryGameCardLabel;
|
||||
import com.gh.gamecenter.entity.DiverterEntity;
|
||||
import com.gh.gamecenter.entity.FloatWindowSettingEntity;
|
||||
import com.gh.gamecenter.entity.FollowCommonContentCollection;
|
||||
import com.gh.gamecenter.entity.FollowDynamicEntity;
|
||||
import com.gh.gamecenter.entity.FollowUserEntity;
|
||||
@ -836,6 +837,9 @@ public interface ApiService {
|
||||
@Query("systemVersion") int systemVersion,
|
||||
@Query("ghVersion") String ghVersion);
|
||||
|
||||
@GET("float_window_game/settings")
|
||||
Single<FloatWindowSettingEntity> getFloatWindowSettings();
|
||||
|
||||
@GET("/settings/game_installed/whitelist")
|
||||
Single<WhitePackageListEntity> getInstallWhitelist();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user