fix: 广告系统-新增广告游戏的过滤条件 https://jira.shanqu.cc/browse/GHZSCY-8006

This commit is contained in:
chenjuntao
2025-05-19 17:39:14 +08:00
parent c41939cd79
commit 6cdff338ed
3 changed files with 35 additions and 1 deletions

View File

@ -9,15 +9,17 @@ import com.gh.common.filter.RegionSettingHelper
import com.gh.common.util.GameUtils
import com.gh.common.util.PackageHelper
import com.gh.common.util.PackageUtils
import com.gh.gamecenter.R
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.entity.InstalledPackagesAction
import com.gh.gamecenter.common.exposure.meta.MetaUtil
import com.gh.gamecenter.common.loghub.LoghubUtils
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.retrofit.EmptyResponse
import com.gh.gamecenter.common.retrofit.ObservableUtil
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.secondOrNull
import com.gh.gamecenter.common.utils.toArrayList
import com.gh.gamecenter.common.utils.toRequestBody
import com.gh.gamecenter.common.utils.tryCatchInRelease
import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.core.utils.SPUtils
@ -41,10 +43,12 @@ import io.reactivex.SingleObserver
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import okhttp3.ResponseBody
import org.greenrobot.eventbus.EventBus
import org.json.JSONException
import org.json.JSONObject
import java.util.*
import kotlin.collections.HashSet
/**
* 该类存储的是已安装的所有游戏(助手后台已收录的)和所有更新(包括插件化)数据
@ -624,7 +628,20 @@ object PackageRepository {
pkgSet.add(iterator.next())
}
postInstalledPackageList(pkgSet)
PackagesManager.initInstallPkgSet(pkgSet)
}
private fun postInstalledPackageList(pkgSet: HashSet<String>) {
val requestBody = InstalledPackagesAction(
action = "launch",
packages = pkgSet.toList()
).toRequestBody()
RetrofitManager.getInstance().newApi.postInstalledPackages(HaloApp.getInstance().gid, requestBody)
.subscribeOn(Schedulers.io())
.subscribe(EmptyResponse<ResponseBody>())
}
}

View File

@ -3521,4 +3521,11 @@ public interface ApiService {
@Headers({"Content-Type: application/json", "Accept: application/json"})
@POST("suggestions")
Single<ResponseBody> uploadAcceleratorErrorLog(@Body RequestBody toRequestBody);
/**
* 上传设备已安装的游戏
*/
@POST("/devices/{device_id}/installed_games")
Single<ResponseBody> postInstalledPackages(@Path("device_id") String deviceId, @Body RequestBody body);
}

View File

@ -0,0 +1,10 @@
package com.gh.gamecenter.common.entity
import android.os.Parcelable
import kotlinx.parcelize.Parcelize
@Parcelize
class InstalledPackagesAction(
val action: String,
val packages: List<String>,
): Parcelable