feat: 【光环助手】QQ小游戏支付唤起问题 https://jira.shanqu.cc/browse/GHZSCY-5385

This commit is contained in:
曾祥俊
2024-05-22 11:02:38 +08:00
parent 2a596bd2a0
commit 65feed01f4
19 changed files with 141 additions and 179 deletions

View File

@ -32,5 +32,6 @@ class BuildConfigImpl : IBuildConfigProvider {
override fun getVApiHost(): String = BuildConfig.VAPI_HOST
override fun getVDevApiHost(): String = BuildConfig.DEV_VAPI_HOST
override fun getLogProducerProject(): String = BuildConfig.LOG_HUB_PROJECT
}

View File

@ -1988,7 +1988,7 @@ object DirectUtils {
val qGameProvider = ARouter
.getInstance()
.build(RouteConsts.provider.qGame)
.navigation() as IQGameProvider<*>
.navigation() as IQGameProvider
qGameProvider.setLoginInfo(activity, userId, userName, userToken)
qGameProvider.launchGame(activity, qqGameId) { _, _ ->
RetrofitManager

View File

@ -1,21 +1,16 @@
package com.gh.gamecenter.qgame
import android.app.Application
import android.content.Context
import android.text.TextUtils
import androidx.collection.ArrayMap
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.alibaba.android.arouter.launcher.ARouter
import com.gh.common.constant.Config
import com.gh.common.filter.RegionSettingHelper
import com.gh.common.util.GameSubstituteRepositoryHelper
import com.gh.common.util.GameUtils
import com.gh.gamecenter.common.baselist.LoadStatus
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.core.provider.IQGameProvider
import com.gh.gamecenter.core.utils.RandomUtils
import com.gh.gamecenter.entity.SubjectEntity
import com.gh.gamecenter.entity.SubjectRecommendEntity
@ -53,7 +48,6 @@ class QGameViewModel(application: Application, blockData: SubjectRecommendEntity
private var mIsLoading = false
init {
initQQMiniGameSDK(application)
initData()
EventBus.getDefault().register(this)// 为了减少对原有逻辑的影响把EventBus注册在这里
}
@ -557,21 +551,6 @@ class QGameViewModel(application: Application, blockData: SubjectRecommendEntity
companion object {
private var isQQMiniSDKInit = false
/**
* QQ小游戏SDK初始化
*/
private fun initQQMiniGameSDK(context: Context) {
if (isQQMiniSDKInit) return
val provider = ARouter
.getInstance()
.build(RouteConsts.provider.qGame)
.navigation() as IQGameProvider<*>
provider.init(context, Config.WECHAT_APPID, Config.TENCENT_APPID)
isQQMiniSDKInit = true
}
fun notifyQGameSubjectUpdate() {
EventBus.getDefault().post(QGameSubjectUpdateEvent())
}

View File

@ -62,6 +62,7 @@ import com.gh.gamecenter.core.AppExecutor;
import com.gh.gamecenter.core.iinterface.IApplication;
import com.gh.gamecenter.core.provider.IFlavorProvider;
import com.gh.gamecenter.core.provider.IPushProvider;
import com.gh.gamecenter.core.provider.IQGameProvider;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.gamecenter.core.utils.SPUtils;
@ -347,6 +348,17 @@ public class HaloApp extends MultiDexApplication {
MainWrapperRepository.Companion.getInstance().getDataUnion();
// QQ小游戏开放互联初始化
IQGameProvider provider = (IQGameProvider) ARouter
.getInstance()
.build(RouteConsts.provider.qGame)
.navigation();
provider.initOpenSdkLogin(
this,
com.gh.common.constant.Config.WECHAT_APPID,
com.gh.common.constant.Config.TENCENT_APPID
);
AppExecutor.getUiExecutor().executeWithDelay(() -> {
FixedRateJobHelper.begin();