feat: 快手可选是否使用默认渠道 SDK https://jira.shanqu.cc/browse/GHZS-3039

This commit is contained in:
chenjuntao
2023-08-08 11:23:53 +08:00
parent ab984d133a
commit 2fb90cb5d4
6 changed files with 23 additions and 14 deletions

View File

@ -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}\""

View File

@ -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
}

View File

@ -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
}
}

View File

@ -9,7 +9,7 @@ interface ApiService {
/**
* 获取推广包配置
*/
@GET("pkg/{path}")
@GET("pkg/{path}/config")
fun getPkgConfig(@Path("path") config: String): Single<PkgConfigEntity>
}

View File

@ -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,

View File

@ -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