Compare commits

..

16 Commits

Author SHA1 Message Date
f040691e24 base镜像添加所需安装包 2023-03-28 11:56:17 +08:00
3648dced06 ci:测试完整流程 2023-03-27 18:20:58 +08:00
94f94f5186 ci: 测试多项目触发 2023-03-27 17:56:11 +08:00
fa03fc6d4c ci: 测试多项目触发 2023-03-27 17:54:22 +08:00
f23eb48185 ci: 测试多项目触发 2023-03-27 17:48:22 +08:00
8c5568c24d ci: 测试多项目触发 2023-03-27 17:42:56 +08:00
1bdc1a6430 ci: 测试多项目触发 2023-03-27 17:40:33 +08:00
b289e78a88 ci: Dockerfile 去掉代码复制 2023-03-27 17:09:49 +08:00
ac4143fe0a fix: 添加 outputs 参数 2023-03-24 15:01:03 +08:00
938cb1c9cb fix: 调整入参命名 2023-03-24 14:04:20 +08:00
7445f98086 修改.gitmodules url 2023-03-24 14:04:10 +08:00
c2552096e1 ci: 修改stage 2023-03-24 14:01:24 +08:00
c6c0fe771a ci:添加android,及制作基础打包镜像 2023-03-24 14:00:16 +08:00
623708fed1 fix: 修正入参命名 2023-03-24 11:27:51 +08:00
faec33658d feat: 简单对接接口 2023-03-15 18:17:53 +08:00
2fda01215a feat: 【光环助手】推广组测试打包任务 https://jira.shanqu.cc/browse/GHZS-972 2023-03-15 14:42:52 +08:00
830 changed files with 10110 additions and 23843 deletions

View File

