Compare commits

..

228 Commits

Author SHA1 Message Date
3a15f9af33 Merge branch 'feature-GHZS-3018' into 'dev'
fix: MIUI优化关闭提示弹窗—0720测试 https://jira.shanqu.cc/browse/GHZS-3001

See merge request halo/android/assistant-android!1217
2023-07-24 11:55:52 +08:00
6920d682b2 fix: MIUI优化关闭提示弹窗—0720测试 https://jira.shanqu.cc/browse/GHZS-3001 2023-07-24 11:55:52 +08:00
b0493502e4 Merge branch 'feature-dev-cherry-pick-GHZS-2901' into 'dev'
feat: MIUI优化关闭提示弹窗—客户端 https://jira.shanqu.cc/browse/GHZS-2901

See merge request halo/android/assistant-android!1216
2023-07-24 11:39:55 +08:00
723202d4ce feat: MIUI优化关闭提示弹窗—客户端 https://jira.shanqu.cc/browse/GHZS-2901 2023-07-24 11:36:49 +08:00
6e0628b478 Merge remote-tracking branch 'origin/release' into dev 2023-07-24 10:42:53 +08:00
7f14555886 Merge branch 'hotfix/v5.28.2-912/crashes' into 'release'
修复 5.28.2 的部分线上闪退

See merge request halo/android/assistant-android!1215
2023-07-24 10:41:52 +08:00
c2477d2a3f fix: 捕抓畅玩游戏创建快捷方式时的闪退 https://sentry.shanqu.cc/organizations/lightgame/issues/300166/?project=22&query=dist%3A912+level%3Afatal&statsPeriod=14d 2023-07-24 10:24:51 +08:00
8ff4945cfa fix: 修复曝光上报时的空指针问题 https://sentry.shanqu.cc/organizations/lightgame/issues/301370/events/4fed437358844787bb532a12283205b6/?project=22 2023-07-24 10:15:21 +08:00
fcc65fdbfe fix: 修复上层下载持有错误下载状态时,暂停任务导致的空指针闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/304224/?project=22 2023-07-24 10:05:52 +08:00
d4b0ecce98 fix: 修复下载其它内容时偶发的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/314990/?project=22 2023-07-24 09:44:52 +08:00
848ca0b5c6 Merge branch 'fix/pkg_issue' into 'dev'
fix: 修复特殊打包选择首页 tab 异常的问题

See merge request halo/android/assistant-android!1213
2023-07-21 17:58:40 +08:00
4f0c81420e fix: 修复特殊打包选择首页 tab 异常的问题 2023-07-21 17:38:32 +08:00
0c437d32bd Merge branch 'feat/GHZS-2910' into 'dev'
feat: 关于我们页面新增安装包隐藏信息提示 https://jira.shanqu.cc/browse/GHZS-2910

See merge request halo/android/assistant-android!1212
2023-07-21 14:31:53 +08:00
25d9771a3c feat: 关于我们页面新增安装包隐藏信息提示 https://jira.shanqu.cc/browse/GHZS-2910 2023-07-21 14:01:44 +08:00
668b54ac6d Merge branch 'feature-GHZS-2987' into 'dev'
fix: 【光环助手】同步正式环境问题-插件化安装弹窗 https://jira.shanqu.cc/browse/GHZS-2987

See merge request halo/android/assistant-android!1211
2023-07-21 11:40:53 +08:00
92b0f8fe73 fix: 【光环助手】同步正式环境问题-插件化安装弹窗 https://jira.shanqu.cc/browse/GHZS-2987 2023-07-21 11:39:07 +08:00
f689dfce07 Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	dependencies.gradle
2023-07-19 19:22:43 +08:00
42d5d46e53 chore: 版本更新至 5.28.2 2023-07-18 16:13:09 +08:00
cdccc35703 Merge branch 'feature-GHZS-2946' into 'release'
fix: 修复线上闪退问题 https://jira.shanqu.cc/browse/GHZS-2946

See merge request halo/android/assistant-android!1207
2023-07-18 16:08:44 +08:00
d3e2fea019 fix: 修复线上闪退问题 https://jira.shanqu.cc/browse/GHZS-2946 2023-07-18 16:08:44 +08:00
f343841233 Merge branch 'fix/GHZS-2948' into 'release'
fix: 修复线上闪退问题 https://jira.shanqu.cc/browse/GHZS-2948

See merge request halo/android/assistant-android!1206
2023-07-18 14:58:47 +08:00
f62083eff2 fix: 修复线上闪退问题 https://jira.shanqu.cc/browse/GHZS-2948 2023-07-18 14:58:47 +08:00
8594e998c2 Merge branch 'fix/vspace_dialog_dismiss_issue' into 'release'
fix: 修复畅玩弹窗在组件安装完成以后的 dismiss 问题

See merge request halo/android/assistant-android!1205
2023-07-17 17:54:15 +08:00
6865706b0f fix: 修复畅玩弹窗在组件安装完成以后的 dismiss 问题 2023-07-17 17:50:23 +08:00
bfb8b46ce8 Merge branch 'fix/GHZS-2941' into 'dev'
fix:【光环助手】畅玩助手神策数据流程优化 https://jira.shanqu.cc/browse/GHZS-2941

See merge request halo/android/assistant-android!1204
2023-07-17 17:34:40 +08:00
b6d8ca4d84 Merge branch 'feat/GHZS-2959' into 'release'
feat: 神策渠道调整 https://jira.shanqu.cc/browse/GHZS-2959

See merge request halo/android/assistant-android!1203
2023-07-17 16:14:05 +08:00
455e1f0432 feat: 神策渠道调整 https://jira.shanqu.cc/browse/GHZS-2959 2023-07-17 16:12:29 +08:00
ba27c09096 fix:【光环助手】畅玩助手神策数据流程优化 https://jira.shanqu.cc/browse/GHZS-2941 2023-07-17 15:03:16 +08:00
15276cc4b3 Merge branch 'hotfix/v5.28.1-911/crashes' into 'release'
修复部分线上闪退

See merge request halo/android/assistant-android!1202
2023-07-17 11:53:17 +08:00
130a7cdf2a fix: 修复因为混淆造成的下载数据恢复闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/281841/?project=22 2023-07-17 11:08:11 +08:00
164ec0c368 fix: 捕抓首页 tab 的 roundToInt 闪退异常 2023-07-17 11:07:11 +08:00
756bc66f26 Merge branch 'fix/GHZS-2945' into 'dev'
fix:【光环助手】内容导航栏图标闪烁 https://jira.shanqu.cc/browse/GHZS-2945

See merge request halo/android/assistant-android!1200
2023-07-17 09:45:10 +08:00
e589bce5c6 fix:【光环助手】内容导航栏图标闪烁 https://jira.shanqu.cc/browse/GHZS-2945 2023-07-17 09:36:28 +08:00
991bd22511 Merge branch 'fix/sensors_log' into 'release'
fix: 修复畅玩助手下载弹窗错误上报安装点击事件的问题

See merge request halo/android/assistant-android!1199
2023-07-14 17:05:55 +08:00
df1ab5221d fix: 修复畅玩助手下载弹窗错误上报安装点击事件的问题 2023-07-14 16:41:51 +08:00
70916fd0f7 Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	app/src/main/java/com/gh/gamecenter/home/gamecollection/carousel/HomeGameCollectionCarouselAdapter.kt
#	dependencies.gradle
2023-07-14 09:58:36 +08:00
226d6c4f2c chore: 版本更新至 5.28.1 2023-07-13 17:25:06 +08:00
896adc9d36 Merge branch 'feature-data-watcher-patch' into 'release'
fix: Sentry312134...

See merge request halo/android/assistant-android!1198
2023-07-13 15:35:48 +08:00
0e33abebdd fix: Sentry312134... 2023-07-13 15:35:48 +08:00
c8ed126605 Merge branch 'fix/GHZS-2926' into 'release'
fix:【光环助手】游戏单封面图显示问题 https://jira.shanqu.cc/browse/GHZS-2926

See merge request halo/android/assistant-android!1196
2023-07-12 14:48:17 +08:00
b510a329b6 fix:【光环助手】游戏单封面图显示问题 https://jira.shanqu.cc/browse/GHZS-2926 2023-07-12 14:36:38 +08:00
2de1ba4e1d Merge branch 'fix/GHZS-2907' into 'release'
fix: 神策埋点—07/10测试 (3) https://jira.shanqu.cc/browse/GHZS-2907

See merge request halo/android/assistant-android!1195
2023-07-11 15:37:47 +08:00
e4a0f0e68b fix: 神策埋点—07/10测试 (3) https://jira.shanqu.cc/browse/GHZS-2907 2023-07-11 15:31:44 +08:00
c064f9d3a6 Merge branch 'feat/core_event_with_toast' into 'release'
fix: 特殊包上报比例为 1 时关键行为进行 toast 提示(方便测试)

See merge request halo/android/assistant-android!1190
2023-07-11 13:52:00 +08:00
759401d9ae Merge branch 'fix/CWZS-91' into 'release'
fix: 推送更新测试问题—测试问题07/06 https://jira.shanqu.cc/browse/CWZS-91

See merge request halo/android/assistant-android!1191
2023-07-11 13:51:53 +08:00
e56209d15e fix: 处理弹窗 dismiss 问题 2023-07-11 13:38:59 +08:00
c466ff1f21 fix: 处理弹窗 dismiss 问题 2023-07-11 11:51:41 +08:00
e09cf299f0 Merge branch 'feature-GHZS-2771-patch-3' into 'release'
fix: 支持xapk格式的apks文件解压-0706测试

See merge request halo/android/assistant-android!1193
2023-07-11 10:40:24 +08:00
25352ba609 fix: 支持xapk格式的apks文件解压-0706测试 2023-07-11 10:40:24 +08:00
3cd065cb6e fix: 处理弹窗 dismiss 问题 2023-07-10 16:21:01 +08:00
5a483bb5db Merge branch 'fix/GHZS-2887' into 'dev'
fix: 游戏单功能优化-游戏单合集-前端部分—0709测试-客户端 https://jira.shanqu.cc/browse/GHZS-2887

See merge request halo/android/assistant-android!1192
2023-07-10 15:55:07 +08:00
3b380c6fe3 fix: 游戏单功能优化-游戏单合集-前端部分—0709测试-客户端 https://jira.shanqu.cc/browse/GHZS-2887 2023-07-10 14:25:14 +08:00
919a98ffe6 fix: 处理弹窗 dismiss 问题 2023-07-10 11:26:22 +08:00
eff84218a8 fix: 特殊包上报比例为 1 时关键行为进行 toast 提示(方便测试) 2023-07-07 11:32:44 +08:00
7c9c363422 fix: 推送更新测试问题—测试问题07/06 https://jira.shanqu.cc/browse/CWZS-91 2023-07-07 10:04:41 +08:00
add6448f44 Merge branch 'fix/GHZS-2848' into 'dev'
fix: 游戏单功能优化-游戏单合集-前端部分—0704测试-客户端(0706测试1、3) https://jira.shanqu.cc/browse/GHZS-2848

See merge request halo/android/assistant-android!1188
2023-07-06 15:49:58 +08:00
efccfaaa7f fix: 游戏单功能优化-游戏单合集-前端部分—0704测试-客户端(0706测试1、3) https://jira.shanqu.cc/browse/GHZS-2848 2023-07-06 15:33:01 +08:00
a61057ae10 Merge branch 'fix/download_issue' into 'dev'
fix: 移除部分在 DownloadObserver/DownloadDataHelper 进行的数据库操作

See merge request halo/android/assistant-android!1187
2023-07-06 15:17:27 +08:00
9472cafe48 fix: 移除部分在 DownloadObserver 进行的数据库操作 2023-07-06 14:37:00 +08:00
be83e1a2b4 Merge branch 'fix/GHZS-2870' into 'dev'
fix: 相关曝光数据埋点补充—0705测试 https://jira.shanqu.cc/browse/GHZS-2870

See merge request halo/android/assistant-android!1186
2023-07-06 11:08:09 +08:00
e48d7745b4 fix: 相关曝光数据埋点补充—0705测试 https://jira.shanqu.cc/browse/GHZS-2870 2023-07-06 10:59:50 +08:00
8b1a38214c Merge branch 'feature-GHZS-2771-patch-2' into 'release'
feat: 支持xapk格式的apks文件解压—0705测试

See merge request halo/android/assistant-android!1185
2023-07-06 09:47:32 +08:00
2acde0af00 feat: 支持xapk格式的apks文件解压—0705测试 2023-07-06 09:47:32 +08:00
daab20424e Merge branch 'fix/GHZS-2848' into 'dev'
fix: 游戏单功能优化-游戏单合集-前端部分—0704测试-客户端 https://jira.shanqu.cc/browse/GHZS-2848

See merge request halo/android/assistant-android!1184
2023-07-05 16:55:40 +08:00
63f2adade2 fix: 游戏单功能优化-游戏单合集-前端部分—0704测试-客户端 https://jira.shanqu.cc/browse/GHZS-2848 2023-07-05 15:39:04 +08:00
201c1207f9 Merge branch 'feature-GHZS-2771-patch-1' into 'release'
feat: 支持xapk格式的apks文件解压—0704测试

See merge request halo/android/assistant-android!1183
2023-07-05 14:24:55 +08:00
75d86b5a91 feat: 支持xapk格式的apks文件解压—0704测试 2023-07-05 14:24:55 +08:00
f30d647936 Merge branch 'feat/enable_log_in_internal_build' into 'dev'
feat: 邮件包保留日志输出,方便无编译条件时简单调试

See merge request halo/android/assistant-android!1182
2023-07-05 10:50:06 +08:00
c7dd449899 feat: 邮件包保留日志输出,方便无编译条件时简单调试 2023-07-05 10:13:09 +08:00
0e9f7feff9 Merge branch 'feature/CWZS-80' into 'dev-5.29.0'
feat: 新增谷歌框架版本管理 https://jira.shanqu.cc/browse/CWZS-81

See merge request halo/android/assistant-android!1181
2023-07-04 17:45:56 +08:00
3697cd720e feat: 新增谷歌框架版本管理 https://jira.shanqu.cc/browse/CWZS-81 2023-07-04 17:38:55 +08:00
07a3c06804 Merge branch 'feature/GHZS-2738' into 'dev-5.29.0'
feat: 相关曝光数据埋点补充 https://jira.shanqu.cc/browse/GHZS-2738

See merge request halo/android/assistant-android!1180
2023-07-04 16:13:09 +08:00
2fce492689 feat: 相关曝光数据埋点补充 https://jira.shanqu.cc/browse/GHZS-2738 2023-07-04 16:13:09 +08:00
d87d12e1ec fix: 合并冲突 2023-07-04 14:58:57 +08:00
a595730c50 Merge remote-tracking branch 'origin/dev' into dev-5.29.0
# Conflicts:
#	libraries/LGLibrary
2023-07-04 14:45:40 +08:00
7976355e34 Merge branch 'release' into 'dev'
Release

See merge request halo/android/assistant-android!1178
2023-07-04 14:41:38 +08:00
a9097793ac Merge branch 'feature-forum-tag-icon-not-display' into 'release'
fix: 修复社区-推荐列表项论坛入口图标不显示以及点击无反应的问题

See merge request halo/android/assistant-android!1177
2023-07-04 13:38:53 +08:00
86e4ddd3f7 fix: 修复社区-推荐列表项论坛入口图标不显示以及点击无反应的问题 2023-07-04 12:45:53 +08:00
b9abf2009d Merge branch 'fix/GHZS-2838' into 'dev-5.29.0'
fix: 游戏单功能优化-游戏单合集-前端部分—0703UI优化(2、6) https://jira.shanqu.cc/browse/GHZS-2838

See merge request halo/android/assistant-android!1176
2023-07-04 11:55:37 +08:00
a7dfd6c16c fix: 游戏单功能优化-游戏单合集-前端部分—0703UI优化(2、6) https://jira.shanqu.cc/browse/GHZS-2838 2023-07-04 11:51:05 +08:00
07dcb4aca2 Merge branch 'fix/web_share_info' into 'dev-5.29.0'
fix: 修复网页分享时分享回调类型为与需求对应不上的问题

See merge request halo/android/assistant-android!1175
2023-07-04 11:09:45 +08:00
48123ff991 fix: 修复网页分享时分享回调类型为与需求对应不上的问题 2023-07-04 11:08:56 +08:00
8312d8e5fe Merge branch 'feature-GHZS-2771-patch' into 'dev'
feat:支持xapk格式的apks文件解压—0620测试 https://jira.shanqu.cc/browse/GHZS-2771

See merge request halo/android/assistant-android!1174
2023-07-04 10:34:40 +08:00
98b4901d55 feat:支持xapk格式的apks文件解压—0620测试 https://jira.shanqu.cc/browse/GHZS-2771 2023-07-04 10:34:40 +08:00
a6a411f2e3 Merge branch 'fix/GHZS-2838' into 'dev-5.29.0'
fix: 游戏单功能优化-游戏单合集-前端部分—0703UI优化 https://jira.shanqu.cc/browse/GHZS-2838

See merge request halo/android/assistant-android!1172
2023-07-03 17:48:47 +08:00
59976dcccd fix: 游戏单功能优化-游戏单合集-前端部分—0703UI优化 https://jira.shanqu.cc/browse/GHZS-2838 2023-07-03 17:47:18 +08:00
e22a3ddcdb Merge branch 'fix/web_share_info' into 'dev-5.29.0'
feat: JS 分享结果回调添加分享类型

See merge request halo/android/assistant-android!1173
2023-07-03 17:41:50 +08:00
ecfd133ce2 feat: JS 分享结果回调添加分享类型 2023-07-03 17:36:37 +08:00
d13ef56eb8 Merge branch 'fix/GHZS-2831' into 'dev-5.29.0'
fix: 游戏单功能优化-游戏单合集-前端部分—0630测试-客户端 https://jira.shanqu.cc/browse/GHZS-2831

See merge request halo/android/assistant-android!1171
2023-07-03 13:36:19 +08:00
66f2d1df99 fix: 游戏单功能优化-游戏单合集-前端部分—0630测试-客户端 https://jira.shanqu.cc/browse/GHZS-2831 2023-07-03 11:38:09 +08:00
8555673d71 Merge branch 'feat/GHZS-2797' into 'dev'
feat: 推广打包配置项增加关键行为上报 https://jira.shanqu.cc/browse/GHZS-2797

See merge request halo/android/assistant-android!1170
2023-06-30 17:43:55 +08:00
cfe4c243e6 feat: 推广打包配置项增加关键行为上报 https://jira.shanqu.cc/browse/GHZS-2797 2023-06-30 17:30:18 +08:00
c999ddf914 Merge branch 'fix/GHZS-2818' into 'dev'
fix: 【光环助手】神策埋点问题(1) https://jira.shanqu.cc/browse/GHZS-2818

See merge request halo/android/assistant-android!1169
2023-06-30 17:03:53 +08:00
f9004bf884 fix: 【光环助手】神策埋点问题(1) https://jira.shanqu.cc/browse/GHZS-2818 2023-06-30 16:50:29 +08:00
7794ef4acf fix: 【光环助手】神策埋点问题(1) https://jira.shanqu.cc/browse/GHZS-2818 2023-06-30 16:05:51 +08:00
1ef9c1fc23 Merge branch 'fix/vgame_download_flicker' into 'dev'
fix: 修复列表下载畅玩游戏时下载按钮闪烁并频繁切换状态的问题

See merge request halo/android/assistant-android!1166
2023-06-30 15:48:54 +08:00
1b1b753feb Merge remote-tracking branch 'origin/dev' into dev-5.29.0 2023-06-30 14:40:29 +08:00
2561767b9a Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	app/src/main/java/com/gh/download/DownloadManager.java
#	dependencies.gradle
#	module_common/src/main/java/com/gh/gamecenter/common/constant/Constants.java
2023-06-30 14:34:01 +08:00
8bda0e178e Merge branch 'fix/GHZS-2818' into 'dev'
fix: 【光环助手】神策埋点问题(1) https://jira.shanqu.cc/browse/GHZS-2818

See merge request halo/android/assistant-android!1167
2023-06-30 14:10:27 +08:00
f634d60605 Merge remote-tracking branch 'origin/dev' into dev-5.29.0 2023-06-30 13:52:06 +08:00
1dcc7654e8 Merge branch 'fix/wrong_game_category' into 'dev'
fix: 更正游戏类型在 downloadEntity 的记录

See merge request halo/android/assistant-android!1168
2023-06-30 11:54:34 +08:00
3579b9d808 fix: 更正游戏类型在 downloadEntity 的记录 2023-06-30 11:51:38 +08:00
c74663c082 fix: 【光环助手】神策埋点问题(1) https://jira.shanqu.cc/browse/GHZS-2818 2023-06-30 11:35:36 +08:00
848d352c60 fix: 【光环助手】神策埋点问题(1) https://jira.shanqu.cc/browse/GHZS-2818 2023-06-30 10:20:53 +08:00
5176766b29 fix: 修复列表下载畅玩游戏时下载按钮闪烁并频繁切换状态的问题 2023-06-30 10:10:47 +08:00
0a90a7ddd9 Merge branch 'feature/GHZS-2748' into 'dev-5.29.0'
feat: 游戏单活动:游戏单狂欢季—客户端-埋点 https://jira.shanqu.cc/browse/GHZS-2748

See merge request halo/android/assistant-android!1165
2023-06-29 17:47:32 +08:00
27ca5073d7 feat: 游戏单活动:游戏单狂欢季—客户端-埋点 https://jira.shanqu.cc/browse/GHZS-2748 2023-06-29 17:39:04 +08:00
e3eb8178a3 fix: merge conflict 2023-06-29 14:52:21 +08:00
10104812d6 Merge remote-tracking branch 'origin/dev' into dev-5.29.0 2023-06-29 14:29:23 +08:00
12cb9a4883 Merge branch 'fix/CWZS-86' into 'dev'
fix: 修复推送更新测试问题 https://jira.shanqu.cc/browse/CWZS-86

See merge request halo/android/assistant-android!1164
2023-06-29 14:08:18 +08:00
a30cc8c273 fix: 修复推送更新测试问题 https://jira.shanqu.cc/browse/CWZS-86 2023-06-29 13:55:19 +08:00
0f0620586b Merge branch 'fix/GHZS-2516' into 'dev'
fix: 【光环助手】神策首次事件取值的相关排查 (修复用户首次启动退出后再次热启动时用户第一次打开的标记仍为true的问题)...

See merge request halo/android/assistant-android!1163
2023-06-28 15:20:24 +08:00
b9e86dd67a fix: 【光环助手】神策首次事件取值的相关排查 (修复用户首次启动退出后再次热启动时用户第一次打开的标记仍为true的问题) https://jira.shanqu.cc/browse/GHZS-2516 2023-06-28 14:47:07 +08:00
9ce793d47e Merge branch 'fix/GHZS-2561' into 'dev'
fix:【光环助手】动态设置-公告文章支持通用链接(修改接口字段的处理方式)https://jira.shanqu.cc/browse/GHZS-2561

See merge request halo/android/assistant-android!1162
2023-06-28 11:31:37 +08:00
43cb18d6e0 fix:【光环助手】动态设置-公告文章支持通用链接(修改接口字段的处理方式)https://jira.shanqu.cc/browse/GHZS-2561 2023-06-28 11:26:42 +08:00
1e87610899 Merge branch 'feature/GHZS-2481' into 'dev-5.29.0'
feat: 游戏单功能优化-游戏单合集-前端部分—客户端 https://jira.shanqu.cc/browse/GHZS-2481

See merge request halo/android/assistant-android!1158
2023-06-28 10:50:33 +08:00
d04d486425 feat: 游戏单功能优化-游戏单合集-前端部分—客户端 https://jira.shanqu.cc/browse/GHZS-2481 2023-06-28 10:50:33 +08:00
843aa4d1c8 Merge branch 'fix/format_check_crash' into 'dev'
fix: 处理 XAPK 类型检测闪退问题

See merge request halo/android/assistant-android!1161
2023-06-27 18:15:41 +08:00
1745ac91b7 fix: 处理 XAPK 类型检测闪退问题 2023-06-27 16:43:36 +08:00
20bc4a0dc8 Merge branch 'fix/direct_to_gamedetail_without_entrance_issue' into 'dev'
fix: 修复部分位置跳转游戏详情丢失 entrance 字段信息的问题

See merge request halo/android/assistant-android!1160
2023-06-27 15:20:48 +08:00
1105f1b92a feat: 测试包默认开启畅玩功能 2023-06-27 15:20:34 +08:00
53f00f00d3 fix: 修复部分位置跳转游戏详情丢失 entrance 字段信息的问题 2023-06-27 15:12:29 +08:00
b66827e216 Merge branch 'feature/GHZS-2800' into 'dev-5.29.0'
feat: 帖子发布按钮展示优化—客户端 https://jira.shanqu.cc/browse/GHZS-2800

See merge request halo/android/assistant-android!1159
2023-06-27 13:52:39 +08:00
485c34d402 feat: 帖子发布按钮展示优化—客户端 https://jira.shanqu.cc/browse/GHZS-2800 2023-06-27 13:49:42 +08:00
330bcd72d7 Merge branch 'fix/concurrent_crash' into 'dev'
fix: 处理部分下载相关的 concurrent 闪退

See merge request halo/android/assistant-android!1157
2023-06-26 17:20:41 +08:00
b04231772b fix: 处理部分下载相关的 concurrent 闪退 2023-06-26 17:10:13 +08:00
ec1bbdc7d5 Merge branch 'feature-GHZS-2771' into 'dev'
feat:支持xapk格式的apks文件解压—0620测试 https://jira.shanqu.cc/browse/GHZS-2771

See merge request halo/android/assistant-android!1155
2023-06-26 16:48:30 +08:00
c685a02653 feat:支持xapk格式的apks文件解压—0620测试 https://jira.shanqu.cc/browse/GHZS-2771 2023-06-26 16:48:30 +08:00
6594bf14df Revert "Revert "Merge branch 'fix/sqlite_full_crash' into 'dev'""
This reverts commit 043f3c5d17.
2023-06-21 15:22:09 +08:00
5a4f19dd8a Merge branch 'feature-GHZS-2730' into 'dev-5.29.0'
feat:插件化安装弹窗优化—客户端 https://jira.shanqu.cc/browse/GHZS-2730

See merge request halo/android/assistant-android!1154
2023-06-21 15:05:39 +08:00
b54be8cb79 feat:插件化安装弹窗优化—客户端 https://jira.shanqu.cc/browse/GHZS-2730 2023-06-21 14:59:11 +08:00
655380d547 Merge branch 'hotfix/v5.27.1-891/cloud_archive_manager_crash' into 'release'
fix: 修复云存档管理页面点击下载按钮偶发的闪退问题...

See merge request halo/android/assistant-android!1153
2023-06-21 11:48:12 +08:00
da3948228f chore: 版本更新至 5.27.2 2023-06-21 11:39:33 +08:00
5c03119c32 fix: 修复云存档管理页面点击下载按钮偶发的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/289025/events/ba71db5b3538491fa2096ecf33fdfcf8/?project=22 2023-06-21 11:38:53 +08:00
2a496b680b Merge branch 'hotfix/v5.27.1-891/emulator_oaid_crash' into 'release'
fix: 修复模拟器上 OAID SDK 闪退的问题,在所有 postInit 操作前初始化 sentry

See merge request halo/android/assistant-android!1152
2023-06-21 11:26:36 +08:00
db535cf281 fix: 修复模拟器上 OAID SDK 闪退的问题,在所有 postInit 操作前初始化 sentry 2023-06-21 11:20:25 +08:00
c199582efc Merge branch 'hotfix/v5.27.1-891/emulator_oaid_crash' into 'release'
fix: 修复模拟器上 OAID SDK 闪退的问题

See merge request halo/android/assistant-android!1151
2023-06-21 11:02:06 +08:00
b53677a118 fix: 修复模拟器上 OAID SDK 闪退的问题 2023-06-21 10:56:24 +08:00
76ba3a5938 Merge branch 'feature-GHZS-2731' into 'dev-5.29.0'
feat:视频播放组件优化—客户端 https://jira.shanqu.cc/browse/GHZS-2731

See merge request halo/android/assistant-android!1150
2023-06-21 09:27:46 +08:00
db596a6c75 feat:视频播放组件优化—客户端 https://jira.shanqu.cc/browse/GHZS-2731 2023-06-20 18:40:31 +08:00
043f3c5d17 Revert "Merge branch 'fix/sqlite_full_crash' into 'dev'"
This reverts merge request !1147
2023-06-20 18:00:56 +08:00
68006dda38 Merge branch 'feature-GHZS-2754' into 'release'
fix:尝试修复部分线上闪退 https://jira.shanqu.cc/browse/GHZS-2754

See merge request halo/android/assistant-android!1149
2023-06-20 17:24:57 +08:00
b5cab193be fix:尝试修复部分线上闪退 https://jira.shanqu.cc/browse/GHZS-2754 2023-06-20 17:24:57 +08:00
6f2692296c Merge branch 'fix/sqlite_full_crash' into 'dev'
fix: 处理存储空间满了后的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/197777/?project=22&query=assigned%3Ame+status%3Aunresolved&sort=user&statsPeriod=14d

See merge request halo/android/assistant-android!1147
2023-06-20 17:16:25 +08:00
0bb7a53046 Merge branch 'fix/game_collection_hot_list' into 'dev'
fix: 修复游戏单热榜的游戏单宽度不能自适应的问题

See merge request halo/android/assistant-android!1146
2023-06-20 15:51:08 +08:00
25fe362912 fix: 修复游戏单热榜的游戏单宽度不能自适应的问题 2023-06-20 15:49:33 +08:00
6749d94c34 fix: 处理存储空间满了后的闪退问题 2023-06-20 15:25:54 +08:00
51f5ea1cd9 Merge branch 'fix/CWZS-85' into 'dev'
fix: 畅玩助手组件下载链接失效问题 https://jira.shanqu.cc/browse/CWZS-85

See merge request halo/android/assistant-android!1145
2023-06-20 14:08:55 +08:00
50a6d5e204 fix: 畅玩助手组件下载链接失效问题 https://jira.shanqu.cc/browse/CWZS-85 2023-06-20 14:02:33 +08:00
044e5646ec Merge branch 'fix/GHZS-2641' into 'dev'
fix: 游戏单功能优化-游戏单广场—0606测试 (修复正式包刷新轮换失效的问题) https://jira.shanqu.cc/browse/GHZS-2641

See merge request halo/android/assistant-android!1144
2023-06-20 11:23:35 +08:00
0ebf3d191d fix: 游戏单功能优化-游戏单广场—0606测试 (修复正式包刷新轮换失效的问题) https://jira.shanqu.cc/browse/GHZS-2641 2023-06-20 11:05:49 +08:00
bb81d91fd5 Merge branch 'release' of git.shanqu.cc:halo/android/assistant-android into release 2023-06-20 10:32:53 +08:00
7442da80e0 Merge branch 'fix/GHZS-2753' into 'dev'
fix: 尝试修复部分线上闪退 https://jira.shanqu.cc/browse/GHZS-2753

See merge request halo/android/assistant-android!1142
2023-06-19 17:00:54 +08:00
96c28907ec Merge branch 'feature-GHZS-2758' into 'dev'
fix:支持xapk格式的apks文件解压—0619测试 https://jira.shanqu.cc/browse/GHZS-2758

See merge request halo/android/assistant-android!1143
2023-06-19 16:52:03 +08:00
e9e7c2043e fix:支持xapk格式的apks文件解压—0619测试 https://jira.shanqu.cc/browse/GHZS-2758 2023-06-19 16:52:03 +08:00
eb5c55f046 ci: 处理特殊打包的编译问题 2023-06-19 16:32:29 +08:00
8f2a1ecaa1 fix: 尝试修复部分线上闪退 https://jira.shanqu.cc/browse/GHZS-2753 2023-06-19 16:31:49 +08:00
8dbe9c5772 Merge branch 'fix/border_color' into 'dev'
fix: 修改玩家创作榜用户头像边框深色模式颜色

See merge request halo/android/assistant-android!1141
2023-06-19 14:14:09 +08:00
6c911e09d3 fix: 修改玩家创作榜用户头像边框深色模式颜色 2023-06-19 14:13:26 +08:00
df557099ec Merge branch 'fix/GHZS-2717' into 'dev'
fix: 搭建评论数据面板—0615测试(修复部分上报位置遗漏问题) https://jira.shanqu.cc/browse/GHZS-2717

See merge request halo/android/assistant-android!1140
2023-06-19 14:09:40 +08:00
fedc91d37e fix: 搭建评论数据面板—0615测试(修复部分上报位置遗漏问题) https://jira.shanqu.cc/browse/GHZS-2717 2023-06-19 13:57:13 +08:00
27484a8306 Merge branch 'fix/GHZS-2752' into 'dev'
fix: 游戏单功能优化-游戏单热榜-前端部分—0619UI优化 https://jira.shanqu.cc/browse/GHZS-2752

See merge request halo/android/assistant-android!1139
2023-06-19 10:36:22 +08:00
42193d222a fix: 游戏单功能优化-游戏单热榜-前端部分—0619UI优化 https://jira.shanqu.cc/browse/GHZS-2752 2023-06-19 10:34:40 +08:00
0a433566b1 chore: 版本更新至 5.29.0 2023-06-19 10:01:48 +08:00
ff02ccd839 Merge remote-tracking branch 'origin/dev' into dev-5.28.0 2023-06-19 09:51:15 +08:00
d1cc0853d4 Merge branch 'fix/vgame_backup_issue' into 'dev-5.28.0'
fix: 修复部分设备卸载重装后无法恢复畅玩历史数据的问题

See merge request halo/android/assistant-android!1138
2023-06-19 09:40:46 +08:00
51eb814a42 fix: 修复部分设备卸载重装后无法恢复畅玩历史数据的问题 2023-06-16 18:04:30 +08:00
6534c17cc0 Merge branch 'fix/GHZS-2641' into 'dev-5.28.0'
fix: 游戏单功能优化-游戏单广场—0606测试(修复筛选游戏单标签时请求接口缺少参数的问题) https://jira.shanqu.cc/browse/GHZS-2641

See merge request halo/android/assistant-android!1137
2023-06-16 16:57:54 +08:00
749a76a09e fix: 游戏单功能优化-游戏单广场—0606测试(修复筛选游戏单标签时请求接口缺少参数的问题) https://jira.shanqu.cc/browse/GHZS-2641 2023-06-16 14:53:04 +08:00
0f59f79495 Merge branch 'fix/GHZS-2744' into 'dev-5.28.0'
fix: 游戏单功能优化-游戏单热榜-前端部分—0616UI测试 https://jira.shanqu.cc/browse/GHZS-2744

See merge request halo/android/assistant-android!1136
2023-06-16 14:50:31 +08:00
af66a967b5 fix: 游戏单功能优化-游戏单热榜-前端部分—0616UI测试 https://jira.shanqu.cc/browse/GHZS-2744 2023-06-16 14:39:30 +08:00
9a9095bcf0 Merge branch 'feature-GHZS-2456-patch' into 'dev-5.28.0'
feat:补充支持xapk格式的apks一些需求 https://jira.shanqu.cc/browse/GHZS-2456

