Compare commits

...

517 Commits

Author SHA1 Message Date
98fb4b381a Merge branch 'hotfix/v5.33.1-1011/GHZS-4743' into 'release'
还原 vivo 设备获取应用列表权限的代码

See merge request halo/android/assistant-android!1541
2024-02-04 17:03:10 +08:00
1afed0d6db fix: VIVO 手机已安装列表权限获取问题 https://jira.shanqu.cc/browse/GHZS-4743 2024-02-04 15:35:11 +08:00
5c872b282c Merge branch 'hotfix/v5.33.1-1011-crashes' into 'release'
修复 5.33.1-1011 线上闪退问题

See merge request halo/android/assistant-android!1539
2024-02-04 14:22:26 +08:00
12be13d267 Merge branch 'hotfix/v5.33.1-1011/home_push_crash' into 'release'
fix: 修复首页下拉推送闪退问题...

See merge request halo/android/assistant-android!1538
2024-02-04 11:54:48 +08:00
83f50bb42c fix: 修复礼包详情页空指针闪退 https://sentry.shanqu.cc/organizations/lightgame/issues/359262/?project=22 2024-02-04 11:50:39 +08:00
61e73ad932 feat: 修复因为延迟引起的海外弹窗弹出闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/360465/?project=22 2024-02-04 11:46:50 +08:00
e811538bbd fix: 修复首页下拉推送闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/352280/events/fa8235ae31344d539a3651d8b9189015/?project=22&statsPeriod=14d 2024-02-04 11:46:04 +08:00
818dec8428 chore: 版本更新至 5.33.2-1012 2024-02-02 17:47:35 +08:00
b79ada682f Merge branch 'hotfix/v5.33.1-1011-crashes' into 'release'
fix: 修复登录后快速关闭绑定手机号页面造成的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/363814

See merge request halo/android/assistant-android!1536
2024-02-02 17:46:45 +08:00
78330c1d12 Merge branch 'hotfix/v5.33.1-1011/runtime_exception' into 'release'
fix: 修复子线程弹出Dialog导致闪退的问题...

See merge request halo/android/assistant-android!1537
2024-02-02 17:45:40 +08:00
ff6e73cdb1 fix: 修复子线程弹出Dialog导致闪退的问题 https://sentry.shanqu.cc/organizations/lightgame/issues/364053/events/20753e6a2e6e4136b9edc2d1c0dcd95e/?project=22&statsPeriod=14d 2024-02-02 17:41:08 +08:00
4be928b015 fix: 修复登录后快速关闭绑定手机号页面造成的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/363814
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-02-02 17:12:58 +08:00
a28451a976 build: 更改 gradle 源地址 2024-01-31 17:59:25 +08:00
ec70e2c47e Merge branch 'hotfix/meta_build_error' into 'release'
fix: 修复推广打包脚本的编译问题

See merge request halo/android/assistant-android!1533
2024-01-31 17:33:30 +08:00
68d546c7ca fix: 修复推广打包脚本的编译问题
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-01-31 17:05:15 +08:00
365aa5d8da chore: 版本更新至 5.33.1-1011 2024-01-31 14:39:02 +08:00
c842a9a184 Merge branch 'hotfix/v5.33.0-1010-crashes' into 'release'
修复 5.33.0-1010 的线上问题

See merge request halo/android/assistant-android!1532
2024-01-31 14:38:33 +08:00
6093b662a1 fix: 临时修复微博登录时偶发的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/314704
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-01-31 14:24:13 +08:00
85d8638178 fix: 修复浏览播放论坛视频时的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/363309
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-01-31 14:23:09 +08:00
ff434a0e51 fix: 修复海外地址弹窗弹出闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/360465/
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-01-31 11:24:10 +08:00
93ec29884b Merge branch 'hotfix/v5.33.0-1010-crashes' into 'release'
fix: 修复多线程初始化下载数据库可能的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/320027

See merge request halo/android/assistant-android!1531
2024-01-30 18:01:34 +08:00
f7bb617edb fix: 移除 EasyPermission 库
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-01-30 17:39:38 +08:00
1b5567f470 fix: 尝试修复卸载应用时可能的数组越界问题 https://sentry.shanqu.cc/organizations/lightgame/issues/242447/
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-01-30 17:17:55 +08:00
d1628b3377 fix: 修复重复设置 LayoutFactoryInflater factory 导致的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/350192
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-01-30 17:17:55 +08:00
509d6f4ac6 fix: 修复更换用户头像时的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/354267
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-01-30 17:17:54 +08:00
5f9257a103 fix: 修复权限获取后的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/355494 https://sentry.shanqu.cc/organizations/lightgame/issues/355612 2024-01-30 17:17:54 +08:00
d50bea5f62 fix: 修复多线程初始化下载数据库可能的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/320027
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-01-30 15:52:44 +08:00
e138890f4d Merge branch 'hotfix/v5.33.0-1010-crashes' into 'release'
fix: 修复首页替换游戏导致的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/352562/?project=22

See merge request halo/android/assistant-android!1530
2024-01-30 15:32:49 +08:00
96734e3ead fix: 修复首页替换游戏导致的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/352562 2024-01-30 14:51:02 +08:00
7a596f49ca Merge branch 'fix/GHZS-4681' into 'dev'
fix:【光环助手】同步正式环境问题-反馈内容提交到后台显示乱码 https://jira.shanqu.cc/browse/GHZS-4681

See merge request halo/android/assistant-android!1528
2024-01-29 13:40:28 +08:00
564e5cbb8c fix:【光环助手】同步正式环境问题-反馈内容提交到后台显示乱码 https://jira.shanqu.cc/browse/GHZS-4681 2024-01-29 13:38:51 +08:00
25d7f2731a Merge branch 'fix/download_crash' into 'dev'
fix: 修复下载完成状态同步异常导致的闪退问题

See merge request halo/android/assistant-android!1527
2024-01-29 11:11:01 +08:00
36c164da26 fix: 修复下载完成状态同步异常导致的闪退问题 2024-01-29 11:09:21 +08:00
4996d62252 Merge branch 'fix/GHZS-4678' into 'dev'
fix:【光环助手】同步正式环境问题-畅玩问题内容未带前缀 https://jira.shanqu.cc/browse/GHZS-4678

See merge request halo/android/assistant-android!1525
2024-01-26 17:10:59 +08:00
20bab0fc84 fix:【光环助手】同步正式环境问题-畅玩问题内容未带前缀 https://jira.shanqu.cc/browse/GHZS-4678 2024-01-26 16:32:21 +08:00
74f6f3467b Merge branch 'chen/202401/GHZS-4673' into 'dev'
feat:搜索结果页面新增游戏首位设置:5.33.0客户端交互验收小优化—客户端 https://jira.shanqu.cc/browse/GHZS-4673

See merge request halo/android/assistant-android!1524
2024-01-26 14:11:22 +08:00
af4647dc37 feat:搜索结果页面新增游戏首位设置:5.33.0客户端交互验收小优化—客户端 https://jira.shanqu.cc/browse/GHZS-4673 2024-01-26 14:04:57 +08:00
e2306124b2 Merge branch 'feat/GHZS-4461' into 'dev'
feat: 神策统计口径切换 https://jira.shanqu.cc/browse/GHZS-4461

See merge request halo/android/assistant-android!1510
2024-01-25 13:43:24 +08:00
00cd4c1f1f feat: 神策统计口径切换 https://jira.shanqu.cc/browse/GHZS-4461 2024-01-25 13:34:54 +08:00
4ace4b8056 Merge branch 'feat/GHZS-4434' into 'dev'
feat: 版本更新弹窗神策埋点补充 https://jira.shanqu.cc/browse/GHZS-4434

See merge request halo/android/assistant-android!1519
2024-01-25 09:18:08 +08:00
bffdc42eac feat: 版本更新弹窗神策埋点补充 https://jira.shanqu.cc/browse/GHZS-4434 2024-01-24 17:11:30 +08:00
0d6aa9f11d Merge branch 'feature-GHZS-4529' into 'dev'
feat: 云存档埋点优化—客户端 https://jira.shanqu.cc/browse/GHZS-4529

See merge request halo/android/assistant-android!1518
2024-01-24 16:52:16 +08:00
357c48ab08 feat: 云存档埋点优化—客户端 https://jira.shanqu.cc/browse/GHZS-4529 2024-01-24 16:52:16 +08:00
f1d3705f80 Merge branch 'feature-GHZS-4530' into 'dev'
feat: 兼职包特殊渠道处理—客户端 https://jira.shanqu.cc/browse/GHZS-4530

See merge request halo/android/assistant-android!1517
2024-01-24 16:14:37 +08:00
699679289b feat: 兼职包特殊渠道处理—客户端 https://jira.shanqu.cc/browse/GHZS-4530 2024-01-24 16:14:37 +08:00
f8dc122c41 Merge branch 'feat/GHZS-4501' into 'dev'
feat: 实名接口调整 https://jira.shanqu.cc/browse/GHZS-4501

See merge request halo/android/assistant-android!1511
2024-01-24 15:44:53 +08:00
0a56189ae8 feat: 实名接口调整 https://jira.shanqu.cc/browse/GHZS-4501 2024-01-24 14:41:52 +08:00
e079116d80 Merge branch 'fix/GHZS-4627' into 'dev'
fix: 广告管理相关优化—0122测试-客户端 https://jira.shanqu.cc/browse/GHZS-4627

See merge request halo/android/assistant-android!1513
2024-01-24 10:28:10 +08:00
d661a91c2f Merge branch 'feat/GHZS-4639' into 'dev'
feat: 推广包升级广点通SDK https://jira.shanqu.cc/browse/GHZS-4639

See merge request halo/android/assistant-android!1512
2024-01-24 10:11:16 +08:00
3ff5b04893 feat: 推广包升级广点通SDK https://jira.shanqu.cc/browse/GHZS-4639
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-01-24 10:01:09 +08:00
9c8bc7742c Revert "fix: 广告管理相关优化—0122测试-客户端(ci) https://jira.shanqu.cc/browse/GHZS-4627"
This reverts commit 9778cf439b.
2024-01-24 09:56:23 +08:00
4c01859683 Merge branch 'feat/GHZS-4542' into 'dev'
feat: 游戏内容屏蔽后台 https://jira.shanqu.cc/browse/GHZS-4542

See merge request halo/android/assistant-android!1509
2024-01-23 11:09:25 +08:00
794a681f07 feat: 游戏内容屏蔽后台 https://jira.shanqu.cc/browse/GHZS-4542 2024-01-23 11:01:15 +08:00
9778cf439b fix: 广告管理相关优化—0122测试-客户端(ci) https://jira.shanqu.cc/browse/GHZS-4627 2024-01-23 10:09:41 +08:00
a66f62bcb7 fix: 广告管理相关优化—0122测试-客户端 https://jira.shanqu.cc/browse/GHZS-4627 2024-01-23 10:07:45 +08:00
0935a75ec0 Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	app/build.gradle
#	dependencies.gradle
2024-01-19 17:34:31 +08:00
0a221c07bf Merge branch 'fix/GHZS-4600' into 'dev'
fix:【光环助手】意见反馈的默认文案出错 https://jira.shanqu.cc/browse/GHZS-4600

See merge request halo/android/assistant-android!1505
2024-01-19 11:31:43 +08:00
011ff1e24a fix:【光环助手】意见反馈的默认文案出错 https://jira.shanqu.cc/browse/GHZS-4600 2024-01-19 11:28:49 +08:00
9cd8b5d8d5 chore: 版本更新至 5.32.9-1001 2024-01-16 15:52:27 +08:00
1eb77e8bd2 Merge branch 'fix/GHZS-4567' into 'release'
fix: V5.32.8实名认证问题 https://jira.shanqu.cc/browse/GHZS-4567

See merge request halo/android/assistant-android!1502
2024-01-16 15:41:18 +08:00
650dd2e2ad fix: V5.32.8实名认证问题 https://jira.shanqu.cc/browse/GHZS-4567
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-01-16 14:43:04 +08:00
563955940d chore: 版本更新至 5.32.9-1000 2024-01-15 17:59:36 +08:00
376996540d Merge branch 'fix/GHZS-4553' into 'release'
fix: V5.32.9群测问题汇总 https://jira.shanqu.cc/browse/GHZS-4553

See merge request halo/android/assistant-android!1500
2024-01-15 17:58:51 +08:00
1292446bd0 fix: V5.32.9群测问题汇总 https://jira.shanqu.cc/browse/GHZS-4553 2024-01-15 17:58:15 +08:00
427ce5bc38 Merge branch 'feature-GHZS-3815-dev' into 'dev'
feat: 港澳APP—客户端 https://jira.shanqu.cc/browse/GHZS-3815

See merge request halo/android/assistant-android!1499
2024-01-15 17:48:25 +08:00
e7897f9b18 feat: 港澳APP—客户端 https://jira.shanqu.cc/browse/GHZS-3815 2024-01-15 17:48:25 +08:00
55ece981b5 chore: 版本更新至 5.32.9 2024-01-12 16:23:11 +08:00
7f68b165cb Merge branch 'feat/GHZS-4498' into 'release'
feat: 神马SDK接入 https://jira.shanqu.cc/browse/GHZS-4498

See merge request halo/android/assistant-android!1495
2024-01-12 16:22:01 +08:00
bf46229bcd feat: 神马SDK接入 https://jira.shanqu.cc/browse/GHZS-4498 2024-01-12 15:43:18 +08:00
ce80f133a0 feat: 更新 LGLibrary 的依赖 2024-01-12 15:41:34 +08:00
e5ea731946 Merge branch 'feat/GHZS-4541' into 'release'
feat: 更新信通院最新版本SDK https://jira.shanqu.cc/browse/GHZS-4541

See merge request halo/android/assistant-android!1494
2024-01-12 15:36:46 +08:00
24d7f60426 Merge branch 'feat/GHZS-4522' into 'release'
feat: 第三方下载地址-实名流程补充 https://jira.shanqu.cc/browse/GHZS-4522

See merge request halo/android/assistant-android!1493
2024-01-12 15:34:30 +08:00
3a0205789a feat: 第三方下载地址-实名流程补充 https://jira.shanqu.cc/browse/GHZS-4522 2024-01-12 15:18:12 +08:00
f86edd196f Merge branch 'feat/GHZS-4537' into 'release'
feat: 推广包升级快手SDK https://jira.shanqu.cc/browse/GHZS-4536

See merge request halo/android/assistant-android!1492
2024-01-12 14:48:21 +08:00
898278b3d9 feat: 推广包升级快手SDK https://jira.shanqu.cc/browse/GHZS-4536 2024-01-12 14:42:48 +08:00
fd757a346c feat: 更新信通院最新版本SDK https://jira.shanqu.cc/browse/GHZS-4541 2024-01-12 14:17:21 +08:00
ed32da8882 Merge branch 'fix/GHZS-4487' into 'dev'
fix: V5.32.8华为鸿蒙系统-模拟器下载问题 https://jira.shanqu.cc/browse/GHZS-4487

See merge request halo/android/assistant-android!1488
2024-01-08 10:06:21 +08:00
d7e88ba38a fix: V5.32.8华为鸿蒙系统-模拟器下载问题 https://jira.shanqu.cc/browse/GHZS-4487 2024-01-08 09:57:28 +08:00
af0ba215dd Merge branch 'feat/GHZS-4476' into 'dev'
feat: 补充权限使用说明 https://jira.shanqu.cc/browse/GHZS-4476

See merge request halo/android/assistant-android!1487
2024-01-05 10:15:40 +08:00
8e7a168495 feat: 补充权限使用说明 https://jira.shanqu.cc/browse/GHZS-4476 2024-01-05 09:47:42 +08:00
913bf7ad2f Merge branch 'fix/hot_launch_splash_ad' into 'dev'
fix: 修复使用第三方登录或分享回到光环时显示开屏广告的问题

See merge request halo/android/assistant-android!1486
2024-01-04 11:21:15 +08:00
4d84af6ff9 fix: 修复使用第三方登录或分享回到光环时显示开屏广告的问题 2024-01-04 11:21:15 +08:00
1acfe4227f Merge branch 'fix/GHZS-4442' into 'dev'
fix: 客户端添加多个下载任务,操作全部开始和暂停时会有任务卡住无法下载  https://jira.shanqu.cc/browse/GHZS-4442

See merge request halo/android/assistant-android!1483
2024-01-03 12:02:33 +08:00
847def3d30 Merge branch 'fix/GHZS-4467' into 'dev'
fix: 同时下载多个畅玩游戏时,游戏详情页的进度条会消失 https://jira.shanqu.cc/projects/GHZS/issues/GHZS-4467

See merge request halo/android/assistant-android!1485
2024-01-03 12:02:28 +08:00
f523e984c8 fix: 客户端添加多个下载任务,操作全部开始和暂停时会有任务卡住无法下载 https://jira.shanqu.cc/browse/GHZS-4442 2024-01-03 11:47:15 +08:00
5fe39d69de Merge branch 'fix/wrong_entity_usage' into 'dev'
fix: 修复 下载管理-游戏更新 页面上报数据时使用了错误实体的问题

See merge request halo/android/assistant-android!1484
2023-12-29 10:38:41 +08:00
0c76783397 fix: 修复 下载管理-游戏更新 页面上报数据时使用了错误实体的问题 2023-12-29 10:20:32 +08:00
e4b5a6ef5a fix: 同时下载多个畅玩游戏时,游戏详情页的进度条会消失 https://jira.shanqu.cc/projects/GHZS/issues/GHZS-4467 2023-12-28 15:22:27 +08:00
f03a9677cc fix: 处理合并冲突 2023-12-28 13:52:22 +08:00
c4b519204b Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	app/src/main/java/com/gh/common/util/DialogUtils.java
#	app/src/main/java/com/gh/gamecenter/MainActivity.java
#	app/src/main/res/layout/dialog_privacy_policy.xml
#	dependencies.gradle
#	module_common/src/main/java/com/gh/gamecenter/common/utils/PermissionHelper.kt
2023-12-28 11:53:03 +08:00
423bcda7ff Merge branch 'feat/GHZS-4446' into 'release'
feat:【光环助手】隐私合规问题-12/22 https://jira.shanqu.cc/browse/GHZS-4444

See merge request halo/android/assistant-android!1482
2023-12-28 11:44:29 +08:00
2bb61e8e4b feat: 隐私合规问题-12/22 https://jira.shanqu.cc/browse/GHZS-4446 2023-12-28 11:43:56 +08:00
84d8de881e Merge branch 'fix/GHZS-4421' into 'dev'
fix: 神策埋点上报问题 https://jira.shanqu.cc/browse/GHZS-4421

See merge request halo/android/assistant-android!1478
2023-12-27 17:26:07 +08:00
3809d6d887 Merge branch 'fix/CWZS-145' into 'dev'
fix: 偶现下载任务无法删除 https://jira.shanqu.cc/browse/CWZS-145

See merge request halo/android/assistant-android!1480
2023-12-27 17:26:04 +08:00
96c18ec7a6 Merge branch 'fix/GHZS-4393' into 'dev'
fix: 开测表时间问题 https://jira.shanqu.cc/browse/GHZS-4393

See merge request halo/android/assistant-android!1481
2023-12-27 17:25:59 +08:00
d052ef5923 fix: 开测表时间问题 https://jira.shanqu.cc/browse/GHZS-4393 2023-12-27 11:51:06 +08:00
993631c853 fix: 偶现下载任务无法删除 https://jira.shanqu.cc/browse/CWZS-145 2023-12-22 17:12:40 +08:00
3a9958fa7d Merge branch 'fix/GHZS-4439' into 'dev'
fix: 【光环助手】版块下载按钮显示问题 https://jira.shanqu.cc/browse/GHZS-4439

See merge request halo/android/assistant-android!1479
2023-12-22 11:31:50 +08:00
bb51391b61 fix: 【光环助手】版块下载按钮显示问题 https://jira.shanqu.cc/browse/GHZS-4439 2023-12-22 11:31:50 +08:00
57f1cb7e59 Merge branch 'fix/GHZS-3923' into 'dev'
fix: 内容触发敏感词点击还原后未正常展示 https://jira.shanqu.cc/browse/GHZS-3923

See merge request halo/android/assistant-android!1476
2023-12-18 16:44:50 +08:00
b4cd90a7e9 Merge branch 'fix/sensor-privacy-issue' into 'dev'
fix: 修复神策 SDK 可能反复获取运营商信息的问题...

See merge request halo/android/assistant-android!1477
2023-12-18 16:44:45 +08:00
6ec9d2076f fix: 修复神策 SDK 可能反复获取运营商信息的问题 https://manual.sensorsdata.cn/sa/latest/zh_cn/tech_sdk_client_android_high-128974940.html#id-.%E9%AB%98%E7%BA%A7%E5%8A%9F%E8%83%BD%EF%BC%88Android%EF%BC%89v2.5-%E9%99%90%E5%88%B6SDK%E8%AF%BB%E5%8F%96%E6%95%8F%E6%84%9F%E5%B1%9E%E6%80%A7 2023-12-18 16:36:45 +08:00
22c727cd2f Merge branch 'hotfix/v5.32.7-997/crashes' into 'release'
修复sentry闪退问题

See merge request halo/android/assistant-android!1475
2023-12-18 14:20:19 +08:00
5e5aee539e fix: 修复首页下拉刷新偶发的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/352463/?project=22&query=is%3Aunresolved+assigned%3Ame&sort=date&statsPeriod=14d 2023-12-18 14:11:21 +08:00
c158225472 fix: 修复开屏广告偶发的空指针闪退 https://sentry.shanqu.cc/organizations/lightgame/issues/349408/events/ca7a12772e484958a5a9d4113fcba161/?project=22&statsPeriod=14d 2023-12-18 14:10:30 +08:00
ac5b7837db Merge branch 'fix/hot_launch_splash_ad' into 'dev'
fix: 修复重复展示热启动和冷启动开屏广告的问题

See merge request halo/android/assistant-android!1474
2023-12-15 17:45:15 +08:00
05a113de40 fix: 修复重复展示热启动和冷启动开屏广告的问题 2023-12-15 17:29:25 +08:00
d45d02bfd2 fix: 神策埋点上报问题 https://jira.shanqu.cc/browse/GHZS-4421
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2023-12-15 17:19:25 +08:00
395433f21f Merge branch 'feature-GHZS-3788' into 'dev'
feat: 新增草稿箱入口—客户端 https://jira.shanqu.cc/browse/GHZS-3788

See merge request halo/android/assistant-android!1473
2023-12-14 18:07:18 +08:00
ccbd70666a feat: 新增草稿箱入口—客户端 https://jira.shanqu.cc/browse/GHZS-3788 2023-12-14 18:07:18 +08:00
aaa8eda004 Merge branch 'feature-GHZS-4259' into 'dev'
fix: 【光环助手】“横屏滑动视频”专题滑动导致APP卡顿 https://jira.shanqu.cc/browse/GHZS-4259

See merge request halo/android/assistant-android!1459
2023-12-14 18:06:45 +08:00
748497e5b1 fix: 【光环助手】“横屏滑动视频”专题滑动导致APP卡顿 https://jira.shanqu.cc/browse/GHZS-4259 2023-12-14 18:06:45 +08:00
1cf49b931e Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	dependencies.gradle
2023-12-14 17:03:14 +08:00
e4a9d533d4 Merge branch 'feat/GHZS-3698' into 'dev'
feat: 通用链接模块新增帮助与反馈类型 https://jira.shanqu.cc/browse/GHZS-3785

See merge request halo/android/assistant-android!1425
2023-12-14 16:53:55 +08:00
36e9bd20ac fix: V5.32.5群测问题汇总1204 https://jira.shanqu.cc/browse/GHZS-4375 2023-12-13 15:36:34 +08:00
cc4ef16e10 chore: 版本更新至 5.32.7 2023-12-13 14:20:28 +08:00
6a446a6f3a Merge branch 'fix/GHZS-4375' into 'dev'
fix: V5.32.5群测问题汇总1204 https://jira.shanqu.cc/browse/GHZS-4375

See merge request halo/android/assistant-android!1472
2023-12-13 10:44:01 +08:00
233e0ec71d fix: V5.32.5群测问题汇总1204 https://jira.shanqu.cc/browse/GHZS-4375 2023-12-13 10:27:10 +08:00
d6e1a90472 Merge branch 'feat/GHZS-4384' into 'dev'
feat: 适龄提示等级补充 https://jira.shanqu.cc/browse/GHZS-4384

See merge request halo/android/assistant-android!1471
2023-12-13 10:06:52 +08:00
0911cd146b Merge branch 'hotfix/v5.32.5-995/CWZS-138' into 'release'
fix:【畅玩助手】畅玩-最近在玩模块、双开按钮异常 https://jira.shanqu.cc/browse/CWZS-138

See merge request halo/android/assistant-android!1468
2023-12-13 09:34:04 +08:00
8e255b1803 fix:【畅玩助手】畅玩-最近在玩模块、双开按钮异常 https://jira.shanqu.cc/browse/CWZS-138 2023-12-13 09:34:04 +08:00
14939625dd Merge branch 'feat/GHZS-3791' into 'dev'
feat: 广告管理相关优化—客户端 https://jira.shanqu.cc/browse/GHZS-3791

See merge request halo/android/assistant-android!1430
2023-12-13 09:31:58 +08:00
19afb7221d feat: 广告管理相关优化—客户端 https://jira.shanqu.cc/browse/GHZS-3791 2023-12-13 09:31:58 +08:00
ae0f4c948b chore: 版本更新至 5.32.5 2023-12-12 15:04:32 +08:00
d650739632 Merge branch 'feature-GHZS-sentry-20231211' into 'release'
fix: Sentry异常修复

See merge request halo/android/assistant-android!1470
2023-12-11 18:00:01 +08:00
6f6a734cb5 fix: Sentry异常修复 2023-12-11 18:00:01 +08:00
e510146775 Merge branch 'hotfix/v5.32.5-995/search_crash' into 'release'
fix: 修复点击搜索栏闪退的问题...

See merge request halo/android/assistant-android!1469
2023-12-11 10:09:01 +08:00
8b863955a3 fix: 修复点击搜索栏闪退的问题 https://sentry.shanqu.cc/organizations/lightgame/issues/350701/events/e5db556244ac4ecb93d37e7997103bf3/?environment=kuaishou&project=22 2023-12-11 10:03:02 +08:00
37155b96dd Merge branch 'hotfix/v5.32.5-995/crashes' into 'release'
修复sentry闪退问题

See merge request halo/android/assistant-android!1467
2023-12-08 14:07:02 +08:00
e55d4d3332 fix: 捕获替换Fragment关联的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/348952/events/d6c0400d0edb4ee8b302faab4707960d/?project=22&statsPeriod=14d 2023-12-08 13:50:00 +08:00
3e38830480 Merge branch 'feat/GHZS-4377' into 'dev'
feat: 游戏详情当前版本展示规则变更 https://jira.shanqu.cc/browse/GHZS-4377

See merge request halo/android/assistant-android!1466
2023-12-06 16:04:10 +08:00
dabf532ae7 feat: 游戏详情当前版本展示规则变更 https://jira.shanqu.cc/browse/GHZS-4377
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2023-12-06 15:59:10 +08:00
7aa2b20224 feat: 适龄提示等级补充 https://jira.shanqu.cc/browse/GHZS-4384
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2023-12-06 11:53:25 +08:00
10572e7b0b fix: 修复线上闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/349079/events/06d299cb0e6549a49f80cd248a91e614/?project=22 2023-12-05 14:53:00 +08:00
3912729fff Merge branch 'fix/GHZS-4364' into 'dev'
fix: 游戏下载按钮显示问题 https://jira.shanqu.cc/browse/GHZS-4364

See merge request halo/android/assistant-android!1465
2023-12-05 10:27:39 +08:00
78ff8dcb0a fix: 游戏下载按钮显示问题 https://jira.shanqu.cc/browse/GHZS-4364
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2023-12-01 16:54:40 +08:00
80e7ad9401 Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	dependencies.gradle
2023-12-01 10:08:09 +08:00
0c807922d6 chore: 版本更新至 5.32.5 2023-11-29 16:51:00 +08:00
d7f5b573c6 Merge branch 'hotfix/v5.32.4-994/provider_conflict' into 'release'
fix: 移除穿山甲广告 tools 依赖

See merge request halo/android/assistant-android!1463
2023-11-29 16:50:04 +08:00
f9d624b077 fix: 移除穿山甲广告 tools 依赖 2023-11-29 16:48:42 +08:00
a22fa59975 Merge branch 'hotfix/v5.32.4-994/get_app_list_crash' into 'release'
fix: 获取应用列表时偶发的空指针异常 https://sentry.shanqu.cc/organizations/lightgame/issues/343985/?project=22

See merge request halo/android/assistant-android!1460
2023-11-27 10:15:41 +08:00
e68ad6489a fix: 获取应用列表时偶发的空指针异常 https://sentry.shanqu.cc/organizations/lightgame/issues/343985/?project=22 2023-11-27 10:06:09 +08:00
ccd3a98799 Merge branch 'hotfix/v5.32.4-994/deadsystem-crash' into 'release'
fix: catch 部分 DeadSystemException 异常

See merge request halo/android/assistant-android!1458
2023-11-24 11:45:28 +08:00
96026ef9fa fix: catch 部分 DeadSystemException 异常 2023-11-24 11:31:56 +08:00
a9ba7d056b Merge branch 'feat/GHZS-3983' into 'dev'
feat: 游戏下载判断逻辑优化 https://jira.shanqu.cc/browse/GHZS-3982

See merge request halo/android/assistant-android!1444
2023-11-23 16:36:23 +08:00
da4e83d29d feat: 游戏下载判断逻辑优化 https://jira.shanqu.cc/browse/GHZS-3983 2023-11-23 16:17:40 +08:00
777e05733c chore: 版本更新至 5.32.4
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2023-11-23 15:41:58 +08:00
cc9c390bbb fix: 内容触发敏感词点击还原后未正常展示 https://jira.shanqu.cc/browse/GHZS-3923
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2023-11-23 14:56:52 +08:00
d96ae0cdbb Merge branch 'chen/202311/GHZS-3800' into 'dev'
feat:搜索结果页面新增游戏首位设置—客户端 https://jira.shanqu.cc/browse/GHZS-3800

See merge request halo/android/assistant-android!1457
2023-11-23 13:37:10 +08:00
c8a1bd5278 feat:搜索结果页面新增游戏首位设置—客户端 https://jira.shanqu.cc/browse/GHZS-3800 2023-11-23 13:37:10 +08:00
aa0d36a3ba Merge branch 'feat/GHZS-3783' into 'dev'
feat: 畅玩游戏问题反馈优化—客户端 https://jira.shanqu.cc/browse/GHZS-3783

See merge request halo/android/assistant-android!1423
2023-11-23 11:47:33 +08:00
ffe1c0606a feat: 畅玩游戏问题反馈优化—客户端 https://jira.shanqu.cc/browse/GHZS-3783 2023-11-23 11:47:33 +08:00
7f73b728a5 feat: 通用链接模块新增帮助与反馈类型 https://jira.shanqu.cc/browse/GHZS-3785 2023-11-22 17:54:41 +08:00
5cfb7f5036 Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	dependencies.gradle
2023-11-22 17:54:06 +08:00
399e513174 Merge branch 'feat/GHZS-3760' into 'dev'
feat: 帮助与反馈第二期迭代 https://jira.shanqu.cc/browse/GHZS-3760

See merge request halo/android/assistant-android!1424
2023-11-22 17:16:10 +08:00
cbf6f34a9c Merge branch 'hotfix/v5.32.3-993/replace_fragment_crash' into 'release'
fix: 修复底部第四个Tab重复创建Fragment的问题,捕获替换Fragment出现的异常

See merge request halo/android/assistant-android!1455
2023-11-22 13:40:11 +08:00
23c0f12ed3 fix: 修复底部第四个Tab重复创建Fragment的问题,捕获替换Fragment出现的异常 2023-11-22 11:55:19 +08:00
da91dcab59 chore: 版本更新至 5.32.3
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2023-11-21 17:07:32 +08:00
ee846bc620 Merge branch 'feat/GHZS-4303' into 'release'
feat: 广告回传参数补充 https://jira.shanqu.cc/browse/GHZS-4303

See merge request halo/android/assistant-android!1453
2023-11-21 17:06:22 +08:00
aa3db9330e feat: 广告回传参数补充 https://jira.shanqu.cc/browse/GHZS-4303
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2023-11-21 16:52:08 +08:00
2393dc2291 chore: 版本更新至 5.32.2
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2023-11-21 15:03:12 +08:00
cb94bc9f29 Merge branch 'hotfix/v5.32.1-991/crashes' into 'release'
fix: 修复文章详情预加载闪退,修复评论页列表刷新闪退

See merge request halo/android/assistant-android!1452
2023-11-21 15:01:45 +08:00
a60442db41 fix: 修复文章详情预加载闪退,修复评论页列表刷新闪退
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2023-11-21 14:30:35 +08:00
1eeb34c93a Merge branch 'feature/GHZS-4272-patch' into 'dev'
fix: 内容搜索新增搜索配置(客户端)-1117测试-客户端...

See merge request halo/android/assistant-android!1450
2023-11-20 15:24:05 +08:00
d18f3909ea fix: 内容搜索新增搜索配置(客户端)-1117测试-客户端... 2023-11-20 15:24:05 +08:00
c23118e535 Merge remote-tracking branch 'origin/dev' into dev-5.33.0
# Conflicts:
#	dependencies.gradle
2023-11-20 14:41:30 +08:00
4d4498cdee Merge branch 'release' into 'dev'
chore: 版本更新至 5.32.1

See merge request halo/android/assistant-android!1448
2023-11-20 14:36:25 +08:00
a348b80eaf Merge branch 'dev' into 'dev-5.33.0'
merge dev into dev-5.33.0

See merge request halo/android/assistant-android!1447
2023-11-20 14:34:22 +08:00
9691344e67 chore: 版本更新至 5.32.1
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2023-11-20 14:32:54 +08:00
64bdbbf409 Merge branch 'feature-GHZS-4272' into 'dev-5.33.0'
fix: 内容搜索新增搜索配置(客户端)-1117测试-客户端 https://jira.shanqu.cc/browse/GHZS-4272

See merge request halo/android/assistant-android!1446
2023-11-20 10:51:36 +08:00
984bb60e6a fix: 内容搜索新增搜索配置(客户端)-1117测试-客户端 https://jira.shanqu.cc/browse/GHZS-4272 2023-11-20 10:51:36 +08:00
41ba8c3e5a Merge branch 'fix/article_detail_culprit' into 'dev'
fix: 修复不能同时打开两个社区文章详情页面的问题

See merge request halo/android/assistant-android!1445
2023-11-17 15:11:31 +08:00
b203d3a756 fix: 修复不能同时打开两个社区文章详情页面的问题 2023-11-16 14:36:45 +08:00
1461af16b9 feat: 帮助与反馈第二期迭代 https://jira.shanqu.cc/browse/GHZS-3760 2023-11-15 14:14:28 +08:00
14fca95ed6 Merge branch 'feature-GHZS-3949' into 'dev-5.33.0'
fix: 内容搜索新增搜索配置(客-户-端)—1110测试-后端 https://jira.shanqu.cc/browse/GHZS-3949

See merge request halo/android/assistant-android!1442
2023-11-15 11:21:50 +08:00
c3926c85d8 fix: 内容搜索新增搜索配置(客-户-端)—1110测试-后端 https://jira.shanqu.cc/browse/GHZS-3949 2023-11-15 11:21:50 +08:00
9b73272019 Merge branch 'dev' into 'dev-5.33.0'
合并 dev 到 dev-5.33.0

See merge request halo/android/assistant-android!1443
2023-11-15 11:16:14 +08:00
28bca22d93 ci: 变更编译文件存放的 OSS 地址 2023-11-15 11:13:51 +08:00
905571a637 fix:【光环助手】单机插件跳转更新验收问题(1) https://jira.shanqu.cc/browse/GHZS-3870 2023-11-15 11:13:48 +08:00
5757df01e7 Merge branch 'dev-5.33.0-merged-dev' into 'dev-5.33.0'
Dev 5.33.0 merged dev

See merge request halo/android/assistant-android!1436
2023-11-10 14:12:42 +08:00
3f60f85992 Merge branch 'dev' into dev-5.33.0-merged-dev
# Conflicts:
#	app/src/main/java/com/gh/gamecenter/forum/search/CommunitySearchEventListener.kt
#	app/src/main/java/com/gh/gamecenter/forum/search/ForumContentSearchListAdapter.kt
#	app/src/main/java/com/gh/gamecenter/forum/search/ForumContentSearchListFragment.kt
2023-11-10 14:05:20 +08:00
dc9ac67e6e Merge branch 'feat/CWZS-79' into 'dev'
畅玩安装本地apk

See merge request halo/android/assistant-android!1433
2023-11-10 14:00:49 +08:00
8c1d4a3778 feat: SD卡游戏按时间排序 https://jira.shanqu.cc/browse/CWZS-79 2023-11-10 13:58:38 +08:00
7189261c01 Merge branch 'feat/build_jira_comment' into 'dev'
ci: jira 需求下补充 APK 附件评论

See merge request halo/android/assistant-android!1431
2023-11-10 11:20:53 +08:00
86c1781426 ci: jira 需求下补充 APK 附件评论 2023-11-10 11:20:31 +08:00
4812e9258b fix: 过滤gh-files目录下的apk包无法正常解析。只扫描一级目录 2023-11-10 11:10:07 +08:00
b906fe7b47 Merge branch 'feat/build_jira_comment' into 'dev'
ci: jira 需求下补充 APK 附件评论

See merge request halo/android/assistant-android!1428
2023-11-10 10:43:30 +08:00
846fd7222e ci: jira 需求下补充 APK 附件评论 2023-11-10 10:42:55 +08:00
1afabdfd94 Merge branch 'chen/202311/GHZS-3940' into 'dev'
fix:埋点问题:内容内容推荐结果点击事件上报错误 https://jira.shanqu.cc/browse/GHZS-3940

See merge request halo/android/assistant-android!1427
2023-11-10 10:37:44 +08:00
8ed2a13884 fix:埋点问题:内容内容推荐结果点击事件上报错误 https://jira.shanqu.cc/browse/GHZS-3940 2023-11-10 10:34:07 +08:00
52980189ed Merge branch 'chen/202310/GHZS-3730' into 'dev-5.33.0' 2023-11-09 14:01:17 +08:00
852f7734ef feat:论坛搜索排序逻辑优化—客户端 https://jira.shanqu.cc/browse/GHZS-3730 2023-11-09 14:01:17 +08:00
a25503113b Merge branch 'docs/GHZS-3866' into 'dev-5.33.0'
docs: 为首页所有现有的 ViewHolder 备注后台对应的样式名称 https://jira.shanqu.cc/browse/GHZS-3866

See merge request halo/android/assistant-android!1426
2023-11-08 18:03:38 +08:00
0d6b62b361 docs: 为首页所有现有的 ViewHolder 备注后台对应的样式名称 https://jira.shanqu.cc/browse/GHZS-3866 2023-11-08 14:34:29 +08:00
e3b8ea74c1 fix: 处理与 5.32.0 的代码冲突 2023-11-08 11:44:15 +08:00
bf10d5aa42 Merge remote-tracking branch 'origin/dev' into dev-5.33.0
# Conflicts:
#	app/src/main/java/com/gh/gamecenter/category/CategoryDirectoryFragment.kt
#	app/src/main/java/com/gh/gamecenter/forum/detail/ForumArticleAskListFragment.kt
#	app/src/main/java/com/gh/gamecenter/forum/search/ForumContentSearchListFragment.kt
#	app/src/main/java/com/gh/gamecenter/forum/search/UserSearchListFragment.kt
#	app/src/main/res/layout/fragment_list_article_detail_comment.xml
2023-11-08 11:30:16 +08:00
cd13c98ac2 Merge branch 'feature-GHZS-3850' into 'dev'
fix: 【光环助手】深夜模式帖子-相关tab展示错误 https://jira.shanqu.cc/browse/GHZS-3850

See merge request halo/android/assistant-android!1422
2023-11-07 09:50:30 +08:00
2c49b468e6 fix: 【光环助手】深夜模式帖子-相关tab展示错误 https://jira.shanqu.cc/browse/GHZS-3850 2023-11-07 09:45:44 +08:00
d175e895c3 Merge branch 'feat/GHZS-3613' into 'dev'
feat: 设备ID重构 https://jira.shanqu.cc/browse/GHZS-3707

See merge request halo/android/assistant-android!1402
2023-11-06 11:45:52 +08:00
1c0af1be7d feat: 设备ID重构 https://jira.shanqu.cc/browse/GHZS-3707 2023-11-06 11:45:52 +08:00
62f5a479c9 Merge branch 'fix/INTERACT_ACROSS_USERS_crash' into 'dev'
fix: 尝试修复 INTERACT_ACROSS_USERS permission 闪退问题

See merge request halo/android/assistant-android!1420
2023-11-06 10:43:44 +08:00
a87011d5b0 Merge branch 'chen/202311/fix-search-crash-when-exchange-dark' into 'dev'
fix:社区搜索改为懒加载后,切换浅色模式crash

See merge request halo/android/assistant-android!1419
2023-11-06 10:19:29 +08:00
c6c2213a88 fix: 尝试修复 INTERACT_ACROSS_USERS permission 闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/318432/events/ff3774f050c145b2a20ec69545fa3cac/?project=22&query=level%3Afatal&sort=user&statsPeriod=14d 2023-11-06 10:13:53 +08:00
9ede98deea fix:社区搜索改为懒加载后,切换浅色模式crash 2023-11-06 10:13:37 +08:00
e46ec7c416 Merge branch 'feature-GHZS-3350-patch' into 'dev'
feat: 游戏开服/开测消息通知—客户端 https://jira.shanqu.cc/browse/GHZS-3350

See merge request halo/android/assistant-android!1418
2023-11-06 10:10:22 +08:00
d49c6bc3ca feat: 游戏开服/开测消息通知—客户端 https://jira.shanqu.cc/browse/GHZS-3350 2023-11-06 10:10:22 +08:00
2bba43cf26 Merge branch 'feat/GHZS-3837' into 'dev'
feat: 穿山甲广告替换定制版SDK

See merge request halo/android/assistant-android!1415
2023-11-03 17:25:58 +08:00
3efcd71046 Merge branch 'fix/GHZS-3853' into 'dev-5.33.0'
fix: 畅玩游戏反馈优化—客户端 https://jira.shanqu.cc/browse/GHZS-3853

See merge request halo/android/assistant-android!1417
2023-11-03 16:24:53 +08:00
19f54bb8d2 Merge branch 'feat/upload_test_apk' into 'dev'
feat: 邮件包上传至内部测试平台

See merge request halo/android/assistant-android!1416
2023-11-03 16:20:01 +08:00
ce99eef958 fix: 畅玩游戏反馈优化—客户端 https://jira.shanqu.cc/browse/GHZS-3853 2023-11-03 16:17:49 +08:00
a167e7ff58 feat: 上传 APK 至内测平台 2023-11-03 16:14:30 +08:00
ddd9032dbf feat: 穿山甲广告替换定制版SDK https://jira.shanqu.cc/browse/GHZS-3836 2023-11-03 10:09:26 +08:00
1062522388 Merge branch 'feat/CWZS-79' into 'dev'
fix: ci-build error

See merge request halo/android/assistant-android!1413
2023-11-02 16:38:03 +08:00
b631c3437c fix: ci-build error 2023-11-02 16:36:37 +08:00
5de5b005bf Merge branch 'feat/CWZS-79' into 'dev'
feat: 测试版本,我的页面添加从SD卡直接安装游戏的畅玩 https://jira.shanqu.cc/browse/CWZS-135

See merge request halo/android/assistant-android!1412
2023-11-02 14:38:55 +08:00
7d99db505b fix: 依赖声明错误 2023-11-02 14:26:39 +08:00
3b3e2e572e feat: 测试版本,我的页面添加从SD卡直接安装游戏的畅玩 https://jira.shanqu.cc/browse/CWZS-135 2023-11-02 14:22:42 +08:00
4f1ccac6fc Merge branch 'fix/GHZS-3754' into 'dev-5.33.0'
fix:【光环助手】跳转链接问题 https://jira.shanqu.cc/browse/GHZS-3754

See merge request halo/android/assistant-android!1409
2023-11-01 17:54:58 +08:00
41c8d4950f Merge branch 'merge_dev_to_dev-5.33.0' into 'dev-5.33.0'
合并 dev 变更

See merge request halo/android/assistant-android!1408
2023-11-01 17:54:46 +08:00
d633d9b37b fix:【光环助手】跳转链接问题 https://jira.shanqu.cc/browse/GHZS-3754 2023-11-01 16:36:42 +08:00
23ec072ac5 fix: 处理合并冲突 2023-11-01 15:54:12 +08:00
3f3fd1ad5f Merge branch 'dev' into merge_dev_to_dev-5.33.0
# Conflicts:
#	app/src/main/java/com/gh/common/databind/BindingAdapters.java
#	app/src/main/java/com/gh/gamecenter/cloudarchive/CloudArchiveManagerActivity.kt
#	app/src/main/java/com/gh/gamecenter/cloudarchive/CloudArchiveManagerViewModel.kt
#	app/src/main/java/com/gh/gamecenter/gamedetail/GameDetailFragment.kt
#	app/src/main/java/com/gh/gamecenter/gamedetail/fuli/kaifu/ServersDetailReportViewHolder.kt
#	app/src/main/java/com/gh/gamecenter/gamedetail/fuli/kaifu/ServersDetailViewHolder.kt
#	app/src/main/java/com/gh/vspace/VHelper.kt
#	app/src/main/res/layout/dialog_servers_calendear_detail.xml
#	app/src/main/res/layout/dialog_servers_calendear_detail_item.xml
#	app/src/main/res/layout/dialog_servers_calendear_detail_report.xml
#	module_common/src/main/res/drawable/download_button_normal_style.xml
2023-11-01 14:47:48 +08:00
3022118445 Merge branch 'feature-GHZS-3769' into 'dev-5.33.0'
feat:更新光环编译SDK版本至 34 https://jira.shanqu.cc/browse/GHZS-3769

See merge request halo/android/assistant-android!1407
2023-10-30 18:04:17 +08:00
edf56c92d5 feat:更新光环编译SDK版本至 34 https://jira.shanqu.cc/browse/GHZS-3769 2023-10-30 18:04:17 +08:00
56eb40740a Merge branch 'feature-GHZS-3350-new' into 'dev'
feat: 游戏开服/开测消息通知—客户端 https://jira.shanqu.cc/browse/GHZS-3350

See merge request halo/android/assistant-android!1406
2023-10-26 14:06:23 +08:00
d697bc7b8a feat: 游戏开服/开测消息通知—客户端 https://jira.shanqu.cc/browse/GHZS-3350 2023-10-26 14:06:22 +08:00
95beddc194 Merge branch 'fix/dark_mode_culprit' into 'dev'
fix: 修复由于社区首页预加载 WebView 资源导致的深色模式状态问题

See merge request halo/android/assistant-android!1405
2023-10-26 09:33:56 +08:00
5e3e4a88f5 fix: 修复由于社区首页预加载 WebView 资源导致的深色模式状态问题 2023-10-26 09:17:31 +08:00
ad6bf59297 Merge branch 'chen/202310/GHZS-3757' into 'dev-5.33.0'
feat:统一设计规范与客户端内代码的命名 https://jira.shanqu.cc/browse/GHZS-3757

See merge request halo/android/assistant-android!1404
2023-10-25 18:01:45 +08:00
42e009b91d feat:统一设计规范与客户端内代码的命名 https://jira.shanqu.cc/browse/GHZS-3757 2023-10-25 17:37:23 +08:00
75dabfef6b Merge branch 'fix/ad_space_gid' into 'dev'
fix: 修复app启动第一次获取广告配置请求没有带上gid的问题

See merge request halo/android/assistant-android!1403
2023-10-25 16:54:41 +08:00
e51e976385 fix: 修复app启动第一次获取广告配置请求没有带上gid的问题 2023-10-25 16:42:33 +08:00
28b9e14487 Merge branch 'feat/GHZS-3502' into 'dev'
feat: APP备案的相关调整 https://jira.shanqu.cc/browse/GHZS-3502

See merge request halo/android/assistant-android!1401
2023-10-25 10:18:36 +08:00
5ee1e823c5 Merge branch 'fix/GHZS-3691' into 'dev'
修复首页下拉弹窗&首页弹窗相关问题 https://jira.shanqu.cc/browse/GHZS-3691

See merge request halo/android/assistant-android!1400
2023-10-25 10:18:32 +08:00
11eee2eb0a 修复首页下拉弹窗&首页弹窗相关问题 https://jira.shanqu.cc/browse/GHZS-3691 2023-10-25 10:18:32 +08:00
42fa273d06 feat: APP备案的相关调整 https://jira.shanqu.cc/browse/GHZS-3502 2023-10-25 09:44:55 +08:00
69dcd407b1 Merge branch 'feat/GHZS-3342' into 'dev'
feat: 游戏下载按钮合并 https://jira.shanqu.cc/browse/GHZS-3342

See merge request halo/android/assistant-android!1368
2023-10-25 09:34:43 +08:00
66722a313f Merge branch 'feat/GHZS-3446' into 'dev'
feat: 广告位管理相关优化—客户端 https://jira.shanqu.cc/browse/GHZS-3446

See merge request halo/android/assistant-android!1399
2023-10-24 17:28:58 +08:00
81b0404999 feat: 广告位管理相关优化—客户端 https://jira.shanqu.cc/browse/GHZS-3446 2023-10-24 17:28:58 +08:00
79dadfeae6 Merge branch 'fix/game_library_crash' into 'dev'
fix: 修复游戏库点击消息中心出现的闪退问题

See merge request halo/android/assistant-android!1398
2023-10-24 15:55:14 +08:00
601733f257 fix: 修复游戏库点击消息中心出现的闪退问题 2023-10-24 15:31:42 +08:00
48a6bd0d2e feat: 游戏下载按钮合并 https://jira.shanqu.cc/browse/GHZS-3342 2023-10-24 14:21:18 +08:00
dfb89980fe Merge branch 'chen/202309/feature-CWZS-110' into 'dev'
云存档优化

See merge request halo/android/assistant-android!1397
2023-10-23 14:58:19 +08:00
e7d4c598a3 feat:云存档管理相关优化—客户端 https://jira.shanqu.cc/browse/CWZS-110 2023-10-23 14:58:19 +08:00
fe2d0e6a34 Merge branch 'fix/CWZS-127' into 'dev-5.33.0'
fix: 云存档使用存档流程优化—客户端(修复云存档管理页面获取存档配置失败的问题) https://jira.shanqu.cc/browse/CWZS-127

See merge request halo/android/assistant-android!1396
2023-10-23 10:04:14 +08:00
1cbfbeb118 Merge branch 'fix/CWZS-129' into 'dev-5.33.0'
fix: 游戏详情中从云存档启动游戏,缺少谷歌框架流程导致无法进入游戏—客户端 https://jira.shanqu.cc/browse/CWZS-129

See merge request halo/android/assistant-android!1395
2023-10-23 10:04:01 +08:00
d845ceb31a fix: 云存档使用存档流程优化—客户端(修复云存档管理页面获取存档配置失败的问题) https://jira.shanqu.cc/browse/CWZS-127 2023-10-23 09:48:38 +08:00
c080049322 fix: 游戏详情中从云存档启动游戏,缺少谷歌框架流程导致无法进入游戏—客户端 https://jira.shanqu.cc/browse/CWZS-129 2023-10-20 17:31:56 +08:00
d6d0bea491 Merge branch 'fix/GHZS-3744' into 'dev'
fix: 编辑器图片格式兼容问题 https://jira.shanqu.cc/browse/GHZS-3744

See merge request halo/android/assistant-android!1394
2023-10-20 15:04:39 +08:00
820e29db23 Merge remote-tracking branch 'origin/dev' into dev-5.33.0 2023-10-20 14:28:21 +08:00
1f05d6e0ba Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	dependencies.gradle
2023-10-20 14:24:24 +08:00
c995846db7 fix: 关编辑器图片格式兼容问题 https://jira.shanqu.cc/browse/GHZS-3744 2023-10-20 11:11:07 +08:00
964b2afaae chore: 版本更新至 5.31.3 2023-10-19 16:29:57 +08:00
7cd4a45915 Merge branch 'feat/GHZS-3682' into 'release'
feat: 关于畅玩游戏在安卓8及以下系统的实名问题 https://jira.shanqu.cc/browse/GHZS-3704

See merge request halo/android/assistant-android!1393
2023-10-19 16:28:43 +08:00
707361e660 feat: 关于畅玩游戏在安卓8及以下系统的实名问题 https://jira.shanqu.cc/browse/GHZS-3704 2023-10-19 16:23:34 +08:00
be4d464bc0 Merge branch 'dev' into 'dev-5.33.0'
Dev

See merge request halo/android/assistant-android!1392
2023-10-19 15:50:39 +08:00
e3c56fa800 Merge branch 'feat/CWZS-127' into 'dev-5.33.0'
feat: 云存档使用存档流程优化—客户端 https://jira.shanqu.cc/browse/CWZS-127

See merge request halo/android/assistant-android!1391
2023-10-19 15:30:35 +08:00
b427418ec6 Merge branch 'chen/202309/GHZS-3477' into 'dev' 2023-10-19 15:19:16 +08:00
580a00e1a9 feat:【光环助手】搜索业务埋点需求 https://jira.shanqu.cc/browse/GHZS-3477 2023-10-19 15:19:15 +08:00
7e982e30a3 feat: 云存档使用存档流程优化—客户端 https://jira.shanqu.cc/browse/CWZS-127 2023-10-19 14:19:20 +08:00
0eae5262af Merge branch 'feat/GHZS-3622' into 'dev-5.33.0'
feat: 反馈管理新增包名屏蔽—客户端 https://jira.shanqu.cc/browse/GHZS-3622

See merge request halo/android/assistant-android!1389
2023-10-19 09:55:51 +08:00
6656cbc635 feat: 反馈管理新增包名屏蔽—客户端 https://jira.shanqu.cc/browse/GHZS-3622 2023-10-19 09:55:51 +08:00
1e13ae4815 Merge branch 'feat/GHZS-3675' into 'release'
feat: V5.31.0发布前调整

See merge request halo/android/assistant-android!1388
2023-10-18 17:10:05 +08:00
e18aeb92dd feat: V5.31.0发布前调整 https://jira.shanqu.cc/browse/GHZS-3675 2023-10-18 17:10:05 +08:00
24aaeeee7f Merge branch 'fix-GHZS-dialog-error' into 'release'
fix: 修复DownloadDialog点击继续下载没有反应的问题

See merge request halo/android/assistant-android!1387
2023-10-18 13:58:06 +08:00
a70a397199 fix: 修复DownloadDialog点击继续下载没有反应的问题 2023-10-18 13:58:06 +08:00
7f4d06fbe1 Merge branch 'feat/GHZS-3638' into 'release'
feat: 穿山甲广告SDK更换新版本 https://jira.shanqu.cc/browse/GHZS-3686

See merge request halo/android/assistant-android!1386
2023-10-18 10:02:09 +08:00
690ca33702 Merge branch 'feat/GHZS-3467' into 'dev'
feat: 用户认证优化—客户端 https://jira.shanqu.cc/browse/GHZS-3467

See merge request halo/android/assistant-android!1385
2023-10-17 17:31:06 +08:00
cf6a80dd0d feat: 用户认证优化—客户端 https://jira.shanqu.cc/browse/GHZS-3467 2023-10-17 17:31:06 +08:00
c409b755cf Merge branch 'feat/GHZS-3403' into 'dev'
feat: 首页底部tab第4位修改为可配置—客户端 https://jira.shanqu.cc/browse/GHZS-3403

See merge request halo/android/assistant-android!1384
2023-10-17 11:45:14 +08:00
0399a0cc91 feat: 首页底部tab第4位修改为可配置—客户端 https://jira.shanqu.cc/browse/GHZS-3403 2023-10-17 11:45:14 +08:00
c28d6f3080 feat: 穿山甲广告SDK更换新版本 https://jira.shanqu.cc/browse/GHZS-3686 2023-10-16 16:35:59 +08:00
56501f9f33 Merge branch 'feat/GHZS-3397' into 'dev'
feat: 游戏单功能优化(第二期)—客户端 https://jira.shanqu.cc/browse/GHZS-3397

See merge request halo/android/assistant-android!1383
2023-10-13 14:20:25 +08:00
ebcf2aaa9e feat: 游戏单功能优化(第二期)—客户端 https://jira.shanqu.cc/browse/GHZS-3397 2023-10-13 14:20:25 +08:00
0f9f3dc073 Merge branch 'feature-GHZS-article-detail-remove-dev-cache' into 'dev'
feat: halo_test_app.js、halo_test_app.css的预缓存移除

See merge request halo/android/assistant-android!1382
2023-10-12 15:09:53 +08:00
8c92da2ceb feat: halo_test_app.js、halo_test_app.css的预缓存移除 2023-10-12 15:09:53 +08:00
671c59a9de Merge branch 'feature-GHZS-article-detail-modification' into 'dev'
feat: 论坛文章详情WebView预加载

See merge request halo/android/assistant-android!1381
2023-10-12 13:45:11 +08:00
adcb8a4693 feat: 论坛文章详情WebView预加载 2023-10-12 13:45:11 +08:00
95d87858f1 Merge branch 'fix/home_page_memory_leak' into 'dev'
fix: 修复首页悬浮窗和AudioManager造成的内存泄漏问题

See merge request halo/android/assistant-android!1380
2023-10-11 11:23:13 +08:00
0a463b0ddd Merge branch 'chen/202310/GHZS-3652' into 'dev'
fix:修复光环首页部分数据被多线程操作的问题 https://jira.shanqu.cc/browse/GHZS-3652

See merge request halo/android/assistant-android!1379
2023-10-11 11:13:27 +08:00
2da4230d8c fix:修复光环首页部分数据被多线程操作的问题 https://jira.shanqu.cc/browse/GHZS-3652 2023-10-11 11:07:15 +08:00
b00fda2289 fix: 修复首页悬浮窗和AudioManager造成的内存泄漏问题 2023-10-11 11:06:29 +08:00
86790e7b69 Merge branch 'fix/GHZS-3596' into 'dev'
fix: 【光环助手】APP内图片显示问题(1010测试) https://jira.shanqu.cc/browse/GHZS-3596

See merge request halo/android/assistant-android!1378
2023-10-10 17:01:43 +08:00
80ea7303f8 fix: 【光环助手】APP内图片显示问题(1010测试) https://jira.shanqu.cc/browse/GHZS-3596 2023-10-10 16:58:48 +08:00
700831ba26 Merge branch 'fix/GHZS-3596' into 'dev'
fix: 【光环助手】APP内图片显示问题(1010测试) https://jira.shanqu.cc/browse/GHZS-3596

See merge request halo/android/assistant-android!1377
2023-10-10 15:27:00 +08:00
e35950ad89 fix: 【光环助手】APP内图片显示问题(1010测试) https://jira.shanqu.cc/browse/GHZS-3596 2023-10-10 15:15:56 +08:00
0a6b93a8f8 chore: 版本更新至 5.33.0 2023-10-10 14:47:26 +08:00
7be72e76f2 Merge branch 'feature-GHZS-sentry-335870' into 'release'
fix: Sentry关于神策埋点上报导致的空指针异常的BUG

See merge request halo/android/assistant-android!1376
2023-10-10 11:53:39 +08:00
6d5b0eb1e8 fix: Sentry关于神策埋点上报导致的空指针异常的BUG 2023-10-10 11:53:39 +08:00
0dcf5d2097 Merge branch 'fix/GHZS-3596' into 'dev'
fix: 【光环助手】APP内图片显示问题 https://jira.shanqu.cc/browse/GHZS-3596

See merge request halo/android/assistant-android!1375
2023-10-09 15:08:09 +08:00
32e584c04c Merge remote-tracking branch 'origin/dev' into dev-5.32.0
# Conflicts:
#	dependencies.gradle
2023-10-09 10:45:04 +08:00
f726a4629f chore: 版本更新至 5.31.1 2023-10-09 10:40:01 +08:00
fbe29d82be fix: 【光环助手】APP内图片显示问题 https://jira.shanqu.cc/browse/GHZS-3596 2023-10-08 16:54:13 +08:00
a6c2254db3 Merge branch 'fix/GHZS-3600' into 'dev'
fix: 光环助手使用微信登录问题 https://jira.shanqu.cc/browse/GHZS-3600

See merge request halo/android/assistant-android!1374
2023-10-08 16:16:21 +08:00
3d4977dc87 Merge branch 'feature-GHZS-3462' into 'dev-5.32.0'
feat: 帖子加载问题优化—客户端 https://jira.shanqu.cc/browse/GHZS-3462

See merge request halo/android/assistant-android!1373
2023-10-08 16:14:05 +08:00
4d0fda6157 feat: 帖子加载问题优化—客户端 https://jira.shanqu.cc/browse/GHZS-3462 2023-10-08 16:14:05 +08:00
34fb8ccf93 fix: 光环助手使用微信登录问题 https://jira.shanqu.cc/browse/GHZS-3600 2023-10-08 16:07:48 +08:00
49b9c3a135 Merge branch 'release' into 'dev'
Release

See merge request halo/android/assistant-android!1372
2023-10-08 09:23:54 +08:00
bc04dcc94b Merge branch 'feature-article-detail-comment-no-data' into 'dev'
feat: 文章详情评论列表缺省图修改

See merge request halo/android/assistant-android!1371
2023-10-08 09:16:48 +08:00
eb0bba47f9 feat: 文章详情评论列表缺省图修改 2023-10-08 09:16:48 +08:00
9ba4e9c2cf Merge branch 'fix/GHZS-3532' into 'dev'
fix:【光环助手】同步正式环境问题-帮助视频问题 https://jira.shanqu.cc/browse/GHZS-3532

See merge request halo/android/assistant-android!1370
2023-10-07 14:06:48 +08:00
3a69bb4452 fix:【光环助手】同步正式环境问题-帮助视频问题 https://jira.shanqu.cc/browse/GHZS-3532 2023-10-07 14:06:48 +08:00
0581ebf409 Merge branch 'hotfix/v5.30.6-956/vivo_culprit' into 'release'
fix: 特殊处理 vivo 设备获取已安装列表权限的异常问题

See merge request halo/android/assistant-android!1369
2023-09-27 15:11:30 +08:00
44607a9039 fix: 特殊处理 vivo 设备获取已安装列表权限的异常问题 2023-09-27 15:06:23 +08:00
00db8c00c6 Merge branch 'feature-GHZS-3528' into 'dev'
fix 【光环助手】同步正式环境问题—帖子详情页相关问题 https://jira.shanqu.cc/browse/GHZS-3528

See merge request halo/android/assistant-android!1367
2023-09-26 11:14:31 +08:00
c64713117e fix 【光环助手】同步正式环境问题—帖子详情页相关问题 https://jira.shanqu.cc/browse/GHZS-3528 2023-09-26 11:14:31 +08:00
28e28d0775 feat: 畅玩游戏启动中转页面内容调整—客户端 https://jira.shanqu.cc/browse/CWZS-101 2023-09-26 09:33:09 +08:00
6f53a67554 feat: 畅玩游戏启动中转页面内容调整—客户端 https://jira.shanqu.cc/browse/CWZS-101 2023-09-26 09:33:09 +08:00
f2b965b447 Merge branch 'fix/GHZS-3513' into 'dev'
fix:【光环助手】同步正式环境问题-新游开测相关 https://jira.shanqu.cc/browse/GHZS-3513

See merge request halo/android/assistant-android!1365
2023-09-21 10:18:58 +08:00
0ae4f745ee fix:【光环助手】同步正式环境问题-新游开测相关 https://jira.shanqu.cc/browse/GHZS-3513 2023-09-21 10:10:05 +08:00
bcfd9cdfef Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	dependencies.gradle
2023-09-20 16:32:53 +08:00
94ffe5a86f chore: 版本更新至 5.30.6 2023-09-20 11:03:34 +08:00
c3ddd28bad Merge branch 'pack/v5.29.2-932/remove_storage_permission_and_change_to_v5.30.4-954_rebased' into 'release'
feat: 合规代码合并 https://jira.shanqu.cc/browse/GHZS-3510

See merge request halo/android/assistant-android!1364
2023-09-20 11:01:41 +08:00
eab8bc846c feat: 合规代码合并 https://jira.shanqu.cc/browse/GHZS-3510 2023-09-20 11:01:41 +08:00
05268442f8 Merge branch 'fix/GHZS-3500' into 'dev-5.32.0'
fix: 求版本下载跳转问题 https://jira.shanqu.cc/browse/GHZS-2674

See merge request halo/android/assistant-android!1362
2023-09-20 10:42:45 +08:00
55521e6f29 fix: 求版本下载跳转问题 https://jira.shanqu.cc/browse/GHZS-2674 2023-09-20 10:42:45 +08:00
db5b09cc11 Merge branch 'feature-GHZS-3493' into 'dev-5.32.0'
fix: 插件求版本相关优化—0915测试 https://jira.shanqu.cc/browse/GHZS-3493

See merge request halo/android/assistant-android!1361
2023-09-19 10:51:12 +08:00
b0922b4c29 fix: 插件求版本相关优化—0915测试 https://jira.shanqu.cc/browse/GHZS-3493 2023-09-19 10:51:12 +08:00
455ed32ac6 Merge branch 'hotfix/v5.30.3-953/GHZS-3484' into 'dev'
修复普通微信登录也会触发 QQ 小游戏的微信登录异常 toast 问题

See merge request halo/android/assistant-android!1360
2023-09-18 09:39:47 +08:00
fd92979481 fix: 微信登录提示问题 https://jira.shanqu.cc/browse/GHZS-3484 2023-09-18 09:39:47 +08:00
3d322b29c1 Merge branch 'hotfix/v5.30.3-953/GHZS-3484' into 'release'
修复普通微信登录也会触发 QQ 小游戏的微信登录异常 toast 问题

See merge request halo/android/assistant-android!1359
2023-09-18 09:34:12 +08:00
dcfc2f44cb fix: 微信登录提示问题 https://jira.shanqu.cc/browse/GHZS-3484 2023-09-18 09:34:12 +08:00
b809ae6687 Merge branch 'fix/GHZS-3452' into 'dev-5.32.0'
fix: 开发者中心及其配套优化—0912测试(2) https://jira.shanqu.cc/browse/GHZS-3452

See merge request halo/android/assistant-android!1358
2023-09-15 09:42:17 +08:00
c575e589ae fix: 开发者中心及其配套优化—0912测试(2) https://jira.shanqu.cc/browse/GHZS-3452 2023-09-15 09:30:57 +08:00
2af47af681 Merge branch 'feat/GHZS-3437' into 'dev-5.32.0'
feat: 游戏下载增加文件格式 https://jira.shanqu.cc/browse/GHZS-3437

See merge request halo/android/assistant-android!1354
2023-09-14 17:12:49 +08:00
b1228bdd2a feat: 游戏下载增加文件格式 https://jira.shanqu.cc/browse/GHZS-3437 2023-09-14 17:12:49 +08:00
4008c7fa4d Merge branch 'feature-GHZS-3424-patch-2' into 'dev'
fix: 神策数据埋点第二期-0914测试...

See merge request halo/android/assistant-android!1357
2023-09-14 17:08:30 +08:00
f2d714280b fix: 神策数据埋点第二期-0914测试... 2023-09-14 17:08:30 +08:00
6862609bba Merge branch 'release' into 'dev'
Release

See merge request halo/android/assistant-android!1356
2023-09-14 16:31:22 +08:00
3afae78477 Merge branch 'hotfix/GHZS-3479' into 'release'
fix:【光环助手】通用内容合集首页显示问题 https://jira.shanqu.cc/browse/GHZS-3479

See merge request halo/android/assistant-android!1355
2023-09-14 16:26:20 +08:00
b03df595bc fix:【光环助手】通用内容合集首页显示问题 https://jira.shanqu.cc/browse/GHZS-3479 2023-09-14 16:15:52 +08:00
c6f0825fb5 Merge branch 'feature-GHZS-3432-patch-1' into 'dev'
fix: 神策数据埋点第二期—0912测试...

See merge request halo/android/assistant-android!1353
2023-09-14 09:08:08 +08:00
cbc2902613 fix: 神策数据埋点第二期—0912测试... 2023-09-14 09:08:08 +08:00
db725a417d Merge branch 'chen/202309/fix-upload-archive-crash' into 'dev'
存档上传bug

See merge request halo/android/assistant-android!1352
2023-09-13 12:09:08 +08:00
4270924d0f fix:登陆光环账号,然后断网,在光环助手游戏详情页上传存档,有的手机是上传存档弹窗一闪而过没有任何提示,有的手机是弹窗一闪而过后提示‘当前页面未捕获的异常....’ 2023-09-13 11:58:57 +08:00
69fc206377 Merge branch 'feature-GHZs-3038-patch' into 'dev'
fix: 帖子详情页UI优化 https://jira.shanqu.cc/browse/GHZS-3038

See merge request halo/android/assistant-android!1350
2023-09-13 11:07:47 +08:00
8468ec45c2 fix: 帖子详情页UI优化 https://jira.shanqu.cc/browse/GHZS-3038 2023-09-13 11:07:47 +08:00
256a4c2b0a Merge branch 'feature-GHZS-3424-patch' into 'dev'
feat: 【光环助手】帖子详情页UI优化 https://jira.shanqu.cc/browse/GHZS-3038

See merge request halo/android/assistant-android!1349
2023-09-12 17:37:46 +08:00
7d01e47c26 feat: 【光环助手】帖子详情页UI优化 https://jira.shanqu.cc/browse/GHZS-3038 2023-09-12 17:37:46 +08:00
5814f468b3 Merge branch 'feature-GHZS-3432-patch' into 'dev'
fix: 神策数据埋点第二期—0907测试(2) https://jira.shanqu.cc/browse/GHZS-3432

See merge request halo/android/assistant-android!1348
2023-09-12 16:24:01 +08:00
a5730e0ffd fix: 神策数据埋点第二期—0907测试(2) https://jira.shanqu.cc/browse/GHZS-3432 2023-09-12 16:24:00 +08:00
0dfd87db25 Merge branch 'feature-GHZS-3420' into 'dev'
fix: 帖子详情页UI优化—0906UI测试 https://jira.shanqu.cc/browse/GHZS-3420

See merge request halo/android/assistant-android!1347
2023-09-12 14:49:18 +08:00
31aa16f155 fix: 帖子详情页UI优化—0906UI测试 https://jira.shanqu.cc/browse/GHZS-3420 2023-09-12 14:49:18 +08:00
b22c6b9a5b Merge branch 'feature-GHZS-3432' into 'dev'
fix: 神策数据埋点第二期—0907测试(2) https://jira.shanqu.cc/browse/GHZS-3432

See merge request halo/android/assistant-android!1344
2023-09-12 14:46:11 +08:00
ffae0d1b1d Merge branch 'dev' into 'dev-5.32.0'
Dev

See merge request halo/android/assistant-android!1346
2023-09-12 13:59:06 +08:00
5d8a31c725 Merge branch 'release' into 'dev'
Release

See merge request halo/android/assistant-android!1345
2023-09-12 13:58:25 +08:00
1c35982db0 Merge branch 'feature-GHZS-qq-game-crash' into 'release'
fix: 修复QQ小游戏调用stopAllMiniApp方法Context为空导致的崩溃问题

See merge request halo/android/assistant-android!1343
2023-09-12 13:46:54 +08:00
52f71dc79e fix: 修复QQ小游戏调用stopAllMiniApp方法Context为空导致的崩溃问题 2023-09-12 13:46:53 +08:00
f1c0155379 fix: 神策数据埋点第二期—0907测试(2) https://jira.shanqu.cc/browse/GHZS-3432 2023-09-12 11:38:30 +08:00
19dc23d98a Merge branch 'fix/GHZS-3434' into 'dev'
fix: 首页推荐入口数据上报问题 https://jira.shanqu.cc/browse/GHZS-3434

See merge request halo/android/assistant-android!1342
2023-09-12 11:00:30 +08:00
69c82ec0e6 fix: 首页推荐入口数据上报问题 https://jira.shanqu.cc/browse/GHZS-3434 2023-09-12 11:00:29 +08:00
b1a9d96c3b Merge branch 'fix/GHZS-3426' into 'dev'
fix: 神策数据埋点第二期—0907测试(1)(0911测试) https://jira.shanqu.cc/browse/GHZS-3426

See merge request halo/android/assistant-android!1340
2023-09-11 17:45:22 +08:00
a88500576f Merge branch 'hotfix/home_game_collection_refresh' into 'release'
fix: 修复首页/版块在特定情况下显示空白的问题

See merge request halo/android/assistant-android!1341
2023-09-11 17:45:05 +08:00
058eaf0a4a fix: 修复首页/版块在特定情况下显示空白的问题 2023-09-11 17:10:40 +08:00
1b326a0515 fix: 神策数据埋点第二期—0907测试(1)(0911测试) https://jira.shanqu.cc/browse/GHZS-3426 2023-09-11 15:44:02 +08:00
3fc1fd821a Merge branch 'feature/GHZS-3408' into 'dev-5.32.0'
feat: 开发者中心及配套优化—客户端 https://jira.shanqu.cc/browse/GHZS-3408

See merge request halo/android/assistant-android!1339
2023-09-11 09:55:00 +08:00
b3af44cc4c feat: 开发者中心及配套优化—客户端 https://jira.shanqu.cc/browse/GHZS-3408 2023-09-11 09:49:25 +08:00
44c1711be7 Merge branch 'fix/GHZS-3426' into 'dev'
fix: 神策数据埋点第二期—0907测试(1) https://jira.shanqu.cc/browse/GHZS-3426

See merge request halo/android/assistant-android!1338
2023-09-08 16:19:21 +08:00
c616df87ea fix: 神策数据埋点第二期—0907测试(1) https://jira.shanqu.cc/browse/GHZS-3426 2023-09-08 16:11:02 +08:00
dd7072eea4 Merge branch 'feature-GHZS-3412' into 'dev-5.32.0'
feat: 插件求版本相关优化—0905测试 https://jira.shanqu.cc/browse/GHZS-3412

See merge request halo/android/assistant-android!1337
2023-09-08 15:55:50 +08:00
4ee463f03e feat: 插件求版本相关优化—0905测试 https://jira.shanqu.cc/browse/GHZS-3412 2023-09-08 15:55:49 +08:00
d3dc31eeaf Update README.md 2023-09-08 15:27:26 +08:00
08b364a626 Merge branch 'fix/GHZS-3421' into 'dev'
fix: 右下悬浮窗优化-新增悬浮窗展开交互—0907测试(补充) https://jira.shanqu.cc/browse/GHZS-3421

See merge request halo/android/assistant-android!1336
2023-09-08 14:59:40 +08:00
9e6d1e5fbd fix: 右下悬浮窗优化-新增悬浮窗展开交互—0907测试(补充) https://jira.shanqu.cc/browse/GHZS-3421 2023-09-08 14:59:40 +08:00
75a21ee04e Merge branch 'feature-GHZS-3424' into 'dev'
feat: 帖子详情页UI优化—0907UI测试 https://jira.shanqu.cc/browse/GHZS-3424

See merge request halo/android/assistant-android!1335
2023-09-08 13:59:49 +08:00
27d13d4ce9 feat: 帖子详情页UI优化—0907UI测试 https://jira.shanqu.cc/browse/GHZS-3424 2023-09-08 13:59:49 +08:00
16526ddfbd Merge branch 'feature/GHZS-3346' into 'dev-5.32.0'
feat: 插件管理功能优化(第2期)—客户端 https://jira.shanqu.cc/browse/GHZS-3346

See merge request halo/android/assistant-android!1334
2023-09-08 11:20:21 +08:00
d6e676300e feat: 插件管理功能优化(第2期)—客户端 https://jira.shanqu.cc/browse/GHZS-3346 2023-09-08 11:15:30 +08:00
7852972e01 feat: 插件管理功能优化(第2期)—客户端 https://jira.shanqu.cc/browse/GHZS-3346 2023-09-08 11:15:22 +08:00
6ff76ea1ed Merge branch 'fix/help_video' into 'dev'
修复帮助视频相关问题

See merge request halo/android/assistant-android!1333
2023-09-07 18:05:18 +08:00
39d51ceeb3 fix: 处理帮助视频全屏播放时全面屏手势与进度条冲突导致无法拖动进度条的问题 2023-09-07 17:49:54 +08:00
00fc6e447c fix: 修复帮助视频上报埋点数据异常的问题 2023-09-07 16:23:22 +08:00
76fff608ed Merge branch 'fix/GHZS-3421' into 'dev'
fix: 右下悬浮窗优化-新增悬浮窗展开交互—0907测试 https://jira.shanqu.cc/browse/GHZS-3421

See merge request halo/android/assistant-android!1332
2023-09-07 11:03:51 +08:00
460409ac30 fix: 右下悬浮窗优化-新增悬浮窗展开交互—0907测试 https://jira.shanqu.cc/browse/GHZS-3421 2023-09-07 10:57:45 +08:00
80403e1684 Merge remote-tracking branch 'origin/dev' into dev-5.32.0 2023-09-07 10:30:53 +08:00
ef32fd946b Merge branch 'feature-GHZS-3373-patch-1' into 'dev'
feat: 帖子详情页UI优化—0901UI测试-客户端 https://jira.shanqu.cc/browse/GHZS-3373

See merge request halo/android/assistant-android!1331
2023-09-07 09:50:49 +08:00
23d57c8bbd feat: 帖子详情页UI优化—0901UI测试-客户端 https://jira.shanqu.cc/browse/GHZS-3373 2023-09-07 09:50:49 +08:00
c46b93769d Merge branch 'fix/GHZS-3415' into 'dev'
fix: 意见反馈页面改版—0906UI测试 https://jira.shanqu.cc/browse/GHZS-3415

See merge request halo/android/assistant-android!1330
2023-09-06 17:52:07 +08:00
2305229919 fix: 意见反馈页面改版—0906UI测试 https://jira.shanqu.cc/browse/GHZS-3415 2023-09-06 17:48:39 +08:00
0e9453b1b2 Merge branch 'fix/floating_window_api_crash' into 'dev'
fix: 修复右下悬浮窗接口结构未同步造成的闪退

See merge request halo/android/assistant-android!1329
2023-09-06 16:58:32 +08:00
420290bc87 fix: 修复右下悬浮窗接口结构未同步造成的闪退 2023-09-06 16:55:43 +08:00
91be2cea1d Merge branch 'fix/GHZS-3415' into 'dev'
fix: 意见反馈页面改版—0906UI测试 https://jira.shanqu.cc/browse/GHZS-3415

See merge request halo/android/assistant-android!1328
2023-09-06 15:52:13 +08:00
4dc3a8edc3 fix: 意见反馈页面改版—0906UI测试 https://jira.shanqu.cc/browse/GHZS-3415 2023-09-06 15:27:43 +08:00
5ba9c74583 Merge branch 'feature-GHZS-3373' into 'dev'
feat: 帖子详情页UI优化—0901UI测试-Web前端 https://jira.shanqu.cc/browse/GHZS-3374

See merge request halo/android/assistant-android!1326
2023-09-06 11:38:43 +08:00
a694e401d3 feat: 帖子详情页UI优化—0901UI测试-Web前端 https://jira.shanqu.cc/browse/GHZS-3374 2023-09-06 11:38:43 +08:00
a6cb0b9fa0 Merge branch 'fix/feedback' into 'dev'
fix: 修改意见反馈页面文案

See merge request halo/android/assistant-android!1327
2023-09-06 11:34:26 +08:00
9b599fd28d fix: 修改意见反馈页面文案 2023-09-06 11:33:10 +08:00
f04fecc11e Merge branch 'feature-GHZS-3373' into 'dev'
feat: 帖子详情页UI优化—0901UI测试-客户端 https://jira.shanqu.cc/browse/GHZS-3373

See merge request halo/android/assistant-android!1323
2023-09-06 10:05:54 +08:00
471e28099b Merge branch 'fix/GHZS-3371' into 'dev'
fix: 意见反馈页面改版—0901UI测试(4) https://jira.shanqu.cc/browse/GHZS-3371

See merge request halo/android/assistant-android!1325
2023-09-05 17:31:44 +08:00
5a3031ae87 fix: 意见反馈页面改版—0901UI测试(4) https://jira.shanqu.cc/browse/GHZS-3371 2023-09-05 17:30:30 +08:00
1421f27bd3 Merge branch 'fix/GHZS-3371' into 'dev'
fix: 意见反馈页面改版—0901UI测试(2) https://jira.shanqu.cc/browse/GHZS-3371

See merge request halo/android/assistant-android!1324
2023-09-05 16:12:51 +08:00
e9e152eeee fix: 意见反馈页面改版—0901UI测试(2) https://jira.shanqu.cc/browse/GHZS-3371 2023-09-05 16:01:31 +08:00
aae6904e4b feat: 帖子详情页UI优化—0901UI测试-客户端 https://jira.shanqu.cc/browse/GHZS-3373 2023-09-05 16:00:36 +08:00
db7fbe057e Merge remote-tracking branch 'origin/dev' into dev-5.32.0 2023-09-05 14:35:39 +08:00
042508e8e6 Merge branch 'release' into dev
# Conflicts:
#	dependencies.gradle
2023-09-05 14:35:09 +08:00
af5736f54d Merge branch 'fix/GHZS-3371' into 'dev'
fix: 意见反馈页面改版—0901UI测试(1-2) https://jira.shanqu.cc/browse/GHZS-3371

See merge request halo/android/assistant-android!1322
2023-09-05 14:21:11 +08:00
56816fa682 fix: 意见反馈页面改版—0901UI测试(1-2) https://jira.shanqu.cc/browse/GHZS-3371 2023-09-05 14:17:47 +08:00
05e0609f94 Merge branch 'fix/GHZS-3382' into 'dev'
fix: 帮助与反馈页面改版—0904测试 https://jira.shanqu.cc/browse/GHZS-3382

See merge request halo/android/assistant-android!1320
2023-09-05 14:05:25 +08:00
7a080851ae Merge branch 'feature-GHZS-3276-patch-2' into 'dev'
feat: 游戏详情-开服日历表-反馈优化—0822UI测试 https://jira.shanqu.cc/browse/GHZS-3276

See merge request halo/android/assistant-android!1321
2023-09-05 13:56:46 +08:00
e1ce989d43 feat: 游戏详情-开服日历表-反馈优化—0822UI测试 https://jira.shanqu.cc/browse/GHZS-3276 2023-09-05 13:56:46 +08:00
6e00a0c2a6 fix: 帮助与反馈页面改版—0904测试 https://jira.shanqu.cc/browse/GHZS-3382 2023-09-05 10:19:58 +08:00
71318fa9ef chore: 版本更新至 5.30.3 2023-09-05 10:03:01 +08:00
05b4896d6e Merge branch 'feature-GHZS-sentry-327680' into 'release'
fix: 修复QQ小游戏Activity未校验导致的BUG

See merge request halo/android/assistant-android!1319
2023-09-05 10:02:07 +08:00
7f40e45ef2 fix: 修复QQ小游戏Activity未校验导致的BUG 2023-09-05 10:02:07 +08:00
2928c59b87 Merge branch 'fix/help_and_feedback_help_video' into 'dev'
fix: 修复帮助视频轮播显示问题

See merge request halo/android/assistant-android!1318
2023-09-04 17:58:39 +08:00
ceb2442f3f fix: 修复帮助视频轮播显示问题 2023-09-04 17:56:43 +08:00
cec684c325 Merge branch 'fix/GHZS-3361' into 'dev'
fix: 帮助与反馈页面改版—0831测试(特殊处理【与我相关】接口内容) https://jira.shanqu.cc/browse/GHZS-3361

See merge request halo/android/assistant-android!1317
2023-09-04 16:23:31 +08:00
b5e4bf772b fix: 帮助与反馈页面改版—0901UI测试(8) https://jira.shanqu.cc/browse/GHZS-3370 2023-09-04 15:08:11 +08:00
9f3fe9e30d fix: 帮助与反馈页面改版—0831测试(特殊处理【与我相关】接口内容) https://jira.shanqu.cc/browse/GHZS-3361 2023-09-04 14:53:54 +08:00
c7174bbaec Merge branch 'fix/help_and_feedback_swipe_refresh' into 'dev'
fix: 修复帮助与反馈页面左右滑动会触发下拉刷新的问题

See merge request halo/android/assistant-android!1316
2023-09-04 11:53:42 +08:00
de013e0129 fix: 修复帮助与反馈页面左右滑动会触发下拉刷新的问题 2023-09-04 11:51:30 +08:00
412ea87668 Merge branch 'hotfix/v5.30.2-952/sql_crashes' into 'release'
fix: 捕抓卸载畅玩游戏时的数据库闪退问题...

See merge request halo/android/assistant-android!1315
2023-09-04 11:23:33 +08:00
dc40f81ff2 fix: 捕抓卸载畅玩游戏时的数据库闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/299251/events/0dd11c01f5a5465face2b6849e5cffc4/?project=22 2023-09-04 11:15:14 +08:00
25c849ccad Merge branch 'fix/GHZS-3371' into 'dev'
fix: 意见反馈页面改版—UI测试 https://jira.shanqu.cc/browse/GHZS-3371

See merge request halo/android/assistant-android!1314
2023-09-04 10:26:54 +08:00
927c846bcb Merge branch 'fix/GHZS-3361' into 'dev'
fix: 帮助与反馈页面改版—0831测试 https://jira.shanqu.cc/browse/GHZS-3361

See merge request halo/android/assistant-android!1313
2023-09-04 10:26:40 +08:00
fcd13ba8b0 fix: 意见反馈页面改版—UI测试 https://jira.shanqu.cc/browse/GHZS-3371 2023-09-04 10:23:48 +08:00
bccd161762 Merge branch 'feature-GHZS-3276-patch-1' into 'dev'
feat: 【光环助手】游戏详情-开服日历表-反馈优化 https://jira.shanqu.cc/browse/GHZS-3049

See merge request halo/android/assistant-android!1312
2023-09-04 10:05:55 +08:00
776dfddc34 feat: 【光环助手】游戏详情-开服日历表-反馈优化 https://jira.shanqu.cc/browse/GHZS-3049 2023-09-04 10:05:55 +08:00
b31b529ca7 Merge branch 'feature-GHZS-3367' into 'dev'
feat: 帖子详情页UI优化—0831测试 https://jira.shanqu.cc/browse/GHZS-3367

See merge request halo/android/assistant-android!1311
2023-09-04 09:40:19 +08:00
1cc2f5387a feat: 帖子详情页UI优化—0831测试 https://jira.shanqu.cc/browse/GHZS-3367 2023-09-02 21:38:19 +08:00
5c79a01cc6 fix: 帮助与反馈页面改版—UI测试 https://jira.shanqu.cc/browse/GHZS-3370 2023-09-01 18:01:06 +08:00
1e3704c1ed fix: 帮助与反馈页面改版—0831测试 https://jira.shanqu.cc/browse/GHZS-3361 2023-09-01 14:17:17 +08:00
41340f7333 Merge branch 'feature-GHZS-3295' into 'dev-5.32.0'
feat: 插件求版本相关优化—客户端 https://jira.shanqu.cc/browse/GHZS-3295

See merge request halo/android/assistant-android!1310
2023-09-01 11:45:18 +08:00
e73fc09d9b feat: 插件求版本相关优化—客户端 https://jira.shanqu.cc/browse/GHZS-3295 2023-09-01 11:35:50 +08:00
d593c54262 Merge branch 'hotfix/v5.30.2-952/number-format-issue' into 'release'
fix: 修复在部分语言设备上解压 XAPK 文件时的闪退问题...

See merge request halo/android/assistant-android!1309
2023-09-01 11:18:29 +08:00
b1e5d48098 fix: 修复在部分语言设备上解压 XAPK 文件时的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/318692/?project=22&query=NumberFormatException&statsPeriod=14d 2023-09-01 11:10:21 +08:00
f9d652d629 Merge branch 'fix/floating_window_issue' into 'dev'
fix: 修复右下悬浮窗及启动弹窗的一些显示问题

See merge request halo/android/assistant-android!1308
2023-08-31 17:05:54 +08:00
77ee092b5b chore: 版本更新至 5.30.2 2023-08-31 16:58:17 +08:00
0a61d29f37 fix: 修复右下悬浮窗及启动弹窗的一些显示问题 2023-08-31 16:50:14 +08:00
c65147e309 Merge branch 'hotfix/v5.30.1-951/ad-sdk-init-issue' into 'release'
fix: 修复开屏广告有机率因为初始化问题导致无法显示的问题

See merge request halo/android/assistant-android!1307
2023-08-31 16:02:13 +08:00
1ff2bb0bcc fix: 修复开屏广告有机率因为初始化问题导致无法显示的问题 2023-08-31 15:45:46 +08:00
f8ce9ffc90 Merge branch 'fix/GHZS-3358' into 'dev'
fix: 意见反馈页面改版-0830测试 https://jira.shanqu.cc/browse/GHZS-3358

See merge request halo/android/assistant-android!1306
2023-08-31 10:59:25 +08:00
42366a8591 fix: 意见反馈页面改版-0830测试 https://jira.shanqu.cc/browse/GHZS-3358 2023-08-31 10:53:52 +08:00
5dbf29a09d Merge branch 'feature-GHZS-3276-patch' into 'dev'
feat: 游戏详情-开服日历表-反馈优化—0822UI测试 https://jira.shanqu.cc/browse/GHZS-3276

See merge request halo/android/assistant-android!1305
2023-08-31 10:53:41 +08:00
9621a62ed6 feat: 游戏详情-开服日历表-反馈优化—0822UI测试 https://jira.shanqu.cc/browse/GHZS-3276 2023-08-31 10:37:27 +08:00
07f320db27 Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	dependencies.gradle
2023-08-31 10:20:25 +08:00
89ecf09b55 Merge branch 'hotfix/v5.30.1-951/gson-culprit' into 'release'
fix: 捕抓 gson toList 方法在部分设备上异常闪退的问题

See merge request halo/android/assistant-android!1304
2023-08-31 10:19:34 +08:00
2cfb227c22 fix: 捕抓 gson toList 方法在部分设备上异常闪退的问题 2023-08-31 10:18:02 +08:00
285ec88d01 Merge branch 'feature-GHZS-3168' into 'dev'
feat: 帖子详情页UI优化—客户端 https://jira.shanqu.cc/browse/GHZS-3168

See merge request halo/android/assistant-android!1303
2023-08-31 09:26:01 +08:00
1f86e7b32d feat: 帖子详情页UI优化—客户端 https://jira.shanqu.cc/browse/GHZS-3168 2023-08-30 18:00:09 +08:00
f34adc8e6d chore: 版本更新至 5.30.1 2023-08-30 17:39:45 +08:00
8606c8f87a Merge branch 'feature-GHZS-sentry-327130' into 'release'
Fix Sentry327130 QQ小游戏生命周期回调异常处理

See merge request halo/android/assistant-android!1301
2023-08-30 17:22:18 +08:00
caf2dbacf9 Fix Sentry327130 QQ小游戏生命周期回调异常处理 2023-08-30 17:22:18 +08:00
df6c87eed2 Merge branch 'fix/GHZS-3064' into 'dev'
fix: 修复帮助与反馈页面帮助视频轮播与下拉刷新的滑动冲突

See merge request halo/android/assistant-android!1302
2023-08-30 17:08:00 +08:00
2894a964ea fix: 修复帮助与反馈页面帮助视频轮播与下拉刷新的滑动冲突 2023-08-30 17:06:35 +08:00
421baf2889 Merge branch 'fix/GHZS-3315' into 'dev'
fix: 重构首页弹窗类功能的显示(调整通知权限弹窗的回调)

See merge request halo/android/assistant-android!1300
2023-08-30 15:32:46 +08:00
040901f9df fix: 重构首页弹窗类功能的显示(调整通知权限弹窗的回调) 2023-08-30 15:28:24 +08:00
9587336b31 Merge branch 'fix/vgame_ui_issue' into 'release'
fix: 修复畅玩首页最近在玩区域的更多按钮被隐藏的问题

See merge request halo/android/assistant-android!1299
2023-08-30 15:23:31 +08:00
e1c2b2027a fix: 修复畅玩首页最近在玩区域的更多按钮被隐藏的问题 2023-08-30 15:22:39 +08:00
c5ff26c879 Merge branch 'fix/crashes' into 'release'
修复Sentry闪退问题

See merge request halo/android/assistant-android!1298
2023-08-30 15:10:57 +08:00
9690a695d4 fix: Sentry327122 https://sentry.shanqu.cc/organizations/lightgame/issues/327122/ 2023-08-30 15:06:59 +08:00
78e9c43f24 fix: Sentry323027 https://sentry.shanqu.cc/organizations/lightgame/issues/323027/ 2023-08-30 15:06:59 +08:00
2d9af85b62 Merge branch 'fix/home_game_collection_carousel_crash' into 'dev'
fix: 修复首页游戏单轮播数组越界闪退

See merge request halo/android/assistant-android!1297
2023-08-30 14:36:12 +08:00
35c71c70c9 fix: 修复首页游戏单轮播数组越界闪退 2023-08-30 14:23:47 +08:00
70e63ed8e3 Merge branch 'fix/GHZS-3286' into 'dev-5.32.0'
fix: 单机插件更新跳转—客户端 https://jira.shanqu.cc/browse/GHZS-3286

See merge request halo/android/assistant-android!1296
2023-08-30 11:32:38 +08:00
b7a36074ed fix: 单机插件更新跳转—客户端 https://jira.shanqu.cc/browse/GHZS-3286 2023-08-30 11:08:31 +08:00
0cb7e4c9a1 Merge branch 'fix/window_animation' into 'dev'
fix: 优化右下悬浮窗的隐藏动画

See merge request halo/android/assistant-android!1295
2023-08-30 10:55:50 +08:00
152b9add80 fix: 优化右下悬浮窗的隐藏动画 2023-08-30 10:52:22 +08:00
ab27ca5256 Merge branch 'fix/compose_setting' into 'dev'
fix: 修复compose设置模块编译问题

See merge request halo/android/assistant-android!1294
2023-08-29 17:35:37 +08:00
90545415ae fix: 修复compose设置模块编译问题 2023-08-29 17:31:55 +08:00
8018517207 Merge branch 'feature/GHZS-3172' into 'dev'
feat: 神策数据埋点第二期(1)—客户端 https://jira.shanqu.cc/browse/GHZS-3172

See merge request halo/android/assistant-android!1293
2023-08-29 15:40:15 +08:00
c79128d6f4 feat: 神策数据埋点第二期(1)—客户端 https://jira.shanqu.cc/browse/GHZS-3172 2023-08-29 15:40:15 +08:00
141d179a64 chore: 版本个更新至 5.32.0 2023-08-29 14:12:07 +08:00
0a9471fc2e Merge remote-tracking branch 'origin/dev' into dev-5.31.0 2023-08-29 14:06:47 +08:00
ce3d594a4e Merge branch 'feat/GHZS-3182' into 'dev-5.31.0'
feat: 神策数据埋点第二期(3) https://jira.shanqu.cc/browse/GHZS-3182

See merge request halo/android/assistant-android!1291
2023-08-29 10:50:58 +08:00
553f84daa1 feat: 神策数据埋点第二期(3) https://jira.shanqu.cc/browse/GHZS-3182 2023-08-29 10:35:40 +08:00
70f782cb5c Merge branch 'fix/GHZS-3325' into 'dev-5.31.0'
fix: 右下悬浮窗优化-0828测试 https://jira.shanqu.cc/browse/GHZS-3325

See merge request halo/android/assistant-android!1290
2023-08-29 10:25:53 +08:00
28725ae76f fix: 右下悬浮窗优化-0828测试 https://jira.shanqu.cc/browse/GHZS-3325 2023-08-29 10:17:38 +08:00
b0972f1a80 Merge branch 'feature/GHZS-3064' into 'dev-5.31.0'
帮助与反馈页面改版&意见反馈页面改版

See merge request halo/android/assistant-android!1283
2023-08-28 14:06:09 +08:00
585660e52d 帮助与反馈页面改版&意见反馈页面改版 2023-08-28 14:06:09 +08:00
20998852b6 fix: 处理合并冲突 2023-08-25 16:57:53 +08:00
929a2c4d29 Merge remote-tracking branch 'origin/dev' into dev-5.31.0
# Conflicts:
#	app/src/main/java/com/gh/gamecenter/fragment/MainWrapperFragment.java
#	app/src/main/java/com/gh/gamecenter/game/horizontal/GameHorizontalAdapter.kt
2023-08-25 16:38:27 +08:00
f0fd323107 Merge branch 'fix/floating_window_animation' into 'dev-5.31.0'
fix: 修复右下悬浮窗展开和收起的动画显示问题

See merge request halo/android/assistant-android!1287
2023-08-25 16:34:50 +08:00
00892e831a fix: 修复右下悬浮窗展开和收起的动画显示问题 2023-08-25 16:34:15 +08:00
a55fcdcb28 Merge branch 'feat/GHZS-3081' into 'dev-5.31.0'
feat: 右下悬浮窗优化-新增悬浮窗展开交互 https://jira.shanqu.cc/browse/GHZS-3081

See merge request halo/android/assistant-android!1285
2023-08-24 18:03:20 +08:00
548a34c66d feat: 右下悬浮窗优化-新增悬浮窗展开交互 https://jira.shanqu.cc/browse/GHZS-3081 2023-08-24 17:28:36 +08:00
55f51284c8 Merge branch 'feature-GHZS-3255' into 'dev-5.31.0'
feat: 插件化相关弹窗埋点补充—0817测试 https://jira.shanqu.cc/browse/GHZS-3255

See merge request halo/android/assistant-android!1282
2023-08-24 15:06:07 +08:00
079dac80f8 feat: 插件化相关弹窗埋点补充—0817测试 https://jira.shanqu.cc/browse/GHZS-3255 2023-08-24 15:06:07 +08:00
b33fee6ec0 Merge branch 'feature-GHZS-3276' into 'dev-5.31.0'
feat: 游戏详情-开服日历表-反馈优化—0822UI测试 https://jira.shanqu.cc/browse/GHZS-3276

See merge request halo/android/assistant-android!1281
2023-08-24 09:55:43 +08:00
2c1fdae6c7 feat: 游戏详情-开服日历表-反馈优化—0822UI测试 https://jira.shanqu.cc/browse/GHZS-3276 2023-08-24 09:55:43 +08:00
6a935b18e8 Merge branch 'fix/GHZS-3274' into 'dev-5.31.0'
fix: 新游开测相关功能优化(第二期)—0822UI测试 https://jira.shanqu.cc/browse/GHZS-3274

See merge request halo/android/assistant-android!1280
2023-08-22 15:40:13 +08:00
91c363fb55 fix: 新游开测相关功能优化(第二期)—0822UI测试 https://jira.shanqu.cc/browse/GHZS-3274 2023-08-22 15:38:46 +08:00
e1a65c5fce Merge branch 'fix/GHZS-3248' into 'dev-5.31.0'
fix: 新游开测相关功能优化(第二期)—0817测试 https://jira.shanqu.cc/browse/GHZS-3248

See merge request halo/android/assistant-android!1277
2023-08-17 16:39:02 +08:00
9fd6ce4e74 fix: 新游开测相关功能优化(第二期)—0817测试 https://jira.shanqu.cc/browse/GHZS-3248 2023-08-17 16:37:33 +08:00
46df9cdccc Merge branch 'fix/GHZS-3248' into 'dev-5.31.0'
fix: 新游开测相关功能优化(第二期)—0817测试 https://jira.shanqu.cc/browse/GHZS-3248

See merge request halo/android/assistant-android!1275
2023-08-17 16:34:37 +08:00
339665f90f fix: 新游开测相关功能优化(第二期)—0817测试 https://jira.shanqu.cc/browse/GHZS-3248 2023-08-17 16:29:33 +08:00
96d9d05eb9 Merge branch 'fix/config_error' into 'dev-5.31.0'
fix: 修复阿里云OSS图片数据处理字段使用错误问题 https://jira.shanqu.cc/browse/GHZS-3113

See merge request halo/android/assistant-android!1274
2023-08-17 14:04:14 +08:00
b1c848a7a6 fix: 修复阿里云OSS图片数据处理字段使用错误问题 2023-08-17 14:03:32 +08:00
eb4d84bb48 Merge branch 'feat/GHZS-3113' into 'dev-5.31.0'
feat: 阿里云OSS图片数据处理 https://jira.shanqu.cc/browse/GHZS-3113

See merge request halo/android/assistant-android!1273
2023-08-17 11:44:25 +08:00
04f72091e4 feat: 阿里云OSS图片数据处理 https://jira.shanqu.cc/browse/GHZS-3113 2023-08-17 11:34:54 +08:00
5d21d62140 Merge branch 'feature-GHZS-3163' into 'dev-5.31.0'
feat:插件化相关弹窗埋点补充—客户端 https://jira.shanqu.cc/browse/GHZS-3163

See merge request halo/android/assistant-android!1272
2023-08-17 10:34:59 +08:00
0a7b646779 feat:插件化相关弹窗埋点补充—客户端 https://jira.shanqu.cc/browse/GHZS-3163 2023-08-17 10:22:44 +08:00
9f9a675f04 Merge branch 'feature/GHZS-3176' into 'dev-5.31.0'
feat: 新游开测相关功能优化(第二期)—客户端 https://jira.shanqu.cc/browse/GHZS-3176

See merge request halo/android/assistant-android!1270
2023-08-16 17:35:23 +08:00
238220548a feat: 新游开测相关功能优化(第二期)—客户端 https://jira.shanqu.cc/browse/GHZS-3176 2023-08-16 17:18:18 +08:00
dfc023a0cd Merge branch 'feat/GHZS-3161' into 'dev-5.31.0'
feat: 帖子发布图片数量限制开放 https://jira.shanqu.cc/browse/GHZS-3161

See merge request halo/android/assistant-android!1268
2023-08-16 15:57:28 +08:00
cbd9a5708b feat: 帖子发布图片数量限制开放 https://jira.shanqu.cc/browse/GHZS-3161 2023-08-16 15:56:50 +08:00
8b0a639196 Merge branch 'feature-GHZS-3063' into 'dev-5.31.0'
feat:游戏详情-开服日历表-反馈优化—客户端 https://jira.shanqu.cc/browse/GHZS-3063

See merge request halo/android/assistant-android!1266
2023-08-16 15:14:43 +08:00
75f164249f feat:游戏详情-开服日历表-反馈优化—客户端 https://jira.shanqu.cc/browse/GHZS-3063 2023-08-16 15:01:48 +08:00
fd72f01b1d Merge branch 'feature/GHZS-3238' into 'dev-5.31.0'
feat: 游戏专区配置相关优化—客户端 https://jira.shanqu.cc/browse/GHZS-3238

See merge request halo/android/assistant-android!1265
2023-08-16 14:24:34 +08:00
c17a55e33c feat: 游戏专区配置相关优化—客户端 https://jira.shanqu.cc/browse/GHZS-3238 2023-08-16 14:13:36 +08:00
1aded5ecf4 Merge branch 'refactor/main_dialog' into 'dev-5.31.0'
refactor: 重构首页弹窗显示逻辑

See merge request halo/android/assistant-android!1262
2023-08-16 11:45:02 +08:00
d86dc7a03c feat: 重构首页弹窗显示逻辑 2023-08-16 11:06:47 +08:00
9741334c2e Merge branch 'feature-GHZS-3181' into 'dev-5.31.0'
feat: 神策数据埋点第二期(2)—客户端 https://jira.shanqu.cc/browse/GHZS-3181

See merge request halo/android/assistant-android!1259
2023-08-15 16:07:19 +08:00
48f762140b feat: 神策数据埋点第二期(2)—客户端 https://jira.shanqu.cc/browse/GHZS-3181 2023-08-15 16:07:18 +08:00
eba7f31b32 Merge remote-tracking branch 'origin/dev' into dev-5.31.0 2023-08-15 15:07:40 +08:00
38d91af306 Merge branch 'dev' into dev-5.31.0 2023-08-14 10:22:13 +08:00
f2bf3df304 Merge branch 'feat/GHZS-3099' into 'dev-5.31.0'
feat: 安装方式管理-增加模糊匹配功能 https://jira.shanqu.cc/browse/GHZS-3099

See merge request halo/android/assistant-android!1250
2023-08-10 10:34:15 +08:00
c2b46ea5f2 feat: 安装方式管理-增加模糊匹配功能 https://jira.shanqu.cc/browse/GHZS-3099 2023-08-10 10:28:22 +08:00
f12c0f8066 Merge branch 'feat/GHZS-3140' into 'dev-5.31.0'
feat: 资讯文章-下载按钮相关优化 https://jira.shanqu.cc/browse/GHZS-3165

See merge request halo/android/assistant-android!1248
2023-08-09 14:51:16 +08:00
5f158f74e8 feat: 资讯文章-下载按钮相关优化 https://jira.shanqu.cc/browse/GHZS-3165 2023-08-09 14:42:11 +08:00
503376edc2 Merge branch 'fix/GHZS-3136' into 'dev-5.31.0'
fix:【光环助手】图片视图规范化 https://jira.shanqu.cc/browse/GHZS-3136

See merge request halo/android/assistant-android!1246
2023-08-09 10:32:11 +08:00
7490617191 fix:【光环助手】图片视图规范化 https://jira.shanqu.cc/browse/GHZS-3136 2023-08-09 10:24:27 +08:00
13949e86c4 Merge remote-tracking branch 'origin/dev' into dev-5.31.0 2023-08-08 10:10:07 +08:00
1207d53314 Merge branch 'fix/GHZS-3097' into 'dev-5.31.0'
feat: 平板适配相关优化 https://jira.shanqu.cc/browse/GHZS-3097

See merge request halo/android/assistant-android!1242
2023-08-07 17:54:48 +08:00
f02b232589 feat: 平板适配相关优化 https://jira.shanqu.cc/browse/GHZS-3097 2023-08-07 17:38:58 +08:00
d61abd1174 Merge remote-tracking branch 'origin/dev' into dev-5.31.0 2023-08-02 11:27:14 +08:00
a460ae0788 chore: 版本更新至 5.31.0 2023-08-02 11:01:15 +08:00
2103 changed files with 46770 additions and 14056 deletions

View File

@ -61,7 +61,7 @@ android_build:
script:
- export GRADLE_USER_HOME=/home/gitlab-runner/ci-build-cache/$CI_PROJECT_PATH/.gradle
- chmod +x ./gradlew
- ./scripts/jenkins_build.sh -c
- ./scripts/jenkins_build.sh $CI_COMMIT_REF_NAME $BEFORE_COMMIT_SHA $CI_COMMIT_SHA
#设置打包后的产物用于job之间共享
artifacts:
paths:
@ -71,8 +71,7 @@ android_build:
exit_codes: 137
only:
- dev
- dev-5.29.0
- dev-5.30.0
- dev-5.33.0
# 代码检查
sonarqube_analysis:
@ -103,8 +102,7 @@ sonarqube_analysis:
exit_codes: 137
only:
- dev
- dev-5.29.0
- dev-5.30.0
- dev-5.33.0
## 发送简易检测结果报告
send_sonar_report:
@ -122,12 +120,11 @@ send_sonar_report:
exit_codes: 137
only:
- dev
- dev-5.29.0
- dev-5.30.0
- dev-5.33.0
oss-upload&send-email:
tags:
- rancher-k8s
- sysadm-devops
stage: oss-upload&send-email
image: hub.shanqu.cc/devops/android-apk-oss-upload:latest
variables:
@ -135,9 +132,9 @@ oss-upload&send-email:
VAULT_ADDR: https://vault.shanqu.cc # 固定值
VAULT_SECRET_PATH: prod/devops/android-apk-oss-upload # 固定值
VAULT_ROLE: android-apk-oss-upload # 固定值
ENDPOINT: "oss-cn-shenzhen-internal.aliyuncs.com" # 固定值
BUCKET: "shanqu" # 固定值
FILE_PATH: "app/build/tmp/" # APK 存放路径
ENDPOINT: "tos-cn-guangzhou.ivolces.com" # 固定值
BUCKET: "sysadm-public" # 固定值
FILE_PATH: "app/build/tmp/" # APK 存放路径
Email_To_List: $EMAIL_TO_LIST # 邮件接受人列表
Email_Title: "光环助手 $CI_COMMIT_BRANCH" # 邮件标题
PIPELINE_ID: $CI_PIPELINE_ID # 流水线id
@ -152,8 +149,7 @@ oss-upload&send-email:
### 开启上传 ###
- /usr/local/bin/python /upload.py
### 发送邮件
- /usr/local/bin/python /ci-android-mail.py
- /usr/local/bin/python /ci-android-mail-jira-comment.py
only:
- dev
- dev-5.29.0
- dev-5.30.0
- dev-5.33.0

View File

@ -30,14 +30,7 @@
### git 版本管理
本项目使用简化版的 git flow 来管理分支,细节请看 [光环安卓简单 git 规范](https://git.ghzs.com/halo/android/assistant-android/-/wikis/%E5%85%89%E7%8E%AF%E5%AE%89%E5%8D%93%E7%AE%80%E5%8D%95-git-%E8%A7%84%E8%8C%83)
### API 环境配置
本项目使用 Build Variants 来切换 API 环境
* internal 为测试环境
* publish 为正式环境
本项目使用简化版的 git flow 来管理分支,细节请看 [光环安卓简单 git 规范](https://git.shanqu.cc/halo/android/assistant-android/-/wikis/%E5%85%89%E7%8E%AF%E5%AE%89%E5%8D%93%E7%AE%80%E5%8D%95-git-%E8%A7%84%E8%8C%83)
### 图片资源配置
@ -53,14 +46,3 @@
* 本项目使用了微信的 [AndResGuard](https://github.com/shwenzhang/AndResGuard) 作为资源混淆压缩方案,新增需要使用 `getIdentifier` 获取的资源文件时需要添加至白名单
* 本项目默认使用 R8 作为混淆工具,往 proguard-rules.txt 添加 proguard 新配置项时请检查可用性(如语法等)
### APK打包配置
> 打内部测试包:`./scripts/test_build.sh`
> 打邮件测试包:`./scripts/jenkins_build.sh`
### TODO
* 把原有 EventBus 的消息 Type 统一到一个文件内
* 将实现细节从 View(Fragment、Activity) 剥离并以 MVVM 结构改造
* 重构 MainActivity

View File

@ -95,8 +95,10 @@ android {
buildConfigField "int", "ACTIVATE_REPORTING_RATIO", "${ACTIVATE_REPORTING_RATIO}"
// All third-party appid/appkey
buildConfigField "boolean", "IS_GAT_APP", "false"
buildConfigField "String", "API_HOST", "\"${API_HOST}\""
buildConfigField "String", "NEW_API_HOST", "\"${NEW_API_HOST}\""
buildConfigField "String", "LOG_HUB_PROJECT", "\"${LOG_HUB_PROJECT}\""
buildConfigField "String", "VAPI_HOST", "\"${VAPI_HOST}\""
buildConfigField "String", "WECHAT_APPID", "\"${WECHAT_APPID}\""
buildConfigField "String", "WECHAT_SECRET", "\"${WECHAT_SECRET}\""
@ -157,7 +159,7 @@ android {
}
}
flavorDimensions("env")
flavorDimensions("env", "region")
sourceSets {
publish {
@ -175,6 +177,15 @@ android {
gdt {
java.srcDirs = ['src/main/java', 'src/gdt/java']
}
gat {
java.srcDirs = ['src/main/java', 'src/gat/java']
}
cn {
java.srcDirs = ['src/main/java', 'src/cn/java']
}
sm {
java.srcDirs = ['src/main/java', 'src/sm/java']
}
}
productFlavors {
@ -188,7 +199,8 @@ android {
buildConfigField "String", "DEV_VAPI_HOST", "\"${DEV_VAPI_HOST}\""
buildConfigField "String", "QUICK_LOGIN_APPID", "\"${DEV_QUICK_LOGIN_APPID}\""
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${DEV_QUICK_LOGIN_APPKEY}\""
buildConfigField "String", "CSJ_APPID", "\"${DEV_CSJ_APPID}\""
buildConfigField "String", "DEV_CSJ_APPID", "\"${DEV_CSJ_APPID}\""
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
}
// publish 发布时候使用的 flavor接口仅包含正式环境
@ -200,6 +212,7 @@ android {
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", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
}
@ -211,6 +224,7 @@ android {
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", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
manifestPlaceholders.put("APPLOG_SCHEME", "rangersapplog.byAx6uYt".toLowerCase())
@ -224,6 +238,7 @@ android {
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", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
}
@ -235,8 +250,40 @@ android {
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", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
}
sm {
dimension "env"
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", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
}
// 港澳台
gat {
dimension "region"
applicationId rootProject.ext.applicationIdGat
// 支持繁体
resConfigs "zh", "zh-rTW"
buildConfigField "boolean", "IS_GAT_APP", "true"
buildConfigField "String", "LOG_HUB_PROJECT", "\"${LOG_HUB_PROJECT_GAT}\""
buildConfigField "String", "API_HOST", "\"${API_HOST_GAT}\""
buildConfigField "String", "NEW_API_HOST", "\"${NEW_API_HOST_GAT}\""
}
cn {
dimension "region"
}
}
}
@ -253,6 +300,7 @@ dependencies {
teaImplementation fileTree(include: ['*.jar', '*.aar'], dir: 'src/tea/libs')
kuaishouImplementation fileTree(include: ['*.jar', '*.aar'], dir: 'src/kuaishou/libs')
gdtImplementation fileTree(include: ['*.jar', '*.aar'], dir: 'src/gdt/libs')
smImplementation fileTree(include: ['*.jar', '*.aar'], dir: 'src/sm/libs')
testImplementation 'junit:junit:4.12'
debugImplementation "com.squareup.leakcanary:leakcanary-android:${leakcanary}"
@ -337,7 +385,10 @@ dependencies {
implementation(project(':module_core_feature')) {
exclude group: 'androidx.swiperefreshlayout'
}
implementation(project(':module_feedback')) {
// implementation(project(':module_feedback')) {
// exclude group: 'androidx.swiperefreshlayout'
// }
implementation(project(':feature:new_feedback',)) {
exclude group: 'androidx.swiperefreshlayout'
}
implementation(project(':module_sensors_data')) {
@ -356,6 +407,7 @@ dependencies {
implementation(project(':feature:qq_game')) {
exclude group: 'androidx.swiperefreshlayout'
}
internalImplementation(project(':module_internal_test'))
}
File propFile = file('sign.properties')

View File

@ -88,7 +88,14 @@
-keep class com.qq.gdt.action.** {*;}
-keep public class com.tencent.turingfd.sdk.**
### 神马 SDK
-dontwarn com.gism.**
-keepclasseswithmembers class * {
native <methods>;
}
-keepclassmembernames class com.contrarywind.view.WheelView {
private int itemsVisible;
}

View File

@ -5,6 +5,7 @@ import com.lightgame.utils.Utils
import com.qq.gdt.action.ActionParam
import com.qq.gdt.action.ActionType
import com.qq.gdt.action.GDTAction
import com.qq.gdt.action.PrivateController
import org.json.JSONObject
object GdtHelper {
@ -16,6 +17,12 @@ object GdtHelper {
@JvmStatic
fun init(application: Application, channel: String) {
GDTAction.setPrivateController(object : PrivateController() {
override fun isCanUsePhoneState(): Boolean {
return false
}
})
if (channel == "KS_GDT_GHZS_MC01") {
GDTAction.init(application, KS_USER_ACTION_SET_ID, KS_APP_SECRET_ID, channel)
} else {

View File

@ -0,0 +1,32 @@
package com.gh.vspace
import android.content.Intent
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.Keep
import com.gh.gamecenter.R
import com.gh.gamecenter.databinding.LayoutPersonalOtherItemBinding
import com.gh.vspace.installexternalgames.InstallExternalGameActivity
@Keep
class ExternalGameUsage : IExternalGamesUsage {
override fun addInstallExternalGameButton(viewParent: ViewGroup) {
val context = viewParent.context
viewParent.findViewById<View>(R.id.install_game_from_external) ?: run {
val binding = LayoutPersonalOtherItemBinding.inflate(LayoutInflater.from(context)).apply {
root.id = R.id.install_game_from_external
titleTv.text = context.getString(R.string.title_install_external_game)
iconIv.setImageResource(R.drawable.ic_personal_my_game)
root.setOnClickListener {
VHelper.connectService {
context.startActivity(
InstallExternalGameActivity.getIntent(context)
.apply { flags = flags or Intent.FLAG_ACTIVITY_NEW_TASK })
}
}
}
viewParent.addView(binding.root, 0)
}
}
}

View File

@ -0,0 +1,5 @@
package com.gh.vspace.installexternalgames;
public class Constants {
public static final String TAG = "从SD卡安装";
}

View File

@ -0,0 +1,47 @@
package com.gh.vspace.installexternalgames
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.common.utils.toBinding
class ExternalGameAdapter(private val games: List<ExternalGameUiState>, private val onItemClickListener: OnItemClickListener) :
RecyclerView.Adapter<ExternalGameViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ExternalGameViewHolder {
return ExternalGameViewHolder(parent.toBinding())
}
override fun getItemCount(): Int {
return games.size
}
override fun onBindViewHolder(holder: ExternalGameViewHolder, position: Int) {
val item = games[position]
holder.apkInfo.text = item.externalGameEntity.let { item ->
"""
应用程序名:${item.appName}
版本号:${item.apkVersion}
包名: ${item.apkPackageName}
路径:${item.apkPath}
""".trimIndent()
}
holder.install.goneIf(item.isInstalled) {
holder.install.setOnClickListener {
onItemClickListener.onItemClick(item, OnItemClickListener.ClickType.CLICK_INSTALL)
}
}
holder.uninstall.goneIf(!item.isInstalled) {
holder.uninstall.setOnClickListener {
onItemClickListener.onItemClick(
item,
OnItemClickListener.ClickType.CLICK_UNINSTALL
)
}
}
holder.start.goneIf(!item.isInstalled) {
holder.start.setOnClickListener {
onItemClickListener.onItemClick(item, OnItemClickListener.ClickType.CLICK_START)
}
}
}
}

View File

@ -0,0 +1,11 @@
package com.gh.vspace.installexternalgames
data class ExternalGameEntity(
val cpuAbi: Set<String>,
val apkPath: String,
val apkFileName: String,
val appName: String,
val apkVersion: String,
val apkPackageName: String,
val lastModified: Long,
)

View File

@ -0,0 +1,6 @@
package com.gh.vspace.installexternalgames
data class ExternalGameUiState(
val externalGameEntity: ExternalGameEntity,
val isInstalled: Boolean
)

View File

@ -0,0 +1,11 @@
package com.gh.vspace.installexternalgames
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.databinding.LayoutExternalGameItemBinding
class ExternalGameViewHolder(binding: LayoutExternalGameItemBinding) : RecyclerView.ViewHolder(binding.root) {
val apkInfo = binding.apkFileInfo
val install = binding.btnInstall
val uninstall = binding.btnUninstall
val start = binding.btnStart
}

View File

@ -0,0 +1,14 @@
package com.gh.vspace.installexternalgames
import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.gh.gamecenter.common.base.activity.ToolBarActivity
class InstallExternalGameActivity : ToolBarActivity() {
companion object {
fun getIntent(context: Context): Intent {
return getTargetIntent(context, InstallExternalGameActivity::class.java, InstallExternalGameFragment::class.java, Bundle())
}
}
}

View File

@ -0,0 +1,153 @@
package com.gh.vspace.installexternalgames
import android.app.Dialog
import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import com.gh.common.util.DialogUtils
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.fragment.ToolbarFragment
import com.gh.gamecenter.common.exposure.meta.MetaUtil
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.viewModelProvider
import com.gh.gamecenter.common.view.divider.HorizontalDividerItemDecoration
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.databinding.FragmentInstallExternalGamesBinding
import com.gh.vspace.VHelper
import com.halo.assistant.HaloApp
import com.lg.vspace.VirtualAppManager
import io.reactivex.Single
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
class InstallExternalGameFragment : ToolbarFragment(), OnItemClickListener {
private val mViewModel: InstallExternalGameViewModel by lazy { viewModelProvider() }
private lateinit var mBinding: FragmentInstallExternalGamesBinding
private val games = mutableListOf<ExternalGameUiState>()
private var adapter = ExternalGameAdapter(games, this)
private var uninstallDisposable: Disposable? = null
override fun getLayoutId() = 0
override fun getInflatedLayout() =
FragmentInstallExternalGamesBinding.inflate(layoutInflater).apply { mBinding = this }.root
private lateinit var dialog: Dialog
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setNavigationTitle(getString(com.gh.gamecenter.R.string.title_install_external_game))
initView()
mViewModel.gamesList.observe(this) {
if (dialog.isShowing) {
dialog.dismiss()
}
games.clear()
games.addAll(
it.map {
ExternalGameUiState(it, VHelper.isInstalled(it.apkPackageName))
}
)
adapter.notifyDataSetChanged()
}
mViewModel.scanPaths()
}
private fun initView() {
dialog = DialogUtils.showWaitDialog(requireContext(), "")
mBinding.externalGamesList.let {
it.adapter = adapter
it.layoutManager = LinearLayoutManager(requireContext())
val itemDecoration = HorizontalDividerItemDecoration.Builder(requireContext())
.size(2F.dip2px())
.color(R.color.ui_divider.toColor(requireContext()))
.build()
if (it.itemDecorationCount != 0) {
it.removeItemDecorationAt(0)
}
it.addItemDecoration(itemDecoration)
}
}
override fun onDestroy() {
super.onDestroy()
if (dialog.isShowing) {
dialog.dismiss()
}
if (uninstallDisposable?.isDisposed != true) {
uninstallDisposable?.dispose()
}
}
override fun onItemClick(externalGameUiState: ExternalGameUiState, clickType: OnItemClickListener.ClickType) {
when (clickType) {
OnItemClickListener.ClickType.CLICK_INSTALL -> {
install(externalGameUiState)
}
OnItemClickListener.ClickType.CLICK_UNINSTALL -> {
uninstall(externalGameUiState)
}
OnItemClickListener.ClickType.CLICK_START -> {
start(externalGameUiState)
}
}
}
private fun install(externalGameUiState: ExternalGameUiState) {
val bit =
externalGameUiState.externalGameEntity.cpuAbi.let { if (it.size == 1 && it.contains("armeabi-v7a")) "32" else "64" }
if (VHelper.showDialogIfVSpaceIsNeeded(
requireContext(),
"",
externalGameUiState.externalGameEntity.appName,
"",
bit = bit
)
) return
dialog.show()
externalGameUiState.externalGameEntity.let {
val intent = VirtualAppManager.getInstallIntent(context, it.apkPath, it.apkPackageName)
requireActivity().startActivity(intent)
}
}
private fun uninstall(externalGameUiState: ExternalGameUiState) {
dialog.show()
uninstallDisposable = Single.create<Void> {
VHelper.uninstall(externalGameUiState.externalGameEntity.apkPackageName)
}.subscribeOn(Schedulers.from(AppExecutor.lightWeightIoExecutor)).observeOn(AndroidSchedulers.mainThread())
.subscribe { t1, t2 ->
if (dialog.isShowing) {
dialog.dismiss()
}
}
}
private fun start(externalGameUiState: ExternalGameUiState) {
val intent = VirtualAppManager.get().getStartGameIntent(
externalGameUiState.externalGameEntity.apkPackageName,
"",
externalGameUiState.externalGameEntity.appName,
"",
MetaUtil.getBase64EncodedAndroidId(),
HaloApp.getInstance().gid,
com.gh.gamecenter.BuildConfig.VERSION_NAME,
HaloApp.getInstance().channel,
"",
""
)
requireActivity().startActivity(intent)
}
}

View File

@ -0,0 +1,64 @@
package com.gh.vspace.installexternalgames
import android.app.Application
import android.content.pm.PackageManager
import android.os.Environment
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.gh.gamecenter.core.runOnIoThread
import com.gh.vspace.VHelper
import com.lg.vspace.helper.compat.NativeLibraryHelperCompat
import com.lightgame.utils.Utils
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
class InstallExternalGameViewModel(application: Application) : AndroidViewModel(application) {
private val _gamesList = MutableLiveData<List<ExternalGameEntity>>(listOf())
val gamesList: LiveData<List<ExternalGameEntity>> = _gamesList
private val pkgManger = getApplication<Application>().packageManager
private var disposable: Disposable = VHelper.callSite.observeOn(AndroidSchedulers.mainThread()).subscribe {
scanPaths()
}
fun scanPaths() {
runOnIoThread {
_gamesList.postValue(Environment.getExternalStorageDirectory().walk().maxDepth(1)
.filter { it.isHidden.not() }
.filter { it.isFile }
.onEach {
Utils.log(Constants.TAG, "获得文件: ${it.name}")
}
.filter { it.extension == "apk" }
.map {
val packageInfo = pkgManger.getPackageArchiveInfo(
it.absolutePath,
PackageManager.GET_META_DATA or PackageManager.GET_ACTIVITIES
)
packageInfo?.let { packageInfo ->
val applicationInfo = packageInfo.applicationInfo
applicationInfo.publicSourceDir = it.absolutePath
applicationInfo.sourceDir = it.absolutePath
ExternalGameEntity(
cpuAbi = NativeLibraryHelperCompat.getPackageAbiList(it.absolutePath),
apkPath = it.absolutePath,
apkFileName = it.name,
apkPackageName = packageInfo.packageName,
apkVersion = packageInfo.versionName,
appName = pkgManger.getApplicationLabel(applicationInfo).toString(),
lastModified = it.lastModified()
)
}
}.filterNotNull()
.toList().sortedByDescending { it.lastModified }
)
}
}
override fun onCleared() {
super.onCleared()
disposable.dispose()
}
}

View File

@ -0,0 +1,11 @@
package com.gh.vspace.installexternalgames
interface OnItemClickListener {
enum class ClickType {
CLICK_INSTALL, CLICK_UNINSTALL, CLICK_START
}
fun onItemClick(externalGameUiState: ExternalGameUiState, clickType: ClickType)
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/external_games_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/apk_file_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
tools:text="文件名:\n路径" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btn_install"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/text_install"
android:visibility="gone"
tools:visibility="visible" />
<Button
android:id="@+id/btn_uninstall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/text_uninstall"
android:visibility="gone"
tools:visibility="visible" />
<Button
android:id="@+id/btn_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/text_start"
android:visibility="gone"
tools:visibility="visible" />
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="title_install_external_game">從SD卡安裝</string>
<string name="text_install">安裝</string>
<string name="text_uninstall">卸載</string>
<string name="text_start">啟動</string>
</resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="install_game_from_external" type="id" />
</resources>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="title_install_external_game">从SD卡安装</string>
<string name="text_install">安装</string>
<string name="text_uninstall">卸载</string>
<string name="text_start">启动</string>
</resources>

Binary file not shown.

View File

@ -78,6 +78,8 @@
androidx.constraintlayout.compose,
androidx.compose.ui.test.manifest,
com.bytedance.sdk.openadsdk,
com.bykv.vk.openvk,
com.bytedance.tools,
androidx.compose.ui.tooling.preview,
com.tencent.qqmini,
com.tencent.qqmini.minigame.external,
@ -97,6 +99,9 @@
android:name="android.permission.GET_TASKS"
tools:node="remove" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"
tools:node="remove"/>
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
@ -275,7 +280,7 @@
<activity
android:name="com.gh.gamecenter.VoteActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
android:windowSoftInputMode="stateAlwaysHidden|adjustPan" />
<activity
android:name="com.gh.gamecenter.WeiBoShareActivity"
@ -474,6 +479,14 @@
android:name="com.gh.gamecenter.gamedetail.fuli.kaifu.ServersCalendarActivity"
android:screenOrientation="portrait" />
<activity
android:name=".gamedetail.fuli.kaifu.ServersCalendarManagementActivity"
android:screenOrientation="portrait" />
<activity
android:name=".gamedetail.fuli.kaifu.ServersSubscribedGameListActivity"
android:screenOrientation="portrait" />
<activity
android:name=".qa.answer.draft.AnswerDraftActivity"
android:screenOrientation="portrait" />
@ -754,7 +767,15 @@
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qgame.QGameSubjectActivity"
android:name="com.gh.gamecenter.gamecollection.hotlist.GameCollectionListDetailActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.UserAuthActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.SplashAdActivity"
android:screenOrientation="portrait" />
@ -812,6 +833,8 @@
<!-- tools:node="remove" />-->
<!-- </provider>-->
<service android:name = "com.gh.gamecenter.install.InstallService" />
<receiver
android:name="com.gh.gamecenter.receiver.DownloadReceiver"
android:exported="false">

File diff suppressed because one or more lines are too long

View File

@ -205,14 +205,17 @@ RE.setOutdent = function() {
RE.setJustifyLeft = function() {
document.execCommand('justifyLeft', false, null);
RE.enabledEditingItems()
}
RE.setJustifyCenter = function() {
document.execCommand('justifyCenter', false, null);
RE.enabledEditingItems()
}
RE.setJustifyRight = function() {
document.execCommand('justifyRight', false, null);
RE.enabledEditingItems()
}
RE.setBlockquote = function() {
@ -227,6 +230,16 @@ RE.insertImage = function(url) {
RE.insertHTML(html);
}
// 设置分割线
RE.insertHorizontalRule = function() {
document.execCommand('insertHorizontalRule', false, null);
}
// 设置编辑器默认换行符
RE.setDefaultParagraphSeparator = function(separator) {
document.execCommand('defaultParagraphSeparator', false, separator);
}
// 替换成缩略图
RE.replaceTbImage = function(imgRuleFlag, gifRuleFlag) {
var imgs = document.getElementsByTagName("img");
@ -574,6 +587,10 @@ document.addEventListener("selectionchange", function(e) {
RE.sendElementNameToNative()
});
document.addEventListener("selectionchange", function(e) {
RE.enabledEditingItems(e)
});
RE.recursion = function(dom) {
var parenDom = dom.parentElement
if (parenDom && parenDom instanceof Element &&
@ -616,7 +633,6 @@ RE.sendElementNameToNative = function() {
// android function to open link
function customLinkgo(self) {
var datas = self.dataset.datas
// console.log(datas)
window.OnLinkClickListener.onClick(datas)
}

View File

@ -30,7 +30,6 @@ body {
}
#editor {
display: table-cell;
outline: 0px solid transparent;
background-repeat: no-repeat;
background-position: center;

View File

@ -17,12 +17,14 @@ import com.gh.common.exposure.ExposureManager
import com.gh.common.util.DirectUtils.directToLinkPage
import com.gh.common.util.LogUtils
import com.gh.common.util.NewFlatLogUtils.logOpenScreenAdSkip
import com.gh.common.util.PackageUtils
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.MainActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.provider.IBeiziAdProvider
@ -33,7 +35,6 @@ import com.gh.gamecenter.core.utils.TimeUtils.getToday
import com.gh.gamecenter.entity.AdConfig
import com.gh.gamecenter.entity.StartupAdEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent.Companion.createEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.feature.exposure.ExposureType
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
@ -60,12 +61,13 @@ object AdDelegateHelper {
private val mGameSearchAdList: ArrayList<AdConfig> by lazy { arrayListOf() }
private var mVGameLaunchAd: AdConfig? = null
private var mIsCsjRequired: Boolean = false // 是否需要初始化穿山甲 SDK
private var mIsBeiziRequired: Boolean = false // 师傅需要初始化 Beizi SDK
val vGameLaunchAd: AdConfig?
get() = mVGameLaunchAd
private const val AD_SDK_CSJ = "穿山甲"
private const val AD_SDK_BEIZI = "倍孜"
private const val AD_TYPE_SDK = "third_party_ads" // 第三方 SDK 广告
const val AD_TYPE_SDK = "third_party_ads" // 第三方 SDK 广告
const val AD_TYPE_OWNER = "owner_ads" // 自有广告
private const val KEY_CACHE_CONFIG = "cache_config" // 放在 SP 里的广告缓存(避免接口加载问题)
@ -73,23 +75,50 @@ object AdDelegateHelper {
HaloApp.getInstance().getSharedPreferences("AdConfig", Context.MODE_PRIVATE)
}
var isShowingSplashAd = false // 是否正在显示开屏广告
var gameSearchKeyword = ""
fun initAdSdk(context: Context) {
// 初始化 Beizi
if (mBeiziAdImpl == null) {
mBeiziAdImpl =
ARouter.getInstance().build(RouteConsts.provider.beiziAd).navigation() as? IBeiziAdProvider
mBeiziAdImpl?.initSDK(context)
}
// 初始化穿山甲
if (mCsjAdImpl == null) {
mCsjAdImpl =
ARouter.getInstance().build(RouteConsts.provider.csjAd).navigation() as? ICsjAdProvider
val csjAppId = if (EnvHelper.isDevEnv) BuildConfig.DEV_CSJ_APPID else BuildConfig.CSJ_APPID
mCsjAdImpl?.initSDK(context, csjAppId, HaloApp.getInstance().oaid)
// 监听亮色/暗色模式切换
DarkModeUtils.registerModeChangeListener {
val topActivity = CurrentActivityHolder.getCurrentActivity() ?: return@registerModeChangeListener
updateThemeStatus(context, DarkModeUtils.isDarkModeOn(topActivity))
}
}
}
/**
* 请求接口获取广告相关配置
*/
@SuppressLint("CheckResult")
fun requestAdConfig(context: Context, isFromRetry: Boolean) {
fun requestAdConfig(isFromRetry: Boolean, keyword: String = "", callback: (() -> Unit)? = null) {
// mAdConfigList 不为空不需要重试
if (isFromRetry && mAdConfigList != null) {
return
}
val paramsMap = if (keyword.isNotEmpty()) mapOf("keyword" to keyword) else mapOf()
RetrofitManager.getInstance()
.newApi
.adConfig
.getAdConfig(paramsMap)
.subscribeOn(Schedulers.io())
.subscribe(object : BiResponse<List<AdConfig>>() {
override fun onSuccess(data: List<AdConfig>) {
handleAdConfig(context, data)
gameSearchKeyword = keyword
handleAdConfig(data)
callback?.invoke()
// 缓存数据到 SP 供接口请求失败用
SPUtils.setString(mAdConfigSp, KEY_CACHE_CONFIG, data.toJson())
@ -101,8 +130,10 @@ object AdDelegateHelper {
// 若接口请求失败时,从 SP 里获取上次缓存的数据
val cachedConfig: List<AdConfig>? = SPUtils.getString(mAdConfigSp, KEY_CACHE_CONFIG).toObject()
if (cachedConfig != null) {
handleAdConfig(context, cachedConfig)
handleAdConfig(cachedConfig)
}
callback?.invoke()
}
})
}
@ -124,56 +155,121 @@ object AdDelegateHelper {
/**
* 处理广告配置
*/
fun handleAdConfig(context: Context, configList: List<AdConfig>) {
fun handleAdConfig(configList: List<AdConfig>) {
mGameSearchAdList.clear()
mSplashAd = null
mDownloadManagerAd = null
mVGameLaunchAd = null
for (config in configList) {
// 处理返回的数据
when (config.location) {
"halo_launch" -> mSplashAd = config
"halo_launch" -> {
config.ownerAd?.startAd?.let { it.id = config.ownerAd.id }
mSplashAd = config
}
"download_manager" -> mDownloadManagerAd = config
"game_search" -> config.let { mGameSearchAdList.add(it) }
"helper_launch" -> mVGameLaunchAd = config
}
// 根据返回的值里判断是否含有 Beizi 的广告
if (!mIsBeiziRequired) {
if (config.thirdPartyAd?.sourceName == AD_SDK_BEIZI) {
mIsBeiziRequired = true
}
}
// 根据返回的值里判断是否含有 穿山甲 的广告
if (!mIsCsjRequired) {
if (config.thirdPartyAd?.sourceName == AD_SDK_CSJ) {
mIsCsjRequired = true
}
}
}
// 初始化 Beizi
if (mIsBeiziRequired && mBeiziAdImpl == null) {
mBeiziAdImpl =
ARouter.getInstance().build(RouteConsts.provider.beiziAd).navigation() as? IBeiziAdProvider
mBeiziAdImpl?.initSDK(context)
}
// 初始化穿山甲
if (mIsCsjRequired && mCsjAdImpl == null) {
mCsjAdImpl =
ARouter.getInstance().build(RouteConsts.provider.csjAd).navigation() as? ICsjAdProvider
mCsjAdImpl?.initSDK(context, BuildConfig.CSJ_APPID, HaloApp.getInstance().oaid)
// 监听亮色/暗色模式切换
DarkModeUtils.registerModeChangeListener {
val topActivity = CurrentActivityHolder.getCurrentActivity() ?: return@registerModeChangeListener
updateThemeStatus(context, DarkModeUtils.isDarkModeOn(topActivity))
}
}
}
/**
* 是否需要显示开屏广告
* @param isHotLaunch 是否为热启动
*/
fun shouldShowStartUpAd(): Boolean {
fun shouldShowStartUpAd(isHotLaunch: Boolean): Boolean {
return mSplashAd != null
&& !isShowingSplashAd
&& (!isHotLaunch || shouldShowStartUpAdWhenHotLaunch())
&& !isMatchAdFreeRule(mSplashAd)
&& isMatchStartUpAdDisplayRule()
}
/**
* 热启动是否需要显示开屏广告
*/
private fun shouldShowStartUpAdWhenHotLaunch() = mSplashAd?.displayRule?.hotStartSplashAd?.type == AD_TYPE_SDK
/**
* 是否需要显示下载管理广告
*/
fun shouldShowDownloadManagerAd(): Boolean {
return mDownloadManagerAd != null && !isMatchAdFreeRule(mDownloadManagerAd) && isMatchDownloadManagerAdDisplayRule()
}
/**
* 是否需要显示游戏搜索广告
*/
fun shouldShowGameSearchAd(adConfig: AdConfig): Boolean {
return !isMatchAdFreeRule(adConfig) && isMatchGameSearchAdDisplayRule(adConfig)
}
/**
* 是否在免广告时长内
*/
private fun isMatchAdFreeRule(adConfig: AdConfig?): Boolean {
adConfig?.displayRule?.run {
if (adFreeDuration > 0) {
val ghInstalledDurationInHours = (System.currentTimeMillis() - PackageUtils.getInstalledTime(
HaloApp.getInstance(),
BuildConfig.APPLICATION_ID
)).toFloat() / 1000 / 3600
return ghInstalledDurationInHours < adFreeDuration
} else {
return false
}
}
return false
}
/**
* 是否大于开屏广告展示间隔时长
*/
private fun isMatchStartUpAdDisplayRule(): Boolean {
mSplashAd?.displayRule?.run {
if (adDisplayInterval > 0) {
val lastShowTime = SPUtils.getLong(Constants.SP_LAST_SPLASH_AD_SHOW_TIME, 0L)
val durationInMinutes = (System.currentTimeMillis() - lastShowTime).toFloat() / 1000 / 60
return durationInMinutes > adDisplayInterval
} else {
return true
}
}
return true
}
/**
* 是否大于广告管理展示间隔时长
*/
private fun isMatchDownloadManagerAdDisplayRule(): Boolean {
mDownloadManagerAd?.displayRule?.run {
if (adDisplayInterval > 0) {
val lastShowTime = SPUtils.getLong(Constants.SP_LAST_DOWNLOAD_MANAGER_AD_SHOW_TIME, 0L)
val durationInMinutes = (System.currentTimeMillis() - lastShowTime).toFloat() / 1000 / 60
return durationInMinutes > adDisplayInterval
} else {
return true
}
}
return true
}
/**
* 是否大于游戏搜索展示间隔时长
*/
private fun isMatchGameSearchAdDisplayRule(adConfig: AdConfig?): Boolean {
adConfig?.displayRule?.run {
if (adDisplayInterval > 0) {
val lastShowTime = SPUtils.getLong(Constants.SP_LAST_GAME_SEARCH_AD_SHOW_TIME + adConfig.position, 0L)
val durationInMinutes = (System.currentTimeMillis() - lastShowTime).toFloat() / 1000 / 60
return durationInMinutes > adDisplayInterval
} else {
return true
}
}
return true
}
/**
@ -197,49 +293,124 @@ object AdDelegateHelper {
sdkStartAdContainer: ViewGroup,
adsViewGroup: FrameLayout,
handler: BaseActivity.BaseHandler,
hideCallback: () -> Unit
isHotLaunch: Boolean,
hideAction: () -> Unit
) {
val hideCallback = {
isShowingSplashAd = false
hideAction.invoke()
}
if (mSplashAd != null) {
if (mSplashAd!!.displayRule.adSource == AD_TYPE_SDK) {
// 第三方开屏广告回调,失败时根据接口配置选项决定是否显示自有开屏广告
val sdkSplashCallback: (isSuccess: Boolean) -> Unit = { isSuccess ->
if (isSuccess) {
hideCallback.invoke()
} else {
if (mSplashAd?.displayRule?.onFailedAction == "show") {
sdkStartAdContainer.visibility = View.GONE
requestStandardSplashAd(mSplashAd!!.ownerAd, startAdContainer, handler, hideCallback)
} else {
hideCallback.invoke()
}
}
}
// 第三方广告的数据为空,按加载失败处理
if (mSplashAd?.thirdPartyAd == null) {
sdkSplashCallback.invoke(false)
return
}
if (mSplashAd?.thirdPartyAd?.sourceName == AD_SDK_BEIZI) {
sdkStartAdContainer.visibility = View.VISIBLE
requestBeiziSplashAd(sdkStartAdContainer, adsViewGroup, adViewWidthInPx, adViewHeightInPx, sdkSplashCallback)
} else if (mSplashAd?.thirdPartyAd?.sourceName == AD_SDK_CSJ) {
sdkStartAdContainer.visibility = View.VISIBLE
requestCsjSplashAd(
when (if (isHotLaunch) mSplashAd!!.displayRule.hotStartSplashAd?.type else mSplashAd!!.displayRule.adSource) {
AD_TYPE_SDK -> {
isShowingSplashAd = true
requestThirdPartySplashAd(
activity,
mSplashAd?.thirdPartyAd?.slotId ?: "unknown",
adViewWidthInPx,
adViewHeightInPx,
adViewWidthInDp,
adViewHeightInDp,
startAdContainer,
sdkStartAdContainer,
sdkSplashCallback
adsViewGroup,
handler,
isHotLaunch,
hideCallback
)
}
AD_TYPE_OWNER -> {
isShowingSplashAd = true
requestStandardSplashAd(
activity,
adViewWidthInPx,
adViewHeightInPx,
adViewWidthInDp,
adViewHeightInDp,
startAdContainer,
sdkStartAdContainer,
adsViewGroup,
handler,
isHotLaunch,
hideCallback
)
}
} else {
requestStandardSplashAd(mSplashAd!!.ownerAd, startAdContainer, handler, hideCallback)
}
} else {
hideCallback.invoke()
}
}
/**
* 获取第三方开屏广告
*/
private fun requestThirdPartySplashAd(
activity: Activity,
adViewWidthInPx: Int,
adViewHeightInPx: Int,
adViewWidthInDp: Float,
adViewHeightInDp: Float,
startAdContainer: ViewGroup,
sdkStartAdContainer: ViewGroup,
adsViewGroup: FrameLayout,
handler: BaseActivity.BaseHandler,
isHotLaunch: Boolean,
hideCallback: () -> Unit
) {
val timeout = if (isHotLaunch) {
((mSplashAd!!.displayRule.hotStartSplashAd?.timeout ?: 3.5F) * 1000).toInt()
} else {
(mSplashAd!!.displayRule.timeout * 1000).toInt()
}
// 第三方开屏广告回调,失败时根据接口配置选项决定是否显示自有开屏广告
val sdkSplashCallback: (isSuccess: Boolean) -> Unit = { isSuccess ->
if (isSuccess) {
hideCallback.invoke()
SPUtils.setLong(Constants.SP_LAST_SPLASH_AD_SHOW_TIME, System.currentTimeMillis())
} else {
if (mSplashAd?.displayRule?.adSource == AD_TYPE_SDK && mSplashAd?.displayRule?.onFailedAction == "show" && !isHotLaunch) {
sdkStartAdContainer.visibility = View.GONE
requestStandardSplashAd(
activity,
adViewWidthInPx,
adViewHeightInPx,
adViewWidthInDp,
adViewHeightInDp,
startAdContainer,
sdkStartAdContainer,
adsViewGroup,
handler,
isHotLaunch,
hideCallback
)
} else {
hideCallback.invoke()
}
}
}
// 第三方广告的数据为空,按加载失败处理
if (mSplashAd?.thirdPartyAd == null) {
sdkSplashCallback.invoke(false)
return
}
if (mSplashAd?.thirdPartyAd?.sourceName == AD_SDK_BEIZI) {
sdkStartAdContainer.visibility = View.VISIBLE
requestBeiziSplashAd(sdkStartAdContainer, adsViewGroup, adViewWidthInPx, adViewHeightInPx, timeout.toLong(), sdkSplashCallback)
} else if (mSplashAd?.thirdPartyAd?.sourceName == AD_SDK_CSJ) {
sdkStartAdContainer.visibility = View.VISIBLE
requestCsjSplashAd(
activity,
mSplashAd?.thirdPartyAd?.slotId ?: "unknown",
adViewWidthInPx,
adViewHeightInPx,
adViewWidthInDp,
adViewHeightInDp,
sdkStartAdContainer,
timeout,
sdkSplashCallback
)
}
}
@ -254,6 +425,7 @@ object AdDelegateHelper {
adViewWidthInDp: Float,
adViewHeightInDp: Float,
startAdContainer: ViewGroup,
timeout: Int,
callback: (isSuccess: Boolean) -> Unit,
) {
if (mCsjAdImpl == null) {
@ -267,6 +439,7 @@ object AdDelegateHelper {
adViewWidthInDp,
adViewHeightInDp,
startAdContainer,
timeout,
callback,
)
}
@ -280,12 +453,13 @@ object AdDelegateHelper {
adsFl: FrameLayout,
adViewWidthInPx: Int,
adViewHeightInPx: Int,
timeout: Long,
callback: (isSuccess: Boolean) -> Unit,
) {
if (mBeiziAdImpl == null) {
callback.invoke(false)
} else {
mBeiziAdImpl?.requestSplashAd(startAdContainer, adsFl, adViewWidthInPx, adViewHeightInPx, callback)
mBeiziAdImpl?.requestSplashAd(startAdContainer, adsFl, adViewWidthInPx, adViewHeightInPx, timeout, callback)
}
}
@ -293,13 +467,41 @@ object AdDelegateHelper {
* 显示自有的开屏广告
*/
private fun requestStandardSplashAd(
splashAd: StartupAdEntity?,
activity: Activity,
adViewWidthInPx: Int,
adViewHeightInPx: Int,
adViewWidthInDp: Float,
adViewHeightInDp: Float,
startAdContainer: ViewGroup,
sdkStartAdContainer: ViewGroup,
adsViewGroup: FrameLayout,
handler: BaseActivity.BaseHandler,
isHotLaunch: Boolean,
hideCallback: () -> Unit
) {
val splashAd = mSplashAd?.ownerAd?.startAd
val onEmptyCallback = {
if (mSplashAd?.displayRule?.adSource == AD_TYPE_OWNER && mSplashAd?.displayRule?.onFailedAction == "show" && mSplashAd?.thirdPartyAd != null) {
// 自有广告为空时,显示第三方广告
requestThirdPartySplashAd(
activity,
adViewWidthInPx,
adViewHeightInPx,
adViewWidthInDp,
adViewHeightInDp,
startAdContainer,
sdkStartAdContainer,
adsViewGroup,
handler,
isHotLaunch,
hideCallback
)
} else {
hideCallback.invoke()
}
}
if (splashAd == null) {
hideCallback.invoke()
onEmptyCallback.invoke()
return
}
@ -312,7 +514,7 @@ object AdDelegateHelper {
) {
showStandardSplashAd(splashAd, startAdContainer, handler, hideCallback)
} else {
hideCallback.invoke()
onEmptyCallback.invoke()
}
"everyday" -> {
@ -323,7 +525,7 @@ object AdDelegateHelper {
) {
showStandardSplashAd(splashAd, startAdContainer, handler, hideCallback)
} else {
hideCallback.invoke()
onEmptyCallback.invoke()
}
}
@ -344,7 +546,9 @@ object AdDelegateHelper {
val jumpBtn: View = startAdContainer.findViewById(R.id.jumpBtn)
val jumpDetailBtn: TextView = startAdContainer.findViewById(R.id.jumpDetailBtn)
val adImage: SimpleDraweeView = startAdContainer.findViewById(R.id.adImage)
val icpContainer: View? = startAdContainer.findViewById(R.id.startAdIcpContainer)
startAdContainer.visibility = View.VISIBLE
icpContainer?.visibility = View.VISIBLE
jumpDetailBtn.text = ad.desc
jumpDetailBtn.setDrawableEnd(
AppCompatResources.getDrawable(
@ -384,13 +588,14 @@ object AdDelegateHelper {
} else {
LogUtils.logStartAd("start_ads", ad)
}
SPUtils.setLong(Constants.SP_LAST_SPLASH_AD_SHOW_TIME, System.currentTimeMillis())
handler.sendEmptyMessageDelayed(MainActivity.COUNTDOWN_AD, 1000)
}
/**
* 获取信息流广告
* 获取第三方信息流广告
*/
fun requestFlowAd(
fun requestThirdPartyFlowAd(
fragment: Fragment,
slotId: String,
adContainerView: ViewGroup,
@ -401,9 +606,9 @@ object AdDelegateHelper {
}
/**
* 获取 Banner 广告
* 获取第三方 Banner 广告
*/
fun requestBannerAd(
fun requestThirdPartyBannerAd(
fragment: Fragment,
containerView: ViewGroup,
ad: AdConfig.ThirdPartyAd,

View File

@ -57,11 +57,16 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
private lateinit var mEditorFontItalic: CheckableImageView
private lateinit var mEditorFontStrikeThrough: CheckableImageView
private lateinit var mEditorFontUnderline: CheckableImageView
private lateinit var mEditorParagraphDivider: CheckableImageView
private lateinit var mEditorParagraphH1: CheckableImageView
private lateinit var mEditorParagraphH2: CheckableImageView
private lateinit var mEditorParagraphH3: CheckableImageView
private lateinit var mEditorParagraphH4: CheckableImageView
private lateinit var mEditorParagraphQuote: CheckableImageView
private lateinit var mEditorAlignLeft: CheckableImageView
private lateinit var mEditorAlignCenter: CheckableImageView
private lateinit var mEditorAlignRight: CheckableImageView
private lateinit var mEditorAlignContainer: View
private lateinit var mEditorFontContainer: View
private lateinit var mEditorParagraphContainer: View
private lateinit var mEditorLinkContainer: View
@ -97,6 +102,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
mRichEditor.insertCustomStyleLink(insertData)
}
}
INSERT_ARTICLE_CODE -> {
val article =
data?.getParcelableExtra<ArticleEntity>(ArticleEntity::class.java.simpleName)
@ -106,6 +112,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
mRichEditor.insertCustomStyleLink(insertData)
}
}
INSERT_GAME_CODE -> {
val game = data?.getParcelableExtra<GameEntity>(GameEntity::class.java.simpleName)
if (game != null) {
@ -114,6 +121,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
mRichEditor.insertCustomStyleLink(insertData)
}
}
INSERT_GAME_COLLECTION_CODE -> {
val gameCollectionEntity =
data?.getParcelableExtra<GamesCollectionEntity>(GamesCollectionEntity::class.java.simpleName)
@ -123,9 +131,11 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
mRichEditor.insertCustomStyleLink(insertData)
}
}
REQUEST_CODE_IMAGE -> {
if (data != null) mViewModel.uploadPic(data)
}
INSERT_MEDIA_VIDEO_CODE -> {
val localVideoList =
data?.getParcelableArrayListExtra<LocalVideoEntity>(LocalVideoEntity::class.java.name)
@ -135,12 +145,14 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
uploadVideo(localVideoList)
}
}
REQUEST_CODE_IMAGE_CROP -> {
val imagePath = data?.getStringExtra(CropImageActivity.RESULT_CLIP_PATH)
if (!imagePath.isNullOrEmpty()) {
mViewModel.uploadPoster(imagePath)
}
}
INSERT_VIDEO_CODE -> {
val videoEntity = data?.getParcelableExtra<MyVideoEntity>(MyVideoEntity::class.java.simpleName)
if (videoEntity != null) {
@ -194,7 +206,12 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
mEditorParagraphH2 = findViewById(R.id.editor_paragraph_h2)
mEditorParagraphH3 = findViewById(R.id.editor_paragraph_h3)
mEditorParagraphH4 = findViewById(R.id.editor_paragraph_h4)
mEditorParagraphDivider = findViewById(R.id.editor_paragraph_divider)
mEditorParagraphQuote = findViewById(R.id.editor_paragraph_quote)
mEditorAlignLeft = findViewById(R.id.editor_align_left)
mEditorAlignCenter = findViewById(R.id.editor_align_center)
mEditorAlignRight = findViewById(R.id.editor_align_right)
mEditorAlignContainer = findViewById(R.id.editor_align_container)
mEditorFontContainer = findViewById(R.id.editor_font_container)
mEditorParagraphContainer = findViewById(R.id.editor_paragraph_container)
mEditorLinkContainer = findViewById(R.id.editor_link_container)
@ -216,7 +233,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
mKeyboardHeightProvider = KeyboardHeightProvider(this)
mRichEditor.post { mKeyboardHeightProvider?.start() }
mRichEditor.enableForceDark(DarkModeUtils.isDarkModeOn(this))
mRichEditor.setEditorBackgroundColor(R.color.background_white.toColor(this))
mRichEditor.setEditorBackgroundColor(R.color.ui_surface.toColor(this))
mRichEditor.setEditorFontColor(if (mIsDarkModeOn) Color.parseColor("#C2C2C2") else Color.parseColor("#4A4A4A"))
// 防止个别手机在Js里无法获取粘贴内容
mRichEditor.addJavascriptInterface(OnPasteListener(), "onPasteListener")
@ -241,6 +258,13 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
mRichEditor.hasFocus()
} else false
}
mRichEditor.setOnDecorationChangeListener { _, types ->
mEditorAlignLeft.isChecked = types.contains(RichEditor.Type.JUSTIFYLEFT)
mEditorAlignCenter.isChecked = types.contains(RichEditor.Type.JUSTIFYCENTER)
mEditorAlignRight.isChecked = types.contains(RichEditor.Type.JUSTIFYRIGHT)
}
mOriginalCb.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
mOriginalTipsContainer.alpha = 0f
@ -325,6 +349,9 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
MtaHelper.onEvent(mtaEventName(), "文字样式", "文字样式-下滑线")
}
}
mEditorParagraphDivider.setOnClickListener {
mRichEditor.insertDivider()
}
mEditorParagraphH1.setOnClickListener {
if (mEditorParagraphH1.isChecked) {
mRichEditor.formatBlock()
@ -370,6 +397,27 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
}
mEditorParagraphQuote.isChecked = !mEditorParagraphQuote.isChecked
}
mEditorAlignLeft.setOnClickListener {
if (!mEditorAlignLeft.isChecked) {
mRichEditor.setAlignLeft()
MtaHelper.onEvent(mtaEventName(), "文本对齐选项", "文本对齐选项-靠左")
mEditorAlignLeft.isChecked = !mEditorAlignLeft.isChecked
}
}
mEditorAlignCenter.setOnClickListener {
if (!mEditorAlignCenter.isChecked) {
mRichEditor.setAlignCenter()
MtaHelper.onEvent(mtaEventName(), "文本对齐选项", "文本对齐选项-靠中")
mEditorAlignCenter.isChecked = !mEditorAlignCenter.isChecked
}
}
mEditorAlignRight.setOnClickListener {
if (!mEditorAlignRight.isChecked) {
mRichEditor.setAlignRight()
MtaHelper.onEvent(mtaEventName(), "文本对齐选项", "文本对齐选项-靠右")
mEditorAlignRight.isChecked = !mEditorAlignRight.isChecked
}
}
findViewById<View>(R.id.editor_link_answer).setOnClickListener {
MtaHelper.onEvent(mtaEventName(), "插入链接", "插入链接-回答")
startActivityForResult(
@ -449,25 +497,22 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
return
}
try {
PermissionHelper.checkStoragePermissionBeforeAction(this,
object : EmptyCallback {
override fun onCallback() {
val maxChooseCount = if (videoCount + 3 <= MAX_MEDIA_COUNT) 3 else MAX_MEDIA_COUNT - videoCount
startActivityForResult(
LocalMediaActivity.getIntent(
this@BaseRichEditorActivity,
LocalMediaActivity.ChooseType.VIDEO,
maxChooseCount,
if (mtaEventName() == "提问帖") "发提问帖" else "发帖子"
), INSERT_MEDIA_VIDEO_CODE
)
NewLogUtils.logChooseMedia(
"view_media",
if (mtaEventName() == "提问帖") "提问帖" else "帖子",
"视频"
)
}
})
PermissionHelper.checkStoragePermissionBeforeAction(this) {
val maxChooseCount = if (videoCount + 3 <= MAX_MEDIA_COUNT) 3 else MAX_MEDIA_COUNT - videoCount
startActivityForResult(
LocalMediaActivity.getIntent(
this@BaseRichEditorActivity,
LocalMediaActivity.ChooseType.VIDEO,
maxChooseCount,
if (mtaEventName() == "提问帖") "发提问帖" else "发帖子"
), INSERT_MEDIA_VIDEO_CODE
)
NewLogUtils.logChooseMedia(
"view_media",
if (mtaEventName() == "提问帖") "提问帖" else "帖子",
"视频"
)
}
} catch (e: Exception) {
toast(R.string.media_image_hint)
e.printStackTrace()
@ -482,18 +527,16 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
return
}
try {
PermissionHelper.checkStoragePermissionBeforeAction(this, object : EmptyCallback {
override fun onCallback() {
val maxChooseCount = if (imageCount + 10 <= MAX_IMAGE_COUNT) 10 else MAX_IMAGE_COUNT - imageCount
val intent = LocalMediaActivity.getIntent(
this@BaseRichEditorActivity,
LocalMediaActivity.ChooseType.IMAGE,
maxChooseCount,
if (mtaEventName() == "提问帖") "发提问帖" else "发帖子"
)
startActivityForResult(intent, REQUEST_CODE_IMAGE)
}
})
PermissionHelper.checkStoragePermissionBeforeAction(this) {
val maxChooseCount = if (imageCount + 10 <= MAX_IMAGE_COUNT) 10 else MAX_IMAGE_COUNT - imageCount
val intent = LocalMediaActivity.getIntent(
this@BaseRichEditorActivity,
LocalMediaActivity.ChooseType.IMAGE,
maxChooseCount,
if (mtaEventName() == "提问帖") "发提问帖" else "发帖子"
)
startActivityForResult(intent, REQUEST_CODE_IMAGE)
}
} catch (e: Exception) {
toast(R.string.media_image_hint)
e.printStackTrace()
@ -516,6 +559,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
mEditorFontContainer.visibility = if (mEditorFont.isChecked) View.VISIBLE else View.GONE
mEditorParagraphContainer.visibility =
if (mEditorFont.isChecked) View.VISIBLE else View.GONE
mEditorAlignContainer.visibility = if (mEditorFont.isChecked) View.VISIBLE else View.GONE
mEditorLinkContainer.visibility = View.GONE
mTagsContainer.visibility = View.GONE
mIsExtendedKeyboardShow = mEditorFont.isChecked
@ -537,6 +581,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
if (mEditorLink.isChecked) View.VISIBLE else View.GONE
mEditorLinkContainer.visibility = if (mEditorLink.isChecked) View.VISIBLE else View.GONE
mEditorFontContainer.visibility = View.GONE
mEditorAlignContainer.visibility = View.GONE
mEditorParagraphContainer.visibility = View.GONE
mTagsContainer.visibility = View.GONE
mIsExtendedKeyboardShow = mEditorLink.isChecked
@ -752,9 +797,9 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
override fun onDarkModeChanged() {
super.onDarkModeChanged()
updateStatusBarColor(R.color.background_white, R.color.background_white)
updateStatusBarColor(R.color.ui_surface, R.color.ui_surface)
mRichEditor.enableForceDark(DarkModeUtils.isDarkModeOn(this))
mRichEditor.setEditorBackgroundColor(R.color.background_white.toColor(this))
mRichEditor.setEditorBackgroundColor(R.color.ui_surface.toColor(this))
mRichEditor.setEditorFontColor(if (mIsDarkModeOn) Color.parseColor("#C2C2C2") else Color.parseColor("#4A4A4A"))
}
@ -776,7 +821,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
const val INSERT_VIDEO_CODE = 415
const val MAX_INPUT_TEXT_NUM = 10000
const val MAX_MEDIA_COUNT = 20
const val MAX_IMAGE_COUNT = 35
const val MAX_IMAGE_COUNT = 70
const val REQUEST_CODE_IMAGE = 120
const val INSERT_MEDIA_VIDEO_CODE = 121

View File

@ -28,6 +28,7 @@ import com.gh.gamecenter.retrofit.service.ApiService
import com.gh.gamecenter.video.upload.OnUploadListener
import com.gh.gamecenter.video.upload.UploadManager
import com.google.gson.JsonObject
import com.lightgame.download.FileUtils
import com.lightgame.utils.Utils
import com.zhihu.matisse.Matisse
import com.zhihu.matisse.internal.utils.PathUtils
@ -38,6 +39,10 @@ import okhttp3.ResponseBody
import retrofit2.HttpException
import java.io.File
import java.io.FileOutputStream
import java.util.*
import kotlin.collections.ArrayList
import kotlin.collections.HashMap
import kotlin.collections.LinkedHashMap
import kotlin.collections.set
// TODO: 移动到module_bbs模块
@ -124,8 +129,17 @@ abstract class BaseRichEditorViewModel(application: Application) : AndroidViewMo
}
val map = LinkedHashMap<String, String>()
for (key in imageUrlMap.keys) {
map[MD5Utils.getUrlMD5(key)] = FILE_HOST + key.decodeURI()
mapImages[TextUtils.htmlEncode(key).decodeURI()] = imageUrlMap[key] ?: ""
val localFileUri = FILE_HOST + key.decodeURI()
// 文件格式为 HEIC 时,使用经 OSS 转码的图片作为预览图片
if (FileUtils.getFileMimeType(getApplication(), key.decodeURI())?.lowercase(Locale.CHINA)?.contains("heic") == true) {
val transformedImgUrl = ImageUtils.getTransformedUrl(imageUrlMap[key], 5000) ?: ""
map[MD5Utils.getUrlMD5(key)] = transformedImgUrl
mapImages[transformedImgUrl.decodeURI()] = imageUrlMap[key] ?: ""
} else {
map[MD5Utils.getUrlMD5(key)] = localFileUri
mapImages[TextUtils.htmlEncode(key).decodeURI()] = imageUrlMap[key] ?: ""
}
}
chooseImagesUploadSuccess.value = map
}

View File

@ -4,11 +4,13 @@ import android.app.Activity
import android.app.Application
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.gh.ad.AdDelegateHelper
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
import com.gh.gamecenter.SplashAdActivity
import com.gh.gamecenter.SplashScreenActivity
import com.gh.gamecenter.authorization.AuthorizationActivity
import com.gh.gamecenter.common.base.GlobalActivityManager
@ -18,6 +20,8 @@ import com.halo.assistant.HaloApp
// TODO移动到对应的模块
class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
private var isFromBackgroundToForeground = false // 是否后台回到前台
private var activityCount = 0
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
// do nothing
@ -25,6 +29,19 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
override fun onActivityStarted(activity: Activity) {
GlobalActivityManager.currentActivity = activity
activityCount ++
if (activityCount == 1 && isFromBackgroundToForeground) {
if (AdDelegateHelper.shouldShowStartUpAd(true)
&& !HaloApp.getInstance().isSkippingThirdParty
&& activity !is SplashScreenActivity
&& activity !is SkipActivity
&& activity !is AuthorizationActivity
&& activity !is SplashAdActivity
) {
activity.startActivity(SplashAdActivity.getIntent(activity))
}
isFromBackgroundToForeground = false
}
}
override fun onActivityResumed(activity: Activity) {
@ -74,7 +91,8 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
}
override fun onActivityStopped(activity: Activity) {
// do nothing
activityCount --
isFromBackgroundToForeground = activityCount <= 0
}
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {

View File

@ -24,10 +24,12 @@ import com.gh.gamecenter.common.callback.BiCallback
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.entity.NotificationUgc
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.loghub.LoghubUtils
import com.gh.gamecenter.common.provider.IHelpAndFeedbackProvider
import com.gh.gamecenter.common.tracker.Tracker
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.utils.NewFlatLogUtils
import com.gh.gamecenter.common.view.dsbridge.CompletionHandler
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.runOnIoThread
@ -39,7 +41,6 @@ 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
@ -68,9 +69,14 @@ class DefaultJsApi(
val entrance: String = "",
private var mFragment: Fragment? = null,
private var mBbsId: String? = "",
private var mOriginUrl: String?= "",
private var mOriginUrl: String? = "",
private val mForumName: String? = ""
) {
companion object {
private const val SOURCE_ENTRANCE = "webView"
}
private var mLoginHandler: CompletionHandler<Any>? = null
private var mDownloadWatcher: DataWatcher? = null // 下载观察者
private var mDownloadUrlSet: HashSet<String>? = null // 下载的 url 集合
@ -229,7 +235,14 @@ class DefaultJsApi(
val context = CurrentActivityHolder.getCurrentActivity()
context?.startActivity(ImageViewerActivity.getIntent(context, imageEvent.imageList, imageEvent.position, "浏览器"))
context?.startActivity(
ImageViewerActivity.getIntent(
context,
imageEvent.imageList,
imageEvent.position,
"浏览器"
)
)
}
@JavascriptInterface
@ -278,11 +291,18 @@ class DefaultJsApi(
/**
* 打开论坛搜索页
* 如果用户是从 webView跳转到论坛搜索页则sourceEntrance为空
*/
@JavascriptInterface
fun openForumSearch(msg: Any) {
runOnUiThread {
DirectUtils.directToForumOrUserSearch(context, mBbsId ?: "", entrance.ifBlank { "内部网页" })
DirectUtils.directToForumOrUserSearch(
context,
mBbsId ?: "",
entrance.ifBlank { "内部网页" },
SOURCE_ENTRANCE,
mForumName ?: ""
)
}
}
@ -384,7 +404,7 @@ class DefaultJsApi(
@JavascriptInterface
fun showQaFeedbackDialog(msg: Any) {
val mHelpAndFeedbackHelp =
val mHelpAndFeedbackHelp =
ARouter.getInstance().build(RouteConsts.provider.helpAndFeedback).navigation() as? IHelpAndFeedbackProvider
mHelpAndFeedbackHelp?.showQaFeedbackDialogFragment(context as AppCompatActivity, msg.toString())
}
@ -530,13 +550,24 @@ class DefaultJsApi(
@JavascriptInterface
fun installDownloadedGame(event: Any) {
val url = event.toString()
val vUrl = VHelper.getVUrl(url)
val downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(url, null, false)
?: DownloadManager.getInstance().getDownloadEntitySnapshot(vUrl, null, false)
val downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(url, null)
?: DownloadManager.getInstance().getDownloadEntitySnapshot(url, null)
NewFlatLogUtils.logGameInstall(
gameId = downloadEntity?.gameId ?: "",
gameName = downloadEntity?.name ?: "",
trigger = "主动安装"
)
SensorsBridge.trackInstallGameClick(
gameId = downloadEntity?.gameId ?: "",
gameName = downloadEntity?.name ?: "",
action = "主动安装"
)
downloadEntity?.let {
PackageInstaller.install(context, it, showUnzipToast = false)
PackageInstaller.install(context, it, showUnzipToast = false, ignoreAsVGame = false)
}
}
@ -737,6 +768,7 @@ class DefaultJsApi(
var status: String = "" // DOWNLOADING, PAUSED, DOWNLOADED, ERROR, UNKNOWN
) {
companion object {
fun fromDownloadEntity(downloadEntity: DownloadEntity): SimpleDownloadEntity {
val status: String = when (downloadEntity.status) {
add,

View File

@ -350,7 +350,8 @@ object DefaultUrlHandler {
}
EntranceConsts.HOST_FORUM_DETAIL -> {
DirectUtils.directForumDetail(context, id, entrance)
val sectionId = uri.getQueryParameter("section_id") ?: ""
DirectUtils.directForumDetailSection(context, id, sectionId, entrance)
}
EntranceConsts.HOST_GAME_RATING_DETAIL -> {
@ -438,17 +439,17 @@ object DefaultUrlHandler {
directToFeedback(
context,
content,
null,
isQaFeedback,
qaContentId,
isPlugin = false,
isSmoothGame = false,
EntranceConsts.ENTRANCE_BROWSER
)
}
}
EntranceConsts.HOST_HELP_AND_FEEDBACK -> {
val position = uri.getQueryParameter("position") ?: ""
DirectUtils.directToHelpAndFeedback(context, position.toInt())
DirectUtils.directToHelpAndFeedback(context)
}
EntranceConsts.HOST_HELP_DETAIL -> {
@ -489,12 +490,13 @@ object DefaultUrlHandler {
val activityName = uri.getQueryParameter("activity_name") ?: ""
val gameId = uri.getQueryParameter("game_id") ?: ""
context.startActivity(
GameCollectionEditActivity.getIntent(
GameCollectionEditActivity.getCreateIntent(
context,
activityId,
activityName,
gameId,
entrance
entrance,
"其他"
)
)
}

View File

@ -1,22 +1,21 @@
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
class BrowserInstallHandler : ChainHandler() {
class BrowserInstallHandler : DownloadChainHandler() {
override fun handleRequest(context: Context, gameEntity: GameEntity) {
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
BrowserInstallHelper.showBrowserInstallHintDialog(
context,
gameEntity.isVGame() || gameEntity.isSplitXApk()
gameEntity,
asVGame || gameEntity.isSplitXApk()
) {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
getNext()?.handleRequest(context, gameEntity, asVGame)
} else {
processEndCallback?.invoke(null)
processEndCallback?.invoke(asVGame, null)
}
}
}

View File

@ -4,14 +4,14 @@ import android.content.Context
import com.gh.common.dialog.CertificationDialog
import com.gh.gamecenter.feature.entity.GameEntity
class CertificationHandler : ChainHandler() {
class CertificationHandler : DownloadChainHandler() {
override fun handleRequest(context: Context, gameEntity: GameEntity) {
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
CertificationDialog.showCertificationDialog(context, gameEntity) {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
getNext()?.handleRequest(context, gameEntity, asVGame)
} else {
processEndCallback?.invoke(null)
processEndCallback?.invoke(asVGame, null)
}
}
}

View File

@ -1,24 +0,0 @@
package com.gh.common.chain
import android.content.Context
import com.gh.gamecenter.feature.entity.GameEntity
abstract class ChainHandler {
private var next: ChainHandler? = null
var processEndCallback: ((Any?) -> Unit)? = null
fun setNext(next: ChainHandler?) {
this.next = next
}
fun getNext(): ChainHandler? {
return next
}
fun hasNext(): Boolean {
return next != null
}
abstract fun handleRequest(context: Context, gameEntity: GameEntity)
}

View File

@ -5,15 +5,15 @@ import com.gh.common.util.DialogUtils
import com.gh.gamecenter.common.utils.safelyGetInRelease
import com.gh.gamecenter.feature.entity.GameEntity
class CheckDownloadHandler : ChainHandler() {
class CheckDownloadHandler : DownloadChainHandler() {
override fun handleRequest(context: Context, gameEntity: GameEntity) {
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
val apk = gameEntity.getApk().safelyGetInRelease(0) ?: return
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name) { isSubscribe: Boolean ->
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name, gameEntity.categoryChinese) { isSubscribe: Boolean ->
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
getNext()?.handleRequest(context, gameEntity, asVGame)
} else {
processEndCallback?.invoke(isSubscribe)
processEndCallback?.invoke(asVGame, isSubscribe)
}
}

View File

@ -2,20 +2,23 @@ package com.gh.common.chain
import android.content.Context
import com.gh.gamecenter.common.utils.PermissionHelper
import com.gh.gamecenter.core.utils.EmptyCallback
import com.gh.gamecenter.feature.entity.GameEntity
class CheckStoragePermissionHandler : ChainHandler() {
class CheckStoragePermissionHandler : DownloadChainHandler() {
override fun handleRequest(context: Context, gameEntity: GameEntity) {
PermissionHelper.checkStoragePermissionBeforeAction(context, object : EmptyCallback {
override fun onCallback() {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
} else {
processEndCallback?.invoke(null)
}
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
PermissionHelper.checkStoragePermissionBeforeAction(
context,
gameEntity.id,
gameEntity.name ?: "",
gameEntity.categoryChinese,
gameEntity.getApk().firstOrNull()?.format,
) {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity, asVGame)
} else {
processEndCallback?.invoke(asVGame, null)
}
})
}
}
}

View File

@ -1,22 +1,22 @@
package com.gh.common.chain
class ChainBuilder {
class DownloadChainBuilder {
private val handlers: MutableList<ChainHandler> = ArrayList()
private val handlers: MutableList<DownloadChainHandler> = ArrayList()
private var processEndCallback: ((Any?) -> Unit)? = null
private var processEndCallback: ((asVGame: Boolean, Any?) -> Unit)? = null
fun setProcessEndCallback(callback: (Any?) -> Unit): ChainBuilder {
fun setProcessEndCallback(callback: (asVGame: Boolean, Any?) -> Unit): DownloadChainBuilder {
processEndCallback = callback
return this
}
fun addHandler(handler: ChainHandler): ChainBuilder {
fun addHandler(handler: DownloadChainHandler): DownloadChainBuilder {
handlers.add(handler)
return this
}
fun buildHandlerChain(): ChainHandler? {
fun buildHandlerChain(): DownloadChainHandler? {
for (i in handlers.indices) {
handlers[i].processEndCallback = processEndCallback
if (i + 1 < handlers.size) {

View File

@ -0,0 +1,40 @@
package com.gh.common.chain
import android.content.Context
import com.gh.gamecenter.feature.entity.GameEntity
abstract class DownloadChainHandler {
private var next: DownloadChainHandler? = null
// asVGame: 当前下载是否以畅玩游戏来进行
var processEndCallback: ((asVGame: Boolean, Any?) -> Unit)? = null
/**
* 设置下一个处理者
*/
fun setNext(next: DownloadChainHandler?) {
this.next = next
}
/**
* 获取下一个处理者
*/
fun getNext(): DownloadChainHandler? {
return next
}
/**
* 是否存在下一个处理者
*/
fun hasNext(): Boolean {
return next != null
}
/**
* 处理请求
* @param gameEntity 游戏实体
* @param asVGame 是否作为畅玩游戏进行
*/
abstract fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean)
}

View File

@ -3,21 +3,18 @@ package com.gh.common.chain
import android.content.Context
import com.gh.common.util.DownloadDialogHelper
import com.gh.gamecenter.common.utils.safelyGetInRelease
import com.gh.gamecenter.core.utils.EmptyCallback
import com.gh.gamecenter.feature.entity.GameEntity
class DownloadDialogHelperHandler : ChainHandler() {
class DownloadDialogHelperHandler : DownloadChainHandler() {
override fun handleRequest(context: Context, gameEntity: GameEntity) {
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
val apk = gameEntity.getApk().safelyGetInRelease(0) ?: return
DownloadDialogHelper.findAvailableDialogAndShow(context, gameEntity, apk, object : EmptyCallback {
override fun onCallback() {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
} else {
processEndCallback?.invoke(null)
}
DownloadDialogHelper.findAvailableDialogAndShow(context, gameEntity, apk) {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity, asVGame)
} else {
processEndCallback?.invoke(asVGame, null)
}
})
}
}
}

View File

@ -5,14 +5,14 @@ import androidx.appcompat.app.AppCompatActivity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.gamedetail.dialog.GamePermissionDialogFragment
class GamePermissionHandler : ChainHandler() {
class GamePermissionHandler : DownloadChainHandler() {
override fun handleRequest(context: Context, gameEntity: GameEntity) {
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
GamePermissionDialogFragment.show((context as AppCompatActivity), gameEntity, gameEntity.info) {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
getNext()?.handleRequest(context, gameEntity, asVGame)
} else {
processEndCallback?.invoke(null)
processEndCallback?.invoke(asVGame, null)
}
}
}

View File

@ -1,22 +1,31 @@
package com.gh.common.chain
import android.app.Activity
import android.content.Context
import com.gh.common.util.DialogUtils
import com.gh.common.util.DirectUtils
import com.gh.common.util.TempCertificationUtils
import com.gh.gamecenter.feature.entity.GameEntity
class LandPageAddressHandler : ChainHandler() {
class LandPageAddressHandler : DownloadChainHandler() {
override fun handleRequest(context: Context, gameEntity: GameEntity) {
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
if (gameEntity.isLandPageAddressDialog()) {
DialogUtils.showLandPageAddressDialog(context, gameEntity) {// 跳转第三方落地页
DirectUtils.directToExternalBrowser(context, gameEntity.landPageAddressDialog!!.link!!)
TempCertificationUtils.checkCertificationBeforeAction(gameEntity) {
if (context is Activity && context.isFinishing) {
// 当前 context 已经无效,不需要再传递执行下去了
return@checkCertificationBeforeAction
}
DialogUtils.showLandPageAddressDialog(context, gameEntity) {// 跳转第三方落地页
DirectUtils.directToExternalBrowser(context, gameEntity.landPageAddressDialog!!.link!!)
}
}
} else {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
getNext()?.handleRequest(context, gameEntity, asVGame)
} else {
processEndCallback?.invoke(null)
processEndCallback?.invoke(asVGame, null)
}
}
}

View File

@ -1,25 +1,34 @@
package com.gh.common.chain
import android.app.Activity
import android.content.Context
import com.gh.common.util.DialogUtils
import com.gh.common.util.TempCertificationUtils
import com.gh.gamecenter.feature.entity.GameEntity
class OverseaDownloadHandler : ChainHandler() {
class OverseaDownloadHandler : DownloadChainHandler() {
override fun handleRequest(context: Context, gameEntity: GameEntity) {
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
if (gameEntity.isOverseaAddressDialog()) {
DialogUtils.showOverseaDownloadDialog(context, gameEntity) {// 跳转海外下载地址弹窗
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
} else {
processEndCallback?.invoke(null)
TempCertificationUtils.checkCertificationBeforeAction(gameEntity) {
if (context is Activity && context.isFinishing) {
// 当前 context 已经无效,不需要再传递执行下去了
return@checkCertificationBeforeAction
}
DialogUtils.showOverseaDownloadDialog(context, gameEntity) {// 跳转海外下载地址弹窗
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity, asVGame)
} else {
processEndCallback?.invoke(asVGame, null)
}
}
}
} else {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
getNext()?.handleRequest(context, gameEntity, asVGame)
} else {
processEndCallback?.invoke(null)
processEndCallback?.invoke(asVGame, null)
}
}
}

View File

@ -5,14 +5,14 @@ import androidx.appcompat.app.AppCompatActivity
import com.gh.common.dialog.PackageCheckDialogFragment
import com.gh.gamecenter.feature.entity.GameEntity
class PackageCheckHandler : ChainHandler() {
class PackageCheckHandler : DownloadChainHandler() {
override fun handleRequest(context: Context, gameEntity: GameEntity) {
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
PackageCheckDialogFragment.show((context as AppCompatActivity), gameEntity) {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
getNext()?.handleRequest(context, gameEntity, asVGame)
} else {
processEndCallback?.invoke(null)
processEndCallback?.invoke(asVGame, null)
}
}
}

View File

@ -4,18 +4,20 @@ import android.content.Context
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.feature.entity.GameEntity
class UnsupportedFeatureHandler : ChainHandler() {
class UnsupportedFeatureHandler : DownloadChainHandler() {
override fun handleRequest(
context: Context, gameEntity: GameEntity
context: Context,
gameEntity: GameEntity,
asVGame: Boolean
) {
if (shouldShowUnsupportedFeatureDialog()) {
DialogHelper.showUnsupportedFeatureDialog(context)
} else {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
getNext()?.handleRequest(context, gameEntity, asVGame)
} else {
processEndCallback?.invoke(null)
processEndCallback?.invoke(asVGame, null)
}
}
}

View File

@ -5,31 +5,27 @@ import com.gh.common.simulator.NewSimulatorGameManager
import com.gh.common.simulator.SimulatorGameManager
import com.gh.gamecenter.feature.entity.GameEntity
class UpdateNewSimulatorHandler: ChainHandler() {
class UpdateNewSimulatorHandler: DownloadChainHandler() {
override fun handleRequest(context: Context, gameEntity: GameEntity) {
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
if (SimulatorGameManager.isSimulatorGame(gameEntity)) {
if (NewSimulatorGameManager.shouldShowUpdateNewSimulatorAlert(context)) {
NewSimulatorGameManager.showUpdateNewsSimulator(context) {
NewSimulatorGameManager.showUpdateNewsSimulator(context, gameEntity) {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
getNext()?.handleRequest(context, gameEntity, asVGame)
} else {
processEndCallback?.invoke(null)
processEndCallback?.invoke(asVGame, null)
}
}
}
else{
} else {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
getNext()?.handleRequest(context, gameEntity, asVGame)
}
}
}
else{
} else {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
getNext()?.handleRequest(context, gameEntity, asVGame)
}
}
}
}

View File

@ -4,15 +4,23 @@ import android.content.Context
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.vspace.VHelper
class ValidateVSpaceHandler : ChainHandler() {
class ValidateVSpaceHandler : DownloadChainHandler() {
override fun handleRequest(context: Context, gameEntity: GameEntity) {
VHelper.validateVSpaceBeforeAction(context, gameEntity) {
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
val closure = {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
getNext()?.handleRequest(context, gameEntity, asVGame)
} else {
processEndCallback?.invoke(null)
processEndCallback?.invoke(asVGame, null)
}
}
if (asVGame) {
VHelper.validateVSpaceBeforeAction(context, gameEntity) {
closure.invoke()
}
} else {
closure.invoke()
}
}
}

View File

@ -3,29 +3,59 @@ package com.gh.common.chain
import android.content.Context
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.common.utils.toResString
import com.gh.gamecenter.feature.entity.GameEntity
class VersionNumberHandler : ChainHandler() {
class VersionNumberHandler : DownloadChainHandler() {
override fun handleRequest(context: Context, gameEntity: GameEntity) {
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
val confirmCallback = {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
getNext()?.handleRequest(context, gameEntity, asVGame)
} else {
processEndCallback?.invoke(null)
processEndCallback?.invoke(asVGame, null)
}
}
if (!gameEntity.isShowVersionNumber()) {
confirmCallback.invoke()
} else {
SensorsBridge.trackGameDemoDialogShow(
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
DialogHelper.showGuideDialog(
context,
"温馨提示",
gameEntity.getVersionNumberString(),
"继续下载",
R.string.cancel.toResString(),
{ confirmCallback.invoke() },
{
confirmCallback.invoke()
SensorsBridge.trackGameDemoDialogClick(
buttonName = "继续下载",
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
},
cancelClickCallback = {
SensorsBridge.trackGameDemoDialogClick(
buttonName = R.string.cancel.toResString(),
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
},
touchOutsideCallback = {
SensorsBridge.trackGameDemoDialogClick(
buttonName = "关闭弹窗",
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
},
extraConfig = DialogHelper.Config(titleIcon = R.drawable.ic_dialog_tips)
)
}

View File

@ -29,6 +29,7 @@ import com.gh.gamecenter.entity.VSetting;
import com.gh.gamecenter.feature.entity.NewsEntity;
import com.gh.gamecenter.feature.entity.SettingsEntity;
import com.gh.gamecenter.feature.entity.SimulatorEntity;
import com.gh.gamecenter.feature.utils.ContentBlockedHelper;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.gh.vspace.VHelper;
import com.halo.assistant.HaloApp;
@ -460,6 +461,11 @@ public class Config {
DarkModeUtils.INSTANCE.initDarkMode();
}
SPUtils.setString(Constants.SP_NEW_API_SETTINGS, GsonUtils.toJson(data));
// 刷新屏蔽字段
if (mNewApiSettingsEntity.getGameShieldContents() != null) {
ContentBlockedHelper.INSTANCE.init(mNewApiSettingsEntity.getGameShieldContents());
}
}
});
}

View File

@ -13,14 +13,14 @@ import android.widget.PopupWindow
import androidx.core.content.ContextCompat
import androidx.databinding.BindingAdapter
import androidx.recyclerview.widget.LinearLayoutManager
import com.gh.gamecenter.R
import com.gh.gamecenter.common.callback.OnViewClickListener
import com.gh.gamecenter.common.databinding.LayoutPopupContainerBinding
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.view.BugFixedPopupWindow
import com.gh.gamecenter.R
import com.gh.gamecenter.databinding.KaifuAddItemBinding
import com.gh.gamecenter.databinding.LayoutAddKaifuPopupBinding
import com.gh.gamecenter.databinding.LayoutPopupContainerBinding
import com.gh.gamecenter.feature.entity.ServerCalendarEntity
import com.gh.gamecenter.servers.add.AddKaiFuPopupAdapter
import java.text.SimpleDateFormat
@ -120,13 +120,13 @@ object AddKaiFuBindingAdapter {
@BindingAdapter("kaiFuTextColor", "kaiFuTextPosition")
fun kaiFuTextColor(view: EditText, dataMark: Int, position: Int) {
if (dataMark == 1 && view.id == R.id.kaifu_add_time || dataMark == 2 && view.id == R.id.kaifu_add_first_name || dataMark == 3 && view.id == R.id.kaifu_add_server_name || dataMark == 4) {
view.setTextColor(ContextCompat.getColor(view.context, R.color.theme_red))
view.setHintTextColor(ContextCompat.getColor(view.context, R.color.theme_red))
view.setTextColor(ContextCompat.getColor(view.context, R.color.secondary_red))
view.setHintTextColor(ContextCompat.getColor(view.context, R.color.secondary_red))
} else if (position == 0) {
view.setTextColor(ContextCompat.getColor(view.context, R.color.hint))
view.setHintTextColor(ContextCompat.getColor(view.context, R.color.hint))
} else {
view.setTextColor(ContextCompat.getColor(view.context, R.color.text_title))
view.setTextColor(ContextCompat.getColor(view.context, R.color.text_primary))
view.setHintTextColor(ContextCompat.getColor(view.context, R.color.hint))
}
}

View File

@ -3,27 +3,21 @@ package com.gh.common.databind;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.common.chain.BrowserInstallHandler;
import com.gh.common.chain.CertificationHandler;
import com.gh.common.chain.ChainBuilder;
import com.gh.common.chain.ChainHandler;
import com.gh.common.chain.DownloadChainBuilder;
import com.gh.common.chain.DownloadChainHandler;
import com.gh.common.chain.CheckDownloadHandler;
import com.gh.common.chain.CheckStoragePermissionHandler;
import com.gh.common.chain.DownloadDialogHelperHandler;
@ -46,7 +40,6 @@ import com.gh.common.util.DialogUtils;
import com.gh.common.util.GameUtils;
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;
@ -57,24 +50,16 @@ import com.gh.download.server.BrowserInstallHelper;
import com.gh.gamecenter.DownloadManagerActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.WebActivity;
import com.gh.gamecenter.common.baselist.LoadStatus;
import com.gh.gamecenter.common.callback.OnViewClickListener;
import com.gh.gamecenter.common.entity.LinkEntity;
import com.gh.gamecenter.common.eventbus.EBReuse;
import com.gh.gamecenter.common.utils.DarkModeUtils;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.gamecenter.common.view.DrawableView;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.common.utils.NewFlatLogUtils;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.core.utils.MtaHelper;
import com.gh.gamecenter.core.utils.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;
import com.gh.gamecenter.feature.entity.GameEntity;
import com.gh.gamecenter.feature.entity.PluginLocation;
import com.gh.gamecenter.feature.entity.ServerCalendarEntity;
import com.gh.gamecenter.feature.entity.TagStyleEntity;
import com.gh.gamecenter.feature.entity.TestEntity;
import com.gh.gamecenter.feature.exposure.ExposureEvent;
@ -83,14 +68,11 @@ import com.gh.gamecenter.feature.view.DownloadButton;
import com.gh.gamecenter.feature.view.GameIconView;
import com.gh.gamecenter.gamedetail.dialog.GamePermissionDialogFragment;
import com.gh.gamecenter.manager.PackagesManager;
import com.gh.vspace.VDownloadManagerActivity;
import com.gh.vspace.VHelper;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.FileUtils;
import com.lightgame.utils.Utils;
import org.greenrobot.eventbus.EventBus;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
@ -98,134 +80,8 @@ import java.util.List;
/**
* Created by khy on 12/02/18.
*/
public class BindingAdapters {
public static void loadIcon(SimpleDraweeView view, String imageUrl) {
ImageUtils.displayIcon(view, imageUrl);
}
public static void loadImage(SimpleDraweeView view, String imageUrl) {
ImageUtils.display(view, imageUrl);
}
public static void setTextSize(TextView view, int number) {
view.setTextSize(number);
}
public static void setTypeface(TextView view, String type) {
if (type == null) return;
switch (type) {
case "bold":
view.setTypeface(null, Typeface.BOLD);
break;
case "italic":
view.setTypeface(null, Typeface.ITALIC);
break;
case "bold_italic":
view.setTypeface(null, Typeface.BOLD_ITALIC);
break;
default:
view.setTypeface(null, Typeface.NORMAL);
break;
}
}
public static void addDetailKaiFuView(LinearLayout view, List<ServerCalendarEntity> list
, OnViewClickListener listener, Boolean isReadyPatch) {
if (list == null) return;
view.removeAllViews();
for (int i = 0; i < list.size() + 1; i++) { // 1 is Title
View inflate = LayoutInflater.from(view.getContext()).inflate(R.layout.kaifu_detail_item_row, null);
KaifuDetailItemRowBinding binding = KaifuDetailItemRowBinding.bind(inflate);
binding.getRoot().setBackgroundColor(isReadyPatch != null && isReadyPatch ? ExtensionsKt.toColor(R.color.theme) : ExtensionsKt.toColor(R.color.white));
binding.getRoot().setPadding(DisplayUtils.dip2px(1), DisplayUtils.dip2px(1), DisplayUtils.dip2px(1), i == list.size() ? DisplayUtils.dip2px(1) : 0);
ServerCalendarEntity serverEntity = list.get(i - 1);
binding.timeTv.setText(i == 0 ? "时间" : serverEntity.getFormatTime("HH:mm"));
binding.remarkTv.setText(i == 0 ? "备注" : serverEntity.getRemark());
binding.nameTv.setText(i == 0 ? "名字" : (TextUtils.isEmpty(serverEntity.getNote()) ? "-" : serverEntity.getNote()));
if (i != 0) {
binding.getRoot().setOnClickListener(v -> {
listener.onClick(v, isReadyPatch != null && isReadyPatch ? serverEntity : null);
});
// 滑动冲突处理
binding.getRoot().setOnTouchListener((v, event) -> {
if (list.size() > 5) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
EventBus.getDefault().post(new EBReuse("CalenderDown"));
} else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
EventBus.getDefault().post(new EBReuse("CalenderCancel"));
}
}
return false;
});
}
view.addView(inflate);
}
}
// 如果超过10000则转换为1.0W
public static void transSimpleCount(TextView view, int count) {
view.setText(NumberUtils.transSimpleCount(count));
}
public static void textColorFromString(TextView tv, String hexString) {
if (TextUtils.isEmpty(hexString)) return;
try {
tv.setTextColor(Color.parseColor(hexString));
} catch (Exception e) {
e.printStackTrace();
}
}
public static void showHide(View view, Boolean show) {
if (show != null && show) {
view.setVisibility(View.VISIBLE);
} else {
view.setVisibility(View.GONE);
}
}
public static void goneIf(View view, Boolean gone) {
if (gone != null && gone) {
view.setVisibility(View.GONE);
} else {
view.setVisibility(View.VISIBLE);
}
}
/**
* lazy 的 paddingTop
*/
public static void lazyPaddingLeft(View view, int paddingLeftInDp) {
view.setPadding(DisplayUtils.dip2px(paddingLeftInDp), view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom());
}
/**
* lazy 的 paddingTop
*/
public static void lazyPaddingTop(View view, int paddingTopInDp) {
view.setPadding(view.getPaddingLeft(), DisplayUtils.dip2px(paddingTopInDp), view.getPaddingRight(), view.getPaddingBottom());
}
/**
* lazy 的 paddingBottom
*/
public static void lazyPaddingBottom(View view, int paddingBottomInDp) {
view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), DisplayUtils.dip2px(paddingBottomInDp));
}
public static void visibleInvisible(View view, Boolean show) {
if (show != null && show) {
view.setVisibility(View.VISIBLE);
} else {
view.setVisibility(View.INVISIBLE);
}
}
public static void setMessageUnread(TextView view, int unreadCount) {
if (unreadCount < 100) {
view.setText(String.valueOf(unreadCount));
@ -234,119 +90,12 @@ public class BindingAdapters {
}
}
public static void setServerTypePadding(TextView view, String serverType) {
int paddRight = 0;
if (TextUtils.isEmpty(serverType)) {
} else {
if ("删档内测".equals(serverType) || "不删档内测".equals(serverType)) {
if ("删档内测".equals(serverType)) {
paddRight = DisplayUtils.dip2px(view.getContext(), 50);
} else {
paddRight = DisplayUtils.dip2px(view.getContext(), 60);
}
} else {
paddRight = DisplayUtils.dip2px(view.getContext(), 30);
}
}
view.setPadding(0, 0, paddRight, 0);
}
public static void setServerType(TextView view, String serverType) {
view.setText(serverType);
if ("删档内测".equals(serverType) || "不删档内测".equals(serverType)) {
view.setBackgroundResource(R.drawable.textview_server_tag);
} else {
view.setBackgroundResource(R.drawable.textview_orange_up);
}
}
public static void setGame(View view, GameEntity gameEntity) {
if (gameEntity != null && view instanceof GameIconView) {
((GameIconView) view).displayGameIcon(gameEntity);
}
}
public static void setGameIcon(View view, GameEntity gameEntity) {
if (gameEntity != null && view instanceof GameIconView) {
((GameIconView) view).displayGameIcon(gameEntity.getIcon(), gameEntity.getIconSubscript(), gameEntity.getIconFloat());
}
}
public static void setArticleType(TextView view, String articleType) {
NewsUtils.setNewsType(view, articleType, 0, 0);
}
public static void setDetailDownloadText(TextView view, GameEntity gameEntity) {
if (gameEntity == null || gameEntity.getApk().isEmpty()) {
view.setBackgroundResource(R.drawable.game_item_btn_pause_style);
view.setTextColor(0xFF999999);
view.setClickable(false);
}
}
public static void setLiBaoBtn(TextView view, String status) {
if (TextUtils.isEmpty(status)) return;
switch (status) {
case "coming":
view.setText(R.string.libao_coming);
view.setBackgroundResource(R.drawable.textview_blue_style);
break;
case "ling":
view.setText(R.string.libao_ling);
view.setBackgroundResource(R.drawable.textview_green_style);
break;
case "tao":
view.setText(R.string.libao_tao);
view.setBackgroundResource(R.drawable.textview_orange_style);
break;
case "used_up":
view.setText(R.string.libao_used_up);
view.setBackgroundResource(R.drawable.textview_cancel_up);
break;
case "finish":
view.setText(R.string.libao_finish);
view.setBackgroundResource(R.drawable.textview_cancel_up);
break;
case "linged":
view.setText(R.string.libao_linged);
view.setBackgroundResource(R.drawable.libao_linged_style);
view.setTextColor(ContextCompat.getColorStateList(view.getContext(), R.color.libao_linged_selector));
break;
case "taoed":
view.setText(R.string.libao_taoed);
view.setBackgroundResource(R.drawable.libao_taoed_style);
view.setTextColor(ContextCompat.getColorStateList(view.getContext(), R.color.libao_taoed_selector));
break;
case "copy":
view.setText(R.string.libao_copy);
view.setBackgroundResource(R.drawable.textview_blue_style);
break;
case "repeatLing":
view.setText(R.string.libao_repeat_ling);
view.setBackgroundResource(R.drawable.textview_cancel_up);
break;
case "repeatLinged":
view.setText(R.string.libao_repeat_ling);
view.setBackgroundResource(R.drawable.textview_green_style);
break;
case "repeatTao":
view.setText(R.string.libao_repeat_tao);
view.setBackgroundResource(R.drawable.textview_cancel_up);
break;
case "repeatTaoed":
view.setText(R.string.libao_repeat_tao);
view.setBackgroundResource(R.drawable.textview_orange_style);
break;
case "unshelve":
view.setBackgroundResource(R.drawable.textview_cancel_style);
view.setText(R.string.libao_unshelve);
break;
default:
view.setBackgroundResource(R.drawable.textview_cancel_style);
view.setText("异常");
}
}
// 大图下的进度条
public static void setDownloadButton(DownloadButton progressBar,
GameEntity gameEntity,
@ -374,13 +123,9 @@ public class BindingAdapters {
switch (progressBar.getButtonStyle()) {
case DOWNLOADING_PLUGIN:
case DOWNLOADING_NORMAL:
if (gameEntity.isVGame()) {
v.getContext().startActivity(VDownloadManagerActivity.getIntent(v.getContext(), true));
} else {
Intent intent = DownloadManagerActivity.getDownloadMangerIntent(v.getContext(),
gameEntity.getApk().get(0).getUrl(), entrance);
v.getContext().startActivity(intent);
}
Intent intent = DownloadManagerActivity.getDownloadMangerIntent(v.getContext(),
gameEntity.getApk().get(0).getUrl(), entrance);
v.getContext().startActivity(intent);
break;
case NONE:
Utils.toast(v.getContext(), "该游戏已关闭下载");
@ -398,12 +143,12 @@ public class BindingAdapters {
boolean isInstalled = PackageUtils.isInstalledFromAllPackage(v.getContext(), gameEntity.getSimulator().getApk().getPackageName());
if (downloadEntity != null && SimulatorGameManager.isSimulatorGame(gameEntity) && !isInstalled) {
SimulatorDownloadManager.getInstance().showDownloadDialog(v.getContext(), gameEntity.getSimulator(),
SimulatorDownloadManager.SimulatorLocation.LAUNCH, gameEntity.getId(), gameEntity.getName(), null);
SimulatorDownloadManager.SimulatorLocation.LAUNCH, gameEntity.getId(), gameEntity.getName(), gameEntity.getCategoryChinese(), null);
return;
}
}
ChainBuilder builder = new ChainBuilder();
DownloadChainBuilder builder = new DownloadChainBuilder();
builder.addHandler(new UnsupportedFeatureHandler());
builder.addHandler(new GamePermissionHandler());
builder.addHandler(new CheckStoragePermissionHandler());
@ -417,22 +162,33 @@ public class BindingAdapters {
builder.addHandler(new OverseaDownloadHandler());
builder.addHandler(new CheckDownloadHandler());
builder.setProcessEndCallback(o -> {
download(v.getContext(), progressBar, gameEntity, traceEvent, (boolean) o, entrance, location);
builder.setProcessEndCallback((asVGame, isSubscribe) -> {
download(v.getContext(),
progressBar,
gameEntity,
traceEvent,
asVGame,
(boolean) isSubscribe,
entrance,
location);
return null;
});
final ChainHandler chainHandler = builder.buildHandlerChain();
final DownloadChainHandler chainHandler = builder.buildHandlerChain();
if (chainHandler != null) {
chainHandler.handleRequest(v.getContext(), gameEntity);
chainHandler.handleRequest(
v.getContext(),
gameEntity,
GameUtils.shouldPerformAsVGame(gameEntity)
);
}
} else {
ChainBuilder builder = new ChainBuilder();
DownloadChainBuilder builder = new DownloadChainBuilder();
builder.addHandler(new UnsupportedFeatureHandler());
builder.addHandler(new GamePermissionHandler());
builder.addHandler(new CertificationHandler());
builder.addHandler(new VersionNumberHandler());
builder.setProcessEndCallback(o -> {
builder.setProcessEndCallback((asVGame, isSubscribe) -> {
DownloadDialog.showDownloadDialog(
v.getContext(),
gameEntity,
@ -441,9 +197,13 @@ public class BindingAdapters {
location + ":" + gameEntity.getName());
return null;
});
final ChainHandler chainHandler = builder.buildHandlerChain();
final DownloadChainHandler chainHandler = builder.buildHandlerChain();
if (chainHandler != null) {
chainHandler.handleRequest(v.getContext(), gameEntity);
chainHandler.handleRequest(
v.getContext(),
gameEntity,
GameUtils.shouldPerformAsVGame(gameEntity)
);
}
}
}
@ -456,7 +216,14 @@ public class BindingAdapters {
if (downloadEntity != null) {
File file = new File(downloadEntity.getPath());
if (!file.exists()) {
download(v.getContext(), progressBar, gameEntity, traceEvent, false, entrance, location);
download(v.getContext(),
progressBar,
gameEntity,
traceEvent,
false,
false,
entrance,
location);
return;
}
@ -465,12 +232,7 @@ public class BindingAdapters {
return;
}
if (gameEntity.isVGame()) {
VHelper.installOrLaunch((AppCompatActivity) v.getContext(), gameEntity, null);
return;
}
PackageLauncher.launchApp(v.getContext(), gameEntity, gameEntity.getApk().get(0).getPackageName());
PackageLauncher.launch(v.getContext(), gameEntity, null);
} else {
DownloadDialog.showDownloadDialog(
v.getContext(),
@ -483,15 +245,27 @@ public class BindingAdapters {
case INSTALL_PLUGIN:
case INSTALL_NORMAL:
if (gameEntity.getApk().size() == 1) {
NewFlatLogUtils.INSTANCE.logGameInstall(
gameEntity.getId(),
gameEntity.getName() != null ? gameEntity.getName() : "",
"主动安装"
);
SensorsBridge.trackInstallGameClick(
gameEntity.getId(),
gameEntity.getName() != null ? gameEntity.getName() : "",
"主动安装"
);
DownloadEntity downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity);
if (gameEntity.isVGame()) {
VHelper.installOrLaunch(v.getContext(), gameEntity, null);
return;
}
if (downloadEntity != null) {
PackageInstaller.install(v.getContext(), downloadEntity);
if (ExtensionsKt.isLocalDownloadInDualDownloadMode(downloadEntity)) {
PackageInstaller.install(v.getContext(), downloadEntity);
} else {
VHelper.installOrLaunch(v.getContext(), gameEntity, null);
}
}
}
break;
@ -577,7 +351,7 @@ public class BindingAdapters {
}
} else {
String status = GameUtils.getDownloadBtnText(progressBar.getContext(), gameEntity, PluginLocation.only_game);
String status = GameUtils.getDownloadBtnText(progressBar.getContext(), gameEntity, true, false, PluginLocation.only_game);
switch (status) {
case "插件化":
progressBar.setButtonStyle(DownloadButton.ButtonStyle.PLUGIN);
@ -649,24 +423,6 @@ public class BindingAdapters {
}
}
/*private static void download(DownloadProgressBar progressBar, GameEntity gameEntity, ExposureEvent traceEvent, @Nullable String entrance, @Nullable String location, View v) {
if (gameEntity.getApk().size() == 1) {
ApkEntity apk = gameEntity.getApk().get(0);
DownloadDialogHelper.findAvailableDialogAndShow(
v.getContext(),
gameEntity,
apk,
() -> {
DialogUtils.checkDownload(v.getContext(), apk.getSize(),
isSubscribe -> download(progressBar, gameEntity, traceEvent, isSubscribe, entrance, location));
});
} else {
DownloadDialog.getInstance(v.getContext()).showPopupWindow(v, gameEntity,
entrance, location + gameEntity.getName(), traceEvent);
}
}*/
private static void updateReservation(DownloadButton progressBar, GameEntity gameEntity) {
// 显示预约
if (gameEntity.isReservable()) {
@ -686,45 +442,35 @@ public class BindingAdapters {
DownloadButton progressBar,
GameEntity gameEntity,
ExposureEvent traceEvent,
boolean asVGame,
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("更新")) {
method = "更新";
} else if (str.contains("插件化")) {
method = "插件化";
} else {
method = progressBar.getContext().getString(R.string.download);
}
String buttonText = progressBar.getText();
ApkEntity apkEntity = gameEntity.getApk().get(0);
String msg = FileUtils.isCanDownload(progressBar.getContext(), apkEntity.getSize());
if (TextUtils.isEmpty(msg)) {
DownloadManager.createDownload(progressBar.getContext(),
apkEntity,
gameEntity,
method,
asVGame,
gameEntity.isDualBtnModeEnabled(),
entrance,
location + gameEntity.getName(),
isSubscribe,
traceEvent);
progressBar.setProgress(0);
progressBar.setButtonStyle("插件化".equals(method) ?
progressBar.setButtonStyle(buttonText.contains("插件化") ?
DownloadButton.ButtonStyle.DOWNLOADING_PLUGIN : DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
} else {
Utils.toast(progressBar.getContext(), msg);
}
}
public static void setGameLabelList(LinearLayout layout, List<TagStyleEntity> tagStyle) {
GameViewUtils.setLabelList(layout.getContext(), layout, tagStyle);
}
// 包含测试开服标签
public static void setGameTags(LinearLayout layout, GameEntity gameEntity) {
try {
@ -794,12 +540,6 @@ public class BindingAdapters {
}
}
public static void isRefreshing(SwipeRefreshLayout layout, LoadStatus status) {
if (status != LoadStatus.INIT_LOADING && status != LoadStatus.LIST_LOADING) {
layout.setRefreshing(false);
}
}
public static void setGameName(TextView view, GameEntity game, boolean isShowPlatform, @Nullable Boolean isShowSuffix) {
if (isShowSuffix == null) isShowSuffix = true; // 默认显示
String gameName;
@ -821,30 +561,6 @@ public class BindingAdapters {
}
public static void setCommunityImage(SimpleDraweeView imageView, List<String> images, List<CommunityVideoEntity> videos) {
if (videos.size() > 0) {
CommunityVideoEntity videoEntity = videos.get(0);
ImageUtils.display(imageView, videoEntity.getPoster());
imageView.setVisibility(View.VISIBLE);
} else if (images.size() > 0) {
imageView.setVisibility(View.VISIBLE);
ImageUtils.display(imageView, images.get(0));
} else {
imageView.setVisibility(View.GONE);
}
}
public static void setCommunityVideoDuration(TextView mVideoDuration, List<CommunityVideoEntity> videos) {
if (videos != null && videos.size() > 0) {
CommunityVideoEntity videoEntity = videos.get(0);
mVideoDuration.setBackground(DrawableView.getOvalDrawable(R.color.black_alpha_50, 999F));
mVideoDuration.setText(videoEntity.getDuration());
mVideoDuration.setVisibility(View.VISIBLE);
} else {
mVideoDuration.setVisibility(View.GONE);
}
}
public static void setGameTags(TextView view, List<TagStyleEntity> tags, int maxTags) {
if (tags == null) {
view.setText("");
@ -872,16 +588,4 @@ public class BindingAdapters {
}
view.setText(span);
}
public static void setVideoData(TextView view, int count) {
if (count > 0) {
ExtensionsKt.setDrawableStart(view, ContextCompat.getDrawable(view.getContext(), R.drawable.ic_video_data_up), null, null);
view.setTextColor(ContextCompat.getColor(view.getContext(), R.color.text_EA3333));
view.setText(count + "");
} else {
ExtensionsKt.removeDrawable(view);
view.setTextColor(ContextCompat.getColor(view.getContext(), R.color.text_subtitleDesc));
view.setText("-");
}
}
}

View File

@ -49,7 +49,7 @@ class ApplyModeratorDialogFragment : BaseDialogFragment() {
requireContext(),
startText.length,
startText.length + mGroupNumber.length,
R.color.theme_font,
R.color.text_theme,
true
) {
DirectUtils.directToQqGroup(

View File

@ -60,7 +60,7 @@ class GameOffServiceDialogFragment : BaseDialogFragment() {
if (index == notEmptySite.size - 1) bottomMargin = 8F.dip2px()
}
siteTv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14F)
siteTv.setTextColor(R.color.theme_font.toColor(requireContext()))
siteTv.setTextColor(R.color.text_theme.toColor(requireContext()))
siteTv.text = site.text
siteTv.paintFlags = siteTv.paintFlags or Paint.UNDERLINE_TEXT_FLAG
siteTv.setOnClickListener {

View File

@ -1,6 +1,7 @@
package com.gh.common.dialog
import android.app.Activity.RESULT_OK
import android.content.DialogInterface
import android.content.Intent
import android.os.Build
import android.os.Bundle
@ -18,13 +19,10 @@ import com.gh.common.xapk.XapkInstaller
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.PermissionHelper
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.utils.PermissionHelper.INSTALL_PERMISSION_CODE
import com.gh.gamecenter.common.utils.getExtension
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.core.utils.SPUtils
import com.lightgame.download.DownloadEntity
import com.lightgame.utils.Utils
import kotlin.random.Random
class InstallPermissionDialogFragment : BaseDialogFragment() {
@ -34,8 +32,11 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
var url: String = ""
var gameId: String = ""
var gameName: String = ""
var gameType: String = ""
var mCallBack: ((isFromPermissionGrantedCallback: Boolean) -> Unit)? = null
private var dismissByTouchInside = false
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
mView = inflater.inflate(R.layout.dialog_install_permission, null, false)
return mView
@ -55,6 +56,12 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
if (isXapk) NewFlatLogUtils.logXApkInstallPermissionDialogShowed(gameId, gameName)
SensorsBridge.trackInstallPermissionDialogShow(
gameId = gameId,
gameName = gameName,
gameType = gameType
)
val randomNumber = if (isXapk) 1 else Random.nextInt(2)
closeTv.goneIf(randomNumber == 0)
closeIv.goneIf(randomNumber != 0)
@ -64,18 +71,38 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
}
closeTv.setOnClickListener {
dismissByTouchInside = true
if (isXapk) {
NewFlatLogUtils.logXApkInstallPermissionDialogClick("尝试解压", false, gameId, gameName)
mCallBack?.invoke(false)
}
SensorsBridge.trackInstallPermissionDialogClick(
buttonName = "尝试解压",
gameId = gameId,
gameName = gameName,
gameType = gameType
)
dismiss()
}
closeIv.setOnClickListener {
dismissByTouchInside = true
if (isXapk) NewFlatLogUtils.logXApkInstallPermissionDialogClick("关闭", false, gameId, gameName)
SensorsBridge.trackInstallPermissionDialogClick(
buttonName = "关闭",
gameId = gameId,
gameName = gameName,
gameType = gameType
)
dismiss()
}
activateTv.setOnClickListener {
NewFlatLogUtils.logXApkInstallPermissionDialogClick("立即开启", false, gameId, gameName)
SensorsBridge.trackInstallPermissionDialogClick(
buttonName = "立即开启",
gameId = gameId,
gameName = gameName,
gameType = gameType
)
PermissionHelper.toInstallPermissionSetting(requireActivity())
if (isXapk) {
SPUtils.setString(Constants.SP_XAPK_UNZIP_ACTIVITY, requireActivity().javaClass.name)
@ -84,9 +111,23 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
}
}
override fun onDismiss(dialog: DialogInterface) {
if (!dismissByTouchInside) {
SensorsBridge.trackInstallPermissionDialogClick(
buttonName = "关闭弹窗",
gameId = gameId,
gameName = gameName,
gameType = gameType
)
}
super.onDismiss(dialog)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == RESULT_OK && requestCode == INSTALL_PERMISSION_CODE) {
dismissByTouchInside = true
NewFlatLogUtils.logXApkInstallPermissionDialogClick("立即开启", true, gameId, gameName)
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
@ -136,6 +177,7 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
installPermissionDialogFragment.url = downloadEntity.url
installPermissionDialogFragment.gameId = downloadEntity.gameId
installPermissionDialogFragment.gameName = downloadEntity.name
installPermissionDialogFragment.gameType = downloadEntity.categoryChinese
val transaction: FragmentTransaction = activity.supportFragmentManager.beginTransaction()
transaction.show(installPermissionDialogFragment)
transaction.commit()
@ -146,6 +188,7 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
this.url = downloadEntity.url
this.gameId = downloadEntity.gameId
this.gameName = downloadEntity.name
this.gameType = downloadEntity.categoryChinese
}
installPermissionDialogFragment.show(
activity.supportFragmentManager,

View File

@ -76,7 +76,7 @@ class NewPrivacyPolicyDialogFragment : BaseDialogFragment() {
contentText.setSpan(object : ClickableSpan() {
override fun updateDrawState(ds: TextPaint) {
super.updateDrawState(ds)
ds.color = ContextCompat.getColor(requireContext(), R.color.theme_font)
ds.color = ContextCompat.getColor(requireContext(), R.color.text_theme)
ds.isUnderlineText = false
}

View File

@ -2,6 +2,7 @@ package com.gh.common.dialog
import android.animation.ValueAnimator
import android.content.Context
import android.content.DialogInterface
import android.content.pm.PackageInfo
import android.os.Bundle
import android.view.LayoutInflater
@ -11,6 +12,7 @@ import android.view.animation.LinearInterpolator
import android.widget.LinearLayout
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import androidx.fragment.app.FragmentTransaction
import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
@ -61,6 +63,8 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
var gameEntity: GameEntity? = null
var callBack: ConfirmListener? = null
private var mDismissByTouchInside = false
private val dataWatcher = object : DataWatcher() {
override fun onDataChanged(downloadEntity: DownloadEntity) {
val packageName = downloadEntity.packageName
@ -90,6 +94,11 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
EventBus.getDefault().register(this)
gameEntity?.let {
LogUtils.uploadPackageCheck("pkg_check_pop_click", "出现弹窗", it, "", "", "", "")
SensorsBridge.trackPkgCheckDialogShow(
gameId = it.id,
gameName = it.name ?: "",
gameType = it.categoryChinese
)
}
}
@ -116,7 +125,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
requireContext(),
0,
(link.title ?: "").length,
R.color.theme_font,
R.color.text_theme,
true
) {
LogUtils.uploadPackageCheck(
@ -128,6 +137,18 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
"",
""
)
SensorsBridge.trackPkgCheckDialogClick(
buttonName = "点击链接",
gameId = gameEntity?.id ?: "",
gameName = gameEntity?.name ?: "",
gameType = gameEntity?.categoryChinese ?: "",
isNotPrompt = if (binding.noRemindAgainCb.isVisible) {
binding.noRemindAgainCb.isChecked
} else null,
linkId = link.link ?: "",
linkType = link.type ?: "",
linkText = link.linkText ?: ""
)
DirectUtils.directToLinkPage(requireContext(), link, "包名检测弹窗", "")
}.build()
spanBuilder.append(linkSpan)
@ -176,6 +197,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
}
val isAllPackageInstalled = isAllPackageInstalled(mAllInstalledPackages, entity)
if (isAllPackageInstalled) {
mDismissByTouchInside = true
callBack?.onConfirm()
dismissAllowingStateLoss()
} else {
@ -193,6 +215,15 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
"",
""
)
SensorsBridge.trackPkgCheckDialogClick(
buttonName = "点击前往下载",
gameId = gameEntity?.id ?: "",
gameName = gameEntity?.name ?: "",
gameType = gameEntity?.categoryChinese ?: "",
isNotPrompt = if (binding.noRemindAgainCb.isVisible) {
binding.noRemindAgainCb.isChecked
} else null
)
DirectUtils.directToLinkPage(requireContext(), packageLink, "包名检测弹窗", "")
}
}
@ -206,6 +237,19 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
saveRecord(entity)
LogUtils.uploadPackageCheck("pkg_check_pop_click", "不再提示", gameEntity, "", "", "", "")
}
mDismissByTouchInside = true
SensorsBridge.trackPkgCheckDialogClick(
buttonName = binding.cancelTv.text.toString(),
gameId = gameEntity?.id ?: "",
gameName = gameEntity?.name ?: "",
gameType = gameEntity?.categoryChinese ?: "",
isNotPrompt = if (binding.noRemindAgainCb.isVisible) {
binding.noRemindAgainCb.isChecked
} else null
)
dismissAllowingStateLoss()
}
}
@ -300,6 +344,21 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
DownloadManager.getInstance().removeObserver(dataWatcher)
}
override fun onDismiss(dialog: DialogInterface) {
if (!mDismissByTouchInside) {
SensorsBridge.trackPkgCheckDialogClick(
buttonName = "关闭弹窗",
gameId = gameEntity?.id ?: "",
gameName = gameEntity?.name ?: "",
gameType = gameEntity?.categoryChinese ?: "",
isNotPrompt = if (binding.noRemindAgainCb.isVisible) {
binding.noRemindAgainCb.isChecked
} else null
)
}
super.onDismiss(dialog)
}
//安装、卸载事件
@Subscribe(threadMode = ThreadMode.MAIN)
fun onEventMainThread(busFour: EBPackage) {
@ -332,10 +391,10 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
val isAllInstalled = checkDetectionsInstalled(mAllInstalledPackages, entity.packages)
if (isAllInstalled) {
holder.binding.statusTv.text = "已安装"
holder.binding.statusTv.setTextColor(ContextCompat.getColor(context, R.color.theme_font))
holder.binding.statusTv.setTextColor(ContextCompat.getColor(context, R.color.text_theme))
} else {
holder.binding.statusTv.text = "未安装"
holder.binding.statusTv.setTextColor(ContextCompat.getColor(context, R.color.theme_red))
holder.binding.statusTv.setTextColor(ContextCompat.getColor(context, R.color.secondary_red))
}
holder.binding.statusTv.visibility = View.VISIBLE
} else {

View File

@ -59,7 +59,7 @@ class PrivacyPolicyDialogFragment : BaseDialogFragment() {
skipText.setSpan(object : ClickableSpan() {
override fun updateDrawState(ds: TextPaint) {
super.updateDrawState(ds)
ds.color = ContextCompat.getColor(requireContext(), R.color.theme_font)
ds.color = ContextCompat.getColor(requireContext(), R.color.text_theme)
ds.isUnderlineText = false
}
@ -101,7 +101,7 @@ class PrivacyPolicyDialogFragment : BaseDialogFragment() {
skipText.setSpan(object : ClickableSpan() {
override fun updateDrawState(ds: TextPaint) {
super.updateDrawState(ds)
ds.color = ContextCompat.getColor(requireContext(), R.color.theme_font)
ds.color = ContextCompat.getColor(requireContext(), R.color.text_theme)
ds.isUnderlineText = false
}
@ -115,7 +115,7 @@ class PrivacyPolicyDialogFragment : BaseDialogFragment() {
skipText.setSpan(object : ClickableSpan() {
override fun updateDrawState(ds: TextPaint) {
super.updateDrawState(ds)
ds.color = ContextCompat.getColor(requireContext(), R.color.theme_font)
ds.color = ContextCompat.getColor(requireContext(), R.color.text_theme)
ds.isUnderlineText = false
}

View File

@ -62,17 +62,17 @@ object ExposureUtils {
host: String? = "unknown",
path: String? = "unknown",
downloadType: DownloadType
) {
): ExposureEvent? {
val gameEntity = entity.copy()
gameEntity.platform = platform
gameEntity.downloadCompleteType = downloadType.toString()
val traceEvent = trace?.toObject<ExposureEvent>()
if (TextUtils.isEmpty(entity.id)) return
if (TextUtils.isEmpty(entity.id)) return null
// 避免生成 trace 相同的下载完成事件,根据日志看下载完成的同一秒有可能生成两条
if (mDownloadCompleteTraceEventIdSet.contains(traceEvent?.id)) {
return
return null
}
traceEvent?.payload?.gameId?.let { mDownloadCompleteTraceEventIdSet.add(it) }
@ -91,12 +91,14 @@ object ExposureUtils {
ExposureManager.log(exposureEvent)
ExposureManager.commitSavedExposureEvents(forcedUpload = true)
return exposureEvent
}
@JvmStatic
fun getDownloadType(apkEntity: ApkEntity, gameId: String, isVGame: Boolean): DownloadType {
fun getDownloadType(apkEntity: ApkEntity, gameId: String, asVGame: Boolean): DownloadType {
return when {
isVGame -> getVGameDownloadType(apkEntity, gameId)
asVGame -> getVGameDownloadType(apkEntity, gameId)
PackageUtils.isInstalled(
HaloApp.getInstance().application,
apkEntity.packageName
@ -107,7 +109,7 @@ object ExposureUtils {
private fun getVGameDownloadType(apkEntity: ApkEntity, gameId: String): DownloadType {
return when {
PackagesManager.isCanUpdate(gameId, apkEntity.packageName) -> DownloadType.FUN_UPDATE
PackagesManager.isCanUpdate(gameId, apkEntity.packageName, asVGame = true) -> DownloadType.FUN_UPDATE
else -> DownloadType.FUN_DOWNLOAD
}
}

View File

@ -0,0 +1,135 @@
package com.gh.common.prioritychain
import android.app.Activity
import android.view.Gravity
import android.view.LayoutInflater
import android.widget.FrameLayout
import com.gh.common.util.NewFlatLogUtils
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.fragment.BaseFragment
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.view.BugFixedPopupWindow
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.databinding.PopupAccelerateNotificationBinding
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.fragment.MainWrapperViewModel
class AccelerateNotificationHandler(priority: Int) : PriorityChainHandler(priority) {
private var mActivity: Activity? = null
private var mBaseHandler: BaseFragment.BaseHandler? = null
private var mGameList: List<GameEntity>? = null
private var mViewModel: MainWrapperViewModel? = null
/**
* 提前预处理显示弹窗的内容
*/
fun doPreProcess(
activity: Activity,
baseHandler: BaseFragment.BaseHandler,
gameEntityList: List<GameEntity>?,
viewModel: MainWrapperViewModel
) {
mActivity = activity
mGameList = gameEntityList
mBaseHandler = baseHandler
mViewModel = viewModel
if (getStatus() == STATUS_PENDING) {
if (gameEntityList == null) {
processNext()
} else {
updateStatus(STATUS_VALID)
onProcess()
}
} else {
if (gameEntityList == null) {
updateStatus(STATUS_INVALID)
} else {
updateStatus(STATUS_VALID)
}
}
}
override fun onProcess() {
when (getStatus()) {
STATUS_VALID -> {
val accelerateSet =
HashSet(SPUtils.getStringSet(Constants.SP_ACCELERATE_NOTIFICATION_POP_UP_SET))
if (!mGameList.isNullOrEmpty() && !accelerateSet.contains(mGameList!![0].messageId)) {
showAccelerateNotificationPopupWindow(mActivity!!, mViewModel, mBaseHandler, mGameList!![0]) {
processNext()
}
accelerateSet.add(mGameList!![0].messageId)
SPUtils.setStringSet(Constants.SP_ACCELERATE_NOTIFICATION_POP_UP_SET, accelerateSet)
} else {
processNext()
}
}
STATUS_INVALID -> {
processNext()
}
}
}
companion object {
fun showAccelerateNotificationPopupWindow(
activity: Activity,
viewModel: MainWrapperViewModel?,
baseHandler: BaseFragment.BaseHandler?,
gameEntity: GameEntity?,
dismissCallback: (() -> Unit)?
) {
val binding: PopupAccelerateNotificationBinding =
PopupAccelerateNotificationBinding.inflate(LayoutInflater.from(activity))
if (gameEntity != null) {
binding.gameIconView.displayGameIcon(gameEntity)
binding.gameNameTv.text = gameEntity.name
binding.root.setOnClickListener {
NewFlatLogUtils.logMessageInformClickPluginVersion(
gameEntity.id,
gameEntity.name!!
)
if (gameEntity.messageId.isNotEmpty()) {
// 把对应系统消息设为已读
viewModel?.postMessageRead(gameEntity.messageId)
}
GameDetailActivity.startGameDetailActivity(
context = activity,
gameId = gameEntity.id,
entrance = "首页插件上架弹窗",
defaultTab = -1,
isSkipGameComment = false,
scrollToLibao = false,
openVideoStreaming = false,
openPlatformWindow = true,
traceEvent = null
)
}
}
BugFixedPopupWindow(
binding.root,
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT
).apply {
isTouchable = true
isFocusable = true
isOutsideTouchable = true
animationStyle = R.style.popup_window_ease_in_and_out_anim_style
showAtLocation(
activity.window.decorView,
Gravity.TOP,
0,
DisplayUtils.getStatusBarHeight(activity.resources) + DisplayUtils.dip2px(42f)
)
setOnDismissListener {
dismissCallback?.invoke()
}
baseHandler?.postDelayed({ dismiss() }, 5000)
}
}
}
}

View File

@ -0,0 +1,87 @@
package com.gh.common.prioritychain
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.launcher.ARouter
import com.gh.gamecenter.common.base.fragment.BaseLazyFragment
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IFloatingWindowProvider
import com.gh.gamecenter.feature.entity.WelcomeDialogEntity
import com.gh.gamecenter.floatingwindow.FloatingWindowEntity
import com.gh.gamecenter.fragment.WelcomeDialogFragment
import com.lightgame.utils.Utils
class FloatingWindowHandler(priority: Int) : PriorityChainHandler(priority) {
private var mFragment: BaseLazyFragment? = null
private var mRecyclerView: RecyclerView? = null
private var mWindowList: ArrayList<FloatingWindowEntity>? = null
fun setData(windowList: ArrayList<FloatingWindowEntity>?) {
mWindowList = windowList
if (mFragment != null) {
doPreProcess()
}
}
fun setView(
fragment: BaseLazyFragment,
recyclerView: RecyclerView
) {
mFragment = fragment
mRecyclerView = recyclerView
if (mWindowList != null) {
doPreProcess()
}
}
private fun doPreProcess() {
Utils.log(TAG, "FloatingWindowHandler preProcess windowSize is -> ${mWindowList?.size}")
if (getStatus() == STATUS_PENDING) {
if (!mWindowList.isNullOrEmpty()) {
updateStatus(STATUS_VALID)
onProcess()
} else {
processNext()
}
} else {
if (!mWindowList.isNullOrEmpty()) {
updateStatus(STATUS_VALID)
} else {
updateStatus(STATUS_INVALID)
}
}
}
override fun onProcess() {
when (getStatus()) {
STATUS_VALID -> {
val floatingWindowProvider =
ARouter.getInstance().build(RouteConsts.provider.floatingwindow)
.navigation() as? IFloatingWindowProvider<WelcomeDialogEntity>
// 强校验所有条件均通过才能显示
if (floatingWindowProvider == null || mFragment == null || mFragment?.isAdded == false || mRecyclerView == null) {
processNext()
return
}
floatingWindowProvider.showFloatingWindowOnly(
mFragment!!,
mRecyclerView!!,
mWindowList!!,
) {
val welcomeDialog = WelcomeDialogFragment.getInstance(it, true, mFragment)
welcomeDialog.show(mFragment!!.childFragmentManager, "WelcomeDialog")
}
}
STATUS_INVALID -> {
processNext()
}
}
}
}

View File

@ -0,0 +1,45 @@
package com.gh.common.prioritychain
import com.gh.gamecenter.fragment.HomeSearchToolWrapperFragment
class HomePushHandler(priority: Int): PriorityChainHandler(priority) {
private var mHomeFragment: HomeSearchToolWrapperFragment? = null
/**
* 提前预处理显示弹窗的内容
*/
fun doPreProcess(homeFragment: HomeSearchToolWrapperFragment?, shouldShow: Boolean) {
mHomeFragment = homeFragment
if (getStatus() == STATUS_PENDING) {
if (shouldShow && homeFragment != null) {
updateStatus(STATUS_VALID)
onProcess()
} else {
processNext()
}
} else {
if (shouldShow && homeFragment != null) {
updateStatus(STATUS_VALID)
} else {
updateStatus(STATUS_INVALID)
}
}
}
override fun onProcess() {
when (getStatus()) {
STATUS_VALID -> {
// 目前首页下拉二楼是首页最后一个弹窗类的东西,还没实现回调,如果有其它要在它后面弹出的,需要自行在它的实现结果后添加回调
mHomeFragment?.popUpHomePushIfNeeded {
processNext()
}
}
STATUS_INVALID -> {
processNext()
}
}
}
}

View File

@ -0,0 +1,20 @@
package com.gh.common.prioritychain
import com.gh.gamecenter.common.entity.NotificationUgc
import com.gh.gamecenter.common.utils.NotificationHelper
import com.gh.gamecenter.login.user.UserManager
class NotificationPermissionDialogHandler(priority: Int) : PriorityChainHandler(priority) {
override fun onProcess() {
// 仅登录后再启动光环时请求一次权限
if (UserManager.getInstance().isLoggedIn) {
NotificationHelper.showNotificationHintDialog(NotificationUgc.LOGIN) {
processNext()
}
} else {
processNext()
}
}
}

View File

@ -0,0 +1,22 @@
package com.gh.common.prioritychain
import java.util.*
import java.util.concurrent.PriorityBlockingQueue
class PriorityChain {
private val mHandlerQueue: Queue<PriorityChainHandler> = PriorityBlockingQueue()
fun addHandler(handler: PriorityChainHandler) {
mHandlerQueue.add(handler.also {
it.setPriorityChain(this)
})
}
fun start() {
mHandlerQueue.poll()?.process(mHandlerQueue)
}
fun isHandlerQueueEmpty() = mHandlerQueue.isEmpty()
}

View File

@ -0,0 +1,71 @@
package com.gh.common.prioritychain
import com.lightgame.utils.Utils
import java.util.*
abstract class PriorityChainHandler(private val mPriority: Int) : Comparable<PriorityChainHandler> {
private var mStatus = STATUS_UNKNOWN
private var mQueue: Queue<PriorityChainHandler>? = null
private var mPriorityChain: PriorityChain? = null
/**
* 获取当前 handler 的状态
* - 等待结果返回 STATUS_PENDING
* - 无需执行 STATUS_INVALID
* - 可执行 STATUS_VALID
* - 未知 STATUS_UNKNOWN
*/
fun getStatus(): Int = mStatus
fun updateStatus(status: Int) {
Utils.log(TAG, "${javaClass.simpleName} updateStatus $status")
mStatus = status
}
fun setPriorityChain(priorityChain: PriorityChain) {
mPriorityChain = priorityChain
}
fun process(queue: Queue<PriorityChainHandler>) {
Utils.log(TAG, "${javaClass.simpleName} process $mStatus")
mQueue = queue
// 若当前 handler 未经处理,将其状态改为 pending
if (mStatus == STATUS_UNKNOWN) {
updateStatus(STATUS_PENDING)
}
onProcess()
}
/**
* 执行相关功能的地方
*/
abstract fun onProcess()
/**
* 分发给下一个 handler 处理
*/
fun processNext() {
Utils.log(TAG, "${javaClass.simpleName} processNext $mStatus")
mQueue?.poll()?.process(mQueue!!)
}
override fun compareTo(other: PriorityChainHandler): Int {
return (mPriority - other.mPriority)
}
companion object {
internal const val STATUS_PENDING = 0
internal const val STATUS_INVALID = 1
internal const val STATUS_VALID = 2
internal const val STATUS_UNKNOWN = 3
const val TAG = "PriorityChainHandler"
}
}

View File

@ -0,0 +1,48 @@
package com.gh.common.prioritychain
import androidx.fragment.app.FragmentActivity
import com.gh.common.dialog.PrivacyPolicyDialogFragment
import com.gh.gamecenter.entity.DialogEntity
class PrivacyPolicyDialogHandler(priority: Int) : PriorityChainHandler(priority) {
private var mActivity: FragmentActivity? = null
private var mPrivacyPolicyEntity: DialogEntity.PrivacyPolicyEntity? = null
/**
* 提前预处理显示弹窗的内容
*/
fun doPreProcess(fragmentActivity: FragmentActivity, privacyPolicyEntity: DialogEntity.PrivacyPolicyEntity?) {
mActivity = fragmentActivity
mPrivacyPolicyEntity = privacyPolicyEntity
if (getStatus() == STATUS_PENDING) {
if (privacyPolicyEntity == null) {
processNext()
} else {
updateStatus(STATUS_VALID)
onProcess()
}
} else {
if (privacyPolicyEntity == null) {
updateStatus(STATUS_INVALID)
} else {
updateStatus(STATUS_VALID)
}
}
}
override fun onProcess() {
when(getStatus()) {
STATUS_VALID -> {
PrivacyPolicyDialogFragment.show(mActivity!!, mPrivacyPolicyEntity) { _: Boolean? ->
processNext()
}
}
STATUS_INVALID -> {
processNext()
}
}
}
}

View File

@ -0,0 +1,53 @@
package com.gh.common.prioritychain
import androidx.fragment.app.Fragment
import com.gh.common.dialog.ReserveDialog
import com.gh.gamecenter.common.entity.SimpleGameEntity
import com.gh.gamecenter.message.MessageUnreadRepository
class ReserveDialogHandler(priority: Int) : PriorityChainHandler(priority) {
private var mFragment: Fragment? = null
private var mReserveData: List<SimpleGameEntity>? = null
/**
* 提前预处理显示弹窗的内容
*/
fun doPreProcess(fragment: Fragment, reserveData: List<SimpleGameEntity>?) {
mFragment = fragment
mReserveData = reserveData
if (getStatus() == STATUS_PENDING) {
if (reserveData.isNullOrEmpty()) {
processNext()
} else {
updateStatus(STATUS_VALID)
onProcess()
}
} else {
if (reserveData.isNullOrEmpty()) {
updateStatus(STATUS_INVALID)
} else {
updateStatus(STATUS_VALID)
}
}
}
override fun onProcess() {
when (getStatus()) {
STATUS_VALID -> {
val reserveDialog = ReserveDialog.getInstance(mReserveData!!)
reserveDialog.setOnDismissListener {
MessageUnreadRepository.loadMessageUnreadData()
processNext()
}
reserveDialog.show(mFragment!!.childFragmentManager, "reserveDialog")
}
STATUS_INVALID -> {
processNext()
}
}
}
}

View File

@ -0,0 +1,17 @@
package com.gh.common.prioritychain
import android.content.Context
import com.gh.gamecenter.manager.UpdateManager
class UpdateDialogHandler(context: Context, priority: Int) : PriorityChainHandler(priority) {
private val mUpdateManager = UpdateManager.getInstance(context)
override fun onProcess() {
mUpdateManager.checkUpdate(true, null)
mUpdateManager.setDismissCallback {
processNext()
}
}
}

View File

@ -0,0 +1,79 @@
package com.gh.common.prioritychain
import android.graphics.Bitmap
import androidx.fragment.app.Fragment
import com.gh.gamecenter.common.callback.BiCallback
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.gamecenter.feature.entity.WelcomeDialogEntity
import com.gh.gamecenter.fragment.MainWrapperViewModel
import com.gh.gamecenter.fragment.WelcomeDialogFragment
import com.halo.assistant.HaloApp
class WelcomeDialogHandler(priority: Int): PriorityChainHandler(priority) {
private var mFragment: Fragment? = null
private var mWelcomeDialogEntity: WelcomeDialogEntity? = null
fun doPreProcess(fragment: Fragment, welcomeDialogEntity: WelcomeDialogEntity?) {
mFragment = fragment
mWelcomeDialogEntity = welcomeDialogEntity
val preLoadClosure = {
// 判断启动本次应用是否已经弹窗,不是的话弹启动弹窗
if (HaloApp.get(MainWrapperViewModel.SHOULD_SHOW_OPENING_DIALOG, false) == null) {
HaloApp.put(MainWrapperViewModel.SHOULD_SHOW_OPENING_DIALOG, false)
ImageUtils.getBitmap(mWelcomeDialogEntity!!.icon, object : BiCallback<Bitmap, Boolean> {
override fun onFirst(first: Bitmap) {
if (getStatus() == STATUS_PENDING) {
updateStatus(STATUS_VALID)
onProcess()
} else {
updateStatus(STATUS_VALID)
}
}
override fun onSecond(second: Boolean) {
processNext()
}
})
} else {
processNext()
}
}
if (getStatus() == STATUS_PENDING) {
if (welcomeDialogEntity == null) {
processNext()
} else {
preLoadClosure.invoke()
}
} else {
if (welcomeDialogEntity == null) {
updateStatus(STATUS_INVALID)
} else {
preLoadClosure.invoke()
}
}
}
override fun onProcess() {
when (getStatus()) {
STATUS_VALID -> {
if (mFragment == null || !mFragment!!.isAdded) {
updateStatus(STATUS_INVALID)
processNext()
} else {
val welcomeDialog = WelcomeDialogFragment.getInstance(mWelcomeDialogEntity)
welcomeDialog.setOnDismissListener {
processNext()
}
welcomeDialog.show(mFragment!!.childFragmentManager, "WelcomeDialog")
}
}
STATUS_INVALID -> {
processNext()
}
}
}
}

View File

@ -82,4 +82,8 @@ class AppProviderImpl : IAppProvider {
override fun getIsBrandNewInstall(): Boolean {
return HaloApp.getInstance().isBrandNewInstall
}
override fun setSkippingThirdParty(isSkippingThirdParty: Boolean) {
HaloApp.getInstance().isSkippingThirdParty = isSkippingThirdParty
}
}

View File

@ -19,6 +19,7 @@ class BuildConfigImpl : IBuildConfigProvider {
override fun getExposureVersion(): String = BuildConfig.EXPOSURE_VERSION
override fun isDebug(): Boolean = BuildConfig.DEBUG
override fun isGATApp(): Boolean = BuildConfig.IS_GAT_APP
override fun getApiHost(): String = BuildConfig.API_HOST
@ -31,4 +32,5 @@ class BuildConfigImpl : IBuildConfigProvider {
override fun getVApiHost(): String = BuildConfig.VAPI_HOST
override fun getVDevApiHost(): String = BuildConfig.DEV_VAPI_HOST
override fun getLogProducerProject(): String = BuildConfig.LOG_HUB_PROJECT
}

View File

@ -56,6 +56,22 @@ class ConfigProviderImpl : IConfigProvider {
return Config.getSettings()?.image?.oss?.gifWaterMark ?: ""
}
override fun getVideoSnapshotSuffix(): String {
return Config.getSettings()?.image?.oss?.snapshot ?: ""
}
override fun getImageCropSuffix(): String {
return Config.getSettings()?.image?.oss?.crop ?: ""
}
override fun getImageInfoSuffix(): String {
return Config.getSettings()?.image?.oss?.info ?: ""
}
override fun getImageResizeSuffix(): String {
return Config.getSettings()?.image?.oss?.resize ?: ""
}
override fun getQQ(): String {
return Config.getSettings()?.support?.qq ?: ""
}

View File

@ -1,6 +1,7 @@
package com.gh.common.provider
import android.content.Context
import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.common.constant.RouteConsts
@ -53,16 +54,16 @@ class DirectProviderImpl : IDirectProvider {
DirectUtils.directDouyin(context, userId)
}
override fun directToSuggestionFromDiagnosis(context: Context, diagnosis: String) {
DirectUtils.directToSuggestion(context, diagnosis = diagnosis)
override fun directToSuggestionFromDiagnosis(context: Context, content: String, diagnosis: String) {
DirectUtils.directToSuggestion(context, content = content, diagnosis = diagnosis)
}
override fun directToQa(context: Context, text: String?, id: String) {
DirectUtils.directToQa(context, text, id)
}
override fun directToHelpAndFeedback(context: Context, position: Int) {
DirectUtils.directToHelpAndFeedback(context, position)
override fun directToHelpAndFeedback(context: Context, bundle: Bundle?) {
DirectUtils.directToHelpAndFeedback(context, bundle)
}
override fun directToQqGroup(context: Context, groupNumber: String?): Boolean {
@ -119,6 +120,10 @@ class DirectProviderImpl : IDirectProvider {
return DirectUtils.directToQGameHome(context)
}
override fun directToExternalBrowser(context: Context, url: String) {
DirectUtils.directToExternalBrowser(context, url)
}
override fun init(context: Context?) {
// Do nothing
}

View File

@ -3,11 +3,14 @@ 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.R
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.entity.GameUpdateEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.provider.IDownloadButtonClickedProvider
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.packagehelper.PackageRepository
@ -25,6 +28,7 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
var downloadStatusInChinese = ""
var gameSchemaType = ""
var packageName = ""
var exposureSourceList: List<ExposureSource>? = null
val boundedObject = downloadButton.getObject()
@ -36,17 +40,21 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
gameId = boundedObject.id
gameName = boundedObject.name ?: ""
gameCategory = boundedObject.category ?: ""
downloadStatus = if (boundedObject.isVGame()) {
"畅玩"
} else if (boundedObject.downloadStatus == "demo") {
"试玩"
} else {
"下载"
}
downloadStatus =
if (boundedObject.isVGamePreferred()) {
"畅玩"
} else {
if (boundedObject.downloadStatus == "demo") {
"试玩"
} else {
"下载"
}
}
gameTypeInChinese = boundedObject.categoryChinese
downloadStatusInChinese = boundedObject.downloadStatusChinese
gameSchemaType = boundedObject.gameBitChinese
packageName = boundedObject.getUniquePackageName() ?: ""
exposureSourceList = boundedObject.exposureEvent?.source
}
is GameUpdateEntity -> {
@ -57,14 +65,16 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
gameTypeInChinese = boundedObject.categoryChinese
downloadStatusInChinese = boundedObject.downloadStatusChinese
packageName = boundedObject.packageName
exposureSourceList = boundedObject.exposureEvent?.source
}
is DownloadEntity -> {
gameId = boundedObject.gameId
gameName = boundedObject.name ?: ""
gameCategory = boundedObject.getGameCategory()
downloadStatus = if (boundedObject.isVGame()) "畅玩" else "下载"
downloadStatus = if (boundedObject.asVGame()) "畅玩" else "下载"
packageName = boundedObject.packageName
exposureSourceList = boundedObject.exposureTrace?.toObject<ExposureEvent>()?.source
}
}
@ -87,28 +97,38 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
}
// 预约状态不上报
if (downloadButton.buttonStyle != DownloadButton.ButtonStyle.RESERVABLE
&& downloadButton.buttonStyle != DownloadButton.ButtonStyle.RESERVED
) {
if (downloadButton.buttonStyle == DownloadButton.ButtonStyle.NORMAL
|| downloadButton.buttonStyle == DownloadButton.ButtonStyle.PLUGIN) {
val text = downloadButton.text.ifEmpty {
downloadButton.getTag(R.string.download) ?: ""
}.toString()
val downloadType = if (text.contains("畅玩")) {
"畅玩下载"
} else {
"本地下载"
}
// 上报神策点击事件
SensorsBridge.trackEvent(
SensorsBridge.trackEventWithExposureSource(
"DownLoadbuttonClick",
exposureSourceList,
"game_id", gameId,
"game_name", gameName,
"game_type", gameTypeInChinese,
"download_status", downloadStatusInChinese,
"button_name", downloadButton.text,
"game_schema_type", gameSchemaType,
"download_type", downloadType,
"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
"last_page_business_id", GlobalActivityManager.getLastPageEntity().pageBusinessId,
)
}
}
}

View File

@ -9,8 +9,8 @@ import com.gh.gamecenter.core.provider.IGameSubstituteRepositoryProvider
@Route(path = RouteConsts.provider.gameSubstituteRepository, name = "GameSubstituteRepositoryHelper暴露服务")
class GameSubstituteRepositoryProviderImpl : IGameSubstituteRepositoryProvider {
override fun updateSubstitutableGames() {
GameSubstituteRepositoryHelper.updateSubstitutableGames()
override fun updateHistoricInstalledGameSet() {
GameSubstituteRepositoryHelper.updateHistoricInstalledGameSet()
}
override fun init(context: Context?) {

View File

@ -6,7 +6,6 @@ import com.gh.common.util.DirectUtils
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.entity.CommunityEntity
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.common.entity.SimpleGameEntity
import com.gh.gamecenter.common.entity.SuggestType
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.provider.ILinkDirectUtilsProvider
@ -48,17 +47,6 @@ class LinkDirectUtilsProviderImpl : ILinkDirectUtilsProvider {
DirectUtils.directToSuggestion(context, type, suggestHintType, content, isQaFeedback, qaContentId)
}
override fun directToSuggestion(
context: Context,
type: SuggestType,
suggestHintType: String?,
content: String?,
game: SimpleGameEntity,
platform: String
) {
DirectUtils.directToSuggestion(context, type, suggestHintType, content, game, platform)
}
override fun directToSuggestion(context: Context, type: SuggestType, hiddenHint: String) {
DirectUtils.directToSuggestion(context, type, hiddenHint)
}

View File

@ -11,7 +11,7 @@ import com.lightgame.download.DownloadEntity
class PackageInstallerProviderImpl : IPackageInstallerProvider {
override fun install(context: Context, downloadEntity: DownloadEntity, showUnzipToast: Boolean) {
PackageInstaller.install(context, downloadEntity, showUnzipToast)
PackageInstaller.install(context, downloadEntity, showUnzipToast, false)
}
override fun uninstall(context: Context, path: String) {

View File

@ -3,23 +3,24 @@ package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IVHelperProvider
import com.gh.gamecenter.feature.entity.InstallGameEntity
import com.gh.gamecenter.feature.provider.IVHelperProvider
import com.gh.vspace.VHelper
@Route(path = RouteConsts.provider.vhelper, name = "VHelper暴露服务")
class VHelperProviderImpl: IVHelperProvider {
override fun getPlatformV(): String {
return VHelper.PLATFORM_V
}
override fun getVUrl(originUrl: String?): String {
return VHelper.getVUrl(originUrl)
}
override fun isVGameOn(): Boolean {
return VHelper.isVGameOn()
}
override fun getAllInstalledVGameEntity(): ArrayList<InstallGameEntity> {
return VHelper.getAllInstalledVGameEntity()
}
override fun launch(context: Context, packageName: String, ignoreGApps: Boolean, showLoading: Boolean) {
VHelper.launch(context, packageName, ignoreGApps, showLoading)
}
override fun init(context: Context?) {
// Do nothing
}

View File

@ -21,10 +21,6 @@ class WebProviderImpl : IWebProvider {
return WebActivity.getBindWechatIntent(context)
}
override fun getSecurityCertificationIntent(context: Context): Intent {
return WebActivity.getSecurityCertificationIntent(context)
}
override fun getQAIntent(
context: Context?,
url: String?,

View File

@ -41,7 +41,7 @@ object NewSimulatorGameManager {
private const val KEY_USE_DEBUG_API = "USE_DEBUG_API"
private const val KEY_META = "META"
// private const val GH_RETRO_EMU_APP_PACKAGE_NAME = "com.gh.retroemu"
// private const val GH_RETRO_EMU_APP_PACKAGE_NAME = "com.gh.retroemu"
private const val GH_RETRO_EMU_APP_LAUNCHER_ACTIVITY_NAME = "com.gh.retroemu.ui.SplashActivity"
@ -61,10 +61,10 @@ object NewSimulatorGameManager {
}
/**
* 弹出更新弹框
*/
* 弹出更新弹框
*/
@JvmStatic
fun showUpdateNewsSimulator(context: Context, callback: EmptyCallback? = null){
fun showUpdateNewsSimulator(context: Context, gameEntity: GameEntity, callback: EmptyCallback? = null) {
NewFlatLogUtils.logSimulatorUpdateAlertShow()
DialogHelper.showDialog(
context,
@ -76,7 +76,13 @@ object NewSimulatorGameManager {
NewFlatLogUtils.logSimulatorUpdateAlertClick("更新")
val simulator = Config.getNewSimulatorEntitySetting()
if (simulator != null) {
SimulatorDownloadManager.getInstance().showDownloadingDialog(context, simulator)
SimulatorDownloadManager.getInstance().showDownloadingDialog(
context,
simulator,
gameEntity.id,
gameEntity.name ?: "",
gameEntity.categoryChinese
)
}
},
cancelClickCallback = {
@ -85,7 +91,7 @@ object NewSimulatorGameManager {
},
uiModificationCallback = { binding ->
binding.contentTv.gravity = Gravity.START
binding.contentTv.setTextColor(R.color.text_subtitle.toColor(context))
binding.contentTv.setTextColor(R.color.text_secondary.toColor(context))
},
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
)
@ -127,7 +133,10 @@ object NewSimulatorGameManager {
)
val intent = Intent()
intent.setClassName(SimulatorGameManager.NEW_SIMULATOR_PACKAGE_NAME, GH_RETRO_EMU_APP_LAUNCHER_ACTIVITY_NAME)
intent.setClassName(
SimulatorGameManager.NEW_SIMULATOR_PACKAGE_NAME,
GH_RETRO_EMU_APP_LAUNCHER_ACTIVITY_NAME
)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
intent.data = gamePackageFileUri
gameEntity.getApk().safelyGetInRelease(0)?.let { apk ->
@ -138,7 +147,10 @@ object NewSimulatorGameManager {
intent.putExtra(KEY_GAME_ICON, it)
intent.putExtra(KEY_GAME_PACKAGE_PATH, downloadEntity.path) // 游戏包文件路径,冗余参数)
intent.putExtra(KEY_GAME_PACKAGE_SDCARD_PATH, true)
intent.putExtra(KEY_GAME_PACKAGE_LAST_MODIFICATION, File(downloadEntity.path).lastModified()) // 游戏包文件修改时间
intent.putExtra(
KEY_GAME_PACKAGE_LAST_MODIFICATION,
File(downloadEntity.path).lastModified()
) // 游戏包文件修改时间
intent.putExtra(KEY_GAME_EMU_SYSTEM, gameEntity.simulatorType) // 模拟器类型
intent.putExtra(KEY_GAME_ID, gameEntity.id)
// TODO 补充光环模拟器的游戏 id

View File

@ -14,6 +14,7 @@ import com.gh.common.util.PackageInstaller
import com.gh.common.util.PackageUtils
import com.gh.download.DownloadManager
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.base.TrackableDialog
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.*
@ -47,6 +48,7 @@ class SimulatorDownloadManager private constructor() {
private var simulator: SimulatorEntity? = null
private var gameId: String = ""
private var gameName: String = ""
private var gameType: String = ""
private var downloadType: String = ""
private val dataWatcher = object : DataWatcher() {
@ -99,33 +101,43 @@ class SimulatorDownloadManager private constructor() {
downloadDialog?.dismiss()
}
}
DownloadStatus.diskisfull == downloadEntity.status -> {
ToastUtils.showToast("存储空间已满,下载任务已暂停")
}
DownloadStatus.diskioerror == downloadEntity.status -> {
ToastUtils.showToast("下载 IO 出现异常,下载任务已暂停")
}
DownloadStatus.neterror == downloadEntity.status -> {
ToastUtils.showToast("网络不稳定,下载任务已暂停")
}
DownloadStatus.timeout == downloadEntity.status -> {
ToastUtils.showToast("网络不稳定,下载任务已暂停")
}
DownloadStatus.notfound == downloadEntity.status -> {
ToastUtils.showToast("下载链接异常,请稍后重试")
}
DownloadStatus.uncertificated == downloadEntity.status -> {
ToastUtils.showToast("请先进行实名认证")
}
DownloadStatus.unqualified == downloadEntity.status -> {
ToastUtils.showToast("未成年人暂不允许在此时间下载游戏")
}
DownloadStatus.unavailable == downloadEntity.status -> {
ToastUtils.showToast("该游戏未接入防沉迷系统,暂不支持下载")
}
DownloadStatus.banned == downloadEntity.status -> {
ToastUtils.showToast("网络异常")
}
DownloadStatus.hijack == downloadEntity.status -> {
ToastUtils.showToast("网络劫持,请稍后重试")
}
@ -135,7 +147,7 @@ class SimulatorDownloadManager private constructor() {
}
fun showDownloadDialog(context: Context, simulator: SimulatorEntity?, location: SimulatorLocation) {
showDownloadDialog(context, simulator, location, "", "", null)
showDownloadDialog(context, simulator, location, "", "", "", null)
}
fun showDownloadDialog(
@ -144,6 +156,7 @@ class SimulatorDownloadManager private constructor() {
location: SimulatorLocation,
gameId: String = "",
gameName: String = "",
gameCategoryChinese: String = "",
cancelCallback: (() -> Unit)? = null
) {
if (context == null) return
@ -152,6 +165,7 @@ class SimulatorDownloadManager private constructor() {
this.simulator = simulator
this.gameId = gameId
this.gameName = gameName
this.gameType = gameCategoryChinese
PermissionHelper.checkGetInstalledAppsListBeforeAction(context, object : EmptyCallback {
override fun onCallback() {
@ -183,7 +197,8 @@ class SimulatorDownloadManager private constructor() {
return
}
val title = if (shouldShowUpdate && isInstalled) "更新模拟器" else "安装模拟器"
val message = if (shouldShowUpdate && isInstalled) "检测到模拟器存在更高版本,是否前往更新" else "模拟器游戏需要先下载安装对应的模拟器,才可以运行"
val message =
if (shouldShowUpdate && isInstalled) "检测到模拟器存在更高版本,是否前往更新" else "模拟器游戏需要先下载安装对应的模拟器,才可以运行"
val positiveText =
if (shouldShowUpdate && isInstalled) "更新(${simulator?.apk?.size}" else "下载(${simulator?.apk?.size}"
val negativeText = if (shouldShowUpdate && isInstalled) "下次再说" else "取消"
@ -195,6 +210,25 @@ class SimulatorDownloadManager private constructor() {
if (shouldShowUpdate && isInstalled) {
NewFlatLogUtils.logSimulatorUpdateAlertShow()
}
if (shouldShowUpdate && isInstalled) {
SensorsBridge.trackSimulatorUpdateDialogShow(
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
} else {
SensorsBridge.trackSimulatorInstallDialogShow(
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
}
DialogHelper.showDialog(
context,
title,
@ -207,16 +241,79 @@ class SimulatorDownloadManager private constructor() {
cancelCallback?.invoke()
NewFlatLogUtils.logSimulatorUpdateAlertClick("取消")
MtaHelper.onEvent(trackableEntity.event, trackableEntity.key, "点击下次再说")
SensorsBridge.trackSimulatorUpdateDialogClick(
buttonName = negativeText,
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
} else {
SensorsBridge.trackSimulatorInstallDialogClick(
buttonName = negativeText,
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
}
},
confirmClickCallback = {
showDownloadingDialog(context, simulator)
showDownloadingDialog(context, simulator, gameId, gameName, gameCategoryChinese)
NewFlatLogUtils.logSimulatorUpdateAlertClick("更新")
MtaHelper.onEvent(
trackableEntity.event,
trackableEntity.key,
if (shouldShowUpdate && isInstalled) "点击更新" else "点击下载"
)
if (shouldShowUpdate && isInstalled) {
SensorsBridge.trackSimulatorUpdateDialogClick(
buttonName = positiveText,
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
} else {
SensorsBridge.trackSimulatorInstallDialogClick(
buttonName = positiveText,
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
}
},
touchOutsideCallback = {
if (shouldShowUpdate && isInstalled) {
SensorsBridge.trackSimulatorUpdateDialogClick(
buttonName = "关闭弹窗",
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
} else {
SensorsBridge.trackSimulatorInstallDialogClick(
buttonName = "关闭弹窗",
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
}
},
mtaEvent = trackableEntity.event, mtaKey = trackableEntity.key,
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
@ -228,7 +325,13 @@ class SimulatorDownloadManager private constructor() {
})
}
fun showDownloadingDialog(context: Context, simulator: SimulatorEntity?) {
fun showDownloadingDialog(
context: Context,
simulator: SimulatorEntity?,
gameId: String = "",
gameName: String = "",
gameCategoryChinese: String = "",
) {
mContextRef = WeakReference(context)
val msg = FileUtils.isCanDownload(context, simulator?.apk?.size)
if (!msg.isNullOrEmpty()) {
@ -261,6 +364,11 @@ class SimulatorDownloadManager private constructor() {
}
downloadDialog?.setOnDismissListener {
SensorsBridge.trackSimulatorDownloadDialogClose(
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese
)
DownloadManager.getInstance().removeObserver(dataWatcher)
}
@ -273,7 +381,7 @@ class SimulatorDownloadManager private constructor() {
params?.width = context.resources.displayMetrics.widthPixels - DisplayUtils.dip2px(60f)
downloadDialog?.window?.attributes = params
download(simulator)
download(simulator, gameId, gameName, gameCategoryChinese)
}
private fun showNoneEmulatorDialog(context: Context) {
@ -287,13 +395,18 @@ class SimulatorDownloadManager private constructor() {
ToastUtils.showToast("该模拟器暂未提供下载")
},
uiModificationCallback = { binding ->
binding.confirmTv.setTextColor(R.color.text_body.toColor(context))
binding.confirmTv.setTextColor(R.color.text_instance.toColor(context))
},
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
)
}
private fun download(simulator: SimulatorEntity?) {
private fun download(
simulator: SimulatorEntity?,
gameId: String = "",
gameName: String = "",
gameCategoryChinese: String = ""
) {
val apkEntity = simulator?.apk ?: return
val entity = DownloadManager.getInstance().getDownloadEntityByUrl(apkEntity.url)
@ -307,19 +420,31 @@ class SimulatorDownloadManager private constructor() {
DownloadStatus.diskioerror,
DownloadStatus.diskisfull -> {
DownloadManager.getInstance().addObserver(dataWatcher)
uiExecutor.executeWithDelay(Runnable { DownloadManager.getInstance().resume(entity, true) }, 200)
uiExecutor.executeWithDelay(Runnable { DownloadManager.getInstance().resume(entity, false) }, 200)
SensorsBridge.trackSimulatorDownloadDialogShow(
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese
)
downloadDialog?.show()
}
DownloadStatus.done -> NDataChanger.notifyDataChanged(entity)
else -> createDownload(apkEntity, simulator)
else -> createDownload(apkEntity, simulator, gameId, gameName, gameCategoryChinese)
}
} else {
createDownload(apkEntity, simulator)
createDownload(apkEntity, simulator, gameId, gameName, gameCategoryChinese)
}
}
private fun createDownload(apkEntity: ApkEntity, simulator: SimulatorEntity) {
private fun createDownload(
apkEntity: ApkEntity,
simulator: SimulatorEntity,
gameId: String = "",
gameName: String = "",
gameCategoryChinese: String = ""
) {
DownloadManager.getInstance().addObserver(dataWatcher)
val downloadId = PackageInstaller.createDownloadId(simulator.name)
val downloadEntity = DownloadEntity()
@ -351,6 +476,11 @@ class SimulatorDownloadManager private constructor() {
downloadType,
""
)
SensorsBridge.trackSimulatorDownloadDialogShow(
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese
)
downloadDialog?.show()
}

View File

@ -150,7 +150,7 @@ object SimulatorGameManager {
SimulatorDownloadManager.getInstance().showDownloadDialog(
AppManager.getInstance().recentActiveActivity, simulator,
SimulatorDownloadManager.SimulatorLocation.LAUNCH, gameEntity.id, gameEntity.name
?: ""
?: "", gameEntity.categoryChinese
) {
jumpToSimulator(downloadEntity, gameEntity)
}

View File

@ -1,15 +1,8 @@
package com.gh.common.util
import com.gh.common.constant.Config
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.gamecenter.common.utils.observableToMain
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.entity.NewApiSettingsEntity
import com.gh.gamecenter.entity.StartupAdEntity
import com.gh.gamecenter.feature.entity.SettingsEntity
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
object AdHelper {

View File

@ -9,6 +9,7 @@ import androidx.fragment.app.Fragment
import com.gh.download.simple.AutoUnregisteredSimpleDownloadListener
import com.gh.download.simple.DownloadListener
import com.gh.gamecenter.R
import com.gh.gamecenter.cloudarchive.BaseCloudArchiveViewModel
import com.gh.gamecenter.common.eventbus.EBReuse
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.runOnUiThread
@ -36,6 +37,7 @@ object ArchiveDownloadButtonHelper {
entrance: String,
fragment: Fragment,
packageName: String,
viewModel: BaseCloudArchiveViewModel,
archiveEntity: ArchiveEntity,
downloadBtn: TextView,
gameEntity: GameEntity?,
@ -60,19 +62,23 @@ object ArchiveDownloadButtonHelper {
}
}
// 检查本地是否已下载存档
VArchiveHelper.isArchiveDownloaded(archiveEntity.md5) -> showApplyArchiveTipDialog(
context,
entrance,
packageName,
archiveEntity,
gameEntity
)
VArchiveHelper.isArchiveDownloaded(archiveEntity.md5) -> viewModel.getArchiveConfigString {
showApplyArchiveTipDialog(
context,
entrance,
packageName,
it,
archiveEntity,
gameEntity
)
}
// 检查完毕下载存档
else -> downloadArchive(
context,
entrance,
fragment,
packageName,
viewModel,
archiveEntity,
downloadBtn,
gameEntity,
@ -109,12 +115,12 @@ object ArchiveDownloadButtonHelper {
R.string.archive_download_dialog_content.toResString(),
R.string.archive_download_dialog_confirm.toResString(),
R.string.cancel.toResString(),
{
confirmClickCallback = {
NewFlatLogUtils.logCloudArchiveGameDownloadDialogClick(R.string.archive_download_dialog_confirm.toResString())
VHelper.disableLaunchGameAfterInstallation()
EventBus.getDefault().post(EBReuse("download"))
},
{
cancelClickCallback = {
NewFlatLogUtils.logCloudArchiveGameDownloadDialogClick(R.string.cancel.toResString())
},
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
@ -125,6 +131,7 @@ object ArchiveDownloadButtonHelper {
context: Context,
entrance: String,
packageName: String,
config: String,
archiveEntity: ArchiveEntity,
gameEntity: GameEntity?
) {
@ -135,7 +142,7 @@ object ArchiveDownloadButtonHelper {
.subscribeOn(Schedulers.io())
.subscribe()
VArchiveHelper.applyGameArchive(context, packageName, this) { packageName, isSuccess ->
VArchiveHelper.applyGameArchive(context, packageName, config, this) { packageName, isSuccess ->
runOnUiThread {
if (isSuccess) {
VHelper.launch(context, packageName)
@ -161,6 +168,7 @@ object ArchiveDownloadButtonHelper {
entrance: String,
fragment: Fragment,
packageName: String,
viewModel: BaseCloudArchiveViewModel,
archiveEntity: ArchiveEntity,
downloadBtn: TextView,
gameEntity: GameEntity?,
@ -197,7 +205,9 @@ object ArchiveDownloadButtonHelper {
DownloadStatus.COMPLETED -> {
dismissArchiveLoadingDialog(archiveLoadingDialog)
downloadBtn.text = R.string.archive_apply.toResString()
showApplyArchiveTipDialog(context, entrance, packageName, archiveEntity, gameEntity)
viewModel.getArchiveConfigString {
showApplyArchiveTipDialog(context, entrance, packageName, it, archiveEntity, gameEntity)
}
downloadCompletedListener?.invoke()
}
else -> {
@ -251,43 +261,46 @@ object ArchiveDownloadButtonHelper {
context: Context,
entrance: String,
packageName: String,
config: String,
archiveEntity: ArchiveEntity,
gameEntity: GameEntity?
) {
DialogHelper.showDialog(
context,
R.string.archive_dialog_title.toResString(),
R.string.archive_apply_dialog_content.toResString(),
R.string.archive_apply.toResString(),
R.string.cancel.toResString(),
{
applyArchive(context, entrance, packageName, archiveEntity, gameEntity)
NewFlatLogUtils.logCloudArchiveApplyDialogRelated("cloud_save_overwrite_dialog_click", "使用")
SensorsBridge.trackEvent(
"CloudSaveOverwriteDialogClick",
"game_id", gameEntity?.id ?: "",
"game_name", gameEntity?.name ?: "",
"button_name", "使用"
)
},
{
NewFlatLogUtils.logCloudArchiveApplyDialogRelated("cloud_save_overwrite_dialog_click", "取消")
SensorsBridge.trackEvent(
"CloudSaveOverwriteDialogClick",
"game_id", gameEntity?.id ?: "",
"game_name", gameEntity?.name ?: "",
"button_name", "取消"
)
},
extraConfig = DialogHelper.Config(centerTitle = true)
)
runOnUiThread {
DialogHelper.showDialog(
context,
R.string.archive_dialog_title.toResString(),
R.string.archive_apply_dialog_content.toResString(),
R.string.archive_apply.toResString(),
R.string.cancel.toResString(),
{
applyArchive(context, entrance, packageName, config, archiveEntity, gameEntity)
NewFlatLogUtils.logCloudArchiveApplyDialogRelated("cloud_save_overwrite_dialog_click", "使用")
SensorsBridge.trackEvent(
"CloudSaveOverwriteDialogClick",
"game_id", gameEntity?.id ?: "",
"game_name", gameEntity?.name ?: "",
"button_name", "使用"
)
},
{
NewFlatLogUtils.logCloudArchiveApplyDialogRelated("cloud_save_overwrite_dialog_click", "取消")
SensorsBridge.trackEvent(
"CloudSaveOverwriteDialogClick",
"game_id", gameEntity?.id ?: "",
"game_name", gameEntity?.name ?: "",
"button_name", "取消"
)
},
extraConfig = DialogHelper.Config(centerTitle = true)
)
NewFlatLogUtils.logCloudArchiveApplyDialogRelated("cloud_save_overwrite_dialog_show")
SensorsBridge.trackEvent(
"CloudSaveOverwriteDialogShow",
"game_id", gameEntity?.id ?: "",
"game_name", gameEntity?.name ?: ""
)
NewFlatLogUtils.logCloudArchiveApplyDialogRelated("cloud_save_overwrite_dialog_show")
SensorsBridge.trackEvent(
"CloudSaveOverwriteDialogShow",
"game_id", gameEntity?.id ?: "",
"game_name", gameEntity?.name ?: ""
)
}
}
private fun dismissArchiveLoadingDialog(archiveLoadingDialog: Dialog) {

View File

@ -64,7 +64,7 @@ object BbsReportHelper {
this,
1f,
false,
R.color.background
R.color.ui_background
)
)
binding.reasonRv.adapter = reportReasonAdapter
@ -94,7 +94,7 @@ object BbsReportHelper {
binding.otherReasonEt.doOnTextChanged { text, start, before, count ->
val tvCount: Int = text.toString().length
if (tvCount >= 500) {
binding.tvCount.setTextColor(R.color.theme_red.toColor(binding.tvCount.context))
binding.tvCount.setTextColor(R.color.secondary_red.toColor(binding.tvCount.context))
}
binding.tvCount.text = "$tvCount/500"
}

View File

@ -177,6 +177,8 @@ public class CommentUtils {
return null;
},
null,
null,
null,
new DialogHelper.Config("", false, true, true, false, -1)
);
break;
@ -196,7 +198,7 @@ public class CommentUtils {
LinearLayout container = new LinearLayout(context);
container.setOrientation(LinearLayout.VERTICAL);
container.setPadding(0, DisplayUtils.dip2px(context, 12), 0, DisplayUtils.dip2px(context, 12));
container.setBackgroundColor(ContextCompat.getColor(context, R.color.background_white));
container.setBackgroundColor(ContextCompat.getColor(context, R.color.ui_surface));
for (final String s : arrReportType) {
TextView reportTypeTv = new TextView(context);
@ -246,12 +248,12 @@ public class CommentUtils {
public static void postVote(final Context context, final CommentEntity commentEntity,
final TextView commentLikeCountTv, final ImageView commentLikeIv,
final OnVoteListener listener) {
if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, R.color.theme_font)) {
if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, R.color.text_theme)) {
ToastUtils.INSTANCE.showToast("已经点过赞啦!");
return;
}
commentEntity.setVote(commentEntity.getVote() + 1);
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.theme_font));
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.text_theme));
commentLikeIv.setImageResource(R.drawable.comment_vote_select);
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
commentLikeCountTv.setVisibility(View.VISIBLE);
@ -316,12 +318,12 @@ public class CommentUtils {
entrance = "视频流-评论-点赞";
}
CheckLoginUtils.checkLogin(context, entrance, () -> {
if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, R.color.theme_font)) {
if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, R.color.text_theme)) {
ToastUtils.INSTANCE.showToast("已经点过赞啦!");
return;
}
commentEntity.setVote(commentEntity.getVote() + 1);
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.theme_font));
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.text_theme));
commentLikeIv.setImageResource(R.drawable.comment_vote_select);
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
commentLikeCountTv.setVisibility(View.VISIBLE);
@ -442,7 +444,7 @@ public class CommentUtils {
public void onFailure(@Nullable HttpException e) {
super.onFailure(e);
commentEntity.setVote(commentEntity.getVote() + 1);
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.theme_font));
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.text_theme));
commentLikeIv.setImageResource(R.drawable.comment_vote_select);
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
commentLikeCountTv.setVisibility(View.VISIBLE);
@ -500,7 +502,7 @@ public class CommentUtils {
holder.commentLikeCountTv.setVisibility(View.GONE);
} else { // 检查是否已点赞
if (userDataEntity != null && (userDataEntity.isCommentVoted())) {
holder.commentLikeCountTv.setTextColor(ContextCompat.getColor(mContext, R.color.theme_font));
holder.commentLikeCountTv.setTextColor(ContextCompat.getColor(mContext, R.color.text_theme));
holder.commentLikeIv.setImageResource(R.drawable.comment_vote_select);
}
holder.commentLikeCountTv.setVisibility(View.VISIBLE);

View File

@ -5,6 +5,7 @@ import android.os.Build;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.common.exposure.meta.MetaUtil;
import com.gh.gamecenter.common.utils.NetworkUtils;
import com.gh.gamecenter.feature.entity.GameEntity;
import com.gh.gamecenter.entity.NewsDetailEntity;
@ -54,7 +55,7 @@ public class DataCollectionUtils {
map.put("location", downloadEntity.getLocation());
map.put(EntranceConsts.KEY_ENTRANCE, downloadEntity.getEntrance());
map.put("installed", downloadEntity.getInstalled());
map.put("network", NetworkUtils.getConnectedType(context));
map.put("network", MetaUtil.getMeta().getNetwork());
DataCollectionManager.onEvent(context, "download", map);
}
@ -118,7 +119,7 @@ public class DataCollectionUtils {
map.put("key", args[0]);
map.put("game_id", args[3]);
map.put("game_name", args[4]);
map.put("netword", NetworkUtils.getConnectedType(context));
map.put("netword", MetaUtil.getMeta().getNetwork());
map.put("type", "search");
map.put("device_type", android.os.Build.MODEL);
map.put("device_system", android.os.Build.VERSION.SDK_INT + "=" + android.os.Build.VERSION.RELEASE);
@ -136,7 +137,7 @@ public class DataCollectionUtils {
map.put("key", args[0]);
map.put("game_id", args[3]);
map.put("game_name", args[4]);
map.put("netword", NetworkUtils.getConnectedType(context));
map.put("netword", MetaUtil.getMeta().getNetwork());
map.put("type", "click");
map.put("device_type", android.os.Build.MODEL);
map.put("device_system", android.os.Build.VERSION.SDK_INT + "=" + android.os.Build.VERSION.RELEASE);

View File

@ -9,15 +9,16 @@ import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.util.Log;
import com.gh.gamecenter.common.base.GlobalActivityManager;
import com.gh.ad.AdDelegateHelper;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.common.base.GlobalActivityManager;
import com.gh.gamecenter.common.base.activity.BaseActivity;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.eventbus.EBReuse;
import com.gh.gamecenter.common.exposure.meta.MetaUtil;
import com.gh.gamecenter.common.retrofit.BiResponse;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.core.AppExecutor;
import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.gamecenter.core.utils.MtaHelper;
import com.gh.gamecenter.core.utils.SPUtils;
@ -114,19 +115,24 @@ public class DataUtils {
Utils.log("Gid", gid);
PreferenceManager.getDefaultSharedPreferences(HaloApp.getInstance().getApplication()).edit().putString(Constants.DEVICE_KEY, gid).apply();
String originalGid = HaloApp.getInstance().getGid();
HaloApp.getInstance().setGid(gid);
// gid 变更时上报 gid 变更日志
if (!TextUtils.isEmpty(originalGid) && !originalGid.equals(gid)) {
NewFlatLogUtils.logGidChanged(originalGid, gid);
// 默认用 APP 级已存储的 GID 来使用,不使用外部 GID
String savedGid = SPUtils.getString(Constants.GID);
if (!TextUtils.isEmpty(savedGid)) {
gid = savedGid;
} else {
SPUtils.setString(Constants.GID, gid);
}
SensorsBridge.setGid(gid);
HaloApp.getInstance().setGid(gid);
// 更新广告配置
ExtensionsKt.doOnMainProcessOnly(HaloApp.getInstance(), () -> {
AdDelegateHelper.INSTANCE.requestAdConfig(false, "", null);
});
// 避免重复调用
if (!TextUtils.isEmpty(gid) && !gid.equals(originalGid)) {
GameSubstituteRepositoryHelper.updateSubstitutableGames();
if (!TextUtils.isEmpty(gid)) {
GameSubstituteRepositoryHelper.updateHistoricInstalledGameSet();
}
getDeviceCertification(gid);
@ -172,9 +178,11 @@ public class DataUtils {
if (idCardEntity != null) {
boolean isCertificated = !TextUtils.isEmpty(data.getIdCard().getId());
boolean isAdult = data.getIdCard().getMinor() == null || !data.getIdCard().getMinor();
boolean isCertificating = data.getIdCard().getStatus() == 1;
values.put(GhContentProvider.KEY_IS_CERTIFICATED, isCertificated); // 是否认证
values.put(GhContentProvider.KEY_IS_ADULT, isAdult); // 是否成年
values.put(GhContentProvider.KEY_IS_CERTIFICATING, isCertificating); // 是否认证中
if (!isCertificated) {
RealNameHelper.updateCertificationStatus(0);
@ -188,6 +196,7 @@ public class DataUtils {
} else {
values.put(GhContentProvider.KEY_IS_CERTIFICATED, false);
values.put(GhContentProvider.KEY_IS_ADULT, false);
values.put(GhContentProvider.KEY_IS_CERTIFICATING, false);
RealNameHelper.updateCertificationStatus(0);
}

View File

@ -1,16 +1,20 @@
package com.gh.common.util;
import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
import com.gh.common.constant.Config;
import com.gh.common.filter.RegionSetting;
import com.gh.common.filter.RegionSettingHelper;
import com.gh.common.repository.ReservationRepository;
import com.gh.common.simulator.SimulatorGameManager;
import com.gh.gamecenter.feature.view.DownloadButton;
import com.gh.common.xapk.XapkInstaller;
import com.gh.common.xapk.XapkUnzipStatus;
import com.gh.gamecenter.feature.entity.GameEntity;
import com.gh.gamecenter.feature.entity.PluginLocation;
import com.gh.gamecenter.feature.view.DownloadButton;
import com.gh.download.DownloadManager;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.DetailViewHolder;
@ -18,7 +22,6 @@ import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.entity.LinkEntity;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.core.utils.SPUtils;
import com.gh.gamecenter.feature.entity.PluginLocation;
import com.gh.gamecenter.manager.PackagesManager;
import com.gh.vspace.VHelper;
import com.lightgame.download.DownloadEntity;
@ -30,163 +33,125 @@ import java.util.Objects;
* Created by khy on 27/06/17.
* 详情下载工具类
*/
public class DetailDownloadUtils {
public static void detailInitDownload(DetailViewHolder viewHolder, boolean isCheck) {
String downloadAddWord = viewHolder.gameEntity.getDownloadAddWord();
public static void updateViewHolder(DetailViewHolder viewHolder) {
updateViewHolder(viewHolder, false);
}
/**
* 更新底部下载区域
* @param viewHolder 下载区域的包裹
* @param ignoreDownloadEntity 忽略下载实体(往往用于下载异常时)
*/
public static void updateViewHolder(DetailViewHolder viewHolder, boolean ignoreDownloadEntity) {
GameEntity gameEntity = viewHolder.getGameEntity();
String downloadAddWord = gameEntity.getDownloadAddWord();
// 隐藏下载按钮上的畅玩文案
if (viewHolder.getOverlayTv() != null) {
viewHolder.getOverlayTv().setVisibility(View.GONE);
}
if (viewHolder.mMultiVersionDownloadTv != null) {
viewHolder.mMultiVersionDownloadTv.setVisibility(View.GONE);
// 多版本下载箭头
if (viewHolder.getMultiVersionDownloadTv() != null) {
viewHolder.getMultiVersionDownloadTv().setVisibility(View.GONE);
}
if (viewHolder.gameEntity != null && Config.isShowDownload(viewHolder.gameEntity.getId()) && !"光环助手".equals(viewHolder.gameEntity.getName())) {
viewHolder.downloadBottom.setVisibility(View.VISIBLE);
// 根据预置的配置更新 ViewHolder 的状态 (譬如青少年模式、下载内容为空等)
if (updateViewHolderWithPredefinedConfig(viewHolder, gameEntity)) {
return;
}
// 游戏只包含单 APK 的情况
if (gameEntity.getApk().size() == 1) {
boolean showVGame = false; // 真下载按钮(DownloadButton)是否需要显示为畅玩,包括单按钮显示和双按钮显示
boolean showDualDownloadButton = false; // 是否显示双下载按钮
int gameDownloadMode = gameEntity.getGameDownloadButtonMode(); // 获取游戏的下载按钮模式
DownloadEntity downloadEntity = null;
if (!ignoreDownloadEntity) {
downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity);
}
// 不支持双下载按钮的情况时(新闻详情、礼包详情页),优选一个下载方式显示
if (!viewHolder.isSupportDualButton()) {
boolean performAsVGame = GameUtils.shouldPerformAsVGame(gameEntity);
if (performAsVGame) {
gameDownloadMode = GameEntity.GAME_DOWNLOAD_BUTTON_MODE_VGAME;
} else {
gameDownloadMode = GameEntity.GAME_DOWNLOAD_BUTTON_MODE_DOWNLOAD;
}
}
if (gameDownloadMode == GameEntity.GAME_DOWNLOAD_BUTTON_MODE_DOWNLOAD) {
showVGame = false;
if (viewHolder.getLocalDownloadContainer() != null) {
viewHolder.getLocalDownloadContainer().setVisibility(View.GONE);
}
} else if (gameDownloadMode == GameEntity.GAME_DOWNLOAD_BUTTON_MODE_VGAME) {
showVGame = true;
if (viewHolder.getLocalDownloadContainer() != null) {
viewHolder.getLocalDownloadContainer().setVisibility(View.GONE);
}
} else if (gameDownloadMode == GameEntity.GAME_DOWNLOAD_BUTTON_MODE_DUAL) {
showVGame = true;
showDualDownloadButton = true;
if (viewHolder.getLocalDownloadContainer() != null) {
viewHolder.getLocalDownloadContainer().setVisibility(View.VISIBLE);
}
// 畅玩未安装,且当前下载的默认类型为"普通下载",且用户未安装时,禁用双按钮,禁用畅玩
if (!VHelper.isInstalled(gameEntity.getUniquePackageName())
&& !PackagesManager.isInstalled(gameEntity.getUniquePackageName())
&& downloadEntity != null
&& ExtensionsKt.isLocalDownloadInDualDownloadMode(downloadEntity)
) {
viewHolder.getDownloadPb().setVisibility(View.GONE);
if (viewHolder.getOverlayTv() != null) {
viewHolder.getOverlayTv().setVisibility(View.GONE);
}
} else {
viewHolder.getDownloadPb().setVisibility(View.VISIBLE);
}
}
// 更新默认的下载按钮
updateWithSingleApk(
gameEntity,
viewHolder,
viewHolder.getDownloadPb(),
downloadAddWord,
showVGame,
showDualDownloadButton,
downloadEntity
);
if (showDualDownloadButton) {
// 双下载按钮时更新占位的下载按钮
updateWithSingleApk(
gameEntity,
viewHolder,
viewHolder.getLocalDownloadButton(),
downloadAddWord,
false,
true,
downloadEntity
);
}
} else {
viewHolder.downloadBottom.setVisibility(View.GONE);
return;
}
if (SPUtils.getBoolean(Constants.SP_TEENAGER_MODE)) {
viewHolder.mDownloadPb.setText("查看");
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.TEENAGER_MODE);
return;
}
if (viewHolder.gameEntity.isSpecialDownload()) {
viewHolder.mDownloadPb.setText("查看下载资源");
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.SPECIAL_DOWNLOAD);
return;
}
if (viewHolder.gameEntity.isReservable()) {
if (!ReservationRepository.thisGameHasBeenReserved(viewHolder.gameEntity.getId())) {
if (TextUtils.isEmpty(downloadAddWord)) {
viewHolder.mDownloadPb.setText(String.format("预约" + "《%s》", viewHolder.gameEntity.getName()));
} else {
viewHolder.mDownloadPb.setText(String.format("预约" + "《%s》%s", viewHolder.gameEntity.getName(), downloadAddWord));
}
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.RESERVABLE);
} else {
viewHolder.mDownloadPb.setText("已预约《" + viewHolder.gameEntity.getName() + "");
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.RESERVED);
}
return;
}
final RegionSetting.GameH5Download gameH5Download = RegionSettingHelper.getGameH5DownloadByGameId(viewHolder.gameEntity.getId());
if (gameH5Download != null) {
viewHolder.mDownloadPb.setText(TextUtils.isEmpty(viewHolder.gameEntity.getDownloadOffText()) ? "查看详情" : viewHolder.gameEntity.getDownloadOffText());
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.NORMAL);
return;
}
if (viewHolder.gameEntity.isVGame() && !viewHolder.gameEntity.getApk().isEmpty()) {
String status = GameUtils.getDownloadBtnText(viewHolder.context, viewHolder.gameEntity, PluginLocation.only_game);
if (viewHolder.context.getString(R.string.launch).equals(status)) {
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
} else if (viewHolder.context.getString(R.string.install).equals(status)) {
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);
} else {
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.NORMAL);
}
String downloadText;
if (viewHolder.context.getString(R.string.launch).equals(status) || viewHolder.context.getString(R.string.install).equals(status) || viewHolder.context.getString(R.string.download).equals(status)) {
downloadText = "";
if (viewHolder.getOverlayTv() != null) {
viewHolder.getOverlayTv().setVisibility(View.VISIBLE);
}
} else if (viewHolder.context.getString(R.string.attempt).equals(status)) {
downloadText = status + getDownloadSizeText(viewHolder);
} else {
downloadText = status + (TextUtils.isEmpty(downloadAddWord) ? "" : downloadAddWord) + getDownloadSizeText(viewHolder);
}
viewHolder.mDownloadPb.setText(downloadText);
DownloadEntity downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(viewHolder.gameEntity);
// 在下载管理找不到下载实体,到畅玩数据库里找
if (downloadEntity == null && viewHolder.gameEntity.isVGame()) {
String packageName = viewHolder.gameEntity.getUniquePackageName();
if (!TextUtils.isEmpty(packageName)) {
downloadEntity = VHelper.getVDownloadEntitySnapshot(viewHolder.gameEntity.getId(), packageName);
}
}
if (downloadEntity != null) {
viewHolder.downloadEntity = downloadEntity;
detailInvalidate(viewHolder);
}
return;
}
if (viewHolder.gameEntity.getApk().isEmpty() || viewHolder.gameEntity.getDownloadOffStatus() != null) {
LinkEntity h5LinkEntity = viewHolder.gameEntity.getH5Link();
if (h5LinkEntity != null) {
if ("play".equals(h5LinkEntity.getType())) {
String defaultString = String.format("开始玩" + "《%s》", viewHolder.gameEntity.getName());
viewHolder.mDownloadPb.setText(TextUtils.isEmpty(h5LinkEntity.getText()) ? defaultString : h5LinkEntity.getText());
} else {
viewHolder.mDownloadPb.setText(TextUtils.isEmpty(h5LinkEntity.getText()) ? "查看" : h5LinkEntity.getText());
}
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.H5_GAME);
} else {
if ("dialog".equals(viewHolder.gameEntity.getDownloadOffStatus())) {
viewHolder.mDownloadPb.setText(TextUtils.isEmpty(viewHolder.gameEntity.getDownloadOffText()) ? "查看详情" : viewHolder.gameEntity.getDownloadOffText());
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.NONE_WITH_HINT);
} else if ("updating".equals(viewHolder.gameEntity.getDownloadOffStatus())) {
viewHolder.mDownloadPb.setText(TextUtils.isEmpty(viewHolder.gameEntity.getDownloadOffText()) ? "更新中" : viewHolder.gameEntity.getDownloadOffText());
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.UPDATING);
} else {
viewHolder.mDownloadPb.setText(TextUtils.isEmpty(viewHolder.gameEntity.getDownloadOffText()) ? "暂无下载" : viewHolder.gameEntity.getDownloadOffText());
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.NONE);
}
}
} else if (viewHolder.gameEntity.getApk().size() == 1) {
String status = GameUtils.getDownloadBtnText(viewHolder.context, viewHolder.gameEntity, PluginLocation.only_game);
if (viewHolder.context.getString(R.string.pluggable).equals(status)) {
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.PLUGIN);
} else if (viewHolder.context.getString(R.string.launch).equals(status)) {
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
} else if (viewHolder.context.getString(R.string.install).equals(status)) {
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);
} else {
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.NORMAL);
}
String downloadText;
if (viewHolder.isNewsDetail) {
downloadText = status;
} else if (viewHolder.context.getString(R.string.pluggable).equals(status)) {
downloadText = "升级" + (TextUtils.isEmpty(downloadAddWord) ? "" : "" + downloadAddWord) + getDownloadSizeText(viewHolder);
} else if (viewHolder.context.getString(R.string.launch).equals(status)) {
downloadText = status + (TextUtils.isEmpty(downloadAddWord) ? "" : "-" + downloadAddWord);
} else if (viewHolder.context.getString(R.string.attempt).equals(status)) {
downloadText = status + getDownloadSizeText(viewHolder);
} else if (viewHolder.context.getString(R.string.install).equals(status)) {
downloadText = viewHolder.context.getString(R.string.install);
} else {
downloadText = status + (TextUtils.isEmpty(downloadAddWord) ? "" : downloadAddWord) + getDownloadSizeText(viewHolder);
}
viewHolder.mDownloadPb.setText(downloadText);
} else {
viewHolder.mMultiVersionDownloadTv.setText("选择下载你的版本" + (TextUtils.isEmpty(downloadAddWord) ? "" : "-" + downloadAddWord));
viewHolder.mMultiVersionDownloadTv.setVisibility(View.VISIBLE);
viewHolder.mDownloadPb.setText("");
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.NORMAL);
DownloadEntity downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(viewHolder.gameEntity);
// 游戏包含多 APK 的情况
viewHolder.getMultiVersionDownloadTv().setText("选择下载你的版本" + (TextUtils.isEmpty(downloadAddWord) ? "" : "-" + downloadAddWord));
viewHolder.getMultiVersionDownloadTv().setVisibility(View.VISIBLE);
viewHolder.getDownloadPb().setText("");
viewHolder.getDownloadPb().setButtonStyle(DownloadButton.ButtonStyle.NORMAL);
DownloadEntity downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity);
if (downloadEntity != null) {
switch (downloadEntity.getStatus()) {
case downloading:
viewHolder.mDownloadTips.setVisibility(View.VISIBLE);
ExtensionsKt.setDownloadTipsAnimation(viewHolder.mDownloadTips, true);
viewHolder.getDownloadTips().setVisibility(View.VISIBLE);
ExtensionsKt.setDownloadTipsAnimation(viewHolder.getDownloadTips(), true);
break;
case done:
case pause:
@ -195,73 +160,347 @@ public class DetailDownloadUtils {
case subscribe:
case neterror:
case overflow:
viewHolder.mDownloadTips.setVisibility(View.VISIBLE);
ExtensionsKt.setDownloadTipsAnimation(viewHolder.mDownloadTips, false);
viewHolder.getDownloadTips().setVisibility(View.VISIBLE);
ExtensionsKt.setDownloadTipsAnimation(viewHolder.getDownloadTips(), false);
break;
default:
viewHolder.mDownloadTips.setVisibility(View.GONE);
viewHolder.getDownloadTips().setVisibility(View.GONE);
break;
}
} else {
viewHolder.mDownloadTips.setVisibility(View.GONE);
viewHolder.getDownloadTips().setVisibility(View.GONE);
}
}
}
if (isCheck && viewHolder.gameEntity.getApk().size() == 1) {
DownloadEntity downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(viewHolder.gameEntity);
/**
* 更新只有单个 APK 文件时候的下载按钮状态
*
* @param downloadButton 下载按钮,可能是真的下载按钮也可能只是占位下载按钮
* @param downloadAddWord 下载按钮的补充文案
* @param showAsVGame 是否显示为畅玩游戏
* @param showDualDownloadButton 是否正显示为双下载按钮
*/
// 在下载管理找不到下载实体,到畅玩数据库里找
if (downloadEntity == null && viewHolder.gameEntity.isVGame()) {
String packageName = viewHolder.gameEntity.getUniquePackageName();
if (!TextUtils.isEmpty(packageName)) {
downloadEntity = VHelper.getVDownloadEntitySnapshot(viewHolder.gameEntity.getId(), packageName);
private static void updateWithSingleApk(GameEntity gameEntity,
DetailViewHolder viewHolder,
DownloadButton downloadButton,
String downloadAddWord,
boolean showAsVGame,
boolean showDualDownloadButton,
DownloadEntity downloadEntity) {
Context context = viewHolder.getContext();
TextView overlayTv = viewHolder.getOverlayTv();
String status = GameUtils.getDownloadBtnText(context, gameEntity, false, showAsVGame, PluginLocation.only_game);
if (showAsVGame) {
// 显示为畅玩游戏
if (context.getString(R.string.launch).equals(status)) {
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
} else {
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.NORMAL);
}
String btnText;
if (showDualDownloadButton
&& (context.getString(R.string.launch).equals(status) || context.getString(R.string.install).equals(status) || context.getString(R.string.smooth).equals(status) || context.getString(R.string.update).equals(status))) {
if (context.getString(R.string.smooth).equals(status)) {
btnText = context.getString(R.string.download_v);
} else if (context.getString(R.string.update).equals(status)) {
btnText = context.getString(R.string.update_v);
} else {
btnText = context.getString(R.string.launch_v);
}
if (overlayTv != null && downloadButton.getVisibility() != View.GONE) {
overlayTv.setVisibility(View.VISIBLE);
overlayTv.setText(btnText);
downloadButton.setText("");
}
} else {
btnText = status + (TextUtils.isEmpty(downloadAddWord) ? "" : downloadAddWord) + getDownloadSizeText(viewHolder);
if (overlayTv != null && downloadButton.getVisibility() != View.GONE) {
if (context.getString(R.string.launch).equals(status)
|| context.getString(R.string.install).equals(status)) {
overlayTv.setVisibility(View.VISIBLE);
overlayTv.setText("启动(畅玩)");
} else {
overlayTv.setVisibility(View.GONE);
downloadButton.setText(btnText);
}
} else {
if (overlayTv != null) {
overlayTv.setVisibility(View.GONE);
}
downloadButton.setText(btnText);
}
}
if (downloadEntity != null) {
viewHolder.downloadEntity = downloadEntity;
detailInvalidate(viewHolder);
// 在下载管理找不到下载实体,到畅玩数据库里找
if (downloadEntity == null) {
String packageName = gameEntity.getUniquePackageName();
if (!TextUtils.isEmpty(packageName)) {
downloadEntity = VHelper.getVDownloadEntitySnapshot(gameEntity.getId(), packageName);
}
}
} else {
// 非畅玩,显示为普通游戏
if (context.getString(R.string.pluggable).equals(status)) {
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.PLUGIN);
} else if (context.getString(R.string.launch).equals(status)) {
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
} else if (context.getString(R.string.install).equals(status)) {
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);
} else {
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.NORMAL);
}
if (showDualDownloadButton && viewHolder.getLocalDownloadSizeTv() != null) {
viewHolder.getLocalDownloadSizeTv().setVisibility(View.GONE);
String size = viewHolder.getGameEntity().getApk().get(0).getSize();
if (size != null) {
String sizeWithoutDigit = size.replaceAll("(?<=\\d)\\.[0-9]+(?!\\d)", "");
viewHolder.getLocalDownloadSizeTv().setText(sizeWithoutDigit);
}
// 若双下载按钮时,下载的游戏是以畅玩游戏下载的,把 downloadEntity 置空,避免把按钮更新到错误的状态
if (downloadEntity != null && ExtensionsKt.isVGameDownloadInDualDownloadMode(downloadEntity)) {
downloadEntity = null;
}
}
String btnText;
String extraBtnText;
if (viewHolder.isNewsDetail()) {
btnText = status;
extraBtnText = status;
} else if (context.getString(R.string.pluggable).equals(status)) {
btnText = "升级" + (TextUtils.isEmpty(downloadAddWord) ? "" : "" + downloadAddWord) + getDownloadSizeText(viewHolder);
extraBtnText = "升级" + (TextUtils.isEmpty(downloadAddWord) ? "" : "" + downloadAddWord);
} else if (context.getString(R.string.launch).equals(status)) {
btnText = status + (TextUtils.isEmpty(downloadAddWord) ? "" : "-" + downloadAddWord);
extraBtnText = context.getString(R.string.launch_local);
} else if (context.getString(R.string.attempt).equals(status)) {
btnText = status + getDownloadSizeText(viewHolder);
extraBtnText = status;
if (showDualDownloadButton
&& viewHolder.getLocalDownloadContainer() != null
&& viewHolder.getLocalDownloadContainer().getVisibility() == View.VISIBLE) {
viewHolder.getLocalDownloadSizeTv().setVisibility(View.VISIBLE);
}
} else if (context.getString(R.string.install).equals(status)) {
btnText = context.getString(R.string.install);
extraBtnText = context.getString(R.string.install_local);
} else if (context.getString(R.string.update).equals(status)) {
btnText = context.getString(R.string.update);
extraBtnText = context.getString(R.string.update_local);
if (showDualDownloadButton
&& viewHolder.getLocalDownloadContainer() != null
&& viewHolder.getLocalDownloadContainer().getVisibility() == View.VISIBLE) {
viewHolder.getLocalDownloadSizeTv().setVisibility(View.VISIBLE);
}
} else {
btnText = status + (TextUtils.isEmpty(downloadAddWord) ? "" : downloadAddWord) + getDownloadSizeText(viewHolder);
extraBtnText = context.getString(R.string.download_local);
if (showDualDownloadButton
&& viewHolder.getLocalDownloadContainer() != null
&& viewHolder.getLocalDownloadContainer().getVisibility() == View.VISIBLE) {
viewHolder.getLocalDownloadSizeTv().setVisibility(View.VISIBLE);
}
}
downloadButton.setText(btnText);
if (viewHolder.getLocalDownloadTitleTv() != null) {
viewHolder.getLocalDownloadTitleTv().setText(extraBtnText);
}
}
if (overlayTv != null && overlayTv.getVisibility() == View.VISIBLE) {
downloadButton.setTag(R.string.download, overlayTv.getText());
} else {
downloadButton.setTag(R.string.download, downloadButton.getText());
}
if (downloadEntity == null) return;
if (handleDownloadButtonAsXapk(downloadEntity, downloadButton)) {
return;
}
// 非完成状态显示下载按钮
if (downloadEntity.getStatus() != DownloadStatus.done) {
viewHolder.getDownloadPb().setVisibility(View.VISIBLE);
}
// 存在未完成的下载任务或不显示双按钮时,隐藏本地下载按钮
if (viewHolder.getLocalDownloadContainer() != null) {
if (downloadEntity.getStatus() != DownloadStatus.done) {
viewHolder.getLocalDownloadContainer().setVisibility(View.GONE);
} else if (showDualDownloadButton) {
viewHolder.getLocalDownloadContainer().setVisibility(View.VISIBLE);
} else {
viewHolder.getLocalDownloadContainer().setVisibility(View.GONE);
}
}
downloadButton.setProgress((int) (downloadEntity.getPercent() * 10));
if (overlayTv != null
&& downloadEntity.getStatus() != DownloadStatus.done) {
overlayTv.setVisibility(View.GONE);
}
if (showAsVGame) {
updateVStyleDownloadButton(viewHolder, downloadButton, downloadEntity, status);
} else {
updateDefaultStyleDownloadButton(context, viewHolder, downloadButton, gameEntity, downloadEntity);
}
}
/**
* 根据预置的配置更新 ViewHolder 的状态
*
* @return 是否已经是最终状态,返回 true 表示已应用当前配置,返回 false 表示不应用当前配置
*/
private static boolean updateViewHolderWithPredefinedConfig(DetailViewHolder viewHolder, GameEntity gameEntity) {
String downloadAddWord = gameEntity.getDownloadAddWord();
// 不满足条件的部分游戏隐藏下载按钮
if (Config.isShowDownload(gameEntity.getId())
&& !"光环助手".equals(gameEntity.getName())) {
viewHolder.getDownloadBottom().setVisibility(View.VISIBLE);
} else {
viewHolder.getDownloadBottom().setVisibility(View.GONE);
return true;
}
// 青少年模式显示为查看
if (SPUtils.getBoolean(Constants.SP_TEENAGER_MODE)) {
viewHolder.getDownloadPb().setText("查看");
viewHolder.getDownloadPb().setButtonStyle(DownloadButton.ButtonStyle.TEENAGER_MODE);
return true;
}
// 预约
if (gameEntity.isReservable()) {
if (!ReservationRepository.thisGameHasBeenReserved(gameEntity.getId())) {
if (TextUtils.isEmpty(downloadAddWord)) {
viewHolder.getDownloadPb().setText(String.format("预约" + "《%s》", gameEntity.getName()));
} else {
viewHolder.getDownloadPb().setText(String.format("预约" + "《%s》%s", gameEntity.getName(), downloadAddWord));
}
viewHolder.getDownloadPb().setButtonStyle(DownloadButton.ButtonStyle.RESERVABLE);
} else {
viewHolder.getDownloadPb().setText("已预约《" + gameEntity.getName() + "");
viewHolder.getDownloadPb().setButtonStyle(DownloadButton.ButtonStyle.RESERVED);
}
return true;
}
// 国际服 H5 弹窗
final RegionSetting.GameH5Download gameH5Download = RegionSettingHelper.getGameH5DownloadByGameId(gameEntity.getId());
if (gameH5Download != null) {
viewHolder.getDownloadPb().setText(TextUtils.isEmpty(gameEntity.getDownloadOffText()) ? "查看详情" : gameEntity.getDownloadOffText());
viewHolder.getDownloadPb().setButtonStyle(DownloadButton.ButtonStyle.NORMAL);
return true;
}
// 特殊下载
if (gameEntity.isSpecialDownload()) {
viewHolder.getDownloadPb().setText("查看下载资源");
viewHolder.getDownloadPb().setButtonStyle(DownloadButton.ButtonStyle.SPECIAL_DOWNLOAD);
return true;
}
// 处理不存在 APK 文件或游戏状态为关闭时的情况
if (gameEntity.getApk().isEmpty() || gameEntity.getDownloadOffStatus() != null) {
LinkEntity h5LinkEntity = gameEntity.getH5Link();
if (h5LinkEntity != null) {
if ("play".equals(h5LinkEntity.getType())) {
String defaultString = String.format("开始玩" + "《%s》", gameEntity.getName());
viewHolder.getDownloadPb().setText(TextUtils.isEmpty(h5LinkEntity.getText()) ? defaultString : h5LinkEntity.getText());
} else {
viewHolder.getDownloadPb().setText(TextUtils.isEmpty(h5LinkEntity.getText()) ? "查看" : h5LinkEntity.getText());
}
viewHolder.getDownloadPb().setButtonStyle(DownloadButton.ButtonStyle.H5_GAME);
} else {
if ("dialog".equals(gameEntity.getDownloadOffStatus())) {
viewHolder.getDownloadPb().setText(TextUtils.isEmpty(gameEntity.getDownloadOffText()) ? "查看详情" : gameEntity.getDownloadOffText());
viewHolder.getDownloadPb().setButtonStyle(DownloadButton.ButtonStyle.NONE_WITH_HINT);
} else if ("updating".equals(gameEntity.getDownloadOffStatus())) {
viewHolder.getDownloadPb().setText(TextUtils.isEmpty(gameEntity.getDownloadOffText()) ? "更新中" : gameEntity.getDownloadOffText());
viewHolder.getDownloadPb().setButtonStyle(DownloadButton.ButtonStyle.UPDATING);
} else {
viewHolder.getDownloadPb().setText(TextUtils.isEmpty(gameEntity.getDownloadOffText()) ? "暂无下载" : gameEntity.getDownloadOffText());
viewHolder.getDownloadPb().setButtonStyle(DownloadButton.ButtonStyle.NONE);
}
}
return true;
}
return false;
}
private static String getDownloadSizeText(DetailViewHolder viewHolder) {
return String.format("%s", viewHolder.gameEntity.getApk().get(0).getSize());
return String.format("%s", viewHolder.getGameEntity().getApk().get(0).getSize());
}
public static void detailInvalidate(DetailViewHolder viewHolder) {
DownloadEntity downloadEntity = viewHolder.downloadEntity;
String xapkStatus = downloadEntity.getMeta().get(XapkInstaller.XAPK_UNZIP_STATUS);
private static void updateVStyleDownloadButton(DetailViewHolder viewHolder,
DownloadButton downloadButton,
DownloadEntity downloadEntity,
String status) {
switch (downloadEntity.getStatus()) {
case redirected:
case downloading:
downloadButton.setText("游戏加载中 " + downloadEntity.getPercent() + "%");
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
break;
case waiting:
downloadButton.setText(R.string.waiting);
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.WAITING);
break;
case overflow:
case timeout:
case neterror:
case subscribe:
case diskisfull:
case diskioerror:
case pause:
downloadButton.setText("继续加载 " + downloadEntity.getPercent() + "%");
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
break;
case done:
if (!status.contains("更新")) {
if (VHelper.isInstalled(downloadEntity.getPackageName())) {
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
} else {
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);
}
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 + "%");
viewHolder.mDownloadPb.setProgress((int) (Float.valueOf(percent) * 10));
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.XAPK_UNZIPPING);
return;
} else if (XapkUnzipStatus.FAILURE.name().equals(xapkStatus)) {
viewHolder.mDownloadPb.setText(R.string.install);
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.XAPK_FAILURE);
return;
}
viewHolder.mDownloadPb.setProgress((int) (viewHolder.downloadEntity.getPercent() * 10));
if (viewHolder.getOverlayTv() != null) {
viewHolder.getOverlayTv().setVisibility(View.GONE);
}
if (viewHolder.gameEntity.isVGame()) {
updateVStyleButton(viewHolder);
return;
downloadButton.setText("");
}
break;
case cancel:
case hijack:
case notfound:
case uncertificated:
case unqualified:
case unavailable:
case banned:
updateViewHolder(viewHolder, true);
break;
default:
break;
}
}
private static void updateDefaultStyleDownloadButton(
Context context,
DetailViewHolder viewHolder,
DownloadButton downloadButton,
GameEntity gameEntity,
DownloadEntity downloadEntity) {
switch (downloadEntity.getStatus()) {
case timeout:
case neterror:
@ -274,55 +513,37 @@ public class DetailDownloadUtils {
case overflow:
String downloadingText = "游戏加载中 " + downloadEntity.getPercent() + "%";
String resumeText = "继续加载 " + downloadEntity.getPercent() + "%";
viewHolder.mDownloadPb.setText((downloadEntity.getStatus() == DownloadStatus.downloading || downloadEntity.getStatus() == DownloadStatus.redirected) ? downloadingText : resumeText);
downloadButton.setText((downloadEntity.getStatus() == DownloadStatus.downloading || downloadEntity.getStatus() == DownloadStatus.redirected) ? downloadingText : resumeText);
if (downloadEntity.isPluggable() && PackagesManager.isInstalled(downloadEntity.getPackageName())) {
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_PLUGIN);
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_PLUGIN);
} else {
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
}
break;
case waiting:
viewHolder.mDownloadPb.setText(R.string.waiting);
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.WAITING);
downloadButton.setText(R.string.waiting);
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.WAITING);
break;
case done:
if (SimulatorGameManager.isSimulatorGame(viewHolder.gameEntity)) {
boolean isInstalled = PackageUtils.isInstalledFromAllPackage(viewHolder.context, viewHolder.gameEntity.getSimulator().getApk().getPackageName());
boolean isInstalledNewSimulator = SimulatorGameManager.isNewSimulatorInstalled(viewHolder.context);
if (SimulatorGameManager.isSimulatorGame(gameEntity)) {
boolean isInstalled = PackageUtils.isInstalledFromAllPackage(context, gameEntity.getSimulator().getApk().getPackageName());
boolean isInstalledNewSimulator = SimulatorGameManager.isNewSimulatorInstalled(context);
if (isInstalled || isInstalledNewSimulator) {
viewHolder.mDownloadPb.setText(R.string.launch);
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
downloadButton.setText(R.string.launch);
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
} else {
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);
downloadButton.setText(R.string.browser_install_install);
} else {
viewHolder.mDownloadPb.setText(R.string.install);
}
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);
}
} else if (viewHolder.gameEntity.isVGame()) {
if (!viewHolder.mDownloadPb.getText().toString().contains("更新")) {
if (VHelper.isInstalled(downloadEntity.getPackageName())) {
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
} else {
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);
}
viewHolder.mDownloadPb.setText("");
if (viewHolder.getOverlayTv() != null) {
viewHolder.getOverlayTv().setVisibility(View.VISIBLE);
downloadButton.setText(R.string.install);
}
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);
}
} else {
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);
downloadButton.setText(R.string.browser_install_install);
} else {
viewHolder.mDownloadPb.setText(R.string.install);
}
if (downloadEntity.isPluggable() && PackagesManager.isInstalled(downloadEntity.getPackageName())) {
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_PLUGIN);
} else {
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);
downloadButton.setText(R.string.install);
}
}
@ -334,50 +555,35 @@ public class DetailDownloadUtils {
case unqualified:
case unavailable:
case banned:
detailInitDownload(viewHolder, false);
updateViewHolder(viewHolder, true);
break;
default:
break;
}
}
private static void updateVStyleButton(DetailViewHolder viewHolder) {
switch (viewHolder.downloadEntity.getStatus()) {
case redirected:
case downloading:
viewHolder.mDownloadPb.setText("游戏加载中 " + viewHolder.downloadEntity.getPercent() + "%");
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
break;
case waiting:
viewHolder.mDownloadPb.setText(R.string.waiting);
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
break;
case overflow:
case timeout:
case neterror:
case subscribe:
case diskisfull:
case diskioerror:
case pause:
viewHolder.mDownloadPb.setText("继续加载 " + viewHolder.downloadEntity.getPercent() + "%");
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
break;
case done:
if (!viewHolder.mDownloadPb.getText().toString().contains("更新")) {
if (VHelper.isInstalled(viewHolder.downloadEntity.getPackageName())) {
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
} else {
viewHolder.mDownloadPb.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);
}
private static boolean handleDownloadButtonAsXapk(DownloadEntity downloadEntity, DownloadButton downloadButton) {
String xapkStatus = downloadEntity.getMeta().get(XapkInstaller.XAPK_UNZIP_STATUS);
viewHolder.mDownloadPb.setText("");
if (viewHolder.getOverlayTv() != null) {
viewHolder.getOverlayTv().setVisibility(View.VISIBLE);
}
}
break;
default:
break;
if (XapkUnzipStatus.SUCCESS.name().equals(xapkStatus) && XapkInstaller.INSTANCE.isInstalling(downloadEntity.getPath())) {
downloadButton.setText("游戏安装中");
downloadButton.setProgress(100);
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);
return true;
}
if (XapkUnzipStatus.UNZIPPING.name().equals(xapkStatus)) {
String percent = downloadEntity.getMeta().get(XapkInstaller.XAPK_UNZIP_PERCENT);
downloadButton.setText("游戏解压中 " + percent + "%");
downloadButton.setProgress((int) (Float.valueOf(percent) * 10));
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.XAPK_UNZIPPING);
return true;
} else if (XapkUnzipStatus.FAILURE.name().equals(xapkStatus)) {
downloadButton.setText(R.string.install);
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.XAPK_FAILURE);
return true;
}
return false;
}
}

View File

@ -11,16 +11,9 @@ import android.net.Uri;
import android.os.CountDownTimer;
import android.provider.Settings;
import android.text.Html;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.text.style.URLSpan;
import android.text.style.UnderlineSpan;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -35,9 +28,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.facebook.drawee.generic.GenericDraweeHierarchy;
import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.common.constant.Config;
import com.gh.common.filter.RegionSetting;
@ -45,11 +36,9 @@ import com.gh.common.xapk.XapkDialogHelper;
import com.gh.gamecenter.R;
import com.gh.gamecenter.ShellActivity;
import com.gh.gamecenter.adapter.ReportReasonAdapter;
import com.gh.gamecenter.adapter.viewholder.PrivacyPolicyItemViewHolder;
import com.gh.gamecenter.common.base.TrackableDialog;
import com.gh.gamecenter.common.callback.CancelListener;
import com.gh.gamecenter.common.callback.ConfirmListener;
import com.gh.gamecenter.common.callback.SimpleCallback;
import com.gh.gamecenter.common.databinding.DialogAlertDefaultBinding;
import com.gh.gamecenter.common.entity.SimpleGameEntity;
import com.gh.gamecenter.common.entity.SuggestType;
@ -58,9 +47,7 @@ import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.gamecenter.common.utils.NetworkUtils;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.common.view.CustomLinkMovementMethod;
import com.gh.gamecenter.common.view.DrawableView;
import com.gh.gamecenter.common.view.FixLinearLayoutManager;
import com.gh.gamecenter.common.view.MaxHeightLinearLayout;
import com.gh.gamecenter.common.view.MaxHeightNestedScrollView;
import com.gh.gamecenter.common.view.VerticalItemDecoration;
@ -78,10 +65,7 @@ import com.gh.gamecenter.databinding.DialogRelievePhoneBinding;
import com.gh.gamecenter.databinding.DialogReportReasonBinding;
import com.gh.gamecenter.databinding.DialogWechatReserveSuccessBinding;
import com.gh.gamecenter.databinding.ImprintContentItemBinding;
import com.gh.gamecenter.databinding.PrivacyItemBinding;
import com.gh.gamecenter.entity.BadgeEntity;
import com.gh.gamecenter.entity.PermissionsEntity;
import com.gh.gamecenter.entity.PrivacyPolicyEntity;
import com.gh.gamecenter.entity.TrackableEntity;
import com.gh.gamecenter.feature.entity.ApkEntity;
import com.gh.gamecenter.feature.entity.Badge;
@ -89,7 +73,6 @@ import com.gh.gamecenter.feature.entity.GameEntity;
import com.gh.gamecenter.feature.entity.SettingsEntity;
import com.gh.gamecenter.help.HelpAndFeedbackBridge;
import com.gh.gamecenter.setting.SettingBridge;
import com.lightgame.adapter.BaseRecyclerAdapter;
import com.lightgame.download.DownloadEntity;
import com.lightgame.utils.AppManager;
import com.lightgame.utils.Util_System_Keyboard;
@ -121,7 +104,7 @@ public class DialogUtils {
return dialog;
}
public static void checkDownload(Context context, String size, String gameId, String gameName, CheckDownloadCallBack callBack) {
public static void checkDownload(Context context, String size, String gameId, String gameName, String gameCategoryChinese, CheckDownloadCallBack callBack) {
if (!NetworkUtils.isNetworkConnected(context)) {
showNoConnectionDownloadDialog(context, () -> {
},
@ -138,7 +121,8 @@ public class DialogUtils {
() -> callBack.onResponse(false),
() -> callBack.onResponse(true),
gameId,
gameName);
gameName,
gameCategoryChinese);
}
}
@ -167,7 +151,9 @@ public class DialogUtils {
DialogHelper.showDialog(context, "下载提示", "网络异常,请检查手机网络状态", "知道了", "WiFi自动下载", listener::onConfirm, cancelListener::onCancel, false, "", "");
}
public static void showDownloadDialog(Context context, ConfirmListener listener, CancelListener cancelListener, String gameId, String gameName) {
public static void showDownloadDialog(Context context, ConfirmListener listener, CancelListener cancelListener, String gameId, String gameName, String gameCategoryChinese) {
SensorsBridge.trackDownloadMobileDataDialogShow(gameId, gameName, gameCategoryChinese);
context = checkDialogContext(context);
NewFlatLogUtils.logDownloadMobileDataDialogShow(gameId, gameName);
@ -182,6 +168,7 @@ public class DialogUtils {
Context finalContext = context;
allowOnce.setOnClickListener(v -> {
NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "允许一次");
SensorsBridge.trackDownloadMobileDataDialogClick("允许一次", gameId, gameName, gameCategoryChinese);
AppExecutor.getUiExecutor().executeWithDelay(() -> {
Utils.toast(finalContext, "已使用移动网络下载,请注意流量消耗");
}, 500);
@ -191,12 +178,14 @@ public class DialogUtils {
});
wifiAuto.setOnClickListener(v -> {
NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "WiFi自动下载");
SensorsBridge.trackDownloadMobileDataDialogClick("WiFi自动下载", gameId, gameName, gameCategoryChinese);
cancelListener.onCancel();
dialog.dismiss();
// MtaHelper.onEvent("移动网络下载", NetworkUtils.getMobileNetworkType(finalContext), "连上WiFi后自动下载");
});
allowAlways.setOnClickListener(v -> {
NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "总是允许");
SensorsBridge.trackDownloadMobileDataDialogClick("总是允许", gameId, gameName, gameCategoryChinese);
SPUtils.setBoolean(getTrafficDownloadHintKey(), false);
AppExecutor.getUiExecutor().executeWithDelay(() -> {
// 显示了弹窗以后,即便下面这个 toast 放在 listener.onConfirm 后调用也是显示 listener.onConfirm 里的 toast
@ -208,7 +197,10 @@ public class DialogUtils {
// MtaHelper.onEvent("移动网络下载", NetworkUtils.getMobileNetworkType(finalContext), "总是允许");
});
dialog.setOnCancelListener(downloadDialog -> NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "关闭弹窗"));
dialog.setOnCancelListener(downloadDialog -> {
NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "关闭弹窗");
SensorsBridge.trackDownloadMobileDataDialogClick("关闭弹窗", gameId, gameName, gameCategoryChinese);
});
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(contentView);
@ -317,180 +309,7 @@ public class DialogUtils {
return dialog;
}
public static void showPrivacyPolicyDialog(Context context,
@NonNull PrivacyPolicyEntity entity,
SimpleCallback<Boolean> callback) {
final Context activityContext = checkDialogContext(context);
// 区分此 dialog 是点击 dialog 外部取消的还是点击返回取消的
AtomicBoolean isCanceledByClickOutsideOfDialog = new AtomicBoolean(true);
final Dialog dialog = new Dialog(activityContext, R.style.GhAlertDialog);
View contentView = LayoutInflater.from(activityContext).inflate(R.layout.dialog_privacy_policy, null);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(contentView);
Window window = dialog.getWindow();
if (window != null) {
window.setBackgroundDrawableResource(android.R.color.transparent);
WindowManager.LayoutParams params = window.getAttributes();
params.horizontalMargin = 0;
params.width = context.getResources().getDisplayMetrics().widthPixels - DisplayUtils.dip2px(40);
// int height = context.getResources().getDisplayMetrics().heightPixels - DisplayUtils.dip2px(120);
// int maxHeight = DisplayUtils.dip2px(446);
// if (height > maxHeight) {
// params.height = maxHeight;
// } else {
// params.height = height;
// }
window.setAttributes(params);
}
TextView title = contentView.findViewById(R.id.title);
TextView bottomContent = contentView.findViewById(R.id.bottom_content);
TextView topContent = contentView.findViewById(R.id.top_content);
TextView allowButton = contentView.findViewById(R.id.allow_button);
TextView disallowButton = contentView.findViewById(R.id.disallow_button);
TextView linkContent = contentView.findViewById(R.id.link_content);
RecyclerView permissions = contentView.findViewById(R.id.permissions_content);
permissions.setLayoutManager(new FixLinearLayoutManager(context));
permissions.setAdapter(new BaseRecyclerAdapter(context) {
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = mLayoutInflater.inflate(R.layout.privacy_item, parent, false);
return new PrivacyPolicyItemViewHolder(PrivacyItemBinding.bind(view));
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if (holder instanceof PrivacyPolicyItemViewHolder) {
PrivacyPolicyItemViewHolder viewHolder = (PrivacyPolicyItemViewHolder) holder;
PrivacyItemBinding binding = viewHolder.getBinding();
final PermissionsEntity permissionsEntity = entity.getPermissions().get(position);
ImageUtils.display(binding.icon, permissionsEntity.getIcon());
binding.name.setText(permissionsEntity.getName());
binding.intro.setText(permissionsEntity.getIntro());
GenericDraweeHierarchy hierarchy = binding.icon.getHierarchy();
if (hierarchy != null) {
if (position == 0) {
hierarchy.setPlaceholderImage(R.drawable.permission_storage);
} else if (position == 1) {
hierarchy.setPlaceholderImage(R.drawable.permission_phone_state);
}
}
}
}
@Override
public int getItemCount() {
return entity.getPermissions().size();
}
});
SpannableStringBuilder skipText = new SpannableStringBuilder("查看完整版的隐私政策和用户协议");
skipText.setSpan(new ClickableSpan() {
@Override
public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds);
ds.setColor(ContextCompat.getColor(activityContext, R.color.theme_font));
ds.setUnderlineText(false);
}
@Override
public void onClick(@NonNull View widget) {
// MtaHelper.onEvent("隐私政策弹窗", "隐私政策弹窗", "点击隐私政策");
DirectUtils.directToExternalBrowser(context, context.getString(R.string.privacy_policy_url));
}
}, skipText.length() - 9, skipText.length() - 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
skipText.setSpan(new ClickableSpan() {
@Override
public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds);
ds.setColor(ContextCompat.getColor(activityContext, R.color.theme_font));
ds.setUnderlineText(false);
}
@Override
public void onClick(@NonNull View widget) {
// MtaHelper.onEvent("隐私政策弹窗", "隐私政策弹窗", "点击用户协议");
DirectUtils.directToExternalBrowser(context, context.getString(R.string.disclaimer_url));
}
}, skipText.length() - 4, skipText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
/*skipText.setSpan(new ClickableSpan() {
@Override
public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds);
ds.setColor(ContextCompat.getColor(activityContext, R.color.theme_font));
ds.setUnderlineText(false);
}
@Override
public void onClick(@NonNull View widget) {
// MtaHelper.onEvent("隐私政策弹窗", "隐私政策弹窗", "点击第三方SDK接入说明");
activityContext.startActivity(WebActivity.getThirdPartySdkStatementIntent(activityContext));
}
}, skipText.length() - 10, skipText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);*/
title.setText(entity.getTitle());
linkContent.setText(skipText);
linkContent.setMovementMethod(LinkMovementMethod.getInstance());
topContent.setText(entity.getTopContent());
bottomContent.setText(ExtensionsKt.fromHtml(entity.getBottomContent()));
bottomContent.setMovementMethod(CustomLinkMovementMethod.getInstance());
// Remove underline
Spannable sa = (Spannable) bottomContent.getText();
for (URLSpan u : sa.getSpans(0, sa.length(), URLSpan.class)) {
sa.setSpan(new UnderlineSpan() {
public void updateDrawState(TextPaint tp) {
tp.setUnderlineText(false);
}
}, sa.getSpanStart(u), sa.getSpanEnd(u), 0);
}
allowButton.setOnClickListener(view -> {
dialog.dismiss();
callback.onCallback(true);
// MtaHelper.onEvent("隐私政策弹窗", "隐私政策弹窗", "点击同意");
});
disallowButton.setOnClickListener(v -> {
dialog.dismiss();
callback.onCallback(false);
// showPrivacyPolicyDisallowDialog(activityContext, entity, callback);
// MtaHelper.onEvent("隐私政策弹窗", "隐私政策弹窗", "不同意并退出App");
});
dialog.setOnCancelListener(cd -> {
if (isCanceledByClickOutsideOfDialog.get()) {
// MtaHelper.onEvent("隐私政策弹窗", "隐私政策弹窗", "点击空白");
}
});
dialog.setOnKeyListener((dialog1, keyCode, event) -> {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
isCanceledByClickOutsideOfDialog.set(false);
// MtaHelper.onEvent("隐私政策弹窗", "隐私政策弹窗", "点击返回");
}
return false;
});
// 用户未同意隐私策略不应该触发 MTA 事件
// MtaHelper.onEvent("隐私政策弹窗", "隐私政策弹窗", "出现弹窗");
try {
dialog.setCancelable(false);
dialog.show();
} catch (Exception ignored) {
}
}
public static void showPrivacyPolicyDisallowDialog(Context context,
@NonNull PrivacyPolicyEntity entity,
EmptyCallback callback) {
final Context activityContext = checkDialogContext(context);
@ -536,8 +355,8 @@ public class DialogUtils {
TextView negativeTv = contentView.findViewById(R.id.negative);
TextView positiveTv = contentView.findViewById(R.id.positive);
TextView content = contentView.findViewById(R.id.content);
positiveTv.setBackground(DrawableView.getOvalDrawable(R.color.background, 999));
negativeTv.setBackground(DrawableView.getOvalDrawable(R.color.theme, 999));
positiveTv.setBackground(DrawableView.getOvalDrawable(R.color.ui_background, 999));
negativeTv.setBackground(DrawableView.getOvalDrawable(R.color.primary_theme, 999));
content.setText(Html.fromHtml(context.getString(R.string.video_upload_draft_dialog_content)));
negativeTv.setOnClickListener(view -> {
@ -730,6 +549,12 @@ public class DialogUtils {
// 海外下载地址弹窗
public static void showOverseaDownloadDialog(Context context, GameEntity gameEntity, @NonNull ConfirmListener listener) {
SensorsBridge.trackOverseasAddressDialogShow(
gameEntity.getId(),
gameEntity.getName() != null ? gameEntity.getName() : "",
gameEntity.getCategoryChinese()
);
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
@ -739,8 +564,19 @@ public class DialogUtils {
View contentView = binding.getRoot();
binding.gameIcon.displayGameIcon(gameEntity);
binding.gameNameTv.setText(context.getString(R.string.dialog_oversea_hint, gameEntity.getName()));
binding.closeIv.setOnClickListener(v -> dialog.dismiss());
AtomicBoolean dismissByTouchInside = new AtomicBoolean(false);
binding.closeIv.setOnClickListener(v -> {
dismissByTouchInside.set(true);
SensorsBridge.trackOverseasAddressDialogClick(
"取消",
gameEntity.getId(),
gameEntity.getName() != null ? gameEntity.getName() : "",
gameEntity.getCategoryChinese()
);
dialog.dismiss();
});
if ("show&download".equals(gameEntity.getOverseasAddressDialog().getStatus())) {
gameEntity.getApk().get(0).setUrl(gameEntity.getOverseasAddressDialog().getLink());
@ -748,6 +584,13 @@ public class DialogUtils {
binding.urlTv.setText(gameEntity.getOverseasAddressDialog().getLink());
binding.downloadBtn.setText("下载(" + gameEntity.getApk().get(0).getSize() + "");
binding.downloadBtn.setOnClickListener(v -> {
dismissByTouchInside.set(true);
SensorsBridge.trackOverseasAddressDialogClick(
"下载",
gameEntity.getId(),
gameEntity.getName() != null ? gameEntity.getName() : "",
gameEntity.getCategoryChinese()
);
listener.onConfirm();
dialog.dismiss();
});
@ -757,6 +600,17 @@ public class DialogUtils {
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
}
dialog.setOnDismissListener(dialog1 -> {
if (!dismissByTouchInside.get()) {
SensorsBridge.trackOverseasAddressDialogClick(
"关闭弹窗",
gameEntity.getId(),
gameEntity.getName() != null ? gameEntity.getName() : "",
gameEntity.getCategoryChinese()
);
}
});
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(contentView);
dialog.show();
@ -1205,11 +1059,11 @@ public class DialogUtils {
DialogPackageParseErrorBinding binding = DialogPackageParseErrorBinding.inflate(LayoutInflater.from(context), null, false);
Context finalContext = context;
SpannableStringBuilder builder = new SpanBuilder("您也可以点击提交反馈跟我们联系").click(context, 6, 10, R.color.theme_font, true, new Function0<Unit>() {
SpannableStringBuilder builder = new SpanBuilder("您也可以点击提交反馈跟我们联系").click(context, 6, 10, R.color.text_theme, true, new Function0<Unit>() {
@Override
public Unit invoke() {
SimpleGameEntity entity = new SimpleGameEntity(gameId, gameName, "");
HelpAndFeedbackBridge.startSuggestionActivity(finalContext, SuggestType.gameQuestion, "notfound", "模拟器安装包解析错误", entity, "-");
SimpleGameEntity entity = new SimpleGameEntity(gameId, gameName, "", "");
HelpAndFeedbackBridge.startSuggestionActivity(finalContext, SuggestType.GAME, "notfound", "模拟器安装包解析错误", entity);
dialog.dismiss();
return null;
}
@ -1264,7 +1118,7 @@ public class DialogUtils {
return null;
});
binding.reasonRv.setLayoutManager(new LinearLayoutManager(context));
binding.reasonRv.addItemDecoration(new VerticalItemDecoration(context, 1F, false, R.color.background));
binding.reasonRv.addItemDecoration(new VerticalItemDecoration(context, 1F, false, R.color.ui_background));
binding.reasonRv.setAdapter(reportReasonAdapter);
binding.negativeBtn.setOnClickListener(v -> {
@ -1286,7 +1140,7 @@ public class DialogUtils {
ExtensionsKt.setTextChangedListener(binding.otherReasonEt, (s, start, before, count) -> {
int tvCount = s.length();
if (tvCount >= 500) {
binding.tvCount.setTextColor(ContextCompat.getColor(finalContext, R.color.theme_red));
binding.tvCount.setTextColor(ContextCompat.getColor(finalContext, R.color.secondary_red));
}
binding.tvCount.setText(tvCount + "/500");
return null;

View File

@ -15,6 +15,7 @@ import com.gh.common.constant.Config
import com.gh.common.exposure.ExposureManager.log
import com.gh.common.exposure.ExposureTraceUtils.appendTrace
import com.gh.common.util.EntranceUtils.jumpActivity
import com.gh.common.util.EntranceUtils.jumpActivityCompat
import com.gh.gamecenter.*
import com.gh.gamecenter.amway.AmwayActivity
import com.gh.gamecenter.catalog.CatalogActivity
@ -24,7 +25,6 @@ import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.base.activity.BaseActivity_TabLayout
import com.gh.gamecenter.common.base.activity.ToolBarActivity
import com.gh.gamecenter.common.base.fragment.BaseFragment_TabLayout
import com.gh.gamecenter.common.constant.CommonConsts
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.constant.EntranceConsts.*
@ -37,7 +37,10 @@ import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.discovery.DiscoveryActivity
import com.gh.gamecenter.download.DownloadFragment.Companion.INDEX_UPDATE
import com.gh.gamecenter.entity.*
import com.gh.gamecenter.entity.GameCollectionListEntity
import com.gh.gamecenter.entity.SubjectData
import com.gh.gamecenter.entity.SubjectRecommendEntity
import com.gh.gamecenter.entity.VideoLinkEntity
import com.gh.gamecenter.eventbus.EBSkip
import com.gh.gamecenter.feature.entity.GameDetailServer
import com.gh.gamecenter.feature.entity.GameEntity
@ -56,9 +59,12 @@ import com.gh.gamecenter.game.commoncollection.detail.CommonCollectionDetailActi
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.hotlist.GameCollectionListDetailActivity
import com.gh.gamecenter.gamecollection.square.GameCollectionSquareActivity
import com.gh.gamecenter.gamedetail.GameDetailFragment
import com.gh.gamecenter.gamedetail.fuli.kaifu.ServersCalendarActivity
import com.gh.gamecenter.gamedetail.fuli.kaifu.ServersCalendarManagementActivity
import com.gh.gamecenter.gamedetail.fuli.kaifu.ServersSubscribedGameListActivity
import com.gh.gamecenter.gamedetail.history.HistoryApkListActivity
import com.gh.gamecenter.gamedetail.rating.RatingReplyActivity
import com.gh.gamecenter.help.HelpAndFeedbackBridge
@ -152,7 +158,8 @@ object DirectUtils {
"bbs_video",
"explore_column",
"game_explore",
"column_test_v2"
"column_test_v2",
"game_list_collection"
)
fun directToLinkPage(
@ -187,6 +194,8 @@ object DirectUtils {
}
}
"game_server_calendar" -> directToGameServerCalendar(context, linkEntity.link)
"column", "游戏专题" -> directToSubject(
context, linkEntity.link
?: "", linkEntity.text, BaseActivity.mergeEntranceAndPath(entrance, path), exposureEvent
@ -225,6 +234,7 @@ object DirectUtils {
linkEntity.link!!.contains("v.douyin") && PackageHelper.localPackageNameSet.contains("com.ss.android.ugc.aweme") -> {
directDouyin(context, "1402577827140941")
}
else -> directToWebView(
context,
url = linkEntity.link!!,
@ -278,7 +288,16 @@ object DirectUtils {
)
}
"column_collection", "专题合集" -> directToColumnCollection(context, linkEntity.link!!, -1, entrance, "", exposureEvent)
"column_collection", "专题合集" -> directToColumnCollection(
context,
linkEntity.link!!,
-1,
entrance,
"",
linkEntity.blockId,
linkEntity.blockName,
exposureEvent
)
"server", "game_server", "开服表" -> directToGameServers(context, entrance, path, exposureEvent)
@ -298,17 +317,24 @@ object DirectUtils {
"libao", "礼包" -> directToGiftDetail(context, linkEntity.link ?: "", entrance)
"feedback" -> directToFeedback(context, linkEntity.name, linkEntity.text, false, "", entrance)
"feedback" -> directToFeedback(context, linkEntity.name, false, "", false, false, entrance)
"qa", "qa_content", "Q&A" -> directToQa(context, linkEntity.text ?: "", linkEntity.link ?: "")
"qa_list" -> directToHelpAndFeedback(context)
"qa_collection", "Q&A合集" -> directToQaCollection(
context, linkEntity.text
?: "", linkEntity.link
?: ""
)
"anliwall", "安利墙" -> directToAmway(context, fixedTopAmwayCommentId = null, entrance = entrance, path = path)
"anliwall", "安利墙" -> directToAmway(
context,
fixedTopAmwayCommentId = null,
entrance = entrance,
path = path
)
"game_detail_comment" -> directToGameDetail(context, linkEntity.link ?: "", entrance)
@ -427,9 +453,18 @@ object DirectUtils {
"qq_mini_game_column" -> directToQGameHome(context)
"game_list_collection" -> directToGameCollectionListDetail(
context,
linkEntity.link ?: "",
linkEntity.text ?: "",
linkEntity.explain,
entrance
)
"" -> {
// do nothing
}
else -> {
if (unknownCallback != null) {
unknownCallback.invoke()
@ -478,6 +513,8 @@ object DirectUtils {
position: Int = -1,
entrance: String,
columnName: String = "",
blockId: String = "",
blockName: String = "",
exposureEvent: ExposureEvent? = null
) {
if (id.isEmpty()) return
@ -486,9 +523,11 @@ object DirectUtils {
bundle.putString(KEY_ENTRANCE, entrance)
bundle.putString(KEY_COLLECTION_ID, id)
bundle.putString(KEY_COLUMNNAME, columnName)
bundle.putString(KEY_BLOCK_ID, blockId)
bundle.putString(KEY_BLOCK_NAME, blockName)
bundle.putInt(KEY_POSITION, position)
if (exposureEvent != null) {
bundle.putParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST ,ArrayList(exposureEvent.source))
bundle.putParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureEvent.source))
}
jumpActivity(context, bundle)
}
@ -510,12 +549,13 @@ object DirectUtils {
* 跳转至游戏日历表
*/
@JvmStatic
fun directToGameServerCalendar(context: Context, gameId: String?) {
fun directToGameServerCalendar(context: Context, gameId: String?, kaifuTime: Long = 0) {
val bundle = Bundle()
bundle.putString(KEY_TO, ServersCalendarActivity::class.java.name)
bundle.putParcelable(GameEntity::class.java.simpleName, GameEntity().apply {
id = gameId ?: ""
})
bundle.putLong(KEY_KAIFU_TIME, kaifuTime)
bundle.putParcelable(GameDetailServer::class.java.simpleName, GameDetailServer())
bundle.putParcelable(MeEntity::class.java.simpleName, MeEntity())
jumpActivity(context, bundle)
@ -721,7 +761,8 @@ object DirectUtils {
) {
if (id.isEmpty()) return
val bundle = Bundle()
val subjectData = SubjectData(subjectId = id, subjectName = subjectName, isOrder = false, isQQMiniGame = isQQMiniGame)
val subjectData =
SubjectData(subjectId = id, subjectName = subjectName, isOrder = false, isQQMiniGame = isQQMiniGame)
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putString(KEY_TO, SubjectActivity::class.java.name)
bundle.putParcelable(EntranceConsts.KEY_SUBJECT_DATA, subjectData)
@ -735,72 +776,68 @@ object DirectUtils {
// 反馈
@JvmStatic
fun directToFeedback(context: Context, content: String? = null, entrance: String? = null) {
directToFeedback(context, content, null, false, "", entrance)
directToFeedback(context, content, false, "", false, false, entrance)
}
@JvmStatic
fun directToFeedback(
context: Context,
content: String? = null,
hintType: String? = null,
isQaFeedback: Boolean = false,
qaContentId: String? = "",
isPlugin: Boolean = false,
isSmoothGame: Boolean = false,
entrance: String? = null
) {
val bundle = Bundle()
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
val destination = RouteConsts.activity.suggestionActivity.toDestinationClass()
bundle.putString(KEY_TO, destination?.name ?: "")
bundle.putBoolean(KEY_PLUGIN, isPlugin)
bundle.putBoolean(KEY_SMOOTH_GAME, isSmoothGame)
if (isPlugin) {
bundle.putString(KEY_HIDE_SUGGEST_HINT, "【插件问题】")
}
if (isSmoothGame) {
bundle.putString(KEY_HIDE_SUGGEST_HINT, "【畅玩问题】")
}
if (isQaFeedback) {
bundle.putBoolean(KEY_IS_QA_FEEDBACK, true)
bundle.putString(KEY_QA_CONTENT_ID, qaContentId)
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.normal)
} else {
bundle.putString(KEY_CONTENT, content)
if (TextUtils.isEmpty(hintType)) {
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.gameQuestion)
bundle.putString(KEY_SUGGEST_HINT_TYPE, KEY_PLUGIN)
} else {
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.normal)
bundle.putString(KEY_SUGGEST_HINT_TYPE, hintType)
}
}
jumpActivity(context, bundle)
context.startActivity(HelpAndFeedbackBridge.getSuggestionCategoryIntent(context, bundle))
}
/**
* 畅玩助手反馈跳转
* 跳转至使用帮助与反馈,请不要随意修改方法名
*/
@JvmStatic
fun directToVGameFeedback(
fun directToHelpAndFeedback(
context: Context,
content: String? = null,
hintType: String? = null,
isQaFeedback: Boolean = false,
qaContentId: String? = "",
isPlugin: Boolean = false,
isSmoothGame: Boolean = false,
entrance: String? = null
) {
val bundle = Bundle()
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
val destination = RouteConsts.activity.suggestionActivity.toDestinationClass()
bundle.putString(KEY_TO, destination?.name ?: "")
bundle.putBoolean(KEY_PLUGIN, isPlugin)
bundle.putBoolean(KEY_SMOOTH_GAME, isSmoothGame)
if (isPlugin) {
bundle.putString(KEY_HIDE_SUGGEST_HINT, "【插件问题】")
}
if (isSmoothGame) {
bundle.putString(KEY_HIDE_SUGGEST_HINT, "【畅玩问题】")
}
if (isQaFeedback) {
bundle.putBoolean(KEY_IS_QA_FEEDBACK, true)
bundle.putString(KEY_QA_CONTENT_ID, qaContentId)
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.cwzsQuestion)
} else {
bundle.putString(KEY_CONTENT, content)
if (TextUtils.isEmpty(hintType)) {
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.gameQuestion)
bundle.putString(KEY_SUGGEST_HINT_TYPE, KEY_PLUGIN)
} else {
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.cwzsQuestion)
bundle.putString(KEY_SUGGEST_HINT_TYPE, hintType)
}
}
EntranceUtils.jumpActivityCompat(context, bundle)
directToHelpAndFeedback(context, bundle)
}
@JvmStatic
@ -811,27 +848,6 @@ object DirectUtils {
jumpActivity(context, bundle)
}
/**
* 跳转到下载管理器并开始下载 [gameId] 和 [packageName] 用于唯一确定一个下载文件
*/
@JvmStatic
fun directToDownloadManagerAndStartDownload(
context: Context,
gameId: String? = "",
packageName: String? = "",
entrance: String? = null
) {
DownloadHelper.createABrandNewDownloadTaskQuietly(gameId, packageName) {
val bundle = Bundle()
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putString(KEY_TO, DownloadManagerActivity.TAG)
bundle.putString(KEY_GAMEID, gameId)
bundle.putString(KEY_PACKAGENAME, packageName)
bundle.putBoolean(KEY_AUTO_DOWNLOAD, true)
jumpActivity(context, bundle)
}
}
@JvmStatic
fun directToDownloadManagerAndStartUpdate(
context: Context,
@ -845,7 +861,7 @@ object DirectUtils {
bundle.putString(KEY_GAMEID, gameId)
bundle.putString(KEY_PACKAGENAME, packageName)
bundle.putInt(BaseFragment_TabLayout.PAGE_INDEX, INDEX_UPDATE)
jumpActivity(context, bundle)
jumpActivityCompat(context, bundle)
}
@JvmStatic
@ -906,9 +922,9 @@ object DirectUtils {
browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
context.startActivity(browserIntent)
} catch (e: ActivityNotFoundException) {
} catch (e: Exception) {
e.printStackTrace()
Utils.toast(context, "跳转地址无效")
url.copyTextAndToast(context.getString(R.string.direct_to_external_browser_failed_toast))
}
}
@ -1106,7 +1122,8 @@ object DirectUtils {
act: String = "",
paginationType: String = "",
fieldId: String = "",
sectionName: String = ""
sectionName: String = "",
isHomeVideo: Boolean = false
) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
val bundle = Bundle()
@ -1124,6 +1141,7 @@ object DirectUtils {
bundle.putString(KEY_PAGINATION_TYPE, paginationType)
bundle.putString(KEY_FIELD_ID, fieldId)
bundle.putString(KEY_SECTION_NAME, sectionName)
bundle.putBoolean(KEY_IS_HOME_VIDEO, isHomeVideo)
jumpActivity(context, bundle)
} else {
DialogHelper.showVideoUnsupportedDialog(context)
@ -1430,7 +1448,7 @@ object DirectUtils {
fun directForumDetailSection(
context: Context,
bbsId: String? = "",
sectionId: String = "",
sectionId: String? = "",
entrance: String? = null
) {
val bundle = Bundle()
@ -1525,15 +1543,14 @@ object DirectUtils {
/**
* 跳转至使用帮助与反馈,请不要随意修改方法名
* @param position 使用帮助:[CommonConsts.TAB_MAIN],意见反馈:[CommonConsts.TAB_SUB]
*/
@JvmStatic
fun directToHelpAndFeedback(context: Context, position: Int = CommonConsts.TAB_MAIN) {
fun directToHelpAndFeedback(context: Context, bundle: Bundle? = null) {
val destination = RouteConsts.activity.helpAndFeedbackActivity.toDestinationClass()
val bundle = Bundle()
bundle.putString(KEY_TO, destination?.name ?: "")
bundle.putInt(BaseActivity_TabLayout.PAGE_INDEX, position)
jumpActivity(context, bundle)
val newBundle = Bundle()
newBundle.putString(KEY_TO, destination?.name ?: "")
bundle?.let { newBundle.putAll(it) }
jumpActivityCompat(context, newBundle)
}
/**
@ -1914,17 +1931,18 @@ object DirectUtils {
@JvmStatic
fun directToSuggestion(
context: Context,
type: SuggestType = SuggestType.normal,
type: SuggestType = SuggestType.APP,
hiddenHint: String = "",
suggestHintType: String? = null,
content: String? = null,
platform: String = "",
game: SimpleGameEntity? = null,
isQaFeedback: Boolean = false,
qaContentId: String = "",
fromRatingKey: Boolean = false,
diagnosis: String = "",
requestCode: Int? = null
forceLogin: Boolean = true,
requestCode: Int? = null,
isSmoothGame: Boolean = false
) {
val intent = HelpAndFeedbackBridge.getIntent(
context,
@ -1932,12 +1950,13 @@ object DirectUtils {
hiddenHint,
suggestHintType,
content,
platform,
game,
isQaFeedback,
qaContentId,
fromRatingKey,
diagnosis
diagnosis,
forceLogin,
isSmoothGame
)
if (requestCode != null) {
(context as Activity).startActivityForResult(intent, requestCode)
@ -1951,8 +1970,14 @@ object DirectUtils {
* @param bbsId, 为空时搜索全范围的内容,不为空时搜索该 bbsId 对应的内容
*/
@JvmStatic
fun directToForumOrUserSearch(context: Context, bbsId: String, entrance: String) {
context.startActivity(ForumOrUserSearchActivity.getIntent(context, bbsId, entrance))
fun directToForumOrUserSearch(
context: Context,
bbsId: String,
entrance: String,
sourceEntrance: String,
forumName: String
) {
context.startActivity(ForumOrUserSearchActivity.getIntent(context, bbsId, entrance, sourceEntrance, forumName))
}
@JvmStatic
@ -1980,12 +2005,19 @@ object DirectUtils {
}
@JvmStatic
fun directToSuggestion(context: Context, type: SuggestType, hiddenHint: String, requestCode: Int?) {
fun directToSuggestion(
context: Context,
type: SuggestType,
hiddenHint: String,
forceLogin: Boolean = true,
requestCode: Int?
) {
directToSuggestion(
context = context,
type = type,
hiddenHint = hiddenHint,
suggestHintType = null,
forceLogin = forceLogin,
requestCode = requestCode,
)
}
@ -2010,26 +2042,6 @@ object DirectUtils {
)
}
@JvmStatic
fun directToSuggestion(
context: Context,
type: SuggestType,
suggestHintType: String? = null,
content: String? = null,
game: SimpleGameEntity,
platform: String = ""
) {
directToSuggestion(
context = context,
type = type,
hiddenHint = "",
suggestHintType = suggestHintType,
content = content,
game = game,
platform = platform
)
}
@JvmStatic
fun directToQGameHome(context: Context) {
context.startActivity(QGameHomeWrapperActivity.getIntent(context))
@ -2051,6 +2063,11 @@ object DirectUtils {
qqGameId: String
) {
if (activity !is AppCompatActivity || activity.supportFragmentManager.isDestroyed) {
ToastUtils.toast("启动QQ小游戏失败请稍后再试")
return
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
ToastUtils.toast("该游戏仅支持安卓5.0及以上设备")
return
@ -2091,4 +2108,42 @@ object DirectUtils {
.withInt(BaseActivity_TabLayout.PAGE_INDEX, defaultTabIndex)
.navigation()
}
// 跳转游戏单合集详情
@JvmStatic
fun directToGameCollectionListDetail(
context: Context,
collectionId: String,
collectionName: String,
explain: String,
entrance: String = ""
) {
context.startActivity(
GameCollectionListDetailActivity.getIntent(
context,
GameCollectionListEntity(id = collectionId, name = collectionName, explain = explain),
entrance
)
)
}
/**
* 跳转到游戏订阅页面
* @param context 上下文
*/
@JvmStatic
fun directToServersSubscribedGameList(context: Context) {
context.startActivity(ServersSubscribedGameListActivity.getIntent(context))
}
/**
* 跳转到开服订阅页面
* @param context 上下文
*/
@JvmStatic
fun directToServersCalendarManagement(context: Context, entrance: String) {
CheckLoginUtils.checkLogin(context, entrance) {
context.startActivity(ServersCalendarManagementActivity.getIntent(context))
}
}
}

View File

@ -2,7 +2,10 @@ package com.gh.common.util
import android.content.Context
import android.os.Build
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.common.utils.toResString
import com.gh.gamecenter.core.utils.EmptyCallback
import com.gh.gamecenter.feature.entity.ApkEntity
import com.gh.gamecenter.feature.entity.GameEntity
@ -21,7 +24,43 @@ object DownloadDialogHelper {
) {
val dialog = retrieveAvailableDialog(gameEntity, apkEntity)
if (dialog != null) {
showDownloadDialog(context, dialog, callback)
SensorsBridge.trackGameDownloadDialogShow(
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
DialogHelper.showDialogWithHtmlContent(
context,
dialog.title,
dialog.content,
"继续下载",
"取消",
confirmClickCallback = {
SensorsBridge.trackGameDownloadDialogClick(
buttonName = "继续下载",
gameId = gameEntity.id ,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
callback.onCallback()
},
cancelClickCallback = {
SensorsBridge.trackGameDownloadDialogClick(
buttonName = "取消",
gameId = gameEntity.id ,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
},
touchOutsideCallback = {
SensorsBridge.trackGameDownloadDialogClick(
buttonName = "关闭弹窗",
gameId = gameEntity.id ,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
}
)
} else {
callback.onCallback()
}
@ -109,14 +148,4 @@ object DownloadDialogHelper {
return null
}
private fun showDownloadDialog(context: Context, dialog: GameEntity.Dialog, callback: EmptyCallback) {
DialogHelper.showDialogWithHtmlContent(
context,
dialog.title,
dialog.content,
"继续下载",
"取消",
{ callback.onCallback() })
}
}

View File

@ -1,63 +0,0 @@
package com.gh.common.util
import com.gh.common.filter.RegionSettingHelper
import com.gh.download.DownloadManager
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.feature.utils.ApkActiveUtils
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
import io.reactivex.schedulers.Schedulers
import retrofit2.HttpException
/**
* 不想写这个类的,但是与其在一个糟糕的类里插入同样的代码,我想独立写一个类相较而已还没那么糟糕
*/
object DownloadHelper {
/**
* 根据 game_id 和 packageName 悄悄地开启一个下载任务,如果可以的话
* @param block 成功添加下载任务后执行的代码块
*/
fun createABrandNewDownloadTaskQuietly(gameId: String? = "", packageName: String? = "", block: () -> Unit) {
if (RegionSettingHelper.shouldThisGameBeFiltered(gameId)) {
return
}
RetrofitManager.getInstance()
.api
.getGameDigest(gameId)
.map(ApkActiveUtils.filterMapper)
.subscribeOn(Schedulers.io())
.subscribe(object : Response<GameEntity>() {
override fun onResponse(response: GameEntity?) {
response?.let {
if (response.getApk().size > 1) {
for (apk in response.getApk()) {
if (packageName == apk.packageName) {
DownloadManager.createDownload(
HaloApp.getInstance().application,
apk, response, "", EntranceConsts.ENTRANCE_RECOMMEND, "", false, null
)
block.invoke()
}
}
} else if (response.getApk().size == 1) {
DownloadManager.createDownload(
HaloApp.getInstance().application,
response, "", EntranceConsts.ENTRANCE_RECOMMEND, "", false, null
)
block.invoke()
}
}
}
override fun onFailure(e: HttpException?) {
e?.printStackTrace()
block.invoke()
}
})
}
}

View File

@ -1,6 +1,5 @@
package com.gh.common.util
import android.annotation.SuppressLint
import android.content.Context
import android.os.Message
import android.text.TextUtils
@ -8,7 +7,6 @@ import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.collection.ArrayMap
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.launcher.ARouter
import com.gh.common.chain.*
import com.gh.common.constant.Config
import com.gh.common.dialog.DeviceRemindDialog
@ -32,20 +30,16 @@ 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.constant.RouteConsts
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.provider.IQGameProvider
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.PluginLocation
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.dialog.GamePermissionDialogFragment
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.manager.PackagesManager
import com.gh.gamecenter.retrofit.RetrofitManager
import com.gh.gamecenter.teenagermode.TeenagerModeActivity
import com.gh.vspace.VHelper
import com.lightgame.download.DownloadConfig
@ -128,7 +122,7 @@ object DownloadItemUtils {
fun updateItemWithReserveStatus(holder: GameViewHolder, gameEntity: GameEntity) {
if ("download" == gameEntity.reserveStatus) {
// 已上线
updateItem(holder.gameDownloadBtn.context, gameEntity, holder, false)
updateItem(holder.gameDownloadBtn.context, gameEntity, holder)
} else if ("appointment" == gameEntity.reserveStatus) {
// 已预约
holder.gameDownloadBtn.text = "已预约"
@ -139,25 +133,35 @@ object DownloadItemUtils {
}
fun updateItem(
context: Context, gameEntity: GameEntity, holder: GameViewHolder,
isShowPlatform: Boolean, hideDownloadBtnIfNoAvailableContent: Boolean
context: Context,
gameEntity: GameEntity,
holder: GameViewHolder,
hideDownloadBtnIfNoAvailableContent: Boolean
) {
updateItem(
context,
gameEntity,
holder,
isShowPlatform,
PluginLocation.only_game,
hideDownloadBtnIfNoAvailableContent,
null
context = context,
gameEntity = gameEntity,
holder = holder,
pluginLocation = PluginLocation.only_game,
hideDownloadBtnIfNoAvailableContent = hideDownloadBtnIfNoAvailableContent,
briefStyle = null
)
}
fun updateItem(
context: Context, gameEntity: GameEntity, holder: GameViewHolder,
isShowPlatform: Boolean, briefStyle: String?
context: Context,
gameEntity: GameEntity,
holder: GameViewHolder,
briefStyle: String?
) {
updateItem(context, gameEntity, holder, isShowPlatform, PluginLocation.only_game, false, briefStyle)
updateItem(
context = context,
gameEntity = gameEntity,
holder = holder,
pluginLocation = PluginLocation.only_game,
hideDownloadBtnIfNoAvailableContent = false,
briefStyle = briefStyle
)
}
@JvmStatic
@ -166,7 +170,6 @@ object DownloadItemUtils {
context: Context,
gameEntity: GameEntity,
holder: GameViewHolder,
isShowPlatform: Boolean,
pluginLocation: PluginLocation? = PluginLocation.only_game,
hideDownloadBtnIfNoAvailableContent: Boolean = false,
briefStyle: String? = null,
@ -292,12 +295,54 @@ object DownloadItemUtils {
}
}
} else if (gameEntity.getApk().size == 1) {
// 优先从下载管理获取 downloadEntity
var downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity)
// 来自于下载管理的实体快照
val entityFromDownloadManager = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity)
// 是否正在下载中
val isDownloading = entityFromDownloadManager != null && entityFromDownloadManager.status != DownloadStatus.done
// 是否已安装至本地
val isInstalledLocally = PackagesManager.isInstalled(gameEntity.getUniquePackageName())
// 来自于畅玩安装列表的实体快照,若存在,代表游戏已下载并成功安装
val entityFromInstalledVGame = VHelper.getVDownloadEntitySnapshot(gameEntity.id, gameEntity.getUniquePackageName())
// 是否已安装至畅玩
val isInstalledToVSpace = entityFromInstalledVGame != null
// 是否处于待安装状态 (仅本地安装有这个状态)
val isPendingToInstall = if (entityFromDownloadManager?.status != DownloadStatus.done) {
false
} else {
entityFromDownloadManager.isLocalDownloadInDualDownloadMode()
&& (!isInstalledLocally || entityFromDownloadManager.isUpdate)
}
// 找不到时,若类型为畅玩,尝试从畅玩数据库的快照中获取 downloadEntity。若存在代表游戏已下载并成功安装
if (downloadEntity == null && gameEntity.isVGame()) {
downloadEntity = VHelper.getVDownloadEntitySnapshot(gameEntity.id, gameEntity.getUniquePackageName())
// 列表按钮显示的优先级
// 1. 都未安装,且不存在下载任务,按后台配置显示的状态优先
// 2. 存在未完成的下载任务时,下载任务优先
// 3. 存在待安装任务时,待安装任务优先
// 4. 存在一个已安装,已安装的显示优先
// 5. 都已安装,按后台配置显示的状态优先
val isVGamePreferred = if (!isInstalledLocally && !isInstalledToVSpace && entityFromDownloadManager == null) {
gameEntity.isVGamePreferred()
} else if (isDownloading || isPendingToInstall) {
entityFromDownloadManager?.isVGameDownloadInDualDownloadMode() == true
} else if (isInstalledLocally && isInstalledToVSpace) {
gameEntity.isVGamePreferred()
} else if (isInstalledLocally) {
false
} else if (isInstalledToVSpace) {
true
} else {
gameEntity.isVGamePreferred()
}
val downloadEntity: DownloadEntity? = if (isDownloading) {
entityFromDownloadManager
} else if (isPendingToInstall) {
entityFromDownloadManager
} else {
if (isVGamePreferred) {
entityFromInstalledVGame ?: entityFromDownloadManager
} else {
entityFromDownloadManager
}
}
if (downloadEntity != null) {
@ -306,11 +351,12 @@ object DownloadItemUtils {
DownloadStatus.done -> {
if (downloadEntity.isSimulatorGame() && gameEntity.simulator != null) {
GameUtils.setDownloadBtnStatus(context, gameEntity, downloadBtn, pluginLocation)
} else if (downloadEntity.isVGame()) {
} else if (isVGamePreferred) {
buttonStyle =
if (PackagesManager.isCanUpdate(
downloadEntity.gameId,
downloadEntity.packageName
downloadEntity.packageName,
asVGame = true
)
) {
setText(R.string.update)
@ -339,8 +385,19 @@ object DownloadItemUtils {
return
}
buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL
setText(R.string.install)
if (PackagesManager.isInstalled(downloadEntity.packageName) && !downloadEntity.isUpdate) {
// 双下载按钮快速安装时存在已下载的安装包过时,需要重新下载的情况
if (PackagesManager.isCanUpdate(downloadEntity.gameId, downloadEntity.packageName)) {
buttonStyle = DownloadButton.ButtonStyle.NORMAL
setText(R.string.update)
} else {
buttonStyle = DownloadButton.ButtonStyle.LAUNCH_OR_OPEN
setText(R.string.launch)
}
} else {
buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL
setText(R.string.install)
}
}
buttonStyle =
if (downloadEntity.isPluggable && PackagesManager.isInstalled(downloadEntity.packageName)) {
@ -642,15 +699,43 @@ object DownloadItemUtils {
gamePermissionDialogFragment?.dismissAllowingStateLoss()
if (SPUtils.getBoolean(Constants.SP_TEENAGER_MODE)) {
downloadBtn.setOnClickListener {
SensorsBridge.trackAdolescentModeDialogShow(
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
DialogHelper.showDialog(
context,
"提示",
"当前处于儿童/青少年模式, \n暂不提供游戏下载",
"退出青少年模式",
"关闭",
{ context.startActivity(TeenagerModeActivity.getIntent(context)) },
{},
DialogHelper.Config(
confirmClickCallback = {
context.startActivity(TeenagerModeActivity.getIntent(context))
SensorsBridge.trackAdolescentModeDialogClick(
buttonName = "退出青少年模式",
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
},
cancelClickCallback = {
SensorsBridge.trackAdolescentModeDialogClick(
buttonName = "关闭",
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
},
touchOutsideCallback = {
SensorsBridge.trackAdolescentModeDialogClick(
buttonName = "关闭弹窗",
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
},
extraConfig = DialogHelper.Config(
centerTitle = true,
centerContent = true
)
@ -677,7 +762,7 @@ object DownloadItemUtils {
}
},
{},
DialogHelper.Config(
extraConfig = DialogHelper.Config(
centerTitle = true,
centerContent = true
)
@ -800,7 +885,14 @@ object DownloadItemUtils {
if (downloadBtn is DownloadButton && downloadBtn.text == context.getString(R.string.launch)) {
clickRunnable.onCallback()
} else {
PermissionHelper.checkStoragePermissionBeforeAction(context, clickRunnable)
PermissionHelper.checkStoragePermissionBeforeAction(
context,
gameEntity.id,
gameEntity.name ?: "",
gameEntity.categoryChinese,
gameEntity.getApk().firstOrNull()?.format,
clickRunnable
)
}
}
} else {
@ -808,17 +900,21 @@ object DownloadItemUtils {
allStateClickCallback?.onCallback()
clickCallback?.onCallback()
ChainBuilder().apply {
DownloadChainBuilder().apply {
addHandler(GamePermissionHandler())
addHandler(CheckStoragePermissionHandler())
addHandler(CertificationHandler())
addHandler(VersionNumberHandler())
}
.setProcessEndCallback {
.setProcessEndCallback { _, _ ->
DownloadDialog.showDownloadDialog(view.context, gameEntity, traceEvent, entrance, location)
}
.buildHandlerChain()
?.handleRequest(context, gameEntity)
?.handleRequest(
context,
gameEntity,
GameUtils.shouldPerformAsVGame(gameEntity)
)
}
}
}
@ -838,8 +934,11 @@ object DownloadItemUtils {
val str = if (downloadBtn is DownloadButton) downloadBtn.text else context.getString(R.string.download)
if (gameEntity.getApk().isEmpty()) return
val apk = gameEntity.getApk().safelyGetInRelease(0) ?: return
val shouldPerformAsVGame = GameUtils.shouldPerformAsVGame(gameEntity)
if (str == context.getString(R.string.download)) {
ChainBuilder().apply {
DownloadChainBuilder().apply {
addHandler(UnsupportedFeatureHandler())
addHandler(UpdateNewSimulatorHandler())
addHandler(GamePermissionHandler())
@ -851,14 +950,14 @@ object DownloadItemUtils {
addHandler(LandPageAddressHandler())
addHandler(CheckDownloadHandler())
}
.setProcessEndCallback {
download(context, gameEntity, downloadBtn, entrance, location, it as Boolean, traceEvent)
.setProcessEndCallback { asVGame, isSubscribe ->
download(context, gameEntity, downloadBtn, entrance, location, asVGame, isSubscribe as Boolean, traceEvent)
}
.buildHandlerChain()
?.handleRequest(context, gameEntity)
?.handleRequest(context, gameEntity, shouldPerformAsVGame)
DataLogUtils.uploadGameLog(context, gameEntity.id, gameEntity.name, entrance)
} else if (str == context.getString(R.string.attempt)) {
ChainBuilder().apply {
DownloadChainBuilder().apply {
addHandler(UnsupportedFeatureHandler())
addHandler(UpdateNewSimulatorHandler())
addHandler(GamePermissionHandler())
@ -871,14 +970,14 @@ object DownloadItemUtils {
addHandler(OverseaDownloadHandler())
addHandler(CheckDownloadHandler())
}
.setProcessEndCallback {
download(context, gameEntity, downloadBtn, entrance, location, it as Boolean, traceEvent)
.setProcessEndCallback { asVGame, isSubscribe ->
download(context, gameEntity, downloadBtn, entrance, location, asVGame, isSubscribe as Boolean, traceEvent)
}
.buildHandlerChain()
?.handleRequest(context, gameEntity)
?.handleRequest(context, gameEntity, shouldPerformAsVGame)
DataLogUtils.uploadGameLog(context, gameEntity.id, gameEntity.name, entrance)
} else if (str == context.getString(R.string.smooth)) {
ChainBuilder().apply {
DownloadChainBuilder().apply {
addHandler(UnsupportedFeatureHandler())
addHandler(GamePermissionHandler())
addHandler(PackageCheckHandler())
@ -891,28 +990,41 @@ object DownloadItemUtils {
addHandler(ValidateVSpaceHandler())
addHandler(CheckDownloadHandler())
}
.setProcessEndCallback {
download(context, gameEntity, downloadBtn, entrance, location, it as Boolean, traceEvent)
.setProcessEndCallback { asVGame, isSubscribe ->
download(context, gameEntity, downloadBtn, entrance, location, asVGame, isSubscribe as Boolean, traceEvent)
}
.buildHandlerChain()
?.handleRequest(context, gameEntity)
?.handleRequest(context, gameEntity, shouldPerformAsVGame)
} else if (str.contains("")) {
if (gameEntity.pluggableCollection != null) {
DownloadDialog.showDownloadDialog(context, gameEntity, traceEvent, entrance, location)
} else {
ChainBuilder().apply {
DownloadChainBuilder().apply {
addHandler(DownloadDialogHelperHandler())
addHandler(CertificationHandler())
addHandler(CheckDownloadHandler())
}
.setProcessEndCallback {
plugin(context, gameEntity, downloadBtn, entrance, location, it as Boolean, traceEvent)
.setProcessEndCallback { _, isSubscribe ->
plugin(context, gameEntity, downloadBtn, entrance, location, isSubscribe as Boolean, traceEvent)
}
.buildHandlerChain()
?.handleRequest(context, gameEntity)
?.handleRequest(context, gameEntity, shouldPerformAsVGame)
}
} else if (str == context.getString(R.string.install)) {
val downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(apk.url)
com.gh.gamecenter.common.utils.NewFlatLogUtils.logGameInstall(
gameId = downloadEntity?.gameId ?: "",
gameName = downloadEntity?.name ?: "",
trigger = "主动安装"
)
SensorsBridge.trackInstallGameClick(
gameId = downloadEntity?.gameId ?: "",
gameName = downloadEntity?.name ?: "",
action = "主动安装"
)
if (gameEntity.simulator != null) {
val isInstalled =
PackageUtils.isInstalledFromAllPackage(context, gameEntity.simulator!!.apk!!.packageName)
@ -925,30 +1037,40 @@ object DownloadItemUtils {
}
if (downloadEntity != null && SimulatorGameManager.isSimulatorGame(gameEntity) && !isInstalled && !isInstalledNewSimulator) {
SimulatorDownloadManager.getInstance().showDownloadDialog(
context, simulator,
SimulatorDownloadManager.SimulatorLocation.LAUNCH, gameEntity.id, gameEntity.name!!, null
context,
simulator,
SimulatorDownloadManager.SimulatorLocation.LAUNCH,
gameEntity.id,
gameEntity.name!!,
gameEntity.categoryChinese,
null
)
return
}
}
if (gameEntity.isVGame()) {
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity)
} else {
install(context, gameEntity, position, adapter, refreshCallback)
}
install(context, gameEntity, position, adapter, refreshCallback)
} else if (str == context.getString(R.string.launch)) {
//启动模拟器游戏
if (SimulatorGameManager.isSimulatorGame(gameEntity)) {
if (NewSimulatorGameManager.shouldShowUpdateNewSimulatorAlert(context)) {
NewSimulatorGameManager.showUpdateNewsSimulator(context, null)
NewSimulatorGameManager.showUpdateNewsSimulator(context, gameEntity, null)
return
}
val downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk()[0].url)
if (downloadEntity != null) {
val file = File(downloadEntity.path)
if (!file.exists()) {
download(context, gameEntity, downloadBtn, entrance, location, false, traceEvent)
download(
context = context,
gameEntity = gameEntity,
downloadBtn = downloadBtn,
entrance = entrance,
location = location,
asVGame = false,
isSubscribe = false,
traceEvent = traceEvent
)
return
}
NewFlatLogUtils.logSimulatorGameCardClick("启动")
@ -957,43 +1079,35 @@ object DownloadItemUtils {
return
}
if (gameEntity.isVGame()) {
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity)
return
}
PackageLauncher.launchApp(context, gameEntity, gameEntity.getApk()[0].packageName)
PackageLauncher.launch(context, gameEntity)
} else if (str == context.getString(R.string.update)) {
if (gameEntity.isVGame()) {
if (shouldPerformAsVGame) {
VHelper.updateOrReDownload(gameEntity)
return
}
ChainBuilder()
DownloadChainBuilder()
.apply {
addHandler(LandPageAddressHandler())
}.setProcessEndCallback {
}.setProcessEndCallback { asVGame, _ ->
DownloadDialogHelper.findAvailableDialogAndShow(context, gameEntity, apk) {
DialogUtils.checkDownload(
context,
apk.size,
gameEntity.id,
gameEntity.name
gameEntity.name,
gameEntity.categoryChinese
) { isSubscribe: Boolean ->
update(context, gameEntity, entrance, location, isSubscribe, traceEvent)
update(context, gameEntity, entrance, location, asVGame, isSubscribe, traceEvent)
}
}
}
.buildHandlerChain()
?.handleRequest(context, gameEntity)
?.handleRequest(context, gameEntity, false)
} else {
var downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity)
// 找不到时,若类型为畅玩,尝试从畅玩数据库的快照中获取 downloadEntity。若存在代表游戏已下载并成功安装
if (downloadEntity == null && gameEntity.isVGame()) {
downloadEntity = VHelper.getVDownloadEntitySnapshot(gameEntity.id, gameEntity.getUniquePackageName())
}
// 还是找不到时,尝试从 gameEntity 里找已绑定的 downloadEntity
// 尝试从 gameEntity 里找已绑定的 downloadEntity
if (downloadEntity == null) {
downloadEntity = gameEntity.getEntryMap().getOrDefault(gameEntity.getUniquePlatform(), null)
}
@ -1009,7 +1123,7 @@ object DownloadItemUtils {
}
when (str) {
context.getString(R.string.resume) -> {
DownloadManager.getInstance().resume(downloadEntity, true)
DownloadManager.getInstance().resume(downloadEntity, false)
}
context.getString(R.string.waiting) -> {
@ -1031,6 +1145,7 @@ object DownloadItemUtils {
downloadBtn: View?,
entrance: String,
location: String,
asVGame: Boolean,
isSubscribe: Boolean,
traceEvent: ExposureEvent?
) {
@ -1041,7 +1156,7 @@ object DownloadItemUtils {
DownloadManager.createDownload(
context,
gameEntity,
context.getString(R.string.download),
asVGame,
entrance,
location,
isSubscribe,
@ -1076,7 +1191,7 @@ object DownloadItemUtils {
) {
val msg = FileUtils.isCanDownload(context, gameEntity.getApk()[0].size ?: "")
if (TextUtils.isEmpty(msg)) {
DownloadManager.createDownload(context, gameEntity, "插件化", entrance, location, isSubscribe, traceEvent)
DownloadManager.createDownload(context, gameEntity, false, entrance, location, isSubscribe, traceEvent)
ToastUtils.toast(gameEntity.name + "已加入下载队列")
if (BrowserInstallHelper.shouldAutoSwitchAssistantInstall(gameEntity)) {
val toast = context.getString(R.string.unsupported_browser_install_hint)
@ -1115,7 +1230,16 @@ object DownloadItemUtils {
}
PackageUtils.isCanPluggable(apkEntity) -> {
DialogHelper.showPluginDialog(context, gameEntity.pluginDesc) { PackageInstaller.uninstall(context, path) }
DialogHelper.showPluginDialog(
context,
pluginDesc = gameEntity.pluginDesc,
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese,
platform = gameEntity.platform ?: ""
) {
PackageInstaller.uninstall(context, path)
}
}
else -> {
@ -1131,9 +1255,19 @@ object DownloadItemUtils {
gameEntity: GameEntity,
entrance: String,
location: String,
asVGame: Boolean,
isSubscribe: Boolean,
traceEvent: ExposureEvent?
) {
DownloadManager.createDownload(context, gameEntity, "更新", entrance, location, isSubscribe, traceEvent)
// 执行更新操作前,先清理历史下载任务,避免冲突
if (gameEntity.getApk().size == 1 && !asVGame) {
val downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity)
if (downloadEntity != null) {
DownloadManager.getInstance().cancel(downloadEntity.url)
}
}
DownloadManager.createDownload(context, gameEntity, asVGame, entrance, location, isSubscribe, traceEvent)
}
}

View File

@ -15,7 +15,7 @@ import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.getMetaExtra
import com.gh.gamecenter.common.utils.isSimulatorGame
import com.gh.gamecenter.common.utils.isVGame
import com.gh.gamecenter.common.utils.asVGame
import com.gh.gamecenter.common.utils.tryCatchInRelease
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.utils.SpeedUtils
@ -57,65 +57,65 @@ object DownloadNotificationHelper {
intent.putExtra(EntranceConsts.KEY_URL, entity.url)
intent.putExtra(EntranceConsts.KEY_PATH, entity.path)
intent.action = ACTION_INSTALL
} else if (entity.isVGame()) {
} else if (entity.asVGame()) {
intent.action = ACTION_VDOWNLOAD
} else {
intent.action = ACTION_DOWNLOAD
}
val pendingIntent = PendingIntent.getBroadcast(
HaloApp.getInstance().application,
downloadNotificationId,
intent,
PendingIntent.FLAG_UPDATE_CURRENT
)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel =
NotificationChannel(DOWNLOAD_CHANNEL_ID, DOWNLOAD_CHANNEL_ID, NotificationManager.IMPORTANCE_LOW)
notificationManager.createNotificationChannel(channel)
}
val whenTime = 1000 * 60 * (System.currentTimeMillis() / 1000 / 60)
val builder = NotificationCompat.Builder(HaloApp.getInstance().application, DOWNLOAD_CHANNEL_ID)
.setContentTitle(entity.name)
.setSmallIcon(getNotificationIcon())
.setContentIntent(pendingIntent)
.setGroup(DOWNLOAD_GROUP_KEY)
.setWhen(whenTime)
if (xapkStatus == XapkUnzipStatus.FAILURE.name) {
builder.setContentText("" + entity.name + "》解压失败,点击查看详情~")
} else {
when (entity.status) {
DownloadStatus.downloading -> builder.setContentText(
String.format(
"%s(剩%s)",
SpeedUtils.getSpeed(entity.speed),
SpeedUtils.getRemainTime(entity.size, entity.progress, entity.speed * 1024)
)
)
DownloadStatus.done -> builder.setContentText("下载完成,点击立即安装")
DownloadStatus.waiting -> builder.setContentText("等待中")
DownloadStatus.subscribe,
DownloadStatus.timeout,
DownloadStatus.diskisfull,
DownloadStatus.diskioerror,
DownloadStatus.neterror -> builder.setContentText("已暂停连接WiFi自动下载")
else -> builder.setContentText("暂停中")
}
builder.setProgress(PROGRESS_MAX, entity.percent.toInt(), false)
}
when (entity.status) {
DownloadStatus.done -> {
builder.setSortKey("A")
builder.setOngoing(true) // 垃圾华为 sortKey 不起效 priority 也不起效,要将下载完成任务的通知置顶只能设置为 ongoing喷了
}
DownloadStatus.downloading -> builder.setSortKey("B")
else -> builder.setSortKey("C")
}
tryCatchInRelease {
val pendingIntent = PendingIntent.getBroadcast(
HaloApp.getInstance().application,
downloadNotificationId,
intent,
PendingIntent.FLAG_UPDATE_CURRENT
)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel =
NotificationChannel(DOWNLOAD_CHANNEL_ID, DOWNLOAD_CHANNEL_ID, NotificationManager.IMPORTANCE_LOW)
notificationManager.createNotificationChannel(channel)
}
val whenTime = 1000 * 60 * (System.currentTimeMillis() / 1000 / 60)
val builder = NotificationCompat.Builder(HaloApp.getInstance().application, DOWNLOAD_CHANNEL_ID)
.setContentTitle(entity.name)
.setSmallIcon(getNotificationIcon())
.setContentIntent(pendingIntent)
.setGroup(DOWNLOAD_GROUP_KEY)
.setWhen(whenTime)
if (xapkStatus == XapkUnzipStatus.FAILURE.name) {
builder.setContentText("" + entity.name + "》解压失败,点击查看详情~")
} else {
when (entity.status) {
DownloadStatus.downloading -> builder.setContentText(
String.format(
"%s(剩%s)",
SpeedUtils.getSpeed(entity.speed),
SpeedUtils.getRemainTime(entity.size, entity.progress, entity.speed * 1024)
)
)
DownloadStatus.done -> builder.setContentText("下载完成,点击立即安装")
DownloadStatus.waiting -> builder.setContentText("等待中")
DownloadStatus.subscribe,
DownloadStatus.timeout,
DownloadStatus.diskisfull,
DownloadStatus.diskioerror,
DownloadStatus.neterror -> builder.setContentText("已暂停连接WiFi自动下载")
else -> builder.setContentText("暂停中")
}
builder.setProgress(PROGRESS_MAX, entity.percent.toInt(), false)
}
when (entity.status) {
DownloadStatus.done -> {
builder.setSortKey("A")
builder.setOngoing(true) // 垃圾华为 sortKey 不起效 priority 也不起效,要将下载完成任务的通知置顶只能设置为 ongoing喷了
}
DownloadStatus.downloading -> builder.setSortKey("B")
else -> builder.setSortKey("C")
}
val notification = builder.build() // 可能会抛出异常
notification.flags = notification.flags or Notification.FLAG_NO_CLEAR
if (xapkStatus == XapkUnzipStatus.FAILURE.name) {

View File

@ -8,6 +8,7 @@ import com.gh.common.xapk.XapkInstaller
import com.gh.download.DownloadDataHelper
import com.gh.download.DownloadManager
import com.gh.gamecenter.R
import com.gh.gamecenter.ShellActivity
import com.gh.gamecenter.common.base.GlobalActivityManager.getCurrentPageEntity
import com.gh.gamecenter.common.base.GlobalActivityManager.getLastPageEntity
import com.gh.gamecenter.common.base.activity.BaseActivity
@ -17,7 +18,11 @@ 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.utils.*
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.core.utils.GsonUtils
import com.gh.gamecenter.core.utils.MtaHelper
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.common.utils.NewFlatLogUtils
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.SimulatorEntity
@ -73,19 +78,47 @@ object DownloadObserver {
val currentActivity = AppManager.getInstance().currentActivity() ?: return
SensorsBridge.trackDownloadLinkRotDialogShow(
gameId = downloadEntity.gameId,
gameName = downloadEntity.name,
gameType = downloadEntity.categoryChinese
)
DialogHelper.showDialog(
currentActivity,
"下载失败",
"下载链接已失效,建议提交反馈",
"立即反馈",
"取消",
{
confirmClickCallback = {
HelpAndFeedbackBridge.startSuggestionActivity(
currentActivity,
SuggestType.gameQuestion, "notfound",
StringUtils.buildString(downloadEntity.name, "问题反馈:下载链接失效"),
SuggestType.GAME, "notfound",
"问题反馈:下载链接失效",
SimpleGameEntity(gameId, downloadEntity.name, "")
)
SensorsBridge.trackDownloadLinkRotDialogClick(
buttonName = "立即反馈",
gameId = downloadEntity.gameId,
gameName = downloadEntity.name,
gameType = downloadEntity.categoryChinese
)
},
cancelClickCallback = {
SensorsBridge.trackDownloadLinkRotDialogClick(
buttonName = "取消",
gameId = downloadEntity.gameId,
gameName = downloadEntity.name,
gameType = downloadEntity.categoryChinese
)
},
touchOutsideCallback = {
SensorsBridge.trackDownloadLinkRotDialogClick(
buttonName = "关闭弹窗",
gameId = downloadEntity.gameId,
gameName = downloadEntity.name,
gameType = downloadEntity.categoryChinese
)
},
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
)
@ -139,6 +172,33 @@ object DownloadObserver {
ToastUtils.toast("该游戏未接入防沉迷系统,暂不支持下载")
}
// 删除任务
downloadEntity.status = DownloadStatus.cancel
downloadManager.cancel(downloadEntity.url)
} else if (DownloadStatus.isCertificating == downloadEntity.status) {
// 未接入防沉迷系统
val currentActivity = AppManager.getInstance().currentActivity()
if (currentActivity != null) {
DialogHelper.showDialog(
context = currentActivity,
title = "实名提示",
content = "您当前的身份信息正在认证中,根据相关政策要求,该游戏需通过认证后才能进行下载",
cancelText = "知道了",
confirmText = "查看实名认证",
cancelClickCallback = null,
confirmClickCallback = {
currentActivity.startActivity(
ShellActivity.getIntent(
currentActivity,
ShellActivity.Type.REAL_NAME_INFO,
))
}
)
} else {
ToastUtils.toast("您当前的身份信息正在认证中,根据相关政策要求,该游戏需通过认证后才能进行下载")
}
// 删除任务
downloadEntity.status = DownloadStatus.cancel
downloadManager.cancel(downloadEntity.url)
@ -196,6 +256,18 @@ object DownloadObserver {
// 会有 ActivityNotFoundException 异常catch 掉不管了
tryWithDefaultCatch {
if (Constants.SILENT_UPDATE != downloadEntity.getMetaExtra(Constants.EXTRA_DOWNLOAD_TYPE)) {
NewFlatLogUtils.logGameInstall(
gameId = downloadEntity.gameId ?: "",
gameName = downloadEntity.name ?: "",
trigger = "自动安装"
)
SensorsBridge.trackInstallGameClick(
gameName = downloadEntity.name,
gameId = downloadEntity.gameId,
action = "自动安装"
)
// TODO 在 Android 11 上没有授权安装未知应用的权限前第一次调用这个方法系统会杀掉我们的进程...
// 没能找到类似的解释,最接近的是这个 https://issuetracker.google.com/issues/154157387但也只是点授权杀进程而已
PackageInstaller.install(mApplication, downloadEntity);
@ -219,7 +291,7 @@ object DownloadObserver {
EBShowDialog(
BaseActivity.PLUGGABLE,
downloadEntity.path,
downloadEntity.pluginDesc
downloadEntity
)
)
@ -229,13 +301,13 @@ object DownloadObserver {
)
else -> {
if (!downloadEntity.isVGame()) {
if (!downloadEntity.asVGame()) {
Utils.toast(mApplication, downloadEntity.name + " - 下载完成")
}
}
}
} else {
if (!downloadEntity.isVGame()) {
if (!downloadEntity.asVGame()) {
Utils.toast(mApplication, downloadEntity.name + " - 下载完成")
}
}
@ -257,7 +329,7 @@ object DownloadObserver {
}
SimulatorDownloadManager.getInstance().showDownloadDialog(
currentActivity, simulator,
SimulatorDownloadManager.SimulatorLocation.LAUNCH, downloadEntity.gameId, gameName, null
SimulatorDownloadManager.SimulatorLocation.LAUNCH, downloadEntity.gameId, gameName, downloadEntity.categoryChinese, null
)
SimulatorGameManager.recordDownloadSimulatorGame(downloadEntity.gameId, simulator.type)
SimulatorGameManager.postPlayedGame(downloadEntity.gameId, downloadEntity.packageName)
@ -270,14 +342,23 @@ object DownloadObserver {
Utils.toast(mApplication, R.string.install_failure_hint)
downloadManager.cancel(downloadEntity.url)
} else {
if (PackageUtils.isCanLaunchSetup(
mApplication,
downloadEntity.path
) || downloadType == Constants.SMOOTH_GAME
) {
if (PackageUtils.isCanLaunchSetup(mApplication, downloadEntity.path)
|| downloadType == Constants.VGAME
|| downloadType == Constants.DUAL_DOWNLOAD_VGAME) {
downloadEntity.meta[Constants.MARK_ALREADY_TRIGGERED_INSTALLATION] = "YES"
tryWithDefaultCatch {
PackageInstaller.install(mApplication, downloadEntity, false)
NewFlatLogUtils.logGameInstall(
gameId = downloadEntity.gameId ?: "",
gameName = downloadEntity.name ?: "",
trigger = "自动安装"
)
SensorsBridge.trackInstallGameClick(
gameId = downloadEntity.gameId,
gameName = downloadEntity.name,
action = "自动安装"
)
PackageInstaller.install(mApplication, downloadEntity, false, ignoreAsVGame = false)
}
} else {
// 弹出卸载提示框
@ -286,14 +367,15 @@ object DownloadObserver {
EBShowDialog(
BaseActivity.PLUGGABLE,
downloadEntity.path,
downloadEntity.pluginDesc
downloadEntity
)
)
} else {
EventBus.getDefault().post(
EBShowDialog(
BaseActivity.SIGNATURE_CONFLICT,
downloadEntity.path
downloadEntity.path,
downloadEntity
)
)
}
@ -344,7 +426,7 @@ object DownloadObserver {
private fun statDoneEvent(downloadEntity: DownloadEntity) {
var type: ExposureUtils.DownloadType
if (downloadEntity.isUpdate) {
if (downloadEntity.isVGame()) {
if (downloadEntity.asVGame()) {
type = ExposureUtils.DownloadType.FUN_UPDATE
} else {
type = ExposureUtils.DownloadType.UPDATE
@ -353,7 +435,7 @@ object DownloadObserver {
}
}
} else {
type = if (downloadEntity.isVGame()) {
type = if (downloadEntity.asVGame()) {
ExposureUtils.DownloadType.FUN_DOWNLOAD
} else {
ExposureUtils.DownloadType.DOWNLOAD
@ -364,35 +446,6 @@ object DownloadObserver {
type = ExposureUtils.DownloadType.PLUGIN_DOWNLOAD
}
if (downloadEntity.isVGame()) {
SensorsBridge.trackEvent(
"HaloFunGameDownloadDone",
"game_name", downloadEntity.name,
"game_id", downloadEntity.gameId,
"game_schema_type", if (downloadEntity.getMetaExtra(VHelper.KEY_BIT) == "32") "32位" else "64位"
)
} else if (downloadEntity.gameId == Constants.HALO_FUN_GAME_ID) {
SensorsBridge.trackEvent(
"HaloFunDownloadDone",
"space_schema_type",
if (downloadEntity.packageName == VHelper.VSPACE_32BIT_PACKAGENAME) "32位" else "64位"
)
} else if (downloadEntity.gameId != Constants.GHZS_GAME_ID && downloadEntity.getMetaExtra(Constants.EXTRA_DOWNLOAD_TYPE) != Constants.SIMULATOR_DOWNLOAD) {
SensorsBridge.trackEvent(
"DownloadProcessFinish",
"game_id", downloadEntity.gameId,
"game_name", downloadEntity.meta[Constants.GAME_NAME] ?: "",
"game_type", downloadEntity.meta[Constants.GAME_CATEGORY_IN_CHINESE] ?: "",
"game_schema_type", if (downloadEntity.getMetaExtra(VHelper.KEY_BIT) == "32") "32位" else "64位",
"page_name", getCurrentPageEntity().pageName,
"page_id", getCurrentPageEntity().pageId,
"page_business_id", getCurrentPageEntity().pageBusinessId,
"last_page_name", getLastPageEntity().pageName,
"last_page_id", getLastPageEntity().pageId,
"last_page_business_id", getLastPageEntity().pageBusinessId
)
}
var downloadSpeed = 0L
val elapsedTimeString = downloadEntity.meta[DownloadConfig.KEY_DOWNLOAD_ELAPSED_TIME]
if (elapsedTimeString != null) {
@ -405,7 +458,7 @@ object DownloadObserver {
val isPlatformRecommend =
java.lang.Boolean.parseBoolean(downloadEntity.getMetaExtra(Constants.IS_PLATFORM_RECOMMEND))
ExposureUtils.logADownloadCompleteExposureEvent(
val exposureEvent = ExposureUtils.logADownloadCompleteExposureEvent(
GameEntity(
id = downloadEntity.gameId,
mName = downloadEntity.name.removeSuffix(Constants.GAME_NAME_DECORATOR),
@ -422,6 +475,42 @@ object DownloadObserver {
type
)
if (downloadEntity.asVGame()) {
SensorsBridge.trackEventWithExposureSource(
"HaloFunGameDownloadDone",
exposureEvent?.source,
"game_name", downloadEntity.name,
"game_id", downloadEntity.gameId,
"game_schema_type", if (downloadEntity.getMetaExtra(VHelper.KEY_BIT) == "32") "32位" else "64位"
)
} else if (downloadEntity.gameId == Constants.HALO_FUN_GAME_ID) {
SensorsBridge.trackEvent(
"HaloFunDownloadDone",
"space_schema_type",
if (downloadEntity.packageName == VHelper.VSPACE_32BIT_PACKAGENAME) "32位" else "64位"
)
}
if (downloadEntity.gameId != Constants.GHZS_GAME_ID
&& downloadEntity.getMetaExtra(Constants.EXTRA_DOWNLOAD_TYPE) != Constants.SIMULATOR_DOWNLOAD
&& downloadEntity.gameId != Constants.HALO_FUN_GAME_ID) {
SensorsBridge.trackEventWithExposureSource(
"DownloadProcessFinish",
exposureEvent?.source,
"game_id", downloadEntity.gameId,
"game_name", downloadEntity.meta[Constants.GAME_NAME] ?: "",
"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,
"page_business_id", getCurrentPageEntity().pageBusinessId,
"last_page_name", getLastPageEntity().pageName,
"last_page_id", getLastPageEntity().pageId,
"last_page_business_id", getLastPageEntity().pageBusinessId,
"download_type", if (downloadEntity.asVGame()) "畅玩下载" else "本地下载",
)
}
DataCollectionUtils.uploadDownload(mApplication, downloadEntity, "完成")
}

View File

@ -15,18 +15,19 @@ import android.text.TextUtils;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.gh.gamecenter.common.base.activity.ToolBarActivity;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.MainActivity;
import com.gh.gamecenter.SplashScreenActivity;
import com.gh.gamecenter.common.avoidcallback.AvoidOnResultManager;
import com.gh.gamecenter.common.avoidcallback.Callback;
import com.gh.gamecenter.common.base.activity.ToolBarActivity;
import com.gh.gamecenter.common.base.fragment.ToolbarFragment;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.core.utils.ClassUtils;
import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.gamecenter.core.utils.SPUtils;
import com.halo.assistant.HaloApp;
import com.lightgame.utils.AppManager;
import com.lightgame.utils.Utils;
import org.json.JSONException;
@ -66,8 +67,8 @@ public class EntranceUtils {
public static void jumpActivity(Context context, Bundle bundle) {
bundle.putBoolean(KEY_REQUIRE_REDIRECT, true);
if (HaloApp.getInstance().isRunningForeground) {
// 应用正在运行,前台或后台
if (AppManager.getInstance().findActivity(MainActivity.class) != null) {
// 应用正在运行,前台或后台且MainActivity在栈中
String to = bundle.getString(KEY_TO);
Class<?> clazz = ClassUtils.forName(to);
if (clazz == null) clazz = MainActivity.class;
@ -92,8 +93,8 @@ public class EntranceUtils {
public static void jumpActivity(Context context, Bundle nextToBundle, Bundle bundle, Callback callback) {
bundle.putBoolean(KEY_REQUIRE_REDIRECT, true);
if (HaloApp.getInstance().isRunningForeground) {
// 应用正在运行,前台或后台
if (AppManager.getInstance().findActivity(MainActivity.class) != null) {
// 应用正在运行,前台或后台且MainActivity在栈中
String to = bundle.getString(KEY_TO);
Class<?> clazz = ClassUtils.forName(to);
if (clazz == null) clazz = MainActivity.class;

View File

@ -18,7 +18,6 @@ import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.entity.ErrorEntity
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.login.user.LoginTag
import com.halo.assistant.fragment.user.UserInfoEditFragment
import com.halo.assistant.fragment.user.VerifyPhoneFragment
import com.lightgame.utils.AppManager
@ -236,7 +235,7 @@ object ErrorHelper {
)
}
binding.hintTv.text = errorEntity.data?.text
binding.hintTv.setTextColor(R.color.theme_font.toColor(context))
binding.hintTv.setTextColor(R.color.text_theme.toColor(context))
binding.hintTv.setOnClickListener {
errorEntity.data?.toLinkEntity()?.let { entity ->
DirectUtils.directToLinkPage(context, entity, "实名提醒弹窗", "")
@ -297,7 +296,7 @@ object ErrorHelper {
)
}
binding.hintTv.text = errorEntity.data?.text
binding.hintTv.setTextColor(R.color.theme_font.toColor(context))
binding.hintTv.setTextColor(R.color.text_theme.toColor(context))
binding.hintTv.setOnClickListener {
errorEntity.data?.toLinkEntity()?.let { entity ->
DirectUtils.directToLinkPage(context, entity, "手机号验证", "")

View File

@ -19,25 +19,21 @@ import com.gh.download.server.BrowserInstallHelper
import com.gh.gamecenter.R
import com.gh.gamecenter.WebActivity
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.retrofit.ApiResponse
import com.gh.gamecenter.common.retrofit.EmptyResponse
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.DataLogUtils
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.utils.*
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
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.feature.entity.ApkEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.PluginLocation
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.feature.exposure.ExposureType
import com.gh.gamecenter.feature.utils.ApkActiveUtils
import com.gh.gamecenter.gamedetail.dialog.GamePermissionDialogFragment
@ -112,15 +108,43 @@ object GameActivityDownloadHelper {
// 青少年模式
private fun isTeenageMode(context: Context): Boolean {
if (SPUtils.getBoolean(Constants.SP_TEENAGER_MODE)) {
SensorsBridge.trackAdolescentModeDialogShow(
gameId = mGameEntity?.id ?: "",
gameName = mGameEntity?.name ?: "",
gameType = mGameEntity?.categoryChinese ?: ""
)
DialogHelper.showDialog(
context,
"提示",
"当前处于儿童/青少年模式, \n暂不提供游戏下载",
"退出青少年模式",
"关闭",
{ context.startActivity(TeenagerModeActivity.getIntent(context)) },
{},
DialogHelper.Config(
confirmClickCallback = {
context.startActivity(TeenagerModeActivity.getIntent(context))
SensorsBridge.trackAdolescentModeDialogClick(
buttonName = "退出青少年模式",
gameId = mGameEntity?.id ?: "",
gameName = mGameEntity?.name ?: "",
gameType = mGameEntity?.categoryChinese ?: ""
)
},
cancelClickCallback = {
SensorsBridge.trackAdolescentModeDialogClick(
buttonName = "关闭",
gameId = mGameEntity?.id ?: "",
gameName = mGameEntity?.name ?: "",
gameType = mGameEntity?.categoryChinese ?: ""
)
},
touchOutsideCallback = {
SensorsBridge.trackAdolescentModeDialogClick(
buttonName = "关闭弹窗",
gameId = mGameEntity?.id ?: "",
gameName = mGameEntity?.name ?: "",
gameType = mGameEntity?.categoryChinese ?: ""
)
},
extraConfig = DialogHelper.Config(
centerTitle = true,
centerContent = true
)
@ -179,10 +203,16 @@ object GameActivityDownloadHelper {
) {
val apk = getApk(gameEntity, event, true) ?: return
val downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity)
val str = GameUtils.getDownloadBtnText(context, gameEntity, PluginLocation.only_game)
if (downloadEntity != null &&
str != context.getString(R.string.install) &&
str != context.getString(R.string.launch)
val str = GameUtils.getDownloadBtnText(
context = context,
gameEntity = gameEntity,
isFromList = true,
fixedAsVGame = false,
pluginLocation = PluginLocation.only_game
)
if (downloadEntity != null
&& str != context.getString(R.string.install)
&& str != context.getString(R.string.launch)
) {
ToastUtils.toast("${gameEntity.name}已加入下载队列")
if (BrowserInstallHelper.shouldAutoSwitchAssistantInstall(gameEntity)) {
@ -235,8 +265,8 @@ object GameActivityDownloadHelper {
) {
GamePermissionDialogFragment.show((context as AppCompatActivity), gameEntity, gameEntity.info) {
CertificationDialog.showCertificationDialog(context, gameEntity) {
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name) { isSubscribe: Boolean ->
download(context, gameEntity, apk, isSubscribe, entrance, location, traceEvent)
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name, gameEntity.categoryChinese) { isSubscribe: Boolean ->
download(context, gameEntity, apk, false, isSubscribe, entrance, location, traceEvent)
}
}
}
@ -259,9 +289,10 @@ object GameActivityDownloadHelper {
context,
apk.size,
gameEntity.id,
gameEntity.name
gameEntity.name,
gameEntity.categoryChinese
) { isSubscribe: Boolean ->
download(context, gameEntity, apk, isSubscribe, entrance, location, traceEvent)
download(context, gameEntity, apk, true, isSubscribe, entrance, location, traceEvent)
}
}
}
@ -281,7 +312,7 @@ object GameActivityDownloadHelper {
DownloadDialog.showDownloadDialog(context, gameEntity, traceEvent, entrance, location)
} else {
CertificationDialog.showCertificationDialog(context, gameEntity) {
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name) { isSubscribe: Boolean ->
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name, gameEntity.categoryChinese) { isSubscribe: Boolean ->
plugin(context, gameEntity, apk, entrance, location, isSubscribe, traceEvent)
}
}
@ -295,6 +326,18 @@ object GameActivityDownloadHelper {
apk: ApkEntity,
downloadEntity: DownloadEntity?
) {
com.gh.gamecenter.common.utils.NewFlatLogUtils.logGameInstall(
gameId = downloadEntity?.gameId ?: "",
gameName = downloadEntity?.name ?: "",
trigger = "主动安装"
)
SensorsBridge.trackInstallGameClick(
gameName = downloadEntity?.name ?: "",
gameId = downloadEntity?.gameId ?: "",
action = "主动安装"
)
val simulatorDownloadEntity = SimulatorGameManager.findDownloadEntityByUrl(apk.url)
if (gameEntity.simulator != null) {
val isInstalled =
@ -310,18 +353,16 @@ object GameActivityDownloadHelper {
if (simulatorDownloadEntity != null && SimulatorGameManager.isSimulatorGame(gameEntity) && !isInstalled && !isInstalledNewSimulator) {
SimulatorDownloadManager.getInstance().showDownloadDialog(
context, simulator,
SimulatorDownloadManager.SimulatorLocation.LAUNCH, gameEntity.id, gameEntity.name!!, null
SimulatorDownloadManager.SimulatorLocation.LAUNCH, gameEntity.id, gameEntity.name!!, gameEntity.categoryChinese, null
)
return
}
}
if (gameEntity.isVGame()) {
if (downloadEntity?.isVGameDownloadInDualDownloadMode() == true) {
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity)
} else {
downloadEntity?.run {
install(context, gameEntity, apk, this)
}
downloadEntity?.run { install(context, gameEntity, apk, this) }
}
}
@ -337,7 +378,7 @@ object GameActivityDownloadHelper {
//启动模拟器游戏
if (SimulatorGameManager.isSimulatorGame(gameEntity)) {
if (NewSimulatorGameManager.shouldShowUpdateNewSimulatorAlert(context)) {
NewSimulatorGameManager.showUpdateNewsSimulator(context, null)
NewSimulatorGameManager.showUpdateNewsSimulator(context, gameEntity, null)
return
}
val simulatorDownloadEntity =
@ -345,7 +386,16 @@ object GameActivityDownloadHelper {
if (simulatorDownloadEntity != null) {
val file = File(simulatorDownloadEntity.path)
if (!file.exists()) {
download(context, gameEntity, apk, false, entrance, location, traceEvent)
download(
context = context,
gameEntity = gameEntity,
apk = apk,
asVGame = false,
isSubscribe = false,
entrance = entrance,
location = location,
traceEvent = traceEvent
)
return
}
NewFlatLogUtils.logSimulatorGameCardClick("启动")
@ -354,15 +404,7 @@ object GameActivityDownloadHelper {
return
}
if (gameEntity.isVGame()) {
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity)
return
}
if (entrance.contains("我的游戏")) {
MtaHelper.onEvent("我的游戏_启动", "启动", gameEntity.name)
}
PackageLauncher.launchApp(context, gameEntity, gameEntity.getApk()[0].packageName)
PackageLauncher.launch(context, gameEntity)
}
// 处理更新状态
@ -374,7 +416,7 @@ object GameActivityDownloadHelper {
location: String,
traceEvent: ExposureEvent
) {
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name) { isSubscribe: Boolean ->
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name, gameEntity.categoryChinese) { isSubscribe: Boolean ->
update(context, gameEntity, apk, entrance, location, isSubscribe, traceEvent)
}
}
@ -425,6 +467,7 @@ object GameActivityDownloadHelper {
context: Context,
gameEntity: GameEntity,
apk: ApkEntity,
asVGame: Boolean,
isSubscribe: Boolean,
entrance: String,
location: String,
@ -432,11 +475,7 @@ object GameActivityDownloadHelper {
) {
val msg = FileUtils.isCanDownload(context, apk.size)
if (TextUtils.isEmpty(msg)) {
DownloadManager.createDownload(
context, apk, gameEntity, context.getString(
R.string.download
), entrance, location, isSubscribe, traceEvent
)
DownloadManager.createDownload(context, apk, gameEntity, asVGame, gameEntity.isDualBtnModeEnabled(), entrance, location, isSubscribe, traceEvent)
ToastUtils.toast("${gameEntity.name}已加入下载队列")
if (BrowserInstallHelper.shouldAutoSwitchAssistantInstall(gameEntity)) {
val toast = context.getString(R.string.unsupported_browser_install_hint)
@ -461,7 +500,7 @@ object GameActivityDownloadHelper {
) {
val msg = FileUtils.isCanDownload(context, apk.size)
if (TextUtils.isEmpty(msg)) {
DownloadManager.createDownload(context, apk, gameEntity, "插件化", entrance, location, isSubscribe, traceEvent)
DownloadManager.createDownload(context, apk, gameEntity, false, false, entrance, location, isSubscribe, traceEvent)
ToastUtils.toast("${gameEntity.name}已加入下载队列")
if (BrowserInstallHelper.shouldAutoSwitchAssistantInstall(gameEntity)) {
val toast = context.getString(R.string.unsupported_browser_install_hint)
@ -489,7 +528,16 @@ object GameActivityDownloadHelper {
gameEntity.getEntryMap().remove(apkEntity.getPlatform())
}
PackageUtils.isCanPluggable(apkEntity) -> {
DialogHelper.showPluginDialog(context, gameEntity.pluginDesc) { PackageInstaller.uninstall(context, path) }
DialogHelper.showPluginDialog(
context,
pluginDesc = gameEntity.pluginDesc,
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese,
platform = gameEntity.platform ?: ""
) {
PackageInstaller.uninstall(context, path)
}
}
else -> {
PackageInstaller.install(context, downloadEntity)
@ -507,7 +555,7 @@ object GameActivityDownloadHelper {
isSubscribe: Boolean,
traceEvent: ExposureEvent?
) {
DownloadManager.createDownload(context, apk, gameEntity, "更新", entrance, location, isSubscribe, traceEvent)
DownloadManager.createDownload(context, apk, gameEntity, false, false, entrance, location, isSubscribe, traceEvent)
ToastUtils.toast("${gameEntity.name}已加入下载队列")
if (BrowserInstallHelper.shouldAutoSwitchAssistantInstall(gameEntity)) {
val toast = context.getString(R.string.unsupported_browser_install_hint)

View File

@ -1,12 +1,12 @@
package com.gh.common.util
import android.annotation.SuppressLint
import android.content.Context
import android.text.TextUtils
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.common.utils.doOnMainProcessOnly
import com.gh.gamecenter.common.utils.toJson
import com.gh.gamecenter.common.utils.toObject
import com.gh.gamecenter.core.utils.MtaHelper
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.entity.SubjectEntity
import com.gh.gamecenter.login.user.UserManager
@ -18,17 +18,19 @@ import com.lightgame.utils.Utils
import io.reactivex.schedulers.Schedulers
/**
* 首页补充游戏库辅助
* 补充游戏库管理
*/
object GameSubstituteRepositoryHelper {
private const val SP_GAME_SUB = "sp_game_sub"
private const val KEY_GAME_REPOSITORY = "game_substitute_repository"
private var mSubstitutableGameIdSet = hashSetOf<String>()
private var mApi = RetrofitManager.getInstance().api
private var mHistoricInstalledGameIdSet = hashSetOf<String>() // 历史已安装过的游戏 ID 列表
private var mApplicationContext = HaloApp.getInstance().application
private val mGameSubSp by lazy { mApplicationContext.getSharedPreferences(SP_GAME_SUB, Context.MODE_PRIVATE) }
var gameCollectionList: List<SubjectEntity> = arrayListOf()
private var mGameCollectionList: List<SubjectEntity> = arrayListOf() // 游戏补充库
init {
loadSavedRepository()
@ -50,9 +52,13 @@ object GameSubstituteRepositoryHelper {
})
}
/**
* 联网获取历史已安装过的游戏 ID 列表
* 包括根据用户 ID 获取的已玩游戏 ID 列表,以及根据 gid 获取的已下载游戏 ID 列表
*/
@JvmStatic
@SuppressLint("CheckResult")
fun updateSubstitutableGames() {
fun updateHistoricInstalledGameSet() {
mApplicationContext.doOnMainProcessOnly {
val single = if (UserManager.getInstance().isLoggedIn) {
mApi.getIdListOfPlayedGames(UserManager.getInstance().userId, Utils.getTime(mApplicationContext))
@ -61,28 +67,22 @@ object GameSubstituteRepositoryHelper {
}
single.subscribeOn(Schedulers.io()).subscribe(object : BiResponse<List<String>>() {
override fun onSuccess(data: List<String>) {
mSubstitutableGameIdSet = data.toHashSet()
mHistoricInstalledGameIdSet = data.toHashSet()
}
})
}
}
/**
* 刷新内存中的游戏库(即从 SP 中再读一次)
*/
@JvmStatic
fun refreshRepositoryFromLocal() = loadSavedRepository()
private fun loadSavedRepository() {
gameCollectionList = SPUtils.getString(KEY_GAME_REPOSITORY).toObject() ?: arrayListOf()
mGameCollectionList = SPUtils.getString(mGameSubSp, KEY_GAME_REPOSITORY).toObject() ?: arrayListOf()
}
private fun updateGameRepository(subjects: List<SubjectEntity>?) {
if (subjects == null) return
SPUtils.setString(KEY_GAME_REPOSITORY, subjects.toJson())
SPUtils.setString(mGameSubSp, KEY_GAME_REPOSITORY, subjects.toJson())
gameCollectionList = subjects
mGameCollectionList = subjects
}
/**
@ -90,19 +90,12 @@ object GameSubstituteRepositoryHelper {
* @param collectionId 补充游戏库相应专题 ID
* @param gameIdList 该专题里已经包含的游戏 ID 列表
*/
private fun getOneUniqueGame(collectionId: String?, gameIdList: HashSet<String>): GameEntity? {
private fun getValidGame(collectionId: String?, gameIdList: HashSet<String>): GameEntity? {
collectionId?.let {
val collection = gameCollectionList.find { it.id == collectionId }
val collection = mGameCollectionList.find { it.id == collectionId }
collection?.let {
val game = collection.data?.find { game -> isThisGameUnique(game, gameIdList) }
val game = collection.data?.find { game -> isThisGameValid(game, gameIdList) }
game?.let {
collection.data?.remove(game)
// collection.data?.size?.let { remainingSize ->
// // 记录被替换游戏的数量10个以上的时候触发
// if (remainingSize % 10 == 0) {
// SentryHelper.onEvent("game_substitute", "substituted_size", "${50 - remainingSize}")
// }
// }
// 产品说要记录补充专题的曝光数,所以这个游戏附带了所在专题的名字
game.subjectName = collection.name
game.subjectId = collection.id
@ -115,14 +108,17 @@ object GameSubstituteRepositoryHelper {
/**
* 替换游戏,包括 已安装,历史下载,历史已安装等类型
* @param gameList 需要被替换数据的游戏列表
* @param displayingGameIdSet 页面正在显示的游戏 ID 列表,避免重复替换
* @param relatedCollectionId 关联的替换合集 ID
*/
fun replaceGames(
gameList: MutableList<GameEntity>,
alreadyDisplayedGameIdSet: HashSet<String>,
displayingGameIdSet: HashSet<String>,
relatedCollectionId: String,
shouldLogReplaceEvent: Boolean
) {
val positionOfTheGameToReplaceList = arrayListOf<Int>()
// 需要被替换的游戏 position 列表
val positionOfGameToBeReplacedList = arrayListOf<Int>()
// 标记需要替换的已安装游戏
for ((index, game) in gameList.withIndex()) {
@ -132,28 +128,29 @@ object GameSubstituteRepositoryHelper {
continue
}
var isThisPositionLabeled = false
// 这个 position 的游戏是否需要被替换
var thisPositionNeedToBeReplaced = false
// 从 游戏ID 判断当前游戏是否需要被替换
if (mSubstitutableGameIdSet.contains(game.id)) {
positionOfTheGameToReplaceList.add(index)
isThisPositionLabeled = true
if (mHistoricInstalledGameIdSet.contains(game.id)) {
positionOfGameToBeReplacedList.add(index)
thisPositionNeedToBeReplaced = true
}
// 检查是否已安装该游戏里同包名的 APK
if (!isThisPositionLabeled) {
if (!thisPositionNeedToBeReplaced) {
for (apk in game.getApk()) {
if (PackageHelper.validLocalPackageNameSet.contains(apk.packageName)) {
// 将该位置的游戏标记为需要替换
positionOfTheGameToReplaceList.add(index)
isThisPositionLabeled = true
positionOfGameToBeReplacedList.add(index)
thisPositionNeedToBeReplaced = true
break
}
}
}
// 若此游戏所包含的 apk 没有已安装,那么再检查是否已安装有预设相关包名
if (!isThisPositionLabeled) {
if (!thisPositionNeedToBeReplaced) {
var relatedPackageList = arrayListOf<String>()
for (entity in PackageHelper.relatedPackageList) {
if (entity.gameId == game.id) {
@ -164,39 +161,45 @@ object GameSubstituteRepositoryHelper {
for (packageName in relatedPackageList) {
if (PackageHelper.validLocalPackageNameSet.contains(packageName)) {
positionOfTheGameToReplaceList.add(index)
positionOfGameToBeReplacedList.add(index)
break
}
}
}
}
if (positionOfTheGameToReplaceList.isNotEmpty()) {
if (shouldLogReplaceEvent) {
MtaHelper.onEvent("首页_加载", "启动光环", "替换游戏")
}
for (position in positionOfTheGameToReplaceList) {
val replacingGame = getOneUniqueGame(relatedCollectionId, alreadyDisplayedGameIdSet)
replacingGame?.let {
gameList[position] = replacingGame
if (positionOfGameToBeReplacedList.isNotEmpty()) {
for (position in positionOfGameToBeReplacedList) {
val validGame = getValidGame(relatedCollectionId, displayingGameIdSet)
validGame?.let {
gameList[position] = it
displayingGameIdSet.add(it.id)
}
}
}
}
private fun isThisGameUnique(game: GameEntity, gameIdList: HashSet<String>): Boolean {
// 判断该游戏是否出现在已安装列表
if (mSubstitutableGameIdSet.contains(game.id)) return false
/**
* 判断该游戏是否有效
* @param game 需要判断的游戏
* @param gameIdList 专题里已经包含的游戏 ID 列表
*/
private fun isThisGameValid(
game: GameEntity,
gameIdList: HashSet<String>
): Boolean {
// 该游戏是否在历史已安装列表中
if (mHistoricInstalledGameIdSet.contains(game.id)) return false
// 该补充游戏是否已经存在关联关系
// 该游戏是否与专题里已包含的游戏存在关联关系
for (relatedId in game.relatedGameIds!!) {
if (gameIdList.contains(relatedId)) {
return false
}
}
// 检查本地是否已安装该游戏,已过滤部分框架服务的包名
for (apk in game.getApk()) {
// 检查本地是否已安装该游戏,已过滤那部分框架服务的包名
if (PackageHelper.validLocalPackageNameSet.contains(apk.packageName)) {
return false
}

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