@ -1,159 +1,83 @@
# commit_sha 文件记录上一次成功流水线的commit sha用于定时计划检测是否有新代码提交有就执行流水线没有就终止流水线
cache:
# 不同的分支采用不同的 cache防止分支之间相互影响
key: "${CI_COMMIT_REF_SLUG}_commit_sha"
paths:
- commit_sha
policy: pull
# 将打包&发送apk包邮件job 和代码分析job 并行执行
stages:
- build&analyze
- oss-upload&send-email
- ci_sonar_mail
# 阻止了 合并请求 或 push分支和标签的流水线。 最后的 when: always 规则运行所有其他流水线类型,包括定时计划流水线。
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
when: always
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- when: always
before_script:
# 检查是否存在 commit_sha 文件
- if [ -f commit_sha ]; then cat commit_sha; else echo "0000000" > commit_sha; fi
- export BEFORE_COMMIT_SHA=$(cat commit_sha)
# 比较commit sha ,若与上一次成功流水线的commit sha 相同,则退出流水线
- if [ "$CI_COMMIT_SHA" == "$BEFORE_COMMIT_SHA" ] && [ "$CI_PIPELINE_SOURCE" != "web" ]; then exit 137; fi
# 使用 .post 阶段使作业在流水线的末尾运行。.post 始终是流水线的最后阶段。
change_commit:
tags:
- offline-test
stage: .post
# 此job 跳过拉取git代码
variables:
GIT_STRATEGY: none
script:
# 更新 commit_sha
- if [ "$CI_COMMIT_SHA" != "$BEFORE_COMMIT_SHA" ]; then echo $CI_COMMIT_SHA > commit_sha; fi
cache:
# 不同的分支采用不同的 cache防止分支之间相互影响
key: "${CI_COMMIT_REF_SLUG}_commit_sha"
paths:
- commit_sha
policy: pull-push
allow_failure:
exit_codes: 137
- android-build && analysis
- docker-build && sendmail
- deploy-trigger
android_build:
tags:
# - local-runner
- offline-test
stage: build&analyze
image: hub.shanqu.cc/library/ci-android:jdk11-sdk31-33
resource_group: android_build
stage: android-build && analysis
image: hub.shanqu.cc/devops/ci-android:jdk11
variables:
KUBERNETES_CPU_LIMIT: "16"
GIT_SUBMODULE_STRATEGY: recursive
KUBERNETES_CPU_LIMIT: "10"
Apk_Path: "app/build/outputs/apk/**/release/*.apk"
script:
- export GRADLE_USER_HOME=/home/gitlab-runner/ci-build-cache/$CI_PROJECT_PATH/.gradle
- export GRADLE_USER_HOME=./.gradle
- chmod +x ./gradlew
- ./scripts/jenkins_build.sh -c
#设置打包后的产物用于job之间共享
- ./scripts/meta_build.sh --config_id 6400549c21c2c94ead074500 --sdk_platform toutiao --sdk_version 5.3.0 --channel BD-GHZS-ZP-KY --activate_reporting_ratio 60 --first_lanuch_jump e1wibGlua190eXBlXCI6XCJcIixcImxpbmtfaWRcIjpcIlwiLFwibGlua190ZXh0XCI6XCJcIixcImhvbWVfaW5kZXhcIjpcIlwiLFwiYm90dG9tX2luZGV4XCI6XCJcIn0= --unix_timestamp 1677657618 --output ./release/com.gh.gamecenter_5.17.4_694_BD-GHZS-ZP-KY_toutiao_5.3.0_1677657618.apk
- rm -rf ./.gradle/caches/build-cache-1
cache:
paths:
- .gradle
artifacts:
paths:
- app/build/tmp/*.apk
expire_in: 48 hrs # 指定附件上载后保存的时间24h默认永久在Gitlab保存
allow_failure:
exit_codes: 137
paths:
- Dockerfile
expire_in: 15 mins
only:
- dev
- dev-5.26.0
- dev-5.27.0
- feature-meta_build
# 构建推送docker镜像
docker-build:
tags:
- offline-test
stage: docker-build && sendmail
image: hub.shanqu.cc/library/docker:latest
variables:
GIT_STRATEGY: none
script:
- projectPath=`echo $CI_PROJECT_PATH | sed 's#/#-#g'`
- docker build -t registry.cn-shenzhen.aliyuncs.com/ghzs/$projectPath:latest .
- docker push registry.cn-shenzhen.aliyuncs.com/ghzs/$projectPath:latest
- docker run -e PROJECTKEY=$projectPath -e EMAIL=$GITLAB_USER_EMAIL -e BRANCH=$CI_COMMIT_REF_NAME --name send-email --rm hub.shanqu.cc/platform/send-sonar-report:latest
cache:
paths:
- .gradle
policy: pull
only:
- feature-meta_build
# 代码检查
sonarqube_analysis:
tags:
- offline-test
stage: build&analyze
image: sonarsource/sonar-scanner-cli:latest
dependencies: [] #禁止传递来的artifact
script:
## 获取项目的一级组和二级组和项目名作为projectKey例如projectKey=platform-backend-eci-monitor
- group=`echo $CI_PROJECT_PATH | sed 's#/#-#g'`
- sonar-scanner
-Dsonar.host.url=http://sonarqube-server.sonarqube:9000/
-Dsonar.login=be43de7264ce4c4766eb0c020373c3e74e6df257
-Dsonar.jacoco.reportPaths=target/jacoco.exec
-Dsonar.projectKey=$group
-Dsonar.projectName=$CI_PROJECT_PATH
-Dsonar.sourceEncoding=UTF-8
-Dsonar.exclusions=**/vendor/**,**/errcode/**
-Dsonar.gitlab.project_id=$CI_PROJECT_ID
-Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA
-Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
-Dsonar.gitlab.ci_merge_request_iid=$CI_MERGE_REQUEST_IID
-Dsonar.gitlab.merge_request_discussion=true
-Dsonar.java.binaries=.
-Dsonar.branch.name=$CI_COMMIT_REF_NAME
allow_failure:
exit_codes: 137
only:
- dev
- dev-5.26.0
- dev-5.27.0
tags:
- offline-test
stage: android-build && analysis
image: sonarsource/sonar-scanner-cli:latest
dependencies: [] #禁止传递来的artifact
script:
## 获取项目的一级组和二级组和项目名作为projectKey例如projectKey=platform-backend-eci-monitor
- group=`echo $CI_PROJECT_PATH | sed 's#/#-#g'`
- sonar-scanner
-Dsonar.host.url=http://sonarqube-server.sonarqube:9000/
-Dsonar.login=be43de7264ce4c4766eb0c020373c3e74e6df257
-Dsonar.jacoco.reportPaths=target/jacoco.exec
-Dsonar.projectKey=$group
-Dsonar.projectName=$CI_PROJECT_PATH
-Dsonar.sourceEncoding=UTF-8
-Dsonar.exclusions=**/vendor/**,**/errcode/**
-Dsonar.gitlab.project_id=$CI_PROJECT_ID
-Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA
-Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
-Dsonar.gitlab.ci_merge_request_iid=$CI_MERGE_REQUEST_IID
-Dsonar.gitlab.merge_request_discussion=true
-Dsonar.java.binaries=. # 如果不使用Maven或Gradle进行分析则必须手动提供测试二进制文件
only:
- feature-meta_build
## 发送简易检测结果报告
send_sonar_report:
tags:
- offline-test
stage: ci_sonar_mail
image: hub.shanqu.cc/library/docker:latest
# 此job 跳过拉取git代码
variables:
GIT_STRATEGY: none
script:
- group=`echo $CI_PROJECT_PATH | sed 's#/#-#g'`
- docker run -e PROJECTKEY=$group -e EMAIL=$GITLAB_USER_EMAIL -e BRANCH=$CI_COMMIT_REF_NAME --name send-email --rm hub.shanqu.cc/platform/send-sonar-report:latest
allow_failure:
exit_codes: 137
only:
- dev
- dev-5.26.0
- dev-5.27.0
## 触发多项目构建
trigger_job:
stage: deploy-trigger
trigger:
project: devops/automation/build-eci
branch: dev
oss-upload&send-email:
tags:
- rancher-k8s
stage: oss-upload&send-email
image: hub.shanqu.cc/devops/android-apk-oss-upload:latest
variables:
GIT_STRATEGY: none
VAULT_ADDR: https://vault.shanqu.cc # 固定值
VAULT_SECRET_PATH: prod/devops/android-apk-oss-upload # 固定值
VAULT_ROLE: android-apk-oss-upload # 固定值
ENDPOINT: "oss-cn-shenzhen-internal.aliyuncs.com" # 固定值
BUCKET: "shanqu" # 固定值
FILE_PATH: "app/build/tmp/" # APK 存放路径
Email_To_List: $EMAIL_TO_LIST # 邮件接受人列表
Email_Title: "光环助手 $CI_COMMIT_BRANCH" # 邮件标题
PIPELINE_ID: $CI_PIPELINE_ID # 流水线id
COMMIT_BRANCH: $CI_COMMIT_BRANCH # 提交分支
MAIL_MESSAGE: "[$CI_COMMIT_AUTHOR] $CI_COMMIT_MESSAGE"
needs:
- job: android_build
artifacts: true
script:
### 绑定上传参数 ###
- export OSS_PATH="release/dev/${CI_PROJECT_NAME}/$(date "+%Y/%m/%d")"
### 开启上传 ###
- /usr/local/bin/python /upload.py
### 发送邮件
- /usr/local/bin/python /ci-android-mail.py
only:
- dev
- dev-5.26.0
- dev-5.27.0

View File

@ -11,7 +11,6 @@ android {
String CONFIG_ID = ""
String FIRST_LAUNCH = ""
int ACTIVATE_REPORTING_RATIO = 0
buildFeatures {
viewBinding true
@ -77,8 +76,6 @@ android {
// 首次启动的跳转配置
buildConfigField "String", "FIRST_LAUNCH", "\"${FIRST_LAUNCH}\""
buildConfigField "int", "ACTIVATE_REPORTING_RATIO", "${ACTIVATE_REPORTING_RATIO}"
// All third-party appid/appkey
buildConfigField "String", "API_HOST", "\"${API_HOST}\""
buildConfigField "String", "NEW_API_HOST", "\"${NEW_API_HOST}\""
@ -163,7 +160,7 @@ android {
}
productFlavors {
// internal 内部测试包使用的 flavor接口包含包括测试和正式环境
// internal test dev host
internal {
dimension "env"
versionNameSuffix "-debug"
@ -175,7 +172,7 @@ android {
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${DEV_QUICK_LOGIN_APPKEY}\""
}
// publish 发布时候使用的 flavor接口仅包含正式环境
// publish release host
publish {
dimension "env"
@ -201,17 +198,11 @@ android {
kuaishou {
dimension "env"
String KUAI_SHOU_APP_ID = ""
String KUAI_SHOU_APP_NAME = ""
buildConfigField "String", "DEV_API_HOST", "\"${API_HOST}\""
buildConfigField "String", "NEW_DEV_API_HOST", "\"${NEW_API_HOST}\""
buildConfigField "String", "DEV_VAPI_HOST", "\"${VAPI_HOST}\""
buildConfigField "String", "QUICK_LOGIN_APPID", "\"${QUICK_LOGIN_APPID}\""
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${QUICK_LOGIN_APPKEY}\""
buildConfigField "String", "KUAI_SHOU_APP_ID", "\"${KUAI_SHOU_APP_ID}\""
buildConfigField "String", "KUAI_SHOU_APP_NAME", "\"${KUAI_SHOU_APP_NAME}\""
}
gdt {
@ -286,7 +277,6 @@ dependencies {
implementation "com.llew.huawei:verifier:${verifier}"
teaImplementation "com.bytedance.applog:RangersAppLog-Lite-cn:${bytedanceApplog}"
teaImplementation "com.bytedance.applog:RangersAppLog-All-convert:${bytedanceApplog}"
implementation "net.lingala.zip4j:zip4j:${zip4j}"
@ -301,8 +291,7 @@ dependencies {
implementation "com.lg:gid:${gid}"
implementation "com.lg:shortcut:${shortcut}"
compileOnly "com.github.axen1314.lancet:lancet-base:${lancet_version}"
kapt "com.alibaba:arouter-compiler:$arouterVersion"
implementation project(':ndownload')
@ -329,13 +318,13 @@ dependencies {
implementation(project(':module_sensors_data')) {
exclude group: 'androidx.swiperefreshlayout'
}
// implementation(project(':feature:vpn'))
implementation(project(':feature:pkg'))
implementation(project(':feature:oaid'))
implementation(project(':feature:floating-window'))
implementation(project(':feature:beizi_startup_ad'))
implementation(project(':module_vpn'))
implementation(project(':module_pkg'))
// 默认不接入光能模块,提高编译速度
// debugImplementation(project(':module_energy')) {
// exclude group: 'androidx.swiperefreshlayout'
// }
}
File propFile = file('sign.properties')
if (propFile.exists()) {
Properties props = new Properties()
@ -475,12 +464,7 @@ andResGuard {
"R.drawable.suggest_add_pic_icon",
"R.drawable.icon_pic_add",
"R.drawable.ask_search_input_delete",
"R.drawable.suggest_pic_delete",
"R.id.cardIv",
"R.id.cardMask",
"R.id.cardGradientMask",
"R.id.gameIconIv",
"R.id.titleContainer"
"R.drawable.suggest_pic_delete"
]
compressFilePattern = [
"*.png",

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.floatingwindow.FloatingWindowEntity {<fields>;}
-keep class com.gh.gamecenter.BR
-keep class com.gh.gamecenter.retrofit.* {*;}
-keep class com.gh.gamecenter.eventbus.* {*;}
@ -63,16 +62,6 @@
public <init>(android.content.Context, android.util.AttributeSet, int);
}
### RecyclerView.jumpToPositionForSmoothScroller
-keep class androidx.recyclerview.widget.RecyclerView {
void jumpToPositionForSmoothScroller(int);
}
### ViewBinding 反射相关
-keep class * implements androidx.viewbinding.ViewBinding {
public static *** inflate(android.view.LayoutInflater, android.view.ViewGroup, boolean);
}
### TEA
-keep class com.gh.gamecenter.TeaHelper { *; }

View File

@ -26,7 +26,7 @@ class FlavorProviderImp : IFlavorProvider {
return channel
}
override fun init(application: Application, activity: Activity, activateRatio: Int) {
override fun init(application: Application, activity: Activity) {
// do nothing
}

View File

@ -12,7 +12,7 @@ import com.leon.channel.helper.ChannelReaderUtil
class FlavorProviderImp : IFlavorProvider {
override fun init(application: Application, activity: Activity, activateRatio: Int) {
override fun init(application: Application, activity: Activity) {
GdtHelper.init(application, getChannelStr(application))
if (HaloApp.getInstance().isBrandNewInstall) {

Binary file not shown.

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<!-- Trust user added CAs while debuggable only -->
<certificates src="user" />
<certificates src="system" />
</trust-anchors>
</base-config>
</network-security-config>

View File

@ -5,15 +5,15 @@ import com.kwai.monitor.log.TurboAgent
import com.kwai.monitor.log.TurboConfig
object KuaishouHelper {
private val mAppId by lazy { BuildConfig.KUAI_SHOU_APP_ID.ifEmpty { "81537" } }
private val mAppName by lazy { BuildConfig.KUAI_SHOU_APP_NAME.ifEmpty { "guanghuanzhushou_1" } }
private const val APP_ID = "80655"
private const val APP_NAME = "guanghuanzhushou_1"
@JvmStatic
fun init(context: Context, channel: String) {
TurboAgent.init(
TurboConfig.TurboConfigBuilder.create(context)
.setAppId(mAppId)
.setAppName(mAppName)
.setAppId(APP_ID)
.setAppName(APP_NAME)
.setAppChannel(channel)
.build()
)

View File

@ -8,11 +8,11 @@ import com.gh.gamecenter.core.provider.IFlavorProvider
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.core.utils.TimeUtils
import com.halo.assistant.HaloApp
import com.kwai.monitor.payload.TurboHelper
import com.leon.channel.helper.ChannelReaderUtil
class FlavorProviderImp : IFlavorProvider {
override fun init(application: Application, activity: Activity, activateRatio: Int) {
override fun init(application: Application, activity: Activity) {
KuaishouHelper.init(application, getChannelStr(application))
if (HaloApp.getInstance().isBrandNewInstall) {
@ -31,7 +31,7 @@ class FlavorProviderImp : IFlavorProvider {
}
override fun getChannelStr(application: Application): String {
var channel = TurboHelper.getChannel(application)
var channel = ChannelReaderUtil.getChannel(application)
if (channel == null || TextUtils.isEmpty(channel.trim())) {
channel = KUAISHOU_CHANNEL
}

Binary file not shown.

View File

@ -46,8 +46,7 @@
<!-- 如果有视频相关的广告且使用textureView播放请务必添加否则黑屏 -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-sdk tools:overrideLibrary="
com.shuyu.gsyvideoplayer,
<uses-sdk tools:overrideLibrary="com.shuyu.gsyvideoplayer,
com.shuyu.gsyvideoplayer.lib,
com.haroldadmin.whatthestack,
com.shuyu.gsyvideoplayer.armv7a,
@ -77,7 +76,7 @@
androidx.compose.animation.core,
androidx.constraintlayout.compose,
androidx.compose.ui.test.manifest,
androidx.compose.ui.tooling.preview" />
androidx.compose.ui.tooling.preview"/>
<!-- 去掉 SDK 一些流氓权限 -->
<uses-permission
@ -107,15 +106,10 @@
android:label="@string/app_name"
android:largeHeap="true"
android:resizeableActivity="true"
android:networkSecurityConfig="@xml/network_security_config"
android:theme="@style/AppCompatTheme.APP"
tools:replace="android:name,android:allowBackup"
tools:targetApi="n">
<meta-data
android:name="EasyGoClient"
android:value="true" />
<meta-data
android:name="io.sentry.auto-init"
android:value="false" />
@ -125,8 +119,6 @@
android:name="io.sentry.breadcrumbs.system-events"
android:value="false" />
<service android:name="com.gh.ndownload.NDownloadService" />
<activity
android:name="com.gh.gamecenter.SplashScreenActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
@ -143,15 +135,10 @@
<activity
android:name="com.gh.gamecenter.MainActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:exported="true"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/AppCompatTheme.APP"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
<activity
android:name="com.gh.gamecenter.DownloadManagerActivity"
@ -632,8 +619,8 @@
<!-- android:theme="@android:style/Theme.Translucent" />-->
<activity
android:name="com.gh.gamecenter.SkipActivity"
android:exported="true"
android:name="com.gh.gamecenter.SkipActivity"
android:theme="@style/Theme.AppCompat.Light.Fullscreen.Transparent">
<intent-filter>
<data android:scheme="ghzhushou" />
@ -652,19 +639,6 @@
</intent-filter>
</activity>
<!-- 光环助手授权登陆页面 -->
<activity
android:name=".authorization.AuthorizationActivity"
android:exported="true"
android:launchMode="singleTask"
android:screenOrientation="portrait">
<intent-filter>
<data android:scheme="ghzhushou_authorization" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
<activity
android:name="com.gh.gamecenter.teenagermode.TeenagerModeActivity"
android:screenOrientation="portrait" />
@ -793,9 +767,9 @@
<service
android:name=".aidl.CommunicationService"
android:enabled="true"
android:exported="true">
android:exported="true" >
<intent-filter>
<action android:name="com.gh.gamecenter.aidl.CommunicationService" />
<action android:name="com.gh.gamecenter.aidl.CommunicationService"/>
</intent-filter>
</service>

View File

@ -1,27 +0,0 @@
{
"easyGoVersion": "1.0",
"client": "com.gh.gamecenter",
"logicEntities": [
{
"head": {
"function": "magicwindow",
"required": "true"
},
"body": {
"mode":"1",
"activityPairs":[
{"from":"com.gh.gamecenter.MainActivity","to":"*"}
],
"defaultDualActivities": {
"mainPages": "com.gh.gamecenter.MainActivity"
},
"UX": {
"supportRotationUxCompat": "false",
"isDraggable": "true"
},
"transActivities":[
]
}
}
]
}

View File

@ -0,0 +1 @@
{"v":"5.5.9","fr":60,"ip":0,"op":90,"w":1080,"h":202,"nm":"click","ddd":0,"assets":[{"id":"comp_0","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"椭圆形","sr":1,"ks":{"o":{"a":0,"k":20,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[204,1455,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[24,24],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"椭圆形","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":120,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"椭圆形","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":63,"s":[10]},{"t":70,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[204,1455,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":39,"s":[100,100,100]},{"t":49,"s":[110,110,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[36,36],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"椭圆形","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":120,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"圆环","refId":"comp_0","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.531],"y":[0]},"t":28,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":38,"s":[100]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.526],"y":[0]},"t":48,"s":[100]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.446],"y":[0]},"t":63,"s":[50]},{"t":82,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[125.951,79.658,0],"ix":2},"a":{"a":0,"k":[205.951,1458.658,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.601,0.601,0.333],"y":[0,0,0]},"t":28,"s":[50,50,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.528,0.528,0.333],"y":[0,0,0]},"t":38,"s":[100,100,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.526,0.526,0.333],"y":[0,0,0]},"t":48,"s":[120,120,100]},{"t":63,"s":[100,100,100]}],"ix":6}},"ao":0,"w":1080,"h":1920,"ip":0,"op":120,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"点击手","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.596],"y":[0]},"t":0,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":10,"s":[100]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.515],"y":[0]},"t":63,"s":[100]},{"t":83,"s":[0]}],"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.507],"y":[0]},"t":10,"s":[6]},{"t":30,"s":[2]}],"ix":10},"p":{"a":0,"k":[178.982,123.325,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.489,0.489,0.333],"y":[0,0,0]},"t":10,"s":[100,100,100]},{"t":30,"s":[90,90,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-5.33,-8.3],[3.89,0.27],[-4.4,-1.68],[-4.33,-0.67],[-4.08,9.32],[3.33,5.44],[3.39,4.6],[0.87,-3.7],[3.6,-0.86],[1.03,-0.21],[2.34,-0.53],[0.96,1.15],[4.22,5.48],[-1.18,-4.56]],"o":[[1.11,1.71],[-3.89,-0.27],[6.42,2.5],[4.33,0.66],[1.63,-5.32],[-3.34,-5.45],[-1.68,-2.1],[-0.71,3.14],[-3.43,0.95],[-0.57,0.08],[-3.86,1.12],[-3.23,-3.94],[-1.89,-2.28],[2.42,4.64]],"v":[[-5.387,9.698],[-10.717,8.498],[-12.327,15.628],[5.813,21.748],[23.313,11.778],[20.273,-1.202],[11.563,-13.962],[5.393,-12.362],[1.083,-13.722],[-2.087,-9.742],[-5.707,-11.752],[-8.777,-7.572],[-18.297,-20.542],[-23.827,-17.832]],"c":true},"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"路径备份 2","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":120,"st":0,"bm":0}],"markers":[]}

View File

@ -0,0 +1 @@
{"v":"5.6.4","fr":25,"ip":0,"op":35,"w":1080,"h":214,"nm":"点赞","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"椭圆形 2","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.588],"y":[0]},"t":17,"s":[15]},{"t":20,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[468.04,73.68,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.659,0.659,0.333],"y":[0,0,0]},"t":10,"s":[50,50,100]},{"t":19,"s":[150,150,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[24,24],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"椭圆形","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":10,"op":1510,"st":10,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"椭圆形 3","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.588],"y":[0]},"t":27,"s":[15]},{"t":30,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[468.04,73.68,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.659,0.659,0.333],"y":[0,0,0]},"t":20,"s":[50,50,100]},{"t":28,"s":[140,140,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[24,24],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"椭圆形","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":20,"op":1520,"st":20,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"路径备份 2","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.602],"y":[0]},"t":0,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":5,"s":[100]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.663],"y":[0]},"t":24,"s":[100]},{"t":29,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[531.02,129.675,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.514,0.514,0.333],"y":[0,0,0]},"t":5,"s":[100,100,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.533,0.533,0.333],"y":[0,0,0]},"t":10,"s":[90,90,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.586,0.586,0.333],"y":[0,0,0]},"t":15,"s":[95,95,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.499,0.499,0.333],"y":[0,0,0]},"t":19,"s":[90,90,100]},{"t":24,"s":[100,100,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-5.33,-8.3],[3.89,0.27],[-4.4,-1.68],[-4.33,-0.67],[-4.08,9.32],[3.33,5.44],[3.39,4.6],[0.87,-3.7],[3.6,-0.86],[1.03,-0.21],[2.34,-0.53],[0.96,1.15],[4.22,5.48],[-1.18,-4.56]],"o":[[1.11,1.71],[-3.89,-0.27],[6.42,2.5],[4.33,0.66],[1.63,-5.32],[-3.34,-5.45],[-1.68,-2.1],[-0.71,3.14],[-3.43,0.95],[-0.57,0.08],[-3.86,1.12],[-3.23,-3.94],[-1.89,-2.28],[2.42,4.64]],"v":[[-5.387,9.698],[-10.717,8.498],[-12.327,15.628],[5.813,21.748],[23.313,11.778],[20.273,-1.202],[11.563,-13.962],[5.393,-12.362],[1.083,-13.722],[-2.087,-9.742],[-5.707,-11.752],[-8.777,-7.572],[-18.297,-20.542],[-23.827,-17.832]],"c":true},"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"路径备份 2","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":1500,"st":0,"bm":0}],"markers":[]}

View File

@ -0,0 +1 @@
{"v":"5.5.9","fr":60,"ip":0,"op":120,"w":1080,"h":586,"nm":"上滑","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":2,"ty":4,"nm":"手","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.642],"y":[0]},"t":0,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":6,"s":[100]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.558],"y":[0]},"t":60,"s":[100]},{"t":71,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.479,"y":0},"t":3,"s":[611,475,0],"to":[0,-62.75,0],"ti":[0,62.75,0]},{"t":40,"s":[611,98.5,0]}],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[90,90,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-7.78,-12.06],[5.68,0.39],[-6.42,-2.45],[-6.32,-0.97],[-5.95,13.55],[4.87,7.91],[4.94,6.69],[1.26,-5.37],[5.25,-1.25],[1.5,-0.3],[3.4,-0.77],[1.4,1.68],[6.15,7.98],[-1.73,-6.64]],"o":[[1.62,2.49],[-5.68,-0.39],[9.37,3.63],[6.31,0.98],[2.39,-7.74],[-4.87,-7.92],[-2.45,-3.05],[-1.05,4.57],[-4.99,1.39],[-0.83,0.13],[-5.63,1.63],[-4.71,-5.72],[-2.75,-3.31],[3.52,6.76]],"v":[[-7.86,14.26],[-15.64,12.52],[-17.99,22.89],[8.47,31.78],[33.98,17.29],[29.55,-1.59],[16.85,-20.15],[7.86,-17.83],[1.56,-19.8],[-3.05,-14.02],[-8.33,-16.94],[-12.44,-11.045],[-26.761,-30.19],[-34.75,-25.78]],"c":true},"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"路径","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":120,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"矩形","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.715],"y":[0]},"t":57,"s":[100]},{"t":67,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[525,228.5,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"hasMask":true,"masksProperties":[{"inv":false,"mode":"a","pt":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.491,"y":0},"t":3,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[24.328,180.5],[-22,180.5],[-22,204.5],[24.328,204.5]],"c":true}]},{"t":40,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[24.328,-207.5],[-22,-207.5],[-22,204.5],[24.328,204.5]],"c":true}]}],"ix":1},"o":{"a":0,"k":100,"ix":3},"x":{"a":0,"k":0,"ix":4},"nm":"蒙版 1"}],"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[6,137],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":2,"ix":4},"nm":"矩形路径 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"gf","o":{"a":0,"k":100,"ix":10},"r":1,"bm":0,"g":{"p":3,"k":{"a":0,"k":[0,1,1,1,0.5,1,1,1,1,1,1,1,0,1,0.5,0.5,1,0],"ix":9}},"s":{"a":0,"k":[0,-68.5],"ix":5},"e":{"a":0,"k":[0,68.5],"ix":6},"t":1,"nm":"Gradient Fill 1","mn":"ADBE Vector Graphic - G-Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"矩形","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":1},"e":{"a":0,"k":100,"ix":2},"o":{"a":0,"k":33,"ix":3},"m":1,"ix":2,"nm":"修剪路径 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":3,"op":123,"st":3,"bm":0}],"markers":[]}

View File

@ -1,6 +1,5 @@
package com.gh.base
import android.annotation.SuppressLint
import android.app.Application
import android.content.Intent
import android.graphics.Bitmap
@ -18,8 +17,6 @@ import com.gh.gamecenter.core.runOnUiThread
import com.gh.gamecenter.core.utils.MD5Utils
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.common.entity.ErrorEntity
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.entity.ForumDetailEntity
import com.gh.gamecenter.entity.LocalVideoEntity
import com.gh.gamecenter.entity.QuoteCountEntity
import com.gh.gamecenter.qa.BbsType
@ -31,9 +28,7 @@ import com.google.gson.JsonObject
import com.lightgame.utils.Utils
import com.zhihu.matisse.Matisse
import com.zhihu.matisse.internal.utils.PathUtils
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import okhttp3.ResponseBody
import retrofit2.HttpException
import java.io.File
@ -43,7 +38,6 @@ import kotlin.collections.set
// TODO: 移动到module_bbs模块
abstract class BaseRichEditorViewModel(application: Application) : AndroidViewModel(application) {
val mApi: ApiService = RetrofitManager.getInstance().api
val mNewApi: ApiService = RetrofitManager.getInstance().newApi
val processDialog = MediatorLiveData<WaitingDialogFragment.WaitingDialogData>()
val chooseImagesUpload = MutableLiveData<LinkedHashMap<String, String>>()
val chooseImagesUploadSuccess = MutableLiveData<LinkedHashMap<String, String>>()
@ -61,8 +55,6 @@ abstract class BaseRichEditorViewModel(application: Application) : AndroidViewMo
var id = ""//视频标记
var videoId = ""//更改封面视频id
val quoteCountEntity = QuoteCountEntity()//数据上报用
val sectionListLiveData = MutableLiveData<List<ForumDetailEntity.Section>>()
var isModerator = false
fun setUploadVideoListener(uploadVideoListener: UploadVideoListener) {
this.mUploadVideoListener = uploadVideoListener
@ -416,30 +408,6 @@ abstract class BaseRichEditorViewModel(application: Application) : AndroidViewMo
return true
}
fun getForumSections(bbsId: String) {
mNewApi.getForumSections(bbsId)
.compose(observableToMain())
.subscribe(object : Response<List<ForumDetailEntity.Section>>() {
override fun onResponse(response: List<ForumDetailEntity.Section>?) {
response?.run {
sectionListLiveData.postValue(this)
}
}
})
}
@SuppressLint("CheckResult")
fun getModeratorsInfo(bbsId: String) {
mApi.getModeratorsInfo(bbsId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : BiResponse<JsonObject>() {
override fun onSuccess(data: JsonObject) {
isModerator = data["is_moderators"].asBoolean
}
})
}
private fun getVideoType(): String {
return when (type) {
BbsType.GAME_BBS.value -> {

View File

@ -7,10 +7,7 @@ import androidx.appcompat.app.AppCompatActivity
import com.gh.common.util.FloatingBackViewManager
import com.gh.download.DownloadManager
import com.gh.gamecenter.SingletonWebActivity
import com.gh.gamecenter.SkipActivity
import com.gh.gamecenter.SplashScreenActivity
import com.gh.gamecenter.authorization.AuthorizationActivity
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.utils.PackageFlavorHelper
import com.gh.vspace.VHelper
import com.halo.assistant.HaloApp
@ -29,7 +26,11 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
override fun onActivityResumed(activity: Activity) {
// 判断是否需要显示或隐藏返回小浮窗
if (FloatingBackViewManager.getType().isNotEmpty()) {
if (activity is SingletonWebActivity
if ((activity::class.java.name == "EnergyCenterActivity")
&& FloatingBackViewManager.getType() == FloatingBackViewManager.TYPE_TASK
) {
FloatingBackViewManager.disableBackView()
} else if (activity is SingletonWebActivity
&& FloatingBackViewManager.getType() == FloatingBackViewManager.TYPE_ACTIVITY
) {
FloatingBackViewManager.disableBackView()
@ -54,11 +55,7 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
DarkModeSwitchHelper.showDarkModeSwitchFloatingView(activity)
}
if (activity is AppCompatActivity
&& activity !is SplashScreenActivity
&& activity !is SkipActivity
&& activity !is AuthorizationActivity
) {
if (activity is AppCompatActivity && activity !is SplashScreenActivity) {
VHelper.showFeedbackDialogIfLastSuccessfulLaunchedGameExitUnexpectedly(activity)
}
}

View File

@ -0,0 +1,14 @@
package com.gh.base
import android.app.Activity
import java.lang.ref.WeakReference
object GlobalActivityManager {
private var mCurrentActivityWeakRef: WeakReference<Activity>? = null
var currentActivity: Activity?
get() = mCurrentActivityWeakRef?.get()
set(activity) {
mCurrentActivityWeakRef = WeakReference<Activity>(activity)
}
}

View File

@ -32,8 +32,7 @@ import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.core.runOnUiThread
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.entity.SensorsEvent
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.energy.EnergyBridge
import com.gh.gamecenter.eventbus.EBPackage
import com.gh.gamecenter.feature.entity.Badge
import com.gh.gamecenter.feature.entity.GameEntity
@ -51,30 +50,21 @@ import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadEntity
import com.lightgame.download.DownloadStatus.*
import com.lightgame.utils.Utils
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import org.json.JSONObject
import java.io.BufferedOutputStream
import java.io.File
import java.io.FileOutputStream
import java.util.*
class DefaultJsApi(
var context: Context,
val entrance: String = "",
private var mFragment: Fragment? = null,
private var mBbsId: String? = "",
) {
class DefaultJsApi(var context: Context, val entrance: String = "", private var mFragment: Fragment? = null) {
private var mLoginHandler: CompletionHandler<Any>? = null
private var mDownloadWatcher: DataWatcher? = null // 下载观察者
private var mDownloadUrlSet: HashSet<String>? = null // 下载的 url 集合
private var mDownloadHandler: CompletionHandler<Any>? = null // 下载信息回调
private var mDownloadWatcher: DataWatcher? = null
private var mDownloadUrlSet: HashSet<String>? = null
private var mDownloadHandler: CompletionHandler<Any>? = null
init {
if (mFragment != null) {
EventBus.getDefault().register(this)
autoUnregisterDownloadObserverIfNeeded(mFragment)
}
}
@ -94,19 +84,6 @@ class DefaultJsApi(
// do nothing, mta is deprecated
}
@JavascriptInterface
fun logSensorsEvent(event: Any) {
val sensorsEvent = event.toString().toObject() ?: SensorsEvent()
val trackEvent = JSONObject()
tryCatchInRelease {
sensorsEvent.kv.split(",").forEach {
val kv = it.split(":")
trackEvent.put(kv[0], kv[1])
}
}
SensorsBridge.trackEvent(sensorsEvent.name, trackEvent)
}
@JavascriptInterface
fun getUserInfo(msg: Any): String {
return UserManager.getInstance().userInfoEntity?.toJson() ?: ""
@ -169,6 +146,7 @@ class DefaultJsApi(
WechatBindHelper.bindWechat(wechatLoginInfoMap, object : BiCallback<Boolean, Boolean> {
override fun onFirst(first: Boolean) {
EnergyBridge.postEnergyTask("bind_wechat")
handler.complete(true)
}
@ -209,7 +187,7 @@ class DefaultJsApi(
runOnUiThread {
// 若畅玩列表中安装了,优先启动畅玩游戏
if (VHelper.isInstalled(packageName)) {
if (!VHelper.showDialogIfVSpaceIsNeeded(context, "", "", "", "")) {
if (!VHelper.showDialogIfVSpaceIsNeeded(context)) {
VHelper.launch(context, packageName)
}
} else {
@ -263,24 +241,6 @@ class DefaultJsApi(
}
}
/**
* 是否为论坛详情的专区
*/
@JavascriptInterface
fun isForumZone(msg: Any): Boolean {
return !mBbsId.isNullOrEmpty()
}
/**
* 打开论坛搜索页
*/
@JavascriptInterface
fun openForumSearch(msg: Any) {
runOnUiThread {
DirectUtils.directToForumOrUserSearch(context, mBbsId ?: "", entrance.ifBlank { "内部网页" })
}
}
@JavascriptInterface
fun exitWebView(msg: Any) {
runOnUiThread { (context as Activity).finish() }
@ -289,6 +249,7 @@ class DefaultJsApi(
@JavascriptInterface
fun updateRegulationTestStatus(msg: Any) {
if (msg.toString().toLowerCase(Locale.getDefault()) == "pass") {
EnergyBridge.postEnergyTask("finish_etiquette_exam")
SPUtils.setString(Constants.SP_REGULATION_TEST_PASS_STATUS, "pass")
}
}
@ -364,17 +325,17 @@ class DefaultJsApi(
@JavascriptInterface
fun postWearBadgeTask(msg: Any) {
// do nothing
EnergyBridge.postEnergyTask("wear_badge")
}
@JavascriptInterface
fun startEnergyCenter(msg: Any) {
// do nothing
context.startActivity(EnergyBridge.getEnergyCenterIntent(context))
}
@JavascriptInterface
fun startEnergyHouse(msg: Any) {
// do nothing
context.startActivity(EnergyBridge.getEnergyHouseIntent(context, null))
}
@JavascriptInterface
@ -635,8 +596,6 @@ class DefaultJsApi(
if (mDownloadWatcher != null) {
DownloadManager.getInstance().removeObserver(mDownloadWatcher)
}
EventBus.getDefault().unregister(this@DefaultJsApi)
}
}
@ -659,14 +618,6 @@ class DefaultJsApi(
)
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun onEventMainThread(status: EBDownloadStatus) {
// 将下载任务删除事件回调给网页
if (mDownloadHandler != null && "delete" == status.status) {
mDownloadHandler?.setProgressData(SimpleDownloadEntity(status.url, 0F, "UNKNOWN").toJson())
}
}
@Keep
internal class ImageEvent(var imageList: ArrayList<String> = arrayListOf(), var position: Int = 0)

View File

@ -5,8 +5,9 @@ import android.content.Intent
import android.net.Uri
import android.text.TextUtils
import android.util.Base64
import com.gh.common.util.CheckLoginUtils
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.core.utils.CurrentActivityHolder
import com.gh.gamecenter.common.constant.Constants
import com.gh.common.util.*
import com.gh.common.util.DirectUtils.directToFeedback
import com.gh.common.util.DirectUtils.directToGameDetailVideoStreaming
import com.gh.common.util.DirectUtils.directToGameServerCalendar
@ -14,30 +15,22 @@ import com.gh.common.util.DirectUtils.directToGameVideo
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.LibaoDetailActivity
import com.gh.gamecenter.MainActivity
import com.gh.gamecenter.NewsDetailActivity
import com.gh.gamecenter.WebActivity
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.*
import com.gh.gamecenter.core.utils.GsonUtils.gson
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.entity.CommunityEntity
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.common.entity.SimpleGameEntity
import com.gh.gamecenter.common.eventbus.EBReuse
import com.gh.gamecenter.common.entity.SimpleGameEntity
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.common.utils.EnvHelper
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.utils.CurrentActivityHolder
import com.gh.gamecenter.core.utils.GsonUtils.gson
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.entity.ActivityLabelEntity
import com.gh.gamecenter.entity.SubjectRecommendEntity
import com.gh.gamecenter.entity.VideoLinkEntity
import com.gh.gamecenter.entity.*
import com.gh.gamecenter.eventbus.EBSkip
import com.gh.gamecenter.fragment.MainWrapperFragment
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.utils.PlatformUtils
import com.gh.gamecenter.fragment.MainWrapperFragment
import com.gh.gamecenter.gamecollection.publish.GameCollectionEditActivity
import com.gh.gamecenter.qa.BbsType
import com.gh.gamecenter.qa.video.publish.VideoPublishActivity
@ -408,11 +401,10 @@ object DefaultUrlHandler {
val packageMd5 = uri.getQueryParameter(EntranceConsts.KEY_PACKAGE_MD5)
val isQaFeedback = uri.getQueryParameter(EntranceConsts.KEY_IS_QA_FEEDBACK) == "true"
val content = if (TextUtils.isEmpty(gameId) || TextUtils.isEmpty(packageMd5)) String.format(
"%s—V%s—%sV%s",
"%s-%s-V%s",
uri.getQueryParameter(EntranceConsts.KEY_GAME_NAME),
uri.getQueryParameter(EntranceConsts.KEY_VERSION),
if (TextUtils.isEmpty(platformName)) platform else platformName,
uri.getQueryParameter(EntranceConsts.KEY_PLATFORM_VERSION),
uri.getQueryParameter(EntranceConsts.KEY_VERSION)
) else String.format(
"%s-%s-V%s\n游戏ID%s\n游戏包MD5%s\n",
uri.getQueryParameter(EntranceConsts.KEY_GAME_NAME),

View File

@ -21,7 +21,7 @@ object FixedRateJobHelper {
private const val TIME_PERIOD: Long = 10 * 60 * 1000L
private const val LOGHUB_PERIOD: Long = 2 * 60 * 1000L
private const val EXPOSURE_PERIOD: Long = 5 * 60 * 1000L
private const val REGION_SETTING_PERIOD: Long = 60 * 1000L
private const val REGION_SETTING_PERIOD: Long = 30 * 1000L
private const val VIDEO_RECORD_PERIOD: Long = 60 * 1000L
private const val DOWNLOAD_HEARTBEAT_PERIOD: Long = 60 * 1000L
@ -54,7 +54,9 @@ object FixedRateJobHelper {
// 提交曝光数据
if (elapsedTime % EXPOSURE_PERIOD == 0L) {
ExposureManager.commitSavedExposureEvents(true)
runOnUiThread {
ExposureManager.commitSavedExposureEvents(true)
}
}
// 分片检测下载进度

View File

@ -9,7 +9,7 @@ class CheckDownloadHandler : ChainHandler() {
override fun handleRequest(context: Context, gameEntity: GameEntity) {
val apk = gameEntity.getApk().safelyGetInRelease(0) ?: return
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name) { isSubscribe: Boolean ->
DialogUtils.checkDownload(context, apk.size) { isSubscribe: Boolean ->
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
} else {

View File

@ -122,6 +122,17 @@ public class Config {
return false;
}
/**
* 是否启用畅玩游戏
*/
public static boolean isVGameEnabled() {
if (getSettings() == null) {
return false;
}
return !"off".equals(getSettings().getGameSmooth());
}
/**
* VPN 开关选项是否开启
*/
@ -207,7 +218,7 @@ public class Config {
PackageHelper.initList();
// 初始化畅玩相关的东西
VHelper.init(HaloApp.getInstance());
VHelper.init(HaloApp.getInstance(), false);
}
@Nullable
@ -218,8 +229,6 @@ public class Config {
if (!TextUtils.isEmpty(json)) {
mSettingsEntity = GsonUtils.fromJson(json, SettingsEntity.class);
}
mSettingsEntity.setGameSmooth("off");
} catch (Exception e) {
e.printStackTrace();
}
@ -385,16 +394,18 @@ public class Config {
}
});
RetrofitManager.getInstance()
.getVApi().getSettings(BuildConfig.VERSION_NAME)
.subscribeOn(Schedulers.io())
.subscribe(new BiResponse<VSetting>() {
@Override
public void onSuccess(VSetting data) {
mVSetting = data;
SPUtils.setString(Constants.SP_V_SETTINGS, GsonUtils.toJson(data));
}
});
if (mVSetting == null) {
RetrofitManager.getInstance()
.getVApi().getSettings(BuildConfig.VERSION_NAME)
.subscribeOn(Schedulers.io())
.subscribe(new BiResponse<VSetting>() {
@Override
public void onSuccess(VSetting data) {
mVSetting = data;
SPUtils.setString(Constants.SP_V_SETTINGS, GsonUtils.toJson(data));
}
});
}
RetrofitManager.getInstance()
.getApi().getGameGuidePopup(Build.MANUFACTURER, Build.VERSION.RELEASE, Build.MODEL, channel, BuildConfig.VERSION_NAME)

View File

@ -24,7 +24,6 @@ import com.gh.common.chain.CertificationHandler;
import com.gh.common.chain.ChainBuilder;
import com.gh.common.chain.ChainHandler;
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.OverseaDownloadHandler;
@ -398,9 +397,8 @@ public class BindingAdapters {
}
ChainBuilder builder = new ChainBuilder();
builder.addHandler(new GamePermissionHandler());
builder.addHandler(new CheckStoragePermissionHandler());
builder.addHandler(new ValidateVSpaceHandler());
builder.addHandler(new GamePermissionHandler());
builder.addHandler(new BrowserInstallHandler());
builder.addHandler(new PackageCheckHandler());
builder.addHandler(new DownloadDialogHelperHandler());
@ -457,7 +455,7 @@ public class BindingAdapters {
}
if (gameEntity.isVGame()) {
VHelper.installOrLaunch((AppCompatActivity) v.getContext(), gameEntity);
VHelper.installOrLaunch((AppCompatActivity) v.getContext(), gameEntity.getApk().get(0).getPackageName());
return;
}
@ -475,9 +473,10 @@ public class BindingAdapters {
case INSTALL_NORMAL:
if (gameEntity.getApk().size() == 1) {
DownloadEntity downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity);
String packageName = gameEntity.getApk().get(0).getPackageName();
if (gameEntity.isVGame()) {
VHelper.installOrLaunch(v.getContext(), gameEntity);
VHelper.installOrLaunch(v.getContext(), packageName);
return;
}
@ -489,7 +488,7 @@ public class BindingAdapters {
case RESERVABLE:
GamePermissionDialogFragment.show((AppCompatActivity) v.getContext(), gameEntity, gameEntity.getInfo(), () -> {
CheckLoginUtils.checkLogin(progressBar.getContext(), "", () -> {
ReservationHelper.reserve(v.getContext(), gameEntity.getId(), gameEntity.getName(), () -> {
ReservationHelper.reserve(v.getContext(), gameEntity.getId(), () -> {
LogUtils.logReservation(gameEntity, traceEvent);
updateReservation(progressBar, gameEntity);
});
@ -594,11 +593,9 @@ public class BindingAdapters {
case pause:
case timeout:
case neterror:
case diskisfull:
case diskioerror:
case waiting:
progressBar.setText(R.string.downloading);
if (downloadEntity.isPluggable() && PackagesManager.isInstalled(downloadEntity.getPackageName())) {
if (downloadEntity.isPluggable() && PackagesManager.INSTANCE.isInstalled(downloadEntity.getPackageName())) {
progressBar.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_PLUGIN);
} else {
progressBar.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
@ -607,7 +604,7 @@ public class BindingAdapters {
case done:
progressBar.setText(R.string.install);
if (downloadEntity.isPluggable()
&& PackagesManager.isInstalled(downloadEntity.getPackageName())) {
&& PackagesManager.INSTANCE.isInstalled(downloadEntity.getPackageName())) {
progressBar.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_PLUGIN);
} else {
progressBar.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);

View File

@ -22,7 +22,6 @@ import com.gh.gamecenter.R
import com.gh.gamecenter.ShellActivity
import com.gh.gamecenter.common.callback.ConfirmListener
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.core.utils.GsonUtils
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.feature.entity.AuthDialogEntity
@ -36,7 +35,7 @@ import com.lightgame.utils.AppManager
class CertificationDialog(
context: Context,
private val authDialogEntity: AuthDialogEntity,
val gameEntity: GameEntity,
val gameId: String,
val listener: ConfirmListener
) :
Dialog(context, R.style.GhAlertDialog) {
@ -70,11 +69,9 @@ class CertificationDialog(
actionRightTv.text = "去实名认证"
noRemindAgainCb.visibility = View.GONE
actionLeftTv.setOnClickListener {
SensorsBridge.trackEvent("VerificationPopupClick", "button_name", actionLeftTv.text.toString())
dismiss()
}
actionRightTv.setOnClickListener {
SensorsBridge.trackEvent("VerificationPopupClick", "button_name", actionRightTv.text.toString())
if (UserManager.getInstance().isLoggedIn) {
gotoAuthPage()
} else {
@ -87,7 +84,6 @@ class CertificationDialog(
actionRightTv.text = "继续下载"
noRemindAgainCb.visibility = View.GONE
actionLeftTv.setOnClickListener {
SensorsBridge.trackEvent("VerificationPopupClick", "button_name", actionLeftTv.text.toString())
if (UserManager.getInstance().isLoggedIn) {
gotoAuthPage()
} else {
@ -95,7 +91,6 @@ class CertificationDialog(
}
}
actionRightTv.setOnClickListener {
SensorsBridge.trackEvent("VerificationPopupClick", "button_name", actionRightTv.text.toString())
listener.onConfirm()
dismiss()
}
@ -105,9 +100,8 @@ class CertificationDialog(
actionRightTv.text = "继续下载"
noRemindAgainCb.visibility = View.VISIBLE
actionLeftTv.setOnClickListener {
SensorsBridge.trackEvent("VerificationPopupClick", "button_name", actionLeftTv.text.toString())
if (noRemindAgainCb.isChecked) {
SPUtils.setBoolean(gameEntity.id, true)
SPUtils.setBoolean(gameId, true)
}
if (UserManager.getInstance().isLoggedIn) {
gotoAuthPage()
@ -116,25 +110,14 @@ class CertificationDialog(
}
}
actionRightTv.setOnClickListener {
SensorsBridge.trackEvent("VerificationPopupClick", "button_name", actionRightTv.text.toString())
if (noRemindAgainCb.isChecked) {
SPUtils.getBoolean(gameEntity.id, true)
SPUtils.getBoolean(gameId, true)
}
listener.onConfirm()
dismiss()
}
}
}
SensorsBridge.trackEvent(
"VerificationDialogShow",
"game_id",
gameEntity.id,
"game_name",
gameEntity.name ?: "",
"game_type",
gameEntity.categoryChinese
)
}
//跳转登录页面
@ -162,7 +145,7 @@ class CertificationDialog(
context,
ShellActivity.Type.REAL_NAME_INFO,
).apply {
putExtra(EntranceConsts.KEY_GAME_ID, gameEntity.id)
putExtra(EntranceConsts.KEY_GAME_ID, gameId)
}, object : Callback {
override fun onActivityResult(resultCode: Int, data: Intent?) {
if (resultCode == Activity.RESULT_OK && data != null) {
@ -211,7 +194,7 @@ class CertificationDialog(
}
val isCloseAuthDialog = SPUtils.getBoolean(game.id, false)
if (authDialog != null && (authDialog.level != AuthDialogLevel.OPTIONAL_HINT.value || !isCloseAuthDialog)) {
val dialog = CertificationDialog(context, authDialog, game, listener)
val dialog = CertificationDialog(context, authDialog, game.id, listener)
dialog.show()
} else {
listener.onConfirm()

View File

@ -13,7 +13,6 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.FragmentTransaction
import com.airbnb.lottie.LottieAnimationView
import com.gh.common.constant.Config
import com.gh.common.util.NewFlatLogUtils
import com.gh.common.xapk.XapkInstaller
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
@ -32,8 +31,6 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
lateinit var mView: View
var isXapk = false
var url: String = ""
var gameId: String = ""
var gameName: String = ""
var mCallBack: ((isFromPermissionGrantedCallback: Boolean) -> Unit)? = null
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
@ -53,8 +50,6 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
switchLottie.setAnimation("lottie/install_permission_switch.json")
switchLottie.playAnimation()
if (isXapk) NewFlatLogUtils.logXApkInstallPermissionDialogShowed(gameId, gameName)
val randomNumber = if (isXapk) 1 else Random.nextInt(2)
closeTv.goneIf(randomNumber == 0)
closeIv.goneIf(randomNumber != 0)
@ -65,17 +60,14 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
closeTv.setOnClickListener {
if (isXapk) {
NewFlatLogUtils.logXApkInstallPermissionDialogClick("尝试解压", false, gameId, gameName)
mCallBack?.invoke(false)
}
dismiss()
}
closeIv.setOnClickListener {
if (isXapk) NewFlatLogUtils.logXApkInstallPermissionDialogClick("关闭", false, gameId, gameName)
dismiss()
}
activateTv.setOnClickListener {
NewFlatLogUtils.logXApkInstallPermissionDialogClick("立即开启", false, gameId, gameName)
PermissionHelper.toInstallPermissionSetting(requireActivity())
if (isXapk) {
SPUtils.setString(Constants.SP_XAPK_UNZIP_ACTIVITY, requireActivity().javaClass.name)
@ -87,8 +79,6 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == RESULT_OK && requestCode == INSTALL_PERMISSION_CODE) {
NewFlatLogUtils.logXApkInstallPermissionDialogClick("立即开启", true, gameId, gameName)
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
SPUtils.setString(Constants.SP_XAPK_UNZIP_ACTIVITY, "")
SPUtils.setString(Constants.SP_XAPK_URL, "")
@ -134,8 +124,6 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
installPermissionDialogFragment.mCallBack = callBack
installPermissionDialogFragment.isXapk = isXapk
installPermissionDialogFragment.url = downloadEntity.url
installPermissionDialogFragment.gameId = downloadEntity.gameId
installPermissionDialogFragment.gameName = downloadEntity.name
val transaction: FragmentTransaction = activity.supportFragmentManager.beginTransaction()
transaction.show(installPermissionDialogFragment)
transaction.commit()
@ -144,8 +132,6 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
this.mCallBack = callBack
this.isXapk = isXapk
this.url = downloadEntity.url
this.gameId = downloadEntity.gameId
this.gameName = downloadEntity.name
}
installPermissionDialogFragment.show(
activity.supportFragmentManager,

View File

@ -5,7 +5,6 @@ import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.common.loghub.LoghubHelper
import com.gh.gamecenter.common.utils.FixedSizeLinkedHashSet
import com.gh.gamecenter.common.utils.toJson
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.lightgame.utils.Utils
@ -31,13 +30,11 @@ object ExposureManager {
* Log a single exposure event.
*/
fun log(event: ExposureEvent) {
AppExecutor.logExecutor.execute {
if (!exposureCache.contains(event.id)) {
exposureSet.add(event)
exposureCache.add(event.id)
} else {
Utils.log("Exposure", "遇到重复曝光事件,自动过滤 ${event.id} - ${event.payload.gameName}")
}
if (!exposureCache.contains(event.id)) {
exposureSet.add(event)
exposureCache.add(event.id)
} else {
Utils.log("Exposure", "遇到重复曝光事件,自动过滤 ${event.id} - ${event.payload.gameName}")
}
}
@ -45,41 +42,37 @@ object ExposureManager {
* Log a collection of exposure event.
*/
fun log(eventList: List<ExposureEvent>) {
AppExecutor.logExecutor.execute {
for (event in eventList) {
if (!exposureCache.contains(event.id)) {
exposureSet.add(event)
exposureCache.add(event.id)
} else {
Utils.log("Exposure", "遇到重复曝光事件,自动过滤 ${event.id} - ${event.payload.gameName}")
}
for (event in eventList) {
if (!exposureCache.contains(event.id)) {
exposureSet.add(event)
exposureCache.add(event.id)
} else {
Utils.log("Exposure", "遇到重复曝光事件,自动过滤 ${event.id} - ${event.payload.gameName}")
}
commitSavedExposureEvents()
}
commitSavedExposureEvents()
}
/**
* @param forcedUpload Ignore all restrictions.
*/
fun commitSavedExposureEvents(forcedUpload: Boolean = false) {
AppExecutor.logExecutor.execute {
if (exposureSet.size < STORE_SIZE && !forcedUpload || exposureSet.size == 0) return@execute
if (exposureSet.size < STORE_SIZE && !forcedUpload || exposureSet.size == 0) return
uploadExposures(exposureSet, forcedUpload)
uploadExposures(exposureSet.toList(), forcedUpload)
Utils.log("Exposure", "提交了${exposureSet.size}条曝光记录")
exposureSet.clear()
}
Utils.log("Exposure", "提交了${exposureSet.size}条曝光记录")
exposureSet.clear()
}
private fun eliminateMultipleBrackets(jsonWithMultipleBracket: String): String {
return jsonWithMultipleBracket.replace("[[", "[").replace("]]", "]")
}
private fun uploadExposures(eventSet: HashSet<ExposureEvent>, forced: Boolean) {
eventSet.forEach {
private fun uploadExposures(eventList: List<ExposureEvent>, forced: Boolean) {
eventList.forEach {
LoghubHelper.uploadLog(buildLog(it), LOG_STORE, forced)
// it.recycle()
it.recycle()
}
}
@ -95,6 +88,7 @@ object ExposureManager {
eliminateMultipleBrackets(event.eTrace?.toJson() ?: "")
} else ""
)
logTime = event.time.toLong()
}
}

View File

@ -3,7 +3,6 @@ package com.gh.common.exposure
import android.text.TextUtils
import com.g00fy2.versioncompare.Version
import com.gh.common.util.PackageUtils
import com.gh.common.util.RealNameHelper
import com.gh.gamecenter.common.utils.FixedSizeLinkedHashSet
import com.gh.gamecenter.common.utils.toObject
import com.gh.gamecenter.feature.entity.ApkEntity
@ -31,9 +30,6 @@ object ExposureUtils {
} else {
entity.id
}
traceEvent ?: gameEntity.exposureEvent
gameEntity.gameVersion = entity.getApk().elementAtOrNull(0)?.version
?: gameEntity.gameVersion
gameEntity.platform = platform
@ -43,9 +39,7 @@ object ExposureUtils {
source = traceEvent?.source ?: ArrayList(),
eTrace = ExposureTraceUtils.appendTrace(traceEvent),
event = ExposureType.DOWNLOAD
).apply {
this.payload.certification = RealNameHelper.getCertificationStatus()
}
)
if (!TextUtils.isEmpty(entity.id)) {
ExposureManager.log(exposureEvent)
}
@ -81,9 +75,7 @@ object ExposureUtils {
source = traceEvent?.source ?: ArrayList(),
eTrace = ExposureTraceUtils.appendTrace(traceEvent),
event = ExposureType.DOWNLOAD_COMPLETE
).apply {
this.payload.certification = RealNameHelper.getCertificationStatus()
}
)
exposureEvent.payload.host = host
exposureEvent.payload.path = path
exposureEvent.payload.speed = speed

View File

@ -8,8 +8,6 @@ import com.google.gson.annotations.SerializedName
class RegionSetting(
@SerializedName("game_mirror")
var mirrorGameIdSet: HashSet<String>,
@SerializedName("game_mirror2")
var mirrorGameIdSet2: HashSet<String>?,
@SerializedName("game_block")
var filterGameIdSet: HashSet<String>,
@SerializedName("channel_control")

View File

@ -18,13 +18,9 @@ import io.reactivex.schedulers.Schedulers
object RegionSettingHelper {
// 是否是初始化调用
private var mIsInit = true
private var mChannelControl: RegionSetting.ChannelControl? = null
private var mFilterGameIdSet: HashSet<String>? = hashSetOf()
private var mDisplayMirrorGameIdSet: HashSet<String>? = hashSetOf()
private var mDisplayMirrorGameIdSet2: HashSet<String>? = hashSetOf()
private var mDisplayMirrorIfoGameIdSet: HashSet<String>? = hashSetOf()
private var mGameH5DownloadList: List<RegionSetting.GameH5Download>? = listOf()
private var mGameSpecialDownloadInfoList: List<RegionSetting.GameSpecialDownloadInfo>? = listOf()
private var mIpInfo: IpInfo? = null
@ -34,21 +30,7 @@ object RegionSettingHelper {
@JvmStatic
fun shouldThisGameDisplayMirrorInfo(gameId: String): Boolean {
return mDisplayMirrorGameIdSet?.contains(gameId) == true
|| mDisplayMirrorGameIdSet2?.contains(gameId) == true
}
/**
* 获取镜像数据的位置,是归属镜像 1 还是镜像 2
*/
fun getMirrorPosition(gameId: String): Int {
return if (mDisplayMirrorGameIdSet?.contains(gameId) == true) {
1
} else if (mDisplayMirrorGameIdSet2?.contains(gameId) == true) {
2
} else {
-1
}
return mDisplayMirrorIfoGameIdSet?.contains(gameId) ?: false
}
@JvmStatic
@ -114,15 +96,6 @@ object RegionSettingHelper {
@JvmStatic
fun getRegionSetting() {
debounceActionWithInterval(R.string.app_name, 5000) {
// 初始启动时先使用历史数据
if (mIsInit) {
SPUtils.getString(SP_SETTING).toObject<RegionSetting>()?.let {
updateSettingsInMemory(it)
}
mIsInit = false
}
// 使用默认的 Schdulers.io() 可能会触发 OOM
RetrofitManager.getInstance()
.api
@ -146,8 +119,7 @@ object RegionSettingHelper {
private fun updateSettingsInMemory(data: RegionSetting) {
mFilterGameIdSet = data.filterGameIdSet
mDisplayMirrorGameIdSet = data.mirrorGameIdSet
mDisplayMirrorGameIdSet2 = data.mirrorGameIdSet2
mDisplayMirrorIfoGameIdSet = data.mirrorGameIdSet
mChannelControl = data.channelControl
mGameH5DownloadList = data.gameH5DownloadList
mGameSpecialDownloadInfoList = data.gameSpecialDownloadInfoList

View File

@ -69,8 +69,4 @@ class AppProviderImpl : IAppProvider {
override fun getFlavorProvider(): IFlavorProvider {
return HaloApp.getInstance().flavorProvider
}
override fun getIsBrandNewInstall(): Boolean {
return HaloApp.getInstance().isBrandNewInstall
}
}

View File

@ -5,7 +5,6 @@ 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
@Route(path = RouteConsts.provider.errorHelper, name = "ErrorHelper暴露服务")
@ -19,13 +18,8 @@ class ErrorHelperProviderImpl : IErrorHelperProvider {
ErrorHelper.handleError(context, errorString, showHighPriorityHint)
}
override fun handleLoginError(
context: Context,
httpException: HttpException?,
loginTagChinese: String,
isCertificate: Boolean
) {
ErrorHelper.handleLoginError(context, httpException, loginTagChinese, isCertificate)
override fun handleLoginError(context: Context, httpException: HttpException?) {
ErrorHelper.handleLoginError(context, httpException)
}
override fun init(context: Context?) {

View File

@ -1,20 +0,0 @@
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
@Route(path = RouteConsts.provider.exposureManager, name = "ExposureManager暴露服务")
class ExposureManagerProviderImpl: IExposureManagerProvider {
override fun logExposure(exposureEvent: ExposureEvent) {
ExposureManager.log(exposureEvent)
}
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.FloatingBackViewManager
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IFloatingBackViewManagerProvider
@Route(path = RouteConsts.provider.floatingBackViewManager, name = "FloatingViewBackManager暴露服务")
class FloatingBackViewManagerProviderImpl : IFloatingBackViewManagerProvider {
override fun enableBackViewForTaskType() {
FloatingBackViewManager.enableBackView(FloatingBackViewManager.TYPE_TASK)
}
override fun init(context: Context?) {
// Do nothing
}
}

View File

@ -22,7 +22,7 @@ class GameDetailProviderImpl : IGameDetailProvider {
context: Context,
gameEntity: GameEntity?,
entrance: String,
defaultTab: String,
defaultTab: Int,
isSkipGameComment: Boolean,
scrollToLibao: Boolean,
scrollToServer: Boolean,

View File

@ -7,8 +7,7 @@ import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.common.entity.SimpleGameEntity
import com.gh.gamecenter.common.entity.SuggestType
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.provider.ILinkDirectUtilsProvider
import com.gh.gamecenter.common.provider.ILinkDirectUtilsProvider
@Route(path = RouteConsts.provider.linkDirectUtils, name = "DirectUtils暴露服务主要是暴露directToLinkPage方法")
class LinkDirectUtilsProviderImpl : ILinkDirectUtilsProvider {
@ -22,16 +21,6 @@ class LinkDirectUtilsProviderImpl : ILinkDirectUtilsProvider {
DirectUtils.directToLinkPage(context, linkEntity, entrance, path)
}
override fun directToLinkPage(
context: Context,
linkEntity: LinkEntity,
entrance: String,
path: String,
exposureEvent: ExposureEvent?
) {
DirectUtils.directToLinkPage(context, linkEntity, entrance, path, exposureEvent)
}
override fun directToSuggestion(context: Context, type: SuggestType, requestCode: Int?) {
DirectUtils.directToSuggestion(context, type, requestCode)
}

View File

@ -14,10 +14,6 @@ class RegionSettingHelperProviderImpl : IRegionSettingHelperProvider {
return RegionSettingHelper.shouldThisGameDisplayMirrorInfo(gameId)
}
override fun getMirrorPosition(gameId: String): Int {
return RegionSettingHelper.getMirrorPosition(gameId)
}
override fun shouldThisGameShowSpecialDownload(gameId: String): Boolean {
return RegionSettingHelper.shouldThisGameShowSpecialDownload(gameId)
}

View File

@ -22,12 +22,8 @@ import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.feature.entity.ApkEntity
import com.gh.gamecenter.feature.entity.SimulatorEntity
import com.gh.gamecenter.entity.TrackableEntity
import com.gh.ndownload.NDataChanger
import com.halo.assistant.HaloApp
import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadEntity
import com.lightgame.download.DownloadStatus
import com.lightgame.download.FileUtils
import com.lightgame.download.*
import com.lightgame.utils.Utils
import java.lang.ref.WeakReference
import java.text.DecimalFormat
@ -99,12 +95,6 @@ class SimulatorDownloadManager private constructor() {
downloadDialog?.dismiss()
}
}
DownloadStatus.diskisfull == downloadEntity.status -> {
ToastUtils.showToast("存储空间已满,下载任务已暂停")
}
DownloadStatus.diskioerror == downloadEntity.status -> {
ToastUtils.showToast("下载 IO 出现异常,下载任务已暂停")
}
DownloadStatus.neterror == downloadEntity.status -> {
ToastUtils.showToast("网络不稳定,下载任务已暂停")
}
@ -300,17 +290,13 @@ class SimulatorDownloadManager private constructor() {
HaloApp.put(simulator.name, simulator)
if (entity != null) {
when (entity.status) {
DownloadStatus.pause,
DownloadStatus.subscribe,
DownloadStatus.neterror,
DownloadStatus.timeout,
DownloadStatus.diskioerror,
DownloadStatus.diskisfull -> {
DownloadStatus.pause, DownloadStatus.subscribe,
DownloadStatus.neterror, DownloadStatus.timeout -> {
DownloadManager.getInstance().addObserver(dataWatcher)
uiExecutor.executeWithDelay(Runnable { DownloadManager.getInstance().resume(entity, true) }, 200)
downloadDialog?.show()
}
DownloadStatus.done -> NDataChanger.notifyDataChanged(entity)
DownloadStatus.done -> DataChanger.notifyDataChanged(entity)
else -> createDownload(apkEntity, simulator)
}

View File

@ -10,13 +10,15 @@ import com.gh.download.simple.AutoUnregisteredSimpleDownloadListener
import com.gh.download.simple.DownloadListener
import com.gh.gamecenter.R
import com.gh.gamecenter.common.eventbus.EBReuse
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.roundTo
import com.gh.gamecenter.common.utils.toResString
import com.gh.gamecenter.core.runOnUiThread
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.databinding.DialogArchiveLoadingBinding
import com.gh.gamecenter.entity.ArchiveEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.retrofit.RetrofitManager
import com.gh.vspace.VArchiveHelper
import com.gh.vspace.VHelper
@ -38,7 +40,6 @@ object ArchiveDownloadButtonHelper {
packageName: String,
archiveEntity: ArchiveEntity,
downloadBtn: TextView,
gameEntity: GameEntity?,
downloadCompletedListener: (() -> Unit)? = null
) {
downloadBtn.text = if (VArchiveHelper.isArchiveDownloaded(archiveEntity.md5)) {
@ -49,7 +50,7 @@ object ArchiveDownloadButtonHelper {
downloadBtn.setOnClickListener {
when {
// 检查是否已安装畅玩助手
!VHelper.isVSpaceInstalled(context) -> showVSpaceTipDialog(context, gameEntity)
!VHelper.isVSpaceInstalled(context) -> showVspaceTipDialog(context)
// 检查是否已安装游戏
!VHelper.isInstalled(packageName) -> {
// 检查游戏是否在安装中
@ -64,8 +65,7 @@ object ArchiveDownloadButtonHelper {
context,
entrance,
packageName,
archiveEntity,
gameEntity
archiveEntity
)
// 检查完毕下载存档
else -> downloadArchive(
@ -75,14 +75,13 @@ object ArchiveDownloadButtonHelper {
packageName,
archiveEntity,
downloadBtn,
gameEntity,
downloadCompletedListener
)
}
}
}
private fun showVSpaceTipDialog(context: Context, gameEntity: GameEntity?) {
private fun showVspaceTipDialog(context: Context) {
NewFlatLogUtils.logCloudArchiveVSpaceDownloadDialogShow()
DialogHelper.showDialog(
context,
@ -92,7 +91,7 @@ object ArchiveDownloadButtonHelper {
R.string.cancel.toResString(),
{
NewFlatLogUtils.logCloudArchiveVSpaceDownloadDialogClick(R.string.archive_vspace_dialog_confirm.toResString())
VHelper.showVSpaceDialog(context, gameEntity)
VHelper.showVspaceDialog(context)
},
{
NewFlatLogUtils.logCloudArchiveVSpaceDownloadDialogClick(R.string.cancel.toResString())
@ -125,8 +124,7 @@ object ArchiveDownloadButtonHelper {
context: Context,
entrance: String,
packageName: String,
archiveEntity: ArchiveEntity,
gameEntity: GameEntity?
archiveEntity: ArchiveEntity
) {
VArchiveHelper.getArchiveFile(archiveEntity.md5)?.run {
@ -146,14 +144,7 @@ object ArchiveDownloadButtonHelper {
}
}
NewFlatLogUtils.logCloudArchiveDownloadOrApply(
archiveEntity.name,
entrance,
gameEntity?.id ?: "",
gameEntity?.name ?: "",
archiveEntity.id,
false
)
NewFlatLogUtils.logCloudArchiveDownloadOrApply(archiveEntity.name, entrance)
}
private fun downloadArchive(
@ -163,7 +154,6 @@ object ArchiveDownloadButtonHelper {
packageName: String,
archiveEntity: ArchiveEntity,
downloadBtn: TextView,
gameEntity: GameEntity?,
downloadCompletedListener: (() -> Unit)? = null
) {
// 执行下载
@ -197,7 +187,7 @@ object ArchiveDownloadButtonHelper {
DownloadStatus.COMPLETED -> {
dismissArchiveLoadingDialog(archiveLoadingDialog)
downloadBtn.text = R.string.archive_apply.toResString()
showApplyArchiveTipDialog(context, entrance, packageName, archiveEntity, gameEntity)
showApplyArchiveTipDialog(context, entrance, packageName, archiveEntity)
downloadCompletedListener?.invoke()
}
else -> {
@ -212,22 +202,7 @@ object ArchiveDownloadButtonHelper {
})
NewFlatLogUtils.logCloudArchiveDownloadOrApply(
archiveEntity.name,
entrance,
gameEntity?.id ?: "",
gameEntity?.name ?: "",
archiveEntity.id,
true
)
SensorsBridge.trackEvent(
"CloudSaveDownload",
"cloud_save_name", archiveEntity.name,
"game_id", gameEntity?.id ?: "",
"game_name", gameEntity?.name ?: "",
"source_entrance", entrance
)
NewFlatLogUtils.logCloudArchiveDownloadOrApply(archiveEntity.name, entrance)
}
private fun showArchiveLoadingDialog(
@ -251,8 +226,7 @@ object ArchiveDownloadButtonHelper {
context: Context,
entrance: String,
packageName: String,
archiveEntity: ArchiveEntity,
gameEntity: GameEntity?
archiveEntity: ArchiveEntity
) {
DialogHelper.showDialog(
context,
@ -261,33 +235,14 @@ object ArchiveDownloadButtonHelper {
R.string.archive_apply.toResString(),
R.string.cancel.toResString(),
{
applyArchive(context, entrance, packageName, archiveEntity, gameEntity)
applyArchive(context, entrance, packageName, archiveEntity)
NewFlatLogUtils.logCloudArchiveApplyDialogRelated("cloud_save_overwrite_dialog_click", "使用")
SensorsBridge.trackEvent(
"CloudSaveOverwriteDialogClick",
"game_id", gameEntity?.id ?: "",
"game_name", gameEntity?.name ?: "",
"button_name", "使用"
)
},
{
NewFlatLogUtils.logCloudArchiveApplyDialogRelated("cloud_save_overwrite_dialog_click", "取消")
SensorsBridge.trackEvent(
"CloudSaveOverwriteDialogClick",
"game_id", gameEntity?.id ?: "",
"game_name", gameEntity?.name ?: "",
"button_name", "取消"
)
},
{ NewFlatLogUtils.logCloudArchiveApplyDialogRelated("cloud_save_overwrite_dialog_click", "取消") },
extraConfig = DialogHelper.Config(centerTitle = true)
)
NewFlatLogUtils.logCloudArchiveApplyDialogRelated("cloud_save_overwrite_dialog_show")
SensorsBridge.trackEvent(
"CloudSaveOverwriteDialogShow",
"game_id", gameEntity?.id ?: "",
"game_name", gameEntity?.name ?: ""
)
}
private fun dismissArchiveLoadingDialog(archiveLoadingDialog: Dialog) {

View File

@ -3,15 +3,11 @@ package com.gh.common.util;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.annotation.Nullable;
@ -23,7 +19,6 @@ import com.gh.gamecenter.adapter.viewholder.CommentViewHolder;
import com.gh.gamecenter.common.callback.SimpleCallback;
import com.gh.gamecenter.common.retrofit.BiResponse;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.common.utils.DialogHelper;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.gamecenter.core.utils.DisplayUtils;
@ -50,7 +45,6 @@ import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
@ -108,27 +102,17 @@ public class CommentUtils {
}
}
public static void showMorePopupWindow(
final View anchor,
final CommentEntity commentEntity,
final boolean showConversation,
final String patch,
final OnCommentDeleteListener onCommentDeleteListener
) {
Context context = anchor.getContext();
LayoutInflater inflater = LayoutInflater.from(context);
View contentView = inflater.inflate(R.layout.layout_popup_container, null);
PopupWindow popupWindow = new PopupWindow(
contentView,
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
);
popupWindow.setBackgroundDrawable(new ColorDrawable(0));
popupWindow.setTouchable(true);
popupWindow.setFocusable(true);
popupWindow.setOutsideTouchable(true);
public static void showReportDialog(final CommentEntity commentEntity,
final Context context,
final boolean showConversation,
final String patch) {
final Dialog dialog = new Dialog(context);
LinearLayout container = new LinearLayout(context);
container.setOrientation(LinearLayout.VERTICAL);
container.setBackgroundColor(ContextCompat.getColor(context, R.color.background_white));
container.setPadding(0, DisplayUtils.dip2px(context, 12), 0, DisplayUtils.dip2px(context, 12));
LinearLayout container = contentView.findViewById(R.id.container);
List<String> dialogType = new ArrayList<>();
dialogType.add("复制");
dialogType.add("投诉");
@ -137,23 +121,21 @@ public class CommentUtils {
dialogType.add("查看对话");
}
String commentUserId = commentEntity.getUser().getId();
String userId = UserManager.getInstance().getUserId();
MeEntity me = commentEntity.getMe();
boolean isCommentedByUser = Objects.equals(commentUserId, userId);
boolean isContentAuthorOrModerator = me != null && (me.isModerator() || me.isContentAuthor());
if (isCommentedByUser || isContentAuthorOrModerator) {
dialogType.add("删除");
}
for (String s : dialogType) {
View itemView = inflater.inflate(R.layout.layout_popup_option_item, container, false);
TextView reportTv = itemView.findViewById(R.id.hint_text);
final TextView reportTv = new TextView(context);
reportTv.setText(s);
container.addView(itemView);
reportTv.setTextSize(17);
reportTv.setTextColor(ContextCompat.getColor(context, R.color.title));
reportTv.setBackgroundResource(R.drawable.textview_white_style);
int widthPixels = context.getResources().getDisplayMetrics().widthPixels;
reportTv.setLayoutParams(new LinearLayout.LayoutParams((widthPixels * 9) / 10,
LinearLayout.LayoutParams.WRAP_CONTENT));
reportTv.setPadding(DisplayUtils.dip2px(context, 20), DisplayUtils.dip2px(context, 12),
0, DisplayUtils.dip2px(context, 12));
container.addView(reportTv);
reportTv.setOnClickListener(v -> {
popupWindow.dismiss();
dialog.cancel();
switch (reportTv.getText().toString()) {
case "复制":
copyText(commentEntity.getContent(), context);
@ -161,30 +143,19 @@ public class CommentUtils {
case "投诉":
CheckLoginUtils.checkLogin(context, patch + "-投诉",
() -> showReportTypeDialog(commentEntity, context));
break;
case "查看对话":
context.startActivity(CommentDetailActivity.getIntent(context, commentEntity.getId(), null));
break;
case "删除":
DialogHelper.INSTANCE.showDialog(
context,
"提示",
"删除评论后,评论下所有的回复都将被删除",
"删除",
"取消",
() -> {
deleteComment(context, commentEntity, onCommentDeleteListener);
return null;
},
null,
new DialogHelper.Config("", false, true, true, false, -1)
);
break;
}
});
}
ExtensionsKt.showAutoOrientation(popupWindow, anchor, 0, 0);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(container);
dialog.show();
}
private static void showReportTypeDialog(final CommentEntity commentEntity, final Context context) {
@ -459,28 +430,6 @@ public class CommentUtils {
});
}
public static void deleteComment(
final Context context,
final CommentEntity commentEntity,
final OnCommentDeleteListener listener
) {
Dialog dialog = DialogUtils.showWaitDialog(
context,
context.getString(R.string.post_dialog_hint)
);
RetrofitManager.getInstance().getApi()
.deleteComment(commentEntity.getId())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doFinally(dialog::cancel)
.subscribe(new Response<ResponseBody>() {
@Override
public void onResponse(@Nullable ResponseBody response) {
listener.onCommentDelete();
}
});
}
// 设置评论item 用户相关的view(点赞/头像/用户名)
public static void setCommentUserView(Context mContext, CommentViewHolder holder, CommentEntity entity) {
@ -591,8 +540,4 @@ public class CommentUtils {
public interface OnVoteListener {
void onVote();
}
public interface OnCommentDeleteListener {
void onCommentDelete();
}
}

View File

@ -9,7 +9,7 @@ import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.util.Log;
import com.gh.gamecenter.common.base.GlobalActivityManager;
import com.gh.base.GlobalActivityManager;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.common.base.activity.BaseActivity;
import com.gh.gamecenter.common.constant.Constants;
@ -118,11 +118,6 @@ public class DataUtils {
String originalGid = HaloApp.getInstance().getGid();
HaloApp.getInstance().setGid(gid);
// gid 变更时上报 gid 变更日志
if (!TextUtils.isEmpty(originalGid) && !originalGid.equals(gid)) {
NewFlatLogUtils.logGidChanged(originalGid, gid);
}
SensorsBridge.setGid(gid);
// 避免重复调用
@ -171,25 +166,14 @@ public class DataUtils {
IdCardEntity idCardEntity = data.getIdCard();
if (idCardEntity != null) {
boolean isCertificated = !TextUtils.isEmpty(data.getIdCard().getId());
boolean isAdult = data.getIdCard().getMinor() == null || !data.getIdCard().getMinor();
values.put(GhContentProvider.KEY_IS_CERTIFICATED, isCertificated); // 是否认证
values.put(GhContentProvider.KEY_IS_ADULT, isAdult); // 是否成年
if (!isCertificated) {
RealNameHelper.updateCertificationStatus(0);
} else {
if (isAdult) {
RealNameHelper.updateCertificationStatus(2);
} else {
RealNameHelper.updateCertificationStatus(1);
}
}
values.put(GhContentProvider.KEY_IS_CERTIFICATED, !TextUtils.isEmpty(data.getIdCard().getId())); // 是否认证
values.put(GhContentProvider.KEY_IS_ADULT,
data.getIdCard().getMinor() == null
|| !data.getIdCard().getMinor()
);
} else {
values.put(GhContentProvider.KEY_IS_CERTIFICATED, false);
values.put(GhContentProvider.KEY_IS_ADULT, false);
RealNameHelper.updateCertificationStatus(0);
}
EventBus.getDefault().post(new EBReuse(Constants.EB_REALNAME_RESULT));

View File

@ -114,7 +114,7 @@ public class DetailDownloadUtils {
if (downloadEntity == null && viewHolder.gameEntity.isVGame()) {
String packageName = viewHolder.gameEntity.getUniquePackageName();
if (!TextUtils.isEmpty(packageName)) {
downloadEntity = VHelper.getVDownloadEntitySnapshot(viewHolder.gameEntity.getId(), packageName);
downloadEntity = VHelper.getDownloadEntitySnapshot(viewHolder.gameEntity.getId(), packageName);
}
}
@ -214,7 +214,7 @@ public class DetailDownloadUtils {
if (downloadEntity == null && viewHolder.gameEntity.isVGame()) {
String packageName = viewHolder.gameEntity.getUniquePackageName();
if (!TextUtils.isEmpty(packageName)) {
downloadEntity = VHelper.getVDownloadEntitySnapshot(viewHolder.gameEntity.getId(), packageName);
downloadEntity = VHelper.getDownloadEntitySnapshot(viewHolder.gameEntity.getId(), packageName);
}
}
@ -262,13 +262,11 @@ public class DetailDownloadUtils {
case downloading:
case redirected:
case pause:
case diskisfull:
case diskioerror:
case overflow:
String downloadingText = "游戏加载中 " + downloadEntity.getPercent() + "%";
String resumeText = "继续加载 " + downloadEntity.getPercent() + "%";
viewHolder.mDownloadPb.setText((downloadEntity.getStatus() == DownloadStatus.downloading || downloadEntity.getStatus() == DownloadStatus.redirected) ? downloadingText : resumeText);
if (downloadEntity.isPluggable() && PackagesManager.isInstalled(downloadEntity.getPackageName())) {
if (downloadEntity.isPluggable() && PackagesManager.INSTANCE.isInstalled(downloadEntity.getPackageName())) {
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_PLUGIN);
} else {
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
@ -350,8 +348,6 @@ public class DetailDownloadUtils {
case timeout:
case neterror:
case subscribe:
case diskisfull:
case diskioerror:
case pause:
viewHolder.mDownloadPb.setText("继续加载 " + viewHolder.downloadEntity.getPercent() + "%");
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);

View File

@ -41,7 +41,6 @@ import com.facebook.drawee.generic.GenericDraweeHierarchy;
import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.common.constant.Config;
import com.gh.common.filter.RegionSetting;
import com.gh.common.xapk.XapkDialogHelper;
import com.gh.gamecenter.R;
import com.gh.gamecenter.ShellActivity;
import com.gh.gamecenter.adapter.ReportReasonAdapter;
@ -57,7 +56,6 @@ import com.gh.gamecenter.common.utils.DialogHelper;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.gamecenter.common.utils.NetworkUtils;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.common.view.CustomLinkMovementMethod;
import com.gh.gamecenter.common.view.DrawableView;
import com.gh.gamecenter.common.view.FixLinearLayoutManager;
@ -121,7 +119,7 @@ public class DialogUtils {
return dialog;
}
public static void checkDownload(Context context, String size, String gameId, String gameName, CheckDownloadCallBack callBack) {
public static void checkDownload(Context context, String size, CheckDownloadCallBack callBack) {
if (!NetworkUtils.isNetworkConnected(context)) {
showNoConnectionDownloadDialog(context, () -> {
},
@ -136,9 +134,7 @@ public class DialogUtils {
// MtaHelper.onEvent("移动网络下载", NetworkUtils.getMobileNetworkType(context), "出现弹窗提示");
showDownloadDialog(context,
() -> callBack.onResponse(false),
() -> callBack.onResponse(true),
gameId,
gameName);
() -> callBack.onResponse(true));
}
}
@ -167,11 +163,9 @@ public class DialogUtils {
DialogHelper.showDialog(context, "下载提示", "网络异常,请检查手机网络状态", "知道了", "WiFi自动下载", listener::onConfirm, cancelListener::onCancel, false, "", "");
}
public static void showDownloadDialog(Context context, ConfirmListener listener, CancelListener cancelListener, String gameId, String gameName) {
public static void showDownloadDialog(Context context, ConfirmListener listener, CancelListener cancelListener) {
context = checkDialogContext(context);
NewFlatLogUtils.logDownloadMobileDataDialogShow(gameId, gameName);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_download_traffic, null);
@ -181,7 +175,6 @@ public class DialogUtils {
Context finalContext = context;
allowOnce.setOnClickListener(v -> {
NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "允许一次");
AppExecutor.getUiExecutor().executeWithDelay(() -> {
Utils.toast(finalContext, "已使用移动网络下载,请注意流量消耗");
}, 500);
@ -190,13 +183,11 @@ public class DialogUtils {
// MtaHelper.onEvent("移动网络下载", NetworkUtils.getMobileNetworkType(finalContext), "本次允许");
});
wifiAuto.setOnClickListener(v -> {
NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "WiFi自动下载");
cancelListener.onCancel();
dialog.dismiss();
// MtaHelper.onEvent("移动网络下载", NetworkUtils.getMobileNetworkType(finalContext), "连上WiFi后自动下载");
});
allowAlways.setOnClickListener(v -> {
NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "总是允许");
SPUtils.setBoolean(getTrafficDownloadHintKey(), false);
AppExecutor.getUiExecutor().executeWithDelay(() -> {
// 显示了弹窗以后,即便下面这个 toast 放在 listener.onConfirm 后调用也是显示 listener.onConfirm 里的 toast
@ -208,8 +199,6 @@ public class DialogUtils {
// MtaHelper.onEvent("移动网络下载", NetworkUtils.getMobileNetworkType(finalContext), "总是允许");
});
dialog.setOnCancelListener(downloadDialog -> NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "关闭弹窗"));
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(contentView);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
@ -921,8 +910,6 @@ public class DialogUtils {
public static void showRegulationTestDialog(Context context, @NonNull ConfirmListener confirmListener, @NonNull CancelListener cancelListener) {
context = checkDialogContext(context);
SensorsBridge.trackEvent("EtiquetteTestDialogShow");
final Dialog dialog = new TrackableDialog(
context,
R.style.GhAlertDialog,
@ -948,7 +935,6 @@ public class DialogUtils {
cancelListener.onCancel();
MtaHelper.onEvent("礼仪考试", "礼仪考试弹窗", "跳过");
SensorsBridge.trackEvent("EtiquetteTestDialogClick", "button_name", "跳过");
dialog.dismiss();
});
@ -957,7 +943,6 @@ public class DialogUtils {
Util_System_Keyboard.hideSoftKeyboard((Activity) finalContext1);
MtaHelper.onEvent("礼仪考试", "礼仪考试弹窗", "确定");
SensorsBridge.trackEvent("EtiquetteTestDialogClick", "button_name", "进入考试");
confirmListener.onConfirm();
dialog.dismiss();
});
@ -973,7 +958,33 @@ public class DialogUtils {
}
public static void showUnzipFailureDialog(Context context, DownloadEntity downloadEntity) {
XapkDialogHelper.INSTANCE.showUnzipFailureDialog(context, downloadEntity, false);
final Context activityContext = checkDialogContext(context);
final Dialog dialog = new Dialog(activityContext, R.style.GhAlertDialog);
Window window = dialog.getWindow();
if (window != null) {
window.setBackgroundDrawableResource(android.R.color.transparent);
}
View contentView = LayoutInflater.from(activityContext).inflate(R.layout.dialog_unzip_failure, null);
View cancelBtn = contentView.findViewById(R.id.cancel);
View confirmBtn = contentView.findViewById(R.id.confirm);
cancelBtn.setOnClickListener(v -> {
dialog.dismiss();
});
confirmBtn.setOnClickListener(v -> {
dialog.dismiss();
String hint = "" + downloadEntity.getName() + "》游戏安装包解压失败,问题反馈:";
HelpAndFeedbackBridge.startSuggestionActivity(activityContext, SuggestType.normal, null, hint);
});
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(contentView);
dialog.show();
}
public static void showNoticeDialog(Context context, String title, String content, @NonNull ConfirmListener listener) {
@ -1014,7 +1025,7 @@ public class DialogUtils {
SimpleDraweeView badgeView = contentView.findViewById(R.id.dialog_badge);
ImageView badgeLightBg = contentView.findViewById(R.id.dialog_badge_light_bg);
ImageUtils.display(badgeView, badge.getMIcon());
ImageUtils.display(badgeView, badge.getIcon());
titleTv.setText(badge.getName());
// 领取条件文本超过一行就不显示
@ -1068,8 +1079,6 @@ public class DialogUtils {
if ("self".equals(badge.getReceive().getType())) {
receiveTv.setText(R.string.receive_badge);
} else if ("auto".equals(badge.getReceive().getType())) {
receiveTv.setText(R.string.view_badge);
} else {
receiveTv.setText(R.string.apply_badge);
}

View File

@ -37,7 +37,6 @@ import com.gh.gamecenter.discovery.DiscoveryActivity
import com.gh.gamecenter.download.DownloadFragment.Companion.INDEX_UPDATE
import com.gh.gamecenter.entity.*
import com.gh.gamecenter.eventbus.EBSkip
import com.gh.gamecenter.feature.entity.GameDetailServer
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.MeEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
@ -45,7 +44,6 @@ import com.gh.gamecenter.feature.exposure.ExposureEvent.Companion.createEvent
import com.gh.gamecenter.feature.exposure.ExposureType
import com.gh.gamecenter.forum.detail.ForumDetailActivity
import com.gh.gamecenter.forum.home.CommunityHomeFragment
import com.gh.gamecenter.forum.search.ForumOrUserSearchActivity
import com.gh.gamecenter.fragment.MainWrapperFragment
import com.gh.gamecenter.game.columncollection.detail.ColumnCollectionDetailActivity
import com.gh.gamecenter.game.commoncollection.detail.CommonCollectionDetailActivity
@ -190,7 +188,6 @@ object DirectUtils {
"game_list_detail",
"bbs_video",
"explore_column",
"game_explore",
"column_test_v2"
)
@ -311,14 +308,13 @@ object DirectUtils {
name = linkEntity.name,
display = linkEntity.display ?: Display()
),
entrance,
exposureEvent
entrance
)
}
"column_collection", "专题合集" -> directToColumnCollection(context, linkEntity.link!!, -1, entrance)
"server", "game_server", "开服表" -> directToGameServers(context, entrance, path, exposureEvent)
"server", "game_server", "开服表" -> directToGameServers(context, entrance, path)
"top_game_comment" -> directToAmway(context, null, entrance, path)
@ -354,13 +350,6 @@ object DirectUtils {
"bbs_detail" -> directForumDetail(context, linkEntity.link ?: "", entrance)
"bbs_section" -> directForumDetailSection(
context,
linkEntity.community?.id,
linkEntity.link ?: "",
entrance
)
"mobile_bind" -> {
CheckLoginUtils.checkLogin(context, entrance) {
context.startActivity(SettingBridge.getBindPhoneNormalIntent(context, false))
@ -440,28 +429,11 @@ object DirectUtils {
"game_list" -> directToGameCollectionSquare(context, entrance, "", "", "")
"game_list_detail" -> directToGameCollectionDetail(
context,
linkEntity.link ?: "",
entrance,
exposureEvent = exposureEvent
)
"game_list_detail" -> directToGameCollectionDetail(context, linkEntity.link ?: "", entrance)
"explore_column", "game_explore" -> context.startActivity(
DiscoveryActivity.getIntent(
context,
entrance,
exposureEvent
)
)
"explore_column" -> context.startActivity(DiscoveryActivity.getIntent(context, entrance))
"column_test_v2" -> context.startActivity(
GameServerTestV2Activity.getIntent(
context,
entrance,
exposureEvent
)
)
"column_test_v2" -> context.startActivity(GameServerTestV2Activity.getIntent(context, entrance))
"" -> {
// do nothing
@ -574,9 +546,6 @@ object DirectUtils {
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putString(KEY_TO, NewsDetailActivity::class.java.simpleName)
bundle.putString(KEY_NEWSID, id)
if (entrance?.contains("隐私政策") == true) {
bundle.putBoolean(KEY_HIDE_USELESS_INFO, true)
}
jumpActivity(context, bundle)
}
@ -679,10 +648,10 @@ object DirectUtils {
bundle.putString(KEY_GAMEID, id)
if (!TextUtils.isEmpty(tab)) {
when (tab) {
"comment" -> bundle.putString(KEY_TARGET, GameDetailFragment.TAB_RATING)
"desc" -> bundle.putString(KEY_TARGET, GameDetailFragment.TAB_DESC)
"forum" -> bundle.putString(KEY_TARGET, GameDetailFragment.TAB_BBS)
"zone" -> bundle.putString(KEY_TARGET, GameDetailFragment.TAB_TRENDS)
"comment" -> bundle.putInt(KEY_TARGET, GameDetailFragment.INDEX_RATING)
"desc" -> bundle.putInt(KEY_TARGET, GameDetailFragment.INDEX_DESC)
"forum" -> bundle.putInt(KEY_TARGET, GameDetailFragment.INDEX_BBS)
"zone" -> bundle.putInt(KEY_TARGET, GameDetailFragment.INDEX_TRENDES)
}
}
if (traceEvent != null) {
@ -722,7 +691,7 @@ object DirectUtils {
bundle.putString(KEY_ENTRANCE, entrance)
bundle.putString(KEY_GAMEID, id)
bundle.putBoolean(KEY_OPEN_VIDEO_STREAMING, true)
bundle.putString(KEY_TARGET, GameDetailFragment.TAB_DESC)
bundle.putInt(KEY_TARGET, GameDetailFragment.INDEX_DESC)
jumpActivity(context, bundle)
}
@ -730,14 +699,14 @@ object DirectUtils {
fun directToGameDetail(
context: Context,
id: String,
defaultTab: String = GameDetailFragment.TAB_DESC,
defaultTab: Int = GameDetailFragment.INDEX_DESC,
entrance: String? = null
) {
val bundle = Bundle()
bundle.putString(KEY_TO, GameDetailActivity::class.java.name)
bundle.putString(KEY_ENTRANCE, entrance)
bundle.putString(KEY_GAMEID, id)
bundle.putString(KEY_TARGET, defaultTab)
bundle.putInt(KEY_TARGET, defaultTab)
jumpActivity(context, bundle)
}
@ -800,11 +769,8 @@ object DirectUtils {
jumpActivity(context, bundle)
}
/**
* 畅玩助手反馈跳转
*/
@JvmStatic
fun directToVGameFeedback(
fun directToFeedbackCompat(
context: Context,
content: String? = null,
hintType: String? = null,
@ -819,14 +785,14 @@ object DirectUtils {
if (isQaFeedback) {
bundle.putBoolean(KEY_IS_QA_FEEDBACK, true)
bundle.putString(KEY_QA_CONTENT_ID, qaContentId)
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.cwzsQuestion)
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.normal)
} else {
bundle.putString(KEY_CONTENT, content)
if (TextUtils.isEmpty(hintType)) {
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.gameQuestion)
bundle.putString(KEY_SUGGEST_HINT_TYPE, KEY_PLUGIN)
} else {
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.cwzsQuestion)
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.normal)
bundle.putString(KEY_SUGGEST_HINT_TYPE, hintType)
}
}
@ -1374,17 +1340,11 @@ object DirectUtils {
* 跳转到板块
*/
@JvmStatic
fun directToBlock(
context: Context,
blockData: SubjectRecommendEntity,
entrance: String,
exposureEvent: ExposureEvent? = null
) {
fun directToBlock(context: Context, blockData: SubjectRecommendEntity, entrance: String) {
val bundle = Bundle()
bundle.putString(KEY_TO, BlockActivity::class.java.name)
bundle.putParcelable(KEY_BLOCK_DATA, blockData)
bundle.putString(KEY_ENTRANCE, entrance)
exposureEvent?.let { bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureEvent.source)) }
jumpActivity(context, bundle)
}
@ -1392,11 +1352,10 @@ object DirectUtils {
* 跳转到开服表
*/
@JvmStatic
fun directToGameServers(context: Context, entrance: String, path: String, exposureEvent: ExposureEvent? = null) {
fun directToGameServers(context: Context, entrance: String, path: String) {
val bundle = Bundle()
bundle.putString(KEY_TO, GameServersActivity::class.java.name)
bundle.putString(KEY_ENTRANCE, ToolBarActivity.mergeEntranceAndPath(entrance, path))
exposureEvent?.let { bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureEvent.source)) }
jumpActivity(context, bundle)
}
@ -1424,7 +1383,7 @@ object DirectUtils {
response?.apply {
if (zone.status == "on") {
if (zone.style == "link") {
directToGameDetail(context, gameId, GameDetailFragment.TAB_TRENDS, entrance)
directToGameDetail(context, gameId, GameDetailFragment.INDEX_TRENDES, entrance)
} else {
directToWebView(context, url, entrance)
}
@ -1457,21 +1416,6 @@ object DirectUtils {
jumpActivity(context, bundle)
}
@JvmStatic
fun directForumDetailSection(
context: Context,
bbsId: String? = "",
sectionId: String = "",
entrance: String? = null
) {
val bundle = Bundle()
bundle.putString(KEY_TO, ForumDetailActivity::class.java.name)
bundle.putString(KEY_BBS_ID, bbsId)
bundle.putString(KEY_BBS_SECTION_ID, sectionId)
bundle.putString(KEY_ENTRANCE, entrance)
jumpActivity(context, bundle)
}
/**
* 到首页-首页 tab
*/
@ -1846,8 +1790,7 @@ object DirectUtils {
collectionId: String,
blockId: String = "",
blockName: String = "",
entrance: String = "",
exposureEvent: ExposureEvent? = null
entrance: String = ""
) {
if (collectionId.isEmpty()) return
val bundle = Bundle()
@ -1856,7 +1799,6 @@ object DirectUtils {
bundle.putString(KEY_BLOCK_NAME, blockName)
bundle.putString(KEY_ENTRANCE, entrance)
bundle.putString(KEY_COLLECTION_ID, collectionId)
exposureEvent?.let { bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureEvent.source)) }
jumpActivity(context, bundle)
}
@ -1892,20 +1834,13 @@ object DirectUtils {
* 跳转至游戏单详情
*/
@JvmStatic
fun directToGameCollectionDetail(
context: Context,
id: String,
entrance: String? = null,
path: String? = null,
exposureEvent: ExposureEvent? = null
) {
fun directToGameCollectionDetail(context: Context, id: String, entrance: String? = null, path: String? = null) {
if (id.isEmpty()) return
val bundle = Bundle()
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putString(KEY_PATH, path)
bundle.putString(KEY_TO, GameCollectionDetailActivity::class.java.name)
bundle.putString(KEY_GAME_COLLECTION_ID, id)
exposureEvent?.let { bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureEvent.source)) }
jumpActivity(context, bundle)
}
@ -1947,15 +1882,6 @@ object DirectUtils {
}
}
/**
* 跳转到论坛搜索页
* @param bbsId, 为空时搜索全范围的内容,不为空时搜索该 bbsId 对应的内容
*/
@JvmStatic
fun directToForumOrUserSearch(context: Context, bbsId: String, entrance: String) {
context.startActivity(ForumOrUserSearchActivity.getIntent(context, bbsId, entrance))
}
@JvmStatic
fun directToVGameDownload(context: Context, switchToDownloadingTab: Boolean = false) {
val bundle = Bundle()

View File

@ -29,7 +29,7 @@ object DownloadDialogHelper {
private fun retrieveAvailableDialog(gameEntity: GameEntity, apkEntity: ApkEntity): GameEntity.Dialog? {
val downloadDialog = if (gameEntity.shouldUseMirrorInfo()) {
gameEntity.obtainMirrorData()?.downloadDialog
gameEntity.mirrorData?.downloadDialog
} else {
gameEntity.downloadDialog
}

View File

@ -10,12 +10,14 @@ import androidx.recyclerview.widget.RecyclerView
import com.gh.common.chain.*
import com.gh.common.constant.Config
import com.gh.common.dialog.DeviceRemindDialog
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.common.filter.RegionSettingHelper
import com.gh.common.history.HistoryHelper
import com.gh.common.repository.ReservationRepository
import com.gh.common.simulator.NewSimulatorGameManager
import com.gh.common.simulator.SimulatorDownloadManager
import com.gh.common.simulator.SimulatorGameManager
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.common.xapk.XapkInstaller
import com.gh.common.xapk.XapkInstaller.cancelUnzipTask
import com.gh.common.xapk.XapkUnzipStatus
@ -24,17 +26,15 @@ import com.gh.download.dialog.DownloadDialog
import com.gh.gamecenter.R
import com.gh.gamecenter.WebActivity
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.callback.CancelListener
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.energy.EnergyBridge
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.PluginLocation
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.dialog.GamePermissionDialogFragment
import com.gh.gamecenter.manager.PackagesManager
import com.gh.gamecenter.teenagermode.TeenagerModeActivity
@ -244,11 +244,9 @@ object DownloadItemUtils {
context.getString(R.string.check)
}
isClickable = true
buttonStyle = DownloadButton.ButtonStyle.NORMAL
} else {
if ("dialog" == offStatus) {
text = context.getString(R.string.check)
buttonStyle = DownloadButton.ButtonStyle.NORMAL
} else if ("updating" == offStatus) {
text = context.getString(R.string.updating)
buttonStyle = DownloadButton.ButtonStyle.UPDATING
@ -266,7 +264,7 @@ object DownloadItemUtils {
var downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity)
if (downloadEntity == null && gameEntity.isVGame()) {
downloadEntity = VHelper.getVDownloadEntitySnapshot(gameEntity.id, gameEntity.getUniquePackageName())
downloadEntity = VHelper.getDownloadEntitySnapshot(gameEntity.id, gameEntity.getUniquePackageName())
}
if (downloadEntity == null) {
@ -311,8 +309,6 @@ object DownloadItemUtils {
DownloadStatus.timeout,
DownloadStatus.neterror,
DownloadStatus.subscribe,
DownloadStatus.diskisfull,
DownloadStatus.diskioerror,
DownloadStatus.overflow -> {
buttonStyle = DownloadButton.ButtonStyle.NORMAL
setText(R.string.resume)
@ -432,8 +428,6 @@ object DownloadItemUtils {
DownloadStatus.pause,
DownloadStatus.timeout,
DownloadStatus.neterror,
DownloadStatus.diskioerror,
DownloadStatus.diskisfull,
DownloadStatus.subscribe,
DownloadStatus.overflow -> {
if (isMultiVersion) {
@ -598,7 +592,6 @@ object DownloadItemUtils {
gamePermissionDialogFragment?.dismissAllowingStateLoss()
if (SPUtils.getBoolean(Constants.SP_TEENAGER_MODE)) {
downloadBtn.setOnClickListener {
logDownloadButtonClick(gameEntity, downloadBtn)
DialogHelper.showDialog(
context,
"提示",
@ -618,7 +611,6 @@ object DownloadItemUtils {
if (gameEntity.isSpecialDownload()) {
val info = RegionSettingHelper.getGameSpecialDownloadInfo(gameEntity.id) ?: return
downloadBtn.setOnClickListener {
logDownloadButtonClick(gameEntity, downloadBtn)
DialogHelper.showDialog(
context,
"提示",
@ -646,27 +638,16 @@ object DownloadItemUtils {
if (gameEntity.isReservable) {
if (!ReservationRepository.thisGameHasBeenReserved(gameEntity.id)) {
downloadBtn.setOnClickListener {
SensorsBridge.trackEvent(
"AppointmentGame",
"game_name",
gameEntity.name ?: "",
"game_id",
gameEntity.id
)
allStateClickCallback?.onCallback()
CheckLoginUtils.checkLogin(context, entrance) {
clickCallback?.onCallback()
ReservationHelper.reserve(
context,
gameEntity.id,
gameEntity.name ?: "",
object : EmptyCallback {
override fun onCallback() {
LogUtils.logReservation(gameEntity, traceEvent)
adapter?.notifyItemChanged(position)
refreshCallback?.onCallback()
}
})
ReservationHelper.reserve(context, gameEntity.id, object : EmptyCallback {
override fun onCallback() {
LogUtils.logReservation(gameEntity, traceEvent)
adapter?.notifyItemChanged(position)
refreshCallback?.onCallback()
}
})
}
}
} else {
@ -708,14 +689,12 @@ object DownloadItemUtils {
val gameH5Download = RegionSettingHelper.getGameH5DownloadByGameId(gameEntity.id)
if (gameH5Download != null) {
downloadBtn.setOnClickListener {
logDownloadButtonClick(gameEntity, downloadBtn)
DialogUtils.showGameH5DownloadDialog(context, gameEntity, gameH5Download)
}
return
}
if (gameEntity.getApk().size == 0 && gameEntity.h5Link != null) {
downloadBtn.setOnClickListener {
logDownloadButtonClick(gameEntity, downloadBtn)
allStateClickCallback?.onCallback()
MtaHelper.onEvent("H5页面", "入口", "列表页_" + gameEntity.name)
val linkEntity = gameEntity.h5Link
@ -734,7 +713,6 @@ object DownloadItemUtils {
}
} else if (gameEntity.getApk().size == 1) {
downloadBtn.setOnClickListener {
logDownloadButtonClick(gameEntity, downloadBtn)
val clickRunnable = EmptyCallback {
allStateClickCallback?.onCallback()
clickCallback?.onCallback()
@ -836,7 +814,6 @@ object DownloadItemUtils {
addHandler(CertificationHandler())
addHandler(VersionNumberHandler())
addHandler(OverseaDownloadHandler())
addHandler(CheckStoragePermissionHandler())
addHandler(ValidateVSpaceHandler())
addHandler(CheckDownloadHandler())
}
@ -885,11 +862,12 @@ object DownloadItemUtils {
}
if (gameEntity.isVGame()) {
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity)
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity.getUniquePackageName() ?: "")
} else {
install(context, gameEntity, position, adapter, refreshCallback)
}
} else if (str == context.getString(R.string.launch)) {
EnergyBridge.postEnergyTask("play_game", gameEntity.id, gameEntity.getApk()[0].packageName)
//启动模拟器游戏
if (SimulatorGameManager.isSimulatorGame(gameEntity)) {
if (NewSimulatorGameManager.shouldShowUpdateNewSimulatorAlert(context)) {
@ -910,7 +888,7 @@ object DownloadItemUtils {
}
if (gameEntity.isVGame()) {
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity)
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity.getUniquePackageName() ?: "")
return
}
@ -928,12 +906,7 @@ object DownloadItemUtils {
}
DownloadDialogHelper.findAvailableDialogAndShow(context, gameEntity, apk, object : EmptyCallback {
override fun onCallback() {
DialogUtils.checkDownload(
context,
apk.size,
gameEntity.id,
gameEntity.name
) { isSubscribe: Boolean ->
DialogUtils.checkDownload(context, apk.size) { isSubscribe: Boolean ->
update(context, gameEntity, entrance, location, isSubscribe, traceEvent)
}
}
@ -1066,23 +1039,4 @@ object DownloadItemUtils {
) {
DownloadManager.createDownload(context, gameEntity, "更新", entrance, location, isSubscribe, traceEvent)
}
private fun logDownloadButtonClick(gameEntity: GameEntity, downloadBtn: View) {
val buttonName = if (downloadBtn is DownloadButton) downloadBtn.text else ""
SensorsBridge.trackEvent(
"DownLoadbuttonClick",
"game_id", gameEntity.id,
"game_name", gameEntity.name ?: "",
"game_type", gameEntity.categoryChinese,
"download_status", gameEntity.downloadStatusChinese,
"button_name", buttonName,
"game_schema_type", gameEntity.gameBitChinese,
"page_name", GlobalActivityManager.getCurrentPageEntity().pageName,
"page_id", GlobalActivityManager.getCurrentPageEntity().pageId,
"page_business_id", GlobalActivityManager.getCurrentPageEntity().pageBusinessId,
"last_page_name", GlobalActivityManager.getLastPageEntity().pageName,
"last_page_id", GlobalActivityManager.getLastPageEntity().pageId,
"last_page_business_id", GlobalActivityManager.getLastPageEntity().pageBusinessId
)
}
}

View File

@ -98,20 +98,18 @@ object DownloadNotificationHelper {
DownloadStatus.waiting -> builder.setContentText("等待中")
DownloadStatus.subscribe,
DownloadStatus.timeout,
DownloadStatus.diskisfull,
DownloadStatus.diskioerror,
DownloadStatus.neterror -> builder.setContentText("已暂停连接WiFi自动下载")
else -> builder.setContentText("暂停中")
}
builder.setProgress(PROGRESS_MAX, entity.percent.toInt(), false)
}
when (entity.status) {
DownloadStatus.done -> {
when {
entity.status == DownloadStatus.done -> {
builder.setSortKey("A")
builder.setOngoing(true) // 垃圾华为 sortKey 不起效 priority 也不起效,要将下载完成任务的通知置顶只能设置为 ongoing喷了
}
DownloadStatus.downloading -> builder.setSortKey("B")
entity.status == DownloadStatus.downloading -> builder.setSortKey("B")
else -> builder.setSortKey("C")
}

View File

@ -8,8 +8,6 @@ import com.gh.common.xapk.XapkInstaller
import com.gh.download.DownloadDataHelper
import com.gh.download.DownloadManager
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.GlobalActivityManager.getCurrentPageEntity
import com.gh.gamecenter.common.base.GlobalActivityManager.getLastPageEntity
import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.callback.ConfirmListener
import com.gh.gamecenter.common.constant.Constants
@ -19,6 +17,7 @@ import com.gh.gamecenter.common.eventbus.EBShowDialog
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.energy.EnergyBridge
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.SimulatorEntity
@ -85,10 +84,7 @@ object DownloadObserver {
)
}, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true))
return
} else if (DownloadStatus.neterror == downloadEntity.status
|| DownloadStatus.timeout == downloadEntity.status
|| DownloadStatus.diskioerror == downloadEntity.status
|| DownloadStatus.diskisfull == downloadEntity.status) {
} else if (DownloadStatus.neterror == downloadEntity.status || DownloadStatus.timeout == downloadEntity.status) {
if (downloadEntity.meta[Constants.MARK_RETRY_DOWNLOAD].isNullOrEmpty()
&& NetworkUtils.isWifiConnected(HaloApp.getInstance().application)
) {
@ -99,14 +95,7 @@ object DownloadObserver {
Utils.log("DownloadObserver", "下载重试->" + downloadEntity.toJson())
}
} else {
if (DownloadStatus.diskisfull == downloadEntity.status) {
ToastUtils.toast("磁盘已满,请清理空间后重试下载")
} else if (DownloadStatus.diskioerror == downloadEntity.status) {
ToastUtils.toast("磁盘 IO 异常,请稍后重试")
} else {
ToastUtils.toast("网络不稳定,下载任务已暂停")
}
Utils.toast(mApplication, "网络不稳定,下载任务已暂停")
DataLogUtils.uploadNeterrorLog(mApplication, downloadEntity)
debugOnly {
@ -217,6 +206,7 @@ object DownloadObserver {
GameActivityDownloadHelper.clear()
EnergyBridge.postEnergyTask("download_game", downloadEntity.gameId, downloadEntity.packageName)
val platform = PlatformUtils.getInstance(mApplication)
.getPlatformName(downloadEntity.platform)
if (platform != null) {
@ -234,13 +224,17 @@ object DownloadObserver {
downloadEntity.name + " - " + platform + " - 下载完成"
)
else -> {
if (!downloadEntity.isVGame()) {
if (downloadEntity.isVGame()) {
VHelper.showFloatingWindow(downloadEntity.packageName)
} else {
Utils.toast(mApplication, downloadEntity.name + " - 下载完成")
}
}
}
} else {
if (!downloadEntity.isVGame()) {
if (downloadEntity.isVGame()) {
VHelper.showFloatingWindow(downloadEntity.packageName)
} else {
Utils.toast(mApplication, downloadEntity.name + " - 下载完成")
}
}
@ -276,7 +270,7 @@ object DownloadObserver {
val downloadType = downloadEntity.getMetaExtra(Constants.EXTRA_DOWNLOAD_TYPE)
// 是否是自动安装
val isAutoInstall = SPUtils.getBoolean(Constants.SP_AUTO_INSTALL, true)
if (downloadType != Constants.VSPACE_32_DOWNLOAD_ONLY && (downloadType == Constants.SIMULATOR_DOWNLOAD || isAutoInstall)) {
if (downloadType == Constants.SIMULATOR_DOWNLOAD || isAutoInstall) {
if (FileUtils.isEmptyFile(downloadEntity.path)) {
Utils.toast(mApplication, R.string.install_failure_hint)
downloadManager.cancel(downloadEntity.url)
@ -312,6 +306,9 @@ object DownloadObserver {
}
}
}
// 统计下载完成
uploadData(gameId, downloadEntity.platform)
}
// 下载过程分析统计
@ -378,28 +375,7 @@ object DownloadObserver {
SensorsBridge.trackEvent(
"HaloFunGameDownloadDone",
"game_name", downloadEntity.name,
"game_id", downloadEntity.gameId,
"game_schema_type", if (downloadEntity.getMetaExtra(VHelper.KEY_BIT) == "32") "32位" else "64位"
)
} else if (downloadEntity.gameId == Constants.HALO_FUN_GAME_ID) {
SensorsBridge.trackEvent(
"HaloFunDownloadDone",
"space_schema_type",
if (downloadEntity.packageName == VHelper.VSPACE_32BIT_PACKAGENAME) "32位" else "64位"
)
} else if (downloadEntity.gameId != Constants.GHZS_GAME_ID && downloadEntity.getMetaExtra(Constants.EXTRA_DOWNLOAD_TYPE) != Constants.SIMULATOR_DOWNLOAD) {
SensorsBridge.trackEvent(
"DownloadProcessFinish",
"game_id", downloadEntity.gameId,
"game_name", downloadEntity.meta[Constants.GAME_NAME] ?: "",
"game_type", downloadEntity.meta[Constants.GAME_TYPE] ?: "",
"game_schema_type", if (downloadEntity.getMetaExtra(VHelper.KEY_BIT) == "32") "32位" else "64位",
"page_name", getCurrentPageEntity().pageName,
"page_id", getCurrentPageEntity().pageId,
"page_business_id", getCurrentPageEntity().pageBusinessId,
"last_page_name", getLastPageEntity().pageName,
"last_page_id", getLastPageEntity().pageId,
"last_page_business_id", getLastPageEntity().pageBusinessId
"game_id", downloadEntity.gameId
)
}
@ -452,4 +428,19 @@ object DownloadObserver {
DataLogUtils.uploadHijack(mApplication, downloadEntity)
}
// 统计下载
private fun uploadData(id: String, platform: String?) {
val params = HashMap<String, String>()
params["game"] = id
params["platform"] = platform ?: ""
val body = RequestBody.create(
MediaType.parse("application/json"),
JSONObject(params as Map<*, *>).toString()
)
RetrofitManager.getInstance().api.postDownload(body)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Response())
}
}

View File

@ -15,10 +15,11 @@ import com.gh.gamecenter.common.avoidcallback.AvoidOnResultManager
import com.gh.gamecenter.common.avoidcallback.Callback
import com.gh.gamecenter.common.callback.ConfirmListener
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toObject
import com.gh.gamecenter.common.entity.ErrorEntity
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.login.user.LoginTag
import com.halo.assistant.fragment.user.UserInfoEditFragment
import com.halo.assistant.fragment.user.VerifyPhoneFragment
import com.lightgame.utils.AppManager
@ -402,50 +403,23 @@ object ErrorHelper {
}
@JvmStatic
fun handleLoginError(
context: Context,
httpException: HttpException?,
loginTagChinese: String,
isCertificate: Boolean
) {
fun handleLoginError(context: Context, httpException: HttpException?) {
try {
var errorReason = ""
val errorEntity: ErrorEntity? =
httpException?.response()?.errorBody()?.string()?.toObject()
when {
errorEntity?.code == 403099 -> {
errorReason = "当前账号正在注销,禁止登录"
Utils.toast(context, errorReason)
}
errorEntity?.code == 403099 -> Utils.toast(context, "当前账号正在注销,禁止登录")
// 用户禁止登录
errorEntity?.code == 403401 -> {
errorReason = "您的账号存在违规,不允许登录"
Utils.toast(context, errorReason)
}
errorEntity?.code == 403401 -> Utils.toast(context, "您的账号存在违规,不允许登录")
// 设备禁止登录
errorEntity?.code == 403404 -> {
errorReason = "您的设备存在违规,不允许登录"
Utils.toast(context, errorReason)
}
errorEntity?.code == 403404 -> Utils.toast(context, "您的设备存在违规,不允许登录")
errorEntity?.toast?.isNotEmpty() == true -> {
Utils.toast(context, errorEntity.toast)
errorReason = errorEntity.toast!!
}
errorEntity?.toast?.isNotEmpty() == true -> Utils.toast(context, errorEntity.toast)
else -> Utils.toast(context, R.string.login_failure)
}
if (!isCertificate) SensorsBridge.trackEvent(
"LoginResult",
"login_type",
loginTagChinese,
"login_result",
"失败",
"defeated_reason",
errorReason
)
} catch (e: Exception) {
e.printStackTrace()
Utils.toast(context, R.string.login_failure)

View File

@ -7,6 +7,7 @@ import android.view.View
import android.widget.TextView
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.energy.EnergyBridge
import com.lightgame.utils.Util_System_Keyboard
import com.lzf.easyfloat.EasyFloat
import com.lzf.easyfloat.enums.ShowPattern
@ -21,6 +22,7 @@ import com.lzf.easyfloat.enums.SidePattern
object FloatingBackViewManager {
const val TYPE_ACTIVITY = "type_activity"
const val TYPE_TASK = "type_task"
private const val FLOATING_BACK_VIEW = "floating_back_view"
@ -54,6 +56,10 @@ object FloatingBackViewManager {
titleView?.text = "返回活动"
DirectUtils.directToWebView(activity, mActivityUrl, ("返回活动浮窗"))
} else if (mType == TYPE_TASK) {
titleView?.text = "返回任务"
activity.startActivity(EnergyBridge.getEnergyCenterIntent(activity))
}
disableBackView()
@ -105,4 +111,11 @@ object FloatingBackViewManager {
mActivityUrl = ""
}
/**
* 返回小浮窗类型是否为活动
*/
fun isTypeActivity(): Boolean {
return mType == TYPE_ACTIVITY
}
}

View File

@ -31,6 +31,7 @@ import com.gh.gamecenter.core.utils.EmptyCallback
import com.gh.gamecenter.core.utils.MtaHelper
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.energy.EnergyBridge
import com.gh.gamecenter.feature.entity.ApkEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.PluginLocation
@ -137,7 +138,7 @@ object GameActivityDownloadHelper {
) {
if (!ReservationRepository.thisGameHasBeenReserved(gameEntity.id)) {
CheckLoginUtils.checkLogin(context, entrance) {
ReservationHelper.reserve(context, gameEntity.id, gameEntity.name ?: "", object : EmptyCallback {
ReservationHelper.reserve(context, gameEntity.id, object : EmptyCallback {
override fun onCallback() {
LogUtils.logReservation(gameEntity, traceEvent)
clear()
@ -221,7 +222,7 @@ object GameActivityDownloadHelper {
) {
GamePermissionDialogFragment.show((context as AppCompatActivity), gameEntity, gameEntity.info) {
CertificationDialog.showCertificationDialog(context, gameEntity) {
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name) { isSubscribe: Boolean ->
DialogUtils.checkDownload(context, apk.size) { isSubscribe: Boolean ->
download(context, gameEntity, apk, isSubscribe, entrance, location, traceEvent)
}
}
@ -241,12 +242,7 @@ object GameActivityDownloadHelper {
VHelper.validateVSpaceBeforeAction(context, gameEntity) {
GamePermissionDialogFragment.show((context as AppCompatActivity), gameEntity, gameEntity.info) {
CertificationDialog.showCertificationDialog(context, gameEntity) {
DialogUtils.checkDownload(
context,
apk.size,
gameEntity.id,
gameEntity.name
) { isSubscribe: Boolean ->
DialogUtils.checkDownload(context, apk.size) { isSubscribe: Boolean ->
download(context, gameEntity, apk, isSubscribe, entrance, location, traceEvent)
}
}
@ -267,7 +263,7 @@ object GameActivityDownloadHelper {
DownloadDialog.showDownloadDialog(context, gameEntity, traceEvent, entrance, location)
} else {
CertificationDialog.showCertificationDialog(context, gameEntity) {
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name) { isSubscribe: Boolean ->
DialogUtils.checkDownload(context, apk.size) { isSubscribe: Boolean ->
plugin(context, gameEntity, apk, entrance, location, isSubscribe, traceEvent)
}
}
@ -303,7 +299,7 @@ object GameActivityDownloadHelper {
}
if (gameEntity.isVGame()) {
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity)
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity.getUniquePackageName() ?: "")
} else {
downloadEntity?.run {
install(context, gameEntity, apk, this)
@ -320,6 +316,7 @@ object GameActivityDownloadHelper {
location: String,
traceEvent: ExposureEvent
) {
EnergyBridge.postEnergyTask("play_game", gameEntity.id, gameEntity.getApk()[0].packageName)
//启动模拟器游戏
if (SimulatorGameManager.isSimulatorGame(gameEntity)) {
if (NewSimulatorGameManager.shouldShowUpdateNewSimulatorAlert(context)) {
@ -341,7 +338,7 @@ object GameActivityDownloadHelper {
}
if (gameEntity.isVGame()) {
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity)
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity.getUniquePackageName() ?: "")
return
}
@ -360,7 +357,7 @@ object GameActivityDownloadHelper {
location: String,
traceEvent: ExposureEvent
) {
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name) { isSubscribe: Boolean ->
DialogUtils.checkDownload(context, apk.size) { isSubscribe: Boolean ->
update(context, gameEntity, apk, entrance, location, isSubscribe, traceEvent)
}
}

View File

@ -107,7 +107,7 @@ public class GameUtils {
// 在下载管理找不到下载实体,并且为畅玩游戏的时候到畅玩数据库里找
if (downloadEntity == null && gameEntity.isVGame()) {
downloadEntity = VHelper.getVDownloadEntitySnapshot(gameEntity.getId(), apkEntity.getPackageName());
downloadEntity = VHelper.getDownloadEntitySnapshot(gameEntity.getId(), apkEntity.getPackageName());
}
if (downloadEntity != null) {

View File

@ -33,6 +33,94 @@ object IntegralLogHelper {
log(json, "score", false)
}
fun logTask(event: String, location: String, jobId: String, jobName: String, jobType: String) {
val json = JSONObject().apply {
tryWithDefaultCatch {
put("meta", LogUtils.getMetaObject())
put("event", event)
put("location", location)
put("timestamp", System.currentTimeMillis() / 1000)
put("launch_id", launchId)
put("session_id", sessionId)
put("job_id", jobId)
put("job_name", jobName)
put("job_type", jobType)
}
}
debugOnly {
Utils.log("LogUtils->$json")
}
log(json, "score", false)
}
fun logCommodityCategory(
event: String,
location: String,
entrance: String,
categoryId: String,
categoryName: String
) {
val json = JSONObject().apply {
tryWithDefaultCatch {
put("meta", LogUtils.getMetaObject())
put("event", event)
put("location", location)
put("timestamp", System.currentTimeMillis() / 1000)
put("launch_id", launchId)
put("session_id", sessionId)
put("entrance", entrance)
put("goods_species_id", categoryId)
put("goods_species_name", categoryName)
}
}
debugOnly {
Utils.log("LogUtils->$json")
}
log(json, "score", false)
}
fun logCommodity(event: String, location: String, commodityId: String, categoryId: String, categoryName: String) {
val json = JSONObject().apply {
tryWithDefaultCatch {
put("meta", LogUtils.getMetaObject())
put("event", event)
put("location", location)
put("timestamp", System.currentTimeMillis() / 1000)
put("launch_id", launchId)
put("session_id", sessionId)
put("goods_id", commodityId)
put("goods_species_id", categoryId)
put("goods_species_name", categoryName)
}
}
debugOnly {
Utils.log("LogUtils->$json")
}
log(json, "score", false)
}
fun logEnergyRange(event: String, location: String, range: String) {
val json = JSONObject().apply {
tryWithDefaultCatch {
put("meta", LogUtils.getMetaObject())
put("event", event)
put("location", location)
put("timestamp", System.currentTimeMillis() / 1000)
put("launch_id", launchId)
put("session_id", sessionId)
put("energy_range", range)
}
}
debugOnly {
Utils.log("LogUtils->$json")
}
log(json, "score", false)
}
fun logPendent(event: String, location: String, pendentId: String, pendentType: String? = null) {
val json = JSONObject().apply {
tryWithDefaultCatch {

View File

@ -18,7 +18,6 @@ import com.gh.gamecenter.adapter.LibaoDetailAdapter;
import com.gh.gamecenter.common.utils.DialogHelper;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.NotificationHelper;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.core.utils.ToastUtils;
import com.gh.gamecenter.core.utils.UrlFilterUtils;
import com.gh.gamecenter.feature.entity.ApkEntity;
@ -306,7 +305,7 @@ public class LibaoUtils {
public static void initLibaoBtn(final Context context, final TextView libaoBtn, final LibaoEntity libaoEntity,
final boolean isInstallRequired, final LibaoDetailAdapter adapter, boolean shouldUpdateStatus,
final String entrance, final String sourceEntrance, final OnLibaoStatusChangeListener listener) {
final String entrance, final OnLibaoStatusChangeListener listener) {
setLiBaoBtnStatusRound(libaoBtn, libaoEntity, shouldUpdateStatus, context);
String status = libaoEntity.getStatus();
@ -407,29 +406,13 @@ public class LibaoUtils {
if ("repeatLing".equals(status)) {
ToastUtils.showToast("礼包每天0点刷新明日0点后可再领一个");
} else {
libaoLing(context, libaoBtn, libaoEntity, adapter, isInstallRequired, null, entrance, sourceEntrance, listener);
libaoLing(context, libaoBtn, libaoEntity, adapter, isInstallRequired, null, entrance, listener);
}
SensorsBridge.trackEvent("GameGiftDraw",
"gift_type", "普通礼包",
"game_name", libaoEntity.getGame().getName(),
"game_id", libaoEntity.getGame().getId(),
"gift_id", libaoEntity.getId(),
"gift_name", libaoEntity.getName(),
"source_entrance", sourceEntrance
);
break;
case "再淘":
case "再淘一个":
case "淘号":
libaoTao(context, libaoBtn, libaoEntity, isInstallRequired, adapter, status, entrance, sourceEntrance, listener);
SensorsBridge.trackEvent("GameGiftDraw",
"gift_type", "淘号礼包",
"game_name", libaoEntity.getGame().getName(),
"game_id", libaoEntity.getGame().getId(),
"gift_id", libaoEntity.getId(),
"gift_name", libaoEntity.getName(),
"source_entrance", sourceEntrance
);
libaoTao(context, libaoBtn, libaoEntity, isInstallRequired, adapter, status, entrance, listener);
break;
}
});
@ -437,7 +420,7 @@ public class LibaoUtils {
}
private static void libaoTao(Context context, TextView libaoBtn, LibaoEntity libaoEntity, boolean isInstallRequired, LibaoDetailAdapter adapter,
String status, String entrance, String sourceEntrance, final OnLibaoStatusChangeListener listener) {
String status, String entrance, final OnLibaoStatusChangeListener listener) {
if ("repeatTao".equals(status)) {
Utils.toast(context, "没到重复淘号时间, 礼包每天0点刷新");
return;
@ -492,16 +475,6 @@ public class LibaoUtils {
des = "您已领取过相同的礼包,可能无法成功兑换";
}
ToastUtils.showToast(des);
SensorsBridge.trackEvent("GameGiftDrawResult",
"draw_result", "成功",
"gift_type", "淘号礼包",
"game_name", libaoEntity.getGame().getName(),
"game_id", libaoEntity.getGame().getId(),
"gift_id", libaoEntity.getId(),
"gift_name", libaoEntity.getName(),
"source_entrance", sourceEntrance
);
}
@Override
@ -560,22 +533,12 @@ public class LibaoUtils {
}
}
Utils.toast(context, "发生异常");
SensorsBridge.trackEvent("GameGiftDrawResult",
"draw_result", "失败",
"gift_type", "淘号礼包",
"game_name", libaoEntity.getGame().getName(),
"game_id", libaoEntity.getGame().getId(),
"gift_id", libaoEntity.getId(),
"gift_name", libaoEntity.getName(),
"source_entrance", sourceEntrance
);
}
});
}
private static void libaoLing(final Context context, TextView libaoBtn, final LibaoEntity libaoEntity, final LibaoDetailAdapter adapter,
final boolean isInstallRequired, String captchaCode, final String entrance, final String sourceEntrance, final OnLibaoStatusChangeListener listener) {
final boolean isInstallRequired, String captchaCode, final String entrance, final OnLibaoStatusChangeListener listener) {
if (BuildConfig.DEBUG) {
if (libaoBtn != null) {
@ -606,15 +569,6 @@ public class LibaoUtils {
}
if (TextUtils.isEmpty(libaoCode)) {
Utils.toast(context, "领取异常");
SensorsBridge.trackEvent("GameGiftDrawResult",
"draw_result", "失败",
"gift_type", "普通礼包",
"game_name", libaoEntity.getGame().getName(),
"game_id", libaoEntity.getGame().getId(),
"gift_id", libaoEntity.getId(),
"gift_name", libaoEntity.getName(),
"source_entrance", sourceEntrance
);
return;
}
libaoEntity.setAvailable(libaoEntity.getAvailable() - 1);
@ -642,15 +596,6 @@ public class LibaoUtils {
}
return null;
});
SensorsBridge.trackEvent("GameGiftDrawResult",
"draw_result", "成功",
"gift_type", "普通礼包",
"game_name", libaoEntity.getGame().getName(),
"game_id", libaoEntity.getGame().getId(),
"gift_id", libaoEntity.getId(),
"gift_name", libaoEntity.getName(),
"source_entrance", sourceEntrance
);
}
@Override
@ -696,7 +641,7 @@ public class LibaoUtils {
}, false, "", "");
libaoEntity.setStatus("used_up");
if (libaoBtn != null) {
initLibaoBtn(context, libaoBtn, libaoEntity, isInstallRequired, adapter, false, entrance, sourceEntrance, listener);
initLibaoBtn(context, libaoBtn, libaoEntity, isInstallRequired, adapter, false, entrance, listener);
}
break;
case "maintaining":
@ -714,22 +659,13 @@ public class LibaoUtils {
} else if (exception.code() == 412) {
// 需要验证
GeetestUtils.getInstance().showDialog(context, captcha ->
libaoLing(context, libaoBtn, libaoEntity, adapter, isInstallRequired, captcha, entrance, sourceEntrance, listener));
libaoLing(context, libaoBtn, libaoEntity, adapter, isInstallRequired, captcha, entrance, listener));
return;
} else if (exception.code() == 401) {
return;
}
}
Utils.toast(context, "发生异常");
SensorsBridge.trackEvent("GameGiftDrawResult",
"draw_result", "失败",
"gift_type", "普通礼包",
"game_name", libaoEntity.getGame().getName(),
"game_id", libaoEntity.getGame().getId(),
"gift_id", libaoEntity.getId(),
"gift_name", libaoEntity.getName(),
"source_entrance", sourceEntrance
);
}
}, captchaCode);
}

View File

@ -415,19 +415,13 @@ public class LogUtils {
LoghubUtils.log(object, "video_streaming", false);
}
public static void uploadWelcomeDialog(String action,
String dialogId,
String linkId,
String linkType,
String linkTitle) {
public static void uploadWelcomeDialog(String action, String dialogId, String linkTitle) {
ExposureEntity payload = new ExposureEntity();
payload.setWelcomeDialogId(dialogId);
payload.setWelcomeDialogLinkTitle(linkTitle);
SimpleLogContainerEntity entity = new SimpleLogContainerEntity();
entity.setEvent("dialog");
entity.setLinkId(linkId);
entity.setLinkType(linkType);
entity.setAction(action);
entity.setMeta(MetaUtil.INSTANCE.getMeta());
entity.setPayload(payload);
@ -568,19 +562,16 @@ public class LogUtils {
}
public static void uploadSearchGame(String event, String location, String key, String searchType) {
uploadSearchClick(event, location, key, searchType, "", "", 0, false);
uploadSearchClick(event, location, key, searchType, "", "", false, false);
}
/**
* @param mirrorDataPosition 镜像的归类,不是镜像是为 -1 ,使用镜像 1 时为 1使用镜像 2 时为 2
*/
public static void uploadSearchClick(String event,
String location,
String key,
String searchType,
String gameId,
String gameName,
int mirrorDataPosition,
Boolean isMirrorData,
Boolean isAdData) {
JSONObject object = new JSONObject();
JSONObject payload = new JSONObject();
@ -594,13 +585,7 @@ public class LogUtils {
payload.put("search_type", searchType); //搜索类型, 有四种取值 默认搜索/历史搜索/自动搜索/主动搜索
payload.put(KEY_GAME_ID, gameId); //event为search_click才取值
payload.put(KEY_GAME_NAME, gameName); //event为search_click才取值
// 是否使用镜像
if (mirrorDataPosition == 1) {
payload.put("is_mirror_data", true);
} else if (mirrorDataPosition == 2) {
payload.put("is_mirror2_data", true);
}
payload.put("is_mirror_data", isMirrorData);
payload.put("is_ad_data", isAdData);
object.put(KEY_PAY_LOAD, payload);
} catch (JSONException e) {

View File

@ -5,7 +5,6 @@ import com.gh.gamecenter.common.json.JsonObjectBuilder
import com.gh.gamecenter.common.json.json
import com.gh.gamecenter.common.loghub.LoghubUtils
import com.gh.gamecenter.common.utils.LogUtils
import com.gh.gamecenter.entity.HomeSubSlide
import com.lightgame.utils.Utils
import org.json.JSONArray
import org.json.JSONObject
@ -22,10 +21,6 @@ object NewFlatLogUtils {
private const val KEY_GAME_NAME = "game_name"
private const val KEY_TEXT = "text"
private const val KEY_BUTTON_TYPE = "button_type"
private const val KEY_BBS_ID = "bbs_id"
private const val EVENT_LOGIN_FROM_GHZS_SHOW = "halo_fun_login_from_ghzs_show"
private const val EVENT_LOGIN_FROM_GHZS_CLICK = "halo_fun_login_from_ghzs_click"
private fun log(jsonObject: JSONObject, logStore: String = "event", uploadImmediately: Boolean = false) {
Utils.log("NewFlatLogUtils", jsonObject.toString(4))
@ -53,66 +48,6 @@ object NewFlatLogUtils {
log(json)
}
// 畅玩助手下载弹窗展示事件
@JvmStatic
fun logHaloFunDownloadDialogShow(gameId: String, gameName: String, gameArchitecture: String) {
val json = json {
KEY_EVENT to "halo_fun_download_dialog_show"
"game_id" to gameId
"game_name" to gameName
"game_architecture" to gameArchitecture
parseAndPutMeta().invoke(this)
}
log(json)
}
// 畅玩助手下载点击事件
@JvmStatic
fun logHaloFunDownloadDialogDownloadClick(architecture: String) {
val json = json {
KEY_EVENT to "halo_fun_download_dialog_download_click"
"architecture" to architecture
parseAndPutMeta().invoke(this)
}
log(json)
}
// 畅玩助手安装提示弹窗展示事件
@JvmStatic
fun logHaloFunInstallTipDialogShow(architecture: String) {
val json = json {
KEY_EVENT to "halo_fun_install_tip_dialog_show"
"architecture" to architecture
parseAndPutMeta().invoke(this)
}
log(json)
}
// 畅玩助手更新弹窗展示事件
@JvmStatic
fun logHaloFunUpdateDialogShow(gameId: String, gameName: String, gameArchitecture: String) {
val json = json {
KEY_EVENT to "halo_fun_update_dialog_show"
"game_id" to gameId
"game_name" to gameName
"game_architecture" to gameArchitecture
parseAndPutMeta().invoke(this)
}
log(json)
}
// 畅玩助手32位弹窗事件
@JvmStatic
fun logHaloFun32DialogEvent(event: String, gameId: String, gameName: String) {
val json = json {
KEY_EVENT to event
"game_id" to gameId
"game_name" to gameName
parseAndPutMeta().invoke(this)
}
log(json)
}
// 关联游戏跳转icon点击事件
@JvmStatic
fun logHaloFunGameDetailJumpClick(downloadStatus: String, gameId: String) {
@ -139,12 +74,11 @@ object NewFlatLogUtils {
// 畅玩助手更新弹窗点击事件
@JvmStatic
fun logHaloFunUpdateDialogClick(dialogType: String, buttonType: String, architecture: String) {
fun logHaloFunUpdateDialogClick(dialogType: String, buttonType: String) {
val json = json {
KEY_EVENT to "halo_fun_update_dialog_click"
"dialog_type" to dialogType
KEY_BUTTON_TYPE to buttonType
"architecture" to architecture
parseAndPutMeta().invoke(this)
}
log(json)
@ -197,105 +131,6 @@ object NewFlatLogUtils {
log(json)
}
// 畅玩游戏管理-长按弹出更多菜单dialog事件
@JvmStatic
fun logHaloFunGameMoreDialogShow(gameId: String, gameName: String) {
val json = json {
KEY_EVENT to "halo_fun_more_dialog_show"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
parseAndPutMeta().invoke(this)
}
log(json)
}
// 畅玩游戏管理-添加桌面图标权限提示弹框展示事件
@JvmStatic
fun logHaloFunShortcutPermissionDialogShow(gameId: String, gameName: String) {
val json = json {
KEY_EVENT to "halo_fun_shutcup_icon_dialog_show"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
parseAndPutMeta().invoke(this)
}
log(json)
}
// 畅玩游戏管理-添加桌面图标权限提示弹框按钮点击事件
@JvmStatic
fun logHaloFunShortcutPermissionDialogButtonClick(
gameId: String,
gameName: String,
buttonType: String,
) {
val json = json {
KEY_EVENT to "halo_fun_shutcup_icon_dialog_click"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
KEY_BUTTON_TYPE to buttonType
parseAndPutMeta().invoke(this)
}
log(json)
}
// 畅玩游戏管理-清除游戏数据弹框展示事件
@JvmStatic
fun logHaloFunCleanDataDialogShow(gameId: String, gameName: String) {
val json = json {
KEY_EVENT to "halo_func_clean_data_dialog_show"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
parseAndPutMeta().invoke(this)
}
log(json)
}
// 畅玩游戏管理-添加桌面图标权限提示弹框按钮点击事件
@JvmStatic
fun logHaloFunCleanDataDialogButtonClick(
gameId: String,
gameName: String,
buttonType: String,
) {
val json = json {
KEY_EVENT to "halo_func_clean_data_dialog_click"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
KEY_BUTTON_TYPE to buttonType
parseAndPutMeta().invoke(this)
}
log(json)
}
// 从畅玩游戏中唤起快捷图标创建弹窗弹窗B展示时上报
@JvmStatic
fun logCwFunShortcutPermissionDialogShow(gameId: String) {
val json = json {
KEY_EVENT to "halo_fun_shotcup_icon_dialog_b_show"
KEY_GAME_ID to gameId
parseAndPutMeta().invoke(this)
}
log(json)
}
// 用户点击快捷图标创建弹窗弹窗B中按钮时触发
@JvmStatic
fun logCwFunShortcutPermissionDialogButtonClick(
gameId: String,
buttonType: String,
) {
val json = json {
KEY_EVENT to "halo_fun_shotcup_icon_dialog_b_click"
KEY_GAME_ID to gameId
KEY_BUTTON_TYPE to buttonType
parseAndPutMeta().invoke(this)
}
log(json)
}
// 搜索-点击热门标签
@JvmStatic
fun logSearchHotTagClick(
@ -542,27 +377,6 @@ object NewFlatLogUtils {
log(json)
}
// 搜索-点击搜索榜单内容
@JvmStatic
fun logSearchClickRankDetail(
rankName: String,
rankSequence: String,
linkId: String,
linkType: String,
linkTitle: String
) {
val json = json {
KEY_EVENT to "search_click_rank_detail"
"rank_name" to rankName
"rank_sequence" to rankSequence
"link_id" to linkId
"link_type" to linkType
"link_title" to linkTitle
parseAndPutMeta().invoke(this)
}
log(json)
}
//点击社区-搜索页返回按钮
@JvmStatic
fun logClickSearchReturn(searchKey: String) {
@ -1108,25 +922,19 @@ object NewFlatLogUtils {
}
// 存档分享弹窗展示事件
fun logCloudArchiveShareDialogShow(gameId: String, gameName: String, cloudSaveId: String) {
fun logCloudArchiveShareDialogShow() {
val json = json {
"cloud_save_id" to cloudSaveId
KEY_EVENT to "cloud_save_share_dialog_show"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
parseAndPutMeta().invoke(this)
}
log(json)
}
// 存档分享弹窗点击事件
fun logCloudArchiveShareDialogClick(buttonType: String, gameId: String, gameName: String, cloudSaveId: String) {
fun logCloudArchiveShareDialogClick(buttonType: String) {
val json = json {
"cloud_save_id" to cloudSaveId
KEY_EVENT to "cloud_save_share_dialog_click"
KEY_BUTTON_TYPE to buttonType
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
parseAndPutMeta().invoke(this)
}
log(json)
@ -1162,23 +970,19 @@ object NewFlatLogUtils {
}
// 上传存档弹窗展示事件
fun logCloudArchiveUploadDialogShow(gameId: String, gameName: String) {
fun logCloudArchiveUploadDialogShow() {
val json = json {
KEY_EVENT to "cloud_save_upload_dialog_show"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
parseAndPutMeta().invoke(this)
}
log(json)
}
// 上传存档弹窗点击事件
fun logCloudArchiveUploadDialogClick(buttonType: String, gameId: String, gameName: String) {
fun logCloudArchiveUploadDialogClick(buttonType: String) {
val json = json {
KEY_EVENT to "cloud_save_upload_dialog_click"
KEY_BUTTON_TYPE to buttonType
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
parseAndPutMeta().invoke(this)
}
log(json)
@ -1257,22 +1061,11 @@ object NewFlatLogUtils {
}
// 云存档下载/使用事件
fun logCloudArchiveDownloadOrApply(
archiveName: String,
entrance: String,
gameId: String,
gameName: String,
cloudSaveId: String,
isDownload: Boolean,
) {
fun logCloudArchiveDownloadOrApply(archiveName: String, entrance: String) {
val json = json {
KEY_EVENT to "cloud_save_download"
"cloud_save_name" to archiveName
"cloud_save_id" to cloudSaveId
"is_download" to isDownload
KEY_ENTRANCE to entrance
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
parseAndPutMeta().invoke(this)
}
log(json)
@ -1707,7 +1500,7 @@ object NewFlatLogUtils {
type: String,
time: Long,
sequence: Int,
) {
){
val json = json {
"event" to "game_test_home_timeline_click"
"action" to action //类型包括: 1.自动定位:滑动游戏时间轴自动更换定位 2.手动点击:手动点击时间轴的定位
@ -1730,7 +1523,7 @@ object NewFlatLogUtils {
type: String = "",
startTime: Long = 0,
sequence: Int = 0,
) {
){
val json = json {
"event" to "game_test_home_view"
"location" to location //新游开测所处位置,包括:首页、版块
@ -1740,24 +1533,11 @@ object NewFlatLogUtils {
"type" to type //触发事件时所停留的时间定位;类型包括“推荐/全部”,时间轴定位在“推荐”时记“推荐”,其余位置则记“全部”
"game_test_start" to startTime //触发事件时所停留的时间定位;时间类型为“全部”时,记录具体的月份日期 例如12.30、12.31
"sequence" to sequence //点击推荐标签在所有标签中所处位置,从左往右依次计算
parseAndPutMeta().invoke(this)
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
// gid 变更事件
@JvmStatic
fun logGidChanged(oldGid: String, newGid: String) {
val json = json {
KEY_EVENT to "gid_changed"
"old_gid" to oldGid
"new_gid" to newGid
parseAndPutMeta().invoke(this)
}
log(json)
}
//发现页下拉刷新
fun logDiscoverPageDropDownRefresh(refreshCount: Int) {
val json = json {
@ -1788,59 +1568,9 @@ object NewFlatLogUtils {
log(json, "event", false)
}
// 出现 XAPK 安装权限引导弹窗
fun logXApkInstallPermissionDialogShowed(gameId: String, gameName: String) {
val json = json {
KEY_EVENT to "xapk_install_permission_dialog_show"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
// 点击引导设置“安装权限”弹窗 时上报
fun logXApkInstallPermissionDialogClick(button: String, isOn: Boolean, gameId: String, gameName: String) {
val json = json {
KEY_EVENT to "xapk_install_permission_dialog_click"
"button" to button
"is_on" to isOn
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
// 出现xapk解压失败弹窗时上报
fun logXApkUnzipFailedDialogShowed(trigger: String, gameId: String, gameName: String) {
val json = json {
KEY_EVENT to "xapk_decompression_failed_dialog_show"
"trigger" to trigger
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
// 点击解压失败弹窗 时上报
fun logXApkUnzipFailedDialogClick(button: String, isOn: Boolean, gameId: String, gameName: String) {
val json = json {
KEY_EVENT to "xapk_decompression_failed_dialog_click"
"button" to button
"is_on" to isOn
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
// vpn 弹窗显示
fun logVpnHintDialogShow(gameId: String, gameName: String) {
val json = json {
KEY_EVENT to "vpn_pre_access_dialog_show"
KEY_EVENT to "profile_picture_default_dialog_click"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
parseAndPutMeta().invoke(this)
@ -1848,10 +1578,9 @@ object NewFlatLogUtils {
log(json, "event", false)
}
// vpn 弹窗点击
fun logVpnHintDialogClick(gameId: String, gameName: String, button: String) {
val json = json {
KEY_EVENT to "vpn_pre_access_dialog_click"
KEY_EVENT to "profile_picture_default_dialog_click"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
"button" to button
@ -1860,329 +1589,4 @@ object NewFlatLogUtils {
log(json, "event", false)
}
// 谷歌框架弹窗显示
fun logGAppsDialogShowed(gameId: String, gameName: String) {
val json = json {
KEY_EVENT to "google_services_hint_pop_show"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
// 谷歌框架弹窗点击
fun logGAppsDialogClicked(gameId: String, gameName: String, buttonType: String) {
val json = json {
KEY_EVENT to "google_services_hint_pop_click"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
KEY_BUTTON_TYPE to buttonType
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
// 谷歌框架安装成功
fun logGAppsInstallSuccess(gameId: String, gameName: String, interval: Int) {
val json = json {
KEY_EVENT to "google_services_install_success"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
"interval" to interval
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
// 谷歌框架安装失败
fun logGAppsInstallFailed(gameId: String, gameName: String, interval: Int) {
val json = json {
KEY_EVENT to "google_services_install_fail"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
"interval" to interval
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
// 谷歌框架安装成功并点击启动游戏
fun logGAppsInstalledAndLaunchGame(gameId: String, gameName: String) {
val json = json {
KEY_EVENT to "google_services_install_game_launch"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
// 点击子版块
fun logClickSection(sectionId: String, bbsId: String, sequence: Int) {
val json = json {
KEY_EVENT to "click_section"
"section_id" to sectionId
KEY_BBS_ID to bbsId
"sequence" to sequence
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
// 点击更多板块按钮
fun logClickMoreSection() {
val json = json {
KEY_EVENT to "click_more_section"
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
// 左右滑动子版块
fun logSlideSection() {
val json = json {
KEY_EVENT to "slide_section"
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
// 点击论坛详情页—专区tab
fun logClickBBSDetailGameZoneTab(bbsId: String, entrance: String, url: String) {
val json = json {
KEY_EVENT to "click_bbs_detail_game_zone_tab"
KEY_BBS_ID to bbsId
KEY_ENTRANCE to entrance
"url" to url
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
// 点击论坛详情页—游戏详情
fun logClickBBSDetailGameDetail() {
val json = json {
KEY_EVENT to "click_bbs_detail_game_detail"
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
// 首页下拉刷新
fun logHomePagePullRefresh(countNum: Int) {
val json = json {
KEY_EVENT to "home_page_pull_refresh"
"count_num" to countNum
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
// 右侧卡片点击事件
fun logRightSideCardClick(homeSubSlide: HomeSubSlide, countNum: Int, location: String) {
val json = json {
KEY_EVENT to "right_side_card_click"
"title" to homeSubSlide.title
"card_id" to homeSubSlide.cardId
"type" to homeSubSlide.cardType
"text" to homeSubSlide.cardText
"count_num" to countNum
"location" to location
"link_type" to homeSubSlide.linkType
"link_id" to homeSubSlide.linkId
"link_text" to homeSubSlide.linkText
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
// 游戏详情浏览大事件
@JvmStatic
fun logGameDetailMajorEventDetailClick(
gameId: String,
gameName: String,
linkId: String = "",
linkType: String = "",
linkTitle: String = ""
) {
val json = json {
KEY_EVENT to "game_detail_major_event_detail_click"
KEY_GAME_NAME to gameName
KEY_GAME_ID to gameId
"link_id" to linkId
"link_type" to linkType
"link_title" to linkTitle
parseAndPutMeta().invoke(this)
}
log(json)
}
// 我的光环点击 banner
@JvmStatic
fun logHaloPersonalActivityBannerClick(
linkId: String = "",
linkType: String = "",
linkTitle: String = ""
) {
val json = json {
KEY_EVENT to "halo_self_activity_banner_click"
"link_id" to linkId
"link_type" to linkType
"link_title" to linkTitle
parseAndPutMeta().invoke(this)
}
log(json)
}
// 视频流点击广告
@JvmStatic
fun logVideoAdsClick(
linkId: String = "",
linkType: String = "",
linkTitle: String = ""
) {
val json = json {
KEY_EVENT to "video_ads_click"
"link_id" to linkId
"link_type" to linkType
"link_title" to linkTitle
parseAndPutMeta().invoke(this)
}
log(json, "video_streaming")
}
// 社区-搜索榜单-内容点击
@JvmStatic
fun logCommunitySearchClickRankDetail(
rankName: String,
linkId: String = "",
linkType: String = "",
linkTitle: String = ""
) {
val json = json {
KEY_EVENT to "click_search_rank_detail"
"rank_name" to rankName
"link_id" to linkId
"link_type" to linkType
"link_title" to linkTitle
parseAndPutMeta().invoke(this)
}
log(json, "bbs_community")
}
// 首页下拉推送触发
@JvmStatic
fun logHomePushTrigger(pushId: String, count: Int, gameId: String, gameName: String) {
val json = json {
KEY_EVENT to "home_push_trigger"
"home_push_id" to pushId
"count_num" to count
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
parseAndPutMeta().invoke(this)
}
log(json)
}
// 首页下拉推送显示
@JvmStatic
fun logHomePushShow(pushId: String, action: String, count: Int, gameId: String, gameName: String) {
val json = json {
KEY_EVENT to "home_push_show"
"home_push_id" to pushId
"action" to action
"count_num" to count
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
parseAndPutMeta().invoke(this)
}
log(json)
}
// 首页下拉推送消失
@JvmStatic
fun logHomePushClose(pushId: String, action: String, count: Int, gameId: String, gameName: String, interval: Int) {
val json = json {
KEY_EVENT to "home_push_close"
"home_push_id" to pushId
"action" to action
"count_num" to count
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
"interval" to interval
parseAndPutMeta().invoke(this)
}
log(json)
}
/**
* 埋点序号24
* 事件IDhalo_fun_login_from_ghzs_show
* 事件名称:光环助手登录授权界面
* 触发时机:畅玩助手点击授权登录跳转光环助手展示对应界面时
* @param gameId 畅玩助手当前运行的游戏ID
* @param gameName 畅玩助手当前运行的游戏名称
*/
fun logLoginFromGHZSShow(
gameId: String,
gameName: String
) {
val json = json {
KEY_EVENT to EVENT_LOGIN_FROM_GHZS_SHOW
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
parseAndPutMeta().invoke(this)
}
log(json)
}
/**
* 埋点序号25
* 事件IDhalo_fun_login_from_ghzs_click
* 事件名称:光环助手登录授权界面点击事件
* 触发时机:点击相关按钮时
* @param gameId 畅玩助手当前运行的游戏ID
* @param gameName 畅玩助手当前运行的游戏名称
* @param buttonType 按钮:确定\返回
*/
fun logLoginFromGHZSClick(
gameId: String,
gameName: String,
buttonType: String
) {
val json = json {
KEY_EVENT to EVENT_LOGIN_FROM_GHZS_CLICK
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
KEY_BUTTON_TYPE to buttonType
parseAndPutMeta().invoke(this)
}
log(json)
}
// 下载流量提示弹窗展示事件
@JvmStatic
fun logDownloadMobileDataDialogShow(gameId: String, gameName: String) {
val json = json {
KEY_EVENT to "download_mobile_data_dialog_show"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
// 下载流量提示弹窗点击事件
@JvmStatic
fun logDownloadMobileDataDialogClick(gameId: String, gameName: String, button: String) {
val json = json {
KEY_EVENT to "download_mobile_data_dialog_click"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
"button" to button
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
}

View File

@ -1344,9 +1344,8 @@ object NewLogUtils {
gameName: String,
tagId: String,
tagName: String,
linkId: String = "",
linkType: String = "",
linkTitle: String = ""
linkType: String,
linkTitle: String
) {
val json = json {
KEY_EVENT to "search_click_tag"
@ -1356,7 +1355,6 @@ object NewLogUtils {
KEY_GAME_NAME to gameName
"tag_id" to tagId
"tag" to tagName
"link_id" to linkId
"link_type" to linkType
"link_title" to linkTitle
KEY_META to LogUtils.getMetaObject()

View File

@ -250,57 +250,47 @@ object PackageInstaller {
// 将 VPN 提示弹窗标记为已读(已读后的下一次显示"不再提醒"按钮)
VpnHelper.setVpnHintDialogShowed()
if (!VpnHelper.shouldShowVpnHintDialog()) {
VpnHelper.startVpn(currentActivity) { shouldShowVpnError ->
if (shouldShowVpnError) {
ToastUtils.toast("安装防护功能启动失败")
}
install(currentActivity, pkgPath)
}
} else {
DialogHelper.showGuideDialog(
context = currentActivity,
title = "开启安装防护",
content = "建议您开启安装防护功能该功能有助于帮助您更快的完成安装避免因提示和置换导致的重复下载等问题安装防护功能需要获取您的VPN权限",
confirmText = "立即授权开启防护",
cancelText = "不再提醒",
confirmClickCallback = {
VpnHelper.ignoreVpnHintDialog()
VpnHelper.startVpn(currentActivity) { shouldShowVpnError ->
if (shouldShowVpnError) {
ToastUtils.toast("安装防护功能启动失败")
}
install(currentActivity, pkgPath)
DialogHelper.showGuideDialog(
context = currentActivity,
title = "建议开启安装防护",
content = "为了帮助您安装官方的光环助手游戏包并加速安装进程避免安装游戏时被手机厂商替换导致重复下载浪费流量及手机存储空间建议您开启安装防护功能光环助手将向您申请开启VPN权限",
confirmText = "立即授权开启防护",
cancelText = "不再提醒",
confirmClickCallback = {
VpnHelper.startVpn(currentActivity) { shouldShowVpnError ->
if (shouldShowVpnError) {
ToastUtils.toast("安装防护功能启动失败")
}
downloadEntity?.let {
NewFlatLogUtils.logVpnHintDialogClick(it.gameId, it.name, "立即授权")
}
},
cancelClickCallback = {
VpnHelper.ignoreVpnFunction()
install(currentActivity, pkgPath)
downloadEntity?.let {
NewFlatLogUtils.logVpnHintDialogClick(it.gameId, it.name, "不再提醒")
}
},
extraConfig = DialogHelper.Config(
showCloseIcon = true,
showAlternativeCancelStyle = !isTheFirstTimeToShowVpnHintDialog
),
uiModificationCallback = { binding, dialog ->
binding.cancelTv.visibility = View.GONE
binding.closeContainer.setOnClickListener {
install(currentActivity, pkgPath)
dialog.dismiss()
}
downloadEntity?.let {
NewFlatLogUtils.logVpnHintDialogClick(it.gameId, it.name, "关闭按钮")
}
downloadEntity?.let {
NewFlatLogUtils.logVpnHintDialogClick(it.gameId, it.name, "立即授权")
}
},
cancelClickCallback = {
VpnHelper.ignoreVpnHintDialog()
install(currentActivity, pkgPath)
downloadEntity?.let {
NewFlatLogUtils.logVpnHintDialogClick(it.gameId, it.name, "不再提醒")
}
},
extraConfig = DialogHelper.Config(
showCloseIcon = true,
showAlternativeCancelStyle = !isTheFirstTimeToShowVpnHintDialog
),
uiModificationCallback = { binding, dialog ->
binding.cancelTv.visibility = View.GONE
binding.closeContainer.setOnClickListener {
install(currentActivity, pkgPath)
dialog.dismiss()
downloadEntity?.let {
NewFlatLogUtils.logVpnHintDialogClick(it.gameId, it.name, "关闭按钮")
}
}
)
}
}
)
}
}

View File

@ -38,7 +38,6 @@ import com.gh.gamecenter.manager.PackagesManager;
import com.gh.vspace.VHelper;
import com.gh.vspace.db.VGameEntity;
import com.halo.assistant.HaloApp;
import com.lg.vspace.VirtualAppManager;
import com.lightgame.utils.Utils;
import net.dongliu.apk.parser.ApkFile;
@ -555,32 +554,9 @@ public class PackageUtils {
}
}
/**
* 根据包名,判断是否已安装该游戏
* 不区分是否有桌面图标
*/
public static boolean isInstalledFromAllPackage(Context context, String packageName) {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
context.getPackageManager().getPackageInfo(
packageName,
PackageManager.PackageInfoFlags.of(0)
);
} else {
context.getPackageManager().getPackageInfo(packageName, 0);
}
return true;
} catch (Exception e) {
ArrayList<String> allPackageName = getAllPackageName(context);
boolean isInstalled = allPackageName.contains(packageName);
if (isInstalled) {
// 能进这里说明上面的 try {} 结果有问题,记录一下
SentryHelper.INSTANCE.onEvent("CHECK_INSTALLED_CONFLICT", "packageName", packageName);
}
return isInstalled;
}
ArrayList<String> allPackageName = getAllPackageName(context);
return allPackageName.contains(packageName);
}
/*

View File

@ -3,10 +3,8 @@ package com.gh.common.util
import com.gh.gamecenter.core.utils.CurrentActivityHolder
import com.gh.download.DownloadManager
import com.gh.gamecenter.ShellActivity
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.common.utils.getMetaExtra
import com.lightgame.download.DownloadEntity
@ -16,9 +14,6 @@ object RealNameHelper {
var pendingInstallPkgPath = ""
// 0表示未实名1表示未成年2表示成年
private var mCertificationStatus: Int = 0
/**
* 弹未成年人不能下载游戏弹窗
*/
@ -59,15 +54,6 @@ object RealNameHelper {
val isForced = downloadEntity.getMetaExtra("force_real_name") != "false"
NewLogUtils.logCertificationTrigger(downloadEntity.gameId, downloadEntity.name)
SensorsBridge.trackEvent(
"VerificationDialogShow",
"game_id",
downloadEntity.gameId,
"game_name",
downloadEntity.name ?: "",
"game_type",
downloadEntity.meta[Constants.GAME_TYPE] ?: ""
)
val contentText = if (downloadEntity.status == DownloadStatus.done) {
"为保护未成年身心健康成长\n" + "根据相关政策要求,该游戏不对未成年人开放\n" + "如需完成安装,请前往实名认证"
@ -102,11 +88,9 @@ object RealNameHelper {
pendingInstallPkgPath = downloadEntity.path
}
NewLogUtils.logCertificationHintDialogOptionsClicked("前往实名认证")
SensorsBridge.trackEvent("VerificationPopupClick", "button_name", "前往实名认证")
},
cancelClickCallback = {
NewLogUtils.logCertificationHintDialogOptionsClicked("取消")
SensorsBridge.trackEvent("VerificationPopupClick", "button_name", "取消")
if (!isForced) {
DownloadManager.getInstance()
.resumeAllInvisiblePendingTask()
@ -127,21 +111,7 @@ object RealNameHelper {
DownloadManager.getInstance()
.addInvisiblePendingTask(downloadEntity)
}
}
/**
* 获取实名状态 0表示未实名1表示未成年2表示成年
*/
fun getCertificationStatus(): Int {
return mCertificationStatus
}
/**
* 更新实名状态 0表示未实名1表示未成年2表示成年
*/
@JvmStatic
fun updateCertificationStatus(newCertificationStatus: Int) {
mCertificationStatus = newCertificationStatus
}
}

View File

@ -69,7 +69,7 @@ object ReservationHelper {
@JvmStatic
@SuppressLint("CheckResult")
fun reserve(context: Context, gameId: String, gameName: String, callback: EmptyCallback) {
fun reserve(context: Context, gameId: String, callback: EmptyCallback) {
val requestMap = hashMapOf<String, String>()
requestMap["game_id"] = gameId
RetrofitManager.getInstance().api
@ -78,16 +78,6 @@ object ReservationHelper {
.subscribe(object : BiResponse<ResponseBody>() {
override fun onSuccess(data: ResponseBody) {
SensorsBridge.trackEvent(
"AppointmentGameResult",
"game_name",
gameName,
"game_id",
gameId,
"result",
"成功"
)
ReservationRepository.addReservationToMemoryAndRefresh(gameId)
callback.onCallback()
val wechatConfig = SPUtils.getString(Constants.SP_WECHAT_CONFIG).toObject<WechatConfigEntity>()
@ -98,22 +88,14 @@ object ReservationHelper {
DialogUtils.showReserveSuccessDialog(context)
} else {
NewLogUtils.logReserveWechatRemindPopShow(wechatConfig)
SensorsBridge.trackEvent("AppointmenWechatRemindDialogShow")
DialogUtils.showReserveSuccess2WechatBindDialog(context, object : ConfirmListener {
override fun onConfirm() {
NewLogUtils.logReserveWechatRemindPopClick(wechatConfig, "开启微信提醒")
SensorsBridge.trackEvent("AppointmenWechatRemindDialogClick")
context.startActivity(WebActivity.getBindWechatIntent(context))
SensorsBridge.trackEvent(
"AppointmenWechatRemindConfigPageShow",
"source_entrance",
"设置微信提醒弹窗"
)
}
}, object : CancelListener {
override fun onCancel() {
NewLogUtils.logReserveWechatRemindPopClick(wechatConfig, "关闭弹窗")
SensorsBridge.trackEvent("AppointmenWechatRemindDialogClick")
}
})
}
@ -121,15 +103,6 @@ object ReservationHelper {
}
override fun onFailure(exception: Exception) {
SensorsBridge.trackEvent(
"AppointmentGameResult",
"game_name",
gameName,
"game_id",
gameId,
"result",
"失败"
)
ToastUtils.showToast(exception.message ?: "")
}
})

View File

@ -1,29 +0,0 @@
package com.gh.common.util
import android.os.Handler
import android.os.Looper
import android.os.Message
import com.gh.gamecenter.common.utils.SensorsBridge
object SensorsLogUtils {
private const val KEY_EVENT_NAME = "event_name"
private val mLogHandler = LogHandler()
fun trackEventDelay(key: Int, eventName: String, delay: Long) {
mLogHandler.sendMessageDelayed(Message().apply {
what = key
data.putString(KEY_EVENT_NAME, eventName)
}, delay)
}
fun removeTrackEvent(key: Int) {
mLogHandler.removeMessages(key)
}
class LogHandler : Handler(Looper.getMainLooper()) {
override fun handleMessage(msg: Message) {
super.handleMessage(msg)
SensorsBridge.trackEvent(msg.data.getString(KEY_EVENT_NAME) ?: "")
}
}
}

View File

@ -1,135 +0,0 @@
package com.gh.common.util
import android.content.Context
import android.graphics.Color
import android.text.Spannable
import android.text.SpannableStringBuilder
import android.text.Spanned
import android.text.TextPaint
import android.text.method.LinkMovementMethod
import android.text.style.ClickableSpan
import android.text.style.ForegroundColorSpan
import android.text.style.UnderlineSpan
import android.view.View
import android.widget.TextView
import androidx.annotation.StringRes
import androidx.core.content.ContextCompat
/**
* @author : liujiarui
* date : 2023/3/22
* description : 文本颜色事件控制
*/
//作用域进行限制
@DslMarker
@Target(AnnotationTarget.TYPE)
annotation class TextSpanDsl
interface DslSpannableStringBuilder {
//增加一段文字
fun addText(text: String, method: (@TextSpanDsl DslSpanBuilder.() -> Unit)? = null)
fun addText(@StringRes stringRes: Int, method: (@TextSpanDsl DslSpanBuilder.() -> Unit)? = null)
}
interface DslSpanBuilder {
//设置文字颜色文本
fun setColor(color: String)
//设置文字颜色int
fun setColor(color: ColorInt)
//设置文字颜色id
fun setColor(color: ColorResId)
//设置点击事件
fun onClick(useUnderLine: Boolean = false, onClick: (View) -> Unit)
}
//为 TextView 创建扩展函数,其参数为接口的扩展函数
fun TextView.buildSpannableString(init: @TextSpanDsl DslSpannableStringBuilder.() -> Unit) {
//具体实现类
val spanStringBuilderImpl = DslSpannableStringBuilderImpl(context)
spanStringBuilderImpl.init()
movementMethod = LinkMovementMethod.getInstance()
//通过实现类返回SpannableStringBuilder
text = spanStringBuilderImpl.build()
}
class DslSpannableStringBuilderImpl(val context: Context) : DslSpannableStringBuilder {
private val builder = SpannableStringBuilder()
//记录上次添加文字后最后的索引值
private var lastIndex: Int = 0
var isClickable = false
override fun addText(text: String, method: (@TextSpanDsl DslSpanBuilder.() -> Unit)?) {
val start = lastIndex
builder.append(text)
lastIndex += text.length
val spanBuilder = DslSpanBuilderImpl(context)
method?.let { spanBuilder.it() }
spanBuilder.apply {
onClickSpan?.let {
builder.setSpan(it, start, lastIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
isClickable = true
}
if (!useUnderLine) {
val noUnderlineSpan = NoUnderlineSpan()
builder.setSpan(noUnderlineSpan, start, lastIndex, Spanned.SPAN_MARK_MARK)
}
foregroundColorSpan?.let {
builder.setSpan(it, start, lastIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
}
}
}
override fun addText(stringRes: Int, method: (@TextSpanDsl DslSpanBuilder.() -> Unit)?) {
val text = context.getString(stringRes)
addText(text, method)
}
fun build(): SpannableStringBuilder {
return builder
}
}
class DslSpanBuilderImpl(val context: Context) : DslSpanBuilder {
var foregroundColorSpan: ForegroundColorSpan? = null
var onClickSpan: ClickableSpan? = null
var useUnderLine = true
override fun setColor(color: String) {
foregroundColorSpan = ForegroundColorSpan(Color.parseColor(color))
}
override fun setColor(color: ColorInt) {
foregroundColorSpan = ForegroundColorSpan(color.color)
}
override fun setColor(color: ColorResId) {
val c = ContextCompat.getColor(context, color.colorResId)
foregroundColorSpan = ForegroundColorSpan(c)
}
override fun onClick(useUnderLine: Boolean, onClick: (View) -> Unit) {
onClickSpan = object : ClickableSpan() {
override fun onClick(widget: View) {
onClick(widget)
}
}
this.useUnderLine = useUnderLine
}
}
@JvmInline
value class ColorInt(val color: Int)
@JvmInline
value class ColorResId(val colorResId: Int)
class NoUnderlineSpan : UnderlineSpan() {
override fun updateDrawState(ds: TextPaint) {
ds.color = ds.linkColor
ds.isUnderlineText = false
}
}

View File

@ -1,131 +0,0 @@
package com.gh.common.xapk
import android.app.Activity
import android.app.Dialog
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.os.Build
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.gh.common.util.NewFlatLogUtils
import com.gh.gamecenter.R
import com.gh.gamecenter.common.activityresult.ActResultRequest
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.entity.SimpleGameEntity
import com.gh.gamecenter.common.entity.SuggestType
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.common.utils.PermissionHelper
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.help.HelpAndFeedbackBridge
import com.lightgame.download.DownloadEntity
import com.lightgame.utils.Utils
import java.lang.ref.WeakReference
object XapkDialogHelper {
private var mUnzipFailureDialogRef: WeakReference<Dialog>? = null
fun showUnzipFailureDialog(context: Context, downloadEntity: DownloadEntity, isManualAction: Boolean) {
val trigger = if (isManualAction) "手动触发" else "自动触发"
NewFlatLogUtils.logXApkUnzipFailedDialogShowed(trigger, downloadEntity.gameId, downloadEntity.name)
val previousShowedDialog = mUnzipFailureDialogRef?.get()
if (previousShowedDialog != null
&& previousShowedDialog.isShowing
&& context == previousShowedDialog.ownerActivity) {
// 上一个解压失败弹窗还在显示,当前 activity 不用再显示新的弹窗了
return
}
val dialog = DialogHelper.showGuideDialog(
context = context,
title = "",
content = "未授权允许未知来源安装、数据包格式、设备兼容性…等均可能导致解压失败。\n如果开启权限后仍未能解决,请提交反馈帮助我们改进。",
confirmText = "开启权限",
cancelText = "提交反馈",
confirmClickCallback = {
if (context is AppCompatActivity) {
val intent = PermissionHelper.getToInstallPermissionSettingIntent(context)
NewFlatLogUtils.logXApkUnzipFailedDialogClick(
"开启权限",
false,
downloadEntity.gameId,
downloadEntity.name
)
// 记录应用重启前需要重解压的信息
SPUtils.setString(Constants.SP_XAPK_UNZIP_ACTIVITY, context.javaClass.name)
SPUtils.setString(Constants.SP_XAPK_URL, downloadEntity.url)
ActResultRequest(context).startForResult(intent) { resultCode, _ ->
if (resultCode == Activity.RESULT_OK) {
NewFlatLogUtils.logXApkUnzipFailedDialogClick(
"开启权限",
true,
downloadEntity.gameId,
downloadEntity.name
)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
val pm = context.packageManager
val restartIntent = pm.getLaunchIntentForPackage(context.packageName)
val mainIntent = Intent.makeRestartActivityTask(restartIntent!!.component)
context.startActivity(mainIntent)
Runtime.getRuntime().exit(0)
} else {
XapkInstaller.install(context, downloadEntity, true)
}
} else if (resultCode == Activity.RESULT_CANCELED) {
Utils.log("授予未知应用安装权限失败")
}
}
} else if (context is Activity) {
PermissionHelper.toInstallPermissionSetting(context)
}
},
cancelClickCallback = {
val hint = "" + downloadEntity.name + "》游戏安装包解压失败,问题反馈:"
HelpAndFeedbackBridge.startSuggestionActivity(
context,
SuggestType.normal,
null,
hint,
SimpleGameEntity(downloadEntity.gameId, downloadEntity.name, downloadEntity.icon)
)
NewFlatLogUtils.logXApkUnzipFailedDialogClick(
"提交反馈",
false,
downloadEntity.gameId,
downloadEntity.name
)
},
uiModificationCallback = { binding, dialog ->
binding.headIv.setBackgroundResource(R.drawable.dialog_unzip_failure_head_background)
binding.titleTv.visibility = View.GONE
// VectorDrawable 的动态颜色设置只在支持 Vector 的系统版本上生效,为了能方便复用资源不支持的就用默认颜色,又不是不能用!
binding.closeIv.setColorFilter(Color.WHITE)
binding.contentTv.setLineSpacing(5.0F.dip2px().toFloat(), 1.0F)
binding.closeContainer.setOnClickListener {
NewFlatLogUtils.logXApkUnzipFailedDialogClick(
"关闭",
false,
downloadEntity.gameId,
downloadEntity.name
)
dialog.dismiss()
}
},
extraConfig = DialogHelper.Config(showCloseIcon = true)
)
if (context is Activity) {
dialog?.setOwnerActivity(context)
}
mUnzipFailureDialogRef = WeakReference(dialog)
}
}

View File

@ -1,18 +1,16 @@
package com.gh.common.xapk
import android.annotation.SuppressLint
import android.content.Context
import com.gh.gamecenter.core.AppExecutor
import com.gh.common.util.*
import com.gh.download.DownloadDataHelper
import com.gh.download.DownloadManager
import com.gh.gamecenter.common.utils.debugOnly
import com.gh.gamecenter.common.utils.getExtension
import com.gh.gamecenter.common.utils.throwExceptionInDebug
import com.gh.gamecenter.common.utils.tryCatchInRelease
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.utils.SentryHelper
import com.gh.ndownload.NDataChanger
import com.halo.assistant.HaloApp
import com.lightgame.download.DataChanger
import com.lightgame.download.DownloadEntity
import com.lightgame.utils.Utils
import java.text.DecimalFormat
@ -27,10 +25,10 @@ import java.util.*
* obb文件直接解压至根目录即可,无需操作文件
* apk文件这解压的gh-files文件夹中
*/
@SuppressLint("StaticFieldLeak")
object XapkInstaller : IXapkUnzipListener {
private const val XAPK_PACKAGE_PATH_TAG = "xapk_package_path"
// private const val XAPK_DATA_PATH_TAG = "xapk_data_path"
const val XAPK_EXTENSION_NAME = "xapk"
// 通过解压过程存放于 DownloadEntity meta
@ -64,7 +62,6 @@ object XapkInstaller : IXapkUnzipListener {
private fun unzipXapkFile(downloadEntity: DownloadEntity) {
if (mXapkUnzipThreadMap[downloadEntity.path] == null) {
DownloadDataHelper.uploadDownloadStatusEvent(downloadEntity, "xapk解压开始")
val xapkUnzipThread = XapkUnzipThread(downloadEntity, this)
xapkUnzipThread.start()
mXapkUnzipThreadMap[downloadEntity.path] = xapkUnzipThread
@ -84,7 +81,7 @@ object XapkInstaller : IXapkUnzipListener {
}
downloadEntity.meta[XAPK_UNZIP_PERCENT] = percent.toString()
downloadEntity.meta[XAPK_UNZIP_STATUS] = XapkUnzipStatus.UNZIPPING.name
NDataChanger.notifyDataChanged(downloadEntity)
DataChanger.notifyDataChanged(downloadEntity)
}
debugOnly {
@ -114,7 +111,7 @@ object XapkInstaller : IXapkUnzipListener {
AppExecutor.uiExecutor.execute {
downloadEntity.meta[XAPK_UNZIP_PERCENT] = "0.0"
downloadEntity.meta[XAPK_UNZIP_STATUS] = XapkUnzipStatus.CANCEL.name
NDataChanger.notifyDataChanged(downloadEntity)
DataChanger.notifyDataChanged(downloadEntity)
DownloadManager.getInstance().updateDownloadEntity(downloadEntity)
}
}
@ -125,7 +122,7 @@ object XapkInstaller : IXapkUnzipListener {
AppExecutor.uiExecutor.execute {
downloadEntity.meta[XAPK_UNZIP_STATUS] = XapkUnzipStatus.FAILURE.name
DownloadNotificationHelper.addOrUpdateDownloadNotification(downloadEntity)
NDataChanger.notifyDataChanged(downloadEntity)
DataChanger.notifyDataChanged(downloadEntity)
DownloadManager.getInstance().updateDownloadEntity(downloadEntity)
}
@ -138,8 +135,6 @@ object XapkInstaller : IXapkUnzipListener {
)
}
DownloadDataHelper.uploadDownloadStatusEvent(downloadEntity, "xapk解压失败")
debugOnly {
Utils.log("unzip", "onFailure->$exception")
}
@ -161,12 +156,10 @@ object XapkInstaller : IXapkUnzipListener {
downloadEntity.meta[XAPK_UNZIP_PERCENT] = "100.0"
downloadEntity.meta[XAPK_UNZIP_STATUS] = XapkUnzipStatus.SUCCESS.name
NDataChanger.notifyDataChanged(downloadEntity)
DataChanger.notifyDataChanged(downloadEntity)
DownloadManager.getInstance().updateDownloadEntity(downloadEntity)
}
DownloadDataHelper.uploadDownloadStatusEvent(downloadEntity, "xapk解压成功")
debugOnly {
Utils.log("unzip", "onSuccess->${downloadEntity.path}")
}

View File

@ -3,16 +3,18 @@ package com.gh.download
import android.content.pm.PackageInfo
import android.text.TextUtils
import com.gh.common.util.PackageUtils
import com.gh.common.util.RealNameHelper
import com.gh.common.xapk.XapkInstaller
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.exposure.meta.MetaUtil
import com.gh.gamecenter.common.exposure.meta.MetaUtil.getMeta
import com.gh.gamecenter.common.loghub.LoghubUtils
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.utils.DeviceUtils
import com.gh.gamecenter.common.utils.getExtension
import com.gh.gamecenter.common.utils.getMetaExtra
import com.gh.gamecenter.common.utils.isSimulatorGame
import com.gh.gamecenter.core.utils.SentryHelper
import com.gh.ndownload.NDataChanger
import com.halo.assistant.HaloApp
import com.lightgame.download.DataChanger
import com.lightgame.download.DownloadConfig
import com.lightgame.download.DownloadEntity
import com.lightgame.download.DownloadStatus
@ -62,7 +64,6 @@ object DownloadDataHelper {
|| status == DownloadStatus.neterror
|| status == DownloadStatus.timeout
|| status == DownloadStatus.diskisfull
|| status == DownloadStatus.diskioerror
) {
"暂停下载-连上WiFi自动下载"
} else if (status == DownloadStatus.done) {
@ -126,9 +127,7 @@ object DownloadDataHelper {
payloadObject.put("gameName", downloadEntity.name)
payloadObject.put("platform", downloadEntity.platform)
payloadObject.put("package", downloadEntity.packageName)
payloadObject.put("certification", RealNameHelper.getCertificationStatus())
payloadObject.put("filename", getFileName(downloadEntity))
payloadObject.put("task_num", NDataChanger.downloadingTasks.size)
jsonObject.put("payload", payloadObject)
} catch (e: Exception) {
e.printStackTrace()
@ -203,21 +202,15 @@ object DownloadDataHelper {
// payload
val payloadObject = JSONObject()
val parallel = downloadEntity.meta[DOWNLOAD_THREAD_SIZE]?.toInt()
payloadObject.put("host", downloadEntity.meta[DownloadEntity.DOWNLOAD_HOST_KEY] ?: "unknown")
payloadObject.put("path", downloadEntity.meta[DownloadEntity.DOWNLOAD_PATH_KEY] ?: "unknown")
payloadObject.put("game_id", downloadEntity.gameId)
payloadObject.put("gameName", downloadEntity.name)
payloadObject.put("platform", downloadEntity.platform)
payloadObject.put("package", downloadEntity.packageName)
payloadObject.put("certification", RealNameHelper.getCertificationStatus())
payloadObject.put("filename", getFileName(downloadEntity))
payloadObject.put("launch_ms", startupTime)
payloadObject.put("task_num", NDataChanger.downloadingTasks.size)
if (parallel != null) {
payloadObject.put("parallel", parallel)
}
payloadObject.put("parallel", downloadEntity.meta[DOWNLOAD_THREAD_SIZE]?.toInt() ?: 0)
jsonObject.put("payload", payloadObject)
} catch (e: Exception) {
e.printStackTrace()
@ -227,11 +220,11 @@ object DownloadDataHelper {
LoghubUtils.log(jsonObject, "download_debug", false)
}
fun uploadDownloadStatusEvent(downloadEntity: DownloadEntity, extraStatus: String? = null) {
private fun uploadDownloadStatusEvent(downloadEntity: DownloadEntity) {
val jsonObject = JSONObject()
try {
val statusAlias = extraStatus ?: getDownloadStatusAlias(downloadEntity)
val statusAlias = getDownloadStatusAlias(downloadEntity)
jsonObject.put("event", statusAlias)
jsonObject.put("msg", downloadEntity.error)
jsonObject.put("status", downloadEntity.status.status)
@ -241,21 +234,16 @@ object DownloadDataHelper {
// payload
val payloadObject = JSONObject()
val parallel = downloadEntity.meta[DOWNLOAD_THREAD_SIZE]?.toInt()
val sizeInMB = downloadEntity.size / 1024 / 1024
payloadObject.put("host", downloadEntity.meta[DownloadEntity.DOWNLOAD_HOST_KEY] ?: "unknown")
payloadObject.put("path", downloadEntity.meta[DownloadEntity.DOWNLOAD_PATH_KEY] ?: "unknown")
payloadObject.put("game_id", downloadEntity.gameId)
payloadObject.put("gameName", downloadEntity.name)
payloadObject.put("platform", downloadEntity.platform)
payloadObject.put("package", downloadEntity.packageName)
payloadObject.put("certification", RealNameHelper.getCertificationStatus())
payloadObject.put("filename", getFileName(downloadEntity))
payloadObject.put("total_size", sizeInMB)
if (parallel != null) {
payloadObject.put("parallel", parallel)
}
payloadObject.put("parallel", downloadEntity.meta[DOWNLOAD_THREAD_SIZE]?.toInt() ?: 0)
if (statusAlias == "下载完成") {
val elapsedTimeString = downloadEntity.meta[DownloadConfig.KEY_DOWNLOAD_ELAPSED_TIME]
@ -276,7 +264,7 @@ object DownloadDataHelper {
payloadObject.put("speed", speed)
}
} else {
payloadObject.put("task_num", NDataChanger.downloadingTasks.size)
payloadObject.put("task_num", DataChanger.downloadingTasks.size)
}
payloadObject.put("completed_size", downloadEntity.progress / 1024 / 1024)
if (downloadEntity.status == DownloadStatus.resume) {
@ -313,23 +301,18 @@ object DownloadDataHelper {
// payload
val payloadObject = JSONObject()
val parallel = downloadEntity.meta[DOWNLOAD_THREAD_SIZE]?.toInt()
payloadObject.put("host", downloadEntity.meta[DownloadEntity.DOWNLOAD_HOST_KEY] ?: "unknown")
payloadObject.put("path", downloadEntity.meta[DownloadEntity.DOWNLOAD_PATH_KEY] ?: "unknown")
payloadObject.put("game_id", downloadEntity.gameId)
payloadObject.put("gameName", downloadEntity.name)
payloadObject.put("platform", downloadEntity.platform)
payloadObject.put("package", downloadEntity.packageName)
payloadObject.put("certification", RealNameHelper.getCertificationStatus())
payloadObject.put("filename", getFileName(downloadEntity))
payloadObject.put("speed_progress", JSONArray(averageSpeedList))
payloadObject.put("is_finished", downloadEntity.status == DownloadStatus.done)
payloadObject.put("completed_size", downloadEntity.progress / 1024 / 1024)
if (parallel != null) {
payloadObject.put("parallel", parallel)
}
payloadObject.put("task_num", NDataChanger.downloadingTasks.size)
payloadObject.put("parallel", downloadEntity.meta[DOWNLOAD_THREAD_SIZE]?.toInt() ?: 0)
payloadObject.put("task_num", DataChanger.downloadingTasks.size)
jsonObject.put("payload", payloadObject)
} catch (e: Exception) {
e.printStackTrace()
@ -352,7 +335,7 @@ object DownloadDataHelper {
* 在后台唤醒的情况下 下载状态可能无法修正
* see [DownloadManager.initDownloadService]
*/
if (downloadEntity.status == DownloadStatus.downloading && NDataChanger.downloadingTasks[downloadEntity.url] != null) {
if (downloadEntity.status == DownloadStatus.downloading && DataChanger.downloadingTasks[downloadEntity.url] != null) {
var sheet = mDownloadHeartbeatSheet[downloadEntity.url]
if (sheet == null) {
sheet = JSONObject()
@ -361,7 +344,6 @@ object DownloadDataHelper {
sheet.put("game_id", downloadEntity.gameId)
sheet.put("platform", downloadEntity.platform)
sheet.put("package", downloadEntity.packageName)
sheet.put("certification", RealNameHelper.getCertificationStatus())
sheet.put("filename", getFileName(downloadEntity))
sheet.put("total_size", downloadEntity.size / 1024 / 1024)
sheet.put("current_progress_size", downloadEntity.progress / 1024)

View File

@ -15,7 +15,6 @@ import androidx.collection.ArrayMap;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import com.gh.gamecenter.common.base.GlobalActivityManager;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.core.AppExecutor;
@ -49,18 +48,17 @@ import com.gh.gamecenter.eventbus.EBDownloadStatus;
import com.gh.gamecenter.manager.PackagesManager;
import com.gh.gamecenter.login.user.UserManager;
import com.gh.gamecenter.packagehelper.PackageRepository;
import com.gh.vspace.VHelper;
import com.gh.ndownload.NDataChanger;
import com.gh.ndownload.NDownloadBridge;
import com.gh.ndownload.NDownloadService;
import com.halo.assistant.HaloApp;
import com.lightgame.download.ConnectionUtils;
import com.lightgame.download.DataChanger;
import com.lightgame.download.DataWatcher;
import com.lightgame.download.DownloadConfig;
import com.lightgame.download.DownloadDao;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.DownloadService;
import com.lightgame.download.DownloadStatus;
import com.lightgame.download.DownloadStatusListener;
import com.lightgame.download.DownloadStatusManager;
import com.lightgame.download.DownloadTask;
import com.lightgame.download.FileUtils;
import com.lightgame.download.HttpDnsManager;
@ -92,9 +90,9 @@ public class DownloadManager implements DownloadStatusListener {
private final Map<String, ConcurrentHashMap<String, DownloadEntity>> gameMap;
private final ArrayMap<String, DownloadStatus> statusMap;
private final ConcurrentHashMap<String, DownloadEntity> downloadingMap;
private final ArrayMap<String, DownloadEntity> downloadingMap;
private final ArrayList<DownloadEntity> mInvisiblePendingTaskList; // 用户不可见的 pending 任务
private ArrayList<DownloadEntity> mInvisiblePendingTaskList; // 用户不可见的 pending 任务
private final DownloadDao mDownloadDao;
private final DownloadedGameIdAndPackageNameDao mDownloadedGameIdAndPackageNameDao;
@ -170,6 +168,8 @@ public class DownloadManager implements DownloadStatusListener {
mUpdateMarks = SPUtils.getStringSet(UPDATE_IS_READ_MARK);
DownloadStatusManager.getInstance().registerTaskStatusListener(this);
// 只有下载模块需要这坨东西,因此移动到这里初始化
ConnectionUtils.initHttpsUrlConnection(mContext);
@ -179,7 +179,7 @@ public class DownloadManager implements DownloadStatusListener {
platformMap = new ArrayMap<>();
gameMap = new ConcurrentHashMap<>();
statusMap = new ArrayMap<>();
downloadingMap = new ConcurrentHashMap<>();
downloadingMap = new ArrayMap<>();
// mDownloadSnapshotList = new ArrayList<>();
mInvisiblePendingTaskList = new ArrayList<>();
@ -225,6 +225,10 @@ public class DownloadManager implements DownloadStatusListener {
}
}
public ArrayMap<String, DownloadEntity> getDownloadingMap() {
return downloadingMap;
}
public static DownloadManager getInstance() {
return SingletonHolder.INSTANCE;
}
@ -323,7 +327,6 @@ public class DownloadManager implements DownloadStatusListener {
ExtensionsKt.addMetaExtra(downloadEntity, Constants.GAME_ICON_SUBSCRIPT, gameEntity.getIconSubscript());
ExtensionsKt.addMetaExtra(downloadEntity, Constants.IS_PLATFORM_RECOMMEND, apkEntity.getRecommend() != null ? "true" : "false");
ExtensionsKt.addMetaExtra(downloadEntity, Constants.GAME_NAME, gameEntity.getName());
ExtensionsKt.addMetaExtra(downloadEntity, Constants.GAME_TYPE, gameEntity.getCategoryChinese());
ExtensionsKt.addMetaExtra(downloadEntity, Constants.AD_ICON_ACTIVE, String.valueOf(gameEntity.getAdIconActive()));
ExtensionsKt.addMetaExtra(downloadEntity, Constants.IS_AD_DATA, String.valueOf(gameEntity.isAdData()));
if (gameEntity.getIconFloat() != null) {
@ -340,26 +343,10 @@ public class DownloadManager implements DownloadStatusListener {
ExtensionsKt.addMetaExtra(downloadEntity, Constants.SMOOTH_GAME, "true");
ExtensionsKt.addMetaExtra(downloadEntity, Constants.EXTRA_DOWNLOAD_TYPE, Constants.SMOOTH_GAME);
ExtensionsKt.addMetaExtra(downloadEntity, DownloadConfig.KEY_PROGRESS_CALLBACK_INTERVAL, "200");
ExtensionsKt.addMetaExtra(downloadEntity, VHelper.KEY_REQUIRED_G_APPS, gameEntity.getGAppsSwitch());
ExtensionsKt.addMetaExtra(downloadEntity, VHelper.KEY_BIT, apkEntity.getBit());
SensorsBridge.trackEvent("HaloFunGameDownloadClick",
"game_name", gameEntity.getName(),
"game_id", gameEntity.getId(),
"game_schema_type", gameEntity.getGameBitChinese());
} else {
SensorsBridge.trackEvent("DownloadProcessBegin",
"game_id", gameEntity.getId(),
"game_name", gameEntity.getName(),
"game_type", gameEntity.getCategoryChinese(),
"game_schema_type", gameEntity.getGameBitChinese(),
"page_name", GlobalActivityManager.getCurrentPageEntity().getPageName(),
"page_id", GlobalActivityManager.getCurrentPageEntity().getPageId(),
"page_business_id", GlobalActivityManager.getCurrentPageEntity().getPageBusinessId(),
"last_page_name", GlobalActivityManager.getLastPageEntity().getPageName(),
"last_page_id", GlobalActivityManager.getLastPageEntity().getPageId(),
"last_page_business_id", GlobalActivityManager.getLastPageEntity().getPageBusinessId()
);
"game_id", gameEntity.getId());
}
HashMap<String, String> map = PageSwitchDataHelper.popLastPageData();
@ -443,7 +430,7 @@ public class DownloadManager implements DownloadStatusListener {
if (isDownloadCompleted(url)) {
downloadEntity.setStatus(DownloadStatus.done);
NDataChanger.INSTANCE.notifyDataChanged(downloadEntity);
DataChanger.INSTANCE.notifyDataChanged(downloadEntity);
} else if (!isTaskDownloading(url)) {
startDownloadService(downloadEntity, DownloadStatus.add);
}
@ -464,7 +451,7 @@ public class DownloadManager implements DownloadStatusListener {
checkDownloadEntryRecordValidate(url);
if (isDownloadCompleted(url)) {
downloadEntity.setStatus(DownloadStatus.done);
NDataChanger.INSTANCE.notifyDataChanged(downloadEntity);
DataChanger.INSTANCE.notifyDataChanged(downloadEntity);
} else if (!isTaskDownloading(url)) {
DownloadEntity daoEntity = mDownloadDao.get(downloadEntity.getUrl());
if (automatic) {
@ -499,7 +486,7 @@ public class DownloadManager implements DownloadStatusListener {
checkDownloadEntryRecordValidate(url);
if (isDownloadCompleted(url)) {
downloadEntity.setStatus(DownloadStatus.done);
NDataChanger.INSTANCE.notifyDataChanged(downloadEntity);
DataChanger.INSTANCE.notifyDataChanged(downloadEntity);
} else if (!isTaskDownloading(url)) {
startDownloadService(downloadEntity, DownloadStatus.subscribe);
}
@ -545,7 +532,7 @@ public class DownloadManager implements DownloadStatusListener {
* 任务是否已经下载中
*/
public boolean isTaskDownloading(String url) {
if (NDataChanger.INSTANCE.getDownloadingTasks().get(url) != null) {
if (DataChanger.INSTANCE.getDownloadingTasks().get(url) != null) {
Utils.log(DownloadManager.class.getSimpleName(), url + "正在下载!");
return true;
}
@ -553,7 +540,7 @@ public class DownloadManager implements DownloadStatusListener {
}
private Intent getIntent(DownloadEntity entry, DownloadStatus status) {
Intent service = new Intent(mContext, NDownloadService.class);
Intent service = new Intent(mContext, DownloadService.class);
service.putExtra(DownloadConfig.KEY_DOWNLOAD_ENTRY, entry);
service.putExtra(DownloadConfig.KEY_DOWNLOAD_ACTION, status.name());
return service;
@ -582,16 +569,6 @@ public class DownloadManager implements DownloadStatusListener {
return mDownloadDao.getAllSnapshots();
}
/**
* 获取快照
*
* @param url 下载地址
*/
@Nullable
public DownloadEntity getDownloadEntitySnapshot(String url) {
return mDownloadDao.getSnapshot(url);
}
/**
* 获取快照
*
@ -629,7 +606,7 @@ public class DownloadManager implements DownloadStatusListener {
}
/**
* 根据包名获取下载任务快照 (仅保证下载状态一致)
* 根据 url 获取下载任务快照 (仅保证下载状态一致)
*
* @param packageName 包名 (多包名一样时取第一个,若使用场景里有多包名,请使用 url 获取下载任务)
* @return null 表示下载列表中不存在该任务,否则返回下载任务
@ -832,8 +809,6 @@ public class DownloadManager implements DownloadStatusListener {
DownloadEntity entry = mDownloadDao.getSnapshot(url);
if (entry != null) {
AppExecutor.getIoExecutor().execute(() -> {
NDownloadBridge.INSTANCE.cancel(url);
mDownloadDao.delete(url);
if (isDeleteFile) {
@ -867,16 +842,19 @@ public class DownloadManager implements DownloadStatusListener {
private void cancelAndNotify(DownloadEntity entry, boolean cancelSilently) {
mDownloadDao.removeErrorMessage(entry.getUrl());
DownloadTask task = NDataChanger.INSTANCE.getDownloadingTasks().get(entry.getUrl());
DownloadTask task = DataChanger.INSTANCE.getDownloadingTasks().get(entry.getUrl());
if (task != null) {
task.cancel();
// 改任务队列的状态
NDataChanger.INSTANCE.getDownloadingTasks().remove(entry.getUrl());
DataChanger.INSTANCE.getDownloadingTasks().remove(entry.getUrl());
if (!cancelSilently) {
DataChanger.INSTANCE.notifyDataChanged(entry);
}
}
NDataChanger.INSTANCE.getDownloadEntries().remove(entry.getUrl());
DataChanger.INSTANCE.getDownloadEntries().remove(entry.getUrl());
if (!cancelSilently) {
NDataChanger.INSTANCE.notifyDataChanged(entry);
onTaskCancelled(entry);
DataChanger.INSTANCE.notifyDataChanged(entry);
DownloadStatusManager.getInstance().onTaskCancelled(entry);
}
Utils.log(DownloadManager.class.getSimpleName(), "cancel");
@ -886,7 +864,7 @@ public class DownloadManager implements DownloadStatusListener {
* 暂停所有正在下载的任务
*/
public void pauseAll() {
for (DownloadEntity entity : NDataChanger.INSTANCE.getDownloadEntries().values()) {
for (DownloadEntity entity : DataChanger.INSTANCE.getDownloadEntries().values()) {
pause(entity.getUrl());
}
Utils.log(DownloadManager.class.getSimpleName(), "pause all");
@ -897,7 +875,7 @@ public class DownloadManager implements DownloadStatusListener {
*/
public void pause(String url) {
checkDownloadEntryRecordValidate(url);
DownloadEntity entry = NDataChanger.INSTANCE.getDownloadEntries().get(url);
DownloadEntity entry = DataChanger.INSTANCE.getDownloadEntries().get(url);
if (entry != null) {
startDownloadService(entry, DownloadStatus.pause);
put(url, System.currentTimeMillis());
@ -913,14 +891,14 @@ public class DownloadManager implements DownloadStatusListener {
* 3.检查是否显示下载通知栏
*/
public void initDownloadService() {
final List<String> urlList = new ArrayList<>(NDataChanger.INSTANCE.getDownloadingTasks().keySet());
final List<String> urlList = new ArrayList<>(DataChanger.INSTANCE.getDownloadingTasks().keySet());
for (DownloadEntity downloadEntity : getAllDownloadEntity()) {
if (!urlList.contains(downloadEntity.getUrl()) &&
(downloadEntity.getStatus().equals(DownloadStatus.downloading)
|| downloadEntity.getStatus().equals(DownloadStatus.waiting))) {
downloadEntity.setStatus(DownloadStatus.subscribe);
mDownloadDao.newOrUpdate(downloadEntity);
NDataChanger.INSTANCE.notifyDataChanged(downloadEntity);
DataChanger.INSTANCE.notifyDataChanged(downloadEntity);
}
}
@ -933,7 +911,7 @@ public class DownloadManager implements DownloadStatusListener {
*/
public void addObserver(DataWatcher dataWatcher) {
Utils.log(DownloadManager.class.getSimpleName(), "addObserver");
NDataChanger.INSTANCE.addObserver(dataWatcher);
DataChanger.INSTANCE.addObserver(dataWatcher);
notifyDownloadStatusASAP(dataWatcher);
}
@ -943,7 +921,7 @@ public class DownloadManager implements DownloadStatusListener {
*/
public void removeObserver(DataWatcher dataWatcher) {
Utils.log(DownloadManager.class.getSimpleName(), "removeObserver");
NDataChanger.INSTANCE.deleteObserver(dataWatcher);
DataChanger.INSTANCE.deleteObserver(dataWatcher);
}
/**
@ -959,11 +937,11 @@ public class DownloadManager implements DownloadStatusListener {
* 初始化下载服务
*/
public void startDownloadService() {
Intent serviceIntent = new Intent(mContext, NDownloadService.class);
Intent serviceIntent = new Intent(mContext, DownloadService.class);
// 当满足系统版本大于 8.0 并且应用在后台运行时以前台服务开启
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
&& !PackageUtils.isAppOnForeground(mContext)) {
serviceIntent.putExtra(NDownloadService.KEY_SERVICE_ACTION, NDownloadService.START_FOREGROUND);
serviceIntent.putExtra(DownloadService.KEY_SERVICE_ACTION, DownloadService.START_FOREGROUND);
mContext.startForegroundService(serviceIntent);
} else {
/*
@ -1003,7 +981,7 @@ public class DownloadManager implements DownloadStatusListener {
// 当满足系统版本大于 8.0 并且应用在后台运行时以前台服务开启
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
&& !PackageUtils.isAppOnForeground(mContext)) {
serviceIntent.putExtra(NDownloadService.KEY_SERVICE_ACTION, NDownloadService.START_FOREGROUND);
serviceIntent.putExtra(DownloadService.KEY_SERVICE_ACTION, DownloadService.START_FOREGROUND);
mContext.startForegroundService(serviceIntent);
} else {
mContext.startService(serviceIntent);
@ -1134,7 +1112,7 @@ public class DownloadManager implements DownloadStatusListener {
String mark = downloadEntity.getMeta().get(DOWNLOADED_IS_READ_MARK);
if (TextUtils.isEmpty(mark)) {
downloadEntity.getMeta().put(DOWNLOADED_IS_READ_MARK, DOWNLOADED_IS_READ_MARK);
mDownloadDao.update(downloadEntity, false);
mDownloadDao.newOrUpdate(downloadEntity);
if (!markHasChanged) markHasChanged = true;
}
}
@ -1174,12 +1152,12 @@ public class DownloadManager implements DownloadStatusListener {
String mark = downloadEntity.getMeta().get(DOWNLOADING_IS_READ_MARK);
if (TextUtils.isEmpty(mark)) {
downloadEntity.getMeta().put(DOWNLOADING_IS_READ_MARK, DOWNLOADING_IS_READ_MARK);
mDownloadDao.update(downloadEntity, false);
mDownloadDao.newOrUpdate(downloadEntity);
if (!markHasChanged) markHasChanged = true;
}
} else {
downloadEntity.getMeta().put(DOWNLOADING_IS_READ_MARK, "");
mDownloadDao.update(downloadEntity, false);
mDownloadDao.newOrUpdate(downloadEntity);
if (!markHasChanged) markHasChanged = true;
}
}
@ -1237,7 +1215,7 @@ public class DownloadManager implements DownloadStatusListener {
* 更新数据库中的下载实体
*/
public void updateDownloadEntity(DownloadEntity downloadEntity) {
mDownloadDao.update(downloadEntity, false);
mDownloadDao.newOrUpdate(downloadEntity);
}
/**

View File

@ -32,15 +32,13 @@ import okhttp3.MediaType
import okhttp3.RequestBody
import org.json.JSONException
import org.json.JSONObject
import java.util.*
import java.util.concurrent.CopyOnWriteArrayList
object PackageObserver {
private val mPackageViewModel: PackageViewModel
by lazy { PackageViewModel(HaloApp.getInstance().application, PackageRepository) }
private val mPackageChangeListenerList = CopyOnWriteArrayList<PackageChangeListener>()
private val mPackageChangeListenerList: ArrayList<PackageChangeListener> = arrayListOf()
fun registerPackageChangeChangeListener(listener: PackageChangeListener) {
mPackageChangeListenerList.add(listener)
@ -93,11 +91,9 @@ object PackageObserver {
}
if (EBPackage.TYPE_INSTALLED == busFour.type) {
if (!busFour.isVGame) {
// 非畅玩游戏才执行下面的代码
mPackageViewModel.addInstalledGame(packageName)
BrowserInstallHelper.onApkInstalled(mDownloadEntity?.path)
}
mPackageViewModel.addInstalledGame(packageName)
BrowserInstallHelper.onApkInstalled(mDownloadEntity?.path)
if (mDownloadEntity != null) {
// 没有光环 ID 的都记录一下游戏 ID供'我的游戏'区分同包名不同插件用
@ -140,13 +136,12 @@ object PackageObserver {
runOnIoThread { postNewlyInstalledApp(gameId, packageName) }
}
if (EBPackage.TYPE_UNINSTALLED == busFour.type) {
if ("卸载" == busFour.type) {
mPackageViewModel.addUninstalledGame(packageName)
mDownloadEntity?.let {
if (it.isVGame()) return@let
if (it.isPluggable
|| (it.isUpdate && !PackageUtils.isInstalled(application, it.packageName))) {
if (it.isPluggable || it.isUpdate) {
PackageInstaller.install(application, mDownloadEntity)
}
}

View File

@ -15,7 +15,6 @@ import okhttp3.Request
import okhttp3.Response
import tv.danmaku.ijk.media.exo2.ExoSourceManager
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.TimeUnit
object ExoCacheManager {
@ -99,9 +98,7 @@ object ExoCacheManager {
.build()
var response: Response? = null
try {
response =
OkHttpClient.Builder().connectTimeout(5, TimeUnit.SECONDS).readTimeout(5, TimeUnit.SECONDS).build()
.newCall(request).execute()
response = OkHttpClient.Builder().build().newCall(request).execute()
if (response!!.isSuccessful && response.body() != null) {
val length = response.body()!!.contentLength()
contentLength = if (length == 0L) -1L else length

View File

@ -373,9 +373,7 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
override fun onConfirm() {
DialogUtils.checkDownload(
context,
apkEntity.size,
gameEntity.id,
gameEntity.name
apkEntity.size
) { isSubscribe ->
DownloadManager.createDownload(
context,

View File

@ -83,6 +83,10 @@ object DownloadMessageHandler : InnerDownloadListener {
}
}
override fun onDownloadComplete(id: String?, elapsedTime: Long) {
// do nothing
}
/**
* 重定向中的回调
* @param id 下载 id
@ -214,10 +218,6 @@ object DownloadMessageHandler : InnerDownloadListener {
// do nothing
}
override fun onDownloadComplete(id: String?, elapsedTime: Long) {
// do nothing
}
fun registerListener(id: String, listener: DownloadListener) {
var listenerList = mListenerMap[id]
if (listenerList == null) {

View File

@ -27,7 +27,7 @@ class BlockActivity : DownloadToolbarActivity() {
}
override fun provideNormalIntent(): Intent {
return getTargetIntent(this, BlockActivity::class.java, GameFragment::class.java, intent?.extras)
return getTargetIntent(this, BlockActivity::class.java, GameFragment::class.java)
}
override fun showDownloadMenu(): Boolean {

View File

@ -101,7 +101,7 @@ class GameDetailActivity : DownloadToolbarActivity() {
entrance: String,
traceEvent: ExposureEvent?
) {
startGameDetailActivity(context, gameEntity, entrance, "", traceEvent = traceEvent)
startGameDetailActivity(context, gameEntity, entrance, -1, traceEvent = traceEvent)
}
/**
@ -117,7 +117,7 @@ class GameDetailActivity : DownloadToolbarActivity() {
context: Context,
gameEntity: GameEntity?,
entrance: String,
defaultTab: String = "",
defaultTab: Int = -1,
isSkipGameComment: Boolean = false,
scrollToLibao: Boolean = false,
scrollToServer: Boolean = false,
@ -140,18 +140,18 @@ class GameDetailActivity : DownloadToolbarActivity() {
)
traceEvent.payload = payload
}
if (defaultTab.isNotEmpty()) {
bundle.putString(EntranceConsts.KEY_TARGET, defaultTab)
if (defaultTab != -1) {
bundle.putInt(EntranceConsts.KEY_TARGET, defaultTab)
}
if (isSkipGameComment) {
bundle.putBoolean(EntranceConsts.KEY_SKIP_GAME_COMMENT, true)
}
if (scrollToLibao) {
bundle.putString(EntranceConsts.KEY_TARGET, GameDetailFragment.TAB_DESC)
bundle.putInt(EntranceConsts.KEY_TARGET, GameDetailFragment.INDEX_DESC)
bundle.putBoolean(EntranceConsts.KEY_SCROLL_TO_LIBAO, true)
}
if (scrollToServer) {
bundle.putString(EntranceConsts.KEY_TARGET, GameDetailFragment.TAB_DESC)
bundle.putInt(EntranceConsts.KEY_TARGET, GameDetailFragment.INDEX_DESC)
bundle.putBoolean(EntranceConsts.KEY_SCROLL_TO_SERVER, true)
}
bundle.putString(EntranceConsts.KEY_GAMEID, gameEntity?.id)
@ -257,7 +257,7 @@ class GameDetailActivity : DownloadToolbarActivity() {
}
if (openVideoStreaming) {
bundle.putBoolean(EntranceConsts.KEY_OPEN_VIDEO_STREAMING, true)
bundle.putString(EntranceConsts.KEY_TARGET, GameDetailFragment.TAB_DESC)
bundle.putInt(EntranceConsts.KEY_TARGET, GameDetailFragment.INDEX_DESC)
}
if (openPlatformWindow) {
bundle.putBoolean(EntranceConsts.KEY_OPEN_PLATFORM_WINDOW, true)
@ -269,7 +269,7 @@ class GameDetailActivity : DownloadToolbarActivity() {
}
}
if (scrollToLibao) {
bundle.putString(EntranceConsts.KEY_TARGET, GameDetailFragment.TAB_DESC)
bundle.putInt(EntranceConsts.KEY_TARGET, GameDetailFragment.INDEX_TRENDES)
bundle.putBoolean(EntranceConsts.KEY_SCROLL_TO_LIBAO, true)
}
bundle.putString(EntranceConsts.KEY_GAMEID, gameId)

View File

@ -861,7 +861,7 @@ class ImageViewerActivity : BaseActivity(), OnPageChangeListener {
imageView.setOnLongClickListener {
// 下滑的时候不弹
if (imageView.isDragging()) {
return@setOnLongClickListener true
return@setOnLongClickListener false
}
val dialog = Dialog(this@ImageViewerActivity)
@ -897,7 +897,7 @@ class ImageViewerActivity : BaseActivity(), OnPageChangeListener {
}
dialog.cancel()
}
true
false
}
view.tag = position
container.addView(view)

View File

@ -4,7 +4,6 @@ import static com.gh.gamecenter.common.constant.Constants.LOGIN_TAG;
import static com.gh.gamecenter.common.constant.Constants.LOGOUT_TAG;
import static com.gh.gamecenter.common.constant.EntranceConsts.ENTRANCE_BROWSER;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_LAUNCH_SIMULATOR_GAME;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_LAUNCH_VM_GAME;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_QQ;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_QQ_GROUP;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_WEB;
@ -33,7 +32,6 @@ import android.text.Html;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
@ -43,7 +41,6 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProviders;
import com.alibaba.android.arouter.launcher.ARouter;
import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.common.DefaultUrlHandler;
import com.gh.common.constant.Config;
@ -77,7 +74,6 @@ import com.gh.gamecenter.common.base.fragment.ToolbarFragment;
import com.gh.gamecenter.common.constant.CommonConsts;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.common.constant.RouteConsts;
import com.gh.gamecenter.common.entity.LinkEntity;
import com.gh.gamecenter.common.entity.NotificationUgc;
import com.gh.gamecenter.common.entity.SuggestType;
@ -92,7 +88,6 @@ import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.gamecenter.common.utils.NotificationHelper;
import com.gh.gamecenter.common.utils.ShareUtils;
import com.gh.gamecenter.core.AppExecutor;
import com.gh.gamecenter.core.provider.IStartUpAdProvider;
import com.gh.gamecenter.core.utils.ClassUtils;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.core.utils.GsonUtils;
@ -121,7 +116,6 @@ import com.gh.gamecenter.packagehelper.PackageViewModel;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.gh.gamecenter.room.AppDatabase;
import com.gh.gamecenter.room.dao.SimulatorGameDao;
import com.gh.vspace.VHelper;
import com.google.android.exoplayer2.upstream.cache.Cache;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
@ -192,8 +186,6 @@ public class MainActivity extends BaseActivity {
private final Handler handler = new Handler();
public boolean showAd = false; // 是否显示广告
private IStartUpAdProvider mStartUpAdProvider;
@Override
protected void onCreate(Bundle savedInstanceState) {
showAd = getIntent().getBooleanExtra(SHOW_AD, false) && savedInstanceState == null;
@ -312,8 +304,7 @@ public class MainActivity extends BaseActivity {
if (showAd) {
observeStartUp();
} else {
hideStartUp();
hideStartUpAd();
checkDialog();
}
// 默认配置为空时重试
@ -474,8 +465,6 @@ public class MainActivity extends BaseActivity {
protected void onDestroy() {
super.onDestroy();
if (mStartUpAdProvider != null) mStartUpAdProvider.cancelStartUpAd(this);
handler.removeCallbacksAndMessages(null);
releaseExoSourceCache();
}
@ -509,17 +498,8 @@ public class MainActivity extends BaseActivity {
showStartUp(startUp);
AppExecutor.getUiExecutor().executeWithDelay(() -> {
hideStartUp();
initStartUpAd();
observeStartUpAd();
}, 2000);
} else {
initStartUpAd();
}
}
private void initStartUpAd() {
mStartUpAdProvider = (IStartUpAdProvider) ARouter.getInstance().build(RouteConsts.provider.adSdk).navigation();
if (mStartUpAdProvider != null && mStartUpAdProvider.shouldEnableSDK(HaloApp.getInstance().getChannel())) {
initSDKStartUpAd();
} else {
observeStartUpAd();
}
@ -613,12 +593,6 @@ public class MainActivity extends BaseActivity {
startAdContainer.setVisibility(View.GONE);
ExtensionsKt.removeFromParent(startAdContainer);
}
View startSdkAdContainer = findViewById(R.id.sdkStartAdContainer);
if (startSdkAdContainer != null) {
startSdkAdContainer.setVisibility(View.GONE);
ExtensionsKt.removeFromParent(startSdkAdContainer);
if (mStartUpAdProvider != null) mStartUpAdProvider.cancelStartUpAd(this);
}
checkDialog();
}
@ -676,18 +650,6 @@ public class MainActivity extends BaseActivity {
mBaseHandler.sendEmptyMessageDelayed(COUNTDOWN_AD, 1000);
}
private void initSDKStartUpAd() {
View startAdContainer = findViewById(R.id.sdkStartAdContainer);
startAdContainer.setVisibility(View.VISIBLE);
FrameLayout adsFl = findViewById(R.id.adsFl);
if (mStartUpAdProvider != null) {
mStartUpAdProvider.initStartUpAd(startAdContainer, adsFl, showAd, () -> {
hideStartUpAd();
return null;
});
}
}
private void showStartUp(StartupAdEntity ad) {
TextView adContentTv = findViewById(R.id.adContentTv);
View containerView = findViewById(R.id.maskContainer);
@ -797,24 +759,6 @@ public class MainActivity extends BaseActivity {
);
}
break;
case HOST_LAUNCH_VM_GAME:
String gamePackageName = getIntent().getStringExtra(EntranceConsts.KEY_GAME_PKG);
if (TextUtils.isEmpty(gamePackageName)) {
ToastUtils.showToast("游戏启动失败,请联系客服反馈相关信息");
return;
}
ToastUtils.showToast("游戏启动中,请稍后~");
handler.postDelayed(() -> {
VHelper.postOnInitialized(() -> {
if (VHelper.isInstalled(gamePackageName)) {
VHelper.launch(this, gamePackageName, false, true);
} else {
ToastUtils.showToast("应用已被卸载!");
}
return null;
});
}, 500);
break;
case KEY_MARKET_DETAILS:
redirectGameDetail(bundle.getString(KEY_DATA));
break;

View File

@ -30,6 +30,7 @@ import com.ethanhua.skeleton.ViewSkeletonScreen;
import com.gh.base.DownloadToolbarActivity;
import com.gh.common.filter.RegionSettingHelper;
import com.gh.common.history.HistoryHelper;
import com.gh.gamecenter.feature.utils.ApkActiveUtils;
import com.gh.common.util.CheckLoginUtils;
import com.gh.common.util.CollectionUtils;
import com.gh.common.util.DataCollectionUtils;
@ -40,8 +41,6 @@ import com.gh.gamecenter.adapter.viewholder.DetailViewHolder;
import com.gh.gamecenter.common.callback.OnRequestCallBackListener;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.common.eventbus.EBNetworkState;
import com.gh.gamecenter.common.eventbus.EBReuse;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.ShareUtils;
@ -50,16 +49,15 @@ import com.gh.gamecenter.common.view.VerticalItemDecoration;
import com.gh.gamecenter.core.utils.ClickUtils;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.core.utils.MtaHelper;
import com.gh.gamecenter.entity.NewsDetailEntity;
import com.gh.gamecenter.eventbus.EBConcernChanged;
import com.gh.gamecenter.eventbus.EBAddComment;
import com.gh.gamecenter.eventbus.EBDeleteComment;
import com.gh.gamecenter.eventbus.EBDownloadStatus;
import com.gh.gamecenter.eventbus.EBPackage;
import com.gh.gamecenter.feature.entity.GameEntity;
import com.gh.gamecenter.feature.entity.MeEntity;
import com.gh.gamecenter.entity.NewsDetailEntity;
import com.gh.gamecenter.feature.entity.NewsEntity;
import com.gh.gamecenter.feature.utils.ApkActiveUtils;
import com.gh.gamecenter.eventbus.EBConcernChanged;
import com.gh.gamecenter.eventbus.EBDownloadStatus;
import com.gh.gamecenter.common.eventbus.EBNetworkState;
import com.gh.gamecenter.eventbus.EBPackage;
import com.gh.gamecenter.common.eventbus.EBReuse;
import com.gh.gamecenter.newsdetail.NewsDetailAdapter;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.lightgame.download.DataWatcher;
@ -94,9 +92,6 @@ public class NewsDetailActivity extends DownloadToolbarActivity implements OnCli
TextView mNoneDataTv;
RelativeLayout mDetailCommentLl;
RelativeLayout mSkeletonView;
View mCommentContainer;
View mDownloadContainer;
View mBottomContainer;
MenuItem mNewsShare;
MenuItem mNewsCollection;
@ -123,7 +118,7 @@ public class NewsDetailActivity extends DownloadToolbarActivity implements OnCli
private NewsEntity mNewsEntity;
private DownloadEntity mDownloadEntity;
private Boolean mHideUselessInfo = false; // 是否需要隐藏一些额外的信息(评论按钮等)
private Boolean mHideUselessInfo = false;
private Handler handler = new Handler();
@ -275,9 +270,6 @@ public class NewsDetailActivity extends DownloadToolbarActivity implements OnCli
mNoneDataTv = findViewById(R.id.reuseNoneDataTv);
mDetailCommentLl = findViewById(R.id.news_detail_ll_coment);
mSkeletonView = findViewById(R.id.news_skeleton);
mCommentContainer = findViewById(R.id.commentContainer);
mDownloadContainer = findViewById(R.id.detail_ll_bottom);
mBottomContainer = findViewById(R.id.bottomContainer);
mViewSkeletonScreen = Skeleton.bind(mSkeletonView).shimmer(false).load(R.layout.news_detail_skeleton).show();
// init toolbar
@ -300,7 +292,6 @@ public class NewsDetailActivity extends DownloadToolbarActivity implements OnCli
if (mHideUselessInfo) {
getMenuItem(R.id.menu_download).setVisible(false);
mCommentContainer.setVisibility(View.GONE);
}
adapter = new NewsDetailAdapter(this, this, mHideUselessInfo, mEntrance);
@ -559,17 +550,6 @@ public class NewsDetailActivity extends DownloadToolbarActivity implements OnCli
});
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onDeleteComment(EBDeleteComment event) {
adapter.getNewsCommentNum();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onAddComment(EBAddComment event) {
adapter.getNewsCommentNum();
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
switch (ev.getAction() & MotionEventCompat.ACTION_MASK) {
@ -686,22 +666,10 @@ public class NewsDetailActivity extends DownloadToolbarActivity implements OnCli
adapter.notifyItemInserted(1);
mDetailBottomLl.setVisibility(View.VISIBLE);
mDownloadContainer.setVisibility(View.VISIBLE);
mBottomContainer.setVisibility(View.VISIBLE);
DetailDownloadUtils.detailInitDownload(getDetailViewHolder(), true);
} else {
mCommentContainer.setVisibility(View.GONE);
// 关联了光环的文章不显示下载按钮
if ("光环助手".equals(gameEntity.getName())) {
mDetailBottomLl.setVisibility(View.GONE);
mBottomContainer.setVisibility(View.GONE);
} else {
mBottomContainer.setVisibility(View.VISIBLE);
mDetailBottomLl.setVisibility(View.VISIBLE);
}
mDetailBottomLl.setVisibility(View.GONE);
}
DetailDownloadUtils.detailInitDownload(getDetailViewHolder(), true);
}
});
}
@ -786,7 +754,7 @@ public class NewsDetailActivity extends DownloadToolbarActivity implements OnCli
mDetailRv.addItemDecoration(mItemDecoration);
if (mContentView != null) {
mContentView.setBackgroundColor(ContextCompat.getColor(this, R.color.background));
findViewById(R.id.bottomContainer).setBackgroundColor(ContextCompat.getColor(this, R.color.background_white));
findViewById(R.id.commentContainer).setBackgroundColor(ContextCompat.getColor(this, R.color.background_white));
((TextView) findViewById(R.id.commentTv)).setTextColor(ContextCompat.getColor(this, R.color.text_subtitle));
}
if (adapter != null) {

View File

@ -107,12 +107,6 @@ open class SearchActivity : BaseActivity() {
) {
updateDisplayType(DEFAULT)
}
SensorsBridge.trackEvent(
"SearchPageShow",
"source_entrance",
intent.getStringExtra(EntranceConsts.KEY_SOURCE_ENTRANCE) ?: ""
)
}
open fun initSearchBar() {
@ -178,7 +172,6 @@ open class SearchActivity : BaseActivity() {
mSearchKey = key
updateDisplayType(GAME_DIGEST)
LogUtils.uploadSearchGame("searching", "搜索页", key, "自动搜索")
SensorsBridge.trackEvent("SearchButtonClick", "search_content", key ?: "", "search_type", "输入搜索")
}
}
@ -188,7 +181,6 @@ open class SearchActivity : BaseActivity() {
searchEt.setSelection(searchEt.text.length)
updateDisplayType(GAME_DETAIL)
LogUtils.uploadSearchGame("searching", "搜索页", key, "默认搜索")
SensorsBridge.trackEvent("SearchButtonClick", "search_content", key ?: "", "search_type", "默认搜索")
// MtaHelper.onEvent("游戏搜索", "默认搜索", key)
}
@ -205,7 +197,6 @@ open class SearchActivity : BaseActivity() {
searchEt.setSelection(searchEt.text.length)
updateDisplayType(GAME_DETAIL)
LogUtils.uploadSearchGame("searching", "搜索页", key, "历史搜索")
SensorsBridge.trackEvent("SearchButtonClick", "search_content", key ?: "", "search_type", "历史搜索")
// MtaHelper.onEvent("游戏搜索", "历史搜索", key)
}
@ -220,7 +211,6 @@ open class SearchActivity : BaseActivity() {
} else if (newSearchKey != mSearchKey || mDisplayType != GAME_DETAIL) {
mSearchKey = newSearchKey
if (!TextUtils.isEmpty(mSearchKey)) {
SensorsBridge.trackEvent("SearchButtonClick", "search_content", newSearchKey, "search_type", "输入搜索")
mDao?.add(mSearchKey)
updateDisplayType(GAME_DETAIL)
} else {
@ -236,9 +226,7 @@ open class SearchActivity : BaseActivity() {
when (type) {
DEFAULT -> {
val fragment = supportFragmentManager.findFragmentByTag(SearchDefaultFragment::class.java.name)
?: SearchDefaultFragment().apply {
arguments = Bundle().also { it.putBoolean(SearchDefaultFragment.KEY_IS_GAME_SEARCH, true) }
}
?: SearchDefaultFragment()
transaction.replace(R.id.search_result, fragment, SearchDefaultFragment::class.java.name)
}
GAME_DIGEST -> {
@ -305,18 +293,11 @@ open class SearchActivity : BaseActivity() {
private const val HINT_TEXT = "搜索游戏..."
@JvmStatic
fun getIntent(
context: Context,
searchImmediately: Boolean,
hint: String,
entrance: String,
sourceEntrance: String
): Intent {
fun getIntent(context: Context, searchImmediately: Boolean, hint: String, entrance: String): Intent {
val intent = Intent(context, SearchActivity::class.java)
intent.putExtra(KEY_SEARCH_IMMEDIATELY, searchImmediately)
intent.putExtra(EntranceConsts.KEY_HINT, hint)
intent.putExtra(EntranceConsts.KEY_ENTRANCE, entrance)
intent.putExtra(EntranceConsts.KEY_SOURCE_ENTRANCE, sourceEntrance)
return intent
}
}

View File

@ -3,17 +3,18 @@ package com.gh.gamecenter;
import static com.gh.gamecenter.common.constant.EntranceConsts.ENTRANCE_BROWSER;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_ANSWER;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_ARTICLE;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_INVOKE_ONLY;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_CATEGORY;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_COLUMN;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_COLUMN_COLLECTION;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_COMMUNITY;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_COMMUNITY_COLUMN;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_CREATE_SHORTCUT;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_COMMUNITY_COLUMN_DETAIL;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_COMMUNITY_QUESTION_LABEL_DETAIL;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_DOWNLOAD;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_GAME;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_GAME_COLLECTION_DETAIL;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_GAME_COLLECTION_SQUARE;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_INVOKE_ONLY;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_LIBAO;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_QQ;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_QQ_GROUP;
@ -35,42 +36,33 @@ import static com.gh.gamecenter.common.constant.EntranceConsts.KEY_GAME_NAME;
import static com.gh.gamecenter.common.constant.EntranceConsts.KEY_NAME;
import static com.gh.gamecenter.common.constant.EntranceConsts.KEY_PACKAGENAME;
import static com.gh.gamecenter.common.constant.EntranceConsts.KEY_PLATFORM;
import static com.gh.gamecenter.common.constant.EntranceConsts.KEY_PLATFORM_VERSION;
import static com.gh.gamecenter.common.constant.EntranceConsts.KEY_TO;
import static com.gh.gamecenter.common.constant.EntranceConsts.KEY_TYPE;
import static com.gh.gamecenter.common.constant.EntranceConsts.KEY_VERSION;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Base64;
import androidx.annotation.Nullable;
import com.gh.gamecenter.common.base.activity.BaseActivity;
import com.gh.common.util.CheckLoginUtils;
import com.gh.common.util.DirectUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.gamecenter.common.base.activity.BaseActivity;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.common.util.EntranceUtils;
import com.gh.gamecenter.feature.utils.PlatformUtils;
import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.gamecenter.common.entity.CommunityEntity;
import com.gh.gamecenter.common.entity.LinkEntity;
import com.gh.gamecenter.common.entity.SimpleGameEntity;
import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.gamecenter.core.utils.ToastUtils;
import com.gh.gamecenter.entity.SubjectRecommendEntity;
import com.gh.gamecenter.entity.VideoLinkEntity;
import com.gh.gamecenter.feature.utils.PlatformUtils;
import com.gh.gamecenter.video.detail.VideoDetailContainerViewModel;
import com.gh.gamecenter.video.videomanager.VideoManagerActivity;
import com.gh.vspace.shortcut.OnCreateShortcutResult;
import com.gh.vspace.shortcut.ShortcutManager;
import com.gh.vspace.shortcut.ShortcutPermissionTipsDialog;
import com.halo.assistant.HaloApp;
import com.lightgame.config.CommonDebug;
import com.lightgame.utils.Utils;
import com.muugi.shortcut.core.Executor;
/**
* Created by LGT on 2016/11/16.
@ -112,10 +104,6 @@ public class SkipActivity extends BaseActivity {
case HOST_INVOKE_ONLY:
// 仅唤起光环助手,不进入光环页面。用于类似 ContentProvider 的用途
break;
case HOST_CREATE_SHORTCUT:
// 创建桌面快捷方式
createShortcut(uri);
return;
case HOST_ARTICLE:
DirectUtils.directToArticle(this, path, ENTRANCE_BROWSER);
break;
@ -134,11 +122,10 @@ public class SkipActivity extends BaseActivity {
String suggestionType = uri.getQueryParameter(KEY_TYPE);
boolean isQaFeedback = !TextUtils.isEmpty(isQaFeedbackString) && isQaFeedbackString.equals("true");
String content = (TextUtils.isEmpty(gameId) || TextUtils.isEmpty(packageMd5)) ?
String.format("%s—V%s—%sV%s",
String.format("%s-%s-V%s",
uri.getQueryParameter(KEY_GAME_NAME),
uri.getQueryParameter(KEY_VERSION),
TextUtils.isEmpty(platformName) ? platform : platformName,
uri.getQueryParameter(KEY_PLATFORM_VERSION)) :
uri.getQueryParameter(KEY_VERSION)) :
String.format("%s-%s-V%s\n游戏ID%s\n游戏包MD5%s\n",
uri.getQueryParameter(KEY_GAME_NAME),
TextUtils.isEmpty(platformName) ? platform : platformName,
@ -149,7 +136,7 @@ public class SkipActivity extends BaseActivity {
if (!TextUtils.isEmpty(qaId)) {
DirectUtils.directToQa(this, qaTitle, qaId);
} else if ("vgame".equals(suggestionType)) {
DirectUtils.directToVGameFeedback(this, content, "game", isQaFeedback, qaContentId, EntranceConsts.ENTRANCE_BROWSER);
DirectUtils.directToFeedbackCompat(this, content, "game", isQaFeedback, qaContentId, EntranceConsts.ENTRANCE_BROWSER);
} else {
DirectUtils.directToFeedback(this, content, null, isQaFeedback, qaContentId, EntranceConsts.ENTRANCE_BROWSER);
}
@ -328,11 +315,11 @@ public class SkipActivity extends BaseActivity {
entity.setLink(path);
entity.setName(name);
entity.setText(name);
DirectUtils.directToBlock(this, entity, mEntrance, null);
DirectUtils.directToBlock(this, entity, mEntrance);
break;
case EntranceConsts.HOST_SERVER_BLOCK:
DirectUtils.directToGameServers(this, ENTRANCE_BROWSER, "浏览器", null);
DirectUtils.directToGameServers(this, ENTRANCE_BROWSER, "浏览器");
break;
case EntranceConsts.HOST_AMWAY_BLOCK:
@ -400,7 +387,7 @@ public class SkipActivity extends BaseActivity {
DirectUtils.directToHelpAndFeedback(this, TextUtils.isEmpty(position) ? 0 : Integer.parseInt(position));
break;
case HOST_GAME_COLLECTION_DETAIL:
DirectUtils.directToGameCollectionDetail(this, path, ENTRANCE_BROWSER, "", null);
DirectUtils.directToGameCollectionDetail(this, path, ENTRANCE_BROWSER, "");
break;
case HOST_GAME_COLLECTION_SQUARE:
DirectUtils.directToGameCollectionSquare(this, ENTRANCE_BROWSER, "", "", "");
@ -433,55 +420,4 @@ public class SkipActivity extends BaseActivity {
finish();
}
/**
* 畅玩助手调用创建游戏桌面图标
*/
private void createShortcut(Uri uri) {
String shortcutGameId = uri.getQueryParameter(EntranceConsts.KEY_GAME_ID);
String shortcutGamePkg = uri.getQueryParameter(EntranceConsts.KEY_GAME_PKG);
OnCreateShortcutResult onCreateShortcutResult = new OnCreateShortcutResult() {
@Override
public void showPermissionDialog(@Nullable Executor executor) {
ShortcutPermissionTipsDialog dialog =
new ShortcutPermissionTipsDialog(SkipActivity.this, shortcutGameId, executor);
dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
finish();
}
});
if (SkipActivity.this.isFinishing()) {
ToastUtils.toast("创建桌面图标失败,请重试");
return;
}
dialog.show();
}
@Override
public void exist() {
Utils.toast(SkipActivity.this, getString(R.string.shortcut_exist));
finish();
}
@Override
public void success() {
Utils.toast(SkipActivity.this, getString(R.string.shortcut_create_success));
finish();
}
@Override
public void failed() {
Utils.toast(SkipActivity.this, getString(R.string.shortcut_create_failed));
finish();
}
};
ShortcutManager.Companion.getInstance().tryCreateShortCut(
this,
shortcutGameId,
shortcutGamePkg,
onCreateShortcutResult);
}
}

View File

@ -17,10 +17,11 @@ import androidx.core.app.ActivityCompat
import androidx.viewpager.widget.PagerAdapter
import androidx.viewpager.widget.ViewPager
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.g00fy2.versioncompare.Version
import com.gh.common.constant.Config
import com.gh.common.dialog.NewPrivacyPolicyDialogFragment
import com.gh.common.util.*
import com.gh.common.util.DialogUtils
import com.gh.common.util.GameSubstituteRepositoryHelper.updateGameSubstituteRepository
import com.gh.common.util.UsageStatsHelper.checkAndPostUsageStats
import com.gh.download.DownloadManager
@ -28,12 +29,8 @@ import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.callback.SimpleCallback
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.exposure.meta.MetaUtil
import com.gh.gamecenter.common.tracker.TrackerLogger
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.provider.IAppProvider
import com.gh.gamecenter.core.provider.IPackageUtilsProvider
import com.gh.gamecenter.core.provider.IStartUpAdProvider
import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.entity.PrivacyPolicyEntity
@ -42,7 +39,6 @@ import com.gh.gamecenter.pkg.PkgHelper
import com.gh.vspace.VHelper
import com.halo.assistant.HaloApp
import com.lightgame.download.FileUtils
import org.json.JSONObject
import pub.devrel.easypermissions.AfterPermissionGranted
import pub.devrel.easypermissions.EasyPermissions
import java.io.BufferedReader
@ -63,9 +59,6 @@ class SplashScreenActivity : BaseActivity() {
private var mStartMainActivityDirectly = false // 是否不需要用户点击立即体验就直接跳转首页
private var mViewModel: SplashScreenViewModel? = null
private var mShouldPrefetchData = true
private val mStartUpAdProvider by lazy {
ARouter.getInstance().build(RouteConsts.provider.adSdk).navigation() as? IStartUpAdProvider
}
private val mPermissions = arrayOf(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
@ -157,34 +150,6 @@ class SplashScreenActivity : BaseActivity() {
}
}
private fun logAppLaunch() {
val packageUtilsConfig =
ARouter.getInstance().build(RouteConsts.provider.packageUtils).navigation() as? IPackageUtilsProvider
val appProvider = ARouter.getInstance().build(RouteConsts.provider.app).navigation() as? IAppProvider
val signatureHash = packageUtilsConfig?.getApkSignatureByPackageName(this, packageName)?.get(0)
val sideLoadInfo = packageUtilsConfig?.getSideLoadedInfo()
val trackEvent = JSONObject()
// 是否首次使用神策
val isFirstTime = SPUtils.getBoolean(Constants.SP_SENSORS_IS_FIRST_TIME, true)
tryCatchInRelease {
trackEvent.run {
put("\$is_first_time", isFirstTime)
put("is_side_loaded", sideLoadInfo?.get("is_side_loaded").toBoolean())
put("installer_store", sideLoadInfo?.get("installer_store") ?: "")
put("package_name", packageName)
put("signature", signatureHash)
put("app_name", appProvider?.getAppName())
put("install_first_time", if (HaloApp.getInstance().isBrandNewInstall) "" else "")
}
}
SensorsBridge.trackEvent("AppLaunch", trackEvent)
if (!isFirstTime && HaloApp.getInstance().isBrandNewInstall) {
// 神策不是第一次使用,但是全局标志为全新安装,有问题,上报数据供后续确认
SentryHelper.onEvent("WRONG_LAUNCH_LOG", "a_id", MetaUtil.getBase64EncodedAndroidId())
}
SPUtils.setBoolean(Constants.SP_SENSORS_IS_FIRST_TIME, false)
}
private fun showPrivacyDialog(guideLayout: ViewPager) {
NewPrivacyPolicyDialogFragment.show(this, null) { isSuccess: Boolean ->
if (isSuccess) {
@ -304,37 +269,13 @@ class SplashScreenActivity : BaseActivity() {
overridePendingTransition(0, 0)
startActivity(intent)
doFlavorInit()
initStartUpAdSDK()
logAppLaunch()
finish()
}
private fun doFlavorInit() {
HaloApp.getInstance().flavorProvider.init(HaloApp.getInstance(), this, PkgHelper.getActivateRatio())
HaloApp.getInstance().flavorProvider.init(HaloApp.getInstance(), this)
val whiteListChannel = arrayListOf(
"GH_206",
"KS-GHZS-KY1",
"KS-GHZS-MC1",
"GDT_GHZS_MC1",
"T11-GH-APPDY-ZC01",
"T7-GH-APPDY-KY03",
"T8-GH-APPUX-KY04",
"T1-GHZS-MC01",
"T4-GHZS-MC03"
)
if (whiteListChannel.contains(HaloApp.getInstance().channel) || PackageFlavorHelper.IS_TEST_FLAVOR) {
SensorsBridge.init(HaloApp.getInstance(), HaloApp.getInstance().channel)
}
}
private fun initStartUpAdSDK() {
mStartUpAdProvider?.run {
if (shouldEnableSDK(HaloApp.getInstance().channel)) {
initSDK(applicationContext)
}
}
SensorsBridge.init(HaloApp.getInstance(), HaloApp.getInstance().channel)
}
private fun getGitLogString(): String {
@ -376,7 +317,6 @@ class SplashScreenActivity : BaseActivity() {
if (gitLog.isNotEmpty()) {
val md5 = MD5Utils.getContentMD5(gitLog)
if (SPUtils.getString(Constants.GIT_LOG_MD5, "") != md5) {
SPUtils.setString(Constants.GIT_LOG_MD5, md5)
DialogHelper.showDialog(
this,
"${PackageUtils.getGhVersionName()} ${com.gh.gamecenter.common.BuildConfig.BUILD_TIME}",
@ -384,6 +324,7 @@ class SplashScreenActivity : BaseActivity() {
"确定",
"",
{
SPUtils.setString(Constants.GIT_LOG_MD5, md5)
launchMainActivity()
},
extraConfig = DialogHelper.Config(
@ -397,8 +338,7 @@ class SplashScreenActivity : BaseActivity() {
isVerticalScrollBarEnabled = true
movementMethod = ScrollingMovementMethod.getInstance()
}
},
)
})
} else {
launchMainActivity()
}

View File

@ -21,7 +21,7 @@ import androidx.annotation.NonNull;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.gh.common.constant.Config;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.energy.EnergyBridge;
import com.gh.common.util.IntegralLogHelper;
import com.gh.gamecenter.common.callback.BiCallback;
import com.gh.gamecenter.common.constant.RouteConsts;
@ -260,6 +260,7 @@ public class WeiBoShareActivity extends Activity implements WbShareCallback {
com.gh.gamecenter.common.utils.LogUtils.uploadShareResult(ShareUtils.shareType, ShareUtils.shareEntrance.getName(), "success",
ShareUtils.shareEntity.getShareUrl(), ShareUtils.shareEntity.getShareTitle(), ShareUtils.shareEntity.getSummary(), ShareUtils.resourceId);
EventBus.getDefault().post(new EBShare(ShareUtils.shareEntrance));
EnergyBridge.postEnergyTaskForShare(ShareUtils.shareEntrance.getName(), ShareUtils.resourceId, ShareUtils.shareEntity.getShareUrl());
if (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.inviteFriends) {
IntegralLogHelper.INSTANCE.logInviteResult("成功", "微博");
}
@ -274,12 +275,6 @@ public class WeiBoShareActivity extends Activity implements WbShareCallback {
ShareUtils.resourceId,
"新浪微博"
);
SensorsBridge.trackEvent(
"GameCollectDetailShareClickSuccess",
"game_collect_title", ShareUtils.shareEntity.getShareTitle(),
"game_collect_id", ShareUtils.resourceId,
"share_type", "新浪微博"
);
}
} else {
IntegralLogHelper.INSTANCE.logInviteResult("成功", "微博");

View File

@ -1,6 +1,5 @@
package com.gh.gamecenter.adapter;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
@ -24,7 +23,6 @@ import com.gh.common.util.PackageUtils;
import com.gh.gamecenter.core.utils.TimeUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.KcSelectGameViewHolder;
import com.gh.gamecenter.core.utils.ToastUtils;
import com.gh.gamecenter.databinding.KcGameSelectItemBinding;
import com.gh.gamecenter.feature.entity.InstallGameEntity;
import com.gh.gamecenter.common.retrofit.Response;
@ -286,11 +284,7 @@ public class CleanApkAdapter extends BaseRecyclerAdapter<KcSelectGameViewHolder>
singleChoose(position);
} else {
if (mIsScanOver) {
try {
mContext.startActivity(PackageInstaller.getInstallIntent(mContext, gameEntity.getGamePath()));
} catch (ActivityNotFoundException e) {
ToastUtils.toast("找不到 APK 安装器,请稍后再试");
}
mContext.startActivity(PackageInstaller.getInstallIntent(mContext, gameEntity.getGamePath()));
}
}
});

View File

@ -8,31 +8,27 @@ import android.view.ViewGroup;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
import com.gh.gamecenter.common.constant.ItemViewType;
import com.gh.common.util.CheckLoginUtils;
import com.gh.common.util.CommentUtils;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.DirectUtils;
import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.gamecenter.core.utils.MtaHelper;
import com.gh.gamecenter.common.utils.TextHelper;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.CommentViewHolder;
import com.gh.gamecenter.common.constant.ItemViewType;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.gamecenter.common.utils.TextHelper;
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
import com.gh.gamecenter.core.utils.MtaHelper;
import com.gh.gamecenter.entity.ArticleCommentParent;
import com.gh.gamecenter.entity.CommentEntity;
import com.gh.gamecenter.eventbus.EBDeleteComment;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.lightgame.adapter.BaseRecyclerAdapter;
import com.lightgame.utils.Utils;
import org.greenrobot.eventbus.EventBus;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
@ -72,34 +68,22 @@ public class CommentDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
mDataExceptionView = dataExceptionView;
mRecyclerView = recyclerView;
mOnCommentCallBackListener.onCommentCallback(null);
refresh();
loadData();
}
public void refresh() {
loadData(1);
}
public void loadMore() {
loadData(mPage + 1);
}
public void loadData(int page) {
public void loadData() {
if (mIsLoading) return;
mIsLoading = true;
RetrofitManager.getInstance().getApi()
.getCommentTrace(mCommentId, page)
.getCommentTrace(mCommentId, mPage)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<List<CommentEntity>>() {
@Override
public void onResponse(List<CommentEntity> response) {
super.onResponse(response);
if (page == 1) {
mCommentList.clear();
}
mCommentList.addAll(response);
if (response.size() < 20) {
mIsOver = true;
}
@ -107,7 +91,7 @@ public class CommentDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
mDataExceptionView.setVisibility(View.GONE);
mRecyclerView.setVisibility(View.VISIBLE);
notifyItemRangeChanged(0, getItemCount() - 1);
mPage = page;
mPage++;
mIsLoading = false;
}
@ -217,14 +201,8 @@ public class CommentDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
});
holder.commentMore.setOnClickListener(v ->
CommentUtils.showMorePopupWindow(
holder.commentMore,
commentEntity,
false,
"资讯文章-评论",
() -> EventBus.getDefault().post(new EBDeleteComment(commentEntity))
)
);
CommentUtils.showReportDialog(commentEntity,
mContext, false, "资讯文章-评论"));
holder.commentUserIconDv.setOnClickListener(v -> DirectUtils.directToHomeActivity(mContext, commentEntity.getUser().getId(), "", "文章-评论详情"));
holder.commentUserNameTv.setOnClickListener(v -> DirectUtils.directToHomeActivity(mContext, commentEntity.getUser().getId(), "", "文章-评论详情"));
@ -276,24 +254,4 @@ public class CommentDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
public boolean isLoading() {
return mIsLoading;
}
public void notifyCommentRemoved(final CommentEntity entity) {
int positionInComments = getCommentIndexByEntity(mCommentList, entity);
if (positionInComments != -1) {
mCommentList.remove(positionInComments);
notifyItemRemoved(positionInComments);
}
}
private static int getCommentIndexByEntity(
final List<CommentEntity> commentList,
final CommentEntity comment
) {
for (int i = 0; i < commentList.size();i++) {
if (Objects.equals(comment.getId(), commentList.get(i).getId())) {
return i;
}
}
return -1;
}
}

View File

@ -245,7 +245,7 @@ public class LibaoDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
List<UserDataLibaoEntity> userDataLibaoList = mLibaoEntity.getMe().getUserDataLibaoList();
LibaoUtils.initLibaoBtn(mContext, holder.binding.libaodetailCopyBtn, mLibaoEntity,
mLibaoDetailEntity.getInstallRequired(), this, false,
StringUtils.buildString(mEntrance, "+(礼包详情[", mLibaoEntity.getName(), "])"), "礼包详情", null);
StringUtils.buildString(mEntrance, "+(礼包详情[", mLibaoEntity.getName(), "])"), null);
if (mLibaoEntity.getUniversal()) {
holder.binding.libaodetailDes.setVisibility(View.GONE);
} else {
@ -285,7 +285,7 @@ public class LibaoDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
if (mLibaoEntity.getStatus() != null && mLibaoDetailEntity != null) {
LibaoUtils.initLibaoBtn(mContext, holder.binding.libaodetailCopyBtn, mLibaoEntity,
mLibaoDetailEntity.getInstallRequired(), this, false,
StringUtils.buildString(mEntrance, "+(礼包详情[", mLibaoEntity.getName(), "])"), "礼包详情", null);
StringUtils.buildString(mEntrance, "+(礼包详情[", mLibaoEntity.getName(), "])"), null);
}
// 判断按钮状态是否为空(礼包详情进入),重新获取
@ -324,11 +324,7 @@ public class LibaoDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
if (mLibaoDetailEntity.getTime() != null) {
SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm", Locale.CHINA);
String start = format.format((mLibaoDetailEntity.getTime().getStart() * 1000));
long libaoLingEndTime = mLibaoDetailEntity.getTime().getEnd();
String end = libaoLingEndTime == 0
? mContext.getString(R.string.libao_ling_time_infinitely) // 礼包领取结束时间为空则表示礼包长期有效
: format.format((mLibaoDetailEntity.getTime().getEnd() * 1000));
String end = format.format((mLibaoDetailEntity.getTime().getEnd() * 1000));
holder.binding.libaodetailTimeStart.setText(StringUtils.buildString("开始时间:", start));
holder.binding.libaodetailTimeEnd.setText(StringUtils.buildString("截止时间:", end));

View File

@ -42,7 +42,6 @@ import com.gh.gamecenter.databinding.NewsDigestItemBinding;
import com.gh.gamecenter.entity.ArticleCommentParent;
import com.gh.gamecenter.entity.CommentEntity;
import com.gh.gamecenter.entity.ConcernEntity;
import com.gh.gamecenter.eventbus.EBDeleteComment;
import com.gh.gamecenter.manager.VisitManager;
import com.gh.gamecenter.common.retrofit.JSONObjectResponse;
import com.gh.gamecenter.common.retrofit.OkHttpCache;
@ -51,14 +50,12 @@ import com.gh.gamecenter.retrofit.RetrofitManager;
import com.lightgame.adapter.BaseRecyclerAdapter;
import com.lightgame.utils.Utils;
import org.greenrobot.eventbus.EventBus;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.atomic.AtomicBoolean;
@ -154,7 +151,6 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
return;
}
if (isRefresh) {
isOver = false;
mNormalCommentList.clear();
mPage = 1;
}
@ -471,14 +467,8 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
});
holder.commentMore.setOnClickListener(v ->
CommentUtils.showMorePopupWindow(
holder.commentMore,
finalCommentEntity,
true,
"资讯文章详情-评论详情",
() -> EventBus.getDefault().post(new EBDeleteComment(finalCommentEntity))
)
);
CommentUtils.showReportDialog(finalCommentEntity,
mContext, true, "资讯文章详情-评论详情"));
holder.commentUserNameTv.setOnClickListener(v -> DirectUtils.directToHomeActivity(mContext, finalCommentEntity.getUser().getId(), mEntrance, "文章-评论详情"));
holder.commentUserIconDv.setOnClickListener(v -> DirectUtils.directToHomeActivity(mContext, finalCommentEntity.getUser().getId(), mEntrance, "文章-评论详情"));
@ -534,42 +524,6 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
});
}
public void notifyCommentRemoved(final CommentEntity entity) {
if (mHotCommentList.size() > 0) {
int positionInHotComments = getCommentIndexByEntity(mHotCommentList, entity);
if (positionInHotComments != -1) {// 如果在热门评论中存在要被删除的评论,则将此评论移除
mHotCommentList.remove(positionInHotComments);
}
}
if (mNormalCommentList.size() > 0) {
int positionInNormalComments = getCommentIndexByEntity(mNormalCommentList, entity);
if (positionInNormalComments != -1) {// 如果在热门评论中存在要被删除的评论,则将此评论移除
mNormalCommentList.remove(positionInNormalComments);
}
}
if (mConcernEntity != null) {
int commentNum = mConcernEntity.getCommentnum();
mConcernEntity.setCommentnum(commentNum - 1);
}
notifyDataSetChanged();
}
private static int getCommentIndexByEntity(
final List<CommentEntity> commentList,
final CommentEntity comment
) {
for (int i = 0; i < commentList.size();i++) {
if (Objects.equals(comment.getId(), commentList.get(i).getId())) {
return i;
}
}
return -1;
}
private void statNewsViews(final String news_id) {
RetrofitManager.getInstance().getApi().postArticleVisit(news_id)
.subscribeOn(Schedulers.io())
@ -633,7 +587,7 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
}
public void addCommentCount() {
mConcernEntity.setCommentnum(mConcernEntity.getCommentnum() + 1);
mConcernEntity.setCommentnum(mConcernEntity.getCommentnum());
notifyDataSetChanged();
}

View File

@ -12,7 +12,6 @@ import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentActivity;
import com.airbnb.lottie.LottieAnimationView;
import com.gh.gamecenter.common.base.GlobalActivityManager;
import com.gh.common.chain.BrowserInstallHandler;
import com.gh.common.chain.CertificationHandler;
import com.gh.common.chain.ChainBuilder;
@ -29,7 +28,6 @@ import com.gh.common.chain.VersionNumberHandler;
import com.gh.common.constant.Config;
import com.gh.common.dialog.DeviceRemindDialog;
import com.gh.common.dialog.GameOffServiceDialogFragment;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.feature.exposure.ExposureEvent;
import com.gh.common.filter.RegionSetting;
import com.gh.common.filter.RegionSettingHelper;
@ -47,6 +45,7 @@ import com.gh.common.util.DetailDownloadUtils;
import com.gh.gamecenter.common.utils.DialogHelper;
import com.gh.common.util.DialogUtils;
import com.gh.gamecenter.core.utils.PageSwitchDataHelper;
import com.gh.gamecenter.energy.EnergyBridge;
import com.gh.common.util.LogUtils;
import com.gh.gamecenter.core.utils.MtaHelper;
import com.gh.common.util.PackageInstaller;
@ -158,24 +157,6 @@ public class DetailViewHolder {
@Override
public void onClick(View v) {
if (mViewHolder.mDownloadPb.getButtonStyle() != DownloadButton.ButtonStyle.RESERVABLE && mViewHolder.mDownloadPb.getButtonStyle() != DownloadButton.ButtonStyle.RESERVED) {
SensorsBridge.trackEvent(
"DownLoadbuttonClick",
"game_id", mGameEntity.getId(),
"game_name", mGameEntity.getName(),
"game_type", mGameEntity.getCategoryChinese(),
"download_status", mGameEntity.getDownloadStatusChinese(),
"button_name", mViewHolder.mDownloadPb.getText(),
"game_schema_type", mGameEntity.getGameBitChinese(),
"page_name", GlobalActivityManager.getCurrentPageEntity().getPageName(),
"page_id", GlobalActivityManager.getCurrentPageEntity().getPageId(),
"page_business_id", GlobalActivityManager.getCurrentPageEntity().getPageBusinessId(),
"last_page_name", GlobalActivityManager.getLastPageEntity().getPageName(),
"last_page_id", GlobalActivityManager.getLastPageEntity().getPageId(),
"last_page_business_id", GlobalActivityManager.getLastPageEntity().getPageBusinessId()
);
}
// 这个 switch 纯粹是为了 MTA和上报光能任务 统计用的
switch (mViewHolder.mDownloadPb.getButtonStyle()) {
case DOWNLOADING_PLUGIN:
@ -204,6 +185,7 @@ public class DetailViewHolder {
break;
case LAUNCH_OR_OPEN:
if (!mGameEntity.getApk().isEmpty()) {
EnergyBridge.postEnergyTask("play_game", mGameEntity.getId(), mGameEntity.getApk().get(0).getPackageName());
}
break;
}
@ -286,9 +268,9 @@ public class DetailViewHolder {
ChainBuilder builder = new ChainBuilder();
builder.addHandler(new UpdateNewSimulatorHandler());
builder.addHandler(new ValidateVSpaceHandler());
builder.addHandler(new GamePermissionHandler());
builder.addHandler(new CheckStoragePermissionHandler());
builder.addHandler(new ValidateVSpaceHandler());
if (mGameEntity.getApk().size() == 1) {
builder.addHandler(new BrowserInstallHandler());
@ -347,7 +329,7 @@ public class DetailViewHolder {
}
if (mGameEntity.isVGame()) {
VHelper.installOrLaunch(mViewHolder.context, mGameEntity);
VHelper.installOrLaunch(mViewHolder.context, mGameEntity.getApk().get(0).getPackageName());
return;
}
@ -389,7 +371,7 @@ public class DetailViewHolder {
}
if (mGameEntity.isVGame()) {
VHelper.installOrLaunch(v.getContext(), mGameEntity);
VHelper.installOrLaunch(v.getContext(), mGameEntity.getApk().get(0).getPackageName());
return;
}
@ -411,9 +393,8 @@ public class DetailViewHolder {
break;
case RESERVABLE:
GamePermissionDialogFragment.show((AppCompatActivity) mViewHolder.context, mGameEntity, mGameEntity.getInfo(), () -> {
SensorsBridge.trackEvent("AppointmentGame", "game_name", mGameEntity.getName(), "game_id", mGameEntity.getId());
CheckLoginUtils.checkLogin(mViewHolder.context, mEntrance, () -> {
ReservationHelper.reserve(mViewHolder.context, mGameEntity.getId(), mGameEntity.getName(), () -> {
ReservationHelper.reserve(mViewHolder.context, mGameEntity.getId(), () -> {
LogUtils.logReservation(mGameEntity, mTraceEvent);
DetailDownloadUtils.detailInitDownload(mViewHolder, false);
});
@ -545,13 +526,9 @@ public class DetailViewHolder {
DownloadButton.ButtonStyle.DOWNLOADING_PLUGIN : DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
DeviceRemindDialog.Companion.showDeviceRemindDialog(mViewHolder.context, mGameEntity);
//去掉游戏详情页启动畅玩游戏弹出加载框的行为 https://jira.shanqu.cc/browse/GHZS-2087
/*if (mGameEntity.isVGame()
&& mViewHolder.context.getString(R.string.download).equals(method)
&& VHelper.INSTANCE.shouldLaunchGameAfterInstallation()
&& !(VHelper.INSTANCE.isGAppsRequired(mGameEntity) && !VHelper.INSTANCE.isGAppsInstalled())) {
if (mGameEntity.isVGame() && mViewHolder.context.getString(R.string.download).equals(method) && VHelper.INSTANCE.shouldLaunchGameAfterInstallation()) {
mViewHolder.context.startActivity(VSpaceLoadingActivity.getIntent(mViewHolder.context, mGameEntity, false));
}*/
}
} else {
Utils.toast(mViewHolder.context, msg);
}

View File

@ -256,6 +256,11 @@ class AmwayFragment : LazyListFragment<AmwayListItemData, AmwayViewModel>() {
MtaHelper.onEventWithTime("安利墙", mElapsedHelper.elapsedTime, "浏览")
}
override fun onResume() {
if (isEverPause) mAdapter?.notifyDataSetChanged()
super.onResume()
}
override fun onFragmentResume() {
super.onFragmentResume()
DownloadManager.getInstance().addObserver(dataWatcher)

View File

@ -16,6 +16,7 @@ import com.gh.gamecenter.home.LegacyHomeItemData
import com.gh.gamecenter.home.LegacyHomeSubjectTransformer
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.energy.EnergyBridge
import com.gh.gamecenter.retrofit.RetrofitManager
import com.lightgame.utils.Utils
import io.reactivex.Observable
@ -211,6 +212,8 @@ class AmwayViewModel(application: Application) : ListViewModel<AmwayCommentEntit
Utils.toast(getApplication(), "点赞成功")
updateAmwayCommentLikeCount(commentId, increaseCount = true, isLiked = true)
EnergyBridge.postEnergyTask("vote_game_comment", commentId)
}
override fun onFailure(e: HttpException?) {

View File

@ -1,239 +0,0 @@
package com.gh.gamecenter.authorization
import android.content.Intent
import android.os.Build
import android.os.Bundle
import com.gh.common.util.CheckLoginUtils
import com.gh.common.util.DialogUtils
import com.gh.common.util.NewFlatLogUtils
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.utils.ImageUtils
import com.gh.gamecenter.common.utils.updateStatusBarColor
import com.gh.gamecenter.common.utils.viewModelProvider
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.databinding.ActivityAuthorizationBinding
import com.gh.gamecenter.login.user.UserManager
import com.gh.vspace.VHelper
/**
* @author : liujiarui
* date : 2023/4/3
* description : 通用授权登陆界面
* 1. 通过scheme跳转到该界面传递参数包括被授权app包名跳转回的游戏包名(若没有则跳回被授权app)
* 2. 检查参数校验申请授权app 包名/签名信息/密钥 等是否合法,后续实现
* 3. 检查是否已经登陆,如果已经登陆,直接初始化用户信息
* 4. 如果未登陆,点击登陆按钮,跳转到登陆界面
* 5. 登陆成功后,初始化用户信息
* 6. 点击确认授权跳转回被授权app
* 7. 被授权app接收到授权成功的广播进行相应的处理
* 隐式意图示例ghzhushou_authorization://authorize?packageName=com.lg.vspace&game_pkg=xxx.xxx.xxx
* 注意被授权的app需要创建一个(包名.AuthorizationReceiver)的广播接收者,用于接收授权成功的广播
* 目前授权返回信息有:
* 用户token[EntranceConsts.KEY_TOKEN]
* 用户昵称[EntranceConsts.KEY_USER_NAME]
* 用户头像[EntranceConsts.KEY_USER_AVATAR]
*/
class AuthorizationActivity : ToolBarActivity() {
private val mViewModel: AuthorizationViewModel by lazy {
viewModelProvider()
}
private lateinit var mBinding: ActivityAuthorizationBinding
//被授权app包名用于获取icon和发送显示广播
private var mRemotePkgName: String? = null
//跳转回的游戏app,如果为空跳转到被授权app
private var mGamePkg: String? = null
//授权内容
private var mContent: String = ""
/**
* 畅玩助手当前运行的游戏ID
*/
private var gameId: String = ""
/**
* 畅玩助手当前运行的游戏名称
*/
private var gameName: String = ""
//授权token
private var mToken = ""
override fun getLayoutId(): Int {
return R.layout.activity_authorization
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
DisplayUtils.transparentStatusBar(this)
setNavigationTitle("光环助手授权登陆")
updateStatusBarColor(R.color.background_white, R.color.background_white)
mBinding = ActivityAuthorizationBinding.bind(mContentView)
checkParam()
initView()
mBinding.authorizeBtn.postDelayed({
checkLogin {
initUserInfo()
}
}, 500)
NewFlatLogUtils.logLoginFromGHZSShow(
gameId = gameId,
gameName = gameName
)
}
private fun initData() {
if (mToken.isNotEmpty()) return
val loadingDialog = DialogUtils.showWaitDialog(this, "请稍后...")
mViewModel.getAccessToken(listOf(mContent), {
mToken = it
loadingDialog.dismiss()
}, {
toast("获取token失败")
loadingDialog.dismiss()
})
}
override fun onDarkModeChanged() {
super.onDarkModeChanged()
updateStatusBarColor(R.color.background_white, R.color.background_white)
}
override fun onRestart() {
super.onRestart()
if (!CheckLoginUtils.isLogin()) {
finish()
} else {
initUserInfo()
initData()
}
}
//检查参数,理论上来说需要 校验申请授权app 包名/签名信息/密钥 等是否合法,后续实现
private fun checkParam() {
val uri = intent.data
if (uri == null) {
finish()
return
}
val host = uri.host
if (host != "authorize") {
finish()
return
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
mRemotePkgName = referrer?.host
}
mRemotePkgName = mRemotePkgName ?: uri.getQueryParameter(EntranceConsts.KEY_PACKAGENAME)
mGamePkg = uri.getQueryParameter(EntranceConsts.KEY_GAME_PKG)
mContent = uri.getQueryParameter(EntranceConsts.KEY_CONTENT) ?: ""
gameId = uri.getQueryParameter(EntranceConsts.KEY_GAME_ID) ?: ""
gameName = uri.getQueryParameter(EntranceConsts.KEY_GAME_NAME) ?: ""
if (mRemotePkgName == null) {
finish()
return
}
}
private fun initView() {
//通过包名获取app图标和名称
val pkgName = mRemotePkgName ?: return
val icon = packageManager.getApplicationIcon(pkgName)
val name = packageManager.getApplicationLabel(packageManager.getApplicationInfo(pkgName, 0))
mBinding.authorizeAppIcon.setImageDrawable(icon)
mBinding.authorizeAppName.text = name
mBinding.authorizeBtn.setOnClickListener {
NewFlatLogUtils.logLoginFromGHZSClick(
gameId = gameId,
gameName = gameName,
buttonType = BUTTON_TYPE_CONFIRM
)
checkLogin {
authorization()
}
}
}
private fun checkLogin(block: () -> Unit) {
//判断光环是否登陆
CheckLoginUtils.checkLogin(this, "光环助手授权登陆") {
initData()
block()
}
}
private fun initUserInfo() {
if (!CheckLoginUtils.isLogin()) return
mBinding.nicknameTv.text = UserManager.getInstance().userInfoEntity?.name
val icon = UserManager.getInstance().userInfoEntity?.icon
if (icon != null) {
ImageUtils.display(mBinding.avatarView, icon)
}
}
private fun authorization() {
val remotePkgName = mRemotePkgName
if (remotePkgName == null) {
finish()
return
}
if (mToken.isEmpty()) {
toast("授权失败")
return
}
val token = mToken
val userId = UserManager.getInstance().userInfoEntity?.userId
val username = UserManager.getInstance().userInfoEntity?.name
val userAvatar = UserManager.getInstance().userInfoEntity?.icon
//授权成功,发送广播, 返回token
val intent = Intent()
intent.setClassName(remotePkgName, "$remotePkgName.AuthorizationReceiver")
intent.setPackage(remotePkgName)
intent.putExtra(EntranceConsts.KEY_TOKEN, token)
intent.putExtra(EntranceConsts.KEY_USER_ID, userId)
intent.putExtra(EntranceConsts.KEY_USER_NAME, username)
intent.putExtra(EntranceConsts.KEY_USER_AVATAR, userAvatar)
sendBroadcast(intent)
backToLaunchApp()
finish()
}
/**
* 跳转回授权app
*/
private fun backToLaunchApp(showLoading: Boolean = true) {
val gamePkg = mGamePkg
if (gamePkg != null) { // 跳转回游戏
VHelper.launch(this, gamePkg, ignoreGApps = true, showLoading = showLoading)
return
}
val remotePkgName = this.mRemotePkgName
if (remotePkgName != null) {// 跳转回其他授权app
startActivity(packageManager.getLaunchIntentForPackage(remotePkgName))
}
}
override fun onBackPressed() {
super.onBackPressed()
backToLaunchApp(false)
NewFlatLogUtils.logLoginFromGHZSClick(
gameId = gameId,
gameName = gameName,
buttonType = BUTTON_TYPE_BACK
)
}
companion object {
private const val BUTTON_TYPE_CONFIRM = "确定"
private const val BUTTON_TYPE_BACK = "返回"
}
}

View File

@ -1,43 +0,0 @@
package com.gh.gamecenter.authorization
import android.annotation.SuppressLint
import android.app.Application
import androidx.lifecycle.AndroidViewModel
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.toJson
import com.gh.gamecenter.common.utils.toRequestBody
import com.gh.gamecenter.login.retrofit.RetrofitManager
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import org.json.JSONArray
import org.json.JSONObject
/**
* @author : liujiarui
* date : 2023/4/13
* description :
*/
class AuthorizationViewModel(application: Application) : AndroidViewModel(application) {
private val mApi = RetrofitManager.getInstance().newApi
@SuppressLint("CheckResult")
fun getAccessToken(contentList: List<String>, onSuccess: (String) -> Unit, onFail: () -> Unit) {
val jsonObject = JSONObject()
val jsonArray = JSONArray()
contentList.forEach {
jsonArray.put(it)
}
jsonObject.put(EntranceConsts.KEY_CONTENT, jsonArray)
val requestBody = jsonObject.toRequestBody()
mApi.grant(requestBody)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
{
onSuccess(it.toJson())
}, {
onFail()
}
)
}
}

View File

@ -154,6 +154,7 @@ class NewCatalogListFragment : ListFragment<GameEntity, NewCatalogListViewModel>
}
override fun onResume() {
if (isEverPause && mAdapter != null) mAdapter?.notifyDataSetChanged()
super.onResume()
DownloadManager.getInstance().addObserver(mDataWatcher)
}

View File

@ -43,14 +43,14 @@ class SpecialCatalogSubjectCollectionAdapter(
}
val entity = mList[position]
ImageUtils.display(subjectCollectionImage, entity.image)
subjectCollectionImage.registerLoadingCallback(object : WrapContentDraweeView.LoadingCallback {
subjectCollectionImage.loadingCallback = object : WrapContentDraweeView.LoadingCallback {
override fun loaded() {
subjectCollectionImage.layoutParams = subjectCollectionImage.layoutParams.apply {
height = 96F.dip2px()
width = (subjectCollectionImage.aspectRatio * 96F.dip2px()).toInt()
}
}
})
}
root.setOnClickListener {
DirectUtils.directToLinkPage(
mContext,

View File

@ -103,6 +103,7 @@ class NewCategoryListFragment : ListFragment<GameEntity, NewCategoryListViewMode
}
override fun onResume() {
if (isEverPause && mAdapter != null) mAdapter?.notifyDataSetChanged()
super.onResume()
DownloadManager.getInstance().addObserver(mDataWatcher)
}

View File

@ -179,7 +179,6 @@ class CategoryV2Fragment : LazyFragment() {
}
private fun showGuide() {
if (!isAdded) return
mBinding?.run {
val isShow = SPUtils.getBoolean(Constants.SP_SHOW_CATEGORY_GUIDE)
if (isShow) return
@ -207,7 +206,6 @@ class CategoryV2Fragment : LazyFragment() {
requireContext(),
false,
"",
"新分类2.0",
"新分类2.0"
)
startActivity(intent)

View File

@ -27,8 +27,6 @@ import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.feature.game.GameItemViewHolder
import com.lightgame.download.DownloadEntity
import org.json.JSONException
import org.json.JSONObject
class CategoryV2ListAdapter(
context: Context,
@ -170,21 +168,7 @@ class CategoryV2ListAdapter(
),
StringUtils.buildString(selectedSubCatalogName, ":", gameEntity.name),
event
) {
val trackEvent = JSONObject()
try {
trackEvent.put("navigation_bar_name", mCategoryViewModel.selectedCategoryName)
trackEvent.put("game_tag", mCategoryViewModel.selectedCategoryList.map { it.name })
trackEvent.put("game_status", gameEntity.category)
trackEvent.put(
"inclusion_size",
if (gameEntity.getApk().size == 1) gameEntity.getApk()[0].size ?: "" else ""
)
} catch (e: JSONException) {
e.printStackTrace()
}
SensorsBridge.trackEvent("ClassificationFilterCriteriaSelected", trackEvent)
}
)
DownloadItemUtils.updateItem(
mContext,

View File

@ -283,6 +283,7 @@ class CategoryV2ListFragment : ListFragment<GameEntity, CategoryV2ListViewModel>
}
override fun onResume() {
if (isEverPause && mAdapter != null) mAdapter?.notifyDataSetChanged()
super.onResume()
DownloadManager.getInstance().addObserver(mDataWatcher)
}

View File

@ -71,10 +71,6 @@ class CloudArchiveManagerActivity : BaseActivity_TabLayout() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// 重连服务
VHelper.reconnectServiceIfNeeded()
mGameEntity = intent.getParcelableExtra<GameEntity?>(EntranceConsts.KEY_GAME)?.apply {
setEntryMap(DownloadManager.getInstance().getEntryMap(name))
}
@ -84,12 +80,6 @@ class CloudArchiveManagerActivity : BaseActivity_TabLayout() {
setToolbarMenu(R.menu.menu_cloud_archive_manager)
updateStatusBarColor(R.color.background_white, R.color.background_white)
NewFlatLogUtils.logCloudArchiveManagePageShow(mGameEntity?.id ?: "", mGameEntity?.name ?: "", mEntrance)
SensorsBridge.trackEvent(
"CloudSaveManagePageShow",
"game_id", mGameEntity?.id ?: "",
"game_name", mGameEntity?.name ?: "",
"source_entrance", mEntrance
)
mBinding.run {
mGameEntity?.let {
@ -104,12 +94,7 @@ class CloudArchiveManagerActivity : BaseActivity_TabLayout() {
mGameEntity?.getUniquePackageName() ?: "", mViewModel.archiveConfigStr
) -> toast("暂未检测到本地的存档数据,请玩会儿游戏再试~")
else -> {
NewFlatLogUtils.logCloudArchiveUploadDialogShow(mGameEntity?.id ?: "", mGameEntity?.name ?: "")
SensorsBridge.trackEvent(
"CloudSaveUploadDialogShow",
"game_id", mGameEntity?.id ?: "",
"game_name", mGameEntity?.name ?: ""
)
NewFlatLogUtils.logCloudArchiveUploadDialogShow()
showUploadDialog()
}
}
@ -124,11 +109,6 @@ class CloudArchiveManagerActivity : BaseActivity_TabLayout() {
toast("上传失败")
}
}
mViewModel.gameEntityLiveData.observeNonNull(this) {
mGameEntity = it
initDownloadBtn()
}
}
override fun onMenuItemClick(item: MenuItem?): Boolean {
@ -165,15 +145,6 @@ class CloudArchiveManagerActivity : BaseActivity_TabLayout() {
mGameEntity?.name ?: "",
if (position == MY_ARCHIVE_INDEX) "我的存档" else if (position == MY_DOWNLOAD_ARCHIVE_INDEX) "我的下载" else "我的分享"
)
SensorsBridge.trackEvent(
"CloudSaveManagePageTabSelected",
"game_id",
mGameEntity?.id ?: "",
"game_name",
mGameEntity?.name ?: "",
"tab_name",
if (position == MY_ARCHIVE_INDEX) "我的存档" else if (position == MY_DOWNLOAD_ARCHIVE_INDEX) "我的下载" else "我的分享"
)
controlUploadGameArchive()
}
@ -219,13 +190,7 @@ class CloudArchiveManagerActivity : BaseActivity_TabLayout() {
confirmTv.alpha = if (text?.length != 0) 1F else 0.4F
}
confirmTv.setOnClickListener {
NewFlatLogUtils.logCloudArchiveUploadDialogClick("确定", mGameEntity?.id ?: "", mGameEntity?.name ?: "")
SensorsBridge.trackEvent(
"CloudSaveUploadDialogClick",
"game_id", mGameEntity?.id ?: "",
"game_name", mGameEntity?.name ?: "",
"button_name", "确定"
)
NewFlatLogUtils.logCloudArchiveUploadDialogClick("确定")
if (contentEt.text.trim().length in 3..30) {
saveAndUploadArchive(contentEt.text.toString().trim())
dialog.dismiss()
@ -234,13 +199,7 @@ class CloudArchiveManagerActivity : BaseActivity_TabLayout() {
}
}
cancelTv.setOnClickListener {
NewFlatLogUtils.logCloudArchiveUploadDialogClick("取消", mGameEntity?.id ?: "", mGameEntity?.name ?: "")
SensorsBridge.trackEvent(
"CloudSaveUploadDialogClick",
"game_id", mGameEntity?.id ?: "",
"game_name", mGameEntity?.name ?: "",
"button_name", "取消"
)
NewFlatLogUtils.logCloudArchiveUploadDialogClick("取消")
dialog.dismiss()
}
}
@ -338,7 +297,7 @@ class CloudArchiveManagerActivity : BaseActivity_TabLayout() {
btnText = getString(R.string.launch)
setOnClickListener {
CurrentActivityHolder.getCurrentActivity()?.let {
VHelper.installOrLaunch(it, downloadEntity)
VHelper.installOrLaunch(it, downloadEntity.packageName)
}
}
}

View File

@ -11,8 +11,6 @@ import com.gh.gamecenter.common.baselist.LoadType
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.utils.toRequestBody
import com.gh.gamecenter.entity.ArchiveEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.utils.ApkActiveUtils
import com.gh.gamecenter.retrofit.RetrofitManager
import com.gh.vspace.VArchiveHelper
import com.halo.assistant.HaloApp
@ -32,21 +30,13 @@ class CloudArchiveManagerViewModel(
) :
ListViewModel<ArchiveEntity, ArchiveEntity>(application) {
companion object {
private const val SORT_TYPE_CREATE = "time.create:-1"
private const val SORT_TYPE_SHARE_AND_CREATE = "time.share:-1,time.create:-1"
}
var archiveConfigStr = ""
private val mNewApi = RetrofitManager.getInstance().newApi
private val mApi = RetrofitManager.getInstance().api
private val mApi = RetrofitManager.getInstance().newApi
val uploadSuccess = MutableLiveData<Boolean>()
val shareSuccess = MutableLiveData<Boolean>()
val gameEntityLiveData = MutableLiveData<GameEntity>()
init {
getGameDigest()
if (configUrl.isNotEmpty()) getArchiveConfigString(configUrl)
}
@ -59,10 +49,10 @@ class CloudArchiveManagerViewModel(
override fun provideDataObservable(page: Int): Observable<List<ArchiveEntity>>? = when (mType) {
MyArchiveFragment.Type.MY_ARCHIVE -> {
mNewApi.getMyArchives(gameId, page, SORT_TYPE_CREATE)
mApi.getMyArchives(gameId, page)
}
MyArchiveFragment.Type.MY_DOWNLOAD_ARCHIVE -> null
MyArchiveFragment.Type.MY_SHARE_ARCHIVE -> mNewApi.getMyShareArchives(gameId, page, SORT_TYPE_SHARE_AND_CREATE)
MyArchiveFragment.Type.MY_SHARE_ARCHIVE -> mApi.getMyShareArchives(gameId, page)
}
override fun provideDataSingle(page: Int): Single<MutableList<ArchiveEntity>>? {
@ -82,7 +72,7 @@ class CloudArchiveManagerViewModel(
url = vArchiveEntity.url,
configUrl = vArchiveEntity.configUrl,
md5 = vArchiveEntity.md5,
time = ArchiveEntity.Time(create = vArchiveEntity.time),
time = ArchiveEntity.Time(update = vArchiveEntity.time),
gameVersion = vArchiveEntity.gameVersion
)
)
@ -96,20 +86,6 @@ class CloudArchiveManagerViewModel(
}
}
private fun getGameDigest() {
mApi.getGameDigest(gameId)
.map(ApkActiveUtils.filterMapper)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : com.gh.gamecenter.common.retrofit.Response<GameEntity>() {
override fun onResponse(response: GameEntity?) {
response?.let {
gameEntityLiveData.postValue(it)
}
}
})
}
@SuppressLint("CheckResult")
fun postArchive(archiveEntity: ArchiveEntity) {
val paramsMap = mapOf(
@ -119,7 +95,7 @@ class CloudArchiveManagerViewModel(
"game_version" to archiveEntity.gameVersion,
"md5" to archiveEntity.md5
)
mNewApi.postMyArchive(gameId, paramsMap.toRequestBody())
mApi.postMyArchive(gameId, paramsMap.toRequestBody())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : BiResponse<ResponseBody>() {
@ -141,7 +117,7 @@ class CloudArchiveManagerViewModel(
"share_desc" to shareDesc,
"is_shared" to true
)
mNewApi.patchMyArchive(gameId, archiveEntity.id, paramsMap.toRequestBody())
mApi.patchMyArchive(gameId, archiveEntity.id, paramsMap.toRequestBody())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : BiResponse<ResponseBody>() {
@ -165,7 +141,7 @@ class CloudArchiveManagerViewModel(
val paramsMap = mapOf(
"is_shared" to false
)
mNewApi.patchMyArchive(gameId, archiveEntity.id, paramsMap.toRequestBody())
mApi.patchMyArchive(gameId, archiveEntity.id, paramsMap.toRequestBody())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : BiResponse<ResponseBody>() {
@ -186,7 +162,7 @@ class CloudArchiveManagerViewModel(
val paramsMap = mapOf(
"name" to archiveEntity.name
)
mNewApi.patchMyArchive(gameId, archiveEntity.id, paramsMap.toRequestBody())
mApi.patchMyArchive(gameId, archiveEntity.id, paramsMap.toRequestBody())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : BiResponse<ResponseBody>() {
@ -198,7 +174,7 @@ class CloudArchiveManagerViewModel(
@SuppressLint("CheckResult")
fun deleteArchive(archiveEntity: ArchiveEntity) {
mNewApi.deleteMyArchive(gameId, archiveEntity.id)
mApi.deleteMyArchive(gameId, archiveEntity.id)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : BiResponse<ResponseBody>() {

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