See merge request halo/android/assistant-android!1133
2023-06-16 13:51:35 +08:00
225f2becf3 feat:补充支持xapk格式的apks一些需求 https://jira.shanqu.cc/browse/GHZS-2456 2023-06-16 13:51:35 +08:00
a502fb64cb Merge branch 'fix/GHZS-2714' into 'dev-5.28.0'
feat: 启动事件埋点补充—0615测试(处理部分游戏类型为空情况) https://jira.shanqu.cc/browse/GHZS-2714

See merge request halo/android/assistant-android!1130
2023-06-16 10:26:41 +08:00
724fe8142c feat: 启动事件埋点补充—0615测试(处理部分游戏类型为空情况,但还需接口返回) https://jira.shanqu.cc/browse/GHZS-2714 2023-06-16 10:16:37 +08:00
dee5a0822d Merge branch 'fix/GHZS-2689' into 'dev-5.28.0'
fix: 游戏单功能优化-游戏单广场—0614测试 (0615测试) https://jira.shanqu.cc/browse/GHZS-2689

See merge request halo/android/assistant-android!1128
2023-06-16 09:51:43 +08:00
e826346ca9 Merge branch 'fix/GHZS-2685' into 'dev-5.28.0'
fix: 游戏单功能优化-游戏单热榜-前端部分—0614测试-客户端 (0615测试) https://jira.shanqu.cc/browse/GHZS-2685

See merge request halo/android/assistant-android!1129
2023-06-16 09:51:35 +08:00
06b43cde77 fix: 游戏单功能优化-游戏单广场—0614测试 (0615测试) https://jira.shanqu.cc/browse/GHZS-2689 2023-06-16 09:45:35 +08:00
ae5edad87b fix: 游戏单功能优化-游戏单热榜-前端部分—0614测试-客户端 (0615测试) https://jira.shanqu.cc/browse/GHZS-2685 2023-06-16 09:35:28 +08:00
c8916f5f33 Merge branch 'fix/GHZS-2641' into 'dev-5.28.0'
fix: 游戏单功能优化-游戏单广场—0606测试 https://jira.shanqu.cc/browse/GHZS-2641

See merge request halo/android/assistant-android!1127
2023-06-15 18:10:53 +08:00
04cca95435 Merge branch 'feature-update-lgl-library' into 'dev-5.28.0'
feat:更新LGLibrary指向

See merge request halo/android/assistant-android!1126
2023-06-15 17:52:55 +08:00
1bd3d8b044 feat:更新LGLibrary指向 2023-06-15 17:52:19 +08:00
4e79466cca fix: 游戏单功能优化-游戏单广场—0606测试 https://jira.shanqu.cc/browse/GHZS-2641 2023-06-15 17:40:20 +08:00
88093d0a8e Merge branch 'feature-GHZS-2456' into 'dev-5.28.0'
feat:支持xapk格式的apks文件解压—客户端 https://jira.shanqu.cc/browse/GHZS-2456

See merge request halo/android/assistant-android!1124
2023-06-15 17:06:10 +08:00
26adcc48f8 feat:支持xapk格式的apks文件解压—客户端 https://jira.shanqu.cc/browse/GHZS-2456 2023-06-15 17:06:10 +08:00
e94e86d901 Merge branch 'fix/GHZS-2472' into 'dev-5.28.0'
fix: 游戏单功能优化-游戏单热榜-前端部分—0614测试-客户端 https://jira.shanqu.cc/browse/GHZS-2685

See merge request halo/android/assistant-android!1125
2023-06-15 15:45:46 +08:00
73355a4103 fix: 游戏单功能优化-游戏单热榜-前端部分—0614测试-客户端 https://jira.shanqu.cc/browse/GHZS-2685
fix: 游戏单功能优化-游戏单热榜-前端部分—0614UI测试 https://jira.shanqu.cc/browse/GHZS-2686
2023-06-15 15:33:21 +08:00
794377fdad fix: 游戏单功能优化-游戏单广场—0614测试 https://jira.shanqu.cc/browse/GHZS-2689 2023-06-15 14:31:33 +08:00
1bff098369 Merge branch 'feat/GHZS-2603' into 'dev-5.28.0'
fix: 修复曝光 id 的传递问题 https://jira.shanqu.cc/browse/GHZS-2603

See merge request halo/android/assistant-android!1123
2023-06-15 13:54:11 +08:00
45c7638dee fix: 修复曝光 id 的传递问题 https://jira.shanqu.cc/browse/GHZS-2603 2023-06-15 13:52:30 +08:00
4c57092300 Merge branch 'feat/GHZS-2622' into 'dev-5.28.0'
feat: 启动事件埋点补充 https://jira.shanqu.cc/browse/GHZS-2622

See merge request halo/android/assistant-android!1121
2023-06-15 13:47:59 +08:00
1ddf9a667e feat: 启动事件埋点补充 https://jira.shanqu.cc/browse/GHZS-2622 2023-06-15 10:42:08 +08:00
84972e7ba7 Merge branch 'fix/GHZS-2687' into 'dev-5.28.0'
fix: 游戏单功能优化-游戏单广场—0614UI优化 https://jira.shanqu.cc/browse/GHZS-2687

See merge request halo/android/assistant-android!1120
2023-06-14 15:00:41 +08:00
03692ad753 fix: 游戏单功能优化-游戏单广场—0614UI优化 https://jira.shanqu.cc/browse/GHZS-2687 2023-06-14 14:59:12 +08:00
bb138fa25f Merge branch 'fix/GHZS-2669' into 'dev-5.28.0'
fix: 多渠道多版本配置-搜索管理功能优化—0612测试-客户端 https://jira.shanqu.cc/browse/GHZS-2669

See merge request halo/android/assistant-android!1118
2023-06-14 14:33:41 +08:00
c5024e670a Merge branch 'fix/GHZS-2674' into 'dev-5.28.0'
fix: 【光环助手】求版本下载跳转问题 https://jira.shanqu.cc/browse/GHZS-2674

See merge request halo/android/assistant-android!1117
2023-06-14 14:33:29 +08:00
fe5c92e988 fix: 【光环助手】求版本下载跳转问题 https://jira.shanqu.cc/browse/GHZS-2674 2023-06-14 14:22:48 +08:00
9b31bf4164 fix: 多渠道多版本配置-搜索管理功能优化—0612测试-客户端 https://jira.shanqu.cc/browse/GHZS-2669 2023-06-14 11:37:25 +08:00
c670ab722f Merge branch 'fix/GHZS-2658' into 'dev-5.28.0'
fix: 游戏单功能优化-游戏单广场—0609测试 https://jira.shanqu.cc/browse/GHZS-2658

See merge request halo/android/assistant-android!1115
2023-06-13 15:14:39 +08:00
fd4f3c25e7 fix: 游戏单功能优化-游戏单广场—0609测试 https://jira.shanqu.cc/browse/GHZS-2658 2023-06-13 15:09:46 +08:00
a14ea3708a Merge branch 'fix/GHZS-2658' into 'dev-5.28.0'
fix: 游戏单功能优化-游戏单广场—0609测试 https://jira.shanqu.cc/browse/GHZS-2658

See merge request halo/android/assistant-android!1114
2023-06-13 14:57:25 +08:00
c003240f16 Merge branch 'fix/GHZS-2576' into 'dev-5.28.0'
fix: 修复游戏详情页在正式环境下的闪退问题

See merge request halo/android/assistant-android!1113
2023-06-13 14:57:18 +08:00
891e3d93fb fix: 游戏单功能优化-游戏单广场—0609测试 https://jira.shanqu.cc/browse/GHZS-2658 2023-06-13 14:48:31 +08:00
af5ec74b9e Merge branch 'feat/GHZS-2644' into 'dev-5.28.0'
feat: 搭建评论数据面板(补充埋点) https://jira.shanqu.cc/browse/GHZS-2644

See merge request halo/android/assistant-android!1112
2023-06-13 13:39:57 +08:00
d2c4483455 feat: 搭建评论数据面板(补充埋点) https://jira.shanqu.cc/browse/GHZS-2644 2023-06-13 11:47:21 +08:00
3a156aa8c1 fix: 修复游戏详情页在正式环境下的闪退问题 2023-06-13 11:03:23 +08:00
60bd3ee9b2 Merge branch 'feature/GHZS-2485' into 'dev-5.28.0'
feat: 游戏单功能优化-游戏单热榜-前端部分—客户端 https://jira.shanqu.cc/browse/GHZS-2485

See merge request halo/android/assistant-android!1111
2023-06-13 10:53:34 +08:00
dacda1a858 feat: 游戏单功能优化-游戏单热榜-前端部分—客户端 https://jira.shanqu.cc/browse/GHZS-2485 2023-06-13 10:53:34 +08:00
265b5f6b57 Merge branch 'feat/GHZS-2502' into 'dev-5.28.0'
feat: 我的光环在设备无网络时的功能版块优化 https://jira.shanqu.cc/browse/GHZS-2502

See merge request halo/android/assistant-android!1109
2023-06-12 10:30:56 +08:00
b4bd6f250b feat: 我的光环在设备无网络时的功能版块优化 https://jira.shanqu.cc/browse/GHZS-2502 2023-06-12 10:25:35 +08:00
0f3ae5f085 Merge branch 'fix/GHZS-2656' into 'dev-5.28.0'
fix: 游戏单功能优化-游戏单广场—0609UI测试 https://jira.shanqu.cc/browse/GHZS-2656

See merge request halo/android/assistant-android!1108
2023-06-09 17:03:43 +08:00
3ab6cc202e fix: 游戏单功能优化-游戏单广场—0609UI测试 https://jira.shanqu.cc/browse/GHZS-2656 2023-06-09 17:03:05 +08:00
7a154bc130 Merge branch 'feature/GHZS-2576' into 'dev-5.28.0'
feat: 动态设置-公告文章支持通用链接—客户端 https://jira.shanqu.cc/browse/GHZS-2576

See merge request halo/android/assistant-android!1106
2023-06-09 15:35:07 +08:00
7cd6f2b0f4 feat: 动态设置-公告文章支持通用链接—客户端 https://jira.shanqu.cc/browse/GHZS-2576 2023-06-09 14:20:13 +08:00
8db2519f61 Merge branch 'feature-GHZS-2590' into 'dev-5.28.0'
feat:帖子更多操作图标UI样式替换—客户端 https://jira.shanqu.cc/browse/GHZS-2590

See merge request halo/android/assistant-android!1102
2023-06-08 16:57:35 +08:00
6b2902a73b feat:帖子更多操作图标UI样式替换—客户端 https://jira.shanqu.cc/browse/GHZS-2590 2023-06-08 16:53:19 +08:00
df7618bbda Merge branch 'feature-GHZS-2626' into 'dev-5.28.0'
feat:【光环助手】视频帖详情页UI展示问题 https://jira.shanqu.cc/browse/GHZS-2626

See merge request halo/android/assistant-android!1100
2023-06-08 15:44:12 +08:00
246983a097 feat:【光环助手】视频帖详情页UI展示问题 https://jira.shanqu.cc/browse/GHZS-2626 2023-06-08 15:42:01 +08:00
ca6146ad9a Merge branch 'feature-GHZS-2649' into 'dev-5.28.0'
feat:【光环助手】游戏礼包相关bug https://jira.shanqu.cc/browse/GHZS-2649

See merge request halo/android/assistant-android!1097
2023-06-08 11:03:06 +08:00
c647320abc feat:【光环助手】游戏礼包相关bug https://jira.shanqu.cc/browse/GHZS-2649 2023-06-08 10:59:07 +08:00
afd738454e Merge branch 'feat/GHZS-2645' into 'dev-5.28.0'
feat: 新增畅玩32位游戏类型 https://jira.shanqu.cc/browse/GHZS-2637

See merge request halo/android/assistant-android!1093
2023-06-07 14:04:40 +08:00
134cb327ec feat: 新增畅玩32位游戏类型 https://jira.shanqu.cc/browse/GHZS-2637 2023-06-07 14:01:57 +08:00
f50ce741ae Merge branch 'dev' into 'dev-5.28.0'
Dev

See merge request halo/android/assistant-android!1092
2023-06-07 11:51:27 +08:00
4547ba969e Merge branch 'dev' into 'dev-5.28.0'
Dev

See merge request halo/android/assistant-android!1087
2023-06-06 16:53:05 +08:00
0a4af78ac8 Merge branch 'dev' into 'dev-5.28.0'
合并 dev 变更

See merge request halo/android/assistant-android!1084
2023-06-06 14:36:18 +08:00
d38e1d1637 Merge branch 'feature/GHZS-2476' into 'dev-5.28.0'
feat: 游戏单功能优化-游戏单广场—客户端 https://jira.shanqu.cc/browse/GHZS-2476

See merge request halo/android/assistant-android!1076
2023-06-05 17:07:28 +08:00
0d3456cf97 feat: 游戏单功能优化-游戏单广场—客户端 https://jira.shanqu.cc/browse/GHZS-2476 2023-06-05 17:00:56 +08:00
f56529aa5b chore: 版本更新至 5.28.0 2023-05-31 11:49:46 +08:00
331 changed files with 9128 additions and 2058 deletions

View File

@ -71,8 +71,7 @@ android_build:
exit_codes: 137
only:
- dev
- dev-5.26.0
- dev-5.27.0
- dev-5.29.0
# 代码检查
sonarqube_analysis:
@ -103,8 +102,7 @@ sonarqube_analysis:
exit_codes: 137
only:
- dev
- dev-5.26.0
- dev-5.27.0
- dev-5.29.0
## 发送简易检测结果报告
send_sonar_report:
@ -122,8 +120,7 @@ send_sonar_report:
exit_codes: 137
only:
- dev
- dev-5.26.0
- dev-5.27.0
- dev-5.29.0
oss-upload&send-email:
tags:
@ -155,5 +152,4 @@ oss-upload&send-email:
- /usr/local/bin/python /ci-android-mail.py
only:
- dev
- dev-5.26.0
- dev-5.27.0
- dev-5.29.0

View File

@ -11,7 +11,10 @@ android {
String CONFIG_ID = ""
String FIRST_LAUNCH = ""
int ACTIVATE_REPORTING_RATIO = 0
String SDK_VERSION = ""
String SDK_APP_ID = ""
String SDK_APP_NAME = ""
int ACTIVATE_REPORTING_RATIO = 100
buildFeatures {
viewBinding true
@ -71,9 +74,19 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt', 'proguard-fresco.txt'
String CORE_EVENT_GAME_CATEGORY = ""
// 推广用的关键事件游戏类型
buildConfigField "String", "CORE_EVENT_GAME_CATEGORY", "\"${CORE_EVENT_GAME_CATEGORY}\""
// 推广用的配置 id
buildConfigField "String", "CONFIG_ID", "\"${CONFIG_ID}\""
// 推广用的 SDK 版本 (仅记录使用)
buildConfigField "String", "SDK_VERSION", "\"${SDK_VERSION}\""
buildConfigField "String", "SDK_APP_ID", "\"${SDK_APP_ID}\""
buildConfigField "String", "SDK_APP_NAME", "\"${SDK_APP_NAME}\""
// 首次启动的跳转配置
buildConfigField "String", "FIRST_LAUNCH", "\"${FIRST_LAUNCH}\""
@ -201,17 +214,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 {
@ -334,6 +341,7 @@ dependencies {
implementation(project(':feature:oaid'))
implementation(project(':feature:floating-window'))
implementation(project(':feature:beizi_startup_ad'))
implementation(project(':feature:xapk-installer'))
}
File propFile = file('sign.properties')

View File

@ -20,12 +20,13 @@
-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.download.DownloadDataSimpleEntity {<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.* {*;}
-keep class com.gh.gamecenter.home.gamecollection.GameCollectionStackLayout {*;}
-keep class com.gh.gamecenter.home.gamecollection.GameCollectionStackAnimation {*;}
-keep class com.gh.gamecenter.home.gamecollection.carousel.GameCollectionStackLayout {*;}
-keep class com.gh.gamecenter.home.gamecollection.carousel.GameCollectionStackAnimation {*;}
# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {

View File

@ -33,4 +33,8 @@ class FlavorProviderImp : IFlavorProvider {
override fun logEvent(content: String) {
// do nothing
}
override fun logCoreEvent() {
// do nothing
}
}

View File

@ -42,6 +42,10 @@ class FlavorProviderImp : IFlavorProvider {
GdtHelper.logAction(content)
}
override fun logCoreEvent() {
// do nothing
}
companion object {
private const val GDT_DEFAULT_CHANNEL = "GDT_GHZS_01"
}

View File

@ -5,8 +5,8 @@ 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 val mAppId by lazy { BuildConfig.SDK_APP_ID.ifEmpty { "81537" } }
private val mAppName by lazy { BuildConfig.SDK_APP_NAME.ifEmpty { "guanghuanzhushou_1" } }
@JvmStatic
fun init(context: Context, channel: String) {

View File

@ -3,10 +3,13 @@ package com.gh.gamecenter.provider
import android.app.Activity
import android.app.Application
import android.text.TextUtils
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.KuaishouHelper
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.provider.IFlavorProvider
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.core.utils.TimeUtils
import com.gh.gamecenter.core.utils.ToastUtils
import com.halo.assistant.HaloApp
import com.kwai.monitor.payload.TurboHelper
@ -42,6 +45,15 @@ class FlavorProviderImp : IFlavorProvider {
KuaishouHelper.onEvent(content)
}
override fun logCoreEvent() {
logEvent("EVENT_KEY_PATH_OPTIMIZATION")
if (BuildConfig.ACTIVATE_REPORTING_RATIO == 1) {
AppExecutor.uiExecutor.executeWithDelay({
ToastUtils.toast("关键行为 EVENT_KEY_PATH_OPTIMIZATION")
}, 500)
}
}
companion object {
private const val KUAISHOU_CHANNEL = "KS-GHZS-01"
}

View File

@ -106,8 +106,8 @@
android:icon="@mipmap/logo"
android:label="@string/app_name"
android:largeHeap="true"
android:resizeableActivity="true"
android:networkSecurityConfig="@xml/network_security_config"
android:resizeableActivity="true"
android:theme="@style/AppCompatTheme.APP"
tools:replace="android:name,android:allowBackup"
tools:targetApi="n">
@ -756,6 +756,10 @@
android:name=".servers.gametest2.GameServerTestV2Activity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.gamecollection.hotlist.GameCollectionHotListActivity"
android:screenOrientation="portrait" />
<!-- <activity-->
<!-- android:name="${applicationId}.douyinapi.DouYinEntryActivity"-->
@ -826,6 +830,11 @@
</intent-filter>
</receiver>
<activity
android:name="com.gh.common.xapk.XapkInstallReceiver"
android:theme="@style/Theme.Transparent"
android:exported="false" />
<receiver
android:name="com.gh.gamecenter.receiver.ActivitySkipReceiver"
android:exported="true">

View File

@ -0,0 +1 @@
{"v":"5.9.1","fr":60,"ip":0,"op":60,"w":144,"h":144,"nm":"icon_change","ddd":0,"assets":[{"id":"comp_0","nm":"icon_change_detail","fr":60,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"stroke1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[37.04,52.994,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-0.533,-0.143],[0.143,-0.533],[1.487,-1.304],[1.961,-0.258],[1.774,0.875],[0.709,0.661],[0,0],[0,0.445],[0,0],[-0.276,0],[0,0],[-0.013,0],[0,0],[0.315,-0.315],[0,0],[-0.682,-0.336],[-1.569,0.207],[-1.19,1.043],[-0.41,1.528]],"o":[[0.533,0.143],[-0.512,1.91],[-1.487,1.304],[-1.961,0.258],[-0.879,-0.433],[0,0],[-0.315,0.315],[0,0],[0,-0.276],[0,0],[0.013,0],[0,0],[0.445,0],[0,0],[0.555,0.508],[1.419,0.7],[1.569,-0.207],[1.19,-1.043],[0.143,-0.533]],"v":[[8.605,-4.301],[9.312,-3.076],[6.247,1.854],[0.958,4.25],[-4.77,3.304],[-7.163,1.652],[-8.493,2.982],[-9.347,2.628],[-9.347,-1.665],[-8.847,-2.165],[-8.161,-2.165],[-8.122,-2.165],[-4.554,-2.165],[-4.2,-1.311],[-5.748,0.237],[-3.885,1.51],[0.697,2.267],[4.928,0.35],[7.381,-3.594]],"c":true},"ix":2},"nm":"stroke1","mn":"ADBE Vector Shape - Group","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.8,1,0.6],"ix":9}},"s":{"a":0,"k":[-5.347,-4.665],"ix":5},"e":{"a":0,"k":[8.653,-4.665],"ix":6},"t":1,"nm":"color1","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":"stroke1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":300,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"stroke2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[34.96,19.006,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-1.961,0.258],[-1.774,-0.875],[-0.709,-0.661],[0,0],[0,-0.445],[0,0],[0.276,0],[0,0],[0.012,0],[0,0],[-0.315,0.315],[0,0],[0.682,0.336],[1.569,-0.207],[1.19,-1.043],[0.41,-1.528],[0.533,0.143],[-0.143,0.533],[-1.487,1.304]],"o":[[1.961,-0.258],[0.879,0.433],[0,0],[0.315,-0.315],[0,0],[0,0.276],[0,0],[-0.012,0],[0,0],[-0.445,0],[0,0],[-0.555,-0.508],[-1.419,-0.7],[-1.569,0.207],[-1.19,1.043],[-0.143,0.533],[-0.533,-0.143],[0.512,-1.91],[1.487,-1.304]],"v":[[-0.958,-4.25],[4.77,-3.304],[7.163,-1.652],[8.493,-2.982],[9.347,-2.628],[9.347,1.665],[8.847,2.165],[8.16,2.165],[8.123,2.165],[4.554,2.165],[4.2,1.311],[5.748,-0.237],[3.885,-1.51],[-0.697,-2.267],[-4.928,-0.35],[-7.381,3.594],[-8.605,4.301],[-9.312,3.076],[-6.247,-1.854]],"c":true},"ix":2},"nm":"stroke2","mn":"ADBE Vector Shape - Group","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.8,1,0.6],"ix":9}},"s":{"a":0,"k":[5.347,4.665],"ix":5},"e":{"a":0,"k":[-8.653,4.665],"ix":6},"t":1,"nm":"color2","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":"stroke2","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":300,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"icon_change_detail","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.5],"y":[1]},"o":{"x":[0.5],"y":[0]},"t":0,"s":[0]},{"t":36,"s":[360]}],"ix":10},"p":{"a":0,"k":[72,72,0],"ix":2,"l":2},"a":{"a":0,"k":[36,36,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":72,"h":72,"ip":0,"op":300,"st":0,"bm":0}],"markers":[]}

View File

