Compare commits
6 Commits
dev
...
GHZSCY-649
| Author | SHA1 | Date | |
|---|---|---|---|
| 1c22c515d9 | |||
| 0d64cfe4c8 | |||
| 8efb57dac8 | |||
| 2e12341b65 | |||
| cb33e9e39e | |||
| a8738887b1 |
@ -107,7 +107,6 @@ android {
|
||||
buildConfigField "String", "WEIBO_APPKEY", "\"${WEIBO_APPKEY}\""
|
||||
// 一体包的32位畅玩游戏助手包名
|
||||
buildConfigField "String", "EXT_PACKAGE_NAME", "\"${rootProject.ext.EXT_PACKAGE_NAME}\""
|
||||
buildConfigField "String", "VA_VERSION_NAME", "\"${rootProject.ext.VA_VERSION}\""
|
||||
}
|
||||
|
||||
// gradle 2.2以上默认同时启用v1和v2(优先用于Android N)
|
||||
@ -218,6 +217,9 @@ android {
|
||||
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${DEV_QUICK_LOGIN_APPKEY}\""
|
||||
buildConfigField "String", "DEV_CSJ_APPID", "\"${DEV_CSJ_APPID}\""
|
||||
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
|
||||
buildConfigField "String", "VA_VERSION_NAME", "\"${rootProject.ext.VA_VERSION}-debug\""
|
||||
manifestPlaceholders.put("VA_VERSION_NAME", "${rootProject.ext.VA_VERSION}-debug")
|
||||
}
|
||||
|
||||
// publish, 发布时候使用的 flavor,接口仅包含正式环境
|
||||
@ -231,6 +233,9 @@ android {
|
||||
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${QUICK_LOGIN_APPKEY}\""
|
||||
buildConfigField "String", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
|
||||
buildConfigField "String", "VA_VERSION_NAME", "\"${rootProject.ext.VA_VERSION}\""
|
||||
manifestPlaceholders.put("VA_VERSION_NAME", "${rootProject.ext.VA_VERSION}")
|
||||
}
|
||||
|
||||
tea {
|
||||
@ -244,7 +249,10 @@ android {
|
||||
buildConfigField "String", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
|
||||
buildConfigField "String", "VA_VERSION_NAME", "\"${rootProject.ext.VA_VERSION}\""
|
||||
|
||||
manifestPlaceholders.put("APPLOG_SCHEME", "rangersapplog.byAx6uYt".toLowerCase())
|
||||
manifestPlaceholders.put("VA_VERSION_NAME", "${rootProject.ext.VA_VERSION}")
|
||||
}
|
||||
|
||||
kuaishou {
|
||||
@ -257,6 +265,9 @@ android {
|
||||
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${QUICK_LOGIN_APPKEY}\""
|
||||
buildConfigField "String", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
|
||||
buildConfigField "String", "VA_VERSION_NAME", "\"${rootProject.ext.VA_VERSION}\""
|
||||
manifestPlaceholders.put("VA_VERSION_NAME", "${rootProject.ext.VA_VERSION}")
|
||||
}
|
||||
|
||||
gdt {
|
||||
@ -269,6 +280,9 @@ android {
|
||||
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${QUICK_LOGIN_APPKEY}\""
|
||||
buildConfigField "String", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
|
||||
buildConfigField "String", "VA_VERSION_NAME", "\"${rootProject.ext.VA_VERSION}\""
|
||||
manifestPlaceholders.put("VA_VERSION_NAME", "${rootProject.ext.VA_VERSION}")
|
||||
}
|
||||
|
||||
sm {
|
||||
@ -281,6 +295,9 @@ android {
|
||||
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${QUICK_LOGIN_APPKEY}\""
|
||||
buildConfigField "String", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
|
||||
buildConfigField "String", "VA_VERSION_NAME", "\"${rootProject.ext.VA_VERSION}\""
|
||||
manifestPlaceholders.put("VA_VERSION_NAME", "${rootProject.ext.VA_VERSION}")
|
||||
}
|
||||
|
||||
// 港澳台
|
||||
@ -371,7 +388,7 @@ dependencies {
|
||||
|
||||
implementation "com.lg:easyfloat:${easyFloat}"
|
||||
|
||||
implementation ("com.lg:apksig:${apksig}") {
|
||||
implementation("com.lg:apksig:${apksig}") {
|
||||
exclude group: 'com.google.protobuf'
|
||||
}
|
||||
|
||||
@ -387,7 +404,7 @@ dependencies {
|
||||
implementation project(':vspace-bridge:vspace')
|
||||
implementation(project(':feature:xapk-installer'))
|
||||
|
||||
implementation (project(':module_common')) {
|
||||
implementation(project(':module_common')) {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
|
||||
@ -464,7 +481,7 @@ dependencies {
|
||||
|
||||
implementation(project(":module_va_api"))
|
||||
implementation(project(":va-archive-common"))
|
||||
if(!gradle.ext.excludeOptionalModules || gradle.ext.enableVa) {
|
||||
if (!gradle.ext.excludeOptionalModules || gradle.ext.enableVa) {
|
||||
implementation(project(":module_va_impl"))
|
||||
}
|
||||
debugImplementation "com.bytedance.tools.codelocator:codelocator-core:2.0.3"
|
||||
|
||||
@ -185,6 +185,8 @@
|
||||
android:name="io.sentry.breadcrumbs.system-events"
|
||||
android:value="false" />
|
||||
|
||||
<meta-data android:name="module_version" android:value="${VA_VERSION_NAME}" />
|
||||
|
||||
<service android:name="com.gh.ndownload.NDownloadService" />
|
||||
|
||||
<activity
|
||||
|
||||
@ -7,7 +7,7 @@ class DownloadChainBuilder {
|
||||
private var processEndCallback: ((asVGame: Boolean, Any?) -> Unit)? = null
|
||||
|
||||
fun setProcessEndCallback(callback: (asVGame: Boolean, Any?) -> Unit): DownloadChainBuilder {
|
||||
processEndCallback = callback
|
||||
processEndCallback = VaPluginDownloadWrapper(callback) // 其他需要添加行为的装饰者可以一直包装A(B(C(callback))), 执行顺序 A->B->C->callback
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
package com.gh.common.chain
|
||||
|
||||
import com.gh.vspace.VHelper
|
||||
|
||||
class VaPluginDownloadWrapper(val callback: (Boolean, Any?) -> Unit) : (Boolean, Any?) -> Unit {
|
||||
override fun invoke(asVGame: Boolean, any: Any?) {
|
||||
callback.invoke(asVGame, any)
|
||||
if (asVGame) {
|
||||
VHelper.initVaPlugin()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7,6 +7,7 @@ import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.gh.common.util.PackageHelper;
|
||||
@ -46,6 +47,7 @@ import org.json.JSONObject;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.functions.Function;
|
||||
@ -78,10 +80,10 @@ public class Config {
|
||||
private static NewApiSettingsEntity.NightMode mNightModeSetting;
|
||||
private static SimulatorEntity mNewSimulatorEntity;
|
||||
private static VSetting mVSetting;
|
||||
private static VNewSetting mVNewSetting;
|
||||
private volatile static VNewSetting mVNewSetting;
|
||||
|
||||
private static AppEntity mNew32UpdateEntity;
|
||||
public static BehaviorSubject<VNewSetting> vNewSettingSubject = BehaviorSubject.create();
|
||||
private static BehaviorSubject<VNewSetting> vNewSettingSubject = BehaviorSubject.create();
|
||||
private static GameGuidePopupEntity mGameGuidePopupEntity;
|
||||
private static SharedPreferences mDefaultSharedPreferences;
|
||||
|
||||
@ -212,6 +214,16 @@ public class Config {
|
||||
return mVNewSetting;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static Observable<VNewSetting> getVNewSettingObservable() {
|
||||
if (mVNewSetting != null) {
|
||||
return Observable.just(mVNewSetting);
|
||||
} else {
|
||||
return vNewSettingSubject.hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
public static AppEntity getNew32UpdateEntity() {
|
||||
return mNew32UpdateEntity;
|
||||
|
||||
@ -10,6 +10,7 @@ import android.database.sqlite.SQLiteFullException
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
@ -85,13 +86,14 @@ import com.lightgame.utils.Utils
|
||||
import com.lightgame.view.CheckableLinearLayout
|
||||
import io.reactivex.Completable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.regex.Pattern
|
||||
|
||||
|
||||
object VHelper {
|
||||
@ -900,7 +902,10 @@ object VHelper {
|
||||
Utils.log(LOG_TAG, "尝试安装新游戏 ${downloadEntity.path}")
|
||||
// 如果一个游戏存在旧版畅玩助手内,此次安装就是游戏更新
|
||||
val isLegacyGame = isLegacyInstalled(downloadEntity.packageName)
|
||||
Utils.log(LOG_TAG, "${downloadEntity.packageName} ${if (isLegacyGame) "是旧畅玩助手的游戏" else "是新畅玩组件的游戏"}")
|
||||
Utils.log(
|
||||
LOG_TAG,
|
||||
"${downloadEntity.packageName} ${if (isLegacyGame) "是旧畅玩助手的游戏" else "是新畅玩组件的游戏"}"
|
||||
)
|
||||
// 更新此包名对应的 gameId Map
|
||||
mTempPackageNameAndGameIdMap[downloadEntity.packageName] = downloadEntity.gameId
|
||||
|
||||
@ -1397,9 +1402,18 @@ object VHelper {
|
||||
VirtualAppManager.AIDL_SERVER_REMOTE_GUIDE_ACTIVITY
|
||||
)
|
||||
)
|
||||
Config.getVNewSettingEntity()?.vaPlugin?.let {
|
||||
intent.putExtra("pluginId", it.id)
|
||||
intent.putExtra("pluginVersionName", it.versionName)
|
||||
if (va.getPluginVersion().isEmpty()) {
|
||||
val url = va.getDefaultPluginUrl()
|
||||
if (url.isEmpty()) {
|
||||
throw IllegalStateException("插件是必须配置的参数,请检查是否配置正确")
|
||||
}
|
||||
// 传递默认的插件信息
|
||||
intent.putExtra("pluginUrl", url)
|
||||
} else {
|
||||
Config.getVNewSettingEntity()?.vaPlugin?.let {
|
||||
intent.putExtra("pluginId", it.id)
|
||||
intent.putExtra("pluginVersionName", it.versionName)
|
||||
}
|
||||
}
|
||||
intent.putExtra(
|
||||
KEY_LAUNCH_COUNT,
|
||||
@ -1453,7 +1467,7 @@ object VHelper {
|
||||
// 最近在玩
|
||||
from = PAGE_SOURCE_RECENTLY_PLAYING
|
||||
launchLocation = null
|
||||
} else if(launchLocation == LAUNCH_LOCATION_FLOATING_WINDOW) {
|
||||
} else if (launchLocation == LAUNCH_LOCATION_FLOATING_WINDOW) {
|
||||
from = PAGE_SOURCE_FLOATING_WINDOW
|
||||
launchLocation = null
|
||||
} else {
|
||||
@ -1484,30 +1498,37 @@ object VHelper {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
is VDownloadManagerActivity -> {
|
||||
// 畅玩管理
|
||||
from = PAGE_SOURCE_CW_MANAGER
|
||||
}
|
||||
|
||||
is MyGameActivity -> {
|
||||
// 我的游戏
|
||||
from = PAGE_SOURCE_MY_GAME
|
||||
}
|
||||
|
||||
is GameDetailActivity -> {
|
||||
// 游戏详情
|
||||
from = PAGE_SOURCE_GAME_DETAIL
|
||||
}
|
||||
|
||||
is SearchActivity -> {
|
||||
// 搜索
|
||||
from = PAGE_SOURCE_SEARCH
|
||||
}
|
||||
|
||||
is ColumnCollectionDetailActivity -> {
|
||||
//非首页的排行榜
|
||||
from = PAGE_SOURCE_RANK
|
||||
}
|
||||
|
||||
is SubjectActivity -> {
|
||||
// 专题
|
||||
from = PAGE_SOURCE_TOPIC
|
||||
}
|
||||
|
||||
is GameCollectionDetailActivity,
|
||||
is ToolbarWrapperActivity,
|
||||
is BlockActivity,
|
||||
@ -2209,23 +2230,7 @@ object VHelper {
|
||||
return sortedEntityList.take(8)
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun preparePluginUpdate() {
|
||||
Config.vNewSettingSubject.debounce(2, TimeUnit.SECONDS).doOnNext {
|
||||
it?.vaPlugin?.let { vaPlugin ->
|
||||
if (!vaPlugin.id.isNullOrEmpty()) {
|
||||
if (!vaPlugin.url64.isNullOrEmpty()) {
|
||||
downloadPlugin(id = "${vaPlugin.id}64", url = vaPlugin.url64)
|
||||
}
|
||||
if (!vaPlugin.url32.isNullOrEmpty()) {
|
||||
downloadPlugin(id = "${vaPlugin.id}32", url = vaPlugin.url32)
|
||||
}
|
||||
}
|
||||
}
|
||||
}.subscribeOn(Schedulers.io()).subscribe({}, {})
|
||||
}
|
||||
|
||||
private fun downloadPlugin(id: String, url: String) {
|
||||
private fun downloadPlugin(id: String, url: String, pluginVersion: String) {
|
||||
val pluginFileName = va.getPluginUpdateFileName(id)
|
||||
val currentPluginFile = File(HaloApp.getInstance().cacheDir, pluginFileName)
|
||||
if (currentPluginFile.exists() && va.isZipFile(currentPluginFile)) {
|
||||
@ -2235,6 +2240,41 @@ object VHelper {
|
||||
if (currentDownloadEntity != null) {
|
||||
SimpleDownloadManager.cancel(id)
|
||||
}
|
||||
val cwBaseLogParams = va.getCwBaseLogParams(
|
||||
gid = HaloApp.getInstance().gid,
|
||||
oaid = HaloApp.getInstance().oaid,
|
||||
hostVersion = com.gh.gamecenter.BuildConfig.VERSION_NAME,
|
||||
hostChannel = HaloApp.getInstance().channel
|
||||
)
|
||||
DownloadMessageHandler.registerListener(id, object : DownloadListener {
|
||||
override fun onError(error: DownloadError) {
|
||||
DownloadMessageHandler.unregisterListener(id, this)
|
||||
}
|
||||
|
||||
override fun onProgress(progress: Float) {
|
||||
}
|
||||
|
||||
override fun onSizeReceived(fileSize: Long) {
|
||||
}
|
||||
|
||||
override fun onStatusChanged(status: DownloadStatus) {
|
||||
if (status == DownloadStatus.COMPLETED) {
|
||||
DownloadMessageHandler.unregisterListener(id, this)
|
||||
va.logBeforeGameLaunch(
|
||||
mutableMapOf<String, String>().apply {
|
||||
put(KEY_EVENT, "va_download_complete")
|
||||
put("target_va_version", pluginVersion)
|
||||
putAll(cwBaseLogParams)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSpeedChanged(speed: Float) {
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
SimpleDownloadManager.download(
|
||||
DownloadConfigBuilder()
|
||||
.setUniqueId(id)
|
||||
@ -2247,31 +2287,19 @@ object VHelper {
|
||||
.setDownloadExecutor(AppExecutor.ioExecutor)
|
||||
.build()
|
||||
)
|
||||
DownloadMessageHandler.registerListener(id, object : DownloadListener {
|
||||
override fun onError(error: DownloadError) {
|
||||
va.logBeforeGameLaunch(
|
||||
mutableMapOf<String, String>().apply {
|
||||
put(KEY_EVENT, "va_download")
|
||||
put("target_va_version", pluginVersion)
|
||||
putAll(cwBaseLogParams)
|
||||
}
|
||||
|
||||
override fun onProgress(progress: Float) {
|
||||
}
|
||||
|
||||
override fun onSizeReceived(fileSize: Long) {
|
||||
}
|
||||
|
||||
override fun onStatusChanged(status: DownloadStatus) {
|
||||
if (status == DownloadStatus.COMPLETED) {
|
||||
DownloadMessageHandler.unregisterListener(id, this)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSpeedChanged(speed: Float) {
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun updateAuthorizeInfo(isLogin: Boolean) {
|
||||
if(!isVGameOn()) return
|
||||
if (!isVGameOn()) return
|
||||
runOnIoThread {
|
||||
if (isLogin) {
|
||||
val token = UserManager.getInstance().token
|
||||
@ -2303,4 +2331,67 @@ object VHelper {
|
||||
launchLocation = PAGE_SOURCE_SHORTCUT
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始下载畅玩游戏时初始化Va插件
|
||||
*/
|
||||
fun initVaPlugin() {
|
||||
Config.getVNewSettingObservable()
|
||||
.take(1)
|
||||
.observeOn(Schedulers.io())
|
||||
.subscribe(object : io.reactivex.Observer<VNewSetting> {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
}
|
||||
|
||||
override fun onNext(vNewSetting: VNewSetting) {
|
||||
val pluginVersion64 = va.getPluginVersion()
|
||||
val onlinePluginVersionName = vNewSetting.vaPlugin?.versionName ?: ""
|
||||
val defaultPluginUrl = va.getDefaultPluginUrl()
|
||||
|
||||
if (pluginVersion64.isEmpty() && onlinePluginVersionName.isEmpty()) {
|
||||
// 不存在64位插件 并且 接口没有获取到插件信息
|
||||
if (defaultPluginUrl.isNotEmpty()) {
|
||||
// 下载默认的插件
|
||||
downloadPlugin(
|
||||
id = MD5Utils.getUrlMD5(defaultPluginUrl),
|
||||
url = defaultPluginUrl,
|
||||
pluginVersion = getPluginVersionInUrl(defaultPluginUrl)
|
||||
)
|
||||
}
|
||||
}
|
||||
vNewSetting.vaPlugin?.let { vaPlugin ->
|
||||
if (!vaPlugin.id.isNullOrEmpty()) {
|
||||
if (!vaPlugin.url64.isNullOrEmpty()) {
|
||||
downloadPlugin(
|
||||
id = "${vaPlugin.id}64",
|
||||
url = vaPlugin.url64,
|
||||
pluginVersion = vaPlugin.versionName ?: ""
|
||||
)
|
||||
}
|
||||
if (!vaPlugin.url32.isNullOrEmpty()) {
|
||||
downloadPlugin(
|
||||
id = "${vaPlugin.id}32",
|
||||
url = vaPlugin.url32,
|
||||
pluginVersion = vaPlugin.versionName ?: ""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
}
|
||||
|
||||
override fun onComplete() {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun getPluginVersionInUrl(url: String): String {
|
||||
val matcher = Pattern.compile("\\d+\\.\\d+\\.\\d+").matcher(url)
|
||||
while (matcher.find()) {
|
||||
return matcher.group()
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
}
|
||||
@ -556,7 +556,6 @@ public class HaloApp extends MultiDexApplication {
|
||||
LoadedApkHuaWei.hookHuaWeiVerifier(this);
|
||||
|
||||
DownloadMessageHandler.INSTANCE.init(SimpleDownloadDatabase.getInstance().downloadDao());
|
||||
VHelper.INSTANCE.preparePluginUpdate();
|
||||
|
||||
// 初始化 WebView ABI 列表
|
||||
getWebviewAbiList();
|
||||
|
||||
@ -82,7 +82,8 @@ class VCore : IVa {
|
||||
|
||||
override fun getUriAuthorizationString(): String = ""
|
||||
|
||||
override fun getAuthContentValue(token: String, userName: String?, userAvatar: String?): ContentValues = ContentValues()
|
||||
override fun getAuthContentValue(token: String, userName: String?, userAvatar: String?): ContentValues =
|
||||
ContentValues()
|
||||
|
||||
override fun logBeforeGameLaunch(kv: Map<String, String>) {
|
||||
}
|
||||
@ -90,6 +91,8 @@ class VCore : IVa {
|
||||
override fun getPluginUpdateFileName(id: String): String = ""
|
||||
|
||||
override fun isZipFile(file: File): Boolean = false
|
||||
override fun getDefaultPluginUrl(): String = ""
|
||||
|
||||
override fun init(context: Context?) {
|
||||
}
|
||||
|
||||
|
||||
@ -82,4 +82,5 @@ interface IVa : IProvider {
|
||||
|
||||
fun isZipFile(file: File): Boolean
|
||||
|
||||
fun getDefaultPluginUrl(): String
|
||||
}
|
||||
@ -6,6 +6,8 @@ plugins {
|
||||
}
|
||||
|
||||
android {
|
||||
// 在 DEFAULT_PLUGIN_URL 中提取插件版本号
|
||||
def va_plugin_version = "1.0.2"
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
|
||||
defaultConfig {
|
||||
@ -13,6 +15,10 @@ android {
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode rootProject.ext.versionCode
|
||||
versionName rootProject.ext.versionName
|
||||
|
||||
|
||||
buildConfigField "String", "DEFAULT_PLUGIN_URL", "\"https://app-static.796697.com/va/plugin/2024/06/28/1.0.2_64_1719568380648.zip\""
|
||||
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
@ -45,10 +51,29 @@ android {
|
||||
productFlavors {
|
||||
internal {
|
||||
dimension "env"
|
||||
manifestPlaceholders.put("VA_PLUGIN_VERSION", va_plugin_version)
|
||||
}
|
||||
publish {
|
||||
dimension "env"
|
||||
manifestPlaceholders.put("VA_PLUGIN_VERSION", va_plugin_version)
|
||||
}
|
||||
tea {
|
||||
dimension "env"
|
||||
manifestPlaceholders.put("VA_PLUGIN_VERSION", va_plugin_version)
|
||||
}
|
||||
kuaishou {
|
||||
dimension "env"
|
||||
manifestPlaceholders.put("VA_PLUGIN_VERSION", va_plugin_version)
|
||||
}
|
||||
gdt {
|
||||
dimension "env"
|
||||
manifestPlaceholders.put("VA_PLUGIN_VERSION", va_plugin_version)
|
||||
}
|
||||
sm {
|
||||
dimension "env"
|
||||
manifestPlaceholders.put("VA_PLUGIN_VERSION", va_plugin_version)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -5,4 +5,8 @@
|
||||
|
||||
<uses-sdk tools:overrideLibrary="com.lg.vspace" />
|
||||
|
||||
<application>
|
||||
<meta-data android:name="va_version" android:value="${VA_PLUGIN_VERSION}" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@ -10,6 +10,7 @@ import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.blankj.utilcode.util.FileUtils
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.exposure.meta.MetaUtil
|
||||
import com.gh.gamecenter.va.impl.BuildConfig
|
||||
import com.gh.gamecenter.va.provider.IVa
|
||||
import com.gh.gamecenter.va.remote.InstalledAppInfo
|
||||
import com.gh.gamecenter.va.remote.VaInstallResult
|
||||
@ -139,7 +140,7 @@ class Va : IVa {
|
||||
ArchiveUtils.checkGameArchiveExists(packageName, archiveConfigJsonStr)
|
||||
}
|
||||
|
||||
override fun getPluginVersion(): String = HostUtils.getPluginVersion()
|
||||
override fun getPluginVersion(): String = HostUtils.getPluginVersion() ?: ""
|
||||
|
||||
override fun getCwBaseLogParams(
|
||||
gid: String,
|
||||
@ -148,7 +149,7 @@ class Va : IVa {
|
||||
hostChannel: String,
|
||||
): Map<String, String> = mapOf(
|
||||
LogConstants.KEY_ANDROID_VERSION to Build.VERSION.RELEASE,
|
||||
LogConstants.KEY_APP_64_VERSION to com.lg.core.BuildConfig.VERSION_NAME,
|
||||
LogConstants.KEY_APP_64_VERSION to com.lg.vspace.BuildConfig.VERSION_NAME,
|
||||
LogConstants.KEY_APP_32_VERSION to "",
|
||||
LogConstants.KEY_VA_VERSION to HostUtils.getPluginVersion(),
|
||||
LogConstants.KEY_ARCHITECTURE to if (ProcessUtils.is64Bit()) "64" else "32",
|
||||
@ -179,6 +180,8 @@ class Va : IVa {
|
||||
override fun getPluginUpdateFileName(id: String): String = PluginHelper.getInstance().getPluginUpdateFileName(id)
|
||||
|
||||
override fun isZipFile(file: File): Boolean = PluginFileUtils.isZipFile(file)
|
||||
override fun getDefaultPluginUrl(): String = BuildConfig.DEFAULT_PLUGIN_URL
|
||||
|
||||
override fun init(context: Context?) {
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,17 @@
|
||||
# @author juntao
|
||||
# @2023.03.06
|
||||
|
||||
git_sha=`git rev-parse --short HEAD`
|
||||
git fetch --tags -f
|
||||
git_sha=$(git rev-parse --short HEAD)
|
||||
currentTag=$(git describe --tags --exact-match "$git_sha")
|
||||
echo "获取当前tag结果:$currentTag"
|
||||
if [[ $currentTag == *"-test"* ]]; then
|
||||
# 如果获取到tag是有-test后缀的,打的是测试包
|
||||
buildType="debug"
|
||||
else
|
||||
buildType="release"
|
||||
fi
|
||||
|
||||
versionName=$(awk -v FS="versionName = " 'NF>1{print $2}' dependencies.gradle | sed "s/\"//g")
|
||||
versionCode=$(awk -v FS="versionCode = " 'NF>1{print $2}' dependencies.gradle | sed "s/\"//g")
|
||||
build_time=$(TZ=Asia/Shanghai date +'%Y-%m%d-%H%M')
|
||||
@ -27,7 +37,7 @@ else
|
||||
sed -i 's/var isTestBuild = true/var isTestBuild = false/g' module_sensors_data/build.gradle
|
||||
fi
|
||||
|
||||
if [[ $MODULE_VERSION == *"debug"* ]]; then
|
||||
if [[ $buildType == "debug" ]]; then
|
||||
build_time_without_divider=$(TZ=Asia/Shanghai date +'%Y%m%d%H%M')L
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
sed -i '' 's/buildConfigField "long", "BUILD_TIME", "0"/buildConfigField "long", "BUILD_TIME", '"\"${build_time_without_divider}\""'/g' module_common/build.gradle
|
||||
@ -39,7 +49,7 @@ fi
|
||||
./gradlew --stop
|
||||
./gradlew clean
|
||||
|
||||
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:,va_version:,va_url:, -- "$@")
|
||||
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:,va_version:, -- "$@")
|
||||
|
||||
eval set -- "$OPTIONS"
|
||||
|
||||
@ -58,30 +68,11 @@ while true; do
|
||||
--sdk_type) sdk_type="$2"; shift 2;;
|
||||
--keypoint_action_reporting) keypoint_action_reporting="$2"; shift 2;;
|
||||
--va_version) va_version="$2"; shift 2;;
|
||||
--va_url) va_url="$2"; shift 2;;
|
||||
--) shift; break;;
|
||||
*) echo "Invalid option: $1" >&2; exit 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
echo "==================== 打包配置的一些变量 ============================="
|
||||
echo "git_sha=$git_sha"
|
||||
echo "versionName=$versionName"
|
||||
echo "versionCode=$versionCode"
|
||||
echo "build_time=$build_time"
|
||||
echo "PACKAGE_NAME=$PACKAGE_NAME"
|
||||
echo "MODULE_VERSION=$MODULE_VERSION 这个是va组件版本号"
|
||||
echo "va_version=$va_version 这个是va插件版本"
|
||||
echo "cwd=$cwd"
|
||||
echo "=================================================================="
|
||||
|
||||
|
||||
if [ "${va_url}" != "" ]; then
|
||||
echo "======================== 下载插件 =================================="
|
||||
curl -o app/src/main/assets/artifacts.zip "$va_url"
|
||||
echo "=================================================================="
|
||||
fi
|
||||
mkdir -p $output
|
||||
|
||||
function updateChannelIfNeeded {
|
||||
@ -177,9 +168,9 @@ if [ "${sdk_platform}" != "" ]; then
|
||||
updateChannelIfNeeded "${output}/${apk_release_path}"
|
||||
|
||||
else
|
||||
apk_release_path="${output}/${PACKAGE_NAME}_${versionName}_${versionCode}_${MODULE_VERSION}_${va_version}_${unix_timestamp}.apk"
|
||||
apk_release_path="${output}/${PACKAGE_NAME}_${versionName}_${versionCode}_${MODULE_VERSION}_${va_version}_${unix_timestamp}_${buildType}.apk"
|
||||
|
||||
if [[ $MODULE_VERSION == *"debug"* ]]; then
|
||||
if [[ $buildType == "debug" ]]; then
|
||||
./gradlew :app:assembleInternalCnRelease -I init.gradle
|
||||
cp -R app/build/outputs/apk/internalCn/release/app-internal-cn-release.apk "${apk_release_path}"
|
||||
else
|
||||
|
||||
2
vasdk
2
vasdk
Submodule vasdk updated: e64cec2695...6a7e208358
Reference in New Issue
Block a user