diff --git a/app/build.gradle b/app/build.gradle index 8e4c7c95f5..df2b1e14fb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,6 +14,7 @@ android { String SDK_VERSION = "" String SDK_APP_ID = "" String SDK_APP_NAME = "" + boolean USE_DEFAULT_CHANNEL_SDK = true int ACTIVATE_REPORTING_RATIO = 100 buildFeatures { @@ -86,6 +87,7 @@ android { buildConfigField "String", "SDK_VERSION", "\"${SDK_VERSION}\"" buildConfigField "String", "SDK_APP_ID", "\"${SDK_APP_ID}\"" buildConfigField "String", "SDK_APP_NAME", "\"${SDK_APP_NAME}\"" + buildConfigField "boolean", "USE_DEFAULT_CHANNEL_SDK", "${USE_DEFAULT_CHANNEL_SDK}" // 首次启动的跳转配置 buildConfigField "String", "FIRST_LAUNCH", "\"${FIRST_LAUNCH}\"" diff --git a/app/src/kuaishou/java/com/gh/gamecenter/provider/FlavorProviderImp.kt b/app/src/kuaishou/java/com/gh/gamecenter/provider/FlavorProviderImp.kt index 58c37af53d..f87cdb3cda 100644 --- a/app/src/kuaishou/java/com/gh/gamecenter/provider/FlavorProviderImp.kt +++ b/app/src/kuaishou/java/com/gh/gamecenter/provider/FlavorProviderImp.kt @@ -12,6 +12,7 @@ import com.gh.gamecenter.core.utils.TimeUtils import com.gh.gamecenter.core.utils.ToastUtils import com.halo.assistant.HaloApp import com.kwai.monitor.payload.TurboHelper +import com.leon.channel.helper.ChannelReaderUtil class FlavorProviderImp : IFlavorProvider { @@ -34,7 +35,11 @@ class FlavorProviderImp : IFlavorProvider { } override fun getChannelStr(application: Application): String { - var channel = TurboHelper.getChannel(application) + var channel = if (BuildConfig.USE_DEFAULT_CHANNEL_SDK) { + ChannelReaderUtil.getChannel(application) + } else { + TurboHelper.getChannel(application) + } if (channel == null || TextUtils.isEmpty(channel.trim())) { channel = KUAISHOU_CHANNEL } diff --git a/app/src/main/java/com/gh/gamecenter/pkg/PkgHelper.kt b/app/src/main/java/com/gh/gamecenter/pkg/PkgHelper.kt index 5443b55c8c..f6d00fcf4b 100644 --- a/app/src/main/java/com/gh/gamecenter/pkg/PkgHelper.kt +++ b/app/src/main/java/com/gh/gamecenter/pkg/PkgHelper.kt @@ -82,9 +82,9 @@ object PkgHelper { if (SPUtils.getBoolean(SP_PKG_CONFIG_IS_USED, false)) return mPkgProvider?.requestPkgConfig(configId) { - mPkgConfigLink = it.data?.link - mActivateRatioFromInternet = it.data?.activateRatio ?: 0 - mCoreEventGameCategory = it.data?.coreEventGameCategory + mPkgConfigLink = it.link + mActivateRatioFromInternet = it.activateRatio ?: 0 + mCoreEventGameCategory = it.coreEventGameCategory } } diff --git a/feature/pkg/src/main/java/com/gh/gamecenter/pkg/retrofit/ApiService.kt b/feature/pkg/src/main/java/com/gh/gamecenter/pkg/retrofit/ApiService.kt index 97d426ccb1..ade847cef3 100644 --- a/feature/pkg/src/main/java/com/gh/gamecenter/pkg/retrofit/ApiService.kt +++ b/feature/pkg/src/main/java/com/gh/gamecenter/pkg/retrofit/ApiService.kt @@ -9,7 +9,7 @@ interface ApiService { /** * 获取推广包配置 */ - @GET("pkg/{path}") + @GET("pkg/{path}/config") fun getPkgConfig(@Path("path") config: String): Single } \ No newline at end of file diff --git a/module_common/src/main/java/com/gh/gamecenter/common/entity/PkgConfigEntity.kt b/module_common/src/main/java/com/gh/gamecenter/common/entity/PkgConfigEntity.kt index 90c1f47bf5..b2a323536b 100644 --- a/module_common/src/main/java/com/gh/gamecenter/common/entity/PkgConfigEntity.kt +++ b/module_common/src/main/java/com/gh/gamecenter/common/entity/PkgConfigEntity.kt @@ -3,15 +3,10 @@ package com.gh.gamecenter.common.entity import com.google.gson.annotations.SerializedName class PkgConfigEntity( - @SerializedName("code") var code: Int? = null, - @SerializedName("data") var data: Data? = Data() + @SerializedName("first_lanuch_jump") var link: PkgLinkEntity? = PkgLinkEntity(), + @SerializedName("activate_reporting_ratio") var activateRatio: Int? = 0, + @SerializedName("keypoint_action_reporting") var coreEventGameCategory: String? = null, ) { - data class Data( - @SerializedName("first_lanuch_jump") var link: PkgLinkEntity? = PkgLinkEntity(), - @SerializedName("activate_reporting_ratio") var activateRatio: Int? = 0, - @SerializedName("keypoint_action_reporting") var coreEventGameCategory: String? = null, - ) - class PkgLinkEntity( @SerializedName("home_index") var shouldStayAtHomePage: Boolean = false, diff --git a/scripts/meta_build.sh b/scripts/meta_build.sh index d18890bae4..9255bc5fe8 100755 --- a/scripts/meta_build.sh +++ b/scripts/meta_build.sh @@ -31,7 +31,7 @@ fi mkdir -p release/ -OPTIONS=$(getopt -o '' -l config_id:,sdk_platform:,sdk_version:,app_id:,app_name:,channel:,activate_reporting_ratio:,first_launch_jump:,output:,unix_timestamp:,keypoint_action_reporting:, -- "$@") +OPTIONS=$(getopt -o '' -l config_id:,sdk_platform:,sdk_version:,app_id:,app_name:,channel:,activate_reporting_ratio:,first_launch_jump:,output:,unix_timestamp:,sdk_type:,keypoint_action_reporting:, -- "$@") eval set -- "$OPTIONS" @@ -47,6 +47,7 @@ while true; do --unix_timestamp) unix_timestamp="$2"; shift 2;; --app_id) app_id="$2"; shift 2;; --app_name) app_name="$2"; shift 2;; + --sdk_type) sdk_type="$2"; shift 2;; --keypoint_action_reporting) keypoint_action_reporting="$2"; shift 2;; --) shift; break;; *) echo "Invalid option: $1" >&2; exit 1;; @@ -57,6 +58,7 @@ function updateChannelIfNeeded { if [ "${channel}" != "" ]; then java -jar ${cwd}/ApkChannelPackage.jar put -c $channel $1 release rm $1 + rm -r ./app/build/outputs/apk find . -type f -name "*.apk" -exec mv {} "${apk_release_path}" \; fi } @@ -71,6 +73,11 @@ if [ "${config_id}" != "" ]; then sed -i "s/String CONFIG_ID = \"\"/String CONFIG_ID = \"${config_id}\"/g" app/build.gradle fi +# 是否使用默认渠道 SDK (目前仅快手可用) +if [ "${sdk_type}" == "subpackage" ]; then + sed -i "s/boolean USE_DEFAULT_CHANNEL_SDK = true/boolean USE_DEFAULT_CHANNEL_SDK = false/g" app/build.gradle +fi + # 保存 first_launch_jump if [ "${first_launch_jump}" != "" ]; then sed -i "s/String FIRST_LAUNCH = \"\"/String FIRST_LAUNCH = \"${first_launch_jump}\"/g" app/build.gradle