Compare commits

..

21 Commits

Author SHA1 Message Date
5d645d408b feat:社区推荐信息流改版&新增图文内容类型—客户端 https://jira.shanqu.cc/browse/GHZSCY-6136 2024-10-24 16:54:20 +08:00
880c7df2ce feat:社区推荐信息流改版&新增图文内容类型—客户端 https://jira.shanqu.cc/browse/GHZSCY-6136 2024-10-22 17:40:10 +08:00
8cf8207d5b feat:社区推荐信息流改版&新增图文内容类型—客户端 https://jira.shanqu.cc/browse/GHZSCY-6136 2024-10-21 18:15:24 +08:00
2ce6b1665d feat:社区推荐信息流改版&新增图文内容类型—客户端 https://jira.shanqu.cc/browse/GHZSCY-6136 2024-10-17 17:01:36 +08:00
ba70162638 feat:社区推荐信息流改版&新增图文内容类型—客户端 https://jira.shanqu.cc/browse/GHZSCY-6136 2024-10-17 16:04:21 +08:00
a3d1b1a262 feat:社区推荐信息流改版&新增图文内容类型—客户端 https://jira.shanqu.cc/browse/GHZSCY-6136 2024-10-17 11:17:34 +08:00
ebcb68fb7e feat:https://jira.shanqu.cc/browse/GHZSCY-6136 https://jira.shanqu.cc/browse/GHZSCY-6136 2024-10-17 09:55:02 +08:00
1f1bf4f9ee feat:社区推荐信息流改版&新增图文内容类型—客户端 https://jira.shanqu.cc/browse/GHZSCY-6136 2024-10-15 15:59:41 +08:00
9de1ef1f99 fix:GHZSCY-6136 社区推荐信息流改版&新增图文内容类型—客户端 2024-10-15 15:59:41 +08:00
b5bfce7a60 社区相关埋点 2024-10-15 15:59:41 +08:00
49e77f7464 feat:社区推荐信息流改版&新增图文内容类型—客户端 https://jira.shanqu.cc/browse/GHZSCY-6136 2024-10-15 15:59:41 +08:00
e3056ec6a1 feat:社区推荐信息流改版&新增图文内容类型—客户端 https://jira.shanqu.cc/browse/GHZSCY-6136 2024-10-15 15:59:41 +08:00
b06a452b8b feat:社区推荐信息流改版&新增图文内容类型—客户端 https://jira.shanqu.cc/browse/GHZSCY-6136 2024-10-15 15:59:41 +08:00
ae269298e4 fix:社区推荐信息流改版&新增图文内容类型—0912UI测试—客户端 https://jira.shanqu.cc/browse/GHZSCY-6676 2024-10-15 15:59:41 +08:00
bfac3a6684 fix:社区推荐信息流改版&新增图文内容类型—0912UI测试—客户端 https://jira.shanqu.cc/browse/GHZSCY-6676 2024-10-15 15:59:41 +08:00
03921fb64d fix:社区推荐信息流改版&新增图文内容类型—0912UI测试—客户端 https://jira.shanqu.cc/browse/GHZSCY-6676 2024-10-15 15:59:41 +08:00
01603ee8c9 fix:社区推荐信息流改版&新增图文内容类型—0912UI测试—客户端 https://jira.shanqu.cc/browse/GHZSCY-6676 2024-10-15 15:59:41 +08:00
f22033b61f feat:社区推荐信息流改版&新增图文内容类型—客户端 https://jira.shanqu.cc/browse/GHZSCY-6136 2024-10-15 15:59:38 +08:00
8b44d65118 删除没有用到的资源 2024-10-15 15:59:14 +08:00
838caaa5fc feat:社区推荐信息流改版&新增图文内容类型—客户端 https://jira.shanqu.cc/browse/GHZSCY-6136 2024-10-15 15:59:14 +08:00
4c521c75b2 ci 2024-10-15 15:59:14 +08:00
1611 changed files with 35029 additions and 48182 deletions

View File

@ -72,6 +72,7 @@ android_build:
only:
- dev
- release
- feat/GHZSCY-6136
# 代码检查
sonarqube_analysis:
@ -103,6 +104,7 @@ sonarqube_analysis:
only:
- dev
- release
- feat/GHZSCY-6136
## 发送简易检测结果报告
send_sonar_report:
@ -121,6 +123,7 @@ send_sonar_report:
only:
- dev
- release
- feat/GHZSCY-6136
oss-upload&send-email:
tags:
@ -157,4 +160,4 @@ oss-upload&send-email:
only:
- dev
- release
- feat/GHZSCY-6136

View File