@ -0,0 +1 @@
{"v":"5.9.1","fr":60,"ip":0,"op":60,"w":72,"h":72,"nm":"icon_title_change","ddd":0,"assets":[{"id":"comp_0","nm":"arrow","fr":60,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"arrow_e_dark","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[29.25,30,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-1.701,0.456],[-1.627,-0.674],[-0.705,-0.667],[0,0],[-0.552,0],[0,-0.552],[0,0],[0.552,0],[0,0],[0.012,0],[0,0],[0,0.552],[-0.552,0],[0,0],[0.615,0.255],[1.276,-0.342],[0.804,-1.048],[0,-1.321],[-0.804,-1.048],[-1.276,-0.342],[-1.22,0.505],[-0.66,1.144],[-0.478,-0.276],[0.276,-0.478],[1.627,-0.674],[1.701,0.456],[1.072,1.397],[0,1.761],[-1.072,1.397]],"o":[[1.701,-0.456],[0.909,0.376],[0,0],[0,-0.552],[0.552,0],[0,0],[0,0.552],[0,0],[-0.012,0],[0,0],[-0.552,0],[0,-0.552],[0,0],[-0.493,-0.435],[-1.22,-0.505],[-1.276,0.342],[-0.804,1.048],[0,1.321],[0.804,1.048],[1.276,0.342],[1.22,-0.505],[0.276,-0.478],[0.478,0.276],[-0.881,1.525],[-1.627,0.674],[-1.701,-0.456],[-1.072,-1.397],[0,-1.761],[1.072,-1.397]],"v":[[-1.821,-7.727],[3.311,-7.391],[5.75,-5.809],[5.75,-6.5],[6.75,-7.5],[7.75,-6.5],[7.75,-3.5],[6.75,-2.5],[6.331,-2.5],[6.295,-2.5],[3.75,-2.5],[2.75,-3.5],[3.75,-4.5],[4.219,-4.5],[2.546,-5.543],[-1.303,-5.796],[-4.51,-3.653],[-5.75,0],[-4.51,3.653],[-1.303,5.796],[2.546,5.543],[5.446,3],[6.812,2.634],[7.178,4],[3.311,7.391],[-1.821,7.727],[-6.097,4.87],[-7.75,0],[-6.097,-4.87]],"c":true},"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.158117651939,0.532358944416,0.878431379795,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":"arrow_e_dark","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":300,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"arrow","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.5],"y":[1]},"o":{"x":[0.5],"y":[0]},"t":0,"s":[0]},{"t":36,"s":[360]}],"ix":10},"p":{"a":0,"k":[36,36,0],"ix":2,"l":2},"a":{"a":0,"k":[30,30,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":60,"h":60,"ip":0,"op":300,"st":0,"bm":0}],"markers":[]}

View File

@ -0,0 +1 @@
{"v":"5.9.1","fr":60,"ip":0,"op":60,"w":72,"h":72,"nm":"icon_title_change","ddd":0,"assets":[{"id":"comp_0","nm":"arrow","fr":60,"layers":[{"ddd":0,"ind":2,"ty":4,"nm":"arrow_e_light","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[29.25,30,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-1.701,0.456],[-1.627,-0.674],[-0.705,-0.667],[0,0],[-0.552,0],[0,-0.552],[0,0],[0.552,0],[0,0],[0.012,0],[0,0],[0,0.552],[-0.552,0],[0,0],[0.615,0.255],[1.276,-0.342],[0.804,-1.048],[0,-1.321],[-0.804,-1.048],[-1.276,-0.342],[-1.22,0.505],[-0.66,1.144],[-0.478,-0.276],[0.276,-0.478],[1.627,-0.674],[1.701,0.456],[1.072,1.397],[0,1.761],[-1.072,1.397]],"o":[[1.701,-0.456],[0.909,0.376],[0,0],[0,-0.552],[0.552,0],[0,0],[0,0.552],[0,0],[-0.012,0],[0,0],[-0.552,0],[0,-0.552],[0,0],[-0.493,-0.435],[-1.22,-0.505],[-1.276,0.342],[-0.804,1.048],[0,1.321],[0.804,1.048],[1.276,0.342],[1.22,-0.505],[0.276,-0.478],[0.478,0.276],[-0.881,1.525],[-1.627,0.674],[-1.701,-0.456],[-1.072,-1.397],[0,-1.761],[1.072,-1.397]],"v":[[-1.821,-7.727],[3.311,-7.391],[5.75,-5.809],[5.75,-6.5],[6.75,-7.5],[7.75,-6.5],[7.75,-3.5],[6.75,-2.5],[6.331,-2.5],[6.295,-2.5],[3.75,-2.5],[2.75,-3.5],[3.75,-4.5],[4.219,-4.5],[2.546,-5.543],[-1.303,-5.796],[-4.51,-3.653],[-5.75,0],[-4.51,3.653],[-1.303,5.796],[2.546,5.543],[5.446,3],[6.812,2.634],[7.178,4],[3.311,7.391],[-1.821,7.727],[-6.097,4.87],[-7.75,0],[-6.097,-4.87]],"c":true},"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.141176477075,0.588235318661,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":"arrow_e_light","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":300,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"arrow","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.5],"y":[1]},"o":{"x":[0.5],"y":[0]},"t":0,"s":[0]},{"t":36,"s":[360]}],"ix":10},"p":{"a":0,"k":[36,36,0],"ix":2,"l":2},"a":{"a":0,"k":[30,30,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":60,"h":60,"ip":0,"op":300,"st":0,"bm":0}],"markers":[]}

View File

@ -5,6 +5,7 @@ import android.app.Application
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.gh.common.util.FloatingBackViewManager
import com.gh.common.xapk.XapkInstaller
import com.gh.download.DownloadManager
import com.gh.gamecenter.SingletonWebActivity
import com.gh.gamecenter.SkipActivity
@ -61,6 +62,8 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
) {
VHelper.showFeedbackDialogIfLastSuccessfulLaunchedGameExitUnexpectedly(activity)
}
XapkInstaller.updateCurrentInstallStatus()
}
override fun onActivityPaused(activity: Activity) {

View File

@ -12,6 +12,7 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.FragmentManager
import com.alibaba.android.arouter.launcher.ARouter
import com.gh.common.exposure.ExposureManager
import com.gh.common.util.*
import com.gh.common.util.LogUtils
import com.gh.download.DownloadManager
@ -37,6 +38,8 @@ import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.eventbus.EBPackage
import com.gh.gamecenter.feature.entity.Badge
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.login.user.LoginTag
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.login.user.UserRepository
@ -71,6 +74,7 @@ class DefaultJsApi(
private var mDownloadWatcher: DataWatcher? = null // 下载观察者
private var mDownloadUrlSet: HashSet<String>? = null // 下载的 url 集合
private var mDownloadHandler: CompletionHandler<Any>? = null // 下载信息回调
private var mExposureEvent: ExposureEvent? = null // 活动曝光实体
init {
if (mFragment != null) {
@ -213,7 +217,7 @@ class DefaultJsApi(
VHelper.launch(context, packageName)
}
} else {
PackageUtils.launchApplicationByPackageName(context, packageName)
PackageLauncher.launchApp(context, packageName = packageName)
}
}
}
@ -624,6 +628,26 @@ class DefaultJsApi(
}
}
@JavascriptInterface
fun logExposure(event: Any) {
val simpleExposureEvent = event.toString().toObject() ?: SimpleExposureEvent()
if (simpleExposureEvent.id.isNotEmpty()) {
val exposureSource = ExposureSource("游戏活动", "${simpleExposureEvent.title}+${simpleExposureEvent.id}")
mExposureEvent = ExposureEvent.createEvent(
gameEntity = null,
source = arrayListOf(exposureSource),
)
ExposureManager.log(mExposureEvent!!)
}
}
/**
* 获取 ExposureEvent可能为空
*/
fun getExposureEvent(): ExposureEvent? {
return mExposureEvent
}
private fun autoUnregisterDownloadObserverIfNeeded(fragment: Fragment?) {
fragment?.parentFragmentManager?.registerFragmentLifecycleCallbacks(
object : FragmentManager.FragmentLifecycleCallbacks() {
@ -676,6 +700,9 @@ class DefaultJsApi(
@Keep
internal class TextShareEvent(var text: String = "", var type: String = "")
@Keep
internal class SimpleExposureEvent(var title: String = "", var id: String = "")
@Keep
internal class InviteFriendsEvent(
var type: String = "",

View File

@ -36,6 +36,7 @@ import com.gh.gamecenter.entity.SubjectRecommendEntity
import com.gh.gamecenter.entity.VideoLinkEntity
import com.gh.gamecenter.eventbus.EBSkip
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.utils.PlatformUtils
import com.gh.gamecenter.fragment.MainWrapperFragment
import com.gh.gamecenter.gamecollection.publish.GameCollectionEditActivity
@ -51,14 +52,21 @@ object DefaultUrlHandler {
@JvmStatic
fun interceptUrl(context: Context, url: String, entrance: String): Boolean {
return interceptUrl(context, url, entrance, false)
return interceptUrl(context, url, null, entrance, false)
}
/**
* 检查并拦截部分内部处理的 url
* @param traceEvent 供一些页面用于登记曝光来源的实体
* @param bringAppToFront 是否需要在不匹配 host 的时候把 APP 调回到前台 (如微信调起)
*
* @return 是否已拦截处理
*/
@JvmStatic
fun interceptUrl(context: Context, url: String, entrance: String, bringAppToFront: Boolean = false): Boolean {
fun interceptUrl(context: Context, url: String,
traceEvent: ExposureEvent? = null,
entrance: String,
bringAppToFront: Boolean = false): Boolean {
val uri = Uri.parse(url)
if ("ghzhushou" == uri.scheme) {
Utils.log("url = $url")
@ -82,6 +90,7 @@ object DefaultUrlHandler {
id = id,
tab = uri.getQueryParameter("to"),
autoDownload = uri.getQueryParameter("auto_download") == "true",
traceEvent = traceEvent,
entrance = entrance
)
@ -90,6 +99,7 @@ object DefaultUrlHandler {
id,
uri.getQueryParameter("name"),
false,
null,
entrance
)
@ -467,7 +477,7 @@ object DefaultUrlHandler {
}
EntranceConsts.HOST_GAME_COLLECTION_DETAIL -> {
DirectUtils.directToGameCollectionDetail(context, id, entrance)
DirectUtils.directToGameCollectionDetail(context, id, entrance, traceEvent = traceEvent)
}
EntranceConsts.HOST_GAME_COLLECTION_SQUARE -> {

View File

@ -20,7 +20,7 @@ object FixedRateJobHelper {
private const val CHECKER_PERIOD: Long = 15 * 1000L
private const val TIME_PERIOD: Long = 10 * 60 * 1000L
private const val LOGHUB_PERIOD: Long = 2 * 60 * 1000L
private const val EXPOSURE_PERIOD: Long = 5 * 60 * 1000L
private const val EXPOSURE_PERIOD: Long = 1 * 60 * 1000L
private const val REGION_SETTING_PERIOD: Long = 60 * 1000L
private const val VIDEO_RECORD_PERIOD: Long = 60 * 1000L

View File

@ -1,6 +1,7 @@
package com.gh.common.chain
import android.content.Context
import com.gh.common.xapk.XapkInstaller
import com.gh.download.server.BrowserInstallHelper
import com.gh.gamecenter.core.utils.EmptyCallback
import com.gh.gamecenter.feature.entity.GameEntity
@ -8,14 +9,15 @@ import com.gh.gamecenter.feature.entity.GameEntity
class BrowserInstallHandler : ChainHandler() {
override fun handleRequest(context: Context, gameEntity: GameEntity) {
BrowserInstallHelper.showBrowserInstallHintDialog(context, gameEntity.isVGame(), object : EmptyCallback {
override fun onCallback() {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
} else {
processEndCallback?.invoke(null)
}
BrowserInstallHelper.showBrowserInstallHintDialog(
context,
gameEntity.isVGame() || gameEntity.isSplitXApk()
) {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
} else {
processEndCallback?.invoke(null)
}
})
}
}
}

View File

@ -0,0 +1,27 @@
package com.gh.common.chain
import android.content.Context
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.feature.entity.GameEntity
class UnsupportedFeatureHandler : ChainHandler() {
override fun handleRequest(
context: Context, gameEntity: GameEntity
) {
if (shouldShowUnsupportedFeatureDialog()) {
DialogHelper.showUnsupportedFeatureDialog(context)
} else {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
} else {
processEndCallback?.invoke(null)
}
}
}
/**
* TODO 检查某个版本是否支持指定的功能
*/
private fun shouldShowUnsupportedFeatureDialog(): Boolean = false
}

View File

@ -205,9 +205,6 @@ public class Config {
// 加载完设置后刷新下
PackageHelper.initList();
// 初始化畅玩相关的东西
VHelper.init(HaloApp.getInstance());
}
@Nullable
@ -308,6 +305,26 @@ public class Config {
return mVSetting;
}
/**
* 请求网络数据,尝试刷新畅玩相关配置
*/
@SuppressLint("CheckResult")
public static void refreshVSettingEntity() {
RetrofitManager.getInstance()
.getVApi().getSettings(BuildConfig.VERSION_NAME, Build.VERSION.SDK_INT)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new BiResponse<VSetting>() {
@Override
public void onSuccess(VSetting data) {
mVSetting = data;
SPUtils.setString(Constants.SP_V_SETTINGS, GsonUtils.toJson(data));
VHelper.init(HaloApp.getInstance());
}
});
}
@Nullable
public static GameGuidePopupEntity getGameGuidePopupEntity() {
return mGameGuidePopupEntity;
@ -385,16 +402,7 @@ 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));
}
});
refreshVSettingEntity();
RetrofitManager.getInstance()
.getApi().getGameGuidePopup(Build.MANUFACTURER, Build.VERSION.RELEASE, Build.MODEL, channel, BuildConfig.VERSION_NAME)

View File

@ -1,5 +1,6 @@
package com.gh.common.databind;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
@ -29,6 +30,7 @@ import com.gh.common.chain.DownloadDialogHelperHandler;
import com.gh.common.chain.GamePermissionHandler;
import com.gh.common.chain.OverseaDownloadHandler;
import com.gh.common.chain.PackageCheckHandler;
import com.gh.common.chain.UnsupportedFeatureHandler;
import com.gh.common.chain.ValidateVSpaceHandler;
import com.gh.common.chain.VersionNumberHandler;
import com.gh.common.constant.Config;
@ -45,10 +47,12 @@ import com.gh.common.util.GameViewUtils;
import com.gh.common.util.LogUtils;
import com.gh.common.util.NewsUtils;
import com.gh.common.util.PackageInstaller;
import com.gh.common.util.PackageLauncher;
import com.gh.common.util.PackageUtils;
import com.gh.common.util.ReservationHelper;
import com.gh.download.DownloadManager;
import com.gh.download.dialog.DownloadDialog;
import com.gh.download.server.BrowserInstallHelper;
import com.gh.gamecenter.DownloadManagerActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.WebActivity;
@ -63,6 +67,7 @@ import com.gh.gamecenter.common.view.DrawableView;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.core.utils.MtaHelper;
import com.gh.gamecenter.core.utils.NumberUtils;
import com.gh.gamecenter.core.utils.ToastUtils;
import com.gh.gamecenter.databinding.KaifuDetailItemRowBinding;
import com.gh.gamecenter.feature.entity.ApkEntity;
import com.gh.gamecenter.feature.entity.CommunityVideoEntity;
@ -398,6 +403,7 @@ public class BindingAdapters {
}
ChainBuilder builder = new ChainBuilder();
builder.addHandler(new UnsupportedFeatureHandler());
builder.addHandler(new GamePermissionHandler());
builder.addHandler(new CheckStoragePermissionHandler());
builder.addHandler(new ValidateVSpaceHandler());
@ -410,7 +416,7 @@ public class BindingAdapters {
builder.addHandler(new CheckDownloadHandler());
builder.setProcessEndCallback(o -> {
download(progressBar, gameEntity, traceEvent, (boolean) o, entrance, location);
download(v.getContext(), progressBar, gameEntity, traceEvent, (boolean) o, entrance, location);
return null;
});
final ChainHandler chainHandler = builder.buildHandlerChain();
@ -419,6 +425,7 @@ public class BindingAdapters {
}
} else {
ChainBuilder builder = new ChainBuilder();
builder.addHandler(new UnsupportedFeatureHandler());
builder.addHandler(new GamePermissionHandler());
builder.addHandler(new CertificationHandler());
builder.addHandler(new VersionNumberHandler());
@ -447,7 +454,7 @@ public class BindingAdapters {
if (downloadEntity != null) {
File file = new File(downloadEntity.getPath());
if (!file.exists()) {
download(progressBar, gameEntity, traceEvent, false, entrance, location);
download(v.getContext(), progressBar, gameEntity, traceEvent, false, entrance, location);
return;
}
@ -457,11 +464,11 @@ public class BindingAdapters {
}
if (gameEntity.isVGame()) {
VHelper.installOrLaunch((AppCompatActivity) v.getContext(), gameEntity);
VHelper.installOrLaunch((AppCompatActivity) v.getContext(), gameEntity, null);
return;
}
PackageUtils.launchApplicationByPackageName(v.getContext(), gameEntity.getApk().get(0).getPackageName());
PackageLauncher.launchApp(v.getContext(), gameEntity, gameEntity.getApk().get(0).getPackageName());
} else {
DownloadDialog.showDownloadDialog(
v.getContext(),
@ -477,7 +484,7 @@ public class BindingAdapters {
DownloadEntity downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity);
if (gameEntity.isVGame()) {
VHelper.installOrLaunch(v.getContext(), gameEntity);
VHelper.installOrLaunch(v.getContext(), gameEntity, null);
return;
}
@ -673,12 +680,16 @@ public class BindingAdapters {
// 开始下载
private static void download(DownloadButton progressBar,
private static void download(Context context,
DownloadButton progressBar,
GameEntity gameEntity,
ExposureEvent traceEvent,
boolean isSubscribe,
String entrance,
String location) {
if (BrowserInstallHelper.shouldAutoSwitchAssistantInstall(gameEntity)) {
ToastUtils.toast(context.getString(R.string.unsupported_browser_install_hint));
}
String str = progressBar.getText().toString();
String method;
if (str.contains("更新")) {

View File

@ -4,6 +4,8 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.LayoutManager
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.gh.gamecenter.feature.exposure.ExposureEvent
import io.reactivex.functions.Consumer
@ -18,7 +20,7 @@ class ExposureListener(var fragment: Fragment, var exposable: IExposable) : Recy
Consumer(Throwable::printStackTrace)
)
}
var layoutManager: LinearLayoutManager? = null
var layoutManager: LayoutManager? = null
var visibleState: ExposureThrottleBus.VisibleState? = null
init {
@ -47,12 +49,28 @@ class ExposureListener(var fragment: Fragment, var exposable: IExposable) : Recy
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (layoutManager == null) layoutManager = recyclerView.layoutManager as LinearLayoutManager
layoutManager = recyclerView.layoutManager
layoutManager?.run {
visibleState =
ExposureThrottleBus.VisibleState(findFirstVisibleItemPosition(), findLastVisibleItemPosition())
throttleBus.postVisibleState(visibleState!!)
if (layoutManager != null) {
if (layoutManager is LinearLayoutManager) {
(layoutManager as LinearLayoutManager).run {
visibleState =
ExposureThrottleBus.VisibleState(findFirstVisibleItemPosition(), findLastVisibleItemPosition())
throttleBus.postVisibleState(visibleState!!)
}
} else if (layoutManager is StaggeredGridLayoutManager) {
(recyclerView.layoutManager as StaggeredGridLayoutManager).run {
val firstVisibleItemArray = IntArray(2)
val lastVisibleItemArray = IntArray(2)
findFirstVisibleItemPositions(firstVisibleItemArray)
findLastVisibleItemPositions(lastVisibleItemArray)
visibleState =
ExposureThrottleBus.VisibleState(firstVisibleItemArray.first(), lastVisibleItemArray.first())
throttleBus.postVisibleState(visibleState!!)
}
}
}
}

View File

@ -47,7 +47,7 @@ object ExposureManager {
fun log(eventList: List<ExposureEvent>) {
AppExecutor.logExecutor.execute {
for (event in eventList) {
if (!exposureCache.contains(event.id)) {
if (event != null && !exposureCache.contains(event.id)) {
exposureSet.add(event)
exposureCache.add(event.id)
} else {

View File

@ -48,6 +48,7 @@ object ExposureUtils {
}
if (!TextUtils.isEmpty(entity.id)) {
ExposureManager.log(exposureEvent)
ExposureManager.commitSavedExposureEvents(forcedUpload = true)
}
return exposureEvent
}

View File

@ -2,6 +2,7 @@ package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.R
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IAppProvider
@ -70,6 +71,10 @@ class AppProviderImpl : IAppProvider {
return HaloApp.getInstance().flavorProvider
}
override fun getFlavor(): String {
return BuildConfig.FLAVOR
}
override fun getIsBrandNewInstall(): Boolean {
return HaloApp.getInstance().isBrandNewInstall
}

View File

@ -15,7 +15,7 @@ class DefaultUrlHandlerProviderImpl : IDefaultUrlHandlerProvider {
entrance: String,
bringAppToFront: Boolean
): Boolean {
return DefaultUrlHandler.interceptUrl(context, url, entrance, bringAppToFront)
return DefaultUrlHandler.interceptUrl(context, url, null, entrance, bringAppToFront)
}
override fun init(context: Context?) {

View File

@ -0,0 +1,119 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.NewFlatLogUtils
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.entity.GameUpdateEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.provider.IDownloadButtonClickedProvider
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.packagehelper.PackageRepository
import com.lightgame.download.DownloadEntity
import com.lightgame.utils.Utils
@Route(path = RouteConsts.provider.downloadButtonClickedHandler, name = "DownloadButton点击事件暴露服务")
class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
override fun onClicked(downloadButton: DownloadButton) {
var gameId = ""
var gameName = ""
var gameCategory = ""
var gameTypeInChinese = ""
var downloadStatus = ""
var downloadStatusInChinese = ""
var gameSchemaType = ""
var packageName = ""
val boundedObject = downloadButton.getObject()
Utils.log("DownloadButtonClickedProviderImpl", "$downloadButton onClicked ${boundedObject?.javaClass}")
if (boundedObject != null) {
when (boundedObject) {
is GameEntity -> {
gameId = boundedObject.id
gameName = boundedObject.name ?: ""
gameCategory = boundedObject.category ?: ""
downloadStatus = if (boundedObject.isVGame()) {
"畅玩"
} else if (boundedObject.downloadStatus == "demo") {
"试玩"
} else {
"下载"
}
gameTypeInChinese = boundedObject.categoryChinese
downloadStatusInChinese = boundedObject.downloadStatusChinese
gameSchemaType = boundedObject.gameBitChinese
packageName = boundedObject.getUniquePackageName() ?: ""
}
is GameUpdateEntity -> {
gameId = boundedObject.id
gameName = boundedObject.name ?: ""
// 下载管理-更新页面,把下载状态都置为下载
downloadStatus = "下载"
gameTypeInChinese = boundedObject.categoryChinese
downloadStatusInChinese = boundedObject.downloadStatusChinese
packageName = boundedObject.packageName
}
is DownloadEntity -> {
gameId = boundedObject.gameId
gameName = boundedObject.name ?: ""
gameCategory = boundedObject.getGameCategory()
downloadStatus = if (boundedObject.isVGame()) "畅玩" else "下载"
packageName = boundedObject.packageName
}
}
// 上报 UI 状态为启动的点击事件 (样式为启动,或者文案包含启动都算能启动)
if (downloadButton.buttonStyle == DownloadButton.ButtonStyle.LAUNCH_OR_OPEN
|| downloadButton.text.contains("启动")) {
// boundedObject 里找不到游戏类型时,尝试从已安装列表中获取
if (gameCategory.isEmpty() && packageName.isNotEmpty()) {
gameCategory = PackageRepository.gameInstalled.find { it.packageName == packageName }?.category ?: ""
}
NewFlatLogUtils.logGameLaunchButtonClicked(
gameId = gameId,
gameName = gameName,
location = downloadButton.getWidgetBusinessName(),
gameCategory = gameCategory,
downloadStatus = downloadStatus
)
}
// 预约状态不上报
if (downloadButton.buttonStyle != DownloadButton.ButtonStyle.RESERVABLE
&& downloadButton.buttonStyle != DownloadButton.ButtonStyle.RESERVED
) {
// 上报神策点击事件
SensorsBridge.trackEvent(
"DownLoadbuttonClick",
"game_id", gameId,
"game_name", gameName,
"game_type", gameTypeInChinese,
"download_status", downloadStatusInChinese,
"button_name", downloadButton.text,
"game_schema_type", gameSchemaType,
"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
)
}
}
}
override fun init(context: Context?) {
// do nothing
}
}

View File

@ -9,7 +9,7 @@ import com.gh.gamecenter.manager.UpdateManager
@Route(path = RouteConsts.provider.updateManager, name = "UpdateManager暴露服务")
class UpdateManagerProviderImpl: IUpdateManagerProvider {
override fun checkUpdate(context: Context, isAutoCheck: Boolean, handler: Handler) {
override fun checkUpdate(context: Context, isAutoCheck: Boolean, handler: Handler?) {
UpdateManager.getInstance(context).checkUpdate(isAutoCheck, handler)
}

View File

@ -57,8 +57,7 @@ public class DataUtils {
return;
}
// 初始化 Sentry 约占用 90ms这里切换到子线程初始化
AppExecutor.getIoExecutor().execute(() -> initSentry(context, channel));
initSentry(context, channel);
}
private static void initSentry(Context context, String channel) {

View File

@ -24,6 +24,8 @@ import com.gh.vspace.VHelper;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.DownloadStatus;
import java.util.Objects;
/**
* Created by khy on 27/06/17.
* 详情下载工具类
@ -42,9 +44,7 @@ public class DetailDownloadUtils {
viewHolder.mMultiVersionDownloadTv.setVisibility(View.GONE);
}
if (viewHolder.gameEntity != null
&& Config.isShowDownload(viewHolder.gameEntity.getId())
&& !"光环助手".equals(viewHolder.gameEntity.getName())) {
if (viewHolder.gameEntity != null && Config.isShowDownload(viewHolder.gameEntity.getId()) && !"光环助手".equals(viewHolder.gameEntity.getName())) {
viewHolder.downloadBottom.setVisibility(View.VISIBLE);
} else {
viewHolder.downloadBottom.setVisibility(View.GONE);
@ -233,6 +233,13 @@ public class DetailDownloadUtils {
DownloadEntity downloadEntity = viewHolder.downloadEntity;
String xapkStatus = downloadEntity.getMeta().get(XapkInstaller.XAPK_UNZIP_STATUS);
if (XapkUnzipStatus.SUCCESS.name().equals(xapkStatus) && XapkInstaller.INSTANCE.isInstalling(downloadEntity.getPath())) {
viewHolder.mDownloadPb.setText("游戏安装中");
viewHolder.mDownloadPb.setProgress(100);
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);
return;
}
if (XapkUnzipStatus.UNZIPPING.name().equals(xapkStatus)) {
String percent = downloadEntity.getMeta().get(XapkInstaller.XAPK_UNZIP_PERCENT);
viewHolder.mDownloadPb.setText("游戏解压中 " + percent + "%");
@ -286,7 +293,7 @@ public class DetailDownloadUtils {
viewHolder.mDownloadPb.setText(R.string.launch);
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
} else {
if (SPUtils.getBoolean(Constants.SP_USE_BROWSER_TO_INSTALL)) {
if (SPUtils.getBoolean(Constants.SP_USE_BROWSER_TO_INSTALL) && !Objects.equals(Constants.XAPK_APKS_FORMAT, downloadEntity.getFormat())) {
viewHolder.mDownloadPb.setText(R.string.browser_install_install);
} else {
viewHolder.mDownloadPb.setText(R.string.install);
@ -307,13 +314,12 @@ public class DetailDownloadUtils {
}
}
} else {
if (SPUtils.getBoolean(Constants.SP_USE_BROWSER_TO_INSTALL)) {
if (SPUtils.getBoolean(Constants.SP_USE_BROWSER_TO_INSTALL) && !Objects.equals(Constants.XAPK_APKS_FORMAT, downloadEntity.getFormat())) {
viewHolder.mDownloadPb.setText(R.string.browser_install_install);
} else {
viewHolder.mDownloadPb.setText(R.string.install);
}
if (downloadEntity.isPluggable()
&& PackagesManager.isInstalled(downloadEntity.getPackageName())) {
if (downloadEntity.isPluggable() && PackagesManager.isInstalled(downloadEntity.getPackageName())) {
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_PLUGIN);
} else {
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);

View File

@ -51,6 +51,7 @@ import com.gh.gamecenter.game.columncollection.detail.ColumnCollectionDetailActi
import com.gh.gamecenter.game.commoncollection.detail.CommonCollectionDetailActivity
import com.gh.gamecenter.game.upload.GameSubmissionActivity
import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailActivity
import com.gh.gamecenter.gamecollection.hotlist.GameCollectionHotListActivity
import com.gh.gamecenter.gamecollection.square.GameCollectionSquareActivity
import com.gh.gamecenter.gamedetail.GameDetailFragment
import com.gh.gamecenter.gamedetail.fuli.kaifu.ServersCalendarActivity
@ -90,6 +91,7 @@ import org.greenrobot.eventbus.EventBus
import retrofit2.HttpException
import java.net.URLEncoder
import java.util.*
import kotlin.collections.ArrayList
import kotlin.math.roundToInt
/**
@ -219,8 +221,9 @@ object DirectUtils {
)
} else {
directToGameDetail(
context, linkEntity.link
?: "", BaseActivity.mergeEntranceAndPath(entrance, path)
context,
linkEntity.link ?: "",
entrance = BaseActivity.mergeEntranceAndPath(entrance, path)
)
}
}
@ -316,7 +319,7 @@ object DirectUtils {
)
}
"column_collection", "专题合集" -> directToColumnCollection(context, linkEntity.link!!, -1, entrance)
"column_collection", "专题合集" -> directToColumnCollection(context, linkEntity.link!!, -1, entrance, "", exposureEvent)
"server", "game_server", "开服表" -> directToGameServers(context, entrance, path, exposureEvent)
@ -338,7 +341,7 @@ object DirectUtils {
"feedback" -> directToFeedback(context, linkEntity.name, linkEntity.text, false, "", entrance)
"qa", "Q&A" -> directToQa(context, linkEntity.text ?: "", linkEntity.link ?: "")
"qa", "qa_content", "Q&A" -> directToQa(context, linkEntity.text ?: "", linkEntity.link ?: "")
"qa_collection", "Q&A合集" -> directToQaCollection(
context, linkEntity.text
@ -444,7 +447,7 @@ object DirectUtils {
context,
linkEntity.link ?: "",
entrance,
exposureEvent = exposureEvent
traceEvent = exposureEvent
)
"explore_column", "game_explore" -> context.startActivity(
@ -513,7 +516,8 @@ object DirectUtils {
id: String,
position: Int = -1,
entrance: String,
columnName: String = ""
columnName: String = "",
exposureEvent: ExposureEvent? = null
) {
if (id.isEmpty()) return
val bundle = Bundle()
@ -522,6 +526,9 @@ object DirectUtils {
bundle.putString(KEY_COLLECTION_ID, id)
bundle.putString(KEY_COLUMNNAME, columnName)
bundle.putInt(KEY_POSITION, position)
if (exposureEvent != null) {
bundle.putParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST ,ArrayList(exposureEvent.source))
}
jumpActivity(context, bundle)
}
@ -1877,7 +1884,9 @@ object DirectUtils {
entrance: String = "",
forumName: String = "",
gameCollectionTitle: String = "",
gameCollectionId: String = ""
gameCollectionId: String = "",
collectionName: String = "",
collectionId: String = ""
) {
val bundle = Bundle()
bundle.putString(KEY_TO, GameCollectionSquareActivity::class.java.name)
@ -1885,6 +1894,19 @@ object DirectUtils {
bundle.putString(KEY_FORUM_NAME, forumName)
bundle.putString(KEY_GAME_COLLECTION_TITLE, gameCollectionTitle)
bundle.putString(KEY_GAME_COLLECTION_ID, gameCollectionId)
bundle.putString(KEY_COLLECTION_ID, collectionId)
bundle.putString(KEY_COLLECTION_NAME, collectionName)
jumpActivity(context, bundle)
}
/**
* 跳转至游戏单热榜
*/
@JvmStatic
fun directToGameCollectionHotList(context: Context, entrance: String = "") {
val bundle = Bundle()
bundle.putString(KEY_TO, GameCollectionHotListActivity::class.java.name)
bundle.putString(KEY_ENTRANCE, entrance)
jumpActivity(context, bundle)
}
@ -1897,15 +1919,20 @@ object DirectUtils {
id: String,
entrance: String? = null,
path: String? = null,
exposureEvent: ExposureEvent? = null
traceEvent: ExposureEvent? = null,
) {
if (id.isEmpty()) return
val bundle = Bundle()
val exposureSourceList = traceEvent?.source
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)) }
if (exposureSourceList is ArrayList) {
bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, exposureSourceList)
} else if (exposureSourceList != null) {
bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureSourceList))
}
jumpActivity(context, bundle)
}

View File

@ -18,18 +18,20 @@ import com.gh.common.simulator.SimulatorDownloadManager
import com.gh.common.simulator.SimulatorGameManager
import com.gh.common.xapk.XapkInstaller
import com.gh.common.xapk.XapkInstaller.cancelUnzipTask
import com.gh.common.xapk.XapkInstaller.isInstalling
import com.gh.common.xapk.XapkUnzipStatus
import com.gh.download.DownloadManager
import com.gh.download.dialog.DownloadDialog
import com.gh.download.server.BrowserInstallHelper
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.AppExecutor
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.PluginLocation
@ -163,6 +165,8 @@ object DownloadItemUtils {
briefStyle: String? = null,
isShowRecommendStar: Boolean = false
) {
holder.gameDownloadBtn.putObject(gameEntity)
// 显示预约
if (gameEntity.isReservable) {
holder.multiVersionDownloadTv?.visibility = View.GONE
@ -263,18 +267,17 @@ object DownloadItemUtils {
}
}
} else if (gameEntity.getApk().size == 1) {
// 优先从下载管理获取 downloadEntity
var downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity)
// 找不到时,若类型为畅玩,尝试从畅玩数据库的快照中获取 downloadEntity。若存在代表游戏已下载并成功安装
if (downloadEntity == null && gameEntity.isVGame()) {
downloadEntity = VHelper.getVDownloadEntitySnapshot(gameEntity.id, gameEntity.getUniquePackageName())
}
// 还是找不到时,尝试从 gameEntity 里找已绑定的 downloadEntity
if (downloadEntity == null) {
val entryMap: ArrayMap<String, DownloadEntity> = gameEntity.getEntryMap()
val apkEntity = gameEntity.getApk()[0]
if (entryMap.isNotEmpty()) {
downloadEntity = entryMap[apkEntity.getPlatform()]
}
downloadEntity = gameEntity.getEntryMap().getOrDefault(gameEntity.getUniquePlatform(), null)
}
if (downloadEntity != null) {
@ -297,6 +300,25 @@ object DownloadItemUtils {
DownloadButton.ButtonStyle.LAUNCH_OR_OPEN
}
} else {
val xapkStatus = downloadEntity.meta[XapkInstaller.XAPK_UNZIP_STATUS]
if (XapkUnzipStatus.SUCCESS.name == xapkStatus && isInstalling(downloadEntity.path)) {
progress = 100
setText(R.string.installing)
buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL
return
}
if (XapkUnzipStatus.UNZIPPING.name == xapkStatus) {
val percent = downloadEntity.meta[XapkInstaller.XAPK_UNZIP_PERCENT]
progress = (java.lang.Float.valueOf(percent) * 10).toInt()
text = "$percent%"
buttonStyle = DownloadButton.ButtonStyle.XAPK_UNZIPPING
return
} else if (XapkUnzipStatus.FAILURE.name == xapkStatus) {
setText(R.string.install)
buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL
return
}
buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL
setText(R.string.install)
}
@ -307,6 +329,7 @@ object DownloadItemUtils {
DownloadButton.ButtonStyle.NORMAL
}
}
DownloadStatus.pause,
DownloadStatus.timeout,
DownloadStatus.neterror,
@ -317,9 +340,11 @@ object DownloadItemUtils {
buttonStyle = DownloadButton.ButtonStyle.NORMAL
setText(R.string.resume)
}
DownloadStatus.cancel -> {
GameUtils.setDownloadBtnStatus(context, gameEntity, downloadBtn, pluginLocation)
}
else -> {
// do nothing
}
@ -396,7 +421,7 @@ object DownloadItemUtils {
}
// 更改进度条和提示文本的状态
fun changeStatus(
private fun changeStatus(
context: Context,
holder: GameViewHolder,
downloadEntity: DownloadEntity,
@ -421,6 +446,7 @@ object DownloadItemUtils {
holder.gameDownloadBtn.text = downloadEntity.percent.toString() + "%"
}
}
DownloadStatus.waiting -> {
if (isMultiVersion) {
holder.gameDownloadTips?.visibility = View.VISIBLE
@ -429,6 +455,7 @@ object DownloadItemUtils {
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.WAITING
holder.gameDownloadBtn.text = context.getString(R.string.waiting)
}
DownloadStatus.pause,
DownloadStatus.timeout,
DownloadStatus.neterror,
@ -443,6 +470,7 @@ object DownloadItemUtils {
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.NORMAL
holder.gameDownloadBtn.text = context.getString(R.string.resume)
}
DownloadStatus.done -> {
if (isMultiVersion) {
holder.gameDownloadTips?.visibility = View.VISIBLE
@ -462,6 +490,7 @@ object DownloadItemUtils {
holder.gameDownloadBtn.progress = 1000
holder.gameDownloadBtn.setText(R.string.hundred_percent)
}
else -> {
holder.gameDownloadTips?.visibility = View.GONE
}
@ -592,13 +621,15 @@ object DownloadItemUtils {
refreshCallback: EmptyCallback?,
allStateClickCallback: EmptyCallback?
) {
// 为 downloadButton 添加游戏实体,供点击的时候上报用
downloadBtn.putObject(gameEntity)
val gamePermissionDialogFragment = (context as AppCompatActivity).supportFragmentManager.findFragmentByTag(
GamePermissionDialogFragment::class.java.name
) as GamePermissionDialogFragment?
gamePermissionDialogFragment?.dismissAllowingStateLoss()
if (SPUtils.getBoolean(Constants.SP_TEENAGER_MODE)) {
downloadBtn.setOnClickListener {
logDownloadButtonClick(gameEntity, downloadBtn)
DialogHelper.showDialog(
context,
"提示",
@ -618,7 +649,6 @@ object DownloadItemUtils {
if (gameEntity.isSpecialDownload()) {
val info = RegionSettingHelper.getGameSpecialDownloadInfo(gameEntity.id) ?: return
downloadBtn.setOnClickListener {
logDownloadButtonClick(gameEntity, downloadBtn)
DialogHelper.showDialog(
context,
"提示",
@ -659,14 +689,12 @@ object DownloadItemUtils {
ReservationHelper.reserve(
context,
gameEntity.id,
gameEntity.name ?: "",
object : EmptyCallback {
override fun onCallback() {
LogUtils.logReservation(gameEntity, traceEvent)
adapter?.notifyItemChanged(position)
refreshCallback?.onCallback()
}
})
gameEntity.name ?: ""
) {
LogUtils.logReservation(gameEntity, traceEvent)
adapter?.notifyItemChanged(position)
refreshCallback?.onCallback()
}
}
}
} else {
@ -708,16 +736,13 @@ 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
val isPlay = "play" == linkEntity!!.type // 是否为开始玩
if (isPlay) {
@ -734,7 +759,6 @@ object DownloadItemUtils {
}
} else if (gameEntity.getApk().size == 1) {
downloadBtn.setOnClickListener {
logDownloadButtonClick(gameEntity, downloadBtn)
val clickRunnable = EmptyCallback {
allStateClickCallback?.onCallback()
clickCallback?.onCallback()
@ -795,6 +819,7 @@ object DownloadItemUtils {
val apk = gameEntity.getApk().safelyGetInRelease(0) ?: return
if (str == context.getString(R.string.download)) {
ChainBuilder().apply {
addHandler(UnsupportedFeatureHandler())
addHandler(UpdateNewSimulatorHandler())
addHandler(GamePermissionHandler())
addHandler(BrowserInstallHandler())
@ -812,6 +837,7 @@ object DownloadItemUtils {
DataLogUtils.uploadGameLog(context, gameEntity.id, gameEntity.name, entrance)
} else if (str == context.getString(R.string.attempt)) {
ChainBuilder().apply {
addHandler(UnsupportedFeatureHandler())
addHandler(UpdateNewSimulatorHandler())
addHandler(GamePermissionHandler())
addHandler(BrowserInstallHandler())
@ -830,6 +856,7 @@ object DownloadItemUtils {
DataLogUtils.uploadGameLog(context, gameEntity.id, gameEntity.name, entrance)
} else if (str == context.getString(R.string.smooth)) {
ChainBuilder().apply {
addHandler(UnsupportedFeatureHandler())
addHandler(GamePermissionHandler())
addHandler(PackageCheckHandler())
addHandler(DownloadDialogHelperHandler())
@ -846,9 +873,6 @@ object DownloadItemUtils {
.buildHandlerChain()
?.handleRequest(context, gameEntity)
} else if (str.contains("")) {
if (entrance.contains("我的游戏")) {
MtaHelper.onEvent("我的游戏_启动", "插件化", gameEntity.name)
}
if (gameEntity.pluggableCollection != null) {
DownloadDialog.showDownloadDialog(context, gameEntity, traceEvent, entrance, location)
} else {
@ -913,42 +937,40 @@ object DownloadItemUtils {
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity)
return
}
if (entrance.contains("我的游戏")) {
MtaHelper.onEvent("我的游戏_启动", "启动", gameEntity.name)
}
PackageUtils.launchApplicationByPackageName(context, gameEntity.getApk()[0].packageName)
PackageLauncher.launchApp(context, gameEntity, gameEntity.getApk()[0].packageName)
} else if (str == context.getString(R.string.update)) {
if (entrance.contains("我的游戏")) {
MtaHelper.onEvent("我的游戏_启动", "更新", gameEntity.name)
}
if (gameEntity.isVGame()) {
VHelper.updateOrReDownload(gameEntity)
return
}
DownloadDialogHelper.findAvailableDialogAndShow(context, gameEntity, apk, object : EmptyCallback {
override fun onCallback() {
DialogUtils.checkDownload(
context,
apk.size,
gameEntity.id,
gameEntity.name
) { isSubscribe: Boolean ->
update(context, gameEntity, entrance, location, isSubscribe, traceEvent)
}
}
})
} else {
var downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity)
if (downloadEntity == null && gameEntity.getApk().size == 1) {
val entryMap: ArrayMap<String, DownloadEntity> = gameEntity.getEntryMap()
val apkEntity = gameEntity.getApk()[0]
if (entryMap.isNotEmpty()) {
downloadEntity = entryMap[apkEntity.getPlatform()]
DownloadDialogHelper.findAvailableDialogAndShow(context, gameEntity, apk) {
DialogUtils.checkDownload(
context,
apk.size,
gameEntity.id,
gameEntity.name
) { isSubscribe: Boolean ->
update(context, gameEntity, entrance, location, isSubscribe, traceEvent)
}
}
} else {
var downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity)
// 找不到时,若类型为畅玩,尝试从畅玩数据库的快照中获取 downloadEntity。若存在代表游戏已下载并成功安装
if (downloadEntity == null && gameEntity.isVGame()) {
downloadEntity = VHelper.getVDownloadEntitySnapshot(gameEntity.id, gameEntity.getUniquePackageName())
}
// 还是找不到时,尝试从 gameEntity 里找已绑定的 downloadEntity
if (downloadEntity == null) {
downloadEntity = gameEntity.getEntryMap().getOrDefault(gameEntity.getUniquePlatform(), null)
}
if (downloadEntity != null) {
val xapkStatus = downloadEntity.meta[XapkInstaller.XAPK_UNZIP_STATUS]
if (XapkUnzipStatus.SUCCESS.name == xapkStatus && isInstalling(downloadEntity.path)) {// 安装过程中避免重复点击
return
}
if (XapkUnzipStatus.UNZIPPING.name == xapkStatus) {
cancelUnzipTask(downloadEntity)
return
@ -957,9 +979,11 @@ object DownloadItemUtils {
context.getString(R.string.resume) -> {
DownloadManager.getInstance().resume(downloadEntity, true)
}
context.getString(R.string.waiting) -> {
Utils.toast(context, "最多只能同时下载三个任务,请稍等")
}
else -> {
DownloadManager.getInstance().pause(downloadEntity.url)
}
@ -980,7 +1004,7 @@ object DownloadItemUtils {
) {
if (gameEntity.getApk().isEmpty()) return
val msg = FileUtils.isCanDownload(context, gameEntity.getApk()[0].size)
val msg = FileUtils.isCanDownload(context, gameEntity.getApk()[0].size ?: "")
if (TextUtils.isEmpty(msg)) {
DownloadManager.createDownload(
context,
@ -991,7 +1015,13 @@ object DownloadItemUtils {
isSubscribe,
traceEvent
)
Utils.toast(context, gameEntity.name + "已加入下载队列")
ToastUtils.toast(gameEntity.name + "已加入下载队列")
if (BrowserInstallHelper.shouldAutoSwitchAssistantInstall(gameEntity)) {
val toast = context.getString(R.string.unsupported_browser_install_hint)
AppExecutor.uiExecutor.executeWithDelay({
ToastUtils.toast(toast)
}, 1000)
}
if (downloadBtn is DownloadButton) {
downloadBtn.text = "0%"
downloadBtn.buttonStyle = DownloadButton.ButtonStyle.DOWNLOADING_NORMAL
@ -1012,10 +1042,16 @@ object DownloadItemUtils {
isSubscribe: Boolean,
traceEvent: ExposureEvent?
) {
val msg = FileUtils.isCanDownload(context, gameEntity.getApk()[0].size)
val msg = FileUtils.isCanDownload(context, gameEntity.getApk()[0].size ?: "")
if (TextUtils.isEmpty(msg)) {
DownloadManager.createDownload(context, gameEntity, "插件化", entrance, location, isSubscribe, traceEvent)
Utils.toast(context, gameEntity.name + "已加入下载队列")
ToastUtils.toast(gameEntity.name + "已加入下载队列")
if (BrowserInstallHelper.shouldAutoSwitchAssistantInstall(gameEntity)) {
val toast = context.getString(R.string.unsupported_browser_install_hint)
AppExecutor.uiExecutor.executeWithDelay({
ToastUtils.toast(toast)
}, 1000)
}
if (downloadBtn is DownloadButton) {
downloadBtn.setText(R.string.downloading)
downloadBtn.buttonStyle = DownloadButton.ButtonStyle.DOWNLOADING_PLUGIN
@ -1045,9 +1081,11 @@ object DownloadItemUtils {
adapter?.notifyItemChanged(position)
refreshCallback?.onCallback()
}
PackageUtils.isCanPluggable(apkEntity) -> {
DialogHelper.showPluginDialog(context) { PackageInstaller.uninstall(context, path) }
DialogHelper.showPluginDialog(context, gameEntity.pluginDesc) { PackageInstaller.uninstall(context, path) }
}
else -> {
PackageInstaller.install(context, downloadEntity)
}
@ -1066,23 +1104,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

@ -16,7 +16,6 @@ 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.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.eventbus.EBDownloadStatus
@ -24,18 +23,13 @@ import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.SimulatorEntity
import com.gh.gamecenter.feature.utils.PlatformUtils
import com.gh.gamecenter.help.HelpAndFeedbackBridge
import com.gh.gamecenter.retrofit.RetrofitManager
import com.gh.gamecenter.pkg.PkgHelper
import com.gh.vspace.VHelper
import com.halo.assistant.HaloApp
import com.lightgame.download.*
import com.lightgame.utils.AppManager
import com.lightgame.utils.Utils
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import okhttp3.MediaType
import okhttp3.RequestBody
import org.greenrobot.eventbus.EventBus
import org.json.JSONObject
object DownloadObserver {
@ -45,7 +39,10 @@ object DownloadObserver {
// TODO 修复因为更改内存对象造成的双重下载完成事件问题,具体触发代码见 DownloadDao.updateSnapshotList
private var mDoneDebouncePair: Pair<String, Long>? = null
private const val TEA_EVENT_DOWNLOAD_COMPLETE = "game_addiction"
private const val TAG = "DownloadObserver"
private const val CORE_EVENT_DOWNLOAD_COMPLETE_LOGGED = "CORE_EVENT_DOWNLOAD_COMPLETE_LOGGED"
private val mRetryableHashMap = hashMapOf<String, Boolean>()
// 如果在WIFI状态下,下载自动暂停,则再重试一遍
@JvmStatic
@ -76,28 +73,34 @@ object DownloadObserver {
val currentActivity = AppManager.getInstance().currentActivity() ?: return
DialogHelper.showDialog(currentActivity, "下载失败", "下载链接已失效,建议提交反馈", "立即反馈", "取消", {
HelpAndFeedbackBridge.startSuggestionActivity(
currentActivity,
SuggestType.gameQuestion, "notfound",
StringUtils.buildString(downloadEntity.name, ",问题反馈:下载链接失效"),
SimpleGameEntity(gameId, downloadEntity.name, "")
)
}, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true))
DialogHelper.showDialog(
currentActivity,
"下载失败",
"下载链接已失效,建议提交反馈",
"立即反馈",
"取消",
{
HelpAndFeedbackBridge.startSuggestionActivity(
currentActivity,
SuggestType.gameQuestion, "notfound",
StringUtils.buildString(downloadEntity.name, ",问题反馈:下载链接失效"),
SimpleGameEntity(gameId, downloadEntity.name, "")
)
},
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) {
if (downloadEntity.meta[Constants.MARK_RETRY_DOWNLOAD].isNullOrEmpty()
|| DownloadStatus.diskisfull == downloadEntity.status
) {
if (mRetryableHashMap[downloadEntity.url] == true
&& NetworkUtils.isWifiConnected(HaloApp.getInstance().application)
) {
downloadEntity.meta[Constants.MARK_RETRY_DOWNLOAD] = downloadEntity.progress.toString()
downloadManager.updateDownloadEntity(downloadEntity)
downloadManager.resumeDownload(downloadEntity.url)
debugOnly {
Utils.log("DownloadObserver", "下载重试->" + downloadEntity.toJson())
}
mRetryableHashMap[downloadEntity.url] = false
Utils.log(TAG, "下载重试->" + downloadEntity.toJson())
} else {
if (DownloadStatus.diskisfull == downloadEntity.status) {
ToastUtils.toast("磁盘已满,请清理空间后重试下载")
@ -108,13 +111,10 @@ object DownloadObserver {
}
DataLogUtils.uploadNeterrorLog(mApplication, downloadEntity)
debugOnly {
Utils.log("DownloadObserver", "下载自动暂停->" + downloadEntity.toJson())
}
Utils.log(TAG, "下载自动暂停->" + downloadEntity.toJson())
}
} else if (DownloadStatus.redirected == downloadEntity.status) {
debugOnly { Utils.log("重定向完毕") }
Utils.log(TAG, "重定向完毕")
DownloadDataHelper.uploadRedirectEvent(downloadEntity)
} else if (DownloadStatus.unqualified == downloadEntity.status) {
// 未成年
@ -159,40 +159,35 @@ object DownloadObserver {
if (DownloadStatus.done == downloadEntity.status) {
if (mDoneDebouncePair?.first != downloadEntity.url) {
mDoneDebouncePair = Pair(downloadEntity.url, System.currentTimeMillis())
performDownloadCompleteAction(downloadEntity, gameId, downloadManager)
performDownloadCompleteAction(downloadEntity, downloadManager)
} else {
if (mDoneDebouncePair?.second == 0L
|| System.currentTimeMillis() - (mDoneDebouncePair?.second ?: 0) > 500
) {
performDownloadCompleteAction(downloadEntity, gameId, downloadManager)
performDownloadCompleteAction(downloadEntity, downloadManager)
}
}
}
if (downloadEntity.status == DownloadStatus.done) {
mRetryableHashMap.remove(downloadEntity.url)
EventBus.getDefault().post(EBDownloadStatus("done", "", "", "", downloadEntity.packageName, ""))
}
DownloadNotificationHelper.addOrUpdateDownloadNotification(downloadEntity)
// 如果已下载大小发生变化,表示成功恢复下载,则重置重试标记
if (downloadEntity.status == DownloadStatus.downloading &&
downloadEntity.progress.toString() != downloadEntity.meta[Constants.MARK_RETRY_DOWNLOAD]
) {
downloadEntity.meta[Constants.MARK_RETRY_DOWNLOAD] = ""
downloadManager.updateDownloadEntity(downloadEntity)
if (downloadEntity.status == DownloadStatus.downloading) {
mRetryableHashMap[downloadEntity.url] = true
}
}
}
// 添加观察者
DownloadManager.getInstance().addObserver(dataWatcher)
}
private fun performDownloadCompleteAction(
downloadEntity: DownloadEntity,
gameId: String,
downloadManager: DownloadManager
) {
if (downloadEntity.name.contains(mApplication.getString(R.string.app_name))) {
@ -210,10 +205,7 @@ object DownloadObserver {
} else {
statDoneEvent(downloadEntity)
if (!SPUtils.getBoolean(TEA_EVENT_DOWNLOAD_COMPLETE)) {
HaloApp.getInstance().flavorProvider.logEvent(TEA_EVENT_DOWNLOAD_COMPLETE)
SPUtils.setBoolean(TEA_EVENT_DOWNLOAD_COMPLETE, true)
}
logCoreEventIfNeeded(downloadEntity.getGameCategory())
GameActivityDownloadHelper.clear()
@ -226,13 +218,16 @@ object DownloadObserver {
EventBus.getDefault().post(
EBShowDialog(
BaseActivity.PLUGGABLE,
downloadEntity.path
downloadEntity.path,
downloadEntity.pluginDesc
)
)
downloadEntity.isPlugin -> Utils.toast(
mApplication,
downloadEntity.name + " - " + platform + " - 下载完成"
)
else -> {
if (!downloadEntity.isVGame()) {
Utils.toast(mApplication, downloadEntity.name + " - 下载完成")
@ -250,15 +245,10 @@ object DownloadObserver {
val gameName = downloadEntity.getMetaExtra(Constants.GAME_NAME)
if (simulatorJson.isEmpty()) return
var simulator = GsonUtils.fromJson(simulatorJson, SimulatorEntity::class.java)
val isInstalled = PackageUtils.isInstalledFromAllPackage(
HaloApp.getInstance().application,
simulator.apk?.packageName
)
val isInstalledNewSimulator =
SimulatorGameManager.isNewSimulatorInstalled(HaloApp.getInstance().application)
val isInstalledOldSimulator =
SimulatorGameManager.isOldSimulatorInstalled(HaloApp.getInstance().application)
// if (!isInstalled && !isInstalledNewSimulator) {
val currentActivity = AppManager.getInstance().currentActivity()
?: return
val newSimulator = Config.getNewSimulatorEntitySetting()
@ -269,7 +259,6 @@ object DownloadObserver {
currentActivity, simulator,
SimulatorDownloadManager.SimulatorLocation.LAUNCH, downloadEntity.gameId, gameName, null
)
// }
SimulatorGameManager.recordDownloadSimulatorGame(downloadEntity.gameId, simulator.type)
SimulatorGameManager.postPlayedGame(downloadEntity.gameId, downloadEntity.packageName)
} else {
@ -296,7 +285,8 @@ object DownloadObserver {
EventBus.getDefault().post(
EBShowDialog(
BaseActivity.PLUGGABLE,
downloadEntity.path
downloadEntity.path,
downloadEntity.pluginDesc
)
)
} else {
@ -392,7 +382,7 @@ object DownloadObserver {
"DownloadProcessFinish",
"game_id", downloadEntity.gameId,
"game_name", downloadEntity.meta[Constants.GAME_NAME] ?: "",
"game_type", downloadEntity.meta[Constants.GAME_TYPE] ?: "",
"game_type", downloadEntity.meta[Constants.GAME_CATEGORY_IN_CHINESE] ?: "",
"game_schema_type", if (downloadEntity.getMetaExtra(VHelper.KEY_BIT) == "32") "32位" else "64位",
"page_name", getCurrentPageEntity().pageName,
"page_id", getCurrentPageEntity().pageId,
@ -452,4 +442,21 @@ object DownloadObserver {
DataLogUtils.uploadHijack(mApplication, downloadEntity)
}
/**
* 根据预设的游戏类型上报关键事件(下载完成事件)
*/
private fun logCoreEventIfNeeded(gameCategory: String) {
val category = PkgHelper.getCoreEventGameCategory()
val categoryMatched = if (category == "standard" || category.isNullOrEmpty()) {
true
} else {
gameCategory == category
}
if (!SPUtils.getBoolean(CORE_EVENT_DOWNLOAD_COMPLETE_LOGGED) && categoryMatched) {
HaloApp.getInstance().flavorProvider.logCoreEvent()
SPUtils.setBoolean(CORE_EVENT_DOWNLOAD_COMPLETE_LOGGED, true)
}
}
}

View File

@ -15,6 +15,7 @@ import com.gh.common.simulator.SimulatorDownloadManager
import com.gh.common.simulator.SimulatorGameManager
import com.gh.download.DownloadManager
import com.gh.download.dialog.DownloadDialog
import com.gh.download.server.BrowserInstallHelper
import com.gh.gamecenter.R
import com.gh.gamecenter.WebActivity
import com.gh.gamecenter.common.constant.Constants
@ -26,6 +27,7 @@ import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.common.utils.observableToMain
import com.gh.gamecenter.common.utils.singleToMain
import com.gh.gamecenter.common.view.dsbridge.CompletionHandler
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.runOnUiThread
import com.gh.gamecenter.core.utils.EmptyCallback
import com.gh.gamecenter.core.utils.MtaHelper
@ -183,6 +185,12 @@ object GameActivityDownloadHelper {
str != context.getString(R.string.launch)
) {
ToastUtils.toast("${gameEntity.name}已加入下载队列")
if (BrowserInstallHelper.shouldAutoSwitchAssistantInstall(gameEntity)) {
val toast = context.getString(R.string.unsupported_browser_install_hint)
AppExecutor.uiExecutor.executeWithDelay({
ToastUtils.toast(toast)
}, 1000)
}
} else {
when {
str == context.getString(R.string.download) || str == context.getString(R.string.attempt) -> {
@ -205,6 +213,12 @@ object GameActivityDownloadHelper {
}
else -> {
ToastUtils.toast("${gameEntity.name}已加入下载队列")
if (BrowserInstallHelper.shouldAutoSwitchAssistantInstall(gameEntity)) {
val toast = context.getString(R.string.unsupported_browser_install_hint)
AppExecutor.uiExecutor.executeWithDelay({
ToastUtils.toast(toast)
}, 1000)
}
}
}
}
@ -348,7 +362,7 @@ object GameActivityDownloadHelper {
if (entrance.contains("我的游戏")) {
MtaHelper.onEvent("我的游戏_启动", "启动", gameEntity.name)
}
PackageUtils.launchApplicationByPackageName(context, gameEntity.getApk()[0].packageName)
PackageLauncher.launchApp(context, gameEntity, gameEntity.getApk()[0].packageName)
}
// 处理更新状态
@ -424,6 +438,12 @@ object GameActivityDownloadHelper {
), entrance, location, isSubscribe, traceEvent
)
ToastUtils.toast("${gameEntity.name}已加入下载队列")
if (BrowserInstallHelper.shouldAutoSwitchAssistantInstall(gameEntity)) {
val toast = context.getString(R.string.unsupported_browser_install_hint)
AppExecutor.uiExecutor.executeWithDelay({
ToastUtils.toast(toast)
}, 1000)
}
} else {
ToastUtils.toast(msg)
}
@ -443,6 +463,12 @@ object GameActivityDownloadHelper {
if (TextUtils.isEmpty(msg)) {
DownloadManager.createDownload(context, apk, gameEntity, "插件化", entrance, location, isSubscribe, traceEvent)
ToastUtils.toast("${gameEntity.name}已加入下载队列")
if (BrowserInstallHelper.shouldAutoSwitchAssistantInstall(gameEntity)) {
val toast = context.getString(R.string.unsupported_browser_install_hint)
AppExecutor.uiExecutor.executeWithDelay({
ToastUtils.toast(toast)
}, 1000)
}
} else {
ToastUtils.toast(msg)
}
@ -463,7 +489,7 @@ object GameActivityDownloadHelper {
gameEntity.getEntryMap().remove(apkEntity.getPlatform())
}
PackageUtils.isCanPluggable(apkEntity) -> {
DialogHelper.showPluginDialog(context) { PackageInstaller.uninstall(context, path) }
DialogHelper.showPluginDialog(context, gameEntity.pluginDesc) { PackageInstaller.uninstall(context, path) }
}
else -> {
PackageInstaller.install(context, downloadEntity)
@ -483,6 +509,12 @@ object GameActivityDownloadHelper {
) {
DownloadManager.createDownload(context, apk, gameEntity, "更新", entrance, location, isSubscribe, traceEvent)
ToastUtils.toast("${gameEntity.name}已加入下载队列")
if (BrowserInstallHelper.shouldAutoSwitchAssistantInstall(gameEntity)) {
val toast = context.getString(R.string.unsupported_browser_install_hint)
AppExecutor.uiExecutor.executeWithDelay({
ToastUtils.toast(toast)
}, 1000)
}
}
@SuppressLint("CheckResult")

View File

@ -8,6 +8,7 @@ import androidx.annotation.WorkerThread;
import com.gh.common.constant.Config;
import com.gh.common.simulator.SimulatorGameManager;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.feature.view.DownloadButton;
import com.gh.download.DownloadManager;
import com.gh.gamecenter.R;
@ -180,7 +181,8 @@ public class GameUtils {
if (gameEntity.isVGame()) {
return context.getString(R.string.smooth);
} else {
if ("smooth".equals(gameEntity.getDownloadStatus())) {
if (Constants.V_GAME.equals(gameEntity.getDownloadStatus())
|| Constants.V_GAME_32.equals(gameEntity.getDownloadStatus())) {
GameEntity.GameCategory gameCategory = gameEntity.getGameCategory();
if (gameCategory.equals(GameEntity.GameCategory.ONLINE_GAME)
|| gameCategory.equals(GameEntity.GameCategory.INTERNATIONAL_ONLINE_GAME)) {

View File

@ -786,7 +786,7 @@ public class LibaoUtils {
, "关闭", "启动游戏"
, () -> {
if (LibaoUtils.isAppInstalled(context, libaoEntity.getPackageName())) {
PackageUtils.launchApplicationByPackageName(context, libaoEntity.getPackageName());
PackageLauncher.launchApp(context, null, libaoEntity.getPackageName());
} else {
Utils.toast(context, "请安装游戏:" + libaoEntity.getGame().getName()
+ PlatformUtils.getInstance(context).getPlatformName(libaoEntity.getPlatform()) + "");

View File

@ -23,6 +23,9 @@ object NewFlatLogUtils {
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 KEY_GAME_CATEGORY = "game_category"
private const val KEY_DOWNLOAD_STATE = "download_state"
private const val KEY_LOCATION = "location"
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"
@ -118,7 +121,7 @@ object NewFlatLogUtils {
fun logHaloFunGameDetailJumpClick(downloadStatus: String, gameId: String) {
val json = json {
KEY_EVENT to "halo_fun_game_detail_jump_click"
"download_state" to downloadStatus
KEY_DOWNLOAD_STATE to downloadStatus
KEY_GAME_ID to gameId
parseAndPutMeta().invoke(this)
}
@ -684,7 +687,7 @@ object NewFlatLogUtils {
val json = json {
KEY_EVENT to "halo_self_publish_content"
"tab_name" to tabName
"location" to location
KEY_LOCATION to location
parseAndPutMeta().invoke(this)
}
log(json)
@ -1052,10 +1055,11 @@ object NewFlatLogUtils {
}
//游戏单广场浏览时长
fun logGameCollectSquareStayTime(interval: Long) {
fun logGameCollectSquareStayTime(interval: Long, source: String) {
val json = json {
KEY_EVENT to "game_collect_square_stay_time"
"interval" to interval
"source" to source
parseAndPutMeta().invoke(this)
}
log(json)
@ -1479,7 +1483,7 @@ object NewFlatLogUtils {
) {
val json = json {
KEY_EVENT to "game_detail_comment_tab_game_comment_click"
"location" to location
KEY_LOCATION to location
"tag" to tag
"filter_tag_name" to filter
"button" to button
@ -1521,7 +1525,7 @@ object NewFlatLogUtils {
) {
val json = json {
KEY_EVENT to "game_detail_comment_tab_game_comment_detail_click"
"location" to location
KEY_LOCATION to location
"tag" to tag
"filter_tag_name" to filter
"button" to button
@ -1623,7 +1627,7 @@ object NewFlatLogUtils {
val json = json {
"event" to "game_test_detail_game_category_click"
"tab_name" to tabName
"game_category" to gameCategory
KEY_GAME_CATEGORY to gameCategory
"game_test_start_type" to gameTestStartType
parseAndPutMeta().invoke(this)
}
@ -1658,7 +1662,7 @@ object NewFlatLogUtils {
val json = json {
"event" to "game_test_home_more_click"
"text" to text //右上角文案,包括:全部、更多
"location" to location //新游开测所处位置,包括:首页、版块
KEY_LOCATION to location //新游开测所处位置,包括:首页、版块
"block_id" to blockId //新游开测所处位置为“版块”上报版块ID
"block_name" to blockName //新游开测所处位置为“版块”,上报版块名称
"link_type" to linkType //右上角文案为“更多”时的链接类型
@ -1685,7 +1689,7 @@ object NewFlatLogUtils {
) {
val json = json {
"event" to "game_test_home_recommend_tag_click"
"location" to location //新游开测所处位置,包括:首页、版块
KEY_LOCATION to location //新游开测所处位置,包括:首页、版块
"block_id" to blockId //新游开测所处位置为“版块”上报版块ID
"block_name" to blockName //新游开测所处位置为“版块”,上报版块名称
"tag_id" to tagId //点击推荐标签的ID
@ -1733,7 +1737,7 @@ object NewFlatLogUtils {
) {
val json = json {
"event" to "game_test_home_view"
"location" to location //新游开测所处位置,包括:首页、版块
KEY_LOCATION to location //新游开测所处位置,包括:首页、版块
"block_id" to blockId //新游开测所处位置为“版块”上报版块ID
"block_name" to blockName //新游开测所处位置为“版块”,上报版块名称
"interval" to interval //内容在屏幕可见范围完整展示的时长
@ -1988,7 +1992,7 @@ object NewFlatLogUtils {
"type" to homeSubSlide.cardType
"text" to homeSubSlide.cardText
"count_num" to countNum
"location" to location
KEY_LOCATION to location
"link_type" to homeSubSlide.linkType
"link_id" to homeSubSlide.linkId
"link_text" to homeSubSlide.linkText
@ -2185,4 +2189,155 @@ object NewFlatLogUtils {
}
log(json, "event", false)
}
// 游戏单广场刷新
@JvmStatic
fun logGameCollectionSquareFlush(action: String, countNum: Int) {
val json = json {
KEY_EVENT to "game_list_square_flush"
"action" to action
"count_num" to countNum
parseAndPutMeta().invoke(this)
}
log(json)
}
// 游戏详情点击公告文章
@JvmStatic
fun logGameDetailNoticeClick(gameId: String, gameName: String, linkId: String, linkType: String, linkText: String) {
val json = json {
KEY_EVENT to "game_detail_notice_click"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
"link_id" to linkId
"link_type" to linkType
"link_text" to linkText
parseAndPutMeta().invoke(this)
}
log(json)
}
// 启动游戏(UI被点击)
fun logGameLaunchButtonClicked(
gameId: String,
gameName: String,
location: String,
gameCategory: String,
downloadStatus: String
) {
val json = json {
KEY_EVENT to "game_launch_button_click"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
KEY_LOCATION to location
KEY_GAME_CATEGORY to gameCategory
KEY_DOWNLOAD_STATE to downloadStatus
parseAndPutMeta().invoke(this)
}
log(json)
}
// 启动游戏(具体实现逻辑)
fun logGameLaunch(
gameId: String,
gameName: String,
gameCategory: String,
downloadStatus: String
) {
val json = json {
KEY_EVENT to "game_launch"
KEY_GAME_ID to gameId
KEY_GAME_NAME to gameName
KEY_GAME_CATEGORY to gameCategory
KEY_DOWNLOAD_STATE to downloadStatus
parseAndPutMeta().invoke(this)
}
log(json)
}
// 进入游戏单热榜
@JvmStatic
fun logGameCollectionHotListEnter(entrance: String) {
val json = json {
KEY_EVENT to "game_list_hot_rank_enter"
"entrance" to entrance
parseAndPutMeta().invoke(this)
}
log(json)
}
// 离开游戏单热榜
@JvmStatic
fun logGameCollectionHotListExit(interval: Long, tabName: String) {
val json = json {
KEY_EVENT to "game_list_hot_rank_exit"
"interval" to interval
"tab_name" to tabName
parseAndPutMeta().invoke(this)
}
log(json)
}
// 游戏热榜点击tab
@JvmStatic
fun logGameCollectionHotListTabClick(tabName: String, collectionId: String, collectionName: String) {
val json = json {
KEY_EVENT to "game_hot_rank_tab_click"
"tab_name" to tabName
"game_list_collection_id" to collectionId
"game_list_collection_name" to collectionName
parseAndPutMeta().invoke(this)
}
log(json)
}
// 游戏热榜tab浏览
@JvmStatic
fun logGameCollectionHotListTabView(interval: Int, tabName: String, collectionId: String, collectionName: String) {
val json = json {
KEY_EVENT to "game_hot_rank_tab_view"
"interval" to interval
"tab_name" to tabName
"game_list_collection_id" to collectionId
"game_list_collection_name" to collectionName
parseAndPutMeta().invoke(this)
}
log(json)
}
// 游戏单热榜点击
@JvmStatic
fun logGameCollectionHotListClick(tabName: String, collectionId: String, collectionName: String, text: String) {
val json = json {
KEY_EVENT to "game_list_hot_rank_click"
"tab_name" to tabName
"game_list_collection_id" to collectionId
"game_list_collection_name" to collectionName
"text" to text
parseAndPutMeta().invoke(this)
}
log(json)
}
// 游戏单合集点击
fun logGameListCollectionClick(
source: String,
blockName: String,
blockId: String,
collectionName: String,
collectionId: String,
text: String
) {
val json = json {
KEY_EVENT to "game_list_collection_click"
"source" to source
"block_name" to blockName
"block_id" to blockId
"game_list_collection_id" to collectionId
"game_list_collection_name" to collectionName
"text" to text
parseAndPutMeta().invoke(this)
}
log(json)
}
}

View File

@ -1657,13 +1657,22 @@ object NewLogUtils {
}
//进入游戏单广场
fun logEnterGameCollectionSquare(entrance: String, forumName: String = "", title: String = "", id: String = "") {
fun logEnterGameCollectionSquare(
entrance: String,
forumName: String = "",
gameCollectionTitle: String = "",
gameCollectionId: String = "",
collectionName: String = "",
collectionId: String = ""
) {
val json = json {
KEY_EVENT to "enter_game_collect_square"
KEY_ENTRANCE to entrance
"forum_name" to forumName
"game_collect_title" to title
"game_collect_id" to id
"game_collect_title" to gameCollectionTitle
"game_collect_id" to gameCollectionId
"game_list_collection_name" to collectionName
"game_list_collection_id" to collectionId
KEY_TIMESTAMP to System.currentTimeMillis() / 1000
parseAndPutMeta().invoke(this)
}
@ -1671,9 +1680,10 @@ object NewLogUtils {
}
//进入选择标签
fun logEnterGameCollectionTag() {
fun logEnterGameCollectionTag(source: String) {
val json = json {
KEY_EVENT to "enter_game_collect_tag_location"
"source" to source
KEY_TIMESTAMP to System.currentTimeMillis() / 1000
parseAndPutMeta().invoke(this)
}
@ -1681,11 +1691,12 @@ object NewLogUtils {
}
//筛选游戏单标签
fun logFilterGameCollectionTag(tagCategory: String, tagName: String) {
fun logFilterGameCollectionTag(tagCategory: String, tagName: String, source: String) {
val json = json {
KEY_EVENT to "filter_game_collect_tag"
"filter_tag_category" to tagCategory
"filter_tag_name" to tagName
"source" to source
KEY_TIMESTAMP to System.currentTimeMillis() / 1000
parseAndPutMeta().invoke(this)
}
@ -1693,9 +1704,10 @@ object NewLogUtils {
}
//点击安利墙卡片
fun logClickGameCollectionAmway() {
fun logClickGameCollectionAmway(tabName: String) {
val json = json {
KEY_EVENT to "click_game_collect_recommend_card"
"tab_name" to tabName
KEY_TIMESTAMP to System.currentTimeMillis() / 1000
parseAndPutMeta().invoke(this)
}

View File

@ -1,6 +1,7 @@
package com.gh.common.util
import android.app.Activity
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.net.Uri
@ -9,6 +10,7 @@ import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.FileProvider
import com.gh.common.dialog.InstallPermissionDialogFragment
import com.gh.common.xapk.XapkInstallReceiver
import com.gh.common.xapk.XapkInstaller
import com.gh.download.server.BrowserInstallHelper
import com.gh.gamecenter.BuildConfig
@ -118,7 +120,7 @@ object PackageInstaller {
}
} else {
if (isPluggin) {
DialogHelper.showPluginDialog(context) {
DialogHelper.showPluginDialog(context, downloadEntity?.pluginDesc) {
uninstall(context, pkgPath)
}
} else {
@ -142,6 +144,32 @@ object PackageInstaller {
context.startActivity(installIntent)
}
fun installMultiple(
context: Context,
pkgPath: String,
sessionId: Int = -1
) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
return
}
val installer = context.packageManager.packageInstaller
val session = installer.openSession(sessionId)
// 监听安装回调的组件可以是Activity、Service或者是BroadcastReceiver
val intent = Intent(context, XapkInstallReceiver::class.java)
.also {
it.putExtra(XapkInstallReceiver.KEY_PACKAGE_PATH, pkgPath)
}
val flags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_CANCEL_CURRENT
} else {
PendingIntent.FLAG_CANCEL_CURRENT
}
val pendingIntent = PendingIntent.getActivity(context, sessionId, intent, flags)
// 提交数据流并执行安装
session.commit(pendingIntent.intentSender)
}
/**
* 获取启动安装意图
*
@ -216,7 +244,8 @@ object PackageInstaller {
}
private fun getFileSuffixByFormat(format: String?): String {
return if (format == XapkInstaller.XAPK_EXTENSION_NAME) {
return if (format == Constants.XAPK_FORMAT
|| format == Constants.XAPK_APKS_FORMAT) {
XapkInstaller.XAPK_EXTENSION_NAME
} else {
"apk"

View File

@ -0,0 +1,54 @@
package com.gh.common.util
import android.content.Context
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.entity.GameInstall
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.packagehelper.PackageRepository
object PackageLauncher {
/*
* 启动应用
*/
@JvmStatic
fun launchApp(
context: Context,
gameEntity: GameEntity? = null,
packageName: String?
) {
if (packageName.isNullOrEmpty()) {
ToastUtils.toast("启动失败")
return
}
// 获取 GameInstall 实体,用于记录启动日志用
val gameInstall = if (gameEntity != null) {
GameInstall.transformGameInstall(gameEntity, packageName)
} else {
PackageRepository.gameInstalled.find { it.packageName == packageName }
}
if (gameInstall != null) {
NewFlatLogUtils.logGameLaunch(
gameId = gameInstall.id ?: "unknown",
gameName = gameInstall.name ?: "unknown",
gameCategory = gameInstall.category ?: "unknown",
downloadStatus = if (gameInstall.downloadStatus == "demo") "试玩" else "下载"
)
}
try {
val intent = context.applicationContext.packageManager.getLaunchIntentForPackage(packageName)
if (intent != null) {
context.startActivity(intent)
} else {
ToastUtils.toast("启动失败")
}
} catch (e: Exception) {
ToastUtils.toast( "启动失败")
}
}
}

View File

@ -746,9 +746,11 @@ public class PackageUtils {
}
/*
/**
* 启动应用
* 请使用 PackageLauncher.launchApp()
*/
@Deprecated
public static void launchApplicationByPackageName(Context context, String packageName) {
try {
Intent intent = context.getApplicationContext().getPackageManager().getLaunchIntentForPackage(packageName);

View File

@ -66,7 +66,7 @@ object RealNameHelper {
"game_name",
downloadEntity.name ?: "",
"game_type",
downloadEntity.meta[Constants.GAME_TYPE] ?: ""
downloadEntity.meta[Constants.GAME_CATEGORY_IN_CHINESE] ?: ""
)
val contentText = if (downloadEntity.status == DownloadStatus.done) {

View File

@ -0,0 +1,59 @@
package com.gh.common.xapk
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.content.pm.PackageInstaller
import android.os.Build
import android.os.Bundle
import androidx.annotation.RequiresApi
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
class XapkInstallReceiver : Activity() {
companion object {
const val KEY_PACKAGE_PATH = "package_path"
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
overridePendingTransition(0, 0)
handleIntent(this, intent)
}
private fun handleIntent(context: Context, intent: Intent) {
when (intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999)) {
PackageInstaller.STATUS_PENDING_USER_ACTION -> {
val installIntent = intent.getParcelableExtra<Intent>(Intent.EXTRA_INTENT)
if (installIntent != null) {
context.startActivity(installIntent)
updatePendingSessionInfoStatus(intent, XapkPendingSessionInfo.STATUS_PENDING_USER_ACTION)
finish()
}
}
PackageInstaller.STATUS_FAILURE,
PackageInstaller.STATUS_FAILURE_ABORTED,
PackageInstaller.STATUS_FAILURE_BLOCKED,
PackageInstaller.STATUS_FAILURE_CONFLICT,
PackageInstaller.STATUS_FAILURE_INCOMPATIBLE,
PackageInstaller.STATUS_FAILURE_INVALID,
PackageInstaller.STATUS_FAILURE_STORAGE -> {
updatePendingSessionInfoStatus(intent, XapkPendingSessionInfo.STATUS_INSTALL_CANCELED)
finish()
}
else -> {
updatePendingSessionInfoStatus(intent, XapkPendingSessionInfo.STATUS_INSTALL_SUCCESS)
finish()
}
}
}
private fun updatePendingSessionInfoStatus(intent: Intent, status: Int) {
val installPackagePath = intent.getStringExtra(KEY_PACKAGE_PATH)
if (!installPackagePath.isNullOrEmpty()) {
val pendingSessionInfo = XapkInstaller.getPendingSessionInfo(installPackagePath)
pendingSessionInfo?.updateStatus(status)
}
}
}

View File

@ -2,20 +2,34 @@ package com.gh.common.xapk
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.os.Build
import android.provider.Settings
import com.gh.common.constant.Config
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.R
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.utils.SentryHelper
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.xapk.XApkUnZipper
import com.gh.gamecenter.xapk.core.XApkFile
import com.gh.gamecenter.xapk.core.XApkUnZipCallback
import com.gh.gamecenter.xapk.core.XApkUnZipEntry
import com.gh.gamecenter.xapk.core.XApkUnZipOutputFactory
import com.gh.gamecenter.xapk.io.NonSplitApksOutput
import com.gh.gamecenter.xapk.io.OBBFileOutput
import com.gh.gamecenter.xapk.io.SplitApksOutput
import com.gh.gamecenter.xapk.io.XApkFileOutput
import com.gh.gamecenter.xapk.pi.IPackageInstaller
import com.gh.ndownload.NDataChanger
import com.halo.assistant.HaloApp
import com.lightgame.download.DownloadEntity
import com.lightgame.utils.Utils
import java.text.DecimalFormat
import java.io.File
import java.util.*
/**
@ -28,7 +42,8 @@ import java.util.*
* apk文件这解压的gh-files文件夹中
*/
@SuppressLint("StaticFieldLeak")
object XapkInstaller : IXapkUnzipListener {
object XapkInstaller : XApkUnZipCallback, XApkUnZipOutputFactory {
private const val XAPK_PACKAGE_PATH_TAG = "xapk_package_path"
const val XAPK_EXTENSION_NAME = "xapk"
@ -40,10 +55,19 @@ object XapkInstaller : IXapkUnzipListener {
const val XAPK_DATA_EXTENSION_NAME = "obb"
const val PACKAGE_EXTENSION_NAME = "apk"
private const val GUIDE_TYPE_MIUI_OPTIMIZATION = "miui_optimization"
private const val MIUI_OPTIMIZATION_WARNING_DIALOG_ENTRANCE = "MIUI优化关闭提示弹窗"
private var mContext = HaloApp.getInstance().application.applicationContext
// 是否需要开启特定线程处理
private val mXapkUnzipThreadMap = Collections.synchronizedMap(HashMap<String, XapkUnzipThread>())
private val mXApkUnZipper = XApkUnZipper(this)
.also {
it.registerCallback(this)
}
private val mDownloadEntityMap = Collections.synchronizedMap(HashMap<String, DownloadEntity>())
private val mPendingSessionInfoMap = HashMap<String, XapkPendingSessionInfo>()
// 按并行解压
@JvmStatic
@ -52,6 +76,35 @@ object XapkInstaller : IXapkUnzipListener {
val filePath = downloadEntity.path
if (XAPK_EXTENSION_NAME == filePath.getExtension()) {
if (MiuiUtils.isMiui() && !MiuiUtils.isMiuiOptimizationDisabled() && downloadEntity.format == Constants.XAPK_APKS_FORMAT) {// 小米手机开启miui以后需要引导用户关闭miui优化
DialogHelper.showMiuiOptimizationWarning(
context,
onHintClick = {
val guides = Config.getNewApiSettingsEntity()?.install
val miuiOptimizationGuide = guides?.guides?.findLast {
it.type == GUIDE_TYPE_MIUI_OPTIMIZATION
}
if (miuiOptimizationGuide != null) {
DirectUtils.directToLinkPage(
context,
miuiOptimizationGuide.link,
MIUI_OPTIMIZATION_WARNING_DIALOG_ENTRANCE,
""
)
}
},
onConfirmClick = {
if (SystemUtils.isDevelopmentSettingsEnabled(context)) {
context.startActivity(Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS))
it.dismiss()
} else {
ToastUtils.showToast(context.getString(R.string.miui_open_adb_hint))
}
}
)
return
}
unzipXapkFile(downloadEntity)
if (showUnzipToast) {
Utils.toast(mContext, "解压过程请勿退出光环助手!")
@ -63,122 +116,230 @@ 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
} else {
debugOnly {
Utils.log("unzip", "重复解压,该文件解压已在队列中")
}
}
mXApkUnZipper.unzip(
XApkUnZipEntry(
downloadEntity.path,
File(downloadEntity.path)
)
)
mDownloadEntityMap[downloadEntity.path] = downloadEntity
}
override fun onProgress(downloadEntity: DownloadEntity, unzipPath: String, unzipSize: Long, unzipProgress: Long) {
AppExecutor.uiExecutor.execute {
val df = DecimalFormat("#.0")
var percent = 0.0
tryCatchInRelease {
percent = df.format((unzipProgress / unzipSize.toFloat()) * 100).toDouble()
}
downloadEntity.meta[XAPK_UNZIP_PERCENT] = percent.toString()
downloadEntity.meta[XAPK_UNZIP_STATUS] = XapkUnzipStatus.UNZIPPING.name
@JvmStatic
fun cancelUnzipTask(downloadEntity: DownloadEntity) {
mXApkUnZipper.cancel(downloadEntity.path)
}
override fun onProgress(apk: XApkFile, progress: Float) {
val downloadEntity = mDownloadEntityMap[apk.file.path] ?: return
downloadEntity.meta[XAPK_UNZIP_PERCENT] = String.format("%.2f", progress * 100)
downloadEntity.meta[XAPK_UNZIP_STATUS] = XapkUnzipStatus.UNZIPPING.name
AppExecutor.ioExecutor.execute {
NDataChanger.notifyDataChanged(downloadEntity)
}
debugOnly {
Utils.log("unzip", "onProgress->" + (unzipProgress / unzipSize.toFloat()))
Utils.log("unzip", "onProgress->$progress")
}
}
override fun onNext(downloadEntity: DownloadEntity, unzipPath: String) {
if (PACKAGE_EXTENSION_NAME == unzipPath.getExtension()) {
downloadEntity.meta[XAPK_PACKAGE_PATH_TAG] = unzipPath
override fun onSuccess(apk: XApkFile, installer: IPackageInstaller) {
val downloadEntity = mDownloadEntityMap[apk.file.path] ?: return
downloadEntity.meta[XAPK_UNZIP_PERCENT] = "100.0"
downloadEntity.meta[XAPK_UNZIP_STATUS] = XapkUnzipStatus.SUCCESS.name
AppExecutor.ioExecutor.execute {
NDataChanger.notifyDataChanged(downloadEntity)
DownloadManager.getInstance().updateDownloadEntity(downloadEntity)
DownloadDataHelper.uploadDownloadStatusEvent(downloadEntity, "xapk解压成功")
}
debugOnly {
Utils.log("unzip", "onNext->$unzipPath")
Utils.log("unzip", "onSuccess->${downloadEntity.path}")
}
installer.install(mContext)
}
/**
* 取消解压回调
*
* 取消后的表现与下载完成一致
*/
override fun onCancel(downloadEntity: DownloadEntity) {
mXapkUnzipThreadMap.remove(downloadEntity.path)
override fun onError(apk: XApkFile, exception: Throwable) {
val downloadEntity = mDownloadEntityMap[apk.file.path] ?: return
downloadEntity.meta[XAPK_UNZIP_STATUS] = XapkUnzipStatus.FAILURE.name
AppExecutor.uiExecutor.execute {
downloadEntity.meta[XAPK_UNZIP_PERCENT] = "0.0"
downloadEntity.meta[XAPK_UNZIP_STATUS] = XapkUnzipStatus.CANCEL.name
NDataChanger.notifyDataChanged(downloadEntity)
DownloadManager.getInstance().updateDownloadEntity(downloadEntity)
}
}
override fun onFailure(downloadEntity: DownloadEntity, exception: Exception) {
mXapkUnzipThreadMap.remove(downloadEntity.path)
AppExecutor.uiExecutor.execute {
downloadEntity.meta[XAPK_UNZIP_STATUS] = XapkUnzipStatus.FAILURE.name
AppExecutor.ioExecutor.execute {
DownloadNotificationHelper.addOrUpdateDownloadNotification(downloadEntity)
NDataChanger.notifyDataChanged(downloadEntity)
DownloadManager.getInstance().updateDownloadEntity(downloadEntity)
}
// 仅官网渠道上报 XAPK 异常信息
if (HaloApp.getInstance().channel == "GH_206") {
SentryHelper.onEvent(
"XAPK_UNZIP_ERROR",
"gameName", downloadEntity.name,
"errorDigest", exception.localizedMessage
)
}
// 仅官网渠道上报 XAPK 异常信息
if (HaloApp.getInstance().channel == "GH_206") {
SentryHelper.onEvent(
"XAPK_UNZIP_ERROR",
"gameName", downloadEntity.name,
"errorDigest", exception.localizedMessage
)
DownloadDataHelper.uploadDownloadStatusEvent(downloadEntity, "xapk解压失败")
}
DownloadDataHelper.uploadDownloadStatusEvent(downloadEntity, "xapk解压失败")
debugOnly {
Utils.log("unzip", "onFailure->$exception")
}
}
override fun onSuccess(downloadEntity: DownloadEntity) {
mXapkUnzipThreadMap.remove(downloadEntity.path)
AppExecutor.uiExecutor.execute {
val pkgPath = downloadEntity.meta[XAPK_PACKAGE_PATH_TAG]
if (pkgPath == null) {
Utils.toast(mContext, "下载出错,请重新下载!")
return@execute
}
PackageInstaller.install(mContext, downloadEntity.isPlugin, pkgPath, downloadEntity)
downloadEntity.meta[XAPK_UNZIP_PERCENT] = "100.0"
downloadEntity.meta[XAPK_UNZIP_STATUS] = XapkUnzipStatus.SUCCESS.name
override fun onCancel(apk: XApkFile) {
val downloadEntity = mDownloadEntityMap.remove(apk.file.path) ?: return
downloadEntity.meta[XAPK_UNZIP_PERCENT] = "0.0"
downloadEntity.meta[XAPK_UNZIP_STATUS] = XapkUnzipStatus.CANCEL.name
AppExecutor.ioExecutor.execute {
NDataChanger.notifyDataChanged(downloadEntity)
DownloadManager.getInstance().updateDownloadEntity(downloadEntity)
}
}
DownloadDataHelper.uploadDownloadStatusEvent(downloadEntity, "xapk解压成功")
override fun onNext(apk: XApkFile, fileName: String) {
debugOnly {
Utils.log("unzip", "onSuccess->${downloadEntity.path}")
Utils.log("unzip", "onNext->$fileName")
}
}
@JvmStatic
fun cancelUnzipTask(downloadEntity: DownloadEntity) {
val xapkUnzipThread = mXapkUnzipThreadMap[downloadEntity.path]
if (xapkUnzipThread != null) {
xapkUnzipThread.canceled = true
fun getPendingSessionInfo(packagePath: String): XapkPendingSessionInfo? = mPendingSessionInfoMap[packagePath]
fun isInstalling(packagePath: String): Boolean = mPendingSessionInfoMap.containsKey(packagePath)
/**
* 通知XAPK安装完成
*/
fun onInstalled(packagePath: String) {
val downloadEntity = mDownloadEntityMap.remove(packagePath) ?: return
mPendingSessionInfoMap.remove(packagePath)
downloadEntity.meta[XAPK_UNZIP_PERCENT] = "100.0"
downloadEntity.meta[XAPK_UNZIP_STATUS] = XapkUnzipStatus.INSTALLED.name
AppExecutor.ioExecutor.execute {
NDataChanger.notifyDataChanged(downloadEntity)
DownloadManager.getInstance().updateDownloadEntity(downloadEntity)
DownloadDataHelper.uploadDownloadStatusEvent(downloadEntity, "xapk安装成功")
}
}
fun onInstallCanceled(packagePath: String) {
val downloadEntity = mDownloadEntityMap.remove(packagePath) ?: return
mPendingSessionInfoMap.remove(packagePath)
downloadEntity.meta[XAPK_UNZIP_PERCENT] = "0.0"
downloadEntity.meta[XAPK_UNZIP_STATUS] = XapkUnzipStatus.CANCEL.name
AppExecutor.ioExecutor.execute {
NDataChanger.notifyDataChanged(downloadEntity)
DownloadManager.getInstance().updateDownloadEntity(downloadEntity)
DownloadDataHelper.uploadDownloadStatusEvent(downloadEntity, "xapk安装取消")
}
}
/**
* 更新当前XAPK安装状态, 主要针对以下出现安装结果回调异常的情况:
* 1. 用户触碰安装弹窗(原生Android系统)区域外导致安装取消
*/
fun updateCurrentInstallStatus() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP || mPendingSessionInfoMap.isEmpty()) {
return
}
val updateList = mutableListOf<XapkPendingSessionInfo>()
for (pendingSessionInfoEntry in mPendingSessionInfoMap) {
val pendingSessionInfo = pendingSessionInfoEntry.value
if (pendingSessionInfo.getStatus() == XapkPendingSessionInfo.STATUS_PENDING_USER_ACTION) {// 用户触摸安装弹窗外部区域取消安装后,更新安装状态
val installer = mContext.packageManager.packageInstaller
val sessionId = pendingSessionInfo.sessionId
if (sessionId != -1) {
val sessionInfo = installer.getSessionInfo(sessionId)
// 表示用户点击了安装弹窗外部区域
if (sessionInfo == null) {
pendingSessionInfo.updateStatus(XapkPendingSessionInfo.STATUS_INSTALL_CANCELED)
} else if (sessionInfo.progress <= 0.8F) {
AppExecutor.ioExecutor.execute {
installer.abandonSession(sessionInfo.sessionId)
}
pendingSessionInfo.updateStatus(XapkPendingSessionInfo.STATUS_INSTALL_CANCELED)
}
}
}
val installStatus = pendingSessionInfo.getStatus()
if (installStatus == XapkPendingSessionInfo.STATUS_INSTALL_CANCELED
|| installStatus == XapkPendingSessionInfo.STATUS_INSTALL_SUCCESS
) {
updateList.add(pendingSessionInfo)
}
}
for (pendingSessionInfo in updateList) {
val downloadEntity = mDownloadEntityMap[pendingSessionInfo.path] ?: continue
val installStatus = pendingSessionInfo.getStatus()
if (installStatus == XapkPendingSessionInfo.STATUS_INSTALL_SUCCESS) {
onInstalled(downloadEntity.path)
} else if (installStatus == XapkPendingSessionInfo.STATUS_INSTALL_CANCELED) {
onInstallCanceled(downloadEntity.path)
}
}
}
override fun onCreateOBBOutput(apk: XApkFile): XApkFileOutput<Unit> {
return OBBFileOutput()
}
override fun onCreateApkOutput(apk: XApkFile): XApkFileOutput<IPackageInstaller> {
val isMultiApks = apk.manifest.isMultiApks
return if (isMultiApks) {
SplitApksOutput(mContext.applicationContext) {
SplitApksInstaller(apk, it)
}
} else {
onCancel(downloadEntity) // 刷新页面
NonSplitApksOutput {
NonSplitApkInstaller(apk, it)
}
}
}
private class SplitApksInstaller(
private val xApkFile: XApkFile,
private val sessionId: Int,
) : IPackageInstaller {
override fun install(context: Context) {
val applicationContext = context.applicationContext
val downloadEntity = mDownloadEntityMap[xApkFile.file.path] ?: return
mPendingSessionInfoMap[downloadEntity.path] = XapkPendingSessionInfo(downloadEntity.path, sessionId)
AppExecutor.ioExecutor.execute {// 有可能卡顿造成anr
PackageInstaller.installMultiple(applicationContext, downloadEntity.path, sessionId)
NDataChanger.notifyDataChanged(downloadEntity)
}
}
}
private class NonSplitApkInstaller(
private val xApkFile: XApkFile,
private val file: File
) : IPackageInstaller {
override fun install(context: Context) {
val downloadEntity = mDownloadEntityMap[xApkFile.file.path] ?: return
PackageInstaller.install(
context,
downloadEntity.isPlugin,
file.absolutePath,
downloadEntity
)
}
}
}
@ -187,5 +348,6 @@ enum class XapkUnzipStatus(status: String) {
UNZIPPING("unzipping"),
SUCCESS("success"),
CANCEL("cancel"),
INSTALLED("installed"),
FAILURE("failure");
}

View File

@ -0,0 +1,21 @@
package com.gh.common.xapk
class XapkPendingSessionInfo(
val path: String,
val sessionId: Int = -1
) {
companion object {
const val STATUS_INIT = -1
const val STATUS_PENDING_USER_ACTION = 0
const val STATUS_INSTALL_SUCCESS = 1
const val STATUS_INSTALL_CANCELED = 2
}
private var status = STATUS_INIT
internal fun updateStatus(status: Int) {
this.status = status
}
fun getStatus(): Int = status
}

View File

@ -23,9 +23,6 @@ import org.json.JSONObject
object DownloadDataHelper {
private const val TAG = "DownloadDataHelper"
private const val DOWNLOAD_SPEED_TIME = "download_speed_time"
private const val DOWNLOAD_SPEED_SIZE = "download_speed_size"
const val DOWNLOAD_RESUME_WAY = "download_resume_way"
const val DOWNLOAD_RESUME_MANUAL = "manual"
const val DOWNLOAD_RESUME_AUTO = "auto"
@ -34,8 +31,6 @@ object DownloadDataHelper {
const val DOWNLOAD_CANCEL_MANUAL = "manual"
const val DOWNLOAD_CANCEL_AUTO = "auto"
const val DOWNLOAD_FIRST_START = "download_first_start"
const val DOWNLOAD_THREAD_SIZE = "download_thread_size" // 线程数量0为传统单线程模式; 1为多线程的单线程; >1为多线程的实际线程数量
private val mDownloadSpeedMap = HashMap<String, MutableList<Long>>()
@ -128,7 +123,7 @@ object DownloadDataHelper {
payloadObject.put("package", downloadEntity.packageName)
payloadObject.put("certification", RealNameHelper.getCertificationStatus())
payloadObject.put("filename", getFileName(downloadEntity))
payloadObject.put("task_num", NDataChanger.downloadingTasks.size)
payloadObject.put("task_num", NDataChanger.downloadingTaskUrlSet.size)
jsonObject.put("payload", payloadObject)
} catch (e: Exception) {
e.printStackTrace()
@ -140,26 +135,28 @@ object DownloadDataHelper {
@JvmStatic
fun uploadDownloadEvent(downloadEntity: DownloadEntity) {
val downloadSimpleEntity = DownloadDataSimpleHelper.getDownloadDataSimpleEntity(downloadEntity.url)
if (downloadEntity.status != DownloadStatus.downloading) {
uploadDownloadStatusEvent(downloadEntity)
}
if (downloadEntity.status == DownloadStatus.downloading) {
val startupTime = downloadEntity.meta[DownloadEntity.DOWNLOAD_STARTUP_TIME_KEY]
val startupTime =
downloadSimpleEntity?.downloadStartUpTime
if (startupTime != null) {
uploadDownloadStartupTimeEvent(downloadEntity, startupTime.toInt())
downloadEntity.meta.remove(DownloadEntity.DOWNLOAD_STARTUP_TIME_KEY)
DownloadManager.getInstance().updateDownloadEntity(downloadEntity)
uploadDownloadStartupTimeEvent(downloadEntity, startupTime)
DownloadDataSimpleHelper.updateDownloadDataSimpleEntity(downloadEntity.url, downloadStartUpTime = null)
}
}
if (downloadEntity.status == DownloadStatus.downloading || downloadEntity.status == DownloadStatus.done) {
val time = downloadEntity.meta[DOWNLOAD_SPEED_TIME]
val size = downloadEntity.meta[DOWNLOAD_SPEED_SIZE]
val time = downloadSimpleEntity?.downloadSpeedTime
val size = downloadSimpleEntity?.downloadSpeedSize
if (downloadEntity.speed == 0L || time == null || size == null) {
downloadEntity.meta[DOWNLOAD_SPEED_TIME] = System.currentTimeMillis().toString()
downloadEntity.meta[DOWNLOAD_SPEED_SIZE] = downloadEntity.progress.toString()
DownloadManager.getInstance().updateDownloadEntity(downloadEntity)
val currentTime = System.currentTimeMillis()
val currentProgress = downloadEntity.progress
DownloadDataSimpleHelper.updateDownloadDataSimpleEntity(downloadEntity.url, downloadSpeedTime = currentTime, downloadSpeedSize = currentProgress)
} else {
val offset = System.currentTimeMillis() - time.toLong()
if (offset > 5000) {
@ -180,15 +177,15 @@ object DownloadDataHelper {
}
}
}
downloadEntity.meta[DOWNLOAD_SPEED_TIME] = System.currentTimeMillis().toString()
downloadEntity.meta[DOWNLOAD_SPEED_SIZE] = downloadEntity.progress.toString()
DownloadManager.getInstance().updateDownloadEntity(downloadEntity)
val currentTime = System.currentTimeMillis()
val currentProgress = downloadEntity.progress
DownloadDataSimpleHelper.updateDownloadDataSimpleEntity(downloadEntity.url, downloadSpeedTime = currentTime, downloadSpeedSize = currentProgress)
}
}
}
}
private fun uploadDownloadStartupTimeEvent(downloadEntity: DownloadEntity, startupTime: Int) {
private fun uploadDownloadStartupTimeEvent(downloadEntity: DownloadEntity, startupTime: Long) {
val jsonObject = JSONObject()
try {
@ -214,7 +211,7 @@ object DownloadDataHelper {
payloadObject.put("certification", RealNameHelper.getCertificationStatus())
payloadObject.put("filename", getFileName(downloadEntity))
payloadObject.put("launch_ms", startupTime)
payloadObject.put("task_num", NDataChanger.downloadingTasks.size)
payloadObject.put("task_num", NDataChanger.downloadingTaskUrlSet.size)
if (parallel != null) {
payloadObject.put("parallel", parallel)
}
@ -276,11 +273,11 @@ object DownloadDataHelper {
payloadObject.put("speed", speed)
}
} else {
payloadObject.put("task_num", NDataChanger.downloadingTasks.size)
payloadObject.put("task_num", NDataChanger.downloadingTaskUrlSet.size)
}
payloadObject.put("completed_size", downloadEntity.progress / 1024 / 1024)
if (downloadEntity.status == DownloadStatus.resume) {
if (downloadEntity.meta[DOWNLOAD_FIRST_START] == "YES") {
if (DownloadDataSimpleHelper.getDownloadDataSimpleEntity(downloadEntity.url)?.isFirstTimeDownload == true) {
payloadObject.put("is_first_start", true)
} else {
payloadObject.put("is_first_start", false)
@ -288,8 +285,7 @@ object DownloadDataHelper {
}
if (downloadEntity.status == DownloadStatus.resume || downloadEntity.status == DownloadStatus.add) {
downloadEntity.meta[DOWNLOAD_FIRST_START] = "NO"
DownloadManager.getInstance().updateDownloadEntity(downloadEntity)
DownloadDataSimpleHelper.updateDownloadSimpleEntityFirstTimeDownload(downloadEntity.url, false)
}
jsonObject.put("payload", payloadObject)
} catch (e: Exception) {
@ -329,7 +325,7 @@ object DownloadDataHelper {
if (parallel != null) {
payloadObject.put("parallel", parallel)
}
payloadObject.put("task_num", NDataChanger.downloadingTasks.size)
payloadObject.put("task_num", NDataChanger.downloadingTaskUrlSet.size)
jsonObject.put("payload", payloadObject)
} catch (e: Exception) {
e.printStackTrace()
@ -342,7 +338,7 @@ object DownloadDataHelper {
/**
* 分片检测下载进度,每隔15秒内记录一次,60秒上传一次
*
* 请见:https://gitlab.ghzs.com/stats/stats-issues/-/issues/188#note_66919
* 请见:https://git.shanqu.cc/stats/stats-issues/-/issues/188#note_66919
*/
fun uploadDownloadHeartbeat(upload: Boolean) {
val allDownloadEntity = DownloadManager.getInstance().allDownloadEntity
@ -352,7 +348,8 @@ object DownloadDataHelper {
* 在后台唤醒的情况下 下载状态可能无法修正
* see [DownloadManager.initDownloadService]
*/
if (downloadEntity.status == DownloadStatus.downloading && NDataChanger.downloadingTasks[downloadEntity.url] != null) {
if (downloadEntity.status == DownloadStatus.downloading
&& NDataChanger.downloadingTaskUrlSet.contains(downloadEntity.url)) {
var sheet = mDownloadHeartbeatSheet[downloadEntity.url]
if (sheet == null) {
sheet = JSONObject()

View File

@ -0,0 +1,60 @@
package com.gh.download
import android.content.Context
import android.content.SharedPreferences
import com.gh.gamecenter.common.HaloApp
import com.gh.gamecenter.common.utils.toJsonIgnoredNull
import com.gh.gamecenter.common.utils.toObject
import com.gh.gamecenter.core.utils.SPUtils
/**
* 用来简单保存/获取下载时一些额外信息的辅助类,避免下载时反复修改原始下载实体的糟糕操作
* 使用 SP 来实现,只适用于相对较为低频的调用
*/
object DownloadDataSimpleHelper {
private val mSp: SharedPreferences by lazy {
HaloApp.getInstance().getSharedPreferences("DownloadDataSimpleDao", Context.MODE_PRIVATE)
}
fun getDownloadDataSimpleEntity(url: String): DownloadDataSimpleEntity? {
return mSp.getString(url, "")?.toObject()
}
fun updateDownloadDataSimpleEntity(
url: String,
downloadStartUpTime: Long? = null,
downloadSpeedTime: Long? = null,
downloadSpeedSize: Long? = null,
) {
val entity = getDownloadDataSimpleEntity(url) ?: DownloadDataSimpleEntity()
entity.downloadStartUpTime = downloadStartUpTime
entity.downloadSpeedTime = downloadSpeedTime
entity.downloadSpeedSize = downloadSpeedSize
SPUtils.setString(mSp, url, entity.toJsonIgnoredNull())
}
fun updateDownloadSimpleEntityFirstTimeDownload(url: String, isFirstTimeDownload: Boolean) {
val entity = getDownloadDataSimpleEntity(url) ?: DownloadDataSimpleEntity()
entity.isFirstTimeDownload = isFirstTimeDownload
SPUtils.setString(mSp, url, entity.toJsonIgnoredNull())
}
fun removeDownloadSimpleEntity(url: String) {
SPUtils.remove(mSp, url)
}
}
class DownloadDataSimpleEntity(
var downloadStartUpTime: Long? = null,
var downloadSpeedTime: Long? = null,
var downloadSpeedSize: Long? = null,
var isFirstTimeDownload: Boolean? = true
)

View File

@ -61,7 +61,6 @@ import com.lightgame.download.DownloadDao;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.DownloadStatus;
import com.lightgame.download.DownloadStatusListener;
import com.lightgame.download.DownloadTask;
import com.lightgame.download.FileUtils;
import com.lightgame.download.HttpDnsManager;
import com.lightgame.utils.Utils;
@ -284,6 +283,7 @@ public class DownloadManager implements DownloadStatusListener {
String path;
String downloadId = PackageInstaller.createDownloadId(gameEntity.getName());
String gameCategory = gameEntity.getCategory();
if (SimulatorGameManager.isSimulatorGame(gameEntity)) {
path = SimulatorGameManager.getPathByType(gameEntity.getSimulatorType()) + "/" + gameEntity.getName() + "." + apkEntity.getFormat();
@ -309,6 +309,7 @@ public class DownloadManager implements DownloadStatusListener {
downloadEntity.setUrl(apkEntity.getUrl());
downloadEntity.setName(gameEntity.getName());
downloadEntity.setPath(path);
downloadEntity.setPluginDesc(gameEntity.getPluginDesc());
downloadEntity.setETag(apkEntity.getEtag());
downloadEntity.setIcon(gameEntity.getIcon());
downloadEntity.setPlatform(apkEntity.getPlatform());
@ -316,6 +317,7 @@ public class DownloadManager implements DownloadStatusListener {
downloadEntity.setGameId(gameEntity.getId());
downloadEntity.setEntrance(entrance);
downloadEntity.setLocation(location);
downloadEntity.setFormat(apkEntity.getFormat());
downloadEntity.setVersionName(apkEntity.getVersion());
ExtensionsKt.addMetaExtra(downloadEntity, Constants.APK_MD5, apkEntity.getMd5());
ExtensionsKt.addMetaExtra(downloadEntity, Constants.DOWNLOAD_ID, downloadId);
@ -323,9 +325,11 @@ 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.GAME_CATEGORY_IN_CHINESE, gameEntity.getCategoryChinese());
ExtensionsKt.addMetaExtra(downloadEntity, Constants.AD_ICON_ACTIVE, String.valueOf(gameEntity.getAdIconActive()));
ExtensionsKt.addMetaExtra(downloadEntity, Constants.IS_AD_DATA, String.valueOf(gameEntity.isAdData()));
ExtensionsKt.putGameCategory(downloadEntity, gameCategory != null ? gameCategory : "");
ExtensionsKt.addMetaExtra(downloadEntity, Constants.APK_SIZE, apkEntity.getSize());
if (gameEntity.getIconFloat() != null) {
ExtensionsKt.addMetaExtra(downloadEntity, Constants.GAME_ICON_FLOAT_TOP_TEXT, gameEntity.getIconFloat().getUpperLeftText());
ExtensionsKt.addMetaExtra(downloadEntity, Constants.GAME_ICON_FLOAT_TOP_COLOR, gameEntity.getIconFloat().getUpperLeftColor());
@ -545,7 +549,7 @@ public class DownloadManager implements DownloadStatusListener {
* 任务是否已经下载中
*/
public boolean isTaskDownloading(String url) {
if (NDataChanger.INSTANCE.getDownloadingTasks().get(url) != null) {
if (NDataChanger.INSTANCE.getDownloadingTaskUrlSet().contains(url)) {
Utils.log(DownloadManager.class.getSimpleName(), url + "正在下载!");
return true;
}
@ -830,6 +834,7 @@ public class DownloadManager implements DownloadStatusListener {
*/
public void cancel(String url, boolean isDeleteFile, boolean automatic, boolean cancelSilently) {
DownloadEntity entry = mDownloadDao.getSnapshot(url);
DownloadDataSimpleHelper.INSTANCE.removeDownloadSimpleEntity(url);
if (entry != null) {
AppExecutor.getIoExecutor().execute(() -> {
NDownloadBridge.INSTANCE.cancel(url);
@ -867,12 +872,8 @@ public class DownloadManager implements DownloadStatusListener {
private void cancelAndNotify(DownloadEntity entry, boolean cancelSilently) {
mDownloadDao.removeErrorMessage(entry.getUrl());
DownloadTask task = NDataChanger.INSTANCE.getDownloadingTasks().get(entry.getUrl());
if (task != null) {
task.cancel();
// 改任务队列的状态
NDataChanger.INSTANCE.getDownloadingTasks().remove(entry.getUrl());
}
// 改任务队列的状态
NDataChanger.INSTANCE.getDownloadingTaskUrlSet().remove(entry.getUrl());
NDataChanger.INSTANCE.getDownloadEntries().remove(entry.getUrl());
if (!cancelSilently) {
NDataChanger.INSTANCE.notifyDataChanged(entry);
@ -886,8 +887,10 @@ public class DownloadManager implements DownloadStatusListener {
* 暂停所有正在下载的任务
*/
public void pauseAll() {
for (DownloadEntity entity : NDataChanger.INSTANCE.getDownloadEntries().values()) {
pause(entity.getUrl());
synchronized (NDataChanger.INSTANCE.getDownloadEntries()) {
for (DownloadEntity entity : NDataChanger.INSTANCE.getDownloadEntries().values()) {
pause(entity.getUrl());
}
}
Utils.log(DownloadManager.class.getSimpleName(), "pause all");
}
@ -913,10 +916,10 @@ public class DownloadManager implements DownloadStatusListener {
* 3.检查是否显示下载通知栏
*/
public void initDownloadService() {
final List<String> urlList = new ArrayList<>(NDataChanger.INSTANCE.getDownloadingTasks().keySet());
final Set<String> urlSet = NDataChanger.INSTANCE.getDownloadingTaskUrlSet();
for (DownloadEntity downloadEntity : getAllDownloadEntity()) {
if (!urlList.contains(downloadEntity.getUrl()) &&
(downloadEntity.getStatus().equals(DownloadStatus.downloading)
if (!urlSet.contains(downloadEntity.getUrl())
&& (downloadEntity.getStatus().equals(DownloadStatus.downloading)
|| downloadEntity.getStatus().equals(DownloadStatus.waiting))) {
downloadEntity.setStatus(DownloadStatus.subscribe);
mDownloadDao.newOrUpdate(downloadEntity);
@ -994,8 +997,11 @@ public class DownloadManager implements DownloadStatusListener {
}
if (status == DownloadStatus.add || status == DownloadStatus.subscribe) {
if (downloadEntity.getMeta().get(DownloadDataHelper.DOWNLOAD_FIRST_START) == null) {
downloadEntity.getMeta().put(DownloadDataHelper.DOWNLOAD_FIRST_START, "YES");
DownloadDataSimpleEntity simpleEntity =
DownloadDataSimpleHelper.INSTANCE.getDownloadDataSimpleEntity(downloadEntity.getUrl());
if (simpleEntity == null || simpleEntity.isFirstTimeDownload() == null) {
DownloadDataSimpleHelper.INSTANCE.updateDownloadSimpleEntityFirstTimeDownload(downloadEntity.getUrl(), true);
}
}
@ -1235,7 +1241,10 @@ public class DownloadManager implements DownloadStatusListener {
/**
* 更新数据库中的下载实体
*
* @deprecated 随意更新数据库可能会出现意想不到的情况,建议不要随意调用
*/
@Deprecated()
public void updateDownloadEntity(DownloadEntity downloadEntity) {
mDownloadDao.update(downloadEntity, false);
}

View File

@ -6,6 +6,7 @@ import com.gh.common.util.ConcernUtils
import com.gh.common.util.DataCollectionUtils
import com.gh.common.util.PackageInstaller
import com.gh.common.util.PackageUtils
import com.gh.common.xapk.XapkInstaller
import com.gh.download.server.BrowserInstallHelper
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.loghub.LoghubUtils
@ -110,6 +111,10 @@ object PackageObserver {
runOnIoThread { FileUtils.deleteFile(mDownloadEntity.path) }
}
if (mDownloadEntity.format == Constants.XAPK_FORMAT) {
XapkInstaller.onInstalled(mDownloadEntity.path)
}
DownloadManager.getInstance().cancel(mDownloadEntity.url, false, true, false)
if (SPUtils.getBoolean(Constants.SP_CONCERN_GAME, true)) { //设置页面控制是否安装后自动关注

View File

@ -178,9 +178,18 @@ class DownloadDialog : BaseDraggableDialogFragment() {
for (i in 0 until it.itemCount) {
val apkEntity = itemList[i].normal ?: continue
val apkCollection = apkEntity.apkCollection
if (apkCollection != null && apkCollection.name == mPlatformName) {
scrollAndDownload(recyclerView, false, i)
break
if (apkCollection != null) {
if (apkCollection.name == mPlatformName) {
scrollAndDownload(recyclerView, false, i)
break
} else {
apkCollection.saveApkEntity?.forEach { entity ->
if (entity.getPlatformName() == mPlatformName || entity.packageName == mPackageName) {
scrollAndDownload(recyclerView, false, i)
}
}
break
}
}
if (apkEntity.getPlatformName() == mPlatformName || apkEntity.packageName == mPackageName) {
scrollAndDownload(recyclerView, true, i)

View File

@ -10,12 +10,9 @@ import com.gh.common.constant.Config
import com.gh.common.dialog.CertificationDialog
import com.gh.common.dialog.DeviceRemindDialog
import com.gh.common.dialog.PackageCheckDialogFragment
import com.gh.common.util.*
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.common.util.DialogUtils
import com.gh.common.util.DirectUtils.directToLinkPage
import com.gh.common.util.DownloadDialogHelper
import com.gh.common.util.PackageInstaller
import com.gh.common.util.PackageUtils
import com.gh.download.DownloadManager
import com.gh.download.server.BrowserInstallHelper
import com.gh.gamecenter.DownloadManagerActivity
@ -244,7 +241,7 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
mtaValue = gameEntity.name + "_" + apkEntity.getPlatformName() + "_下载"
}
DownloadDialogItemStatus.LAUNCH -> {
PackageUtils.launchApplicationByPackageName(it.context, apkEntity.packageName)
PackageLauncher.launchApp(it.context, gameEntity, apkEntity.packageName)
mtaValue = gameEntity.name + "_" + apkEntity.getPlatformName() + "_启动"
}
@ -282,7 +279,7 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
DownloadManager.getInstance().cancel(apkEntity.url)
} else {
if (PackageUtils.isCanPluggable(apkEntity)) {
DialogHelper.showPluginDialog(it.context) {
DialogHelper.showPluginDialog(it.context, gameEntity.pluginDesc) {
PackageInstaller.uninstall(it.context, downloadEntity.path)
}
} else {
@ -352,54 +349,46 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
if (msg.isNullOrEmpty()) {
BrowserInstallHelper.showBrowserInstallHintDialog(
context,
gameEntity.isVGame(),
object : EmptyCallback {
override fun onCallback() {
DownloadDialogHelper.findAvailableDialogAndShow(
gameEntity.isVGame() || gameEntity.isSplitXApk()
) {
DownloadDialogHelper.findAvailableDialogAndShow(
context,
gameEntity,
apkEntity
) {
PackageCheckDialogFragment.show(
context as AppCompatActivity,
gameEntity
) {
CertificationDialog.showCertificationDialog(
context,
gameEntity,
apkEntity,
object : EmptyCallback {
override fun onCallback() {
PackageCheckDialogFragment.show(
context as AppCompatActivity,
gameEntity,
object : ConfirmListener {
override fun onConfirm() {
CertificationDialog.showCertificationDialog(
context,
gameEntity,
object : ConfirmListener {
override fun onConfirm() {
DialogUtils.checkDownload(
context,
apkEntity.size,
gameEntity.id,
gameEntity.name
) { isSubscribe ->
DownloadManager.createDownload(
context,
apkEntity,
gameEntity,
downloadMethod,
entrance,
location,
isSubscribe, traceEvent
)
gameEntity
) {
DialogUtils.checkDownload(
context,
apkEntity.size,
gameEntity.id,
gameEntity.name
) { isSubscribe ->
DownloadManager.createDownload(
context,
apkEntity,
gameEntity,
downloadMethod,
entrance,
location,
isSubscribe, traceEvent
)
DeviceRemindDialog.showDeviceRemindDialog(
context,
gameEntity
)
}
}
})
}
})
}
})
DeviceRemindDialog.showDeviceRemindDialog(
context,
gameEntity
)
}
}
}
})
}
}
} else {
Utils.toast(context, msg)
}

View File

@ -17,6 +17,7 @@ import com.gh.gamecenter.common.utils.tryCatchInRelease
import com.gh.gamecenter.core.utils.EmptyCallback
import com.gh.gamecenter.core.utils.GsonUtils
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.feature.entity.GameEntity
import com.google.gson.JsonObject
import com.halo.assistant.HaloApp
import com.lightgame.utils.Utils
@ -93,6 +94,10 @@ object BrowserInstallHelper {
return false
}
@JvmStatic
fun shouldAutoSwitchAssistantInstall(gameEntity: GameEntity): Boolean =
isUseBrowserToInstallEnabled() && shouldUseBrowserToInstall() && gameEntity.isSplitXApk()
/**
* 是否显示使用浏览器来安装弹窗
*/
@ -144,7 +149,8 @@ object BrowserInstallHelper {
val manufacturer = Build.MANUFACTURER.toUpperCase(Locale.CHINA)
var contentText = "当前安装方式为助手安装,如果出现游戏无法安装的问题,可选择切换安装方式为“浏览器安装”"
if (manufacturer == "OPPO" || manufacturer == "VIVO") {
contentText = "当前安装方式为助手安装,下载安装游戏需要验证账户密码或指纹。如需免密码安装,可选择切换安装方式为“浏览器安装”"
contentText =
"当前安装方式为助手安装,下载安装游戏需要验证账户密码或指纹。如需免密码安装,可选择切换安装方式为“浏览器安装”"
}
DialogHelper.showDialog(

View File

@ -55,23 +55,21 @@ object DownloadMessageHandler : InnerDownloadListener {
* @param status 下载状态
*/
override fun onStatusChanged(id: String, status: DownloadStatus) {
val entity = findEntity(id)
val entity = findEntity(id) ?: return
if (entity != null) {
entity.status = status
entity.status = status
if (status == DownloadStatus.COMPLETED) {
SimpleDownloadManager.resumeQueuedTask()
}
if (status == DownloadStatus.COMPLETED) {
SimpleDownloadManager.resumeQueuedTask()
}
ExecutorProvider.getInstance().backgroundExecutor.execute {
updateDownloadToDatabase(entity)
updateDownloadList()
}
ExecutorProvider.getInstance().backgroundExecutor.execute {
updateDownloadToDatabase(entity)
updateDownloadList()
}
for (listener in mGlobalStatusChangedListenerList) {
listener.invoke(entity!!, status)
listener.invoke(entity, status)
}
val listenerList = mListenerMap[id] ?: return
@ -165,7 +163,7 @@ object DownloadMessageHandler : InnerDownloadListener {
* @param error 错误类型
* @param exception 包裹错误的 Exception
*/
override fun onError(id: String, error: DownloadError?, exception: Exception) {
override fun onError(id: String, error: DownloadError?, exception: Exception?) {
error ?: return
when (error) {

View File

@ -7,14 +7,21 @@ import com.gh.base.DownloadToolbarActivity
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.updateStatusBarColor
import com.gh.gamecenter.entity.SubjectRecommendEntity
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.game.GameFragment
class BlockActivity : DownloadToolbarActivity() {
companion object {
fun getIntent(context: Context, blockData: SubjectRecommendEntity, entrance: String): Intent {
fun getIntent(context: Context,
blockData: SubjectRecommendEntity,
exposureSourceList: ArrayList<ExposureSource>? = null,
entrance: String): Intent {
val args = Bundle()
args.putParcelable(EntranceConsts.KEY_BLOCK_DATA, blockData)
if (exposureSourceList != null) {
args.putParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST, exposureSourceList)
}
args.putString(EntranceConsts.KEY_ENTRANCE, entrance)
return getTargetIntent(context, BlockActivity::class.java, GameFragment::class.java, args)
}

View File

@ -198,7 +198,6 @@ public class MainActivity extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) {
showAd = getIntent().getBooleanExtra(SHOW_AD, false) && savedInstanceState == null;
HaloApp.getInstance().initFresco();
HaloApp.getInstance().isAlreadyUpAndRunning = true;
super.onCreate(savedInstanceState);
@ -319,6 +318,8 @@ public class MainActivity extends BaseActivity {
// 默认配置为空时重试
if (Config.getSettings() == null) {
Config.getGhzsSettings();
} else if (Config.getVSettingEntity() == null) {
Config.refreshVSettingEntity();
}
// 耗时操作
@ -803,6 +804,15 @@ public class MainActivity extends BaseActivity {
ToastUtils.showToast("游戏启动失败,请联系客服反馈相关信息");
return;
}
VHelper.INSTANCE.logLaunchButtonClicked(
gamePackageName,
null,
null,
null,
"桌面快捷图标"
);
ToastUtils.showToast("游戏启动中,请稍后~");
handler.postDelayed(() -> {
VHelper.postOnInitialized(() -> {
@ -1064,6 +1074,8 @@ public class MainActivity extends BaseActivity {
if (busNetworkState.isNetworkConnected()) {
if (Config.getSettings() == null) {
Config.getGhzsSettings();
} else if (Config.getVSettingEntity() == null) {
Config.refreshVSettingEntity();
}
mPackageViewModel.checkData();

View File

@ -320,7 +320,7 @@ public class SkipActivity extends BaseActivity {
DirectUtils.directCategoryDirectory(this, path, title, ENTRANCE_BROWSER, "浏览器");
break;
case HOST_COLUMN_COLLECTION:
DirectUtils.directToColumnCollection(this, path, -1, ENTRANCE_BROWSER, "浏览器");
DirectUtils.directToColumnCollection(this, path, -1, ENTRANCE_BROWSER, "", null);
break;
case EntranceConsts.HOST_BLOCK:
name = uri.getQueryParameter("name");
@ -403,7 +403,7 @@ public class SkipActivity extends BaseActivity {
DirectUtils.directToGameCollectionDetail(this, path, ENTRANCE_BROWSER, "", null);
break;
case HOST_GAME_COLLECTION_SQUARE:
DirectUtils.directToGameCollectionSquare(this, ENTRANCE_BROWSER, "", "", "");
DirectUtils.directToGameCollectionSquare(this, ENTRANCE_BROWSER, "", "", "", "", "");
break;
default:
EntranceUtils.jumpActivity(this, new Bundle()); // 跳转至首页

View File

@ -51,6 +51,7 @@ import java.io.IOException
import java.io.InputStreamReader
import java.text.SimpleDateFormat
import java.util.*
import kotlin.collections.ArrayList
/**
* 引导页面
@ -79,6 +80,7 @@ class SplashScreenActivity : BaseActivity() {
mIsNewForThisVersion =
mSharedPreferences!!.getBoolean("isNewFirstLaunchV" + PackageUtils.getGhVersionName(), true)
HaloApp.getInstance().isNewForThisVersion = mIsNewForThisVersion
HaloApp.getInstance().isBrandNewInstall = SPUtils.getBoolean(Constants.SP_BRAND_NEW_USER, true)
// 用户不是新版本,但应用最后更新时间不是上次的时间代表用户重新安装了当前版本
if (!mIsNewForThisVersion) {
@ -104,12 +106,11 @@ class SplashScreenActivity : BaseActivity() {
guideLayout.adapter = GuidePagerAdapter()
// 判断是不是光环的新用户
if (SPUtils.getBoolean(Constants.SP_BRAND_NEW_USER, true)) {
if (HaloApp.getInstance().isBrandNewInstall) {
// 引导页需用户点击 “立即体验” 按钮才进入首页所以这里不能置为true
// https://git.ghzs.com/pm/halo-app-issues/-/issues/1422第3点
// mStartMainActivityDirectly = true;
SPUtils.setLong(Constants.SP_INITIAL_USAGE_TIME, System.currentTimeMillis())
HaloApp.getInstance().isBrandNewInstall = true
if (!PackageFlavorHelper.IS_TEST_FLAVOR) {
showPrivacyDialog(guideLayout)
} else {
@ -188,20 +189,6 @@ class SplashScreenActivity : BaseActivity() {
private fun showPrivacyDialog(guideLayout: ViewPager) {
NewPrivacyPolicyDialogFragment.show(this, null) { isSuccess: Boolean ->
if (isSuccess) {
// guideLayout.visibility = View.VISIBLE
// SPUtils.setBoolean(Constants.SP_BRAND_NEW_USER, false)
//
// // 恢复畅玩数据
// VHelper.recoverVDataIfPossible()
//
// requestPermission()
//
// // 检查是否有旧版本光环,有就删掉
// AppExecutor.ioExecutor.execute { deleteOutdatedUpdatePackage() }
// if (mStartMainActivityDirectly) {
// launchMainActivity()
// }
mShouldPrefetchData = false
prefetchData()
@ -226,12 +213,10 @@ class SplashScreenActivity : BaseActivity() {
} else {
DialogUtils.showPrivacyPolicyDisallowDialog(
this,
PrivacyPolicyEntity.createDefaultData(),
object : EmptyCallback {
override fun onCallback() {
showPrivacyDialog(guideLayout)
}
})
PrivacyPolicyEntity.createDefaultData()
) {
showPrivacyDialog(guideLayout)
}
}
}
}
@ -312,19 +297,7 @@ class SplashScreenActivity : BaseActivity() {
private fun doFlavorInit() {
HaloApp.getInstance().flavorProvider.init(HaloApp.getInstance(), this, PkgHelper.getActivateRatio())
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) {
if (HaloApp.getInstance().channel == "GH_206" || PackageFlavorHelper.IS_TEST_FLAVOR) {
SensorsBridge.init(HaloApp.getInstance(), HaloApp.getInstance().channel)
}
}
@ -440,11 +413,8 @@ class SplashScreenActivity : BaseActivity() {
@AfterPermissionGranted(REQUEST_PERMISSION_TAG)
private fun checkAndRequestPermission() {
if (EasyPermissions.hasPermissions(this, *mPermissions)) {
// 恢复畅玩数据
VHelper.recoverVDataIfPossible()
onPermissionsGranted(REQUEST_PERMISSION_TAG, ArrayList(mPermissions.toList()))
// 检查是否有旧版本光环,有就删掉
runOnIoThread { deleteOutdatedUpdatePackage() }
if (mStartMainActivityDirectly) {
if (com.gh.gamecenter.common.BuildConfig.BUILD_TIME != 0L) {
showGitLogDialogIfNeeded()
@ -467,6 +437,17 @@ class SplashScreenActivity : BaseActivity() {
}
}
override fun onPermissionsGranted(requestCode: Int, perms: MutableList<String>?) {
super.onPermissionsGranted(requestCode, perms)
if (perms?.contains(Manifest.permission.READ_EXTERNAL_STORAGE) == true) {
// 恢复畅玩数据
VHelper.recoverVDataIfPossible()
// 检查是否有旧版本光环,有就删掉
runOnIoThread { deleteOutdatedUpdatePackage() }
}
}
// 检查下载文件夹下是否有旧版本的光环助手的包,有则删除
private fun deleteOutdatedUpdatePackage() {
try {

View File

@ -259,7 +259,7 @@ public class WeiBoShareActivity extends Activity implements WbShareCallback {
if ("NORMAL".equals(mShareStyle)) {
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));
EventBus.getDefault().post(new EBShare(ShareUtils.shareEntrance, "新浪微博"));
if (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.inviteFriends) {
IntegralLogHelper.INSTANCE.logInviteResult("成功", "微博");
}

View File

@ -208,9 +208,9 @@ public class LibaoDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
}
holder.binding.libaodetailName.setText(mLibaoEntity.getName());
if (TextUtils.isEmpty(mLibaoEntity.getPlatform())) {
holder.binding.libaodetailName.setText(mLibaoEntity.getGame().getName());
holder.binding.libaodetailGameName.setText(mLibaoEntity.getGame().getName());
} else {
holder.binding.libaodetailName.setText((mLibaoEntity.getGame().getName() + " - " +
holder.binding.libaodetailGameName.setText((mLibaoEntity.getGame().getName() + " - " +
PlatformUtils.getInstance(mContext).getPlatformName(mLibaoEntity.getPlatform())));
}

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;
@ -23,14 +22,13 @@ import com.gh.common.chain.DownloadDialogHelperHandler;
import com.gh.common.chain.GamePermissionHandler;
import com.gh.common.chain.OverseaDownloadHandler;
import com.gh.common.chain.PackageCheckHandler;
import com.gh.common.chain.UnsupportedFeatureHandler;
import com.gh.common.chain.UpdateNewSimulatorHandler;
import com.gh.common.chain.ValidateVSpaceHandler;
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;
import com.gh.common.history.HistoryHelper;
@ -38,41 +36,43 @@ import com.gh.common.simulator.NewSimulatorGameManager;
import com.gh.common.simulator.SimulatorDownloadManager;
import com.gh.common.simulator.SimulatorGameManager;
import com.gh.common.util.CheckLoginUtils;
import com.gh.common.util.DetailDownloadUtils;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.DirectUtils;
import com.gh.common.util.LogUtils;
import com.gh.common.util.PackageInstaller;
import com.gh.common.util.PackageLauncher;
import com.gh.common.util.PackageUtils;
import com.gh.common.util.ReservationHelper;
import com.gh.common.xapk.XapkInstaller;
import com.gh.common.xapk.XapkUnzipStatus;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.common.utils.DataLogUtils;
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.common.util.LogUtils;
import com.gh.gamecenter.core.utils.MtaHelper;
import com.gh.common.util.PackageInstaller;
import com.gh.common.util.PackageUtils;
import com.gh.gamecenter.common.utils.PermissionHelper;
import com.gh.common.util.ReservationHelper;
import com.gh.gamecenter.feature.view.DownloadButton;
import com.gh.download.DownloadManager;
import com.gh.download.dialog.DownloadDialog;
import com.gh.gamecenter.DownloadManagerActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.WebActivity;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.core.utils.StringUtils;
import com.gh.gamecenter.feature.entity.ApkEntity;
import com.gh.gamecenter.feature.entity.GameEntity;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.common.entity.LinkEntity;
import com.gh.gamecenter.common.eventbus.EBReuse;
import com.gh.gamecenter.feature.entity.SimulatorEntity;
import com.gh.gamecenter.common.utils.DataLogUtils;
import com.gh.gamecenter.common.utils.DialogHelper;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.PermissionHelper;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.core.utils.PageSwitchDataHelper;
import com.gh.gamecenter.core.utils.StringUtils;
import com.gh.gamecenter.eventbus.EBScroll;
import com.gh.gamecenter.feature.entity.ApkEntity;
import com.gh.gamecenter.feature.entity.GameEntity;
import com.gh.gamecenter.feature.entity.SimulatorEntity;
import com.gh.gamecenter.feature.exposure.ExposureEvent;
import com.gh.gamecenter.feature.view.DownloadButton;
import com.gh.gamecenter.gamedetail.GameDetailFragment;
import com.gh.gamecenter.gamedetail.dialog.GamePermissionDialogFragment;
import com.gh.gamecenter.teenagermode.TeenagerModeActivity;
import com.gh.vspace.VDownloadManagerActivity;
import com.gh.vspace.VHelper;
import com.gh.vspace.VSpaceLoadingActivity;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.FileUtils;
import com.lightgame.utils.Utils;
@ -121,6 +121,8 @@ public class DetailViewHolder {
final OnDetailDownloadClickListener listener = new OnDetailDownloadClickListener(this, entrance, name, title, traceEvent);
mDownloadPb.setOnClickListener(listener);
ExtensionsKt.putWidgetBusinessName(mDownloadPb, "游戏详情页");
ExtensionsKt.putObject(mDownloadPb, gameEntity);
restoreDialogFragment();
}
@ -138,13 +140,13 @@ public class DetailViewHolder {
}
static class OnDetailDownloadClickListener implements View.OnClickListener {
private DetailViewHolder mViewHolder;
private GameEntity mGameEntity;
private final DetailViewHolder mViewHolder;
private final GameEntity mGameEntity;
private DownloadEntity mDownloadEntity;
private String mEntrance;
private String mName;
private String mTitle;
private ExposureEvent mTraceEvent;
private final String mEntrance;
private final String mName;
private final String mTitle;
private final ExposureEvent mTraceEvent;
public OnDetailDownloadClickListener(DetailViewHolder viewHolder, String entrance, String name, String title, ExposureEvent traceEvent) {
mViewHolder = viewHolder;
@ -158,67 +160,7 @@ 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:
MtaHelper.onEvent("游戏详情_新", "插件化中", mGameEntity.getName());
break;
case DOWNLOADING_NORMAL:
MtaHelper.onEvent("游戏详情_新", "下载中", mGameEntity.getName());
break;
case NONE:
MtaHelper.onEvent("游戏详情_新", "关闭下载", mGameEntity.getName());
break;
case NORMAL:
MtaHelper.onEvent("游戏详情_新", "下载", mGameEntity.getName());
break;
case PLUGIN:
MtaHelper.onEvent("游戏详情_新", "插件化", mGameEntity.getName());
break;
case INSTALL_PLUGIN:
MtaHelper.onEvent("游戏详情_新", "安装插件化", mGameEntity.getName());
break;
case INSTALL_NORMAL:
MtaHelper.onEvent("游戏详情_新", "安装", mGameEntity.getName());
break;
case RESERVABLE:
MtaHelper.onEvent("游戏详情_新", "预约", mGameEntity.getName());
break;
case LAUNCH_OR_OPEN:
if (!mGameEntity.getApk().isEmpty()) {
}
break;
}
// 由于部分状态不包含在 downloadType 里,所以还是需要手动获取下载按钮文字判断点击时的状态
String downloadText = mViewHolder.mDownloadPb.getText().toString();
if (downloadText.contains("打开")) {
MtaHelper.onEvent("游戏详情_新", "打开", mGameEntity.getName());
} else if (downloadText.contains("启动")) {
MtaHelper.onEvent("游戏详情_新", "启动", mGameEntity.getName());
} else if (downloadText.contains("更新")) {
MtaHelper.onEvent("游戏详情_新", "更新", mGameEntity.getName());
}
v.setTag(null);
if (mViewHolder.mDownloadPb.getButtonStyle() != DownloadButton.ButtonStyle.INSTALL_NORMAL
&& mViewHolder.mDownloadPb.getButtonStyle() != DownloadButton.ButtonStyle.INSTALL_PLUGIN
&& mViewHolder.mDownloadPb.getButtonStyle() != DownloadButton.ButtonStyle.LAUNCH_OR_OPEN) {
@ -236,6 +178,9 @@ public class DetailViewHolder {
if (mDownloadEntity != null) {
String xapkStatus = mDownloadEntity.getMeta().get(XapkInstaller.XAPK_UNZIP_STATUS);
if (XapkUnzipStatus.SUCCESS.name().equals(xapkStatus) && XapkInstaller.INSTANCE.isInstalling(mDownloadEntity.getPath())) {// 安装过程中避免重复点击
return;
}
if (XapkUnzipStatus.UNZIPPING.name().equals(xapkStatus)) {
XapkInstaller.cancelUnzipTask(mDownloadEntity);
return;
@ -261,15 +206,12 @@ public class DetailViewHolder {
String offStatus = mGameEntity.getDownloadOffStatus();
if (offStatus != null && !"off".equals(offStatus)) {
if ("dialog".equals(offStatus)) {
// MtaHelper.onEvent("游戏下载状态按钮", "查看详情", mGameEntity.getName());
showOffServiceDialog(mGameEntity.getDownloadOffDialog());
} else if ("toast".equals(offStatus)) {
// MtaHelper.onEvent("游戏下载状态按钮", "关闭且toast", mGameEntity.getName());
EventBus.getDefault().post(new EBReuse(GameDetailFragment.SKIP_RATING));
Utils.toast(mViewHolder.context, "该游戏因故暂不提供下载,具体详情可在相关评论中查看,敬请谅解~");
}
} else {
// MtaHelper.onEvent("游戏下载状态按钮", "暂无下载", mGameEntity.getName());
Utils.toast(mViewHolder.context, "该游戏已关闭下载");
}
break;
@ -282,9 +224,8 @@ public class DetailViewHolder {
DataLogUtils.uploadGameLog(mViewHolder.context, mGameEntity.getId(), mGameEntity.getName(), mEntrance);
}
case PLUGIN:
ChainBuilder builder = new ChainBuilder();
builder.addHandler(new UnsupportedFeatureHandler());
builder.addHandler(new UpdateNewSimulatorHandler());
builder.addHandler(new GamePermissionHandler());
builder.addHandler(new CheckStoragePermissionHandler());
@ -347,11 +288,11 @@ public class DetailViewHolder {
}
if (mGameEntity.isVGame()) {
VHelper.installOrLaunch(mViewHolder.context, mGameEntity);
VHelper.installOrLaunch(mViewHolder.context, mGameEntity, null);
return;
}
PackageUtils.launchApplicationByPackageName(mViewHolder.context, mGameEntity.getApk().get(0).getPackageName());
PackageLauncher.launchApp(mViewHolder.context, mGameEntity, mGameEntity.getApk().get(0).getPackageName());
} else {
GamePermissionDialogFragment.show((AppCompatActivity) mViewHolder.context, mGameEntity, mGameEntity.getInfo(), () -> {
PermissionHelper.checkStoragePermissionBeforeAction(mViewHolder.context, () -> {
@ -389,7 +330,7 @@ public class DetailViewHolder {
}
if (mGameEntity.isVGame()) {
VHelper.installOrLaunch(v.getContext(), mGameEntity);
VHelper.installOrLaunch(v.getContext(), mGameEntity, null);
return;
}
@ -436,7 +377,6 @@ public class DetailViewHolder {
}
break;
case H5_GAME:
MtaHelper.onEvent("H5页面", "入口", "详情页_" + mGameEntity.getName());
LinkEntity linkEntity = mGameEntity.getH5Link();
boolean isPlay = "play".equals(linkEntity.getType()); // 是否为开始玩
@ -482,7 +422,7 @@ public class DetailViewHolder {
}
if (mDownloadEntity != null) {
if (downloadText.contains("继续加载")) {
if (mViewHolder.mDownloadPb.getText().contains("继续加载")) {
DownloadManager.getInstance().resume(mDownloadEntity, true);
} else {
DownloadManager.getInstance().pause(mDownloadEntity.getUrl());

View File

@ -31,6 +31,8 @@ class GameHeadViewHolder(var binding: GameHeadItemBinding) :
binding.arrowIv.visibility = View.GONE
val text = if ("change" == subject.home) {
"换一批"
} else if (subject.type == "game_list_collection" && subject.style?.contains("slide") == true) {
"游戏单广场"
} else {
when (subject.home) {
"more" -> "更多"
@ -62,7 +64,7 @@ class GameHeadViewHolder(var binding: GameHeadItemBinding) :
} else {
binding.headMore.visibility = View.VISIBLE
}
if (binding.headMore.visibility == View.VISIBLE && (binding.headMore.text == "更多" || binding.headMore.text == "全部")) {
if (binding.headMore.visibility == View.VISIBLE && (binding.headMore.text == "更多" || binding.headMore.text == "全部" || binding.headMore.text == "游戏单广场")) {
binding.arrowIv.visibility = View.VISIBLE
}
binding.headTitle.setTextColor(R.color.text_title.toColor(binding.root.context))

View File

@ -42,7 +42,8 @@ import java.util.regex.Pattern
class AmwayAdapter(
context: Context,
private var mViewModel: AmwayViewModel,
private var mBasicExposureSource: List<ExposureSource>,
private var mBasicExposureSource: ArrayList<ExposureSource>,
private var mUseAlternativeLayout: Boolean,
private var mLayoutManager: RecyclerView.LayoutManager
) : ListAdapter<AmwayListItemData>(context), IExposable {
@ -102,6 +103,7 @@ class AmwayAdapter(
mViewModel,
mEntityList[position],
mEntityList[position].blockPosition,
mUseAlternativeLayout,
mBasicExposureSource
)
}
@ -203,6 +205,7 @@ class AmwayAdapter(
viewModel: AmwayViewModel,
itemData: AmwayListItemData,
blockPosition: Int,
useAlternativeLayout: Boolean,
basicExposureSource: List<ExposureSource>
) {
val context = binding.root.context
@ -269,9 +272,22 @@ class AmwayAdapter(
}
binding.commentContainer.setOnClickListener {
val exposureSource = if (useAlternativeLayout) {
arrayListOf(ExposureSource("新首页"), ExposureSource("安利墙"))
} else {
arrayListOf(ExposureSource("安利墙"))
}.toJson()
val intent = RatingReplyActivity.getIntent(
context, amway.game.id, amway.comment, false, viewModel.entrance
?: "", EntranceConsts.ENTRANCE_AMWAY
context = context,
gameId = amway.game.id,
gameEntity = null,
comment = amway.comment,
commentId = amway.comment.id,
showKeyboardIfReplyListIsEmpty = false,
exposureSource = exposureSource,
entrance = viewModel.entrance ?: "",
path = EntranceConsts.ENTRANCE_AMWAY
)
SyncDataBetweenPageHelper.startActivityForResult(
binding.root.context,

View File

@ -145,7 +145,8 @@ class AmwayFragment : LazyListFragment<AmwayListItemData, AmwayViewModel>() {
}
add(ExposureSource("安利墙", ""))
}
mAdapter = AmwayAdapter(requireContext(), mViewModel, basicExposureSource, mLayoutManager)
mAdapter =
AmwayAdapter(requireContext(), mViewModel, basicExposureSource, mUseAlternativeLayout, mLayoutManager)
}
return mAdapter!!
}

View File

@ -184,6 +184,7 @@ class SpecialCatalogAdapter(
specialLink.link,
specialLink.text,
false,
null,
"(游戏-专题:" + specialLink.text + "-全部)"
)
}

View File

@ -193,6 +193,8 @@ class CategoryV2ListAdapter(
true,
"star&brief"
)
holder.binding.downloadBtn.putWidgetBusinessName("分类列表")
} else if (holder is FooterViewHolder) {
holder.run {
initItemPadding()

View File

@ -4,6 +4,7 @@ import android.app.Activity
import android.content.Context
import android.content.Intent
import android.graphics.drawable.ColorDrawable
import android.util.SparseArray
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
@ -13,6 +14,7 @@ import android.widget.PopupWindow
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.RecyclerView
import com.gh.common.exposure.IExposable
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.common.syncpage.ISyncAdapterHandler
import com.gh.common.util.*
@ -30,6 +32,10 @@ import com.gh.gamecenter.databinding.ItemGameCollectionFlexTagBinding
import com.gh.gamecenter.databinding.PopupHistoryOptionBinding
import com.gh.gamecenter.entity.GamesCollectionEntity
import com.gh.gamecenter.entity.TagInfoEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.feature.exposure.ExposureType
import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailActivity
import com.gh.gamecenter.gamecollection.publish.GameCollectionEditActivity
import com.gh.gamecenter.history.ManageOption
@ -39,12 +45,19 @@ import com.google.android.flexbox.FlexboxLayout
class GamesCollectionAdapter(
context: Context,
private val mViewModel: GamesCollectionViewModel,
) : ListAdapter<GamesCollectionEntity>(context), ISyncAdapterHandler {
) : ListAdapter<GamesCollectionEntity>(context), ISyncAdapterHandler, IExposable {
private var mCurrentOption = ManageOption.OPTION_MANAGER
private var mPopWindow: PopupWindow? = null
private var mPopupBinding: PopupHistoryOptionBinding? = null
var selectItems = arrayListOf<String>()
private var mExposureEventArray: SparseArray<ExposureEvent>? = null
override fun setListData(updateData: MutableList<GamesCollectionEntity>?) {
mExposureEventArray = SparseArray(updateData?.size ?: 0)
super.setListData(updateData)
}
override fun getItemCount(): Int {
return if (mEntityList == null || mEntityList.isEmpty()) return 0 else mEntityList.size + 1
@ -102,6 +115,19 @@ class GamesCollectionAdapter(
when (holder) {
is GameCollectionItemViewHolder -> {
val itemEntity = mEntityList[position]
val exposureEvent = ExposureEvent.createEvent(
GameEntity().apply {
sequence = position
},
listOf(
ExposureSource("个人主页", ""),
ExposureSource("游戏单", "${itemEntity.title}+${itemEntity.id}")
),
null,
ExposureType.EXPOSURE
)
mExposureEventArray?.put(position, exposureEvent)
holder.binding.run {
ImageUtils.display(poster, itemEntity.cover)
nameTv.text = itemEntity.title
@ -117,7 +143,7 @@ class GamesCollectionAdapter(
gameThree.goneIf(it < 3)
}
moreNumTv.goneIf((itemEntity.count?.game ?: 0) < 4)
moreNumTv.goneIf((itemEntity.count?.game ?: 0) < 4 || itemEntity.games?.size == 0)
moreNumTv.text = "+ " + ((itemEntity.count?.game ?: 0) - 3)
tagContainer.goneIf(itemEntity.count?.game != 0)
timeTv.text = TimeUtils.getFormatTime(itemEntity.time?.update ?: 0, "MM - dd")
@ -235,7 +261,8 @@ class GamesCollectionAdapter(
GameCollectionDetailActivity.getIntent(
mContext,
itemEntity.id,
isScrollToCommentArea = true
isScrollToCommentArea = true,
exposureSourceList = ArrayList(exposureEvent.source)
)
)
}
@ -294,7 +321,13 @@ class GamesCollectionAdapter(
} else {
if (mCurrentOption == ManageOption.OPTION_MANAGER) {
NewLogUtils.logEnterGameCollectionDetail(itemEntity.title, itemEntity.id)
mContext.startActivity(GameCollectionDetailActivity.getIntent(mContext, itemEntity.id))
mContext.startActivity(
GameCollectionDetailActivity.getIntent(
mContext,
itemEntity.id,
exposureSourceList = ArrayList(exposureEvent.source)
)
)
} else {
if (selectItems.contains(itemEntity.id)) {
selectItems.remove(itemEntity.id)
@ -459,4 +492,8 @@ class GamesCollectionAdapter(
checkAllCb.isChecked = selectItems.size == mEntityList.size
}
}
override fun getEventByPosition(pos: Int): ExposureEvent? = mExposureEventArray!!.get(pos)
override fun getEventListByPosition(pos: Int): List<ExposureEvent>? = null
}

View File

@ -3,6 +3,7 @@ package com.gh.gamecenter.collection
import android.os.Bundle
import android.view.View
import androidx.core.content.ContextCompat
import com.gh.common.exposure.ExposureListener
import com.gh.gamecenter.common.constant.EntranceConsts.*
import com.gh.gamecenter.common.view.SpacingItemDecoration
import com.gh.gamecenter.R
@ -76,6 +77,8 @@ class GamesCollectionFragment : ListFragment<GamesCollectionEntity, GamesCollect
mListViewModel.publishLiveData.observe(viewLifecycleOwner) {
mListViewModel.load(LoadType.REFRESH)
}
mListRv.addOnScrollListener(ExposureListener(this, provideListAdapter()))
}
override fun onLoadEmpty() {

View File

@ -223,7 +223,7 @@ class DiscoveryAdapter(
val navBar = MainWrapperRepository.getInstance().getNavBarLiveData().value
if (navBar == null || mContext is DiscoveryActivity) {
val blockData = HomeBottomBarHelper.getDefaultGameBarData()
mContext.startActivity(BlockActivity.getIntent(mContext, blockData, mEntrance))
mContext.startActivity(BlockActivity.getIntent(mContext, blockData, mBaseExposureSource, mEntrance))
} else {
EventBus.getDefault()
.post(EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_GAME))

View File

@ -38,6 +38,7 @@ import com.gh.gamecenter.fragment.MainWrapperFragment;
import com.halo.assistant.HaloApp;
import com.lightgame.download.DataWatcher;
import com.lightgame.download.DownloadConfig;
import com.lightgame.download.DownloadDao;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.DownloadStatus;
@ -137,8 +138,7 @@ public class GameDownloadFragment extends BaseFragment implements View.OnClickLi
}
}
adapter.getUrlMap().put(PackageUtils.getPackageNameByPath(HaloApp.getInstance().getApplication(),
downloadEntity.getPath()), downloadEntity.getUrl());
adapter.getUrlMap().put(downloadEntity.getPackageName(), downloadEntity.getUrl());
// 用户焦点在下载管理页面时有任务完成,直接把所有下载完成的任务标记为已读
DownloadManager.getInstance().markDownloadedTaskAsRead();
@ -222,6 +222,7 @@ public class GameDownloadFragment extends BaseFragment implements View.OnClickLi
protected void initView(View view) {
super.initView(view);
String path = getActivity().getIntent().getStringExtra(EntranceConsts.KEY_PATH);
String pluginDesc = getActivity().getIntent().getStringExtra(EntranceConsts.KEY_PLUGIN_DESC);
url = getActivity().getIntent().getStringExtra(EntranceConsts.KEY_URL);
isScroll = false;
@ -297,7 +298,7 @@ public class GameDownloadFragment extends BaseFragment implements View.OnClickLi
});
if (path != null) {
adapter.showPluginDialog(path);
adapter.showPluginDialog(path, pluginDesc);
}
mBinding.downloadmanagerTvAllstart.setOnClickListener(this);
}
@ -342,8 +343,8 @@ public class GameDownloadFragment extends BaseFragment implements View.OnClickLi
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBMiPush mipush) {
if ("plugin_install".equals(mipush.getFrom())) {
String path = (String) mipush.getObj();
adapter.showPluginDialog(path);
DownloadEntity downloadEntity = (DownloadEntity) mipush.getObj();
adapter.showPluginDialog(downloadEntity.getPath(), downloadEntity.getPluginDesc());
}
}

View File

@ -16,6 +16,7 @@ import androidx.recyclerview.widget.RecyclerView.ViewHolder;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.PackageInstaller;
import com.gh.common.util.PackageLauncher;
import com.gh.common.util.PackageUtils;
import com.gh.common.xapk.XapkDialogHelper;
import com.gh.gamecenter.common.entity.IconFloat;
@ -210,7 +211,11 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
} else if (XapkUnzipStatus.SUCCESS.name().equals(xapkStatus)) {
viewHolder.binding.dmItemTvStartorpause.setButtonStyle(DownloadButton.ButtonStyle.XAPK_SUCCESS);
viewHolder.binding.dmItemTvStartorpause.setProgress(1000);
viewHolder.binding.dmItemTvStartorpause.setText(R.string.hundred_percent);
if (XapkInstaller.INSTANCE.isInstalling(downloadEntity.getPath())) {
viewHolder.binding.dmItemTvStartorpause.setText(R.string.installing);
} else {
viewHolder.binding.dmItemTvStartorpause.setText(R.string.install);
}
}
if (xapkStatus != null && !xapkStatus.isEmpty()) {
xapkStatusMap.put(downloadEntity.getUrl(), xapkStatus);
@ -264,17 +269,20 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
viewHolder.binding.dmItemTvStartorpause.setOnClickListener(v -> {
String str = ((DownloadButton) v).getText();
final String url = downloadEntity.getUrl();
final String currentXApkStatus = downloadEntity.getMeta().get(XapkInstaller.XAPK_UNZIP_STATUS);
DownloadManager.getInstance().put(url, System.currentTimeMillis());
if (XapkUnzipStatus.UNZIPPING.name().equals(xapkStatus)) {
if (XapkUnzipStatus.SUCCESS.name().equals(currentXApkStatus) && XapkInstaller.INSTANCE.isInstalling(downloadEntity.getPath())) {
return;
} else if (XapkUnzipStatus.UNZIPPING.name().equals(currentXApkStatus)) {
XapkInstaller.cancelUnzipTask(downloadEntity);
return;
} else if (XapkUnzipStatus.FAILURE.name().equals(xapkStatus)
|| XapkUnzipStatus.SUCCESS.name().equals(xapkStatus)) {
} else if (XapkUnzipStatus.FAILURE.name().equals(currentXApkStatus)
|| XapkUnzipStatus.SUCCESS.name().equals(currentXApkStatus)) {
PermissionHelper.checkStoragePermissionBeforeAction(mContext, () -> {
final String path = downloadEntity.getPath();
if (downloadEntity.isPluggable()
&& PackagesManager.isInstalled(downloadEntity.getPackageName())) {
showPluginDialog(downloadEntity.getPath());
showPluginDialog(downloadEntity.getPath(), downloadEntity.getPluginDesc());
} else {
if (FileUtils.isEmptyFile(path)) {
Utils.toast(mContext, R.string.install_failure_hint);
@ -323,7 +331,7 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
final String path = downloadEntity.getPath();
if (downloadEntity.isPluggable()
&& PackagesManager.isInstalled(downloadEntity.getPackageName())) {
showPluginDialog(downloadEntity.getPath());
showPluginDialog(downloadEntity.getPath(), downloadEntity.getPluginDesc());
} else {
if (FileUtils.isEmptyFile(path)) {
Utils.toast(mContext, R.string.install_failure_hint);
@ -334,7 +342,7 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
}
});
} else if (str.equals(mContext.getString(R.string.launch))) {
PackageUtils.launchApplicationByPackageName(mContext, downloadEntity.getPackageName());
PackageLauncher.launchApp(mContext, null, downloadEntity.getPackageName());
}
break;
case redirected:
@ -469,8 +477,8 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
}
// 显示插件化
void showPluginDialog(final String path) {
DialogHelper.showPluginDialog(mContext, () -> {
void showPluginDialog(final String path, final String pluginDesc) {
DialogHelper.showPluginDialog(mContext, pluginDesc, () -> {
if (FileUtils.isEmptyFile(path)) {
Utils.toast(mContext, R.string.install_failure_hint);
} else {
@ -629,8 +637,7 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
statusMap.put(downloadEntity.getUrl(), downloadEntity.getStatus().name());
if (DownloadStatus.done.equals(downloadEntity.getStatus())) {
if (!ExtensionsKt.isSimulatorGame(downloadEntity)) {
urlMap.put(PackageUtils.getPackageNameByPath(mContext,
downloadEntity.getPath()), downloadEntity.getUrl());
urlMap.put(downloadEntity.getPackageName(), downloadEntity.getUrl());
mDownloadedList.add(downloadEntity);
}
} else {

View File

@ -15,12 +15,11 @@ import com.gh.gamecenter.feature.exposure.ExposureType
import com.gh.common.exposure.IExposable
import com.gh.common.simulator.SimulatorGameManager.isSimulatorGame
import com.gh.common.util.*
import com.gh.common.util.DownloadItemUtils.setOnClickListener
import com.gh.common.util.DownloadItemUtils.updateItem
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
import com.gh.gamecenter.common.utils.putWidgetBusinessName
import com.gh.gamecenter.common.utils.safelyGetInRelease
import com.gh.gamecenter.feature.databinding.GameItemBinding
import com.gh.gamecenter.feature.entity.GameEntity
@ -92,17 +91,18 @@ class NewInstalledGameFragmentAdapter(context: Context, private var mViewModel:
}
binding.gameName.text = name
generateExposureEvent(gameEntity)
setOnClickListener(
DownloadItemUtils.setOnClickListener(
binding.root.context,
binding.downloadBtn,
gameEntity,
1,
this@NewInstalledGameFragmentAdapter,
"(我的光环-已安装)", "我的光环-已安装" + ":" + gameEntity.name,
gameEntity.exposureEvent // , () -> MtaHelper.onEvent("下载管理", "已安装", binding.downloadBtn.getText().toString())
gameEntity.exposureEvent
)
updateItem(binding.root.context, gameEntity, GameViewHolder(binding), !gameEntity.isPluggable)
holder.itemView.setOnClickListener { v: View? ->
binding.downloadBtn.putWidgetBusinessName("下载管理")
DownloadItemUtils.updateItem(binding.root.context, gameEntity, GameViewHolder(binding), !gameEntity.isPluggable)
holder.itemView.setOnClickListener {
DataCollectionUtils.uploadClick(binding.root.context, "列表", "我的光环-我的游戏", gameEntity.name)
GameDetailActivity.startGameDetailActivity(
binding.root.context,

View File

@ -19,8 +19,6 @@ import com.gh.download.DownloadManager
import com.gh.download.dialog.DownloadDialog
import com.gh.gamecenter.DownloadManagerActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.BugFixedPopupWindow
import com.gh.gamecenter.core.utils.CurrentActivityHolder
@ -335,6 +333,8 @@ class UpdatableGameAdapter(private var mViewModel: UpdatableGameViewModel) :
}
}
updateBtn.putWidgetBusinessName("下载管理")
updateBtn.putObject(update)
updateBtn.setOnClickListener {
val str: String = updateBtn.text.toString()
if ("更新" == str || str.contains("")) {
@ -380,7 +380,7 @@ class UpdatableGameAdapter(private var mViewModel: UpdatableGameViewModel) :
}
}
} else if (updateBtn.context.getString(R.string.launch) == str) {
PackageUtils.launchApplicationByPackageName(updateBtn.context, update.packageName)
PackageLauncher.launchApp(updateBtn.context, packageName = update.packageName)
} else if (updateBtn.context.getString(R.string.resume) == str) {
if (downloadEntity != null) {
DownloadManager.getInstance().resume(downloadEntity, true)
@ -401,21 +401,6 @@ class UpdatableGameAdapter(private var mViewModel: UpdatableGameViewModel) :
updateBtn.buttonStyle = DownloadButton.ButtonStyle.NORMAL
}
}
SensorsBridge.trackEvent(
"DownLoadbuttonClick",
"game_id", update.id,
"game_name", update.name ?: "",
"game_type", update.categoryChinese,
"download_status", update.downloadStatusChinese,
"button_name", str,
"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

@ -16,11 +16,8 @@ import com.gh.gamecenter.common.base.GlobalActivityManager.getCurrentPageEntity
import com.gh.gamecenter.common.base.GlobalActivityManager.getLastPageEntity
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.utils.SensorsBridge.trackEvent
import com.gh.gamecenter.common.utils.addMetaExtra
import com.gh.gamecenter.common.utils.secondOrNull
import com.gh.gamecenter.common.utils.toProperReadableSize
import com.gh.gamecenter.common.utils.tryCatchInRelease
import com.gh.gamecenter.core.utils.GsonUtils.toJson
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.core.utils.UrlFilterUtils
@ -78,7 +75,9 @@ class UpdatableGameViewModel(
// 有闪退日志说这个 update 实体可能为空,实在看不原因 (
if (update == null) continue
// 筛选仅下载管理出现的插件化更新
if (update.isShowPlugin(PluginLocation.only_index) && update.downloadStatus != "smooth") {
if (update.isShowPlugin(PluginLocation.only_index)
&& update.downloadStatus != Constants.V_GAME
&& update.downloadStatus != Constants.V_GAME_32) {
val platform =
PlatformUtils.getInstance(getApplication()).getPlatformName(update.platform)
if (!platform.isNullOrEmpty() && "官方版" != platform) {
@ -585,12 +584,14 @@ class UpdatableGameViewModel(
downloadEntity.platform = update.platform
downloadEntity.packageName = update.packageName
downloadEntity.versionName = update.version
downloadEntity.pluginDesc = update.pluginDesc
downloadEntity.addMetaExtra(Constants.RAW_GAME_ICON, update.rawIcon)
downloadEntity.addMetaExtra(Constants.GAME_ICON_SUBSCRIPT, update.iconSubscript)
downloadEntity.addMetaExtra(Constants.DOWNLOAD_ID, downloadId)
downloadEntity.addMetaExtra(Constants.APK_MD5, update.md5)
downloadEntity.addMetaExtra(Constants.GAME_NAME, update.name)
downloadEntity.addMetaExtra(Constants.GAME_TYPE, update.categoryChinese)
downloadEntity.addMetaExtra(Constants.GAME_CATEGORY_IN_CHINESE, update.categoryChinese)
downloadEntity.putGameCategory(update.category ?: "")
if (update.iconFloat != null) {
downloadEntity.addMetaExtra(Constants.GAME_ICON_FLOAT_TOP_TEXT, update.iconFloat?.upperLeftText)
downloadEntity.addMetaExtra(Constants.GAME_ICON_FLOAT_TOP_COLOR, update.iconFloat?.upperLeftColor)

View File

@ -0,0 +1,27 @@
package com.gh.gamecenter.entity
import android.os.Parcelable
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.feature.entity.PersonalEntity
import com.google.gson.annotations.SerializedName
import kotlinx.parcelize.Parcelize
data class GameCollectionPlayerCreationEntity(
@SerializedName("tip_link")
val tipLink: LinkEntity? = null,
val data: List<PlayerCreationItem>? = ArrayList()
)
@Parcelize
data class GameCollectionHotListTab(
@SerializedName("_id")
val id: String = "",
val name: String = "",
var position: Int = -1
) : Parcelable
data class PlayerCreationItem(
val user: PersonalEntity? = null,
@SerializedName("game_list")
val gameList: GamesCollectionEntity? = null
)

View File

@ -18,6 +18,8 @@ data class GameInstall(
var installTime: Long = 0,
var version: String = "",
var isSmoothGame: Boolean = false, // 是否是畅玩游戏
var downloadStatus: String? = "", // 下载状态,对应 GameEntity 的 downloadStatus
var category: String? = "", // 类型,对应 GameEntity 的 category
var tag: Any? = null
) {
@ -35,6 +37,8 @@ data class GameInstall(
gameInstall.version = PackageUtils.getVersionNameByPackageName(installedPkgName) ?: "unknown"
gameInstall.packageName = installedPkgName
gameInstall.isSmoothGame = game.isVGame()
gameInstall.downloadStatus = game.downloadStatus
gameInstall.category = game.category
return gameInstall
}
}

View File

@ -0,0 +1,10 @@
package com.gh.gamecenter.entity
import com.gh.gamecenter.gamecollection.square.GameCollectionListItemData
data class GameListCollection(
var id: String = "",
var name: String = "",
var style: String = "",
var gameCollectionItemDataList: List<GameCollectionListItemData> = arrayListOf(),
)

View File

@ -1,5 +1,6 @@
package com.gh.gamecenter.entity
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.entity.IconFloat
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.entity.*
@ -60,7 +61,7 @@ data class GameUpdateEntity(
val downloadStatusChinese: String
get() = when (downloadStatus) {
"on" -> "开启"
"smooth" -> "畅玩"
Constants.V_GAME, Constants.V_GAME_32 -> "畅玩"
"appointment" -> "预约"
"demo" -> "试玩"
else -> ""

View File

@ -15,7 +15,7 @@ data class HomeContent(
@SerializedName("link_column")
val linkColumn: SubjectEntity? = null,
@SerializedName("game_list")
val linkGameCollection: List<GamesCollectionEntity>? = null,
var linkGameCollection: List<HomeGameCollectionEntity>? = null,
@SerializedName("link_top_game_comment")
val linkTopGameComment: List<AmwayCommentEntity>? = null,
@SerializedName("display_content")
@ -35,4 +35,5 @@ data class HomeContent(
val recommendTag: String = "",
@SerializedName("ad_icon_active")
val adIconActive: Boolean = false,
var style: String = "",
)

View File

@ -0,0 +1,53 @@
package com.gh.gamecenter.entity
import android.os.Parcelable
import com.gh.gamecenter.feature.entity.*
import com.gh.gamecenter.feature.entity.TimeEntity
import com.gh.gamecenter.room.converter.*
import com.google.gson.annotations.SerializedName
import kotlinx.parcelize.Parcelize
@Parcelize
data class HomeGameCollectionEntity(
@SerializedName("_id")
var id: String = "",
var games: ArrayList<GameEntity>? = null,
var title: String = "",
var intro: String = "",
var cover: String = "",
var display: String = "",//self_only: 仅自己可见
var stamp: String = "",//special_choice: 精选 offical: 官方
var count: Count? = null,
var user: User? = null,
var time: TimeEntity? = null,
@SerializedName("ad_icon_active")
var adIconActive: Boolean = false,
) : Parcelable {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as HomeGameCollectionEntity
// 这里只对比游戏单id判断是否相同
if (id != other.id) return false
return true
}
override fun hashCode(): Int {
var result = id.hashCode()
result = 31 * result + (games?.hashCode() ?: 0)
result = 31 * result + title.hashCode()
result = 31 * result + intro.hashCode()
result = 31 * result + cover.hashCode()
result = 31 * result + display.hashCode()
result = 31 * result + stamp.hashCode()
result = 31 * result + (count?.hashCode() ?: 0)
result = 31 * result + (user?.hashCode() ?: 0)
result = 31 * result + (time?.hashCode() ?: 0)
result = 31 * result + adIconActive.hashCode()
return result
}
}

View File

@ -2,6 +2,7 @@ package com.gh.gamecenter.entity
import com.gh.gamecenter.common.entity.Display
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.google.gson.annotations.SerializedName
data class HomeRecommend(
@ -13,7 +14,10 @@ data class HomeRecommend(
val linkText: String = "",
val icon: String = "",
val name: String = "",
val display: Display = Display()
val display: Display = Display(),
// 绑定的曝光实体
var exposureEvent: ExposureEvent? = null,
) {
fun transformLinkEntity(): LinkEntity {

View File

@ -1,5 +1,6 @@
package com.gh.gamecenter.entity
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.feature.entity.SimulatorEntity
import com.google.gson.annotations.SerializedName
@ -29,7 +30,9 @@ class NewApiSettingsEntity(
// VPN 配置
class Install(
@SerializedName("vpn_required")
val vpnRequired: VpnSetting? = null
val vpnRequired: VpnSetting? = null,
@SerializedName("guides")
val guides: List<Guide>? = null
)
class VpnSetting(
@ -38,4 +41,9 @@ class NewApiSettingsEntity(
@SerializedName("packages")
val vpnMatchedPackagesName: HashSet<String>
)
class Guide(
val type: String,
val link: LinkEntity
)
}

View File

@ -41,7 +41,7 @@ data class SubjectEntity(
var verticalLine: String = "", // 竖排时才有数据,代表竖排行数控制
@SerializedName("game_list_collection")
var gameListCollection: List<GamesCollectionEntity>? = null,
var gameListCollection: List<HomeGameCollectionEntity>? = null,
@SerializedName("column_test_v2_data")
val testV2Data: HomeItemTestV2Entity? = null,

View File

@ -3,6 +3,7 @@ package com.gh.gamecenter.entity
import android.graphics.Color
import android.os.Parcelable
import com.gh.gamecenter.common.entity.Display
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.google.gson.annotations.SerializedName
import kotlinx.parcelize.Parcelize
@ -52,6 +53,7 @@ data class SubjectRecommendEntity(
var currentSelectColor: Int = 0,
var isTopViewShow: Boolean = true,
var isSlideEmpty: Boolean = false, // 首页轮播图是否为空
var exposureEvent: ExposureEvent? = null, // 绑定的曝光实体
) : Parcelable {
/*init {

View File

@ -3,8 +3,8 @@ package com.gh.gamecenter.entity
import com.google.gson.annotations.SerializedName
class VSetting {
@SerializedName("va")
var va: Va? = null
var gsf: GApp? = null
class Va(
@SerializedName("32-bit")
@ -23,4 +23,9 @@ class VSetting {
val versionCode: Int,
val url: String
)
class GApp(
val url: String? = null,
var md5: String? = null
)
}

View File

@ -83,7 +83,7 @@ class ForumArticleAskListFragment : LazyListFragment<AnswerEntity, ForumArticleA
mListRv.setBackgroundColor(R.color.background_white.toColor(requireContext()))
mScrollCalculatorHelper = ForumScrollCalculatorHelper(R.id.horizontalVideoView, R.id.verticalVideoView, 0)
requireView().setBackgroundColor(R.color.background_white.toColor(requireContext()))
view?.setBackgroundColor(R.color.background_white.toColor(requireContext()))
mSkeletonScreen = Skeleton.bind(mBinding.listSkeleton)
.shimmer(true)
@ -115,11 +115,6 @@ class ForumArticleAskListFragment : LazyListFragment<AnswerEntity, ForumArticleA
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (dy > Constants.FOLLOW_HINT_TRIGGER_HEIGHT) {
EventBus.getDefault().post(EBTypeChange(ForumDetailFragment.EB_HIDE_QUESTION_BUTTON, 0))
} else if (dy < -Constants.FOLLOW_HINT_TRIGGER_HEIGHT) {
EventBus.getDefault().post(EBTypeChange(ForumDetailFragment.EB_SHOW_QUESTION_BUTTON, 0))
}
if (dy != 0) scroll()
}
})
@ -142,13 +137,16 @@ class ForumArticleAskListFragment : LazyListFragment<AnswerEntity, ForumArticleA
override fun onLoadRefresh() {
super.onLoadRefresh()
requireView().setBackgroundColor(R.color.background_white.toColor(requireContext()))
// Fixhttps://sentry.shanqu.cc/organizations/lightgame/issues/288994/?project=22&query=LazyListFragment&statsPeriod=14d
// Fragment在内存泄露的情况下调用requireView()会触发崩溃这里替换为getView()方法
// TODO 解决Fragment内存泄露的问题
view?.setBackgroundColor(R.color.background_white.toColor(requireContext()))
}
override fun onLoadDone() {
super.onLoadDone()
requireView().setBackgroundColor(Color.TRANSPARENT)
AppExecutor.uiExecutor.executeWithDelay(Runnable {
view?.setBackgroundColor(Color.TRANSPARENT)
mBaseHandler.postDelayed(Runnable {
tryCatchInRelease {
scroll()
mScrollCalculatorHelper?.onScrollStateChanged(mListRv, RecyclerView.SCROLL_STATE_IDLE)
@ -158,12 +156,12 @@ class ForumArticleAskListFragment : LazyListFragment<AnswerEntity, ForumArticleA
override fun onLoadError() {
super.onLoadError()
requireView().setBackgroundColor(Color.TRANSPARENT)
view?.setBackgroundColor(Color.TRANSPARENT)
}
override fun onLoadEmpty() {
super.onLoadEmpty()
requireView().setBackgroundColor(Color.TRANSPARENT)
view?.setBackgroundColor(Color.TRANSPARENT)
}
override fun hideRefreshingLayout() {

View File

@ -96,11 +96,6 @@ class ForumArticleListFragment : LazyListFragment<ArticleEntity, ForumArticleLis
}
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
if (dy > Constants.FOLLOW_HINT_TRIGGER_HEIGHT) {
EventBus.getDefault().post(EBTypeChange(CommunityHomeFragment.EB_HIDE_QUESTION_BUTTON, 0))
} else if (dy < -Constants.FOLLOW_HINT_TRIGGER_HEIGHT) {
EventBus.getDefault().post(EBTypeChange(CommunityHomeFragment.EB_SHOW_QUESTION_BUTTON, 0))
}
if (dy != 0) scroll()
if (parentFragment is CommunityHomeFragment) {
(parentFragment as CommunityHomeFragment).translateTopBg(recyclerView.computeVerticalScrollOffset() - 8F.dip2px())

View File

@ -773,7 +773,18 @@ class HomeSearchToolWrapperFragment : SearchToolWrapperFragment() {
}
// 这里的 selectedPosition 指的是应该被高亮显示的 position
val selectedPosition = (position + positionOffset).roundToInt()
val selectedPosition = try {
(position + positionOffset).roundToInt()
} catch (e: IllegalArgumentException) {
// roundToInt() 方法有时候会报 Cannot round NaN value. 错误
// https://sentry.shanqu.cc/organizations/lightgame/issues/301377/?project=22
SentryHelper.onEvent(
"HOME_NAN_POSITION",
"value",
"$position+$positionOffset=(${position + positionOffset})"
)
position
}
val positionOffsetOnRealSelectedPosition = if (positionOffset >= 0.5) {
positionOffset - 1
} else {
@ -797,8 +808,8 @@ class HomeSearchToolWrapperFragment : SearchToolWrapperFragment() {
// positionOffset 小于零,表示 indicator 当前位置处于选中的 tab 的左边
val indicatorOnLeft = positionOffset < 0F
val selectedTabBinding = mTabBindingList[selectedPosition]
val selectedTabImageStyle = mTabImageStyleList[selectedPosition]
val selectedTabBinding = mTabBindingList.safelyGetInRelease(selectedPosition) ?: return
val selectedTabImageStyle = mTabImageStyleList.safelyGetInRelease(selectedPosition) ?: return
// 前一个 tab、当前选中的 tab、后一个 tab 的显示比例
val preScaleRatio = 1 + abs(positionOffset) / 4
@ -1097,6 +1108,11 @@ class HomeSearchToolWrapperFragment : SearchToolWrapperFragment() {
putInt(EntranceConsts.KEY_POSITION, 0)
putString(EntranceConsts.KEY_COLUMNNAME, tabEntity.text)
putBoolean(EntranceConsts.KEY_IS_COLUMN_COLLECTION, true)
putInt(EntranceConsts.KEY_TAB_INDEX, index)
putParcelableArrayList(
EntranceConsts.KEY_EXPOSURE_SOURCE_LIST,
arrayListOf(ExposureSource("顶部tab", tabEntity.name ?: ""))
)
})
"column" -> SubjectFragment().with(Bundle().apply {
@ -1121,6 +1137,11 @@ class HomeSearchToolWrapperFragment : SearchToolWrapperFragment() {
putString(EntranceConsts.KEY_ENTRANCE, "首页顶部Tab栏")
putString(EntranceConsts.KEY_COLLECTION_ID, tabEntity.link)
putString(EntranceConsts.KEY_COLUMNNAME, tabEntity.text)
putInt(EntranceConsts.KEY_TAB_INDEX, index)
putParcelableArrayList(
EntranceConsts.KEY_EXPOSURE_SOURCE_LIST,
arrayListOf(ExposureSource("顶部tab", tabEntity.name ?: ""))
)
})
"explore_column" -> DiscoveryFragment().with(Bundle().apply {

View File

@ -84,6 +84,7 @@ class HomeSearchToolWrapperViewModel(application: Application) : AndroidViewMode
if (pkgLinkEntity.type == tab.type
&& (pkgLinkEntity.link == tab.link || tab.link == null)) {
defaultTabPosition = index
PkgHelper.markConfigUsed()
break
}
}

View File

@ -58,7 +58,7 @@ class WelcomeDialogFragment : BaseDialogFragment() {
DirectUtils.directToGameDetail(
requireContext(),
mWelcomeEntity?.link!!,
EntranceConsts.ENTRANCE_WELCOME
entrance = EntranceConsts.ENTRANCE_WELCOME
)
}
EntranceConsts.HOST_COLUMN -> {

View File

@ -68,19 +68,20 @@ import com.gh.gamecenter.game.rank.RankCollectionViewHolder
import com.gh.gamecenter.game.vertical.GameVerticalAdapter
import com.gh.gamecenter.game.vertical.GameVerticalSlideViewHolder
import com.gh.gamecenter.game.vertical.OnPagerSnapScrollListener
import com.gh.gamecenter.home.BlankDividerViewHolder
import com.gh.gamecenter.home.HomeDividerViewHolder
import com.gh.gamecenter.home.HomeGameItemViewHolder
import com.gh.gamecenter.home.*
import com.gh.gamecenter.home.discovercard.DiscoverCardGameAdapter
import com.gh.gamecenter.home.discovercard.HomeDiscoverCardViewHolder
import com.gh.gamecenter.home.gamecollection.HomeGameCollectionViewHolder
import com.gh.gamecenter.home.gamecollection.carousel.HomeGameCollectionCarouselViewHolder
import com.gh.gamecenter.home.gamecollection.refresh.HomeGameCollectionRefreshAdapter
import com.gh.gamecenter.home.gamecollection.refresh.HomeGameCollectionRefreshViewHolder
import com.gh.gamecenter.home.gamecollection.slide.HomeGameCollectionSlideAdapter
import com.gh.gamecenter.home.gamecollection.slide.HomeGameCollectionSlideViewHolder
import com.gh.gamecenter.home.horizontalslidevideo.HomeHorizontalSlideVideoAdapter
import com.gh.gamecenter.home.horizontalslidevideo.HomeHorizontalSlideVideoListViewHolder
import com.gh.gamecenter.home.test_v2.HomeGameTestV2GameListRvAdapter
import com.gh.gamecenter.home.test_v2.HomeGameTestV2ViewModel
import com.gh.gamecenter.home.test_v2.HomeItemGameTestV2ViewHolder
import com.gh.gamecenter.home.video.ScrollCalculatorHelper
import com.gh.gamecenter.servers.GameServersActivity
import com.gh.gamecenter.servers.gametest2.GameServerTestV2Activity
import com.gh.gamecenter.subject.SubjectActivity
import com.lightgame.adapter.BaseRecyclerAdapter
@ -91,7 +92,7 @@ class GameFragmentAdapter(
model: GameViewModel,
private val mLifecycleOwner: LifecycleOwner,
private val mHomeGameTestV2ViewModel: HomeGameTestV2ViewModel,
private val mBasicExposureSource: List<ExposureSource>,
private val mBasicExposureSource: ArrayList<ExposureSource>,
private val mLayoutManager: LinearLayoutManager?,
private val mScrollCalculatorHelper: ScrollCalculatorHelper? = null
) : BaseRecyclerAdapter<ViewHolder>(context), IExposable {
@ -140,7 +141,16 @@ class GameFragmentAdapter(
if (itemData.gallerySlide != null) return ItemViewType.GALLERY_SLIDE
if (itemData.blankDivider != null) return ItemViewType.BLANK_DIVIDER
if (itemData.rankCollection != null) return ItemViewType.RANK_COLLECTION
if (itemData.gameCollection != null) return ItemViewType.GAME_COLLECTION_ITEM
if (itemData.gameCollection != null) {
return when (itemData.gameCollection!!.style) {
LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_CAROUSEL_STYLE -> ItemViewType.GAME_COLLECTION_CAROUSEL
LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_BIG_SLIDE_STYLE -> ItemViewType.GAME_COLLECTION_BIG_SLIDE
LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_SMALL_SLIDE_STYLE -> ItemViewType.GAME_COLLECTION_SMALL_SLIDE
LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_HORIZONTAL_REFRESH_STYLE -> ItemViewType.GAME_COLLECTION_HORIZONTAL_REFRESH
LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_VERTICAL_REFRESH_STYLE -> ItemViewType.GAME_COLLECTION_VERTICAL_REFRESH
else -> ItemViewType.GAME_COLLECTION_CAROUSEL // style为空时默认展示轮播图
}
}
if (itemData.doubleCardColumn != null) return ItemViewType.DOUBLE_CARD_COLUMN
if (itemData.bigImageRecommend != null) return ItemViewType.BIG_IMAGE_RECOMMEND
if (itemData.attachGame != null) return ItemViewType.GAME_ITEM
@ -160,6 +170,7 @@ class GameFragmentAdapter(
GameViewpagerItemBinding.bind(mLayoutInflater.inflate(R.layout.game_viewpager_item, parent, false))
GameViewPagerViewHolder(view, displayMetrics)
}
ItemViewType.LOADING -> {
FooterViewHolder(mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false))
}
@ -176,11 +187,12 @@ class GameFragmentAdapter(
ItemViewType.GALLERY -> GameGalleryViewHolder(
GameGalleryViewHolder.GameGalleryItemCell(mContext).apply { inflate() }
)
ItemViewType.BLANK_DIVIDER -> BlankDividerViewHolder(parent.toBinding())
ItemViewType.COMMON_LINK_COLLECTION -> CommonCollectionViewHolder(parent.toBinding())
ItemViewType.COMMON_LINK_COLLECTION12 -> CommonCollection12ViewHolder(parent.toBinding())
ItemViewType.RANK_COLLECTION -> RankCollectionViewHolder(parent.toBinding())
ItemViewType.GAME_COLLECTION_ITEM -> HomeGameCollectionViewHolder(parent.toBinding())
ItemViewType.GAME_COLLECTION_CAROUSEL -> HomeGameCollectionCarouselViewHolder(parent.toBinding())
ItemViewType.DOUBLE_CARD_COLUMN -> DoubleCardViewHolder(parent.toBinding())
ItemViewType.BIG_IMAGE_RECOMMEND -> BigImageRecommendViewHolder(parent.toBinding())
ItemViewType.GAME_ITEM -> HomeGameItemViewHolder(parent.toBinding())
@ -191,7 +203,13 @@ class GameFragmentAdapter(
mHomeGameTestV2ViewModel,
mLifecycleOwner
)
ItemViewType.HORIZONTAL_SLIDE_VIDEO -> HomeHorizontalSlideVideoListViewHolder(parent.toBinding())
ItemViewType.GAME_COLLECTION_BIG_SLIDE,
ItemViewType.GAME_COLLECTION_SMALL_SLIDE -> HomeGameCollectionSlideViewHolder(parent.toBinding())
ItemViewType.GAME_COLLECTION_HORIZONTAL_REFRESH,
ItemViewType.GAME_COLLECTION_VERTICAL_REFRESH -> HomeGameCollectionRefreshViewHolder(parent.toBinding())
else -> GameItemViewHolder(GameItemBinding.bind(mLayoutInflater.inflate(R.layout.game_item, parent, false)))
}
@ -215,7 +233,7 @@ class GameFragmentAdapter(
is CommonCollectionViewHolder -> bindCommonCollection(holder, position)
is CommonCollection12ViewHolder -> bindCommonCollection(holder, position)
is RankCollectionViewHolder -> bindRankCollection(holder, position)
is HomeGameCollectionViewHolder -> bindGameCollection(holder, position)
is HomeGameCollectionCarouselViewHolder -> bindGameCollectionCarousel(holder, position)
is DoubleCardViewHolder -> bindGameDoubleCard(holder, position)
is BigImageRecommendViewHolder -> bindBigImageRecommend(holder, position)
is HomeGameItemViewHolder -> bindAttachGame(holder, position)
@ -223,6 +241,8 @@ class GameFragmentAdapter(
is HomeDiscoverCardViewHolder -> bindDiscoverCard(holder, position)
is HomeItemGameTestV2ViewHolder -> bindGameTestV2ViewHolder(holder, position)
is HomeHorizontalSlideVideoListViewHolder -> bindHomeHorizontalSlideVideo(holder, position)
is HomeGameCollectionSlideViewHolder -> bindGameCollectionSlide(holder, position)
is HomeGameCollectionRefreshViewHolder -> bindGameCollectionRefresh(holder, position)
}
}
@ -267,24 +287,27 @@ class GameFragmentAdapter(
}
private fun bindColumnCollection(holder: GameColumnCollectionViewHolder, position: Int) {
val itemData = mItemDataList[position]
val columnCollection = mItemDataList[position].columnCollection!!
// 重置曝光列表
mItemDataList[position].exposureEventList = arrayListOf()
val clickClosure: (position: Int, gameEntity: GameEntity) -> Unit = { prefixedPosition, gameEntity ->
// 类型为排行榜时点击处理不一样
if (columnCollection.style == "top") {
MtaHelper.onEvent("游戏专题合集", "首页合集图片", columnCollection.name)
DirectUtils.directToColumnCollection(
mContext, columnCollection.id
?: "", prefixedPosition, "(首页游戏)"
)
} else {
MtaHelper.onEvent("游戏专题合集", "首页合集图片", gameEntity.name)
setPageSwitchData()
DirectUtils.directToLinkPage(
mContext,
LinkEntity(link = gameEntity.link, type = gameEntity.type),
"(首页游戏)",
"游戏-专题"
"游戏-专题",
gameEntity.exposureEvent
)
}
NewLogUtils.logColumnCategoryHomeContentClick(
@ -294,7 +317,10 @@ class GameFragmentAdapter(
)
}
holder.bindColumnCollection(columnCollection, clickClosure)
holder.bindColumnCollection(columnCollection, mBasicExposureSource, clickClosure) {
it.payload.outerSequence = itemData.columnCollection?.outerSequence
itemData.exposureEventList?.add(it)
}
val dataList = columnCollection.data!!
if (dataList.size == 1) {
@ -458,7 +484,13 @@ class GameFragmentAdapter(
DataCollectionUtils.uploadClick(mContext, subjectData?.name + "-列表", "游戏-专题", gameEntity.name)
GameDetailActivity.startGameDetailActivity(
mContext, gameEntity,
StringUtils.buildString("(游戏-专题:", subjectData?.name, "-列表[", (subjectData?.position).toString(), "])"),
StringUtils.buildString(
"(游戏-专题:",
subjectData?.name,
"-列表[",
(subjectData?.position).toString(),
"])"
),
traceEvent = gameEntity.exposureEvent
)
}
@ -697,10 +729,10 @@ class GameFragmentAdapter(
val blockData = mViewModel.blockData
val clickListener = OnViewClickListener<Int> { v, clickedPosition ->
if (clickedPosition is Int) {
MtaHelper.onEvent("推荐入口", blockData?.name, (clickedPosition + 1).toString())
if (clickedPosition < subjectDigestList?.size!!) {
val entity = subjectDigestList[clickedPosition]
val exposureEvent = entity.exposureEvent
setPageSwitchData(false)
@ -715,9 +747,20 @@ class GameFragmentAdapter(
mContext,
entity.link!!,
-1,
entrance
entrance,
"",
exposureEvent
)
"block" -> mContext.startActivity(BlockActivity.getIntent(mContext, entity, entrance))
"block" -> mContext.startActivity(
BlockActivity.getIntent(
mContext,
entity,
exposureEvent?.source?.toArrayList(),
entrance
)
)
"category" -> mContext.startActivity(
CategoryDirectoryActivity.getIntent(
mContext,
@ -725,12 +768,14 @@ class GameFragmentAdapter(
entity.text!!
)
)
"column" -> {
SubjectActivity.startSubjectActivity(
mContext,
entity.link,
entity.text,
entity.order,
exposureEvent?.source?.toArrayList(),
StringUtils.buildString(
"(游戏-专题:",
entity.name,
@ -741,15 +786,20 @@ class GameFragmentAdapter(
)
)
}
"game" -> GameDetailActivity.startGameDetailActivity(mContext, entity.link ?: "", entrance)
"game" -> GameDetailActivity.startGameDetailActivity(
mContext,
entity.link ?: "",
entrance,
exposureEvent
)
EntranceConsts.HOST_COMMUNITY -> DirectUtils.directToCommunity(
mContext,
CommunityEntity(entity.link!!, entity.text!!)
)
"top_game_comment" -> DirectUtils.directToAmway(mContext, null, entrance, "")
"server" -> mContext.startActivity(GameServersActivity.getIntent(mContext, entrance, ""))
//entity.type == "h5_game_center" -> DirectUtils.directLetoGameCenter(mContext)
// else -> DialogUtils.showLowVersionDialog(mContext)
"common_collection" -> {
val linkEntity =
LinkEntity(
@ -761,7 +811,7 @@ class GameFragmentAdapter(
blockId = blockData?.link ?: "",
blockName = blockData?.name ?: ""
)
DirectUtils.directToLinkPage(mContext, linkEntity, "板块推荐入口", "")
DirectUtils.directToLinkPage(mContext, linkEntity, "板块推荐入口", "", exposureEvent)
NewLogUtils.logAccessToCommonCollectionDetail(
entity.link ?: "",
entity.text ?: "",
@ -770,27 +820,29 @@ class GameFragmentAdapter(
blockData?.name ?: ""
)
}
"game_list_square" -> {
DirectUtils.directToGameCollectionSquare(
mContext,
"版块推荐入口",
blockData?.name ?: ""
blockData?.name ?: "",
)
}
else -> {
val linkEntity =
LinkEntity(
name = entity.name,
link = entity.link,
text = entity.text,
type = entity.type,
display = entity.display
)
val linkEntity = LinkEntity(
name = entity.name,
link = entity.link,
text = entity.text,
type = entity.type,
display = entity.display
)
DirectUtils.directToLinkPage(
mContext,
linkEntity,
entrance,
"",
exposureEvent = exposureEvent
)
}
}
@ -802,55 +854,53 @@ class GameFragmentAdapter(
}
}
binding.run {
if (mTopViewExposureEventList == null) {
mTopViewExposureEventList = arrayListOf()
mTopViewExposureEventList = arrayListOf()
subjectDigestList?.forEachIndexed { index, entity ->
val event = ExposureEvent.createEventWithSourceConcat(
gameEntity = GameEntity(
containerId = blockData?.link ?: "",
containerType = ExposureEntity.BLOCK_ID
).also {
it.sequence = index
it.outerSequence = position
},
basicSource = mBasicExposureSource,
source = listOf(
ExposureSource(
"推荐入口",
if (Config.isShowPlugin()) entity.name ?: "" else entity.nameNormal ?: ""
)
subjectDigestList?.forEachIndexed { index, entity ->
val event = ExposureEvent.createEventWithSourceConcat(
gameEntity = GameEntity(
containerId = blockData?.link ?: "",
containerType = ExposureEntity.BLOCK_ID
).also {
it.sequence = index
it.outerSequence = position
},
basicSource = mBasicExposureSource,
source = listOf(
ExposureSource(
"推荐入口",
if (Config.isShowPlugin()) entity.name ?: "" else entity.nameNormal ?: ""
)
)
event.payload.controlType = "推荐入口"
event.payload.controlName = if (Config.isShowPlugin()) entity.name else entity.nameNormal
event.payload.controlLinkType = entity.type
event.payload.controlLinkName = entity.text
mTopViewExposureEventList?.add(event)
}
val slideList = mItemDataList[position].slideList
slideList?.forEachIndexed { index, entity ->
val event = ExposureEvent.createEventWithSourceConcat(
gameEntity = GameEntity(
containerId = blockData?.link ?: "",
containerType = ExposureEntity.BLOCK_ID
).also {
it.sequence = index
it.outerSequence = position
},
basicSource = mBasicExposureSource,
source = listOf(ExposureSource("轮播图"))
)
event.payload.controlType = "轮播图"
event.payload.controlName = entity.name
event.payload.controlLinkType = entity.type
event.payload.controlLinkName = entity.text
mTopViewExposureEventList?.add(event)
}
mItemDataList[position].exposureEventList = mTopViewExposureEventList
} else {
mItemDataList[position].exposureEventList = mTopViewExposureEventList
)
event.payload.controlType = "推荐入口"
event.payload.controlName = if (Config.isShowPlugin()) entity.name else entity.nameNormal
event.payload.controlLinkType = entity.type
event.payload.controlLinkName = entity.text
entity.exposureEvent = event
mTopViewExposureEventList?.add(event)
}
val slideList = mItemDataList[position].slideList
slideList?.forEachIndexed { index, entity ->
val event = ExposureEvent.createEventWithSourceConcat(
gameEntity = GameEntity(
containerId = blockData?.link ?: "",
containerType = ExposureEntity.BLOCK_ID
).also {
it.sequence = index
it.outerSequence = position
},
basicSource = mBasicExposureSource,
source = listOf(ExposureSource("轮播图"))
)
event.payload.controlType = "轮播图"
event.payload.controlName = entity.name
event.payload.controlLinkType = entity.type
event.payload.controlLinkName = entity.text
mTopViewExposureEventList?.add(event)
}
mItemDataList[position].exposureEventList = mTopViewExposureEventList
viewpagerTvFailure.goneIf(subjectDigestList != null)
viewpagerTvFailure.setOnClickListener {
@ -1094,12 +1144,14 @@ class GameFragmentAdapter(
holder.binding.headPb.visibility = View.VISIBLE
mViewModel.changeSubjectGame(column.id!!)
}
"more" -> {
setPageSwitchData()
column.moreLink?.let { link ->
DirectUtils.directToLinkPage(it.context, link, "(板块)", "(游戏-专题:" + column.name + "-全部)")
}
}
else -> {
setPageSwitchData()
when (column.type) {
@ -1110,6 +1162,7 @@ class GameFragmentAdapter(
buttonType, column.name ?: "", column.id ?: "", "板块", mViewModel.blockData?.name ?: ""
)
}
"common_collection" -> {
val blockData = mViewModel.blockData
mContext.startActivity(
@ -1136,13 +1189,25 @@ class GameFragmentAdapter(
blockData?.name ?: ""
)
}
"game_list_collection" -> {
NewFlatLogUtils.logGameListCollectionClick(
"版块内容列表",
mViewModel.blockData?.name ?: "",
mViewModel.blockData?.link ?: "",
column.name ?: "",
column.id ?: "",
"游戏单广场"
)
DirectUtils.directToGameCollectionSquare(
mContext,
"版块内容列表",
mViewModel.blockData?.name ?: ""
mViewModel.blockData?.name ?: "",
collectionName = column.name ?: "",
collectionId = column.id ?: ""
)
}
"column_test_v2" -> {
//跳转到新游开测页面
val link = column.indexRightTopLink
@ -1174,6 +1239,7 @@ class GameFragmentAdapter(
}
}
}
else -> {
if (column.indexRightTopLink != null) {
val link = column.indexRightTopLink!!
@ -1191,6 +1257,7 @@ class GameFragmentAdapter(
column.id,
column.getFilterName(),
column.isOrder,
mBasicExposureSource,
"(游戏-专题:" + column.name + "-全部)"
)
}
@ -1202,36 +1269,95 @@ class GameFragmentAdapter(
}
}
private fun bindGameCollection(holder: HomeGameCollectionViewHolder, position: Int) {
val gameItemData = mItemDataList[position]
val gameCollectionItemDataList = gameItemData.gameCollection ?: listOf()
private fun getHomeGameCollectionExposureEventList(
itemData: GameItemData,
refreshCurrentPosition: Int = -1
): ArrayList<ExposureEvent> {
val exposureList = arrayListOf<ExposureEvent>()
for (gameCollectionItemData in gameCollectionItemDataList) {
runOnIoThread(true) {
val gameCollection = gameCollectionItemData.gameCollectionItem
val gameCollectionSource =
listOf(ExposureSource("游戏单", "${gameCollection?.title} + ${gameCollection?.id}"))
val gameExposureList = arrayListOf<ExposureEvent>()
gameCollection?.games?.take(3)?.forEachIndexed { index, game ->
gameExposureList.add(
ExposureEvent.createEventWithSourceConcat(
gameEntity = game.toGameEntity().apply {
isAdData = gameCollection.adIconActive
outerSequence = gameCollectionItemData.outerSequence; sequence =
gameCollectionItemData.gameStartPosition + index + 1
},
basicSource = mBasicExposureSource,
source = gameCollectionSource
)
)
runOnIoThread(true) {
itemData.gameCollection?.gameCollectionItemDataList?.run {
val currentIndex = if (itemData.gameCollection?.style?.contains("refresh") == true) {
refreshCurrentPosition % size
} else -1
forEachIndexed { index, gameCollectionItemData ->
if (itemData.gameCollection?.style?.contains("refresh") == false || currentIndex == index) {
gameCollectionItemData.homeGameCollectionItem?.let {
val gameCollectionSource =
listOf(
ExposureSource("游戏单合集", itemData.gameCollection?.id ?: ""),
ExposureSource("游戏单", "${it.title} + ${it.id}")
)
val gameExposureList = arrayListOf<ExposureEvent>()
it.games?.forEach { game ->
game.isAdData = it.adIconActive
game.outerSequence = gameCollectionItemData.outerSequence
game.sequence = index
val exposureEvent = ExposureEvent.createEventWithSourceConcat(
gameEntity = game,
basicSource = mBasicExposureSource,
source = gameCollectionSource
)
game.exposureEvent = exposureEvent
gameExposureList.add(exposureEvent)
}
exposureList.addAll(gameExposureList)
gameCollectionItemData.exposureEvent = ExposureEvent.createEventWithSourceConcat(
gameEntity = GameEntity().apply {
adIconActive = it.adIconActive
outerSequence = gameCollectionItemData.outerSequence
sequence = index
},
basicSource = mBasicExposureSource,
source = gameCollectionSource
)
}
}
}
gameCollectionItemData.exposureEventList = gameExposureList
exposureList.addAll(gameExposureList)
}
}
gameItemData.exposureEventList = exposureList
holder.bindGameCollectionList(gameCollectionItemDataList, "版块内容列表")
return exposureList
}
private fun bindGameCollectionCarousel(holder: HomeGameCollectionCarouselViewHolder, position: Int) {
val gameItemData = mItemDataList[position]
gameItemData.exposureEventList = getHomeGameCollectionExposureEventList(gameItemData)
gameItemData.gameCollection?.let {
holder.bindGameCollectionList(
it,
"版块内容列表",
mViewModel.blockData?.link ?: "",
mViewModel.blockData?.name ?: ""
)
}
}
private fun bindGameCollectionSlide(holder: HomeGameCollectionSlideViewHolder, position: Int) {
val gameItemData = mItemDataList[position]
gameItemData.exposureEventList = getHomeGameCollectionExposureEventList(gameItemData)
gameItemData.gameCollection?.let {
holder.bindGameCollectionSlide(
it,
"版块内容列表",
mViewModel.blockData?.link ?: "",
mViewModel.blockData?.name ?: ""
)
}
}
private fun bindGameCollectionRefresh(holder: HomeGameCollectionRefreshViewHolder, position: Int) {
val gameItemData = mItemDataList[position]
gameItemData.exposureEventList = getHomeGameCollectionExposureEventList(gameItemData, holder.currentPosition)
gameItemData.gameCollection?.let {
holder.bindGameCollectionRefresh(
it,
"版块内容列表",
mViewModel.blockData?.link ?: "",
mViewModel.blockData?.name ?: ""
) {
mViewModel.changeGameCollectionRefresh(it.id, true)
}
}
}
private fun bindGameDoubleCard(holder: DoubleCardViewHolder, position: Int) {
@ -1359,6 +1485,8 @@ class GameFragmentAdapter(
|| getItemViewType(gameAndPosition.position) == ItemViewType.DISCOVER_CARD
|| getItemViewType(gameAndPosition.position) == ItemViewType.COLUMN_TEST_V2
|| getItemViewType(gameAndPosition.position) == ItemViewType.HORIZONTAL_SLIDE_VIDEO
|| getItemViewType(gameAndPosition.position) == ItemViewType.GAME_COLLECTION_BIG_SLIDE
|| getItemViewType(gameAndPosition.position) == ItemViewType.GAME_COLLECTION_VERTICAL_REFRESH
) {
val view = mLayoutManager?.findViewByPosition(gameAndPosition.position)
val recyclerView = view?.findViewById<RecyclerView>(R.id.recycler_view)
@ -1368,6 +1496,8 @@ class GameFragmentAdapter(
is DiscoverCardGameAdapter -> adapter.notifyItemByDownload(download)
is HomeGameTestV2GameListRvAdapter -> adapter.notifyItemByDownload(download)
is HomeHorizontalSlideVideoAdapter -> adapter.notifyItemByDownload(download)
is HomeGameCollectionSlideAdapter -> adapter.notifyItemByDownload(download)
is HomeGameCollectionRefreshAdapter -> adapter.notifyItemByDownload(download)
}
} else {
notifyItemChanged(gameAndPosition.position)
@ -1492,6 +1622,20 @@ class GameFragmentAdapter(
continue
}
val gameListCollection = mItemDataList[position].gameCollection
if (gameListCollection != null) {
gameListCollection.gameCollectionItemDataList.forEach { gameCollectionItemData ->
gameCollectionItemData.homeGameCollectionItem?.games?.forEach {
for (apkEntity in it.getApk()) {
if (apkEntity.packageName == packageName) {
positionList.add(GameAndPosition(it, position))
}
}
}
}
continue
}
val image = mItemDataList[position].image
if (image != null) positionList.add(GameAndPosition(image, position))
}

View File

@ -31,6 +31,7 @@ import com.gh.gamecenter.game.data.GameItemData
import com.gh.gamecenter.game.rank.RankCollectionAdapter
import com.gh.gamecenter.gamecollection.square.GameCollectionListItemData
import com.gh.gamecenter.home.BlankDividerViewHolder
import com.gh.gamecenter.home.LegacyHomeFragmentAdapterAssistant
import com.gh.gamecenter.home.test_v2.HomeGameTestV2DownloadStateUpdateHelper
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
@ -56,6 +57,8 @@ class GameViewModel(application: Application, var blockData: SubjectRecommendEnt
private val mItemDataListCache: MutableList<GameItemData> = ArrayList()
private val mSubjectChangedMap: ArrayMap<String, List<GameEntity>> = ArrayMap() // 存储换一换的数据
private val mSubjectRefreshMap: ArrayMap<String, MutableList<GameEntity>> = ArrayMap() // 存储专题刷新数据
private val mRefreshGameCollectionMap: ArrayMap<String, List<HomeGameCollectionEntity>> = ArrayMap() // 存储刷新轮换游戏单的数据
private val mRefreshGameCollectionPageMap: ArrayMap<String, Int> = ArrayMap() // 存储刷新轮换游戏单的次数
private var mSmartSubject: SubjectEntity? = null // 猜你喜欢专题
private var mDiscoveryGameCard: DiscoveryGameCardEntity? = null
private var mDiscoveryGameCardLabels: List<DiscoveryGameCardLabel>? = null
@ -595,6 +598,53 @@ class GameViewModel(application: Application, var blockData: SubjectRecommendEnt
}
}
fun changeGameCollectionRefresh(collectionId: String, isRefreshClick: Boolean): Boolean {
val page = (mRefreshGameCollectionPageMap[collectionId] ?: 1) + 1
return if (page != 0) {
getGameCollectionRefresh(collectionId, page, isRefreshClick)
true // 表示需要从接口获取数据
} else {
false // 表示已加载完毕
}
}
private fun getGameCollectionRefresh(collectionId: String, page: Int, isRefreshClick: Boolean) {
mSensitiveApi.getGameCollectionRefresh(collectionId, "block", page, 1)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : Response<List<HomeGameCollectionEntity>>() {
override fun onResponse(response: List<HomeGameCollectionEntity>?) {
if (response != null) {
if (response.isNotEmpty()) {
mRefreshGameCollectionPageMap[collectionId] = page
mRefreshGameCollectionMap[collectionId] = mRefreshGameCollectionMap[collectionId]?.let {
ArrayList(it).apply {
addAll(response)
}
}
// 手动点击刷新获取时,若游戏单内游戏被全部屏蔽会自动获取下一个游戏单
if (isRefreshClick) {
val filterGameList = RegionSettingHelper.filterGame(response[0].games)
if (filterGameList.isEmpty()) {
changeGameCollectionRefresh(collectionId, true)
return
}
}
} else {
// -1 表示加载完毕
mRefreshGameCollectionPageMap[collectionId] = -1
}
transformationItemData()
}
}
override fun onFailure(e: HttpException?) {
Utils.toast(getApplication(), "网络异常")
}
})
}
private fun transformationItemData() {
mItemDataListCache.clear()
positionAndPackageMap.clear()
@ -666,6 +716,7 @@ class GameViewModel(application: Application, var blockData: SubjectRecommendEnt
if (!(!isTopItemShown && index == 0)
&& !shouldShowDivider
&& !hideSubjectName
&& !(subjectEntity.type == "game_list_collection" && subjectEntity.style == LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_VERTICAL_REFRESH_STYLE)
) {
mItemDataListCache.add(getBlankSpacingItem())
}
@ -724,7 +775,8 @@ class GameViewModel(application: Application, var blockData: SubjectRecommendEnt
&& subjectEntity.type != "news"
&& subjectEntity.type != "game"
&& subjectEntity.type != "video"
&& subjectEntity.type != "game_explore")
&& subjectEntity.type != "game_explore"
&& subjectEntity.type != "game_list_collection")
|| (subjectEntity.type == "column_collection" && subjectEntity.style != "top")
) {
val itemDataHead = GameItemData()
@ -954,24 +1006,63 @@ class GameViewModel(application: Application, var blockData: SubjectRecommendEnt
val gameCollectionItem = GameItemData()
val itemDataList = arrayListOf<GameCollectionListItemData>().apply {
if (!subjectEntity.gameListCollection.isNullOrEmpty()) {
var position = 0
if (subjectEntity.style?.contains("refresh") == true) {
if (mRefreshGameCollectionMap[subjectEntity.id] == null) {
mRefreshGameCollectionMap[subjectEntity.id] = subjectEntity.gameListCollection
mRefreshGameCollectionPageMap[subjectEntity.id] = 1
} else {
subjectEntity.gameListCollection = mRefreshGameCollectionMap[subjectEntity.id]
}
}
for (item in subjectEntity.gameListCollection!!) {
item.games = RegionSettingHelper.filterSimpleGame(item.games)
add(
GameCollectionListItemData(
gameCollectionItem = item,
gameStartPosition = position,
outerSequence = subjectEntity.outerSequence + 1
item.games = RegionSettingHelper.filterGame(item.games)
if (!item.games.isNullOrEmpty() || subjectEntity.style == LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_CAROUSEL_STYLE || subjectEntity.style == LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_SMALL_SLIDE_STYLE) {
add(
GameCollectionListItemData(
homeGameCollectionItem = item,
outerSequence = index
)
)
)
position += if (item.count?.game!! > 2) 3 else if (item.games?.size == 0) 0 else
item.count?.game ?: 0
}
}
}
}
if (itemDataList.isEmpty()) {
if (subjectEntity.style?.contains("refresh") == true) {
subjectEntity.id?.let { changeGameCollectionRefresh(it, false) }
return
}
continue
}
// 轮播图样式需要至少3个游戏单
if ((subjectEntity.style == LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_CAROUSEL_STYLE && itemDataList.size >= 3) || subjectEntity.style != LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_CAROUSEL_STYLE) {
if (subjectEntity.style?.contains("refresh") == false) {
val head = GameItemData()
head.columnHead =
SubjectEntity(
id = subjectEntity.id,
type = subjectEntity.type,
name = subjectEntity.name,
adIconActive = subjectEntity.adIconActive,
style = subjectEntity.style
)
mItemDataListCache.add(head)
}
gameCollectionItem.gameCollection = GameListCollection(
id = subjectEntity.id ?: "",
name = subjectEntity.name ?: "",
style = subjectEntity.style ?: "",
gameCollectionItemDataList = itemDataList
)
mItemDataListCache.add(gameCollectionItem)
if (subjectEntity.style == LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_BIG_SLIDE_STYLE || subjectEntity.style == LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_VERTICAL_REFRESH_STYLE) {
gameCollectionItem.gameCollection?.gameCollectionItemDataList?.forEach {
it.homeGameCollectionItem?.games?.forEach { game ->
addGamePositionAndPackage(game)
}
}
}
}
gameCollectionItem.gameCollection = itemDataList
appendAdditionalInfoToSubjectGame(subjectEntity, index)
mItemDataListCache.add(gameCollectionItem)
continue
}

View File

@ -9,12 +9,16 @@ import com.gh.gamecenter.common.view.WrapContentDraweeView
import com.gh.gamecenter.databinding.GameColumnCollectionItemBinding
import com.gh.gamecenter.entity.SubjectEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.lightgame.adapter.BaseRecyclerAdapter
class GameColumnCollectionAdapter(
context: Context,
private var mSubjectEntity: SubjectEntity,
private var mClickClosure: (position: Int, gameEntity: GameEntity) -> Unit
private var mBasicExposureSourceList: ArrayList<ExposureSource>,
private var mClickClosure: (position: Int, gameEntity: GameEntity) -> Unit,
private var mExposureClosure: (exposureEvent: ExposureEvent) -> Unit
) : BaseRecyclerAdapter<GameColumnCollectionItemViewHolder>(context) {
private var mCountAndKey: Pair<Int, String>? = null
@ -55,6 +59,17 @@ class GameColumnCollectionAdapter(
}
})
val exposureEvent = ExposureEvent.createEventWithSourceConcat(
data,
mBasicExposureSourceList,
arrayListOf(ExposureSource("游戏专题合集","${mSubjectEntity.name}+${mSubjectEntity.id}"))
).apply {
payload.sequence = position
}
data.exposureEvent = exposureEvent
mExposureClosure.invoke(exposureEvent)
holder.binding.columnCollectionImage.setOnClickListener {
mClickClosure(position, data)
}

View File

@ -10,13 +10,17 @@ import com.gh.gamecenter.common.view.SpacingItemDecoration
import com.gh.gamecenter.databinding.GameColumnCollectionListBinding
import com.gh.gamecenter.entity.SubjectEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
class GameColumnCollectionViewHolder(val binding: GameColumnCollectionListBinding) :
BaseRecyclerViewHolder<Any>(binding.root) {
fun bindColumnCollection(
columnCollection: SubjectEntity,
clickClosure: (position: Int, gameEntity: GameEntity) -> Unit
basicExposureList: ArrayList<ExposureSource>,
clickClosure: (position: Int, gameEntity: GameEntity) -> Unit,
exposureClosure: (exposureEvent: ExposureEvent) -> Unit
) {
val context = binding.root.context
val dataList = columnCollection.data!!
@ -32,7 +36,7 @@ class GameColumnCollectionViewHolder(val binding: GameColumnCollectionListBindin
binding.columnCollectionList.visibility = View.VISIBLE
var slideAdapter = binding.columnCollectionList.adapter
if (slideAdapter == null) {
slideAdapter = GameColumnCollectionAdapter(context, columnCollection, clickClosure)
slideAdapter = GameColumnCollectionAdapter(context, columnCollection, basicExposureList, clickClosure, exposureClosure)
binding.columnCollectionList.layoutManager =
LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
binding.columnCollectionList.addItemDecoration(

View File

@ -1,14 +1,15 @@
package com.gh.gamecenter.game.columncollection.detail
import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.gh.gamecenter.common.base.activity.ToolBarActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.catalog.CatalogActivity
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.updateStatusBarColor
/**
* 游戏专题合集详情页
*/
class ColumnCollectionDetailActivity : ToolBarActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
@ -40,29 +41,4 @@ class ColumnCollectionDetailActivity : ToolBarActivity() {
}
}
companion object {
/**
* [position] 当专题合集是排行榜(多专题)类型时的起始位置
*/
fun getIntent(
context: Context,
collectionId: String,
position: Int = -1,
entrance: String = "",
columnName: String = ""
): Intent {
val bundle = Bundle()
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance)
bundle.putString(EntranceConsts.KEY_COLLECTION_ID, collectionId)
bundle.putInt(EntranceConsts.KEY_POSITION, position)
bundle.putString(EntranceConsts.KEY_COLUMNNAME, columnName)
return getTargetIntent(
context,
CatalogActivity::class.java,
ColumnCollectionDetailFragment::class.java,
bundle
)
}
}
}

View File

@ -1,10 +1,12 @@
package com.gh.gamecenter.game.columncollection.detail
import android.content.Context
import android.util.SparseArray
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.gh.common.exposure.IExposable
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.common.util.DirectUtils
import com.gh.common.util.NewLogUtils
@ -17,12 +19,18 @@ import com.gh.gamecenter.adapter.viewholder.GameColumnCollectionItemViewHolder
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.databinding.GameColumnCollectionItemBinding
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
class ColumnCollectionDetailAdapter(
context: Context,
private val mViewModel: ColumnCollectionDetailViewModel,
private var mTabIndex: Int,
private val mBasicExposureSourceList: ArrayList<ExposureSource>?,
private val mEntrance: String,
) : ListAdapter<LinkEntity>(context) {
) : ListAdapter<LinkEntity>(context), IExposable {
private var mExposureSparseArray = SparseArray<ExposureEvent>()
override fun areItemsTheSame(oldItem: LinkEntity?, newItem: LinkEntity?): Boolean {
return oldItem == newItem
@ -66,12 +74,21 @@ class ColumnCollectionDetailAdapter(
Pair(PageSwitchDataHelper.PAGE_BUSINESS_NAME, mViewModel.columnCollection.value?.name ?: "")
)
)
DirectUtils.directToLinkPage(mContext, data, mEntrance, "专题合集")
DirectUtils.directToLinkPage(mContext, data, mEntrance, "专题合集", mExposureSparseArray.get(position))
NewLogUtils.logColumnCategoryDetailContentClick(
data.name ?: "", data?.link ?: "",
mViewModel.columnCollection.value?.name ?: "", mViewModel.collectionId
)
}
val exposureEvent = ExposureEvent.createEventWithSourceConcat(
null,
mBasicExposureSourceList ?: arrayListOf(),
arrayListOf(ExposureSource("游戏专题合集", "${mViewModel.getGameColumnCollectionName()}+${mViewModel.collectionId}"))
).apply {
payload.outerSequence = mTabIndex
payload.sequence = position
}
mExposureSparseArray.put(position, exposureEvent)
} else if (holder is FooterViewHolder) {
holder.initFooterViewHolder(mViewModel, mIsLoading, mIsNetworkError, mIsOver)
if (holder.itemView.layoutParams is StaggeredGridLayoutManager.LayoutParams) {
@ -79,4 +96,10 @@ class ColumnCollectionDetailAdapter(
}
}
}
override fun getEventByPosition(pos: Int): ExposureEvent? {
return mExposureSparseArray.get(pos)
}
override fun getEventListByPosition(pos: Int) = null
}

View File

@ -1,9 +1,11 @@
package com.gh.gamecenter.game.columncollection.detail
import android.os.Bundle
import android.view.View
import androidx.lifecycle.ViewModelProviders
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.ethanhua.skeleton.Skeleton
import com.gh.common.exposure.ExposureListener
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.dip2px
@ -15,6 +17,7 @@ import com.gh.gamecenter.common.baselist.LazyListFragment
import com.gh.gamecenter.databinding.FragmentColumnCollectionDetailBinding
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.entity.SubjectData
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.subject.tab.SubjectTabFragment
class ColumnCollectionDetailFragment : LazyListFragment<LinkEntity, ColumnCollectionDetailViewModel>() {
@ -22,6 +25,11 @@ class ColumnCollectionDetailFragment : LazyListFragment<LinkEntity, ColumnCollec
private var mAdapter: ColumnCollectionDetailAdapter? = null
private var mBinding: FragmentColumnCollectionDetailBinding? = null
private var mExposureListener: ExposureListener? = null
private var mTabIndex = -1
private var mBasicExposureSourceList : ArrayList<ExposureSource>? = null
override fun getItemDecoration() = null
override fun getRealLayoutId() = R.layout.fragment_column_collection_detail
@ -31,6 +39,13 @@ class ColumnCollectionDetailFragment : LazyListFragment<LinkEntity, ColumnCollec
mBinding = FragmentColumnCollectionDetailBinding.bind(inflatedView)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mTabIndex = arguments?.getInt(EntranceConsts.KEY_TAB_INDEX) ?: -1
mBasicExposureSourceList = arguments?.getParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST)
}
override fun onFragmentFirstVisible() {
super.onFragmentFirstVisible()
@ -57,8 +72,12 @@ class ColumnCollectionDetailFragment : LazyListFragment<LinkEntity, ColumnCollec
val gridLayoutManager =
StaggeredGridLayoutManager(mListViewModel.rowCount(), StaggeredGridLayoutManager.VERTICAL)
gridLayoutManager.gapStrategy = StaggeredGridLayoutManager.GAP_HANDLING_NONE
mExposureListener = ExposureListener(this, provideListAdapter())
mListRv.clipToPadding = false
mListRv.layoutManager = gridLayoutManager
mListRv.addOnScrollListener(mExposureListener!!)
if (mListViewModel.rowCount() == 1) {
mListRv.setPadding(16F.dip2px(), 0, 16F.dip2px(), 0)
mListRv.addItemDecoration(GridSpacingItemDecoration(mListViewModel.rowCount(), 16F.dip2px(), false))
@ -113,7 +132,7 @@ class ColumnCollectionDetailFragment : LazyListFragment<LinkEntity, ColumnCollec
override fun provideListAdapter(): ColumnCollectionDetailAdapter {
if (mAdapter == null) {
mAdapter = ColumnCollectionDetailAdapter(requireContext(), mListViewModel, mEntrance)
mAdapter = ColumnCollectionDetailAdapter(requireContext(), mListViewModel, mTabIndex, mBasicExposureSourceList, mEntrance)
}
return mAdapter!!
}

View File

@ -25,6 +25,7 @@ class ColumnCollectionDetailViewModel(
) : ListViewModel<LinkEntity, LinkEntity>(application) {
private val mSensitiveApi = RetrofitManager.getInstance().api
private var mCollectionName = ""
val collectionId: String
get() = mCollectionId
@ -41,6 +42,10 @@ class ColumnCollectionDetailViewModel(
mResultLiveData.addSource(mListLiveData) { mResultLiveData.postValue(it) }
}
fun getGameColumnCollectionName(): String {
return mCollectionName
}
@SuppressLint("CheckResult")
fun getGameColumnCollection() {
mSensitiveApi.getGameColumnCollection(mCollectionId)
@ -50,6 +55,7 @@ class ColumnCollectionDetailViewModel(
override fun onResponse(response: GameColumnCollection?) {
super.onResponse(response)
columnCollection.postValue(response)
mCollectionName = response?.name ?: ""
loadData()
}

View File

@ -15,10 +15,19 @@ import com.lightgame.adapter.BaseRecyclerAdapter
class CommonCollectionAdapter(
context: Context,
private var mSubjectEntity: SubjectEntity,
private var mClickClosure: (position: Int, contentEntity: CommonCollectionContentEntity) -> Unit,
private var mExposureClosure: (position: Int, entity: ExposureLinkEntity) -> Unit
) : BaseRecyclerAdapter<CommonCollectionItemViewHolder>(context) {
private var mExposureClosure: ((position: Int, entity: ExposureLinkEntity) -> Unit)? = null
private var mClickClosure: ((position: Int, contentEntity: CommonCollectionContentEntity) -> Unit)? = null
fun setCallback(
clickClosure: ((position: Int, contentEntity: CommonCollectionContentEntity) -> Unit),
exposureClosure: ((position: Int, entity: ExposureLinkEntity) -> Unit)
) {
mClickClosure = clickClosure
mExposureClosure = exposureClosure
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CommonCollectionItemViewHolder {
return CommonCollectionItemViewHolder(parent.toBinding())
}
@ -45,7 +54,7 @@ class CommonCollectionAdapter(
}
if (linkEntity.type == "game") {
mExposureClosure.invoke(position, linkEntity)
mExposureClosure?.invoke(position, linkEntity)
}
holder.binding.apply {
@ -81,7 +90,7 @@ class CommonCollectionAdapter(
rootParams.rightMargin = if (position == itemCount - 1) 16F.dip2px() else 0
root.layoutParams = rootParams
root.setOnClickListener { mClickClosure.invoke(position, contentEntity) }
root.setOnClickListener { mClickClosure?.invoke(position, contentEntity) }
}
}

View File

@ -55,15 +55,20 @@ class CommonCollectionViewHolder(val binding: CommonCollectionListBinding) : Bas
}
}
})
adapter = CommonCollectionAdapter(context, mCollection!!, clickClosure, exposureClosure)
adapter = CommonCollectionAdapter(context, mCollection!!).also {
it.setCallback(clickClosure, exposureClosure)
}
} else {
mLayoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
if (itemDecorationCount > 0) {
removeItemDecorationAt(0)
}
addItemDecoration(SpacingItemDecoration(notDecorateTheFirstItem = true, left = 8f.dip2px()))
addItemDecoration(SpacingItemDecoration(notDecorateTheFirstItem = true, left = 8F.dip2px()))
layoutManager = mLayoutManager
(adapter as CommonCollectionAdapter).checkResetData(mCollection!!)
(adapter as CommonCollectionAdapter).apply {
setCallback(clickClosure, exposureClosure)
checkResetData(mCollection!!)
}
}
}
}

View File

@ -28,6 +28,7 @@ class CommonCollectionDetailAdapter(
val mViewModel: CommonCollectionDetailViewModel,
val mBlockId: String,
val mBlockName: String,
val mTabIndex: Int,
val mEntrance: String,
private val mBasicExposureSource: List<ExposureSource>?
) : ListAdapter<CommonCollectionContentEntity>(context), IExposable {
@ -70,7 +71,13 @@ class CommonCollectionDetailAdapter(
val linkEntity = mEntityList[position].linkEntity
val listener: (v: View) -> Unit = {
DirectUtils.directToLinkPage(mContext, linkEntity, "通用链接合集详情", "")
DirectUtils.directToLinkPage(
mContext,
linkEntity,
"通用链接合集详情",
"",
mExposureEventSparseArray.get(position)
)
val commonLinkCollection = mViewModel.commonCollectionLiveData.value
NewLogUtils.logCommonCollectionClick(
commonLinkCollection?.id ?: "",
@ -110,11 +117,13 @@ class CommonCollectionDetailAdapter(
listOf(
ExposureSource(
"内容合集",
mViewModel.commonCollectionLiveData.value?.name ?: ""
"${mViewModel.commonCollectionLiveData.value?.name}+${mViewModel.commonCollectionLiveData.value?.id}"
),
ExposureSource("合集详情")
),
)
).apply {
this.payload.outerSequence = mTabIndex
}
)
}

View File

@ -32,6 +32,7 @@ class CommonCollectionDetailFragment : LazyListFragment<LinkEntity, CommonCollec
private lateinit var mBinding: FragmentListBaseSkeletonBinding
private var mBlockId = ""
private var mBlockName = ""
private var mTabIndexValue = 0 // 在首页的 tab 位置
override fun getRealLayoutId(): Int = R.layout.fragment_list_base_skeleton
@ -39,6 +40,7 @@ class CommonCollectionDetailFragment : LazyListFragment<LinkEntity, CommonCollec
super.onCreate(savedInstanceState)
mBlockId = requireArguments().getString(EntranceConsts.KEY_BLOCK_ID, "")
mBlockName = requireArguments().getString(EntranceConsts.KEY_BLOCK_NAME, "")
mTabIndexValue = requireArguments().getInt(EntranceConsts.KEY_TAB_INDEX, -1)
}
override fun onRealLayoutInflated(inflatedView: View) {
@ -56,6 +58,7 @@ class CommonCollectionDetailFragment : LazyListFragment<LinkEntity, CommonCollec
mViewModel,
mBlockId,
mBlockName,
mTabIndexValue,
mEntrance,
exposureEvent
)

View File

@ -28,7 +28,7 @@ class GameItemData : ExposureItemData {
var rankCollection: SubjectEntity? = null
var gameCollection: List<GameCollectionListItemData>? = null
var gameCollection: GameListCollection? = null
var doubleCardColumn: SubjectEntity? = null // 双列卡片专题

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