@ -2,9 +2,7 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' // kotlin
apply plugin: 'kotlin-parcelize'
apply plugin: 'com.google.devtools.ksp'
apply plugin: 'kotlin-kapt'
apply plugin: 'therouter'
import groovy.xml.XmlUtil
@ -53,10 +51,6 @@ android {
}
}
ksp {
arg("ROUTER_MODULE_NAME", project.getName())
}
defaultConfig {
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
@ -107,13 +101,10 @@ android {
buildConfigField "String", "NEW_API_HOST", "\"${NEW_API_HOST}\""
buildConfigField "String", "LOG_HUB_PROJECT", "\"${LOG_HUB_PROJECT}\""
buildConfigField "String", "VAPI_HOST", "\"${VAPI_HOST}\""
buildConfigField "String", "WGAME_CPM_BUSIAPPID", "\"${WGAME_CPM_BUSIAPPID}\""
buildConfigField "String", "WGAME_CPM_API_HOST", "\"${WGAME_CPM_API_HOST}\""
buildConfigField "String", "WECHAT_APPID", "\"${WECHAT_APPID}\""
buildConfigField "String", "WECHAT_SECRET", "\"${WECHAT_SECRET}\""
buildConfigField "String", "TENCENT_APPID", "\"${TENCENT_APPID}\""
buildConfigField "String", "WEIBO_APPKEY", "\"${WEIBO_APPKEY}\""
buildConfigField "String", "DSP_API_HOST","\"${DSP_API_HOST}\""
// 一体包的32位畅玩游戏助手包名
buildConfigField "String", "EXT_PACKAGE_NAME", "\"${rootProject.ext.EXT_PACKAGE_NAME}\""
}
@ -130,6 +121,12 @@ android {
}
}
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.name)
}
}
packagingOptions {
// exclude 部分冗余的文件
exclude 'META-INF/gradle/incremental.annotation.processors'
@ -154,7 +151,7 @@ android {
zipAlignEnabled false
signingConfig signingConfigs.debug
buildConfigField "String", "EXPOSURE_REPO", "\"exposure\""
buildConfigField "String", "EXPOSURE_REPO", "\"test\""
buildConfigField "String", "EXPOSURE_VERSION", "\"E4\""
multiDexKeepProguard file("tinker_multidexkeep.pro")
@ -198,7 +195,7 @@ android {
java.srcDirs = ['src/main/java', "src/default/java"]
}
internal {
java.srcDirs = ['src/main/java', "src/default/java", "src/internal/java"]
java.srcDirs = ['src/main/java', "src/default/java"]
}
tea {
java.srcDirs = ['src/main/java', 'src/tea/java']
@ -347,7 +344,7 @@ repositories {
android.applicationVariants.configureEach { variant ->
variant.mergeAssets.doLast {
def assetDir = variant.mergeAssetsProvider.get().outputDir.get()
def unwantedAssets = ['1832823466', 'gdt_plugin/gdtadv2.jar']
def unwantedAssets = ['2011394667', 'gdt_plugin/gdtadv2.jar']
unwantedAssets.each { assetPath ->
def file = new File([assetDir, assetPath].join(File.separator))
@ -379,7 +376,7 @@ dependencies {
implementation "androidx.annotation:annotation:${annotation}"
implementation "androidx.viewpager2:viewpager2:${viewpager2}"
ksp("androidx.room:room-compiler:${room}")
kapt "androidx.room:room-compiler:${room}"
implementation "com.tencent.vasdolly:helper:${apkChannelPackage}"
implementation "com.tencent.vasdolly:writer:${apkChannelPackage}"
@ -403,7 +400,7 @@ dependencies {
exclude module: "gsyvideoplayer-androidvideocache"
exclude group: "tv.danmaku.ijk.media"
})
implementation("com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer-exo_player2:$gsyVideo") {
implementation ("com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer-exo_player2:$gsyVideo") {
exclude group: 'com.google.android.exoplayer', module: 'extension-rtmp'
}
@ -429,8 +426,7 @@ dependencies {
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:${desugarJdkLibs}"
kapt "com.google.auto.service:auto-service:${autoServiceVersion}"
ksp "cn.therouter:apt:${routerVersion}"
kapt "com.alibaba:arouter-compiler:$arouterVersion"
implementation project(':ndownload')
implementation project(':vspace-bridge:vspace')
@ -452,9 +448,9 @@ dependencies {
exclude group: 'androidx.swiperefreshlayout'
}
// implementation(project(':module_setting_compose')) {
// exclude group: 'androidx.swiperefreshlayout'
// }
// implementation(project(':module_setting_compose')) {
// exclude group: 'androidx.swiperefreshlayout'
// }
if (!gradle.ext.excludeOptionalModules || gradle.ext.enablePkg) {
implementation(project(':feature:pkg'))
@ -511,10 +507,6 @@ dependencies {
implementation(project(':feature:sentry'))
}
if (gradle.ext.enableRouteDoc) {
ksp project(":feature:route_doc")
}
implementation(project(':feature:media_select'))
implementation(project(":module_va_api"))
@ -527,20 +519,6 @@ dependencies {
debugImplementation 'com.bytedance.android:shadowhook:1.0.9'
debugImplementation 'io.github.shiqos:wytrace:1.0.1'
if (!gradle.ext.excludeOptionalModules || gradle.ext.enableAccelerator) {
implementation(project(":feature:accelerator"))
}
if (!gradle.ext.excludeOptionalModules || gradle.ext.enableAliPay) {
implementation(project(":feature:ali_pay"))
}
if(!gradle.ext.excludeOptionalModules || gradle.ext.enableWechatPay){
implementation(project(":feature:wechat_pay"))
}
implementation "me.xdrop:fuzzywuzzy:${fuzzyVersion}"
}
File propFile = file('sign.properties')

View File

@ -20,7 +20,6 @@
-keep class com.gh.gamecenter.db.info.* {*;}
-keep class com.gh.gamecenter.entity.** {<fields>;}
-keep class com.gh.gamecenter.qa.entity.** {<fields>;}
-keep class com.gh.gamecenter.gamedetail.entity.** {<fields>;}
-keep class com.gh.download.DownloadDataSimpleEntity {<fields>;}
-keep class com.gh.gamecenter.floatingwindow.FloatingWindowEntity {<fields>;}
-keep class com.gh.gamecenter.BR
@ -77,7 +76,6 @@
### TEA
-keep class com.gh.gamecenter.TeaHelper { *; }
-keep class com.bytedance.ads.convert.broadcast.common.EncryptionTools {*;}
### EasyFloat
-keep class com.lzf.easyfloat.* {*;}

Binary file not shown.

View File

@ -3,14 +3,9 @@ package com.gh.vspace.installexternalgames
import android.Manifest
import android.app.Dialog
import android.content.ComponentName
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.os.Environment
import android.provider.Settings
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AlertDialog
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import com.gh.common.util.DialogUtils
@ -42,9 +37,6 @@ class InstallExternalGameFragment : ToolbarFragment(), OnItemClickListener {
private var uninstallDisposable: Disposable? = null
private var shouldScan = false
override fun getLayoutId() = 0
override fun getInflatedLayout() =
@ -82,24 +74,7 @@ class InstallExternalGameFragment : ToolbarFragment(), OnItemClickListener {
adapter.notifyDataSetChanged()
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
if (!Environment.isExternalStorageManager()) {
shouldScan = true
AlertDialog.Builder(requireContext()).setMessage("请在设置页面允许光环助手")
.setNegativeButton("") { dialog, which ->
val intent = Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)
}.show()
} else {
mViewModel.scanPaths()
}
} else {
requestStoragePermission()
}
requestStoragePermission()
}
private fun requestStoragePermission() {
@ -121,12 +96,6 @@ class InstallExternalGameFragment : ToolbarFragment(), OnItemClickListener {
}
}
override fun onStart() {
super.onStart()
if (shouldScan) {
mViewModel.scanPaths()
}
}
private fun initView() {
dialog = DialogUtils.showWaitDialog(requireContext(), "")
@ -183,7 +152,7 @@ class InstallExternalGameFragment : ToolbarFragment(), OnItemClickListener {
}, true)
VHelper.newCwValidateVspaceBeforeAction(
requireContext(), null,
requireContext(),null,
) {
dialog.show()
}

View File

@ -10,9 +10,9 @@
<queries>
<package android:name="com.gh.toolmap" />
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="ghtoolmap" />
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="ghtoolmap"/>
</intent>
</queries>
@ -68,13 +68,6 @@
<!-- 悬浮窗 -->
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<!-- 适配 双开/分身 游戏授权登录 -->
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
<!-- 日历 -->
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-sdk tools:overrideLibrary="
com.shuyu.gsyvideoplayer,
com.shuyu.gsyvideoplayer.lib,
@ -201,9 +194,7 @@
android:name="io.sentry.breadcrumbs.system-events"
android:value="false" />
<meta-data
android:name="module_version"
android:value="${VA_VERSION_NAME}" />
<meta-data android:name="module_version" android:value="${VA_VERSION_NAME}" />
<service android:name="com.gh.ndownload.NDownloadService" />
@ -526,6 +517,10 @@
android:name=".video.data.VideoDataActivity"
android:screenOrientation="portrait" />
<activity
android:name=".video.poster.PosterEditActivity"
android:screenOrientation="portrait" />
<activity
android:name=".forum.detail.ForumDetailActivity"
android:screenOrientation="portrait" />
@ -643,9 +638,8 @@
<!-- android:theme="@android:style/Theme.Translucent" />-->
<activity
android:name="com.gh.gamecenter.SkipCompatActivity"
android:name="com.gh.gamecenter.SkipActivity"
android:exported="true"
android:launchMode="singleTask"
android:theme="@style/Theme.AppCompat.Light.Fullscreen.Transparent">
<intent-filter>
<data android:scheme="ghzhushou" />
@ -669,8 +663,7 @@
android:name=".authorization.AuthorizationActivity"
android:exported="true"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:taskAffinity=".auth">
android:screenOrientation="portrait">
<intent-filter>
<data android:scheme="ghzhushou_authorization" />
<category android:name="android.intent.category.DEFAULT" />
@ -816,20 +809,20 @@
android:screenOrientation="portrait"
android:theme="@style/AppCompatTheme.APP" />
<activity
android:name=".video.poster.PosterEditActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.halo.assistant.accelerator.MyAssetsActivity"
android:screenOrientation="portrait" />
<!-- <activity-->
<!-- android:name="${applicationId}.douyinapi.DouYinEntryActivity"-->
<!-- android:launchMode="singleTask"-->
<!-- android:taskAffinity="${applicationId}"-->
<!-- android:exported="true" />-->
<activity
android:name=".forum.home.recommend.PublishImageArticleActivity"
android:screenOrientation="portrait" />
<activity
android:name=".forum.home.recommend.ImageArticleDetailActivity"
android:screenOrientation="portrait" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}"
@ -879,6 +872,10 @@
<!-- tools:node="remove" />-->
<!-- </provider>-->
<service android:name="com.gh.gamecenter.install.InstallService" />
<service android:name="com.gh.download.suspendwindow.DownloadSuspendWindowService" />
<receiver
android:name="com.gh.gamecenter.receiver.DownloadReceiver"
android:exported="false">

File diff suppressed because one or more lines are too long

View File

@ -588,7 +588,7 @@ document.addEventListener("selectionchange", function(e) {
});
document.addEventListener("selectionchange", function(e) {
setTimeout(() => RE.enabledEditingItems(e), 10)
RE.enabledEditingItems(e)
});
RE.recursion = function(dom) {

View File

@ -4,8 +4,6 @@ import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Animatable
import android.os.Build
import android.os.Message
import android.text.TextUtils
import android.view.View
@ -14,22 +12,20 @@ import android.widget.FrameLayout
import android.widget.TextView
import androidx.appcompat.content.res.AppCompatResources
import androidx.fragment.app.Fragment
import com.therouter.TheRouter
import com.facebook.drawee.controller.BaseControllerListener
import com.alibaba.android.arouter.launcher.ARouter
import com.facebook.drawee.view.SimpleDraweeView
import com.facebook.imagepipeline.image.ImageInfo
import com.gh.common.exposure.ExposureManager
import com.gh.common.util.DirectUtils.directToLinkPage
import com.gh.common.util.LogUtils
import com.gh.common.util.NewFlatLogUtils
import com.gh.common.util.NewFlatLogUtils.logOpenScreenAdSkip
import com.gh.common.util.PackageUtils
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.MainActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.exposure.meta.MetaUtil
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.AppExecutor
@ -44,7 +40,6 @@ import com.gh.gamecenter.feature.exposure.ExposureType
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
import io.reactivex.schedulers.Schedulers
import java.util.Locale
/**
* 广告实现代理类
@ -64,8 +59,6 @@ object AdDelegateHelper {
private val mGameSearchAdList: ArrayList<AdConfig> by lazy { arrayListOf() }
private var mVGameLaunchAd: AdConfig? = null
private var ownerSplashAdLoadTime = 0L
val vGameLaunchAd: AdConfig?
get() = mVGameLaunchAd
@ -83,7 +76,6 @@ object AdDelegateHelper {
}
var isShowingSplashAd = false // 是否正在显示开屏广告
var isOwnerSplashAdShown = false // 自有开屏广告是否展示
var gameSearchKeyword = ""
fun initAdSdk(context: Context) {
@ -102,7 +94,8 @@ object AdDelegateHelper {
private fun initAdSdkInternal(context: Context) {
// 初始化穿山甲
if (mCsjAdImpl == null) {
mCsjAdImpl = TheRouter.get(ICsjAdProvider::class.java)
mCsjAdImpl =
ARouter.getInstance().build(RouteConsts.provider.csjAd).navigation() as? ICsjAdProvider
val csjAppId = if (EnvHelper.isDevEnv) BuildConfig.DEV_CSJ_APPID else BuildConfig.CSJ_APPID
mCsjAdImpl?.initSDK(context, csjAppId, HaloApp.getInstance().oaid)
// 监听亮色/暗色模式切换
@ -122,12 +115,7 @@ object AdDelegateHelper {
if (isFromRetry && mAdConfigList.isNotEmpty()) {
return
}
val paramsMap = if (keyword.isNotEmpty()) {
mapOf("keyword" to keyword, "android_sdk_version" to Build.VERSION.SDK_INT)
} else {
mapOf("android_sdk_version" to Build.VERSION.SDK_INT)
}
val paramsMap = if (keyword.isNotEmpty()) mapOf("keyword" to keyword) else mapOf()
RetrofitManager.getInstance()
.newApi
.getAdConfig(paramsMap)
@ -185,20 +173,6 @@ object AdDelegateHelper {
when (config.location) {
"halo_launch" -> {
config.ownerAd?.startAd?.let { it.id = config.ownerAd.id }
// HarmonyOS 2.2.0 版本不展示第三方开屏广告 (因为会引起奇怪的闪退)
if (MetaUtil.getRom().name == "HarmonyOS"
&& MetaUtil.getRom().versionName == "2.2.0"
&& config.displayRule.adSource == AD_TYPE_SDK) {
return
}
// 华为系 Android 10 不展示第三方开屏广告 (因为会引起奇怪的闪退)
if (isBuggyHuaweiDevice() && config.displayRule.adSource == AD_TYPE_SDK) {
return
}
mSplashAd = config
}
@ -227,7 +201,6 @@ object AdDelegateHelper {
private fun shouldShowStartUpAdWhenHotLaunch() = (mCsjAdImpl != null)
&& mSplashAd?.displayRule?.hotStartSplashAd?.type == AD_TYPE_SDK
&& mSplashAd?.hotStartThirdPartyAd != null
&& !isBuggyHuaweiDevice()
/**
* 是否需要显示下载管理广告
@ -330,7 +303,6 @@ object AdDelegateHelper {
) {
val hideCallback = {
isShowingSplashAd = false
isOwnerSplashAdShown = false
hideAction.invoke()
}
if (mSplashAd != null) {
@ -603,8 +575,6 @@ object AdDelegateHelper {
handler: BaseActivity.BaseHandler,
hideCallback: () -> Unit
) {
isOwnerSplashAdShown = false
val jumpBtn = startAdContainer.findViewById<TextView>(R.id.jumpBtn)
val jumpDetailBtn: TextView = startAdContainer.findViewById(R.id.jumpDetailBtn)
val adImage: SimpleDraweeView = startAdContainer.findViewById(R.id.adImage)
@ -622,63 +592,39 @@ object AdDelegateHelper {
), null, null
)
adImage.visibleIf(true)
ImageUtils.display(adImage, ad.img)
if (ad.isImageType) {
adVideo.visibleIf(false)
adImage.visibleIf(true)
ImageUtils.displayWithCallback(adImage, ad.img, true, object : BaseControllerListener<ImageInfo>() {
override fun onSubmit(id: String?, callerContext: Any?) {
super.onSubmit(id, callerContext)
adImage.post {
ownerSplashAdLoadTime = System.currentTimeMillis()
NewFlatLogUtils.logSplashAdLoad(ad.id)
}
}
override fun onFinalImageSet(id: String?, imageInfo: ImageInfo?, animatable: Animatable?) {
isOwnerSplashAdShown = true
adImage.post {
NewFlatLogUtils.logSplashAdShow(ad.id, System.currentTimeMillis() - ownerSplashAdLoadTime)
}
}
override fun onFailure(id: String?, throwable: Throwable?) {
super.onFailure(id, throwable)
NewFlatLogUtils.logSplashAdFail(ad.id, "启动广告图加载失败")
}
})
} else {
adImage.visibleIf(false)
adVideo.visibleIf(true)
adVideo.startPlay(ad.video.url)
}
startAdContainer.setOnClickListener {
// 拦截点击事件传递
}
jumpBtn.setOnClickListener {
it.debounceActionWithInterval(1000L) {
if (!isOwnerSplashAdShown) {
NewFlatLogUtils.logSplashAdFail(ad.id, "加载过程中点击跳过广告")
}
handler.removeMessages(MainActivity.COUNTDOWN_AD)
hideCallback.invoke()
val linkEntity = ad.jump
NewFlatLogUtils.logOpenScreenAdSkip(
ad.id,
(if (linkEntity.text != null) linkEntity.text else "")!!,
(if (linkEntity.type != null) linkEntity.type else "")!!,
(if (linkEntity.link != null) linkEntity.link else "")!!
)
SensorsBridge.trackEvent(
"SplashAdOwnSkip",
"splash_ad_id",
ad.id,
"link_type",
linkEntity.type ?: "",
"link_id",
linkEntity.link ?: "",
"link_text",
linkEntity.text ?: ""
)
}
handler.removeMessages(MainActivity.COUNTDOWN_AD)
hideCallback.invoke()
val linkEntity = ad.jump
logOpenScreenAdSkip(
ad.id,
(if (linkEntity.text != null) linkEntity.text else "")!!,
(if (linkEntity.type != null) linkEntity.type else "")!!,
(if (linkEntity.link != null) linkEntity.link else "")!!
)
SensorsBridge.trackEvent(
"SplashAdOwnSkip",
"splash_ad_id",
ad.id,
"link_type",
linkEntity.type ?: "",
"link_id",
linkEntity.link ?: "",
"link_text",
linkEntity.text ?: ""
)
}
val sources: MutableList<ExposureSource> = ArrayList()
sources.add(ExposureSource("开屏广告", ad.id))
@ -796,16 +742,4 @@ object AdDelegateHelper {
mCsjAdImpl?.cancelSplashAd(context)
}
/**
* 是否为有问题的华为系 Android 10 设备
*/
private fun isBuggyHuaweiDevice(): Boolean {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.Q) {
val manufacturer = Build.MANUFACTURER.lowercase(Locale.CHINA) ?: ""
return manufacturer == "huawei" || manufacturer == "honor"
} else {
return false
}
}
}

View File

@ -19,10 +19,10 @@ import java.net.URLConnection
object AdPluginDownloadHelper : InnerDownloadListener {
private const val CSJ_FILE_NAME = "1832823466"
private const val CSJ_FILE_NAME = "2011394667"
private const val GDT_FILE_NAME = "gdt_plugin/gdtadv2.jar"
private const val CSJ_PLUGIN_URL = "https://and-static.ghzs66.com/android/static/1832823466"
private const val CSJ_PLUGIN_URL = "https://and-static.ghzs66.com/android/static/2011394667"
private const val GDT_PLUGIN_URL = "https://and-static.ghzs66.com/android/static/gdtadv2.jar"
private var csjDownloadedCallback: (() -> Unit)? = null

View File

@ -1,10 +1,13 @@
package com.gh.ad
import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.view.ViewStub
import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.provider.ILaunchAd
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.common.utils.goneIf
@ -12,8 +15,10 @@ import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.entity.AdConfig
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.vaAd, name = "畅玩启动页广告")
class LaunchAdImpl : ILaunchAd {
override fun init(context: Context?) {
}
override fun requestAd(fragment: Fragment, container: ViewGroup, maskView: View, topViewStub: ViewStub, bottomViewStub: ViewStub, adClickAction: () -> Unit): View {
if (AdDelegateHelper.shouldShowHelperLaunchAd()) {
@ -99,4 +104,4 @@ class LaunchAdImpl : ILaunchAd {
companion object {
private const val AD_PLACEMENT = "畅玩启动"
}
}
}

View File

@ -44,16 +44,6 @@ class SplashAdVideoView @JvmOverloads constructor(
return R.layout.layout_splash_ad_video
}
override fun touchSurfaceMoveFullLogic(absDeltaX: Float, absDeltaY: Float) {
// no nothing
}
override fun onPrepared() {
super.onPrepared()
visibility = VISIBLE
}
override fun onAutoCompletion() {
setStateAndUi(CURRENT_STATE_AUTO_COMPLETE);

View File

@ -21,31 +21,26 @@ import com.gh.common.view.RichEditor
import com.gh.gamecenter.CropImageActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.activity.ToolBarActivity
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.entity.LocalVideoEntity
import com.gh.gamecenter.feature.selector.LocalMediaActivity
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.entity.GamesCollectionEntity
import com.gh.gamecenter.entity.MyVideoEntity
import com.gh.gamecenter.entity.VideoEntity
import com.gh.gamecenter.entity.*
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.qa.editor.*
import com.gh.gamecenter.feature.entity.AnswerEntity
import com.gh.gamecenter.feature.entity.ArticleEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.selector.ChooseType
import com.gh.gamecenter.feature.selector.LocalMediaActivity
import com.gh.gamecenter.qa.editor.*
import com.gh.gamecenter.qa.entity.EditorInsertEntity
import com.gh.gamecenter.video.poster.video.VideoPosterFragment
import com.gh.gamecenter.video.poster.PosterEditActivity
import com.gh.gamecenter.video.upload.UploadManager
import com.google.gson.JsonObject
import com.halo.assistant.HaloApp
import com.lightgame.utils.Util_System_Keyboard
import com.lightgame.utils.Utils
import com.lightgame.view.CheckableImageView
import com.therouter.TheRouter
import io.reactivex.disposables.Disposable
import org.json.JSONArray
import org.json.JSONObject
@ -234,7 +229,6 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> constructor(
@SuppressLint("AddJavascriptInterface", "ClickableViewAccessibility")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
VideoPosterFragment.createVideoCoverFile(this)
findView()
onRichClick()
mViewModel = provideViewModel()
@ -745,9 +739,9 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> constructor(
mViewModel.id = id
mViewModel.videoId = videoId
val videoEntity = VideoEntity(url = url)
TheRouter.build(RouteConsts.activity.videoCoverEditActivity)
.withParcelable(EntranceConsts.KEY_VIDEO_ENTITY, videoEntity)
.navigation(this@BaseRichEditorActivity, REQUEST_CODE_IMAGE_CROP)
val intent =
PosterEditActivity.getIntentByVideo(this@BaseRichEditorActivity, videoEntity)
startActivityForResult(intent, REQUEST_CODE_IMAGE_CROP)
}
@JavascriptInterface

View File

@ -2,9 +2,9 @@ package com.gh.base
import android.app.Activity
import android.app.Application
import android.content.res.Configuration
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.alibaba.android.arouter.launcher.ARouter
import com.gh.ad.AdDelegateHelper
import com.gh.common.util.FloatingBackViewManager
import com.gh.common.xapk.XapkInstaller
@ -15,45 +15,27 @@ import com.gh.gamecenter.SplashAdActivity
import com.gh.gamecenter.SplashScreenActivity
import com.gh.gamecenter.authorization.AuthorizationActivity
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.provider.IHelpAndFeedbackProvider
import com.gh.gamecenter.common.utils.PackageFlavorHelper
import com.gh.gamecenter.core.provider.IPushProvider
import com.gh.gamecenter.login.utils.QuickLoginHelper
import com.gh.gamecenter.login.view.LoginActivity
import com.gh.gamecenter.va.VCore
import com.gh.gamecenter.login.utils.QuickLoginHelper
import com.gh.vspace.VHelper
import com.halo.assistant.HaloApp
import com.therouter.TheRouter
// TODO移动到对应的模块
class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
private var isFromBackgroundToForeground = false // 是否后台回到前台
override fun onActivityPreCreated(activity: Activity, savedInstanceState: Bundle?) {
if (QuickLoginHelper.isLoginAuthPage(activity)) {
try {
val resources = activity.resources
val config = Configuration(resources.configuration)
config.fontScale = 1.0f
// 更新Resources配置
val metrics = resources.displayMetrics
metrics.scaledDensity = metrics.density
resources.updateConfiguration(config, metrics)
} catch (e: Exception) {
// 设置字体失败
}
}
}
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
// do nothing
}
override fun onActivityStarted(activity: Activity) {
GlobalActivityManager.currentActivity = activity
GlobalActivityManager.activityCount++
GlobalActivityManager.activityCount ++
if (GlobalActivityManager.activityCount == 1 && isFromBackgroundToForeground) {
if (AdDelegateHelper.shouldShowStartUpAd(true)
&& !HaloApp.getInstance().isDisableSplashAdTemporarily
@ -71,7 +53,7 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
if (GlobalActivityManager.activityCount == 1) {
// 清除桌面角标
if (activity !is SplashScreenActivity && activity !is AuthorizationActivity) {
val pushProvider = TheRouter.get(IPushProvider::class.java)
val pushProvider = ARouter.getInstance().build(RouteConsts.provider.push).navigation() as? IPushProvider
pushProvider?.cleanBadgeNumber(activity.applicationContext)
}
}
@ -129,7 +111,7 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
}
override fun onActivityStopped(activity: Activity) {
GlobalActivityManager.activityCount--
GlobalActivityManager.activityCount --
isFromBackgroundToForeground = GlobalActivityManager.activityCount <= 0
}
@ -144,7 +126,9 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
}
private fun isSuggestionActivity(activity: Activity): Boolean {
val helpAndFeedbackProvider = TheRouter.get(IHelpAndFeedbackProvider::class.java)
val helpAndFeedbackProvider =
ARouter.getInstance().build(RouteConsts.provider.helpAndFeedback)
.navigation() as? IHelpAndFeedbackProvider
return helpAndFeedbackProvider?.isSuggestionActivity(activity) ?: false
}

View File

@ -3,8 +3,6 @@ package com.gh.common
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.os.Handler
import android.os.Looper
import android.util.Base64
import android.view.View
import android.webkit.JavascriptInterface
@ -13,7 +11,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
import com.alibaba.android.arouter.launcher.ARouter
import com.gh.common.exposure.ExposureManager
import com.gh.common.util.*
import com.gh.common.util.LogUtils
@ -21,12 +19,10 @@ import com.gh.download.DownloadManager
import com.gh.download.PackageObserver
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.ImageViewerActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.WebActivity
import com.gh.gamecenter.common.callback.BiCallback
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.Constants.SP_MEMBER_PAYMENT_BUTTON_CLICK
import com.gh.gamecenter.common.constant.Constants.SP_MEMBER_RECHARGE_BUTTON_CLICK
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.entity.NotificationUgc
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.loghub.LoghubUtils
@ -34,23 +30,20 @@ import com.gh.gamecenter.common.provider.IHelpAndFeedbackProvider
import com.gh.gamecenter.common.tracker.Tracker
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.utils.NewFlatLogUtils
import com.gh.gamecenter.common.utils.SensorsBridge.EVENT_MEMBER_RECHARGE_BUTTON_CLICK
import com.gh.gamecenter.common.utils.SensorsBridge.EVENT_NAME
import com.gh.gamecenter.common.utils.SensorsBridge.KEY_IS_FIRST_TIME
import com.gh.gamecenter.common.view.dsbridge.CompletionHandler
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.provider.IAcceleratorProvider
import com.gh.gamecenter.core.provider.IPushProvider
import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.core.runOnUiThread
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.core.utils.CurrentActivityHolder
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.entity.SensorsEvent
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.eventbus.EBPackage
import com.gh.gamecenter.feature.entity.AcctRecordEntity
import com.gh.gamecenter.feature.entity.Badge
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.OrderEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.login.user.LoginTag
import com.gh.gamecenter.login.user.UserManager
@ -62,14 +55,10 @@ import com.gh.gamecenter.personalhome.border.AvatarBorderActivity
import com.gh.gamecenter.setting.SettingBridge
import com.gh.vspace.VHelper
import com.halo.assistant.HaloApp
import com.halo.assistant.accelerator.repository.AccelerationRepository.Companion.PAYMENT_TYPE_ALIPAY
import com.halo.assistant.accelerator.repository.AccelerationRepository.Companion.PAYMENT_TYPE_WECHAT
import com.halo.assistant.accelerator.repository.AcceleratorDataHolder
import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadEntity
import com.lightgame.download.DownloadStatus.*
import com.lightgame.utils.Utils
import com.therouter.TheRouter
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
@ -82,11 +71,10 @@ import java.util.*
class DefaultJsApi(
var context: Context,
val entrance: String = "",
private val mFragment: Fragment? = null,
private var mFragment: Fragment? = null,
private var mBbsId: String? = "",
private var mOriginUrl: String? = "",
private val mForumName: String? = "",
private val listener: OnWebClickListener? = null
) {
companion object {
@ -99,8 +87,6 @@ class DefaultJsApi(
private var mDownloadHandler: CompletionHandler<Any>? = null // 下载信息回调
private var mExposureEvent: ExposureEvent? = null // 活动曝光实体
private val handler = Handler(Looper.getMainLooper())
init {
if (mFragment != null) {
EventBus.getDefault().register(this)
@ -247,12 +233,6 @@ class DefaultJsApi(
VHelper.launch(context, packageName)
}
} else {
val wechatPkgName = "com.tencent.mm"
if (packageName == wechatPkgName && !PackageUtils.isInstalled(context, wechatPkgName)) {
// 如果是微信客户端,需要检查是否安装微信
ToastUtils.showToast(R.string.wechat_app_not_install_tips.toResString())
return@runOnUiThread
}
PackageLauncher.launchApp(context, packageName = packageName)
}
}
@ -365,7 +345,7 @@ class DefaultJsApi(
@JavascriptInterface
fun getPushId(): String {
val pushProvider = TheRouter.get(IPushProvider::class.java)
val pushProvider = ARouter.getInstance().build(RouteConsts.provider.push).navigation() as? IPushProvider
return pushProvider?.getRegistrationId(HaloApp.getInstance()) ?: "unknown"
}
@ -444,7 +424,8 @@ class DefaultJsApi(
@JavascriptInterface
fun showQaFeedbackDialog(msg: Any) {
val mHelpAndFeedbackHelp = TheRouter.get(IHelpAndFeedbackProvider::class.java)
val mHelpAndFeedbackHelp =
ARouter.getInstance().build(RouteConsts.provider.helpAndFeedback).navigation() as? IHelpAndFeedbackProvider
mHelpAndFeedbackHelp?.showQaFeedbackDialogFragment(context as AppCompatActivity, msg.toString())
}
@ -515,44 +496,6 @@ class DefaultJsApi(
}
}
@JavascriptInterface
fun saveWechatQRCode(msg: Any) {
val base64StringData = msg.toString()
runOnUiThread {
(context as? FragmentActivity)?.checkStoragePermissionBeforeAction {
runOnIoThread {
val base64String = base64StringData.replace("data:image/png;base64", "")
tryWithDefaultCatch {
val imageFile =
File(HaloApp.getInstance().cacheDir.absolutePath + File.separator + System.currentTimeMillis() + ".png")
val decodedString = Base64.decode(base64String, Base64.DEFAULT)
val bos = BufferedOutputStream(FileOutputStream(imageFile))
bos.write(decodedString)
bos.flush()
bos.close()
ImageUtils.saveImageToFile(imageFile, "", true) {
// 这里是 ui 线程
// 保存微信二维码成功1s 以后跳转微信
if (mFragment != null && mFragment.lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED)) {
handler.removeCallbacksAndMessages(null)
handler.postDelayed({
val wechatPkgName = "com.tencent.mm"
if (!PackageUtils.isInstalled(context, wechatPkgName)) {
ToastUtils.showToast(R.string.wechat_app_not_install_tips.toResString())
return@postDelayed
}
PackageLauncher.launchApp(context, packageName = wechatPkgName)
}, 1000)
}
}
}
}
}
}
}
@JavascriptInterface
fun loginWithCallback(msg: Any, handler: CompletionHandler<Any>) {
mLoginHandler = handler
@ -757,86 +700,6 @@ class DefaultJsApi(
}
}
@JavascriptInterface
fun preOrderWithAli(json: Any) {
val order = json.toString().toObject<OrderEntity>() ?: return
trackMemberPaymentButtonClick(order, PAYMENT_TYPE_ALIPAY)
listener?.onPreOrderWithAli(order)
}
@JavascriptInterface
fun preOrderWithWechat(json: Any) {
val order = json.toString().toObject<OrderEntity>() ?: return
trackMemberPaymentButtonClick(order, PAYMENT_TYPE_WECHAT)
listener?.onPreOrderWithWechat(order)
}
private fun trackMemberPaymentButtonClick(order: OrderEntity, paymentType: String) {
val isFirstTime = SPUtils.getBoolean(SP_MEMBER_PAYMENT_BUTTON_CLICK, true)
SPUtils.setBoolean(SP_MEMBER_PAYMENT_BUTTON_CLICK, false)
SensorsBridge.trackMemberPaymentButtonClick(
isFirstTime,
paymentType,
order.setMenuName,
order.paymentAmount
)
}
@JavascriptInterface
fun startGameAccelerate(acctJson: Any) {
if (acctJson is String) {
val acctRecord = GsonUtils.fromJson(acctJson, AcctRecordEntity::class.java)
val accInfo = acctRecord.accInfo
listener?.onStartGameAccelerate(accInfo)
}
}
@JavascriptInterface
fun getCurAcctGameId(): String {
return AcceleratorDataHolder.instance.getAcceleratingGameId()
}
@JavascriptInterface
fun stopGameAccelerate() {
listener?.onStopGameAccelerate()
}
@JavascriptInterface
fun getDurationRemainingTime(msg: Any, handler: CompletionHandler<Any>) {
TheRouter.get(IAcceleratorProvider::class.java)?.loadQyUserPermissionData {
val durationExpiredMinute = AcceleratorDataHolder.instance.vipEntity?.durationExpiredTime ?: 0L
handler.complete(durationExpiredMinute)
}
}
@JavascriptInterface
fun refreshToken(token: Any, handler: CompletionHandler<Any>) {
val accessToken = token.toString()
UserManager.getInstance().refreshToken(accessToken, object : UserManager.refreshCallBack {
override fun onLogin() {
handler.complete(true)
}
override fun onLoginFailure(errorMessage: String?) {
handler.complete(false)
}
})
}
@JavascriptInterface
fun trackSensorsAnalytics(json: Any) {
val hashMap = json.toString().toObject<HashMap<String, Any>>() ?: return
val eventName = hashMap.remove(EVENT_NAME) ?: return
when (eventName) {
EVENT_MEMBER_RECHARGE_BUTTON_CLICK -> {
hashMap[KEY_IS_FIRST_TIME] = SPUtils.getBoolean(SP_MEMBER_RECHARGE_BUTTON_CLICK, true)
SPUtils.setBoolean(SP_MEMBER_RECHARGE_BUTTON_CLICK, false)
}
}
SensorsBridge.trackSensorsAnalyticsFromWeb(eventName.toString(), hashMap)
}
/**
* 获取 ExposureEvent可能为空
*/
@ -857,8 +720,6 @@ class DefaultJsApi(
}
EventBus.getDefault().unregister(this@DefaultJsApi)
handler.removeCallbacksAndMessages(null)
}
}
@ -955,15 +816,4 @@ class DefaultJsApi(
}
}
}
interface OnWebClickListener {
fun onPreOrderWithAli(order: OrderEntity)
fun onPreOrderWithWechat(order: OrderEntity)
fun onStartGameAccelerate(accInfo: AcctRecordEntity.AccInfo)
fun onStopGameAccelerate()
}
}

View File

@ -15,7 +15,6 @@ import com.gh.common.util.DirectUtils.directToLegacyVideoDetail
import com.gh.common.util.DirectUtils.directToLinkPage
import com.gh.common.util.DirectUtils.directToQa
import com.gh.common.util.PackageUtils
import com.gh.gamecenter.SkipCompatActivity
import com.gh.gamecenter.WebActivity
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
@ -67,10 +66,6 @@ object DefaultUrlHandler {
bringAppToFront: Boolean = false,
sourceEntrance: String = ""): Boolean {
val uri = Uri.parse(url)
// 优先交给新的路由拦截处理
if (SkipCompatActivity.handleSkip(context, uri)) return true
if ("ghzhushou" == uri.scheme) {
Utils.log("url = $url")
Utils.log("url = " + uri.scheme!!)
@ -379,7 +374,7 @@ object DefaultUrlHandler {
val iconSubscript = uri.getQueryParameter("game_icon_subscript") ?: ""
val gameEntity =
if (forumType == BbsType.OFFICIAL_BBS.value && gameId.isNotEmpty() && gameName.isNotEmpty() && icon.isNotEmpty()) {
GameEntity(_id = gameId, mName = gameName, mIcon = icon, mIconSubscript = iconSubscript)
GameEntity(id = gameId, mName = gameName, mIcon = icon, mIconSubscript = iconSubscript)
} else null
val activityLabelEntity = if (activityId.isNotEmpty() && activityName.isNotEmpty()) {
ActivityLabelEntity(

View File

@ -17,7 +17,7 @@ import kotlin.concurrent.fixedRateTimer
object FixedRateJobHelper {
private const val CHECKER_PERIOD: Long = 15 * 1000L
private const val TIME_PERIOD: Long = 24 * 60 * 60 * 1000L
private const val TIME_PERIOD: Long = 10 * 60 * 1000L
private const val LOGHUB_PERIOD: Long = 2 * 60 * 1000L
private const val EXPOSURE_PERIOD: Long = 1 * 60 * 1000L
private const val REGION_SETTING_PERIOD: Long = 60 * 1000L
@ -35,7 +35,7 @@ object FixedRateJobHelper {
// 时间检查每15秒检查一次
fixedRateTimer("Global-Fixed-Rate-Timer", initialDelay = 100, period = CHECKER_PERIOD) {
val elapsedTime = mExecuteCount * CHECKER_PERIOD
// 时间校对,24 小时一次
// 时间校对,10分钟一次
if (elapsedTime % TIME_PERIOD == 0L) {
RetrofitManager.getInstance().api.time
.subscribeOn(Schedulers.io())

View File

@ -4,7 +4,6 @@ import android.app.Activity
import android.content.Context
import com.gh.common.util.DialogUtils
import com.gh.common.util.DirectUtils
import com.gh.common.util.PackageChangeHelper
import com.gh.common.util.TempCertificationUtils
import com.gh.gamecenter.feature.entity.GameEntity
@ -26,10 +25,6 @@ class LandPageAddressHandler : DownloadChainHandler() {
processEndCallback?.invoke(asVGame, null)
}
} else {
val packageName = gameEntity.getApk().firstOrNull()?.packageName
if (packageName?.isNotEmpty() == true) {
PackageChangeHelper.addInstallPendingPackage(packageName)
}
DirectUtils.directToExternalBrowser(context, gameEntity.landPageAddressDialog!!.link!!)
}
}

View File

@ -8,21 +8,12 @@ import com.gh.gamecenter.feature.entity.GameEntity
class PackageCheckHandler : DownloadChainHandler() {
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
fun nextOrProcessEnd() {
PackageCheckDialogFragment.show((context as AppCompatActivity), gameEntity) {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity, asVGame)
} else {
processEndCallback?.invoke(asVGame, null)
}
}
if (gameEntity.canSpeed) {
nextOrProcessEnd()
} else {
PackageCheckDialogFragment.show((context as AppCompatActivity), gameEntity) {
nextOrProcessEnd()
}
}
}
}

View File

@ -63,11 +63,6 @@ public class Config {
public static final String NEW_API_HOST = EnvHelper.getNewHost();
public static final String VAPI_HOST = EnvHelper.getVHost();
public static final String WGAME_CPM_BUSIAPPID = BuildConfig.WGAME_CPM_BUSIAPPID;
public static final String WGAME_CPM_API_HOST = EnvHelper.getWGameCPMHost();
public static final String DSP_API_HOST = EnvHelper.getDspHost();
// Third-Party confs
public static final String WECHAT_APPID = BuildConfig.WECHAT_APPID;
public static final String WECHAT_SECRET = BuildConfig.WECHAT_SECRET;
@ -116,6 +111,8 @@ public class Config {
if (!TextUtils.isEmpty(json)) {
mSettingsEntity = GsonUtils.fromJson(json, SettingsEntity.class);
}
mSettingsEntity.setGameSmooth("off");
} catch (Exception e) {
e.printStackTrace();
}
@ -263,7 +260,8 @@ public class Config {
public void onSuccess(VSetting data) {
mVSetting = data;
SPUtils.setString(Constants.SP_V_SETTINGS, GsonUtils.toJson(data));
VHelper.checkVspaceUpdate(HaloApp.getInstance());
VHelper.init(HaloApp.getInstance());
}
});
}

View File

@ -1,10 +1,5 @@
package com.gh.common.databind;
import static com.gh.gamecenter.entity.SubjectEntity.SUBJECT_TAG_SELLING_POINT;
import static com.gh.gamecenter.entity.SubjectEntity.SUBJECT_TAG_TEST;
import static com.gh.gamecenter.entity.SubjectEntity.SUBJECT_TAG_TYPE;
import static com.gh.gamecenter.entity.SubjectEntity.SUBJECT_TAG_UPDATE;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
@ -13,20 +8,17 @@ import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.view.ViewParent;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet;
import com.gh.common.chain.BrowserInstallHandler;
import com.gh.common.chain.CheckDownloadHandler;
import com.gh.common.chain.CheckStoragePermissionHandler;
import com.gh.common.chain.DownloadChainBuilder;
import com.gh.common.chain.DownloadChainHandler;
import com.gh.common.chain.CheckDownloadHandler;
import com.gh.common.chain.CheckStoragePermissionHandler;
import com.gh.common.chain.DownloadDialogHelperHandler;
import com.gh.common.chain.GamePermissionHandler;
import com.gh.common.chain.LandPageAddressHandler;
@ -56,7 +48,6 @@ import com.gh.download.server.BrowserInstallHelper;
import com.gh.gamecenter.DownloadManagerActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.WebActivity;
import com.gh.gamecenter.common.databinding.LayoutGameItemSellingPointBinding;
import com.gh.gamecenter.common.entity.LinkEntity;
import com.gh.gamecenter.common.utils.DarkModeUtils;
import com.gh.gamecenter.common.utils.ExtensionsKt;
@ -64,7 +55,6 @@ import com.gh.gamecenter.common.utils.FileUtils;
import com.gh.gamecenter.common.utils.NewFlatLogUtils;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.core.utils.MtaHelper;
import com.gh.gamecenter.core.utils.TimeUtils;
import com.gh.gamecenter.core.utils.ToastUtils;
import com.gh.gamecenter.feature.entity.ApkEntity;
import com.gh.gamecenter.feature.entity.GameEntity;
@ -211,8 +201,7 @@ public class BindingAdapters {
gameEntity,
traceEvent,
entrance,
location + ":" + gameEntity.getName(),
null);
location + ":" + gameEntity.getName());
return null;
});
final DownloadChainHandler chainHandler = builder.buildHandlerChain();
@ -257,8 +246,7 @@ public class BindingAdapters {
gameEntity,
traceEvent,
entrance,
location + ":" + gameEntity.getName(),
null);
location + ":" + gameEntity.getName());
}
break;
case INSTALL_PLUGIN:
@ -274,9 +262,7 @@ public class BindingAdapters {
SensorsBridge.trackInstallGameClick(
gameEntity.getId(),
gameEntity.getName() != null ? gameEntity.getName() : "",
"主动安装",
gameEntity.isDspGame(),
gameEntity.getDspAdId()
"主动安装"
);
DownloadEntity downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity);
@ -301,11 +287,19 @@ public class BindingAdapters {
});
break;
case RESERVED:
ReservationHelper.showCancelReservationDialog(progressBar.getContext(), gameEntity, () -> {
ReservationHelper.cancelReservation(gameEntity, () -> {
updateReservation(progressBar, gameEntity);
if ("download".equals(gameEntity.getReserveStatus())) {
ReservationHelper.showDeleteReservationDialog(progressBar.getContext(), () -> {
ReservationHelper.deleteReservation(gameEntity, () -> {
updateReservation(progressBar, gameEntity);
});
});
});
} else {
ReservationHelper.showCancelReservationDialog(progressBar.getContext(),gameEntity, () -> {
ReservationHelper.cancelReservation(gameEntity, () -> {
updateReservation(progressBar, gameEntity);
});
});
}
break;
case H5_GAME:
LinkEntity linkEntity = gameEntity.getH5Link();
@ -351,9 +345,9 @@ public class BindingAdapters {
}
progressBar.setButtonStyle(DownloadButton.ButtonStyle.H5_GAME);
} else {
if (("dialog".equals(offStatus) || "third_party".equals(offStatus))) {
if (offStatus != null && "dialog".equals(offStatus)) {
progressBar.setText("查看");
progressBar.setButtonStyle(DownloadButton.ButtonStyle.NONE_WITH_HINT);
progressBar.setButtonStyle(DownloadButton.ButtonStyle.NONE);
} else if ("updating".equals(offStatus)) {
progressBar.setText("更新中");
progressBar.setButtonStyle(DownloadButton.ButtonStyle.UPDATING);
@ -484,37 +478,39 @@ public class BindingAdapters {
}
}
/**
* 包含测试开服标签
*
* @param layout
* @param gameEntity
* @param subjectTag 默认为 “”只有游戏专题可以配置subjectTag
*/
public static void setGameTags(LinearLayout layout, GameEntity gameEntity, String subjectTag) {
// 包含测试开服标签
public static void setGameTags(LinearLayout layout, GameEntity gameEntity) {
try {
if (layout.getVisibility() == View.GONE) return;
ArrayList<TagStyleEntity> tagStyle = new ArrayList<>();
TestEntity test = gameEntity.getTest();
if (test != null && subjectTag.equals(SUBJECT_TAG_TEST)) {
// 显示开测表标签
TagStyleEntity typeTag = new TagStyleEntity();
boolean isDarkModeOn = DarkModeUtils.INSTANCE.isDarkModeOn(layout.getContext());
typeTag.setName(test.getType() != null ? test.getType() : "");
typeTag.setBackground("1AFFA142");
typeTag.setColor(isDarkModeOn ? "EB9238" : "FFA142");
tagStyle.add(typeTag);
TagStyleEntity timeTag = new TagStyleEntity();
if (test.getStartPending()) {
timeTag.setName(test.getStartText());
if (test != null
// 这个判断用于开测表列表
&& !"type_tag".equals(test.getGameTag())) {
if ("custom".equals(test.getGameTag())) {
TagStyleEntity typeTag = new TagStyleEntity();
if (!TextUtils.isEmpty(test.getText())) {
typeTag.setName(test.getText() != null ? test.getText() : "");
} else {
typeTag.setName(test.getType() != null ? test.getType() : "");
}
typeTag.setBackground("E8F3FF");
typeTag.setColor("1383EB");
tagStyle.add(typeTag);
} else {
timeTag.setName(GameViewUtils.getGameTestDate(test.getStart()));
}
timeTag.setBackground("1A06CEA8");
timeTag.setColor(isDarkModeOn ? "07A385" : "06CEA8");
tagStyle.add(timeTag);
TagStyleEntity typeTag = new TagStyleEntity();
boolean isDarkModeOn = DarkModeUtils.INSTANCE.isDarkModeOn(layout.getContext());
typeTag.setName(test.getType() != null ? test.getType() : "");
typeTag.setBackground("1AFFA142");
typeTag.setColor(isDarkModeOn ? "EB9238" : "FFA142");
tagStyle.add(typeTag);
TagStyleEntity timeTag = new TagStyleEntity();
timeTag.setName(GameViewUtils.getGameTestDate(test.getStart()));
timeTag.setBackground("1A06CEA8");
timeTag.setColor(isDarkModeOn ? "07A385" : "06CEA8");
tagStyle.add(timeTag);
}
} else {
tagStyle = gameEntity.getTagStyle();
}
@ -524,68 +520,6 @@ public class BindingAdapters {
}
}
public static void setGameTagsWithSellingPoint(LinearLayout layout, LayoutGameItemSellingPointBinding binding, GameEntity gameEntity, String subjectTag) {
if (subjectTag.equals(SUBJECT_TAG_SELLING_POINT)) {
layout.setVisibility(View.GONE);
binding.getRoot().setVisibility(View.VISIBLE);
GameEntity.SellingPoints sellingPoints = gameEntity.getSellingPoints();
if (sellingPoints != null) {
binding.tvSellingPoints.setVisibility(View.VISIBLE);
binding.tvSellingPoints.setText(sellingPoints.getText());
} else {
binding.tvSellingPoints.setVisibility(View.GONE);
}
ArrayList<TagStyleEntity> tagStyle = gameEntity.getTagStyle();
StringBuilder tagText = new StringBuilder();
for (int i = 0; i < tagStyle.size(); i++) {
if (i < 3) {
tagText.append(i == 0 ? "" : "·").append(tagStyle.get(i).getName());
}
}
binding.gtcvTags.setText(tagText);
} else {
layout.setVisibility(View.VISIBLE);
binding.getRoot().setVisibility(View.GONE);
switch (subjectTag) {
case SUBJECT_TAG_UPDATE:
List<TagStyleEntity> updateTags = new ArrayList<>();
TagStyleEntity updateTag = new TagStyleEntity(
"local_generated",
TimeUtils.getFormatTime(gameEntity.getUpdateTime(), "MM-dd") + " 更新",
"",
"1383EB",
"E8F3FF",
"1383EB",
false
);
updateTags.add(updateTag);
GameViewUtils.setLabelList(layout.getContext(), layout, updateTags);
break;
case SUBJECT_TAG_TYPE:
GameViewUtils.setLabelList(layout.getContext(), layout, gameEntity.getTagStyle());
break;
default:
setGameTags(layout, gameEntity, subjectTag);
break;
}
}
ViewParent parent = binding.getRoot().getParent();
if (parent instanceof ConstraintLayout) {
ConstraintLayout constraintLayout = (ConstraintLayout) parent;
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(constraintLayout);
constraintSet.clear(R.id.gameDesSpace, ConstraintSet.BOTTOM);
if (subjectTag.equals(SUBJECT_TAG_SELLING_POINT)) {
constraintSet.connect(R.id.gameDesSpace, ConstraintSet.BOTTOM, R.id.layout_selling_points, ConstraintSet.TOP);
} else {
constraintSet.connect(R.id.gameDesSpace, ConstraintSet.BOTTOM, R.id.label_list, ConstraintSet.TOP);
}
constraintSet.applyTo(constraintLayout);
}
}
public static void setVideoDetailGameTags(LinearLayout layout, GameEntity gameEntity) {
try {
ArrayList<TagStyleEntity> tagStyle = new ArrayList<>();

View File

@ -1,294 +0,0 @@
package com.gh.common.dialog
import android.content.Context
import android.os.Bundle
import android.os.Parcelable
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.R
import com.gh.gamecenter.common.HaloApp
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.core.utils.CurrentActivityHolder
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.databinding.DialogFragmentAccelerateExporationBinding
import kotlinx.parcelize.Parcelize
public class AccelerateExpirationDialogFragment : BaseDialogFragment() {
private lateinit var binding: DialogFragmentAccelerateExporationBinding
private var _reminder: ExpirationReminder? = null
override fun onBack(): Boolean {
return true
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
_reminder = arguments?.getParcelable(KEY_EXPIRATION_REMINDER)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return DialogFragmentAccelerateExporationBinding.inflate(inflater, container, false)
.also {
binding = it
}.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val reminder = _reminder ?: return
val (title, content) = when (reminder) {
is ExpirationReminder.UserExpired -> {
SensorsBridge.trackMonthlyPackageExpiresDialogShow(
reminder.gameId, reminder.gameName, reminder.pkgName, reminder.sourceEntrance
)
getString(
R.string.membership_expiration_reminder_title,
"${reminder.days}"
) to getString(R.string.membership_expiration_reminder_content)
}
is ExpirationReminder.InsufficientDuration -> {
SensorsBridge.trackInsufficientDurationDialogShow(
reminder.gameId,
reminder.gameName,
reminder.pkgName,
reminder.sourceEntrance
)
getString(
R.string.duration_time_out_reminder_title,
"${reminder.hours}"
) to getString(R.string.duration_time_out_reminder_content)
}
is ExpirationReminder.DurationExpired -> {
SensorsBridge.trackTimedPackageExpiresDialogShow(
reminder.gameId,
reminder.gameName,
reminder.pkgName,
reminder.sourceEntrance
)
getString(
R.string.duration_expiration_reminder_title,
"${reminder.days}"
) to getString(R.string.duration_expiration_reminder_content)
}
is ExpirationReminder.TimeRunsOut -> {
SensorsBridge.trackDurationExhaustedDialogShow()
getString(R.string.accelerator_member_expired_title) to getString(R.string.accelerator_member_expired_content)
}
}
binding.tvTitle.text = title
binding.tvContent.text = content
binding.tvCancel.setOnClickListener {
when (reminder) {
is ExpirationReminder.UserExpired -> {
SensorsBridge.trackMonthlyPackageExpiresDialogClick(
reminder.gameId, reminder.gameName, reminder.pkgName, reminder.sourceEntrance, BUTTON_NAME_KNOW
)
}
is ExpirationReminder.InsufficientDuration -> {
SensorsBridge.trackInsufficientDurationDialogClick(
reminder.gameId, reminder.gameName, reminder.pkgName, reminder.sourceEntrance, BUTTON_NAME_KNOW
)
}
is ExpirationReminder.DurationExpired -> {
SensorsBridge.trackTimedPackageExpiresDialogClick(
reminder.gameId, reminder.gameName, reminder.pkgName, reminder.sourceEntrance, BUTTON_NAME_KNOW
)
}
is ExpirationReminder.TimeRunsOut -> {
SensorsBridge.trackDurationExhaustedDialogClick(BUTTON_NAME_KNOW)
}
}
dismissAllowingStateLoss()
}
binding.tvSubmit.setOnClickListener {
when (reminder) {
is ExpirationReminder.UserExpired -> {
SensorsBridge.trackMonthlyPackageExpiresDialogClick(
reminder.gameId, reminder.gameName, reminder.pkgName, reminder.sourceEntrance, BUTTON_NAME_BUY
)
}
is ExpirationReminder.InsufficientDuration -> {
SensorsBridge.trackInsufficientDurationDialogClick(
reminder.gameId, reminder.gameName, reminder.pkgName, reminder.sourceEntrance, BUTTON_NAME_BUY
)
}
is ExpirationReminder.DurationExpired -> {
SensorsBridge.trackTimedPackageExpiresDialogClick(
reminder.gameId, reminder.gameName, reminder.pkgName, reminder.sourceEntrance, BUTTON_NAME_BUY
)
}
is ExpirationReminder.TimeRunsOut -> {
SensorsBridge.trackDurationExhaustedDialogClick(BUTTON_NAME_BUY)
}
}
SensorsBridge.trackMyAssetsPageShow(
reminder.pkgName,
reminder.gameId,
reminder.gameName,
reminder.dialogName
)
dismissAllowingStateLoss()
DirectUtils.navigateToMyAssetsPage(requireContext(), reminder.sourceEntrance)
}
}
override fun onStart() {
super.onStart()
val width = HaloApp.getInstance().resources.displayMetrics.widthPixels - 60F.dip2px()
val height = dialog?.window?.attributes?.height ?: ViewGroup.LayoutParams.WRAP_CONTENT
dialog?.window?.setLayout(width, height)
}
companion object {
const val KEY_EXPIRATION_REMINDER = "key_expiration_reminder"
private const val BUTTON_NAME_KNOW = "知道了"
private const val BUTTON_NAME_BUY = "前往购买"
fun checkDialogShown(context: Context, reminder: ExpirationReminder, callback: ((Boolean) -> Unit)? = null) {
when (reminder) {
is ExpirationReminder.UserExpired -> {
val days = SPUtils.getLong(Constants.SP_ACCELERATOR_USER_REMAINING_REMIND)
if (reminder.days != days) {
SPUtils.setLong(Constants.SP_ACCELERATOR_USER_REMAINING_REMIND, reminder.days)
show(context, reminder)
callback?.invoke(true)
} else {
callback?.invoke(false)
}
}
is ExpirationReminder.InsufficientDuration -> {
val hours = SPUtils.getLong(Constants.SP_ACCELERATOR_DURATION_REMAINING_HOURS)
if (reminder.hours != hours) {
SPUtils.setLong(Constants.SP_ACCELERATOR_DURATION_REMAINING_HOURS, reminder.hours)
show(context, reminder)
callback?.invoke(true)
} else {
callback?.invoke(false)
}
}
is ExpirationReminder.DurationExpired -> {
val days = SPUtils.getLong(Constants.SP_ACCELERATOR_DURATION_REMAINING_DAYS)
if (reminder.days != days) {
SPUtils.setLong(Constants.SP_ACCELERATOR_DURATION_REMAINING_DAYS, reminder.days)
show(context, reminder)
callback?.invoke(true)
} else {
callback?.invoke(false)
}
}
is ExpirationReminder.TimeRunsOut -> {
val hasShow = SPUtils.getBoolean(Constants.SP_ACCELERATOR_MEMBERSHIP_EXPIRED)
if (!hasShow) {
SPUtils.setBoolean(Constants.SP_ACCELERATOR_MEMBERSHIP_EXPIRED, true)
show(context, reminder)
callback?.invoke(true)
} else {
callback?.invoke(false)
}
}
}
}
fun show(context: Context, reminder: ExpirationReminder) {
if (context is AppCompatActivity) {
context.supportFragmentManager
} else {
(CurrentActivityHolder.getCurrentActivity() as? AppCompatActivity)?.supportFragmentManager
}?.let {
val fragment = AccelerateExpirationDialogFragment().apply {
arguments = Bundle().apply {
putParcelable(KEY_EXPIRATION_REMINDER, reminder)
}
}
fragment.show(it, AcceleratorPermissionGuideDialogFragment::class.java.name)
}
}
}
sealed class ExpirationReminder(
val gameId: String,
val gameName: String,
val pkgName: String,
val sourceEntrance: String
) :
Parcelable {
abstract val dialogName: String
@Parcelize
data class InsufficientDuration(
val hours: Long,
private val _gameId: String,
private val _gameName: String,
private val _pkgName: String,
private val _sourceEntrance: String,
) :
ExpirationReminder(_gameId, _gameName, _pkgName, _sourceEntrance) {
override val dialogName: String
get() = "时长不足提示弹窗"
}
@Parcelize
data class DurationExpired(
val days: Long,
private val _gameId: String,
private val _gameName: String,
private val _pkgName: String,
private val _sourceEntrance: String,
) :
ExpirationReminder(_gameId, _gameName, _pkgName, _sourceEntrance) {
override val dialogName: String
get() = "计时套餐临期提示弹窗"
}
@Parcelize
data class UserExpired(
val days: Long,
private val _gameId: String,
private val _gameName: String,
private val _pkgName: String,
private val _sourceEntrance: String,
) :
ExpirationReminder(_gameId, _gameName, _pkgName, _sourceEntrance) {
override val dialogName: String
get() = "包月套餐临期提示弹窗"
}
@Parcelize
data class TimeRunsOut(
private val _sourceEntrance: String,
) : ExpirationReminder("", "", "", _sourceEntrance) {
override val dialogName: String
get() = "时长耗尽提示弹窗"
}
}
}

View File

@ -1,68 +0,0 @@
package com.gh.common.dialog
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import com.gh.gamecenter.common.HaloApp
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.core.utils.CurrentActivityHolder
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.databinding.DialogFragmentAcceleratorPermissionGuideBinding
class AcceleratorPermissionGuideDialogFragment : BaseDialogFragment() {
private lateinit var binding: DialogFragmentAcceleratorPermissionGuideBinding
private var callback: (() -> Unit)? = null
override fun onBack(): Boolean {
return true
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return DialogFragmentAcceleratorPermissionGuideBinding.inflate(inflater, container, false)
.also {
binding = it
}.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
SPUtils.setBoolean(Constants.SP_ACCELERATOR_PERMISSION_GUIDE_SHOW, true)
binding.tvSubmit.setOnClickListener {
dismiss()
callback?.invoke()
}
}
fun setOnCallback(block: () -> Unit) {
this.callback = block
}
override fun onStart() {
super.onStart()
val width = HaloApp.getInstance().resources.displayMetrics.widthPixels - 60F.dip2px()
val height = dialog?.window?.attributes?.height ?: ViewGroup.LayoutParams.WRAP_CONTENT
dialog?.window?.setLayout(width, height)
}
companion object {
fun show(context: Context, callback: () -> Unit) {
if (context is AppCompatActivity) {
context.supportFragmentManager
} else {
(CurrentActivityHolder.getCurrentActivity() as? AppCompatActivity)?.supportFragmentManager
}?.let {
val fragment = AcceleratorPermissionGuideDialogFragment()
fragment.setOnCallback(callback)
fragment.show(it, AcceleratorPermissionGuideDialogFragment::class.java.name)
}
}
}
}

View File

@ -3,6 +3,7 @@ package com.gh.common.dialog
import android.animation.ValueAnimator
import android.content.Context
import android.content.DialogInterface
import android.content.pm.PackageInfo
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
@ -18,6 +19,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.gh.common.util.DirectUtils
import com.gh.common.util.LogUtils
import com.gh.common.util.PackageHelper
import com.gh.common.util.PackageUtils
import com.gh.download.DownloadManager
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
@ -57,6 +59,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
private val mDuration = 3000
private var mDisposable: Disposable? = null
private var mAdapter: PackageCheckAdapter? = null
private var mAllInstalledPackages = PackageHelper.getInstalledPackageNameList(HaloApp.getInstance().application, 0)
var gameEntity: GameEntity? = null
var callBack: ConfirmListener? = null
@ -192,7 +195,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
if (binding.noRemindAgainCb.isChecked) {
saveRecord(entity)
}
val isAllPackageInstalled = isAllPackageInstalled(entity)
val isAllPackageInstalled = isAllPackageInstalled(mAllInstalledPackages, entity)
if (isAllPackageInstalled) {
mDismissByTouchInside = true
callBack?.onConfirm()
@ -296,7 +299,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
private fun getNotInstalledLink(packageDialogEntity: PackageDialogEntity): LinkEntity? {
val links = LinkedHashSet<LinkEntity>()
packageDialogEntity.detectionObjects.forEach { obj ->
if (!checkDetectionsInstalled(obj.packages)) {
if (!checkDetectionsInstalled(mAllInstalledPackages, obj.packages)) {
obj.assignDownload.forEach {
links.add(packageDialogEntity.links[it])
}
@ -322,8 +325,9 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
override fun onResume() {
super.onResume()
mAllInstalledPackages = PackageHelper.getInstalledPackageNameList(HaloApp.getInstance().application, 0)
gameEntity?.packageDialog?.let {
if (isAllPackageInstalled(it)) {
if (isAllPackageInstalled(mAllInstalledPackages, it)) {
callBack?.onConfirm()
dismissAllowingStateLoss()
}
@ -359,6 +363,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
@Subscribe(threadMode = ThreadMode.MAIN)
fun onEventMainThread(busFour: EBPackage) {
if (busFour.isInstalledOrUninstalled()) {
mAllInstalledPackages = PackageHelper.getInstalledPackageNameList(HaloApp.getInstance().application, 0)
mAdapter?.notifyDataSetChanged()
}
}
@ -383,7 +388,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
val entity = entities[position]
holder.binding.gameNameTv.text = entity.text
if (position <= index) {
val isAllInstalled = checkDetectionsInstalled(entity.packages)
val isAllInstalled = checkDetectionsInstalled(mAllInstalledPackages, entity.packages)
if (isAllInstalled) {
holder.binding.statusTv.text = "已安装"
holder.binding.statusTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_theme))
@ -411,7 +416,8 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
return
}
if (isAllPackageInstalled(packageDialogEntity)) {
val allInstalledPackages = PackageHelper.getInstalledPackageNameList(HaloApp.getInstance().application, 0)
if (isAllPackageInstalled(allInstalledPackages, packageDialogEntity)) {
callBack.onConfirm()
return
}
@ -447,11 +453,13 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
}
private fun checkDetectionsInstalled(
allInstalledPackages: List<String>,
packages: ArrayList<String>
): Boolean {
var isPackagesInstalled = false
packages.forEach { packageName ->
if (PackageUtils.isInstalledFromAllPackage(HaloApp.getInstance(), packageName)) {
val isInstalled = allInstalledPackages.find { it == packageName } != null
if (isInstalled) {
isPackagesInstalled = true
return@forEach
}
@ -461,14 +469,17 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
fun isAllPackageInstalled(
allInstalledPackages: List<String>,
packageDialogEntity: PackageDialogEntity
): Boolean {
var isAllInstalled = true
packageDialogEntity.detectionObjects.forEach loop@{ obj ->
if (!checkDetectionsInstalled(obj.packages)) {
return false
if (!checkDetectionsInstalled(allInstalledPackages, obj.packages)) {
isAllInstalled = false
return isAllInstalled
}
}
return true
return isAllInstalled
}
}
}

View File

@ -16,10 +16,12 @@ import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.FixLinearLayoutManager
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.core.utils.SPUtils.getBoolean
import com.gh.gamecenter.databinding.DialogReserveBinding
import com.gh.gamecenter.databinding.DialogReserveItemBinding
import com.gh.gamecenter.feature.entity.GameEntity

View File

@ -16,7 +16,6 @@ import com.gh.common.pop.EditBindWechatPop
import com.gh.common.pop.RealNameTipsPop
import com.gh.gamecenter.R
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.entity.WechatConfigEntity
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.common.utils.toObject
@ -84,90 +83,79 @@ class ReserveSuccessReminderDialog(
handlers.clear()
binding.flContentContainer.removeAllViews()
val configTypes = mutableListOf<Int>()
// 短信
if (reserveReminder.hasSmsConfig) {
if (reserveReminder.smsConfig.notice) {
configTypes.add(SMS_REMINDER_ENABLE_TYPE)
} else {
configTypes.add(SMS_REMINDER_UNABLE_TYPE)
}
}
// 微信
if (reserveReminder.wechatConfig.isReminderEnable) {
configTypes.add(WECHAT_REMINDER_ENABLE_TYPE)
} else {
configTypes.add(WECHAT_REMINDER_UNABLE_TYPE)
}
// 日历
if (reserveReminder.hasCalendarConfig) {
if (reserveReminder.calendarConfig.notice) {
configTypes.add(CALENDAR_REMINDER_ENABLE_TYPE)
} else {
configTypes.add(CALENDAR_REMINDER_UNABLE_TYPE)
}
}
if (configTypes.size == 1) {
// 只有微信提醒
if (configTypes.first() == WECHAT_REMINDER_ENABLE_TYPE) {
binding.tvContent.setText(R.string.reverse_success_with_reminder_tips)
handlers.add(
WechatReminderEnableHandler(reserveReminder.wechatConfig, 8.dp, binding.flContentContainer, this)
)
} else {
val smsConfig = reserveReminder.smsConfig
val wechatConfig = reserveReminder.wechatConfig
when {
reserveReminder.onlyShowWechatReminder && !wechatConfig.isReminderEnable -> { // 只显示微信:未开启
binding.tvContent.setText(R.string.reverse_success_without_reminder_tips)
handlers.add(OnlyWechatReminderUnableHandler(16.dp, binding.flContentContainer, this))
arrayListOf(OnlyWechatReminderUnableHandler(16.dp, binding.flContentContainer, this))
}
} else {
binding.tvContent.setText(R.string.reverse_success_with_reminder_tips)
var isLargerSpacing = true
fun getPaddingTop(): Int {
val paddingTop = if (isLargerSpacing) 16.dp else 8.dp
isLargerSpacing = false
return paddingTop
reserveReminder.onlyShowWechatReminder && wechatConfig.isReminderEnable -> { // 只显示微信:已开
binding.tvContent.setText(R.string.reverse_success_with_reminder_tips)
arrayListOf(
WechatReminderEnableHandler(
reserveReminder.wechatConfig.nickName,
8.dp,
binding.flContentContainer,
this
)
)
}
configTypes.sorted().forEach {
when (it) {
SMS_REMINDER_ENABLE_TYPE -> {
isLargerSpacing = true
SmsReminderEnableHandler(reserveReminder.smsConfig, 8.dp, binding.flContentContainer, this)
}
SMS_REMINDER_UNABLE_TYPE -> {
SmsReminderUnableHandler(getPaddingTop(), binding.flContentContainer, this)
}
WECHAT_REMINDER_ENABLE_TYPE -> {
isLargerSpacing = true
WechatReminderEnableHandler(
reserveReminder.wechatConfig,
8.dp,
binding.flContentContainer,
this
)
}
WECHAT_REMINDER_UNABLE_TYPE ->
WechatReminderUnableHandler(getPaddingTop(), binding.flContentContainer, this)
CALENDAR_REMINDER_ENABLE_TYPE -> {
isLargerSpacing = true
CalendarReminderEnableHandler(8.dp, binding.flContentContainer, this)
}
CALENDAR_REMINDER_UNABLE_TYPE ->
CalendarReminderUnableHandler(getPaddingTop(), binding.flContentContainer, this)
else -> null
}?.let(handlers::add)
!smsConfig.notice && !wechatConfig.isReminderEnable -> { // 短信,微信未开启
binding.tvContent.setText(R.string.reverse_success_without_reminder_tips)
arrayListOf(
SmsReminderUnableHandler(16.dp, binding.flContentContainer, this),
WechatReminderUnableHandler(8.dp, binding.flContentContainer, this)
)
}
smsConfig.notice && wechatConfig.isReminderEnable -> {// 短信,微信已开启
binding.tvContent.setText(R.string.reverse_success_with_reminder_tips)
arrayListOf(
SmsReminderEnableHandler(reserveReminder.smsConfig, 8.dp, binding.flContentContainer, this),
WechatReminderEnableHandler(
reserveReminder.wechatConfig.nickName,
8.dp,
binding.flContentContainer,
this
)
)
}
smsConfig.notice && !wechatConfig.isReminderEnable -> { // 短信开启,微信未开启
binding.tvContent.setText(R.string.reverse_success_with_reminder_tips)
arrayListOf(
SmsReminderEnableHandler(smsConfig, 8.dp, binding.flContentContainer, this),
WechatReminderUnableHandler(16.dp, binding.flContentContainer, this)
)
}
!smsConfig.notice && wechatConfig.isReminderEnable -> { // 微信开启,短信未开启
binding.tvContent.setText(R.string.reverse_success_with_reminder_tips)
arrayListOf(
WechatReminderEnableHandler(
wechatConfig.nickName,
8.dp,
binding.flContentContainer,
this
),
SmsReminderUnableHandler(16.dp, binding.flContentContainer, this)
)
}
else -> {
binding.tvContent.setText(R.string.reverse_success_without_reminder_tips)
arrayListOf()
}
}.let {
handlers.clear()
handlers.addAll(it)
}
handlers.forEach {
binding.flContentContainer.addView(it.init())
}
@ -232,14 +220,9 @@ class ReserveSuccessReminderDialog(
listener.changeWechatBinding()
}
override fun updateCalendarReminder() {
listener.updateCalendarReminder()
}
override fun onStart() {
super.onStart()
window?.let {
it.setDimAmount(0.4F)
it.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
val params = it.attributes
params.width = DisplayUtils.dip2px(300F)
@ -261,13 +244,6 @@ class ReserveSuccessReminderDialog(
private val Int.dp: Int
get() = DisplayUtils.dip2px(this.toFloat())
private const val SMS_REMINDER_ENABLE_TYPE = 1
private const val WECHAT_REMINDER_ENABLE_TYPE = 2
private const val CALENDAR_REMINDER_ENABLE_TYPE = 3
private const val SMS_REMINDER_UNABLE_TYPE = 4
private const val WECHAT_REMINDER_UNABLE_TYPE = 5
private const val CALENDAR_REMINDER_UNABLE_TYPE = 6
fun create(context: Context, listener: OnReserveReminderListener) =
ReserveSuccessReminderDialog(
context,
@ -384,7 +360,7 @@ class ReserveSuccessReminderDialog(
}
class WechatReminderEnableHandler(
private val wechatConfig: WechatConfigEntity,
private val nickName: String,
topMargin: Int,
parent: ViewGroup,
listener: OnReserveSuccessListener
@ -404,7 +380,7 @@ class ReserveSuccessReminderDialog(
}.root
override fun initView() {
binding.tvWechat.text = wechatConfig.nickName
binding.tvWechat.text = nickName
binding.vModifyWechat.setOnClickListener {
editWechatPop.showAsDropDown(
binding.ivModifyWechat,
@ -435,51 +411,6 @@ class ReserveSuccessReminderDialog(
}
class CalendarReminderUnableHandler(
topMargin: Int,
parent: ViewGroup,
listener: OnReserveSuccessListener
) : ReminderContentHandler(topMargin, parent, listener) {
private lateinit var binding: LayoutReserveWechatReminderUnableBinding
// 复用微信提醒未开启状态布局
override fun createView(inflater: LayoutInflater) =
LayoutReserveWechatReminderUnableBinding.inflate(inflater, parent, false)
.also {
binding = it
}.root
override fun initView() {
binding.tvWechatReminderTitle.setText(R.string.calendar_reminders)
binding.tvWechatReminderDescription.setText(R.string.calendar_reminders_description)
binding.vWechatAdd.setOnClickListener {
listener.updateCalendarReminder()
}
}
}
class CalendarReminderEnableHandler(
topMargin: Int,
parent: ViewGroup,
listener: OnReserveSuccessListener
) : ReminderContentHandler(topMargin, parent, listener) {
private lateinit var binding: LayoutReserveCalendarReminderUnableBinding
override fun createView(inflater: LayoutInflater) =
LayoutReserveCalendarReminderUnableBinding.inflate(inflater, parent, false)
.also {
binding = it
}.root
override fun initView() {
}
}
}
@ -494,6 +425,4 @@ interface OnReserveSuccessListener {
fun verifyPhoneNumber()
fun changeWechatBinding()
fun updateCalendarReminder()
}

View File

@ -17,7 +17,7 @@ import com.gh.gamecenter.common.entity.ErrorEntity
import com.gh.gamecenter.core.utils.CurrentActivityHolder
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.databinding.DialogWechatBindingFailedBinding
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.login.user.UserRepository
import com.lightgame.utils.Utils
class WechatBindingFailedDialogFragment : BaseDialogFragment() {
@ -48,10 +48,10 @@ class WechatBindingFailedDialogFragment : BaseDialogFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
UserManager.getInstance().userInfoEntity?.let {
currentUserId = it.getShortUserId()
binding.tvCurrentName.text = it.name ?: ""
binding.ivCurrentAvatar.displayAvatar(it.icon)
UserRepository.getInstance().loginUserInfo.observe(viewLifecycleOwner) {
currentUserId = it.data.getShortUserId()
binding.tvCurrentName.text = it.data.name
binding.ivCurrentAvatar.displayAvatar(it.data.icon)
binding.tvUserId.text = getString(R.string.user_id, currentUserId)
}

View File

@ -1,54 +0,0 @@
package com.gh.common.exposure
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.IExposureStateChangeListener
import com.gh.gamecenter.feature.exposure.RecyclerViewExposureHelper
import com.lightgame.utils.Utils
class DefaultExposureStateChangeListener : IExposureStateChangeListener {
override fun onExposureStateChange(
exposureEvent: ExposureEvent,
position: Int,
inExposure: Boolean
) {
val exposureStatus = if (inExposure) "曝光中" else "结束曝光"
val isCPMExposureEvent = exposureEvent.payload.miniGameType == Constants.WECHAT_MINI_GAME_CPM
Utils.log(
RecyclerViewExposureHelper.TAG,
"onExposureStateChange: 名称 ${exposureEvent.payload.gameName} 位置 $position, $exposureStatus"
)
// 如果是 CPM 曝光事件,且在曝光中,直接上报 CPM 曝光 (内部有做简单的去重处理CPM 曝光追求一个及时上报,不用理会曝光时长)
if (isCPMExposureEvent && inExposure) {
Utils.log(
RecyclerViewExposureHelper.TAG,
"上报 CPM 曝光 ${exposureEvent.payload.gameName} ${exposureEvent.id}"
)
ExposureManager.logCPM(exposureEvent)
}
if (!inExposure
&& System.currentTimeMillis() - exposureEvent.timeInMillisecond > DEFAULT_VALID_EXPOSURE_THRESHOLD
) {
Utils.log(
RecyclerViewExposureHelper.TAG,
"上报曝光 ${exposureEvent.payload.gameName} ${exposureEvent.id},是否为 CPM 小游戏 -> ${isCPMExposureEvent}" +
"曝光时长为 ${System.currentTimeMillis() - exposureEvent.timeInMillisecond}ms"
)
// 标记当前 ExposureEvent 已经被使用过
exposureEvent.markIsUsed()
ExposureManager.log(exposureEvent)
}
}
companion object {
// 默认曝光有效时长
const val DEFAULT_VALID_EXPOSURE_THRESHOLD = 1000L
}
}

View File

@ -6,7 +6,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.LayoutManager
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.feature.exposure.ExposureEvent
import io.reactivex.functions.Consumer
@ -17,9 +16,8 @@ class ExposureListener(var fragment: Fragment, var exposable: IExposable) : Recy
val throttleBus: ExposureThrottleBus by lazy {
ExposureThrottleBus(
{ commitExposure(it) },
Consumer(Throwable::printStackTrace),
{ commitExternalExposure(it) }
Consumer { commitExposure(it) },
Consumer(Throwable::printStackTrace)
)
}
var layoutManager: LayoutManager? = null
@ -31,7 +29,6 @@ class ExposureListener(var fragment: Fragment, var exposable: IExposable) : Recy
override fun onFragmentPaused(fm: FragmentManager, f: Fragment) {
if (fragment == f) {
visibleState?.let { commitExposure(it) }
visibleState?.let { commitExternalExposure(it) }
throttleBus.clear()
}
}
@ -96,43 +93,4 @@ class ExposureListener(var fragment: Fragment, var exposable: IExposable) : Recy
ExposureManager.log(eventList)
}
/**
* 提交第三方的曝光事件 微信小游戏CPM 和 DSP 游戏)
* 由于普通曝光事件的上报通道存在节流特性不符合CPM接口对于数据上报的实时性和准确性的要求所以使用额外的通道进行上报
*/
private fun commitExternalExposure(visibleState: ExposureThrottleBus.VisibleState) {
val cpmEventList = arrayListOf<ExposureEvent>()
val dspEventList = arrayListOf<ExposureEvent>()
for (pos in visibleState.firstVisiblePosition..visibleState.lastVisiblePosition) {
try {
exposable.getEventByPosition(pos)?.let {
when (it.payload.miniGameType) {
Constants.WECHAT_MINI_GAME_CPM -> cpmEventList.add(it)
Constants.DSP_GAME -> dspEventList.add(it)
else -> {
// do nothing
}
}
}
exposable.getEventListByPosition(pos)?.let { list ->
list.forEach {
when (it.payload.miniGameType) {
Constants.WECHAT_MINI_GAME_CPM -> cpmEventList.add(it)
Constants.DSP_GAME -> dspEventList.add(it)
else -> {
// do nothing
}
}
}
}
} catch (ignore: Exception) {
// Just ignore the error.
}
}
ExposureManager.logExternal(cpmEventList, dspEventList)
}
}

View File

@ -1,17 +1,12 @@
package com.gh.common.exposure
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.loghub.LoghubUtils
import com.gh.gamecenter.common.loghub.TLogHubHelper
import com.gh.gamecenter.common.utils.FixedSizeLinkedHashSet
import com.gh.gamecenter.common.utils.toJson
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.dsp.DspReportHelper
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureType
import com.gh.gamecenter.feature.minigame.wechat.WGameSubjectCPMListReportHelper
import com.google.gson.ExclusionStrategy
import com.google.gson.FieldAttributes
import com.google.gson.GsonBuilder
import com.lightgame.utils.Utils
import com.volcengine.model.tls.LogItem
@ -33,32 +28,11 @@ object ExposureManager {
private val exposureSet by lazy { hashSetOf<ExposureEvent>() }
private val exposureCache by lazy { FixedSizeLinkedHashSet<String>(300) }
private val gson by lazy {
GsonBuilder()
.addSerializationExclusionStrategy(object: ExclusionStrategy {
override fun shouldSkipClass(clazz: Class<*>): Boolean {
return false
}
override fun shouldSkipField(f: FieldAttributes): Boolean {
return f.name == "additional"
}
})
.create()
}
/**
* Log a single exposure event.
*/
fun log(event: ExposureEvent) {
AppExecutor.logExecutor.execute {
if (event.payload.miniGameType == Constants.WECHAT_MINI_GAME_CPM) {
WGameSubjectCPMListReportHelper.reportExposure(event)
} else if (event.payload.miniGameType == Constants.DSP_GAME) {
if (event.event == ExposureType.DOWNLOAD_COMPLETE) {
DspReportHelper.report(event.payload.downloadUrl)
}
}
if (!exposureCache.contains(event.id)) {
exposureSet.add(event)
exposureCache.add(event.id)
@ -85,32 +59,6 @@ object ExposureManager {
}
}
/**
* Log a collection of exposure event for external use.
*/
fun logExternal(cpmEventList: List<ExposureEvent>, dspEventList: ArrayList<ExposureEvent>) {
AppExecutor.logExecutor.execute {
if (cpmEventList.isNotEmpty()) {
WGameSubjectCPMListReportHelper.reportExposure(cpmEventList.toSet())
}
if (dspEventList.isNotEmpty()) {
for (event in dspEventList) {
DspReportHelper.report(event.payload.showUrl)
}
}
}
}
/**
* Log a wechat mini game cpm collection of exposure event.
*/
fun logCPM(event: ExposureEvent) {
AppExecutor.logExecutor.execute {
WGameSubjectCPMListReportHelper.reportExposure(event)
}
}
/**
* @param forcedUpload Ignore all restrictions.
*/
@ -131,7 +79,12 @@ object ExposureManager {
private fun uploadExposures(eventSet: HashSet<ExposureEvent>, forced: Boolean) {
eventSet.forEach {
TLogHubHelper.sendLog(buildLog(it), LOG_STORE)
val jsonExposure = it.jsonExposure
if (jsonExposure == null) {
TLogHubHelper.sendLog(buildLog(it), LOG_STORE)
} else {
LoghubUtils.log(jsonExposure, it.logStore, true)
}
// LoghubHelper.uploadLog(buildLog(it), LOG_STORE, forced)
// it.recycle()
}
@ -139,14 +92,14 @@ object ExposureManager {
private fun buildLog(event: ExposureEvent) = LogItem(System.currentTimeMillis()).apply {
addContent("__id", event.id)
addContent("payload", gson.toJson(event.payload))
addContent("payload", event.payload.toJson())
addContent("event", event.event.toString())
addContent("source", eliminateMultipleBrackets(gson.toJson(event.source)))
addContent("meta", gson.toJson(event.meta))
addContent("source", eliminateMultipleBrackets(event.source.toJson()))
addContent("meta", event.meta.toJson())
addContent("real_millisecond", event.timeInMillisecond.toString())
addContent(
"e-traces", if (event.eTrace != null) {
eliminateMultipleBrackets(gson.toJson(event.eTrace))
eliminateMultipleBrackets(event.eTrace?.toJson() ?: "")
} else ""
)
}

View File

@ -3,20 +3,16 @@ package com.gh.common.exposure
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import io.reactivex.subjects.BehaviorSubject
import io.reactivex.subjects.PublishSubject
import java.util.concurrent.TimeUnit
class ExposureThrottleBus(
var onSuccess: Consumer<VisibleState>,
var onError: Consumer<Throwable>,
onPreSuccess: Consumer<VisibleState>
) {
class ExposureThrottleBus(var onSuccess: Consumer<VisibleState>, var onError: Consumer<Throwable>) {
companion object {
private const val THRESHOLD_TIME = 300L
}
private val mPublishSubject: BehaviorSubject<VisibleState> = BehaviorSubject.create()
private val mPublishSubject: PublishSubject<VisibleState> = PublishSubject.create()
private val mCompositeDisposable: CompositeDisposable = CompositeDisposable()
init {
@ -28,7 +24,6 @@ class ExposureThrottleBus(
*/
val disposable = mPublishSubject
.distinctUntilChanged()
.doOnNext(onPreSuccess)
.throttleWithTimeout(THRESHOLD_TIME, TimeUnit.MILLISECONDS)
.subscribeOn(Schedulers.io())
.subscribe(onSuccess, onError)

View File

@ -8,13 +8,13 @@ object ExposureTraceUtils {
val traceList = arrayListOf<ExposureEvent>()
event?.let {
//这里使用 copy是为了防止循环引用调用hashCode方法触发StackOverflowError错误
val exposureCopy = it.shallowCopy()
if (exposureCopy.eTrace == null) {
traceList.add(exposureCopy)
//这里使用deepCopy是为了防止循环引用调用hashCode方法触发StackOverflowError错误
val deepCopy = it.deepCopy()
if (deepCopy.eTrace == null) {
traceList.add(deepCopy)
} else {
traceList.addAll(exposureCopy.eTrace!!)
traceList.add(flattenTrace(exposureCopy))
traceList.addAll(deepCopy.eTrace!!)
traceList.add(flattenTrace(deepCopy))
}
}

View File

@ -89,7 +89,6 @@ object ExposureUtils {
exposureEvent.payload.path = path
exposureEvent.payload.speed = speed
exposureEvent.payload.redirectedUrlList = redirectedUrlList
exposureEvent.payload.downloadUrl = gameEntity.downloadUrl
ExposureManager.log(exposureEvent)
ExposureManager.commitSavedExposureEvents(forcedUpload = true)

View File

@ -4,7 +4,6 @@ import android.annotation.SuppressLint
import com.gh.gamecenter.R
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.utils.PackageFlavorHelper
import com.gh.gamecenter.common.utils.debounceActionWithInterval
import com.gh.gamecenter.common.utils.toJson
import com.gh.gamecenter.common.utils.toObject
@ -124,16 +123,10 @@ object RegionSettingHelper {
mIsInit = false
}
val fakeIp = if (PackageFlavorHelper.IS_TEST_FLAVOR) {
SPUtils.getString(Constants.SP_TEST_FLAVOR_IP)
} else {
""
}
// 使用默认的 Schdulers.io() 可能会触发 OOM
RetrofitManager.getInstance()
.api
.getRegionSetting(HaloApp.getInstance().channel, fakeIp)
.getRegionSetting(HaloApp.getInstance().channel)
.subscribeOn(Schedulers.io())
.subscribe(object : BiResponse<RegionSetting>() {
override fun onSuccess(data: RegionSetting) {

View File

@ -1,45 +0,0 @@
package com.gh.common.fragment
import androidx.fragment.app.FragmentManager
import java.lang.reflect.Field
fun FragmentManager.popBackStackAllowStateLoss() {
popBackStackAllowStateLoss(-1, 0)
}
fun FragmentManager.popBackStackAllowStateLoss(id: Int, flags: Int) {
if (!isStateSaved) {
popBackStack(id, flags)
}
}
fun FragmentManager.popBackStackAllowStateLoss(name: String?, flags: Int) {
if (!isStateSaved) {
popBackStack(name, flags)
}
}
fun FragmentManager.popBackStackImmediateAllowStateLoss() = popBackStackAllowStateLoss(-1, 0)
fun FragmentManager.popBackStackImmediateAllowStateLoss(id: Int, flags: Int) =
if (!isStateSaved) {
popBackStackImmediate(id, flags)
} else {
false
}
@Throws(NoSuchFieldException::class)
private fun getField(clazz: Class<*>, name: String): Field {
var cls: Class<*>? = clazz
while (cls != null) {
try {
val declaredField = cls.getDeclaredField(name)
declaredField.isAccessible = true
return declaredField
} catch (e: NoSuchFieldException) {
e.printStackTrace()
}
cls = cls.superclass
}
throw NoSuchFieldException()
}

View File

@ -7,20 +7,19 @@ import androidx.room.TypeConverters
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
import com.gh.gamecenter.entity.GamesCollectionEntity
import com.gh.gamecenter.entity.HistoryGameDetailEntity
import com.gh.gamecenter.entity.HistoryGameEntity
import com.gh.gamecenter.entity.MyVideoEntity
import com.gh.gamecenter.feature.entity.NewsEntity
import com.gh.gamecenter.feature.entity.AnswerEntity
import com.gh.gamecenter.feature.entity.ArticleEntity
import com.gh.gamecenter.feature.entity.NewsEntity
import com.gh.gamecenter.feature.room.converter.*
import com.gh.gamecenter.room.converter.*
import com.gh.gamecenter.room.dao.*
import com.halo.assistant.HaloApp
@Database(
entities = [AnswerEntity::class, ArticleEntity::class, NewsEntity::class, HistoryGameEntity::class, MyVideoEntity::class, GamesCollectionEntity::class, HistoryGameDetailEntity::class],
version = 15,
entities = [AnswerEntity::class, ArticleEntity::class, NewsEntity::class, HistoryGameEntity::class, MyVideoEntity::class, GamesCollectionEntity::class],
version = 14,
exportSchema = false
)
@TypeConverters(
@ -54,7 +53,6 @@ abstract class HistoryDatabase : RoomDatabase() {
abstract fun gameDao(): GameDao
abstract fun videoHistoryDao(): VideoHistoryDao
abstract fun gamesCollectionDao(): GamesCollectionDao
abstract fun gameDetailDao(): GameDetailHistoryDao
companion object {
@ -154,12 +152,6 @@ abstract class HistoryDatabase : RoomDatabase() {
}
}
val MIGRATION_14_15: Migration = object : Migration(14, 15) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("CREATE TABLE HistoryGameDetailEntity (id TEXT NOT NULL PRIMARY KEY, name TEXT DEFAULT '')")
}
}
val instance by lazy {
Room.databaseBuilder(
HaloApp.getInstance().application,
@ -178,7 +170,6 @@ abstract class HistoryDatabase : RoomDatabase() {
.addMigrations(MIGRATION_11_12)
.addMigrations(MIGRATION_12_13)
.addMigrations(MIGRATION_13_14)
.addMigrations(MIGRATION_14_15)
.build()
}
}

View File

@ -44,20 +44,6 @@ object HistoryHelper {
runOnIoThread { tryCatchInRelease { HistoryDatabase.instance.gameDao().addGame(historyGameEntity) } }
}
@JvmStatic
fun insertGameDetail(gameEntity: GameEntity) {
val historyGameDetailEntity = HistoryGameDetailEntity(gameEntity.id, gameEntity.name)
runOnIoThread { tryCatchInRelease { HistoryDatabase.instance.gameDetailDao().addGame(historyGameDetailEntity) } }
}
@JvmStatic
fun getHistoryGameDetailById(id: String): HistoryGameDetailEntity? =
try {
HistoryDatabase.instance.gameDetailDao().getHistoryGameDetailById(id)
} catch (e: Throwable) {
null
}
private fun convertGameUpdateEntityToHistoryGameEntity(updateEntity: GameUpdateEntity): HistoryGameEntity {
val historyGame = HistoryGameEntity()
@ -156,15 +142,6 @@ object HistoryHelper {
}
}
@JvmStatic
fun deleteGameDetailEntity(gameId: String) {
runOnIoThread {
tryCatchInRelease {
HistoryDatabase.instance.gameDetailDao().deleteGame(HistoryGameDetailEntity(id = gameId))
}
}
}
@JvmStatic
fun emptyDatabase() {

View File

@ -1,9 +1,12 @@
package com.gh.common.iinterface
import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.constant.RefreshState
interface ISmartRefreshContent {
/**
* 启用/关闭 页面滑动
* @param isScrollEnabled 是否启用
*/
fun setScrollEnabled(isScrollEnabled: Boolean)
fun onRefresh()
/**
@ -11,6 +14,4 @@ interface ISmartRefreshContent {
* @param isSwipeRefreshEnabled 是否启用
*/
fun setSwipeRefreshEnabled(isSwipeRefreshEnabled: Boolean)
fun onStateChanged(refreshLayout: RefreshLayout, oldState: RefreshState, newState: RefreshState)
}

View File

@ -1,29 +0,0 @@
package com.gh.common.interceptor
import com.gh.gamecenter.common.constant.RouteConsts
import com.halo.assistant.HaloApp
import com.therouter.router.RouteItem
import com.therouter.router.interceptor.RouterReplaceInterceptor
import com.therouter.router.matchRouteMap
/**
* 主拦截器
*/
class MainInterceptor: RouterReplaceInterceptor() {
override fun replace(routeItem: RouteItem?): RouteItem? {
if (routeItem == null) return null
// 用户是否已经同意隐私政策
val isUserAcceptPrivacyPolicy = HaloApp.isUserAcceptPrivacyPolicy(HaloApp.getInstance())
// 如果用户已经同意隐私政策并且应用已经启动,直接返回 routeItem ,运行跳转
if (isUserAcceptPrivacyPolicy && HaloApp.getInstance().isAlreadyUpAndRunning) {
return routeItem
}
// 指向调整为 SplashScreenActivity
return matchRouteMap(RouteConsts.activity.splashActivity)
}
}

View File

@ -103,6 +103,7 @@ class AccelerateNotificationHandler(priority: Int) : PriorityChainHandler(priori
context = activity,
gameId = gameEntity.id,
entrance = "首页插件上架弹窗",
defaultTab = -1,
isSkipGameComment = false,
scrollToLibao = false,
openVideoStreaming = false,

View File

@ -59,7 +59,7 @@ class CustomFloatingWindowHandler(priority: Int) : PriorityChainHandler(priority
override fun onProcess(): Boolean {
when (getStatus()) {
STATUS_VALID -> {
_showFloatingAction.postValue(Event(data))
_showFloatingAction.value = Event(data)
return true
// floatingWindowProvider.showFloatingWindowOnly(
// mFragment!!,

View File

@ -64,8 +64,7 @@ object GlobalPriorityChainHelper : ISuperiorChain {
* 预启动所有的优先级弹窗管理链
*/
fun preStart(withSpecialDelay: Boolean) {
val launchRedirectHandler = LaunchRedirectHandler(-102)
val membershipExpiredHandler = MembershipExpiredHandler(-101)
val launchRedirectHandler = LaunchRedirectHandler(-101)
val updateDialogHandler = UpdateDialogHandler(-100)
val privacyPolicyDialogHandler = PrivacyPolicyDialogHandler(-99)
val notificationPermissionDialogHandler = NotificationPermissionDialogHandler(0)
@ -75,7 +74,6 @@ object GlobalPriorityChainHelper : ISuperiorChain {
val resumeDownloadHandler = ResumeDownloadHudHandler(4)
mainChain.addHandler(launchRedirectHandler)
mainChain.addHandler(membershipExpiredHandler)
mainChain.addHandler(updateDialogHandler)
mainChain.addHandler(privacyPolicyDialogHandler)
mainChain.addHandler(welcomeDialogHandler)
@ -85,7 +83,6 @@ object GlobalPriorityChainHelper : ISuperiorChain {
mainChain.addHandler(resumeDownloadHandler)
launchRedirectHandler.doPreProcess()
membershipExpiredHandler.doPreProcess()
updateDialogHandler.doPreProcess()
// 首次启动延迟 300ms保证请求首次启动时已经获取到了 GID 、 OAID 等标记

View File

@ -5,7 +5,6 @@ import com.gh.common.util.DirectUtils
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.common.entity.LaunchRedirect
import com.gh.gamecenter.common.entity.LaunchRedirectWrapper
import com.gh.gamecenter.common.pagelevel.PageLevelManager
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.utils.singleToMain
import com.gh.gamecenter.core.AppExecutor
@ -66,11 +65,9 @@ class LaunchRedirectHandler(priority: Int) : PriorityChainHandler(priority) {
override fun onProcess(): Boolean {
val currentActivity = CurrentActivityHolder.getCurrentActivity()
if (GlobalPriorityChainHelper.isThisActivityValid(currentActivity) && launchData?.type != "bottom_tab") {
if (GlobalPriorityChainHelper.isThisActivityValid(currentActivity)) {
if (getStatus() == STATUS_VALID) {
// 设置下一个页面为顶级页面
PageLevelManager.setNextPageAsSupremePageLevel()
// 当 type 为 "bottom_tab" 时上面 doPreProcess 中已经处理过了,但再选中一次好像也没有什么问题,先不特殊处理这个 case 了
DirectUtils.directToLinkPage(currentActivity!!, launchData!!, "首次启动跳转", "")
// 跳转页面不管回调,延迟 500ms 后执行下一个 handler
AppExecutor.uiExecutor.executeWithDelay({

View File

@ -1,80 +0,0 @@
package com.gh.common.prioritychain
import android.os.Bundle
import androidx.fragment.app.FragmentActivity
import com.gh.common.dialog.AccelerateExpirationDialogFragment
import com.gh.gamecenter.common.constant.Constants.SP_ACCELERATOR_MEMBERSHIP_EXPIRED
import com.gh.gamecenter.core.utils.CurrentActivityHolder
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.login.user.UserRepository
import com.halo.assistant.accelerator.repository.AcceleratorDataHolder
class MembershipExpiredHandler(priority: Int) : PriorityChainHandler(priority) {
fun doPreProcess() {
UserRepository.getInstance().setAutoLoginListener {
val hasShow = SPUtils.getBoolean(SP_ACCELERATOR_MEMBERSHIP_EXPIRED)
val vipEntity = AcceleratorDataHolder.instance.vipEntity
if (getStatus() == STATUS_PENDING) {
if (vipEntity == null ||
vipEntity.vipStatus ||
vipEntity.isNewUser ||
vipEntity.isVipRefundUser ||
vipEntity.isDurationRefundUser ||
hasShow
) {
processNext()
} else {
updateStatus(STATUS_VALID)
process()
}
} else {
if (vipEntity == null ||
vipEntity.vipStatus ||
vipEntity.isNewUser ||
vipEntity.isVipRefundUser ||
vipEntity.isDurationRefundUser ||
hasShow
) {
updateStatus(STATUS_INVALID)
} else {
updateStatus(STATUS_VALID)
}
}
}
}
override fun onProcess(): Boolean {
val currentActivity = CurrentActivityHolder.getCurrentActivity()
if (GlobalPriorityChainHelper.isThisActivityValid(currentActivity)) {
when (getStatus()) {
STATUS_VALID -> {
val reminder = AccelerateExpirationDialogFragment.ExpirationReminder.TimeRunsOut("")
SPUtils.setBoolean(SP_ACCELERATOR_MEMBERSHIP_EXPIRED, true)
val dialogFragment = AccelerateExpirationDialogFragment().apply {
arguments = Bundle().apply {
putParcelable(
AccelerateExpirationDialogFragment.KEY_EXPIRATION_REMINDER, reminder
)
}
}
dialogFragment.dialog?.setOnDismissListener {
processNext()
}
dialogFragment.show(
(currentActivity as FragmentActivity).supportFragmentManager,
AccelerateExpirationDialogFragment::class.java.name
)
return true
}
STATUS_INVALID -> {
processNext()
}
}
}
return false
}
}

View File

@ -0,0 +1,18 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.ActivationHelper
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IActivationProvider
@Route(path = RouteConsts.provider.activation, name = "ActivationHelper暴露服务")
class ActivationProviderImpl : IActivationProvider {
override fun init(context: Context?) {
// Do nothing
}
override fun sendActivationInfo() {
ActivationHelper.sendActivationInfo()
}
}

View File

@ -0,0 +1,19 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.AdHelper
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.entity.SettingsEntity
import com.gh.gamecenter.feature.provider.IAdHelperProvider
@Route(path = RouteConsts.provider.adHelper, name = "AdHelper暴露服务")
class AdHelperProviderImpl : IAdHelperProvider {
override fun getSuggestionFunctionAd(): SettingsEntity.AD? {
return AdHelper.getAd(AdHelper.LOCATION_SUGGESTION_FUNCTION)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,15 +1,20 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.R
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IAppProvider
import com.gh.gamecenter.core.provider.IFlavorProvider
import com.gh.gamecenter.va.VCore
import com.halo.assistant.HaloApp
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.app, name = "Application暴露服务")
class AppProviderImpl : IAppProvider {
override fun init(context: Context?) {
// Do nothing
}
override fun getAppName(): String {
return HaloApp.getInstance().getString(R.string.app_name)
@ -88,5 +93,4 @@ class AppProviderImpl : IAppProvider {
override fun initImageLoaderIfNeeded() {
HaloApp.getInstance().initFresco()
}
}

View File

@ -1,15 +1,16 @@
package com.gh.common.provider
import android.content.Context
import android.view.View
import android.widget.LinearLayout
import android.widget.TextView
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.databind.BindingAdapters
import com.gh.gamecenter.common.databinding.LayoutGameItemSellingPointBinding
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.provider.IBindingAdaptersProvider
import com.gh.gamecenter.home.custom.adapter.CustomViewExt
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.bindingAdapters, name = "BindingAdapters暴露服务")
class BindingAdaptersProviderImpl : IBindingAdaptersProvider {
override fun setGameName(
view: TextView,
@ -20,7 +21,7 @@ class BindingAdaptersProviderImpl : IBindingAdaptersProvider {
}
override fun setGameTags(layout: LinearLayout, gameEntity: GameEntity) {
BindingAdapters.setGameTags(layout, gameEntity, "")
BindingAdapters.setGameTags(layout, gameEntity)
}
override fun setMessageUnread(view: TextView, unreadCount: Int) {
@ -31,16 +32,7 @@ class BindingAdaptersProviderImpl : IBindingAdaptersProvider {
BindingAdapters.setGame(view, gameEntity)
}
override fun setGameTagsWithSellingPoints(
layout: LinearLayout,
sellingPointsBinding: LayoutGameItemSellingPointBinding,
gameEntity: GameEntity,
subjectTag: String
) {
BindingAdapters.setGameTagsWithSellingPoint(layout, sellingPointsBinding, gameEntity, subjectTag)
}
override fun setGameDescription(tvDesc: TextView, briefStyle: String, game: GameEntity) {
CustomViewExt.setDescription(tvDesc, briefStyle, game)
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,9 +1,12 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.download.server.BrowserInstallHelper
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IBrowserInstallHelperProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.browserInstallHelper, name = "BrowserInstallHelper暴露服务")
class BrowserInstallHelperProviderImpl : IBrowserInstallHelperProvider {
override fun isUseBrowserToInstallEnabled(): Boolean = BrowserInstallHelper.isUseBrowserToInstallEnabled()
@ -12,4 +15,9 @@ class BrowserInstallHelperProviderImpl : IBrowserInstallHelperProvider {
override fun logSwitchInstallSettingEvent() {
BrowserInstallHelper.logOrdinaryBrowserEvent(BrowserInstallHelper.Type.SWITCH_INSTALL_SETTING)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,10 +1,17 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IBuildConfigProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.buildConfig, name = "BuildConfig暴露服务")
class BuildConfigImpl : IBuildConfigProvider {
override fun init(context: Context?) {
// Do nothing
}
override fun getApplicationId(): String = BuildConfig.APPLICATION_ID
override fun getVersionName(): String = BuildConfig.VERSION_NAME
@ -26,11 +33,5 @@ class BuildConfigImpl : IBuildConfigProvider {
override fun getVDevApiHost(): String = BuildConfig.DEV_VAPI_HOST
override fun getWGameCPMApiHost(): String = BuildConfig.WGAME_CPM_API_HOST
override fun getWGameCPMBusiAppId(): String = BuildConfig.WGAME_CPM_BUSIAPPID
override fun getLogProducerProject(): String = BuildConfig.LOG_HUB_PROJECT
override fun getDspApiHost(): String = BuildConfig.DSP_API_HOST
}

View File

@ -1,12 +1,18 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.CheckLoginUtils
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.ICheckLoginProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.checkLogin, name = "CheckLoginUtils暴露服务")
class CheckLoginProviderImpl : ICheckLoginProvider {
override fun checkLogin(context: Context, entrance: String, action: (() -> Unit)?) {
CheckLoginUtils.checkLogin(context, entrance, action)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -3,16 +3,20 @@ package com.gh.common.provider
import android.content.Context
import android.content.Intent
import android.os.Parcelable
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.CommentDetailActivity
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.provider.ICommentDetailProvider
import com.gh.gamecenter.feature.entity.MessageEntity
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.commentDetail, name = "CommentDetailActivity暴露服务")
class CommentDetailProviderImpl : ICommentDetailProvider {
override fun getIntent(context: Context, commentId: String?, message: Parcelable): Intent {
return CommentDetailActivity.getIntent(context, commentId, message as MessageEntity.Article)
}
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,14 +1,18 @@
package com.gh.common.provider
import android.content.Context
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.ICommentManagerProvider
import com.gh.gamecenter.manager.CommentManager
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.commentManager, name = "CommentManager暴露服务")
class CommentManagerProviderImpl : ICommentManagerProvider {
override fun addUrl(ids: String) {
CommentManager.getInstance().addUrl(ids)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -2,12 +2,12 @@ package com.gh.common.provider
import android.content.Context
import android.widget.TextView
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.CommentUtils
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.provider.ICommentUtilsProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.commentUtils, name = "CommentUtils暴露服务")
class CommentUtilsProviderImpl : ICommentUtilsProvider {
override fun setCommentTime(textView: TextView, time: Long) {
CommentUtils.setCommentTime(textView, time)
@ -16,4 +16,8 @@ class CommentUtilsProviderImpl : ICommentUtilsProvider {
override fun getCommentTime(timestamp: Long): String {
return CommentUtils.getCommentTime(timestamp)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -8,7 +8,7 @@ import android.widget.LinearLayout
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.viewbinding.ViewBinding
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.facebook.drawee.view.SimpleDraweeView
import com.gh.common.util.ConcernContentUtils
import com.gh.common.view.ImageContainerView
@ -18,7 +18,7 @@ import com.gh.gamecenter.common.utils.toArrayList
import com.gh.gamecenter.core.provider.IConcernArticleUtilsProvider
import com.gh.gamecenter.databinding.RecyclerGameArticleBinding
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.concernContentUtils, name = "ConcernContentUtils暴露服务")
class ConcernArticleUtilsProviderImpl : IConcernArticleUtilsProvider {
override fun addContentPic(
context: Context,
@ -95,4 +95,8 @@ class ConcernArticleUtilsProviderImpl : IConcernArticleUtilsProvider {
override fun getTvComment(binding: ViewBinding): TextView = (binding as RecyclerGameArticleBinding).tvComment
override fun getTvShare(binding: ViewBinding): TextView = (binding as RecyclerGameArticleBinding).tvShare
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -6,14 +6,14 @@ import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.viewbinding.ViewBinding
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.core.provider.IConcernGiftPackUtilsProvider
import com.gh.gamecenter.databinding.RecyclerGiftPackBinding
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.concernGiftPackUtils, name = "ConcernGiftPackUtils暴露服务")
class ConcernGiftPackUtilsProviderImpl : IConcernGiftPackUtilsProvider {
override fun createBinding(parent: ViewGroup): ViewBinding {
val inflater = LayoutInflater.from(parent.context)
@ -48,4 +48,7 @@ class ConcernGiftPackUtilsProviderImpl : IConcernGiftPackUtilsProvider {
override fun getTvGiftPackContent(viewBinding: ViewBinding) =
(viewBinding as RecyclerGiftPackBinding).tvGiftPackContent
}
override fun init(context: Context?) {
// Do Nothing
}
}

View File

@ -2,15 +2,19 @@ package com.gh.common.provider
import android.content.Context
import android.content.Intent
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.ConcernActivity
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IConcernProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.concernActivity, name = "ConcernActivity暴露服务")
class ConcernProviderImpl : IConcernProvider {
override fun getIntent(context: Context, entrance: String): Intent {
return ConcernActivity.getIntent(context, entrance)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -2,14 +2,18 @@ package com.gh.common.provider
import android.content.Context
import androidx.appcompat.app.AppCompatActivity
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IConcernShareNewsProvider
import com.gh.gamecenter.newsdetail.NewsShareDialog
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.concernShareNews, name = "ConcernShareNews暴露服务")
class ConcernShareNewsProviderImpl : IConcernShareNewsProvider {
override fun share(activity: AppCompatActivity, shortId: String?, id: String?, gameIcon: String?, title: String?) {
NewsShareDialog.show(activity, shortId, id, gameIcon, title)
}
override fun init(context: Context?) {
// Do Nothing
}
}

View File

@ -1,9 +1,12 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.constant.Config
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IConfigProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.config, name = "Config暴露服务")
class ConfigProviderImpl : IConfigProvider {
override fun getTencentAppId(): String {
return Config.TENCENT_APPID
@ -100,4 +103,8 @@ class ConfigProviderImpl : IConfigProvider {
override fun isJiguangSwitch(): Boolean {
return Config.getNewApiSettingsEntity()?.jiguangSwitch ?: false
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,12 +1,19 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.constant.Config
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.entity.SettingsEntity
import com.gh.gamecenter.feature.provider.IConfigSettingProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.configSetting, name = "Config.getSettings暴露服务")
class ConfigSettingProviderImpl : IConfigSettingProvider {
override fun getSettings(): SettingsEntity? {
return Config.getSettings()
}
override fun init(context: Context?) {
// do nothing
}
}

View File

@ -1,58 +0,0 @@
package com.gh.common.provider
import android.content.Context
import android.content.Intent
import android.net.Uri
import com.gh.gamecenter.CropImageActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.core.provider.ICropImageProvider
import com.gh.gamecenter.personalhome.background.BackgroundClipActivity
import com.halo.assistant.fragment.user.UserPortraitCropImageActivity
import com.lightgame.utils.Utils
import com.zhihu.matisse.internal.utils.PathUtils
@com.therouter.inject.ServiceProvider
class CropImageProviderImpl : ICropImageProvider {
override fun getCropImageIntent(data: List<Uri>, imageType: Int, entrance: String, context: Context): Intent? {
if (data.isEmpty()) {
return null
}
val picturePath = PathUtils.getPath(context, data[0])
Utils.log("picturePath = $picturePath")
return when (imageType) {
IMAGE_TYPE_AVATAR -> {// 上传头像
UserPortraitCropImageActivity.getIntent(
context,
picturePath,
"我的光环(选择头像)"
)
}
IMAGE_TYPE_GAME_COLLECTION_COVER -> {// 游戏单封面
CropImageActivity.getIntent(
context,
picturePath,
142 / 328F,
false,
R.layout.layout_game_collection_crop_image_assist,
entrance
)
}
IMAGE_TYPE_PERSONAL_BACKGROUND -> { // 用户主页背景
BackgroundClipActivity.getIntent(context, picturePath, entrance)
}
else ->
null
}
}
companion object {
const val IMAGE_TYPE_AVATAR = 1
const val IMAGE_TYPE_GAME_COLLECTION_COVER = 2
const val IMAGE_TYPE_PERSONAL_BACKGROUND = 3
}
}

View File

@ -1,12 +1,12 @@
package com.gh.common.provider
import android.content.Context
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.DataCollectionUtils
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.provider.IDataCollectionProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.dataCollection, name = "DataCollectionUtils暴露服务")
class DataCollectionProviderImpl : IDataCollectionProvider {
override fun uploadClick(context: Context, vararg args: String) {
DataCollectionUtils.uploadClick(context, *args)
@ -15,4 +15,8 @@ class DataCollectionProviderImpl : IDataCollectionProvider {
override fun uploadConcern(context: Context, vararg args: String) {
DataCollectionUtils.uploadConcern(context, *args)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,12 +1,20 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.DataUtils
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IDataUtilsProvider
import com.halo.assistant.HaloApp
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.dataUtils, name = "DataUtils暴露服务")
class DataUtilsProviderImpl : IDataUtilsProvider {
override fun getDeviceCertification() {
DataUtils.getDeviceCertification(HaloApp.getInstance().gid)
}
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,12 +1,12 @@
package com.gh.common.provider
import android.content.Context
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.DefaultUrlHandler
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IDefaultUrlHandlerProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.defaultUrlHandler, name = "DefaultUrlHandler暴露服务")
class DefaultUrlHandlerProviderImpl : IDefaultUrlHandlerProvider {
override fun interceptUrl(
@ -19,4 +19,7 @@ class DefaultUrlHandlerProviderImpl : IDefaultUrlHandlerProvider {
return DefaultUrlHandler.interceptUrl(context, url, null, entrance, bringAppToFront, sourceEntrance)
}
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -2,12 +2,14 @@ package com.gh.common.provider
import android.app.Dialog
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.DialogUtils
import com.gh.gamecenter.common.callback.CancelListener
import com.gh.gamecenter.common.callback.ConfirmListener
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IDialogUtilsProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.dialogUtils, name = "DialogUtils暴露服务")
class DialogUtilsProviderImpl : IDialogUtilsProvider {
override fun showRegulationTestDialog(context: Context, confirm: () -> Unit, cancel: () -> Unit) {
DialogUtils.showRegulationTestDialog(context, object : ConfirmListener {
@ -43,4 +45,8 @@ class DialogUtilsProviderImpl : IDialogUtilsProvider {
}
override fun showBindPhoneDialog(context: Context, confirm: () -> Unit): Dialog = DialogUtils.showBindPhoneDialog(context) { confirm.invoke() }
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -3,12 +3,12 @@ package com.gh.common.provider
import android.app.Activity
import android.content.Context
import android.os.Bundle
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IDirectProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.directUtils, name = "DirectUtils暴露服务")
class DirectProviderImpl : IDirectProvider {
override fun directToWebView(context: Context, url: String, entrance: String?) {
@ -62,13 +62,7 @@ class DirectProviderImpl : IDirectProvider {
DirectUtils.directToCommunityArticle(context, articleId, communityId, entrance, path, sourceEntrance)
}
override fun directToVideoDetail(
context: Context,
videoId: String,
entrance: String?,
path: String?,
sourceEntrance: String
) {
override fun directToVideoDetail(context: Context, videoId: String, entrance: String?, path: String?, sourceEntrance: String) {
DirectUtils.directToVideoDetail(context, videoId, entrance, path, sourceEntrance)
}
@ -84,16 +78,15 @@ class DirectProviderImpl : IDirectProvider {
DirectUtils.directToQQGameById(activity, qqAppId)
}
override fun directToWechatGameById(
activity: Activity,
wechatAppId: String,
wechatAppPath: String,
wechatAppExtData: String
) {
DirectUtils.directToWechatGameById(activity, wechatAppId, wechatAppPath, wechatAppExtData)
override fun directToWechatGameById(activity: Activity, qqAppId: String) {
DirectUtils.directToWechatGameById(activity, qqAppId)
}
override fun directToExternalBrowser(context: Context, url: String) {
DirectUtils.directToExternalBrowser(context, url)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,9 +1,10 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.NewFlatLogUtils
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.entity.GameUpdateEntity
@ -13,11 +14,10 @@ import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.provider.IDownloadButtonClickedProvider
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.packagehelper.PackageRepository
import com.halo.assistant.HaloApp
import com.lightgame.download.DownloadEntity
import com.lightgame.utils.Utils
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.downloadButtonClickedHandler, name = "DownloadButton点击事件暴露服务")
class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
override fun onClicked(downloadButton: DownloadButton) {
var gameId = ""
@ -30,11 +30,6 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
var packageName = ""
var exposureSourceList: List<ExposureSource>? = null
var customPageTrackData: CustomPageTrackData? = null
var isAd = false
var adGroupId = ""
val pushMessageId = (HaloApp.get(Constants.PUSH_MESSAGE_ID, false) as? String) ?: ""
val pushLinkId = (HaloApp.get(Constants.PUSH_LINK_ENTITY, false) as? LinkEntity)?.link ?: ""
val isFromPush = pushMessageId.isNotEmpty()
val boundedObject = downloadButton.getObject()
@ -62,8 +57,6 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
packageName = boundedObject.getUniquePackageName() ?: ""
exposureSourceList = boundedObject.exposureEvent?.source
customPageTrackData = boundedObject.customPageTrackData
isAd = boundedObject.adGroupId.isNotEmpty()
adGroupId = boundedObject.adGroupId
}
is GameUpdateEntity -> {
@ -122,14 +115,6 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
"本地下载"
}
// 小游戏的启动不需要上报下载点击事件
// @see https://jira.shanqu.cc/browse/GHZSCY-7013 & https://jira.shanqu.cc/browse/GHZSCY-7918
if (boundedObject is GameEntity
&& (boundedObject.isMiniGame() || boundedObject.isDspGame)
) {
return
}
// 上报神策点击事件
val customPageKV = customPageTrackData?.toKV() ?: arrayOf()
SensorsBridge.trackEventWithExposureSource(
@ -139,7 +124,7 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
"game_name", gameName,
"game_type", gameTypeInChinese,
"download_status", downloadStatusInChinese,
"button_name", text,
"button_name", downloadButton.text,
"game_schema_type", gameSchemaType,
"download_type", downloadType,
"page_name", GlobalActivityManager.getCurrentPageEntity().pageName,
@ -148,15 +133,14 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
"last_page_name", GlobalActivityManager.getLastPageEntity().pageName,
"last_page_id", GlobalActivityManager.getLastPageEntity().pageId,
"last_page_business_id", GlobalActivityManager.getLastPageEntity().pageBusinessId,
"is_ad", isAd.toString(),
"ad_group_id", adGroupId,
"is_from_push_notifications", isFromPush,
"message_id", pushMessageId,
"link_id", pushLinkId,
*customPageKV
)
}
}
}
override fun init(context: Context?) {
// do nothing
}
}

View File

@ -1,10 +1,13 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.download.DownloadManager
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IDownloadManagerProvider
import com.lightgame.download.DownloadEntity
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.downloadManager, name = "DownloadManager暴露服务")
class DownloadManagerProviderImpl : IDownloadManagerProvider {
override fun getDownloadEntityByUrl(url: String): DownloadEntity? {
@ -15,4 +18,8 @@ class DownloadManagerProviderImpl : IDownloadManagerProvider {
DownloadManager.getInstance().resumeAllInvisiblePendingTask()
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -5,16 +5,15 @@ import android.content.Intent
import android.os.Build
import android.os.Bundle
import androidx.fragment.app.FragmentActivity
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.EntranceUtils
import com.gh.gamecenter.common.avoidcallback.Callback
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IEntranceUtilsProvider
import com.lightgame.utils.AppManager
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.entranceUtils, name = "EntranceUtils暴露服务")
class EntranceUtilsProviderImpl : IEntranceUtilsProvider {
override fun jumpActivity(context: Context, bundle: Bundle) {
EntranceUtils.jumpActivity(context, bundle)
}
@ -33,6 +32,10 @@ class EntranceUtilsProviderImpl : IEntranceUtilsProvider {
} else {
EntranceUtils.jumpActivityCompat(AppManager.getInstance().currentActivity(), bundle)
}
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,11 +1,14 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.ErrorHelper
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IErrorHelperProvider
import com.gh.gamecenter.login.user.LoginTag
import retrofit2.HttpException
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.errorHelper, name = "ErrorHelper暴露服务")
class ErrorHelperProviderImpl : IErrorHelperProvider {
override fun handleError(
@ -25,4 +28,7 @@ class ErrorHelperProviderImpl : IErrorHelperProvider {
ErrorHelper.handleLoginError(context, httpException, loginTagChinese, isCertificate)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,16 +1,20 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.exposure.ExposureManager
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.provider.IExposureManagerProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.exposureManager, name = "ExposureManager暴露服务")
class ExposureManagerProviderImpl: IExposureManagerProvider {
override fun logExposure(exposureEvent: ExposureEvent) {
ExposureManager.log(exposureEvent)
}
override fun logExposureList(exposureEventList: List<ExposureEvent>) {
ExposureManager.log(exposureEventList)
override fun init(context: Context?) {
// do nothing
}
}

View File

@ -1,11 +1,18 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.FixedRateJobHelper
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IFixedRateJobHelperProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.fixedRateJobHelper, name = "FixedRateJobHelper暴露服务")
class FixedRateJobHelperProviderImpl : IFixedRateJobHelperProvider {
override fun getTimeDeltaBetweenServerAndClient(): Long {
return FixedRateJobHelper.timeDeltaBetweenServerAndClient
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -2,16 +2,23 @@ package com.gh.common.provider
import android.content.Context
import android.content.Intent
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.provider.IGameCollectionDetailProvider
import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailActivity
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.gameCollectionDetail, name = "GameCollectionDetailActivity暴露服务")
class GameCollectionDetailProviderImpl : IGameCollectionDetailProvider {
override fun getIntent(context: Context, gameCollectionId: String, isFromSquare: Boolean, entrance: String): Intent {
return GameCollectionDetailActivity.getIntent(context, gameCollectionId, isFromSquare, entrance)
override fun getIntent(context: Context, gameCollectionId: String, isFromSquare: Boolean): Intent {
return GameCollectionDetailActivity.getIntent(context, gameCollectionId, isFromSquare)
}
override fun getSpecifiedCommentIntent(context: Context, gameCollectionId: String, topCommentId: String, entrance: String): Intent {
return GameCollectionDetailActivity.getSpecifiedCommentIntent(context, gameCollectionId, topCommentId, entrance)
override fun getSpecifiedCommentIntent(context: Context, gameCollectionId: String, topCommentId: String): Intent {
return GameCollectionDetailActivity.getSpecifiedCommentIntent(context, gameCollectionId, topCommentId)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,12 +1,14 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.provider.IGameDetailProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.gameDetail, name = "GameDetailActivity暴露服务")
class GameDetailProviderImpl : IGameDetailProvider {
override fun startGameDetailActivity(
context: Context,
@ -52,6 +54,7 @@ class GameDetailProviderImpl : IGameDetailProvider {
context: Context,
gameId: String,
entrance: String?,
defaultTab: Int,
isSkipGameComment: Boolean,
scrollToLibao: Boolean,
openVideoStreaming: Boolean,
@ -62,6 +65,7 @@ class GameDetailProviderImpl : IGameDetailProvider {
context,
gameId,
entrance,
defaultTab,
isSkipGameComment,
scrollToLibao,
openVideoStreaming,
@ -69,4 +73,8 @@ class GameDetailProviderImpl : IGameDetailProvider {
traceEvent
)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,14 +1,18 @@
package com.gh.common.provider
import android.content.Context
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.GameTrendsHelper
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IGameTrendsHelperProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.gameTrendsHelper, name = "GameTrendsHelper暴露服务")
class GameTrendsHelperProviderImpl : IGameTrendsHelperProvider {
override fun updateReadPostTime() {
GameTrendsHelper.updateReadPostTime()
}
override fun init(context: Context?) {
// do nothing
}
}

View File

@ -1,14 +1,17 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.filter.RegionSettingHelper
import com.gh.gamecenter.feature.utils.ApkActiveUtils
import com.gh.download.DownloadManager
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.utils.countOccurrences
import com.gh.gamecenter.core.provider.IHandleGameResponseProvider
import com.gh.gamecenter.feature.entity.GameEntity
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.handleGameResponse, name = "处理游戏类型返回")
class HandleGameResponseProviderImpl : IHandleGameResponseProvider {
override fun handleGameResponse(response: List<Any>, entrance: String): List<Any> {
@ -34,4 +37,8 @@ class HandleGameResponseProviderImpl : IHandleGameResponseProvider {
return response
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,11 +1,18 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.history.HistoryHelper
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IHistoryHelperProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.historyHelper, name = "HistoryHelper暴露服务")
class HistoryHelperProviderImpl : IHistoryHelperProvider {
override fun emptyDatabase() {
HistoryHelper.emptyDatabase()
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,59 +0,0 @@
package com.gh.common.provider
import com.gh.common.util.PackageUtils
import android.annotation.SuppressLint
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.utils.singleToMain
import com.gh.gamecenter.core.provider.IAcceleratorDataHolderProvider
import com.gh.gamecenter.feature.entity.BaseEntity
import com.gh.gamecenter.feature.entity.VipEntity
import com.gh.gamecenter.login.retrofit.RetrofitManager
import com.gh.gamecenter.login.user.UserManager
import com.halo.assistant.accelerator.repository.AcceleratorDataHolder
@com.therouter.inject.ServiceProvider
class IAcceleratorDataHolderProviderImpl : IAcceleratorDataHolderProvider {
override fun isPaidVip(): Boolean =
AcceleratorDataHolder.instance.isPaidVip
override fun getGhVersionName(): String {
return PackageUtils.getGhVersionName()
}
/**
* 请注意,由于光环后端无法获取 奇游时长套餐 加速时长,这里的 vipStatus不准
* 这里只做参考具体的状态需要奇游sdk提供如果奇游sdk返回失败则以这条接口结果为准
*/
@SuppressLint("CheckResult")
override fun loadVipEntityFromGh(userId: String, callBack: (Any?) -> Unit) {
RetrofitManager.getInstance().newApi.getVipStatus(
userId.ifBlank { UserManager.getInstance().userId },
"gjonline_vip",
true
)
.compose(singleToMain())
.subscribe(object : BiResponse<BaseEntity<VipEntity>>() {
override fun onSuccess(data: BaseEntity<VipEntity>) {
callBack(data.data)
}
override fun onFailure(exception: Exception) {
super.onFailure(exception)
callBack(null)
}
})
}
override fun updateVipEntity(data: Any) {
if (data is VipEntity) {
AcceleratorDataHolder.instance.setVipEntity(data)
}
}
override fun clear() {
AcceleratorDataHolder.instance.clear()
}
}

View File

@ -1,13 +1,13 @@
package com.gh.common.provider
import android.content.Context
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.LibaoUtils
import com.gh.common.util.LibaoUtils.PostLibaoListener
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.ILibaoUtilsProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.libaoUtils, name = "LibaoUtils暴露服务")
class LibaoUtilsProviderImpl : ILibaoUtilsProvider {
override fun getLibaoStatus(ids: String, successCallback: ((Any?) -> Unit)?, failureCallback: (() -> Unit)?) {
LibaoUtils.getLibaoStatus(ids, object : PostLibaoListener {
@ -20,4 +20,8 @@ class LibaoUtilsProviderImpl : ILibaoUtilsProvider {
}
})
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,7 +1,7 @@
package com.gh.common.provider
import android.content.Context
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.entity.CommunityEntity
@ -10,7 +10,7 @@ import com.gh.gamecenter.common.entity.SuggestType
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.provider.ILinkDirectUtilsProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.linkDirectUtils, name = "DirectUtils暴露服务主要是暴露directToLinkPage方法")
class LinkDirectUtilsProviderImpl : ILinkDirectUtilsProvider {
override fun directToLinkPage(
@ -61,4 +61,7 @@ class LinkDirectUtilsProviderImpl : ILinkDirectUtilsProvider {
DirectUtils.directToCommunityColumn(context, community, subjectId, entrance, path)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,13 +1,19 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.*
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.*
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.logUtils, name = "LogUtils暴露服务")
class LogUtilsProviderImpl : ILogUtilsProvider {
override fun login(loginStep: String, loginType: String, entrance: String) {
LogUtils.login(loginStep, loginType, entrance)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -0,0 +1,19 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.MainActivity
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IMainProvider
@Route(path = RouteConsts.provider.mainActivity, name = "MainActivity暴露服务")
class MainProviderImpl : IMainProvider {
override fun skipToMainActivity(context: Context, type: String) {
DirectUtils.directToHomeDefaultTab(context)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -2,13 +2,13 @@ package com.gh.common.provider
import android.content.Context
import android.content.Intent
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.MessageDetailActivity
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.entity.ConcernEntity
import com.gh.gamecenter.feature.provider.IMessageDetailProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.messageDetail, name = "MessageDetailActivity暴露服务")
class MessageDetailProviderImpl : IMessageDetailProvider {
override fun getIntentById(
@ -24,4 +24,8 @@ class MessageDetailProviderImpl : IMessageDetailProvider {
override fun getIntentByEntity(context: Context, concernEntity: ConcernEntity, entrance: String): Intent? {
return MessageDetailActivity.getIntentByEntity(context, concernEntity, entrance)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,13 +1,16 @@
package com.gh.common.provider
import android.content.Context
import androidx.lifecycle.MediatorLiveData
import androidx.lifecycle.MutableLiveData
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.entity.MessageUnreadCount
import com.gh.gamecenter.feature.entity.MessageUnreadEntity
import com.gh.gamecenter.feature.provider.IMessageUnreadRepositoryProvider
import com.gh.gamecenter.message.MessageUnreadRepository
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.messageUnreadRepository, name = "MessageUnreadRepository暴露服务")
class MessageUnreadRepositoryProviderImpl : IMessageUnreadRepositoryProvider {
override fun loadMessageUnreadData() {
@ -30,4 +33,7 @@ class MessageUnreadRepositoryProviderImpl : IMessageUnreadRepositoryProvider {
return MessageUnreadRepository.messageUnreadCountLiveData
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,13 +1,13 @@
package com.gh.common.provider
import android.content.Context
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IMiniGameRecentlyPlayedProvider
import com.gh.gamecenter.minigame.MiniGameRecentlyPlayUseCase
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.miniGameRecentPlayed, name = "MiniGameRecentlyPlayed暴露服务")
class MiniGameRecentlyPlayedProviderImpl : IMiniGameRecentlyPlayedProvider {
override fun clearMiniGameRecentlyPlayed(gameType: String) {
MiniGameRecentlyPlayUseCase.clearRecentlyPlayedMiniGameList(gameType)
@ -16,4 +16,8 @@ class MiniGameRecentlyPlayedProviderImpl : IMiniGameRecentlyPlayedProvider {
override fun refreshQQMiniRecentPlayed() {
MiniGameRecentlyPlayUseCase.loadRecentlyPlayedMiniGameList(Constants.QQ_MINI_GAME)
}
override fun init(context: Context?) {
// no implement
}
}

View File

@ -2,12 +2,12 @@ package com.gh.common.provider
import android.content.Context
import android.content.Intent
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.provider.INewCommentDetailProvider
import com.gh.gamecenter.qa.comment.NewCommentDetailActivity
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.newCommentDetail, name = "NewCommentDetailActivity暴露服务")
class NewCommentDetailProviderImpl : INewCommentDetailProvider {
override fun getAnswerCommentIntent(
@ -76,4 +76,21 @@ class NewCommentDetailProviderImpl : INewCommentDetailProvider {
path
)
}
override fun getImageArticleCommentIntent(
context: Context,
commentId: String,
imageArticleId: String,
topCommentId: String,
entrance: String,
path: String
):Intent {
return NewCommentDetailActivity.getImageArticleCommentIntent(
context, commentId, imageArticleId, topCommentId, entrance, path
)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -0,0 +1,19 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.PackageHelper
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IPackageHelperProvider
@Route(path = RouteConsts.provider.packageHelper, name = "PackageHelper暴露服务")
class PackageHelperProviderImpl : IPackageHelperProvider {
override fun getLocalPackageNameSet(): Set<String> {
return PackageHelper.localPackageNameSet
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,11 +1,13 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.PackageInstaller
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IPackageInstallerProvider
import com.lightgame.download.DownloadEntity
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.packageInstaller, name = "PackageInstaller暴露服务")
class PackageInstallerProviderImpl : IPackageInstallerProvider {
override fun install(context: Context, downloadEntity: DownloadEntity, showUnzipToast: Boolean) {
@ -16,4 +18,7 @@ class PackageInstallerProviderImpl : IPackageInstallerProvider {
PackageInstaller.uninstall(context, path)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -2,12 +2,14 @@ package com.gh.common.provider
import android.content.Context
import android.content.pm.PackageInfo
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.PackageHelper
import com.gh.common.util.PackageUtils
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IPackageUtilsProvider
import com.gh.gamecenter.core.utils.ProcessUtil
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.packageUtils, name = "PackageUtils暴露服务")
class PackageUtilsProviderImpl : IPackageUtilsProvider {
override fun obtainProcessName(): String? {
return ProcessUtil.getCurrentProcessName()
@ -48,4 +50,8 @@ class PackageUtilsProviderImpl : IPackageUtilsProvider {
override fun getVersionNameByPackageName(packageName: String): String {
return PackageUtils.getVersionNameByPackageName(packageName) ?: ""
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,10 +1,13 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.entity.GameInstall
import com.gh.gamecenter.feature.provider.IPackagesManagerProvider
import com.gh.gamecenter.manager.PackagesManager
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.packagesManager, name = "PackagesManager暴露服务")
class PackagesManagerProviderImpl: IPackagesManagerProvider {
override fun isCanPluggable(gameId: String?, packageName: String?): Boolean {
return PackagesManager.isCanPluggable(gameId, packageName)
@ -13,4 +16,8 @@ class PackagesManagerProviderImpl: IPackagesManagerProvider {
override fun getFilterSameApkInstalledList(): ArrayList<GameInstall> {
return PackagesManager.getFilterSameApkInstalledList()
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,12 +1,18 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.filter.RegionSettingHelper
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.IpInfo
import com.gh.gamecenter.feature.provider.IRegionSettingHelperProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.regionSettingHelper, name = "RegionSettingHelper暴露服务")
class RegionSettingHelperProviderImpl : IRegionSettingHelperProvider {
override fun shouldThisGameDisplayMirrorInfo(gameId: String): Boolean {
return RegionSettingHelper.shouldThisGameDisplayMirrorInfo(gameId)
}
override fun getMirrorPosition(gameId: String): Int {
return RegionSettingHelper.getMirrorPosition(gameId)
@ -27,4 +33,8 @@ class RegionSettingHelperProviderImpl : IRegionSettingHelperProvider {
override fun shouldThisGameBeFiltered(gameId: String?): Boolean {
return RegionSettingHelper.shouldThisGameBeFiltered(gameId)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,9 +1,12 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.repository.ReservationRepository
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IReservationRepositoryProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.reservationRepository, name = "ReservationRepository暴露服务")
class ReservationRepositoryProviderImpl : IReservationRepositoryProvider {
override fun refreshReservations() {
@ -13,4 +16,8 @@ class ReservationRepositoryProviderImpl : IReservationRepositoryProvider {
override fun clearReservations() {
ReservationRepository.clearReservations()
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -5,12 +5,12 @@ import androidx.fragment.app.Fragment
import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.ISearchTabUtilsProvider
import com.gh.gamecenter.search.viewmodel.SearchTabViewModel
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.searchTabUtils, name = "SearchTabUtils暴露服务")
class SearchTabUtilsProviderImpl : ISearchTabUtilsProvider {
override fun obtainParentViewModel(fragment: Fragment): ViewModel {
@ -29,4 +29,8 @@ class SearchTabUtilsProviderImpl : ISearchTabUtilsProvider {
null
}
}
override fun init(context: Context?) {
// no implement
}
}

View File

@ -0,0 +1,19 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.ShareCardPicActivity
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.entity.ConcernEntity
import com.gh.gamecenter.feature.provider.IShareCardPicProvider
@Route(path = RouteConsts.provider.shareCardPicActivity, name = "ShareCardPicActivity暴露服务")
class ShareCardPicProviderImpl : IShareCardPicProvider {
override fun startShareCardPicActivity(context: Context, concernEntity: ConcernEntity, entrance: String) {
ShareCardPicActivity.startShareCardPicActivity(context, concernEntity, entrance)
}
override fun init(context: Context?) {
// do nothing
}
}

View File

@ -0,0 +1,20 @@
package com.gh.common.provider
import android.content.Context
import android.content.Intent
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.ShareCardActivity
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.entity.ConcernEntity
import com.gh.gamecenter.feature.provider.IShareCardProvider
@Route(path = RouteConsts.provider.shareCardActivity, name = "ShareCardActivity暴露服务")
class ShareCardProviderImpl : IShareCardProvider {
override fun getIntent(context: Context, concernEntity: ConcernEntity, shareContent: String): Intent {
return ShareCardActivity.getIntent(context, concernEntity, shareContent)
}
override fun init(context: Context?) {
// do nothing
}
}

View File

@ -3,11 +3,17 @@ package com.gh.common.provider
import android.content.Context
import android.content.Intent
import android.os.Parcelable
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.ShellActivity
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IShellProvider
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.shellActivity, name = "ShellActivity暴露服务")
class ShellProviderImpl : IShellProvider {
override fun getSwitchInstallMethodIntent(context: Context, extraParcelable: Parcelable?): Intent =
ShellActivity.getIntent(context, ShellActivity.Type.SWITCH_INSTALL_METHOD, extraParcelable)
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -2,15 +2,19 @@ package com.gh.common.provider
import android.content.Context
import android.content.Intent
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.provider.ISimpleAnswerDetailProvider
import com.gh.gamecenter.qa.answer.detail.SimpleAnswerDetailActivity
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.simpleAnswerDetail, name = "SimpleAnswerDetailActivity暴露服务")
class SimpleAnswerDetailProviderImpl : ISimpleAnswerDetailProvider {
override fun getIntent(context: Context, answerId: String, entrance: String, path: String): Intent {
return SimpleAnswerDetailActivity.getIntent(context, answerId, entrance, path)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -1,12 +1,12 @@
package com.gh.common.provider
import android.content.Context
import com.therouter.router.Route
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.provider.ISubjectProvider
import com.gh.gamecenter.subject.SubjectActivity
@com.therouter.inject.ServiceProvider
@Route(path = RouteConsts.provider.subject, name = "SubjectActivity暴露服务")
class SubjectProviderImpl : ISubjectProvider {
override fun startSubjectActivity(
context: Context,
@ -17,4 +17,8 @@ class SubjectProviderImpl : ISubjectProvider {
) {
SubjectActivity.startSubjectActivity(context, id, name, isOrder, null, entrance)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -0,0 +1,19 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.feature.exposure.time.TimeUtil
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.ITimeUtilProvider
@Route(path = RouteConsts.provider.timeUtil, name = "TimeUtil暴露服务")
class TimeUtilProviderImpl : ITimeUtilProvider {
override fun currentTimeMillis() = TimeUtil.currentTimeMillis()
override fun currentTime() = TimeUtil.currentTime()
override fun init(context: Context?) {
// Do nothing
}
}

Some files were not shown because too many files have changed in this diff Show More