Compare commits

...

30 Commits

Author SHA1 Message Date
1023e0492b feat: 测试插件化
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-04-25 17:02:54 +08:00
0fda3ecfcd feat: 合规调整-已安装列表权限-2024/4/22(gitlab-ci) https://jira.shanqu.cc/browse/GHZSCY-5250
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-04-25 11:09:55 +08:00
166abd5c9b feat: 合规调整-已安装列表权限-2024/4/22 https://jira.shanqu.cc/browse/GHZSCY-5250
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-04-25 11:08:52 +08:00
af3102f6be feat: 合规调整-已安装列表权限-2024/4/22 https://jira.shanqu.cc/browse/GHZSCY-5250
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-04-25 10:11:45 +08:00
93363f23b4 feat: 合规调整-已安装列表权限-2024/4/22 https://jira.shanqu.cc/browse/GHZSCY-5250
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-04-24 16:15:31 +08:00
a552677e41 Merge branch 'chen/202404/GHZSCY-5187-2' into 'dev'
style:匹配按钮设计规范...

See merge request halo/android/assistant-android!1645
2024-04-24 16:12:37 +08:00
bb148f42b8 style:匹配按钮设计规范 https://jira.shanqu.cc/browse/GHZSCY-5187?focusedCommentId=61918&page=com.atlassian.jira.plugin.system.issuetabpanels%253Acomment-tabpanel#comment-61918 2024-04-24 16:09:44 +08:00
065aa96e18 Merge branch 'fix/GHZSCY-5236' into 'dev'
fix: 多渠道多版本-首次启动跳转问题 https://jira.shanqu.cc/browse/GHZSCY-5236

See merge request halo/android/assistant-android!1640
2024-04-24 11:43:36 +08:00
d9a90ca80b fix: 多渠道多版本-首次启动跳转问题 https://jira.shanqu.cc/browse/GHZSCY-5236 2024-04-24 11:10:39 +08:00
2aeffb1cc4 Merge branch 'chen/202404/GHZSCY-5187' into 'dev'
style:匹配按钮设计规范...

See merge request halo/android/assistant-android!1644
2024-04-23 17:47:19 +08:00
d3188cc3cd style:匹配按钮设计规范 https://jira.shanqu.cc/browse/GHZSCY-5187?focusedCommentId=61918&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-61918 2024-04-23 17:42:52 +08:00
1d7f902a81 feat: 移除一键登录 SDK 依赖 (移除相关无用的资源)
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-04-23 16:19:59 +08:00
13a40806e4 Merge branch 'fix/GHZS-5009' into 'dev'
fix: 插件问题反馈内容默认文案出错 https://jira.shanqu.cc/browse/GHZS-5009

See merge request halo/android/assistant-android!1637
2024-04-23 15:04:29 +08:00
b56e5c4022 Merge branch 'feat/GHZS-5188' into 'dev'
feat: 调整客户端用到的部分域名(同时移除已经从未上线的光能部分相关代码) https://jira.shanqu.cc/browse/GHZS-5188

See merge request halo/android/assistant-android!1638
2024-04-23 15:04:21 +08:00
acca1537da Merge branch 'feat/optimise_package_privacy' into 'dev'
feat: 移除一键登录 SDK 依赖

See merge request halo/android/assistant-android!1642
2024-04-23 15:04:12 +08:00
6e5b639d58 feat: 调整客户端用到的部分域名(同时移除已经从未上线的光能部分相关代码) https://jira.shanqu.cc/browse/GHZS-5188 2024-04-23 14:43:10 +08:00
24000f55af feat: 移除一键登录 SDK 依赖 2024-04-22 17:56:04 +08:00
3540c4626d Merge branch 'fix/update_crash' into 'dev'
fix: 修复软更时更新弹窗回到桌面由于下载监听移除不及时导致的闪退问题

See merge request halo/android/assistant-android!1636
2024-04-22 15:34:30 +08:00
e6a2758fdb fix: 修复软更时更新弹窗回到桌面由于下载监听移除不及时导致的闪退问题 2024-04-22 15:08:02 +08:00
a56e2bd16e Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	dependencies.gradle
2024-04-22 14:01:25 +08:00
e038c565ff Merge branch 'hotfix/v5.34.8-1038/authorization_crash' into 'release'
fix: 修复通用授权登陆界面出现的闪退问题...

See merge request halo/android/assistant-android!1635
2024-04-22 13:57:42 +08:00
ec5905bb11 fix: 修复通用授权登陆界面出现的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/373879/events/b72b2eb3c7ef4426ba8d42ff5a476bbe/?project=22 2024-04-22 13:49:47 +08:00
21f50c4eed Merge branch 'hotfix/v5.34.8-1038/optional_update_crash' into 'release'
fix: 修复软更时取消弹窗切换页面后有机率触发闪退的问题 https://sentry.shanqu.cc/organizations/lightgame/issues/380566

See merge request halo/android/assistant-android!1634
2024-04-22 11:42:21 +08:00
5a93f3671b fix: 修复软更时取消弹窗切换页面后有机率触发闪退的问题 https://sentry.shanqu.cc/organizations/lightgame/issues/380566 2024-04-22 11:04:57 +08:00
6dcb8b6efe Merge branch 'fix/GHZSCY-5244' into 'dev'
fix:【光环助手】5.35验收问题:极光推送触发了APP角标提示,但不能消除 https://jira.shanqu.cc/browse/GHZSCY-5244

See merge request halo/android/assistant-android!1633
2024-04-19 18:06:48 +08:00
d60916b3bc fix:【光环助手】5.35验收问题:极光推送触发了APP角标提示,但不能消除 https://jira.shanqu.cc/browse/GHZSCY-5244 2024-04-19 18:06:48 +08:00
4e00b5db19 chore: 版本更新至 5.34.8 2024-04-17 15:59:16 +08:00
e6a6bbcf97 Merge branch 'feat/GHZS-5229' into 'release'
chore: 神策 SDK 更新至 6.8.0

See merge request halo/android/assistant-android!1629
2024-04-17 15:58:35 +08:00
0eecc4699f chore: 神策 SDK 更新至 6.8.0 2024-04-17 15:56:04 +08:00
920e7a8038 fix: 插件问题反馈内容默认文案出错 https://jira.shanqu.cc/browse/GHZS-5009
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-03-21 10:07:14 +08:00
107 changed files with 1862 additions and 1963 deletions

View File

@ -71,7 +71,7 @@ android_build:
exit_codes: 137
only:
- dev
- release
- feat/GHZSCY-5250
# 代码检查
sonarqube_analysis:
@ -152,4 +152,4 @@ oss-upload&send-email:
- /usr/local/bin/python /ci-android-mail-jira-comment.py
only:
- dev
- release
- feat/GHZSCY-5250

3
.gitmodules vendored
View File

@ -5,9 +5,6 @@
[submodule "vspace-bridge"]
path = vspace-bridge
url = ../../../cwzs/android/vspace-bridge.git
[submodule "module_common/src/debug/assets/assistant-android-mock"]
path = module_common/src/debug/assets/assistant-android-mock
url = ../../../halo/android/assistant-android-mock.git
[submodule "ndownload"]
path = ndownload
url = ../../../android/ndownload.git

View File

@ -11,6 +11,12 @@
<package android:name="com.lg.vspace" />
</queries>
<!-- 华为/荣耀角标 -->
<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE "/>
<uses-permission android:name="com.hihonor.android.launcher.permission.CHANGE_BADGE" />
<!-- vivo角标 -->
<uses-permission android:name="com.vivo.notification.permission.BADGE_ICON" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />
<!-- 允许应用程序访问网络连接 -->

View File

@ -6,8 +6,6 @@
<link rel="stylesheet" type="text/css" href="normalize.css">
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" type="text/css" href="video-js.min.css">
<!-- <link rel="stylesheet" href="https://static-web.ghzs.com/website-static/lib/video-js.min.css">--> <!--在web页面播放视频-->
<!--<link rel="stylesheet" type="text/css" href="https://resource.ghzs.com/css/halo_app.css">-->
</head>
<body style="overflow-x: hidden; word-break: break-all;">
@ -15,8 +13,5 @@
<script type="text/javascript" src="zepto.min.js"></script>
<script type="text/javascript" src="rich_editor.js"></script>
<script type="text/javascript" src="video.min.js"></script>
<!--<script src="https://static-web.ghzs.com/website-static/lib/video.min.js"></script>--> <!--在web页面播放视频-->
<!--<script type="text/javascript" src="content.js"></script>-->
<!--<script type="text/javascript" src="https://resource.ghzs.com/js/halo_app.js"></script>-->
</body>
</html>

View File

@ -34,18 +34,18 @@ try {
var script = document.createElement("script")
document.body.appendChild(script)
if (isDebug) {
script.src = "https://resource.ghzs.com/js/halo_app_test.js" + "?timestamp=" + Math.round(new Date().getTime() / 1000)
script.src = "https://dev-and-static.ghzs66.com/web/js/halo.js" + "?timestamp=" + Math.round(new Date().getTime() / 1000)
} else {
script.src = "https://resource.ghzs.com/js/halo.js" + "?timestamp=" + Math.round(new Date().getTime() / 1000 / 1000)
script.src = "https://and-static.ghzs66.com/web/js/halo.js" + "?timestamp=" + Math.round(new Date().getTime() / 1000 / 1000)
}
var style = document.createElement("link")
style.rel = "stylesheet"
style.type = "text/css"
if (isDebug) {
style.href = "https://resource.ghzs.com/css/halo_app_test.css" + "?timestamp=" + Math.round(new Date().getTime() / 1000)
style.href = "https://dev-and-static.ghzs66.com/web/css/halo.css" + "?timestamp=" + Math.round(new Date().getTime() / 1000)
} else {
style.href = "https://resource.ghzs.com/css/halo.css" + "?timestamp=" + Math.round(new Date().getTime() / 1000 / 1000)
style.href = "https://and-static.ghzs66.com/web/css/halo.css" + "?timestamp=" + Math.round(new Date().getTime() / 1000 / 1000)
}
document.head.appendChild(style)

View File

@ -4,6 +4,7 @@ import android.app.Activity
import android.app.Application
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.alibaba.android.arouter.launcher.ARouter
import com.gh.ad.AdDelegateHelper
import com.gh.common.util.FloatingBackViewManager
import com.gh.common.xapk.XapkInstaller
@ -14,7 +15,9 @@ import com.gh.gamecenter.SplashAdActivity
import com.gh.gamecenter.SplashScreenActivity
import com.gh.gamecenter.authorization.AuthorizationActivity
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.utils.PackageFlavorHelper
import com.gh.gamecenter.core.provider.IPushProvider
import com.gh.vspace.VHelper
import com.halo.assistant.HaloApp
@ -81,6 +84,10 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
}
XapkInstaller.updateCurrentInstallStatus()
// 清除桌面角标
val pushProvider = ARouter.getInstance().build(RouteConsts.provider.push).navigation() as? IPushProvider
pushProvider?.cleanBadgeNumber(activity.applicationContext)
}
override fun onActivityPaused(activity: Activity) {

View File

@ -45,7 +45,6 @@ import com.gh.gamecenter.login.user.LoginTag
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.login.user.UserRepository
import com.gh.gamecenter.login.utils.LoginHelper
import com.gh.gamecenter.login.utils.QuickLoginHelper
import com.gh.gamecenter.login.view.LoginActivity
import com.gh.gamecenter.personalhome.border.AvatarBorderActivity
import com.gh.gamecenter.setting.SettingBridge
@ -130,12 +129,12 @@ class DefaultJsApi(
@JavascriptInterface
fun login(msg: Any) {
if (SPUtils.getBoolean(Constants.SP_HAS_GET_PHONE_INFO) || NetworkUtils.isOpenMobileData(context)) {
QuickLoginHelper.startLogin(context, "浏览器")
} else {
// if (SPUtils.getBoolean(Constants.SP_HAS_GET_PHONE_INFO) || NetworkUtils.isOpenMobileData(context)) {
// QuickLoginHelper.startLogin(context, "浏览器")
// } else {
val intent = LoginActivity.getIntent(context, "浏览器")
context.startActivity(intent)
}
// }
}
@JavascriptInterface

View File

@ -57,8 +57,7 @@ public class Config {
public static final String WEIBO_APPKEY = BuildConfig.WEIBO_APPKEY;
public static final String QUICK_LOGIN_APPID = BuildConfig.QUICK_LOGIN_APPID;
public static final String QUICK_LOGIN_APPKEY = BuildConfig.QUICK_LOGIN_APPKEY;
// http://www.ghzs666.com/article/${articleId}.html
public static final String URL_ARTICLE = "http://www.ghzs666.com/article/"; // ghzs/ghzs666 统一
public static final String URL_ARTICLE = "www.ghzs666.com/article/"; // ghzs/ghzs666 统一
private static final String SETTINGS_KEY = "settingsKey";
@ -95,8 +94,7 @@ public class Config {
getPreferences().edit().putString(SETTINGS_KEY, GsonUtils.toJson(settingsEntity)).apply();
mSettingsEntity = settingsEntity;
// 加载完设置后刷新下
PackageHelper.initList();
PackageHelper.refreshList();
}
@Nullable

View File

@ -19,6 +19,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.gh.common.util.DirectUtils
import com.gh.common.util.LogUtils
import com.gh.common.util.PackageHelper
import com.gh.common.util.PackageUtils
import com.gh.download.DownloadManager
import com.gh.gamecenter.R
@ -59,7 +60,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
private val mDuration = 3000
private var mDisposable: Disposable? = null
private var mAdapter: PackageCheckAdapter? = null
private var mAllInstalledPackages = PackageUtils.getInstalledPackages(HaloApp.getInstance().application, 0)
private var mAllInstalledPackages = PackageHelper.getInstalledPackages(HaloApp.getInstance().application, 0)
var gameEntity: GameEntity? = null
var callBack: ConfirmListener? = null
@ -325,7 +326,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
override fun onResume() {
super.onResume()
mAllInstalledPackages = PackageUtils.getInstalledPackages(HaloApp.getInstance().application, 0)
mAllInstalledPackages = PackageHelper.getInstalledPackages(HaloApp.getInstance().application, 0)
gameEntity?.packageDialog?.let {
if (isAllPackageInstalled(mAllInstalledPackages, it)) {
callBack?.onConfirm()
@ -363,7 +364,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
@Subscribe(threadMode = ThreadMode.MAIN)
fun onEventMainThread(busFour: EBPackage) {
if (busFour.isInstalledOrUninstalled()) {
mAllInstalledPackages = PackageUtils.getInstalledPackages(HaloApp.getInstance().application, 0)
mAllInstalledPackages = PackageHelper.getInstalledPackages(HaloApp.getInstance().application, 0)
mAdapter?.notifyDataSetChanged()
}
}
@ -416,7 +417,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
return
}
val allInstalledPackages = PackageUtils.getInstalledPackages(HaloApp.getInstance().application, 0)
val allInstalledPackages = PackageHelper.getInstalledPackages(HaloApp.getInstance().application, 0)
if (isAllPackageInstalled(allInstalledPackages, packageDialogEntity)) {
callBack.onConfirm()
return

View File

@ -22,34 +22,6 @@ class DirectProviderImpl : IDirectProvider {
DirectUtils.directToQqConversation(context, qq)
}
override fun directToCommodityDetail(context: Context, commodityId: String) {
DirectUtils.directToCommodityDetail(context, commodityId)
}
override fun directToEnergyRecord(context: Context) {
DirectUtils.directToEnergyRecord(context)
}
override fun directToEnergyRulePage(context: Context) {
DirectUtils.directToEnergyRulePage(context)
}
override fun directToInviteFriends(context: Context) {
DirectUtils.directToInviteFriends(context)
}
override fun directToExchangeRulePage(context: Context) {
DirectUtils.directToExchangeRulePage(context)
}
override fun directToExchangeCommodityPage(context: Context) {
DirectUtils.directToExchangeCommodityPage(context)
}
override fun directToLotteryParadisePage(context: Context) {
DirectUtils.directToLotteryParadisePage(context)
}
override fun directDouyin(context: Context, userId: String) {
DirectUtils.directDouyin(context, userId)
}
@ -97,26 +69,6 @@ class DirectProviderImpl : IDirectProvider {
DirectUtils.directToAmway(context, fixedTopAmwayCommentId, entrance, path)
}
override fun directToOrderCenter(context: Context) {
DirectUtils.directToOrderCenter(context)
}
override fun directToOrderDetail(context: Context, orderId: String) {
DirectUtils.directToOrderDetail(context, orderId)
}
override fun directToEnergyRecord(context: Context, position: Int) {
DirectUtils.directToEnergyRecord(context, position)
}
override fun directToMyPrizePage(context: Context) {
DirectUtils.directToMyPrizePage(context)
}
override fun directToWinOrderDetail(context: Context, orderId: String, activityId: String) {
DirectUtils.directToWinOrderDetail(context, orderId, activityId)
}
override fun directToQGame(context: Context) {
return DirectUtils.directToQGameHome(context)
}

View File

@ -3,6 +3,7 @@ package com.gh.common.provider
import android.content.Context
import android.content.pm.PackageInfo
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.PackageHelper
import com.gh.common.util.PackageUtils
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IPackageUtilsProvider
@ -23,7 +24,7 @@ class PackageUtilsProviderImpl : IPackageUtilsProvider {
}
override fun getInstalledPackages(context: Context, flag: Int): List<PackageInfo> {
return PackageUtils.getInstalledPackages(context, flag)
return PackageHelper.getInstalledPackages(context, flag)
}
override fun getApkSignatureByPackageName(context: Context, packageName: String): Array<String> {
@ -38,6 +39,10 @@ class PackageUtilsProviderImpl : IPackageUtilsProvider {
return PackageUtils.isSignedByGh(context, packageName)
}
override fun isInstalledWithLauncherIcon(context: Context, packageName: String): Boolean {
return PackageUtils.isInstalled(context, packageName)
}
override fun getInstalledTime(context: Context, packageName: String): Long {
return PackageUtils.getInstalledTime(context, packageName)
}

View File

@ -166,162 +166,160 @@ class SimulatorDownloadManager private constructor() {
this.gameName = gameName
this.gameType = gameCategoryChinese
PermissionHelper.checkGetInstalledAppsListBeforeAction(context, object : EmptyCallback {
override fun onCallback() {
val isInstalledNewSimulator =
SimulatorGameManager.isNewSimulatorInstalled(HaloApp.getInstance().application)
//当没有安装新版本模拟器时候 判断是否隐藏
if (simulator?.active == false && !isInstalledNewSimulator) {
showNoneEmulatorDialog(context)
return
}
var isInstalled = PackageUtils.isInstalledFromAllPackage(
context,
simulator?.apk?.packageName
)
//模拟器管理界面还是用之前的逻辑
if (isInstalledNewSimulator && location != SimulatorLocation.SIMULATOR_MANAGE) {
isInstalled = isInstalledNewSimulator
}
// val versionFromInstalledApp = PackageUtils.getVersionNameByPackageName(simulator?.apk?.packageName)
val shouldShowUpdate =
PackageUtils.isInstalledApkMatchedMd5(simulator?.apk?.packageName, simulator?.apk?.md5)
val showAlertTag = SPUtils.getString(SimulatorGameManager.SIMULATOR_UPDATE_SHOW_ALERT_TAG, "") //当天是否弹过
val todayIsShow = showAlertTag == TimeUtils.getToday()
downloadType = if (shouldShowUpdate && isInstalled) "update" else "download"
if (downloadType == "update" && todayIsShow && location != SimulatorLocation.SIMULATOR_MANAGE) {
return
}
if (downloadType == "download" && isInstalled) {
return
}
val title = 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 "取消"
val trackableEntity = TrackableEntity(
"模拟器下载",
key = if (shouldShowUpdate && isInstalled) "更新弹窗" else "下载弹窗",
logShowEvent = true
)
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,
message,
positiveText,
negativeText,
trackMtaEvent = true,
cancelClickCallback = {
if (shouldShowUpdate && isInstalled) {
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, 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)
)
if (downloadType == "update" && location != SimulatorLocation.SIMULATOR_MANAGE) {
SPUtils.setString(SimulatorGameManager.SIMULATOR_UPDATE_SHOW_ALERT_TAG, TimeUtils.getToday())
}
PermissionHelper.checkGetInstalledAppsListBeforeAction(context) { _ ->
val isInstalledNewSimulator =
SimulatorGameManager.isNewSimulatorInstalled(HaloApp.getInstance().application)
//当没有安装新版本模拟器时候 判断是否隐藏
if (simulator?.active == false && !isInstalledNewSimulator) {
showNoneEmulatorDialog(context)
return@checkGetInstalledAppsListBeforeAction
}
})
var isInstalled = PackageUtils.isInstalledFromAllPackage(
context,
simulator?.apk?.packageName
)
//模拟器管理界面还是用之前的逻辑
if (isInstalledNewSimulator && location != SimulatorLocation.SIMULATOR_MANAGE) {
isInstalled = isInstalledNewSimulator
}
// val versionFromInstalledApp = PackageUtils.getVersionNameByPackageName(simulator?.apk?.packageName)
val shouldShowUpdate =
PackageUtils.isInstalledApkMatchedMd5(simulator?.apk?.packageName, simulator?.apk?.md5)
val showAlertTag = SPUtils.getString(SimulatorGameManager.SIMULATOR_UPDATE_SHOW_ALERT_TAG, "") //当天是否弹过
val todayIsShow = showAlertTag == TimeUtils.getToday()
downloadType = if (shouldShowUpdate && isInstalled) "update" else "download"
if (downloadType == "update" && todayIsShow && location != SimulatorLocation.SIMULATOR_MANAGE) {
return@checkGetInstalledAppsListBeforeAction
}
if (downloadType == "download" && isInstalled) {
return@checkGetInstalledAppsListBeforeAction
}
val title = 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 "取消"
val trackableEntity = TrackableEntity(
"模拟器下载",
key = if (shouldShowUpdate && isInstalled) "更新弹窗" else "下载弹窗",
logShowEvent = true
)
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,
message,
positiveText,
negativeText,
trackMtaEvent = true,
cancelClickCallback = {
if (shouldShowUpdate && isInstalled) {
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, 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)
)
if (downloadType == "update" && location != SimulatorLocation.SIMULATOR_MANAGE) {
SPUtils.setString(SimulatorGameManager.SIMULATOR_UPDATE_SHOW_ALERT_TAG, TimeUtils.getToday())
}
}
}
fun showDownloadingDialog(

View File

@ -1,17 +1,11 @@
package com.gh.common.util;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.core.utils.CurrentActivityHolder;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.login.utils.QuickLoginHelper;
import com.gh.gamecenter.login.view.LoginActivity;
import com.gh.gamecenter.common.utils.NetworkUtils;
import com.gh.gamecenter.core.utils.SPUtils;
import com.gh.gamecenter.login.user.UserManager;
import com.lightgame.utils.Utils;
@ -28,15 +22,15 @@ public class CheckLoginUtils {
LogUtils.login("dialog", null, entrance);
LogUtils.login("activity", null, entrance);
if (SPUtils.getBoolean(Constants.SP_HAS_GET_PHONE_INFO) || NetworkUtils.isOpenMobileData(context)) {
startQuickLogin(context, entrance);
} else {
// 有可能App未启动
Bundle bundle = new Bundle();
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance);
bundle.putString(EntranceConsts.KEY_TO, LoginActivity.class.getName());
EntranceUtils.jumpActivity(context, bundle);
}
// if (SPUtils.getBoolean(Constants.SP_HAS_GET_PHONE_INFO) || NetworkUtils.isOpenMobileData(context)) {
// startQuickLogin(context, entrance);
// } else {
// 有可能App未启动
Bundle bundle = new Bundle();
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance);
bundle.putString(EntranceConsts.KEY_TO, LoginActivity.class.getName());
EntranceUtils.jumpActivity(context, bundle);
// }
} else {
if (listener != null) {
listener.onLogin();
@ -44,16 +38,16 @@ public class CheckLoginUtils {
}
}
private static void startQuickLogin(Context context, String entrance) {
// 需要确保传入的 context 不为 application
if (!(context instanceof Activity)) {
context = CurrentActivityHolder.getCurrentActivity();
}
if (context != null) {
QuickLoginHelper.startLogin(context, entrance);
}
}
// private static void startQuickLogin(Context context, String entrance) {
// // 需要确保传入的 context 不为 application
// if (!(context instanceof Activity)) {
// context = CurrentActivityHolder.getCurrentActivity();
// }
//
// if (context != null) {
// QuickLoginHelper.startLogin(context, entrance);
// }
// }
public static void checkLogin(final Context context, Bundle nextToBundle, boolean isTriggerNextStep, String entrance, OnLoginListener listener) {
if (!isLogin()) {

View File

@ -1625,211 +1625,6 @@ object DirectUtils {
jumpActivityCompat(context, newBundle)
}
/**
* 跳转至商品详情
*/
@JvmStatic
fun directToCommodityDetail(context: Context, commodityId: String) {
var url: String = if (EnvHelper.isDevEnv) {
Constants.COMMODITY_DETAIL_ADDRESS_DEV
} else {
Constants.COMMODITY_DETAIL_ADDRESS
}
url = String.format(
Locale.CHINA,
"%s&shopid=%s&timestamp=%d",
url,
commodityId,
(Date().time / 1000 / 1000.toFloat()).roundToInt()
)
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至光能记录默认跳到光能记录第一个Tab
*/
@JvmStatic
fun directToEnergyRecord(context: Context) {
directToEnergyRecord(context, 0)
}
@JvmStatic
fun directToEnergyRecord(context: Context, position: Int) {
var url: String = if (EnvHelper.isDevEnv) {
Constants.ENERGY_RECORD_ADDRESS_DEV
} else {
Constants.ENERGY_RECORD_ADDRESS
}
url = String.format(
Locale.CHINA,
"%s&position=%s&timestamp=%d",
url,
position,
(Date().time / 1000 / 1000.toFloat()).roundToInt()
)
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至订单中心
*/
@JvmStatic
fun directToOrderCenter(context: Context) {
val url: String = if (EnvHelper.isDevEnv) {
Constants.ORDER_CENTER_ADDRESS_DEV
} else {
Constants.ORDER_CENTER_ADDRESS
}
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至订单详情
*/
@JvmStatic
fun directToOrderDetail(context: Context, orderId: String) {
var url: String = if (EnvHelper.isDevEnv) {
Constants.ORDER_DETAIL_ADDRESS_DEV
} else {
Constants.ORDER_DETAIL_ADDRESS
}
url = String.format(
Locale.CHINA,
"%s&order_id=%s&timestamp=%d",
url,
orderId,
(Date().time / 1000 / 1000.toFloat()).roundToInt()
)
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至邀请好友
*/
@JvmStatic
fun directToInviteFriends(context: Context) {
val url: String = if (EnvHelper.isDevEnv) {
Constants.INVITE_FRIENDS_ADDRESS_DEV
} else {
Constants.INVITE_FRIENDS_ADDRESS
}
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至等级页面
*/
@JvmStatic
fun directToLevelPage(context: Context) {
var url: String = if (isPublishEnv()) {
Constants.LEVEL_ADDRESS
} else {
Constants.LEVEL_ADDRESS_DEV
}
url = String.format(Locale.CHINA, "%s?timestamp=%d", url, (Date().time / 1000 / 1000.toFloat()).roundToInt())
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至兑换规则
*/
@JvmStatic
fun directToExchangeRulePage(context: Context) {
var url: String = if (isPublishEnv()) {
Constants.EXCHANGE_RULE_ADDRESS
} else {
Constants.EXCHANGE_RULE_ADDRESS_DEV
}
url = String.format(Locale.CHINA, "%s&timestamp=%d", url, (Date().time / 1000 / 1000.toFloat()).roundToInt())
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至光能规则
*/
@JvmStatic
fun directToEnergyRulePage(context: Context) {
var url: String = if (isPublishEnv()) {
Constants.ENERGY_RULE_ADDRESS
} else {
Constants.ENERGY_RULE_ADDRESS_DEV
}
url = String.format(Locale.CHINA, "%s&timestamp=%d", url, (Date().time / 1000 / 1000.toFloat()).roundToInt())
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至兑换商品
*/
@JvmStatic
fun directToExchangeCommodityPage(context: Context) {
var url: String = if (isPublishEnv()) {
Constants.EXCHANGE_COMMODITY_ADDRESS
} else {
Constants.EXCHANGE_COMMODITY_ADDRESS_DEV
}
url = String.format(Locale.CHINA, "%s&timestamp=%d", url, (Date().time / 1000 / 1000.toFloat()).roundToInt())
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至抽奖乐园
*/
@JvmStatic
fun directToLotteryParadisePage(context: Context) {
var url: String = if (isPublishEnv()) {
Constants.LOTTERY_PARADISE_ADDRESS
} else {
Constants.LOTTERY_PARADISE_ADDRESS_DEV
}
url = String.format(Locale.CHINA, "%s&timestamp=%d", url, (Date().time / 1000 / 1000.toFloat()).roundToInt())
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至我的奖品
*/
@JvmStatic
fun directToMyPrizePage(context: Context) {
var url: String = if (isPublishEnv()) {
Constants.MY_PRIZE_ADDRESS
} else {
Constants.MY_PRIZE_ADDRESS_DEV
}
url = String.format(Locale.CHINA, "%s&timestamp=%d", url, (Date().time / 1000 / 1000.toFloat()).roundToInt())
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至中奖订单详情
*/
@JvmStatic
fun directToWinOrderDetail(context: Context, orderId: String, activityId: String) {
var url: String = if (isPublishEnv()) {
Constants.WIN_ORDER_DETAIL_ADDRESS
} else {
Constants.WIN_ORDER_DETAIL_ADDRESS_DEV
}
url = String.format(
Locale.CHINA,
"%s&order_id=%s&activity_id=%s&timestamp=%d",
url,
orderId,
activityId,
(Date().time / 1000 / 1000.toFloat()).roundToInt()
)
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至地址信息

View File

@ -35,8 +35,6 @@ object HomeBottomBarHelper {
text = "游戏库",
name = "游戏库",
position = 2,
iconSelect = "https://resource.ghzs.com/image/game/library/entrance/5e183202913fbd002c75f247.png",
iconUnselect = "https://resource.ghzs.com/image/game/library/entrance/5e1831fd913fbd003024641e.png",
animationCode = animationCode,
default = false,
display = Display()

View File

@ -50,7 +50,7 @@ public class InstallUtils {
public void handleMessage(Message msg) {
if (msg.what == INSTALL_WHAT && packageManager != null) {
ArrayList<String> list = new ArrayList<>();
List<PackageInfo> packageInfos = PackageUtils.getInstalledPackages(context, 0);
List<PackageInfo> packageInfos = PackageHelper.INSTANCE.getInstalledPackages(context, 0);
for (PackageInfo packageInfo : packageInfos) {
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
list.add(packageInfo.packageName);

View File

@ -768,7 +768,7 @@ public class LibaoUtils {
}
public static boolean isAppInstalled(Context context, String packageName) {
List<PackageInfo> pinfo = PackageUtils.getInstalledPackages(context, 0);
List<PackageInfo> pinfo = PackageHelper.INSTANCE.getInstalledPackages(context, 0);
if (pinfo != null) {
for (int i = 0; i < pinfo.size(); i++) {
String pn = pinfo.get(i).packageName;

View File

@ -2,23 +2,53 @@ package com.gh.common.util
import android.content.Context
import android.content.pm.ApplicationInfo
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.content.pm.PermissionInfo
import android.os.Build
import android.provider.Settings
import com.gh.common.constant.Config
import com.gh.gamecenter.common.utils.PermissionHelper.isGetInstalledListPermissionDisabled
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.feature.entity.SettingsEntity
import com.halo.assistant.HaloApp
import com.lightgame.utils.Utils
import java.io.BufferedReader
import java.io.IOException
import java.io.InputStreamReader
import kotlin.collections.ArrayList
import kotlin.collections.HashSet
object PackageHelper {
private const val TAG = "PackageHelper"
private const val SP_GET_INSTALLED_API_AGREED = "get_installed_api_agreed"
private const val UNKNOWN = -1
private const val UNSUPPORTED = 0
private const val SUPPORTED = 1
private var lastInstalledPackageListTime = 0L
private var installedPackageList: List<PackageInfo> = arrayListOf()
private var isGetInstalledPackagesApiAgreed = false
private var isGetInstalledListPermissionSupported = UNKNOWN // 设备是否支持禁用获取已安装应用列表。-1 代表支持情况未知0 代表不支持, 1 代表支持
// 评论黑名单包名列表,避免用户安装了 Xposed Installer 这样的工具,也能在包含该安装包的游戏详情页评论
var commentPackageNameBlackList = arrayListOf<String>()
private var _commentPackageNameBlackList = arrayListOf<String>()
val commentPackageNameBlackList: ArrayList<String> = _commentPackageNameBlackList
// 关闭下载的包列表
var downloadPackageNameBlackList = arrayListOf<String>()
private var _downloadPackageNameBlackList = arrayListOf<String>()
val downloadPackageNameBlackList: ArrayList<String> = _downloadPackageNameBlackList
// 本地已安装的包去掉关闭下载的包后的列表
var validLocalPackageNameSet = hashSetOf<String>()
private var _validLocalPackageNameSet = hashSetOf<String>()
val validLocalPackageNameSet: HashSet<String> = _validLocalPackageNameSet
// 游戏包名匹配列表
var relatedPackageList = arrayListOf<SettingsEntity.GameWithPackages>()
private var _relatedPackageList = arrayListOf<SettingsEntity.GameWithPackages>()
val relatedPackageList: ArrayList<SettingsEntity.GameWithPackages> = _relatedPackageList
// 本地已安装包的列表
var localPackageNameSet = hashSetOf<String>()
@ -38,33 +68,26 @@ object PackageHelper {
}
@JvmStatic
fun initList() {
Config.getSettings()?.gameCommentBlackList?.let {
commentPackageNameBlackList = ArrayList(it)
}
Config.getSettings()?.gameDownloadBlackList?.let {
downloadPackageNameBlackList = ArrayList(it)
}
Config.getSettings()?.gamePackageMatch?.let {
relatedPackageList = ArrayList(it)
}
fun refreshList() {
Config.getSettings()?.gameCommentBlackList?.let { _commentPackageNameBlackList = ArrayList(it) }
Config.getSettings()?.gameDownloadBlackList?.let { _downloadPackageNameBlackList = ArrayList(it) }
Config.getSettings()?.gamePackageMatch?.let { _relatedPackageList = ArrayList(it) }
Config.getSettings()?.gameDownloadBlackList
updateValidPackageNameList()
}
private fun updateValidPackageNameList() {
validLocalPackageNameSet =
_validLocalPackageNameSet =
localPackageNameSet.filterNot { p -> downloadPackageNameBlackList.contains(p) }.toHashSet()
}
/*
/**
* 获取所有已安装的软件的包名、版本(非系统应用)
*/
private fun getAllPackageName(context: Context): HashSet<String> {
val set = HashSet<String>()
return try {
val packageInfos = PackageUtils.getInstalledPackages(context, 0)
val packageInfos = getInstalledPackages(context, 0)
for (packageInfo in packageInfos) {
if (packageInfo.applicationInfo.flags and ApplicationInfo.FLAG_SYSTEM == 0) {
if (context.packageName != packageInfo.packageName) {
@ -79,4 +102,154 @@ object PackageHelper {
}
}
/**
* 弃用已安装列表缓存
*/
fun dumpInstalledListCache() {
lastInstalledPackageListTime = 0
}
/**
* 用户是否已经允许了调用获取已安装应用列表接口
* 优先用内存的值,没有再从 SP 中获取并更新
*/
fun isGetInstalledPackagesApiAgreed(): Boolean {
return isGetInstalledPackagesApiAgreed
|| (SPUtils.getBoolean(SP_GET_INSTALLED_API_AGREED).also { isGetInstalledPackagesApiAgreed = it })
}
/**
* 同意使用已安装应用列表 API
*/
fun agreeOnGetInstalledPackagesApi() {
isGetInstalledPackagesApiAgreed = true
SPUtils.setBoolean(SP_GET_INSTALLED_API_AGREED, true)
}
/**
* 获取已安装应用列表
*/
fun getInstalledPackages(context: Context?, flags: Int): List<PackageInfo> {
Utils.log(TAG, "即将获取已安装应用列表")
// Utils.log(TAG, "即将获取已安装应用列表" + Thread.currentThread().getStackTrace().contentToString().replace( ',', '\n' ))
// 用户未同意使用已安装应用列表 API返回空列表
if (!isGetInstalledPackagesApiAgreed()) {
Utils.log(TAG, "用户未同意使用已安装应用列表 API返回空列表")
return installedPackageList
}
// 简单 debounce 过于频繁的获取已安装应用列表调用
if (System.currentTimeMillis() - lastInstalledPackageListTime < 3000 && installedPackageList.isNotEmpty()) {
Utils.log(TAG, "使用了缓存的已安装应用列表")
return installedPackageList
}
var shouldGetNewInstalledPackagedList = false
// 当前设备是否支持限制获取已安装应用列表的功能
if (isSupportGetInstalledAppsPermission(context!!)) {
Utils.log(TAG, "当前设备支持限制获取已安装应用列表的功能")
// 当前设备是否支持禁用了获取已安装应用列表
if (!isGetInstalledListPermissionDisabled(context)) {
Utils.log(TAG, "当前设备没有限制获取已安装应用列表的功能")
shouldGetNewInstalledPackagedList = true
} else {
Utils.log(TAG, "当前设备已限制获取已安装应用列表的功能")
}
} else {
Utils.log(TAG, "当前设备不支持限制获取已安装应用列表的功能")
shouldGetNewInstalledPackagedList = true
}
if (shouldGetNewInstalledPackagedList) {
lastInstalledPackageListTime = System.currentTimeMillis()
installedPackageList = getInstalledPackagesInternal(context, flags)
}
return installedPackageList
}
/**
* 是否支持动态获取已安装应用列表权限
*/
fun isSupportGetInstalledAppsPermission(context: Context): Boolean {
// 若存在缓存,直接返回缓存结果。
if (isGetInstalledListPermissionSupported != UNKNOWN) {
return isGetInstalledListPermissionSupported != UNSUPPORTED
}
try {
// 根据官方提供的方法来判定是否支持限制获取已安装应用列表
val flag =
Settings.Secure.getInt(context.contentResolver, "oem_installed_apps_runtime_permission_enable", 0)
if (flag == 1) {
isGetInstalledListPermissionSupported = SUPPORTED
return true
}
// 部分未升级的手机没有上面配置项,有定义下面危险权限也认为是支持设备软件列表管控
val packageManager = context.packageManager
val permissionInfo = packageManager.getPermissionInfo("com.android.permission.GET_INSTALLED_APPS", 0)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
if (permissionInfo.protection == PermissionInfo.PROTECTION_DANGEROUS) {
isGetInstalledListPermissionSupported = SUPPORTED
return true
} else {
isGetInstalledListPermissionSupported = UNSUPPORTED
return false
}
} else {
isGetInstalledListPermissionSupported = UNSUPPORTED
return false
}
} catch (e: PackageManager.NameNotFoundException) {
isGetInstalledListPermissionSupported = UNSUPPORTED
return false
}
}
/**
* 在5.1系统手机使用PackageManager获取已安装应用容易发生Package manager has died异常
* https://stackoverflow.com/questions/13235793/transactiontoolargeeception-when-trying-tÏo-get-a-list-of-applications-installed/30062632#30062632
*/
private fun getInstalledPackagesInternal(context: Context, flags: Int): List<PackageInfo> {
Utils.log(TAG, "调用系统 API 获取已安装应用列表")
val pm = context.packageManager
try {
return pm.getInstalledPackages(flags)
} catch (ignored: java.lang.Exception) {
//we don't care why it didn't succeed. We'll do it using an alternative way instead
}
// use fallback:
val process: Process
val result: MutableList<PackageInfo> = java.util.ArrayList()
var bufferedReader: BufferedReader? = null
try {
process = Runtime.getRuntime().exec("pm list packages")
bufferedReader = BufferedReader(InputStreamReader(process.inputStream))
var line: String
while ((bufferedReader.readLine().also { line = it }) != null) {
val packageName = line.substring(line.indexOf(':') + 1)
val packageInfo = pm.getPackageInfo(packageName, flags)
result.add(packageInfo)
}
process.waitFor()
} catch (e: java.lang.Exception) {
e.printStackTrace()
if (e is InterruptedException) {
Thread.currentThread().interrupt()
}
} finally {
if (bufferedReader != null) try {
bufferedReader.close()
} catch (e: IOException) {
e.printStackTrace()
}
}
return result
}
}

View File

@ -29,7 +29,6 @@ import com.gh.common.xapk.XapkInstaller;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.PackageFlavorHelper;
import com.gh.gamecenter.common.utils.PermissionHelper;
import com.gh.gamecenter.core.utils.MD5Utils;
import com.gh.gamecenter.core.utils.SentryHelper;
@ -68,14 +67,8 @@ import java.util.zip.ZipFile;
public class PackageUtils {
private static long mLastInstalledPackageListTime = 0L;
private static List<PackageInfo> mInstalledPackageList = null;
private static final String TAG = "PackageUtils";
// 设备是否支持禁用获取已安装应用列表。-1 代表支持情况未知0 代表不支持, 1 代表支持
private static int mIsSupportGetInstalledListPermission = -1;
public static String getInstallPackageInfoSourceDir(String packageName) {
try {
return HaloApp.getInstance().getApplication().getPackageManager().getPackageInfo(packageName,
@ -677,7 +670,7 @@ public class PackageUtils {
*/
public static ArrayList<String> getAllPackageName(Context context) {
ArrayList<String> list = new ArrayList<>();
List<PackageInfo> packageInfos = getInstalledPackages(context, 0);
List<PackageInfo> packageInfos = PackageHelper.INSTANCE.getInstalledPackages(context, 0);
for (PackageInfo packageInfo : packageInfos) {
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
if (!context.getPackageName().equals(packageInfo.packageName)) {
@ -690,7 +683,7 @@ public class PackageUtils {
public static ArrayList<String> getAllPackageNameIncludeGh(Context context) {
ArrayList<String> list = new ArrayList<>();
List<PackageInfo> packageInfos = getInstalledPackages(context, 0);
List<PackageInfo> packageInfos = PackageHelper.INSTANCE.getInstalledPackages(context, 0);
for (PackageInfo packageInfo : packageInfos) {
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
list.add(packageInfo.packageName);
@ -704,11 +697,9 @@ public class PackageUtils {
*/
public static ArrayList<String> getAllPackageNameIncludeSystemApps(Context context) {
ArrayList<String> list = new ArrayList<>();
List<PackageInfo> packageInfos = getInstalledPackages(context, 0);
List<PackageInfo> packageInfos = PackageHelper.INSTANCE.getInstalledPackages(context, 0);
for (PackageInfo packageInfo : packageInfos) {
if (!context.getPackageName().equals(packageInfo.packageName)) {
list.add(packageInfo.packageName);
}
list.add(packageInfo.packageName);
}
return list;
}
@ -717,7 +708,7 @@ public class PackageUtils {
JSONArray jsonArray = new JSONArray();
try {
PackageManager pm = context.getPackageManager();
List<PackageInfo> packageInfos = getInstalledPackages(context, 0);
List<PackageInfo> packageInfos = PackageHelper.INSTANCE.getInstalledPackages(context, 0);
for (PackageInfo packageInfo : packageInfos) {
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
JSONObject jsonObject = new JSONObject();
@ -758,7 +749,6 @@ public class PackageUtils {
}
}
/**
* 启动应用
* 请使用 PackageLauncher.launchApp()
@ -778,22 +768,6 @@ public class PackageUtils {
}
}
/*
* 根据包名,获取软件名称
*/
public static String getNameByPackageName(Context context, String packageName) {
try {
PackageManager pm = context.getApplicationContext().getPackageManager();
ApplicationInfo applicationInfo = pm.getApplicationInfo(
packageName, 0);
return applicationInfo.loadLabel(pm).toString();
} catch (NameNotFoundException e) {
e.printStackTrace();
}
return null;
}
/**
* todo 统一判断
* <p>
@ -912,8 +886,8 @@ public class PackageUtils {
String packageName = context.getApplicationContext().getPackageName();
for (ActivityManager.RunningAppProcessInfo appProcess : appProcesses) {
// The name of the process that this object is associated with.
if (appProcess.processName.equals(packageName) && appProcess.importance
== ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
if (appProcess.processName.equals(packageName)
&& appProcess.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
return true;
}
}
@ -924,132 +898,6 @@ public class PackageUtils {
return false;
}
/**
* 弃用已安装列表缓存
*/
public static void dumpInstalledListCache() {
mLastInstalledPackageListTime = 0;
}
public static List<PackageInfo> getInstalledPackages(Context context, int flags) {
Utils.log(TAG, "即将获取已安装应用列表");
// 简单 debounce 掉过于频繁的调用获取已安装列表调用
if (System.currentTimeMillis() - mLastInstalledPackageListTime < 1000
&& mInstalledPackageList != null
&& mInstalledPackageList.size() > 0) {
Utils.log(TAG, "使用了缓存的已安装应用列表");
return new ArrayList<>(mInstalledPackageList);
}
// 是否需要调用系统 API 获取最新的已安装应用列表
boolean shouldGetNewInstalledPackagedList = false;
// 当前设备是否支持限制获取已安装应用列表的功能
if (isSupportGetInstalledAppsPermission(context)) {
Utils.log(TAG, "当前设备支持限制获取已安装应用列表的功能");
// 当前设备是否支持禁用了获取已安装应用列表
if (!PermissionHelper.isGetInstalledListPermissionDisabled(context)) {
Utils.log(TAG, "当前设备没有限制获取已安装应用列表的功能");
shouldGetNewInstalledPackagedList = true;
} else {
Utils.log(TAG, "当前设备已限制获取已安装应用列表的功能");
}
} else {
Utils.log(TAG, "当前设备不支持限制获取已安装应用列表的功能");
shouldGetNewInstalledPackagedList = true;
}
if (shouldGetNewInstalledPackagedList) {
mLastInstalledPackageListTime = System.currentTimeMillis();
mInstalledPackageList = getInstalledPackagesInternal(context, flags);
}
if (mInstalledPackageList == null) {
mInstalledPackageList = new ArrayList<>();
}
return mInstalledPackageList;
}
public static boolean isSupportGetInstalledAppsPermission(Context context) {
// 若存在缓存,直接返回缓存结果。为 0 代表不支持,为 1 代表支持
if (mIsSupportGetInstalledListPermission != -1) {
return mIsSupportGetInstalledListPermission != 0;
}
try {
// 根据官方提供的方法来判定是否支持限制获取已安装应用列表
int flag = Settings.Secure.getInt(context.getContentResolver(), "oem_installed_apps_runtime_permission_enable", 0);
if (flag == 1) {
mIsSupportGetInstalledListPermission = 1;
return true;
}
// 部分未升级的手机没有上面配置项,有定义下面危险权限也认为是支持设备软件列表管控
PackageManager packageManager = context.getPackageManager();
PermissionInfo permissionInfo = packageManager.getPermissionInfo("com.android.permission.GET_INSTALLED_APPS", 0);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
if (permissionInfo.getProtection() == PermissionInfo.PROTECTION_DANGEROUS) {
mIsSupportGetInstalledListPermission = 1;
return true;
} else {
mIsSupportGetInstalledListPermission = 0;
return false;
}
} else {
mIsSupportGetInstalledListPermission = 0;
return false;
}
} catch (NameNotFoundException e) {
mIsSupportGetInstalledListPermission = 0;
return false;
}
}
/**
* 在5.1系统手机使用PackageManager获取已安装应用容易发生Package manager has died异常
* https://stackoverflow.com/questions/13235793/transactiontoolargeeception-when-trying-tÏo-get-a-list-of-applications-installed/30062632#30062632
*/
private static List<PackageInfo> getInstalledPackagesInternal(Context context, int flags) {
Utils.log(TAG, "调用系统 API 获取已安装应用列表");
final PackageManager pm = context.getPackageManager();
try {
return pm.getInstalledPackages(flags);
} catch (Exception ignored) {
//we don't care why it didn't succeed. We'll do it using an alternative way instead
}
// use fallback:
Process process;
List<PackageInfo> result = new ArrayList<>();
BufferedReader bufferedReader = null;
try {
process = Runtime.getRuntime().exec("pm list packages");
bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = bufferedReader.readLine()) != null) {
final String packageName = line.substring(line.indexOf(':') + 1);
final PackageInfo packageInfo = pm.getPackageInfo(packageName, flags);
result.add(packageInfo);
}
process.waitFor();
} catch (Exception e) {
e.printStackTrace();
if (e instanceof InterruptedException) {
Thread.currentThread().interrupt();
}
} finally {
if (bufferedReader != null)
try {
bufferedReader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return result;
}
public static String getWebviewPath(Context context) {
final PackageInfo webViewPackageInfo = WebViewCompat.getCurrentWebViewPackage(context);
return webViewPackageInfo != null ? webViewPackageInfo.applicationInfo.sourceDir : null;

View File

@ -28,10 +28,10 @@ import org.json.JSONObject
import java.io.File
import java.net.URLEncoder
import java.util.*
import kotlin.collections.ArrayList
object BrowserInstallHelper {
// 随便选的 32321 居然在部分 vivo 手机上被占用,喷了
private const val PORT = 40705
private const val RESERVE_PORT = 40706
@ -40,15 +40,12 @@ object BrowserInstallHelper {
private val mContext by lazy { HaloApp.getInstance().application }
private var mUseReservePort = false
private val mAllInstalledPackageList: ArrayList<String> by lazy {
PackageUtils.getAllPackageNameIncludeSystemApps(HaloApp.getInstance().applicationContext).apply {
add(HaloApp.getInstance().applicationContext.packageName)
}
}
private var mValidInstalledPackageList: ArrayList<String> = arrayListOf()
private var mValidConditionMatchedCache: Boolean? = null
private fun getServer(port: Int): DownloadServer {
val server = DownloadServer(port)
for (packageName in mAllInstalledPackageList) {
for (packageName in getAllInstalledPackageList()) {
if (packageName.contains("com.freeme") || packageName.contains("com.zhuoyi")) {
server.isBuggyDevice = true
break
@ -57,6 +54,23 @@ object BrowserInstallHelper {
return server
}
private fun getAllInstalledPackageList(): ArrayList<String> {
when {
mValidInstalledPackageList.isNotEmpty() -> {
return mValidInstalledPackageList
}
else -> {
val allInstalledPackageList = PackageUtils.getAllPackageNameIncludeSystemApps(mContext)
if (allInstalledPackageList.isNotEmpty()) {
mValidInstalledPackageList = allInstalledPackageList
}
return mValidInstalledPackageList
}
}
}
fun downloadFile(filePath: String) {
if (!::mServer.isInitialized) mServer = if (mUseReservePort) getServer(RESERVE_PORT) else getServer(PORT)
if (!mServer.isAlive && !startServer()) {
@ -80,7 +94,7 @@ object BrowserInstallHelper {
Base64.encodeToString(URLEncoder.encode(downloadUrl).trim().toByteArray(), Base64.NO_WRAP)
DirectUtils.directToExternalBrowser(
mContext,
"https://down-and.ghzs.com/redirect?location=base64($encodedString)"
"https://down-and.ghzs6.com/redirect?location=base64($encodedString)"
)
} else {
DirectUtils.directToExternalBrowser(mContext, downloadUrl)
@ -237,32 +251,43 @@ object BrowserInstallHelper {
* 是否满足开启浏览器安装的条件
*/
private fun isConditionMatched(settingsEntity: NewSettingsEntity): Boolean {
if (mValidConditionMatchedCache != null) {
return mValidConditionMatchedCache!!
}
val packageList = getAllInstalledPackageList()
if (packageList.isEmpty()) return false
settingsEntity.installModel?.whiteList?.let {
for (packageName in it) {
if (mAllInstalledPackageList.contains(packageName)) {
return false
if (packageList.contains(packageName)) {
mValidConditionMatchedCache = false
break
}
}
}
settingsEntity.installModel?.packages?.let {
for (packageName in it) {
if (mAllInstalledPackageList.contains(packageName)) {
return true
if (packageList.contains(packageName)) {
mValidConditionMatchedCache = true
break
}
}
}
// 匹配部分字符串即可
settingsEntity.installModel?.regexPackages?.let {
for (packageNamePieces in it) {
for (installedPackageName in mAllInstalledPackageList) {
for (installedPackageName in packageList) {
if (installedPackageName.contains(packageNamePieces)) {
return true
mValidConditionMatchedCache = true
break
}
}
}
}
return false
return mValidConditionMatchedCache ?: false
}
fun onApkInstalled(path: String?) {

View File

@ -98,7 +98,6 @@ import com.gh.gamecenter.feature.utils.PlatformUtils;
import com.gh.gamecenter.home.custom.model.CustomPageShareRepository;
import com.gh.gamecenter.home.skip.PackageSkipActivity;
import com.gh.gamecenter.login.user.UserManager;
import com.gh.gamecenter.login.utils.QuickLoginHelper;
import com.gh.gamecenter.manager.DataCollectionManager;
import com.gh.gamecenter.packagehelper.PackageViewModel;
import com.gh.gamecenter.retrofit.RetrofitManager;
@ -319,8 +318,7 @@ public class MainActivity extends BaseActivity {
mMainWrapperViewModel.requestAllDialogData();
// TODO 去掉一键登录?
QuickLoginHelper.getPhoneInfo();
// QuickLoginHelper.getPhoneInfo();
// TODO 搞清楚为什么这里要获取微信相关配置
WechatBindHelper.getWechatConfig(null);

View File

@ -111,7 +111,7 @@ public class ShareCardActivity extends ToolBarActivity {
String qrBody;
if (!TextUtils.isEmpty(newsId)) {
qrBody = "http://www.ghzs666.com/article/" + newsId + ".html?source=appshare200";
qrBody = "https://www.ghzs666.com/article/" + newsId + ".html?source=appshare200";
} else {
qrBody = "https://www.ghzs.com/?source=appshare200";
}

View File

@ -166,7 +166,7 @@ public class ShareCardPicActivity extends ToolBarActivity {
String qrBody;
if (!TextUtils.isEmpty(newsId)) {
qrBody = "http://www.ghzs666.com/article/" + newsId + ".html?source=appshare200";
qrBody = "https://www.ghzs666.com/article/" + newsId + ".html?source=appshare200";
} else {
qrBody = "https://www.ghzs.com/?source=appshare200";
}

View File

@ -197,15 +197,7 @@ class SplashScreenActivity : BaseActivity() {
// 尝试获取安装应用列表权限并启动首页(不在乎结果)
private fun requestGetInstallListPermissionAndLaunchMainActivity() {
if (PackageUtils.isSupportGetInstalledAppsPermission(this)
&& PermissionHelper.isGetInstalledListPermissionDisabled(this)
) {
PermissionHelper.requestGetInstalledAppsListPermission(this, true) {
launchMainActivity()
}
} else {
launchMainActivity()
}
launchMainActivity()
}
// 删除更新后的光环助手包

View File

@ -18,6 +18,7 @@ import android.widget.TextView;
import androidx.collection.ArrayMap;
import androidx.core.content.ContextCompat;
import com.gh.common.util.PackageHelper;
import com.gh.common.util.PackageInstaller;
import com.gh.common.util.PackageUtils;
import com.gh.gamecenter.R;
@ -188,7 +189,7 @@ public class CleanApkAdapter extends BaseRecyclerAdapter<KcSelectGameViewHolder>
}
private int doType(String packageName) {
List<PackageInfo> pakageinfos = PackageUtils.getInstalledPackages(mContext, 0);
List<PackageInfo> pakageinfos = PackageHelper.INSTANCE.getInstalledPackages(mContext, 0);
for (PackageInfo pi : pakageinfos) {
if ((pi.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
String pi_packageName = pi.packageName;

View File

@ -89,7 +89,7 @@ class AuthorizationActivity : ToolBarActivity() {
}
private fun initData() {
if (mToken.isNotEmpty()) return
if (mToken.isNotEmpty() || isFinishing) return
val loadingDialog = DialogUtils.showWaitDialog(this, "请稍后...")
mViewModel.getAccessToken(listOf(mContent), {
mToken = it

View File

@ -153,7 +153,7 @@ class NewInstalledGameFragment : ToolbarFragment() {
reuseNoneData.reuseNoneDataDescTv.text = " 及时获悉游戏最新的更新消息"
reuseNoneData.reuseResetLoadTv.text = "去开启"
reuseNoneData.reuseResetLoadTv.setOnClickListener {
PermissionHelper.requestGetInstalledAppsListPermission(requireActivity()) {
PermissionHelper.showGetInstalledAppsListPermissionDialogAndRequestPermission(requireActivity()) {
updateNoDataView()
PackageRepository.initData()
}

View File

@ -4,7 +4,6 @@ import android.view.View
import com.gh.common.exposure.ExposureListener
import com.gh.common.util.DirectUtils
import com.gh.download.DownloadManager
import com.gh.gamecenter.MainActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.fragment.LazyFragment
import com.gh.gamecenter.common.constant.EntranceConsts
@ -12,12 +11,10 @@ import com.gh.gamecenter.common.eventbus.EBReuse
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.FixLinearLayoutManager
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.core.utils.EmptyCallback
import com.gh.gamecenter.databinding.FragmentGameUpdatableBinding
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.packagehelper.PackageRepository
import com.gh.gamecenter.packagehelper.PackageViewModel
import com.gh.gamecenter.wrapper.MainWrapperFragment
import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadEntity
import org.greenrobot.eventbus.Subscribe
@ -40,7 +37,6 @@ class UpdatableGameFragment : LazyFragment() {
}
}
override fun getRealLayoutId() = R.layout.fragment_game_updatable
override fun onRealLayoutInflated(inflatedView: View) {
mBinding = FragmentGameUpdatableBinding.bind(inflatedView)
@ -104,15 +100,14 @@ class UpdatableGameFragment : LazyFragment() {
noDataContainer.reuseNoneDataDescTv.text = "及时获悉游戏最新的更新消息"
noDataContainer.reuseResetLoadTv.text = "去开启"
noDataContainer.reuseResetLoadTv.setOnClickListener {
PermissionHelper.requestGetInstalledAppsListPermission(
requireActivity(),
false,
object : EmptyCallback {
override fun onCallback() {
updateNoDataView()
PackageRepository.initData()
}
})
PermissionHelper.showGetInstalledAppsListPermissionDialogAndRequestPermission(
requireActivity()
) { isGranted ->
if (isGranted) {
updateNoDataView()
PackageRepository.initData()
}
}
}
} else {
noDataContainer.reuseNoneDataIv.visibility = View.VISIBLE

View File

@ -413,7 +413,7 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
val shareUrl = if (isPublishEnv()) {
"https://m.ghzs666.com/video/${it.id}"
} else {
"https://resource.ghzs.com/page/video_play/video/video.html?video=${it.id}"
"https://dev-and-static.ghzs66.com/page/video_play/video/video.html?video=${it.id}"
}
val additionalParams = AdditionalParamsEntity().apply {
contentType = "视频帖"

View File

@ -45,6 +45,12 @@ class UpdateDialogFragment : BaseDialogFragment() {
private var mIsDisplayingDownloadingStyle = false // 是否正在显示更新中样式
private val mDataWatcher = object : DataWatcher() {
override fun onDataInit(downloadEntity: DownloadEntity) {
super.onDataInit(downloadEntity)
onDataChanged(downloadEntity)
}
override fun onDataChanged(downloadEntity: DownloadEntity) {
if (downloadEntity.name.contains("光环助手")) {
if (mIsDisplayingDownloadingStyle) {
@ -74,13 +80,11 @@ class UpdateDialogFragment : BaseDialogFragment() {
return
}
DownloadManager.getInstance().addObserver(mDataWatcher)
mUpdateEntity = arguments?.getParcelable(UPDATE_ENTITY)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
showUpdateHintStyle(requireContext(), mUpdateEntity!!)
showUpdateHintStyle(requireContext(), mUpdateEntity!!, true)
return mBinding.root
}
@ -109,8 +113,14 @@ class UpdateDialogFragment : BaseDialogFragment() {
mDismissCallback?.onCallback()
}
override fun onDestroyView() {
super.onDestroyView()
override fun onStart() {
super.onStart()
DownloadManager.getInstance().addObserver(mDataWatcher)
}
override fun onStop() {
super.onStop()
DownloadManager.getInstance().removeObserver(mDataWatcher)
}
@ -120,7 +130,9 @@ class UpdateDialogFragment : BaseDialogFragment() {
* @param context 上下文
* @param updateEntity 更新实体
*/
private fun showUpdateHintStyle(context: Context, updateEntity: AppEntity) {
private fun showUpdateHintStyle(context: Context,
updateEntity: AppEntity,
invokeByViewCreated: Boolean) {
mIsDisplayingDownloadingStyle = false
val updateHintBinding = mBinding.updateHintContainerView
@ -200,12 +212,15 @@ class UpdateDialogFragment : BaseDialogFragment() {
)
}
SensorsBridge.trackVersionUpdateDialogShow(
keyDialogReminderTime = mUpdateEntity?.alert,
keyDialogClose = if (mUpdateEntity?.isForce == true) "关闭且强退" else "仅关闭"
)
if (invokeByViewCreated) {
SensorsBridge.trackVersionUpdateDialogShow(
keyDialogReminderTime = mUpdateEntity?.alert,
keyDialogClose = if (mUpdateEntity?.isForce == true) "关闭且强退" else "仅关闭"
)
DataLogUtils.uploadUpgradeLog(context, "notice") //上传更新通知弹窗数据
}
DataLogUtils.uploadUpgradeLog(context, "notice") //上传更新通知弹窗数据
}
/**
@ -294,13 +309,8 @@ class UpdateDialogFragment : BaseDialogFragment() {
if (DownloadStatus.done == downloadEntity.status) {
DownloadManager.getInstance().cancel(downloadEntity.url, false, true, false)
try {
dismiss()
} catch (ignored: IllegalArgumentException) {
// do nothing
}
if (updateEntity.isForce) {
AppExecutor.uiExecutor.executeWithDelay({ UpdateHelper.exitApp() }, 1000L)
tryWithDefaultCatch {
showUpdateHintStyle(requireContext(), updateEntity, false)
}
} else if (DownloadStatus.neterror == downloadEntity.status) {
ToastUtils.toast("网络错误,请稍后重试")

View File

@ -282,10 +282,10 @@ class RatingEditActivity : ToolBarActivity(), KeyboardHeightObserver {
}
}
mBinding.mWebView.addJavascriptObject(DefaultJsApi(this), null)
val url = if ("internal" == BuildConfig.FLAVOR) {
"https://resource.ghzs.com/page/comment_tag_editor_dev/index.html?timestamp=${System.currentTimeMillis()}"
val url = if (PackageFlavorHelper.IS_TEST_FLAVOR) {
"https://dev-and-static.ghzs66.com/page/comment_tag_editor/index.html?timestamp=${System.currentTimeMillis()}"
} else {
"https://resource.ghzs.com/page/comment_tag_editor/index.html?timestamp=${System.currentTimeMillis()}"
"https://and-static.ghzs66.com/page/comment_tag_editor/index.html?timestamp=${System.currentTimeMillis()}"
}
mBinding.mWebView.loadUrl(url)
}

View File

@ -90,9 +90,6 @@ class UserHomeFragment : ToolbarFragment() {
getUserInfo()
getBadgeList()
getUserPlayedGameCount()
if (PackageFlavorHelper.IS_TEST_FLAVOR) {
getUserLevel()
}
}
mHomeBinding?.container?.setZoomView(mHomeBinding?.userBackgroundContainer)
@ -167,38 +164,12 @@ class UserHomeFragment : ToolbarFragment() {
if (mUserHomeViewModel.userId == UserManager.getInstance().userId) {
mUserHomeViewModel.availableBadges()
}
// if (mUserHomeViewModel.userId == UserManager.getInstance().userId) {
// mUserHomeViewModel.availableBadges()
// } else {
// mHomeBinding?.userBadgeTips?.visibility = View.VISIBLE
// if (it.isNotEmpty()) {
// mHomeBinding?.userBadge?.visibility = View.VISIBLE
// updateUserBadge(it)
// } else {
// mHomeBinding?.userBadge?.visibility = View.GONE
// }
// }
}
mUserHomeViewModel.availableBadgeCount.observeNonNull(this) {
mHomeBinding?.badgeTips?.visibility = if (it > 0) View.VISIBLE else View.GONE
}
// mUserHomeViewModel.availableBadgeCount.observeNonNull(this) {
// mHomeBinding?.viewBadgeMessageTip?.visibleIf(it > 0)
// if (mUserHomeViewModel.badges.value?.isEmpty() == true && it > 0) {
// mHomeBinding?.userBadgeList?.visibility = View.INVISIBLE
// mHomeBinding?.userBadgeTips?.visibility = View.VISIBLE
// mHomeBinding?.userBadgeTips?.text = "有${it}枚徽章可领取"
// } else if (mUserHomeViewModel.badges.value?.isEmpty() == false) {
// mHomeBinding?.userBadgeList?.visibility = View.VISIBLE
// mHomeBinding?.userBadgeTips?.visibility = View.GONE
// updateUserBadge(mUserHomeViewModel.badges.value!!)
// }
// }
mUserHomeViewModel.networkError.observeNonNull(this) {
mHomeBinding?.container?.visibility = View.GONE
mHomeBinding?.reuseNoConnection?.root?.visibility = View.VISIBLE
@ -214,28 +185,10 @@ class UserHomeFragment : ToolbarFragment() {
mPlayGameCount = it
})
mUserHomeViewModel.level.observeNonNull(this) {
mHomeBinding?.run {
levelContainer.visibility = View.VISIBLE
levelContainer.setOnClickListener {
if (mUserHomeViewModel.userId == UserManager.getInstance().userId) {
IntegralLogHelper.run {
log("click_grade_label", LOCATION)
log("view_grade", "等级中心页")
}
DirectUtils.directToLevelPage(requireContext())
}
}
val levelNum = if (it > 9) 9 else it
levelTv.text = "Lv$levelNum "
}
}
mMessageUnreadViewModel.liveData.observeNonNull(this) {
updateUnreadInfo(it)
}
mUserViewModel.editObsUserinfo.observeNonNull(this) {
it.data?.let { updatedUserInfo ->
if (mUserHomeViewModel.userId == UserManager.getInstance().userId) {
@ -542,7 +495,6 @@ class UserHomeFragment : ToolbarFragment() {
// 跳转更换背景页
userChangeBgBtn.setOnClickListener {
IntegralLogHelper.log("click_change _background", LOCATION)
SPUtils.setBoolean(Constants.SP_HAS_CLICK_CHANGE_BG, false)
changeBgTips.visibility = View.GONE
startActivity(PersonalityBackgroundActivity.getIntent(requireContext()))

View File

@ -33,7 +33,6 @@ class UserHomeViewModel(application: Application, var userId: String) : AndroidV
var availableBadge = MutableLiveData<BadgeEntity>()
var availableBadgeCount = MutableLiveData<Int>()
var playGamesCount = MutableLiveData<Int>()
var level = MutableLiveData<Int>()
fun getUserInfo() {
RetrofitManager.getInstance()
@ -133,19 +132,6 @@ class UserHomeViewModel(application: Application, var userId: String) : AndroidV
})
}
@SuppressLint("CheckResult")
fun getUserLevel() {
RetrofitManager.getInstance()
.api.getUserLevels(userId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : BiResponse<JsonObject>() {
override fun onSuccess(data: JsonObject) {
level.postValue(data["level"].asInt)
}
})
}
@SuppressLint("CheckResult")
fun postReport(reason: String, desc: String) {
val requestMap = hashMapOf<String, String>()

View File

@ -56,13 +56,13 @@ object ArticleDetailWebCacheManager {
}
val cacheUrlList = mutableListOf(
"https://static-web.ghzs.com/website-static/lib/polyfill.min.js",
"https://and-static.ghzs.com/web/dplayer/DPlayer.min.js"
"https://and-static.ghzs66.com/web/website-static/lib/polyfill.min.js",
"https://and-static.ghzs66.com/web/dplayer/DPlayer.min.js"
)
if (!EnvHelper.isDevEnv) {
cacheUrlList.add("https://resource.ghzs.com/js/halo.js")
cacheUrlList.add("https://resource.ghzs.com/css/halo.css")
cacheUrlList.add("https://and-static.ghzs66.com/web/js/halo.js")
cacheUrlList.add("https://and-static.ghzs66.com/web/css/halo.css")
}
val okHttpClient = OkHttpClient.Builder()
@ -73,7 +73,7 @@ object ArticleDetailWebCacheManager {
val retrofit = Retrofit.Builder()
.client(okHttpClient)
.baseUrl("https://resource.ghzs.com")
.baseUrl("https://and-static.ghzs66.com")
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build()

View File

@ -27,7 +27,7 @@ class EditorInsertEntity(
entity.type = "answer"
entity.title = answer.questions.title?.eliminateDoubleQuote()
entity.brief = answer.brief?.eliminateDoubleQuote()
entity.icon = "http://static-web.ghzs.com/website-static/images/icon_new_reply.png"
entity.icon = "https://and-static.ghzs66.com/web/website-static/images/icon_new_reply.png"
return entity
}
@ -39,7 +39,7 @@ class EditorInsertEntity(
entity.type = "community_article"
entity.title = article.title.eliminateDoubleQuote()
entity.brief = article.brief.eliminateDoubleQuote()
entity.icon = "http://static-web.ghzs.com/website-static/images/icon_new_article.png"
entity.icon = "https://and-static.ghzs66.com/web/website-static/images/icon_new_article.png"
return entity
}
@ -60,7 +60,7 @@ class EditorInsertEntity(
entity.type = "game_collection"
entity.title = game.title
entity.brief = game.intro
entity.icon = "https://static-web.ghzs.com/website-static/images/icon_game_collection.png"
entity.icon = "https://and-static.ghzs66.com/web/website-static/images/icon_game_collection.png"
return entity
}
@ -71,7 +71,7 @@ class EditorInsertEntity(
entity.type = "video"
entity.title = video.title
entity.brief = video.des
entity.icon = "https://static-web.ghzs.com/website-static/images/icon_video.png"
entity.icon = "https://and-static.ghzs66.com/web/website-static/images/icon_video.png"
return entity
}
}

View File

@ -408,7 +408,7 @@ class ForumTopVideoView @JvmOverloads constructor(context: Context, attrs: Attri
shareUrl = if (isPublishEnv()) {
"https://m.ghzs666.com/video/${it.id}"
} else {
"https://resource.ghzs.com/page/video_play/video/video.html?video=${it.id}"
"https://dev-and-static.ghzs66.com/page/video_play/video/video.html?video=${it.id}"
},
shareIcon = it.poster,
shareTitle = it.title,

View File

@ -41,7 +41,7 @@ public class InstallAndUninstallReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
PackageUtils.dumpInstalledListCache();
PackageHelper.INSTANCE.dumpInstalledListCache();
ExtensionsKt.doOnMainProcessOnly(() -> {
Utils.log("InstallAndUninstallReceiver:: onReceive->" + intent.getAction() + "==" + intent.getDataString());

View File

@ -2287,12 +2287,6 @@ public interface ApiService {
@POST("users/{user_id}:report")
Single<ResponseBody> reportUser(@Path("user_id") String userId, @Body RequestBody body);
/**
* 获取用户等级
*/
@GET("users/{user_id}/levels")
Single<JsonObject> getUserLevels(@Path("user_id") String userId);
/**
* 获取新分类2.0侧边栏
*/

View File

@ -5,8 +5,8 @@ import android.app.Application
import android.content.pm.PackageManager
import com.gh.common.constant.Config
import com.gh.common.simulator.SimulatorGameManager
import com.gh.common.util.PackageHelper
import com.gh.gamecenter.common.utils.NetworkUtils
import com.gh.common.util.PackageUtils
import com.gh.gamecenter.common.baselist.ListViewModel
import com.gh.gamecenter.feature.entity.ApkEntity
import com.gh.gamecenter.feature.entity.SimulatorEntity
@ -56,7 +56,7 @@ class SimulatorManagementViewModel(application: Application) :
return Single.create<List<SimulatorEntity>> { emitter ->
val simulatorEntityList = ArrayList<SimulatorEntity>()
val allInstalledPackages =
PackageUtils.getInstalledPackages(HaloApp.getInstance().application, PackageManager.GET_ACTIVITIES)
PackageHelper.getInstalledPackages(HaloApp.getInstance().application, PackageManager.GET_ACTIVITIES)
allInstalledPackages.forEach {
if (it.packageName.contains("com.gh")) {
val activityInfo =

View File

@ -358,7 +358,7 @@ class DetailPlayerView @JvmOverloads constructor(context: Context, attrs: Attrib
mBinding.censoringContainer.setOnClickListener {
DirectUtils.directToWebView(
context,
"https://resource.ghzs.com/page/video_rule/video_rule.html",
context.getString(R.string.upload_protocol_url),
mEntrance
)
}

View File

@ -3,12 +3,16 @@ package com.gh.gamecenter.wrapper
import android.graphics.PorterDuff
import android.net.Uri
import android.os.Bundle
import android.text.SpannableStringBuilder
import android.text.TextUtils
import android.view.View
import androidx.annotation.ColorRes
import androidx.constraintlayout.widget.ConstraintSet
import androidx.core.text.color
import androidx.core.view.doOnNextLayout
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.gh.common.util.PackageHelper
import com.gh.gamecenter.R
import com.gh.gamecenter.ShellActivity
import com.gh.gamecenter.common.base.fragment.ToolbarFragment
@ -24,6 +28,7 @@ import com.gh.gamecenter.databinding.FragmentMainBinding
import com.gh.gamecenter.databinding.PieceBottomTabBinding
import com.gh.gamecenter.entity.BottomTab
import com.gh.gamecenter.login.entity.UserInfoEntity
import com.gh.gamecenter.packagehelper.PackageRepository
import com.halo.assistant.HaloApp
import com.lightgame.listeners.OnBackPressedListener
import org.greenrobot.eventbus.EventBus
@ -62,6 +67,8 @@ class MainWrapperFragment : BaseBottomTabFragment<PieceBottomTabBinding>(), OnBa
setCurrentItem(mViewModel!!.defaultBottomTabIndex)
}
}
PackageRepository.addInstalledGame("com.woobest.sgwg.aligames")
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@ -77,6 +84,10 @@ class MainWrapperFragment : BaseBottomTabFragment<PieceBottomTabBinding>(), OnBa
mViewModel?.realNameInfoUpdateLiveData?.observe(viewLifecycleOwner) {
updateRealNameErrorContainer()
}
if (!PackageHelper.isGetInstalledPackagesApiAgreed()) {
showInstallApiHintView(mBinding)
}
}
fun setCurrentItem(page: Int) {
@ -255,6 +266,70 @@ class MainWrapperFragment : BaseBottomTabFragment<PieceBottomTabBinding>(), OnBa
}
}
private fun showInstallApiHintView(binding: FragmentMainBinding) {
val contentText = SpannableStringBuilder()
.color(R.color.text_theme.toColor(requireContext())) { append("您未授予已安装列表权限,可能") }
.color(R.color.secondary_red.toColor(requireContext())) { append("导致无法安装及更新") }
.color(R.color.text_theme.toColor(requireContext())) { append("建议开启权限!") }
binding.installApiContainer.visibility = View.VISIBLE
binding.installApiContainer.setOnClickListener {
// do nothing
}
binding.installApiCloseIv.enlargeTouchArea()
binding.installApiContentTv.text = contentText
binding.installApiCloseIv.setOnClickListener {
binding.installApiContainer.visibility = View.GONE
}
binding.installApiBtn.setOnClickListener {
val grantedClosure = {
binding.installApiContainer.visibility = View.GONE
PackageHelper.agreeOnGetInstalledPackagesApi()
// 进行包名初始化相关的操作
PackageRepository.initData()
PackageHelper.refreshLocalPackageList()
PackageHelper.refreshList()
}
if (PackageHelper.isSupportGetInstalledAppsPermission(requireContext())) {
// 若系统已经授予了获取应用列表的权限,直接进行授权成功回调
if (!PermissionHelper.isGetInstalledListPermissionDisabled(requireContext())) {
grantedClosure.invoke()
return@setOnClickListener
}
PermissionHelper.showGetInstalledAppsListPermissionDialogAndRequestPermission(requireContext() as FragmentActivity) { isGranted ->
// TODO 处理回调,上报日志等
if (isGranted) {
grantedClosure.invoke()
} else {
// TODO 处理拒绝权限的情况
}
}
} else {
val hintDialog = PermissionHelper.showGetInstalledAppsListPermissionDialogAndRequestPermission(requireContext() as FragmentActivity) {
// do nothing
}
val noticeDialog = DialogHelper.showDialog(
context = requireContext(),
title = "权限申请",
content = "是否允许“光环助手”获取已安装的应用信息",
confirmText = "开启",
cancelText = "拒绝",
confirmClickCallback = {
grantedClosure.invoke()
}
)
noticeDialog?.setOnDismissListener {
hintDialog?.dismiss()
}
}
}
}
override fun onDarkModeChanged() {
super.onDarkModeChanged()
changeBottomTabStyle(mBinding.viewPager.currentItem)

View File

@ -211,7 +211,7 @@ class MainWrapperRepository {
// 如果有优先级更高的选中 tab id则将优先级更高的选中 tab 设置为 default
if (mHighPrioritySelectedTopTabId.isNotEmpty() && mHighPrioritySelectedNavId == multiTabNav?.id) {
val selectedTab = multiTabNav.linkMultiTabNav.firstOrNull {
it.link?.link == mHighPrioritySelectedTopTabId
it.id == mHighPrioritySelectedTopTabId
}
// 将优先级更高的选中 tab 设置为 default
@ -225,7 +225,7 @@ class MainWrapperRepository {
defaultCustomPageId =
multiTabNav?.linkMultiTabNav?.find { it.link?.type == ViewPagerFragmentHelper.TYPE_CUSTOM_PAGE && it.default }?.link?.link ?: ""
multiTabNavLiveData.postValue(multiTabNav)
multiTabNavLiveData.value = multiTabNav
}
companion object : SingletonHolder<MainWrapperRepository>({ MainWrapperRepository() })

View File

@ -13,6 +13,7 @@ import android.widget.ImageView
import android.widget.RelativeLayout
import android.widget.TextView
import androidx.core.graphics.ColorUtils
import androidx.core.view.doOnLayout
import androidx.core.view.isVisible
import androidx.core.view.updateLayoutParams
import com.gh.common.constant.Config
@ -402,7 +403,9 @@ class SearchToolbarTabWrapperFragment : BaseTabWrapperFragment(), ISearchToolbar
val selectTab = it.getContentWithHandled()
if (selectTab is MainSelectedEvent.SelectedTab) {
if (selectTab.topTabIndex != -1) {
mViewPager?.setCurrentItem(selectTab.topTabIndex, false)
mViewPager?.doOnLayout {
mViewPager?.setCurrentItem(selectTab.topTabIndex, false)
}
}
}
}

View File

@ -46,7 +46,6 @@ import com.gh.common.videolog.VideoRecordUtils;
import com.gh.download.simple.DownloadMessageHandler;
import com.gh.download.simple.SimpleDownloadDatabase;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.Injection;
import com.gh.gamecenter.common.constant.Config;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.constant.RouteConsts;
@ -351,7 +350,7 @@ public class HaloApp extends MultiDexApplication {
PackageRepository.initData();
PackageHelper.refreshLocalPackageList();
PackageHelper.initList();
PackageHelper.refreshList();
initReceiver();
initPackageChangesReceiver();

View File

@ -118,7 +118,7 @@ class RealNameInfoFragment : ToolbarFragment() {
) {
DirectUtils.directToWebView(
requireContext(),
"https://resource.ghzs.com/page/privacy_policies/Identity_information.html",
"https://and-static.ghzs66.com/page/privacy_policies/Identity_information.html",
"(实名认证)"
)
}

View File

@ -153,7 +153,7 @@ class UserInfoFragment : ToolbarFragment() {
MtaHelper.onEvent("个人主页详情", "个人中心", "账号安全指南")
DirectUtils.directToWebView(
requireContext(),
"https://resource.ghzs.com/page/guide_page/safety_guide.html",
"https://and-static.ghzs66.com/page/guide_page/safety_guide.html",
"(个人中心)"
)
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 668 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

View File

@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="12dp"
android:height="6dp"
android:viewportWidth="12"
android:viewportHeight="6">
<path
android:strokeWidth="1"
android:pathData="M10,1L6,5L2,1"
android:strokeLineJoin="round"
android:fillColor="#00000000"
android:strokeColor="@color/text_neutral"
android:strokeLineCap="round"/>
</vector>

View File

@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="8dp"
android:height="6dp"
android:viewportWidth="8"
android:viewportHeight="6">
<path
android:strokeWidth="1"
android:pathData="M7,1.5L4,4.5L1,1.5"
android:strokeLineJoin="round"
android:fillColor="#00000000"
android:strokeColor="@color/text_neutral"
android:strokeLineCap="round"/>
</vector>

View File

@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="6dp"
android:height="12dp"
android:viewportWidth="6"
android:viewportHeight="12">
<path
android:strokeWidth="1"
android:pathData="M1,2L5,6L1,10"
android:strokeLineJoin="round"
android:fillColor="#00000000"
android:strokeColor="@color/text_neutral"
android:strokeLineCap="round"/>
</vector>

View File

@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="5dp"
android:height="8dp"
android:viewportWidth="5"
android:viewportHeight="8">
<path
android:strokeWidth="1"
android:pathData="M1,1L4,4L1,7"
android:strokeLineJoin="round"
android:fillColor="#00000000"
android:strokeColor="@color/text_neutral"
android:strokeLineCap="round"/>
</vector>

View File

@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="12dp"
android:height="12dp"
android:viewportWidth="12"
android:viewportHeight="12">
<group>
<clip-path
android:pathData="M0,0h12v12h-12z"/>
<path
android:pathData="M1.646,1.646C1.842,1.451 2.158,1.451 2.354,1.646L6,5.293L9.646,1.646C9.842,1.451 10.158,1.451 10.354,1.646C10.549,1.842 10.549,2.158 10.354,2.354L6.707,6L10.354,9.646C10.549,9.842 10.549,10.158 10.354,10.354C10.158,10.549 9.842,10.549 9.646,10.354L6,6.707L2.354,10.354C2.158,10.549 1.842,10.549 1.646,10.354C1.451,10.158 1.451,9.842 1.646,9.646L5.293,6L1.646,2.354C1.451,2.158 1.451,1.842 1.646,1.646Z"
android:fillColor="@color/text_neutral"
android:fillType="evenOdd"/>
</group>
</vector>

View File

@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="8dp"
android:height="8dp"
android:viewportWidth="8"
android:viewportHeight="8">
<group>
<clip-path
android:pathData="M0,0h8v8h-8z"/>
<path
android:pathData="M0.6464,0.6465C0.8417,0.4512 1.1583,0.4512 1.3535,0.6465L4,3.2929L6.6465,0.6465C6.8417,0.4512 7.1583,0.4512 7.3535,0.6465C7.5488,0.8417 7.5488,1.1583 7.3535,1.3536L4.7071,4L7.3535,6.6465C7.5488,6.8417 7.5488,7.1583 7.3535,7.3536C7.1583,7.5488 6.8417,7.5488 6.6465,7.3536L4,4.7071L1.3535,7.3536C1.1583,7.5488 0.8417,7.5488 0.6464,7.3536C0.4512,7.1583 0.4512,6.8417 0.6464,6.6465L3.2929,4L0.6464,1.3536C0.4512,1.1583 0.4512,0.8417 0.6464,0.6465Z"
android:fillColor="@color/text_neutral"
android:fillType="evenOdd"/>
</group>
</vector>

View File

@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="12dp"
android:height="12dp"
android:viewportWidth="12"
android:viewportHeight="12">
<group>
<clip-path
android:pathData="M0,0h12v12h-12z"/>
<path
android:pathData="M6,1C6.276,1 6.5,1.224 6.5,1.5V5.5H10.5C10.776,5.5 11,5.724 11,6C11,6.276 10.776,6.5 10.5,6.5H6.5V10.5C6.5,10.776 6.276,11 6,11C5.724,11 5.5,10.776 5.5,10.5V6.5H1.5C1.224,6.5 1,6.276 1,6C1,5.724 1.224,5.5 1.5,5.5H5.5V1.5C5.5,1.224 5.724,1 6,1Z"
android:fillColor="@color/text_neutral"
android:fillType="evenOdd"/>
</group>
</vector>

View File

@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="8dp"
android:height="8dp"
android:viewportWidth="8"
android:viewportHeight="8">
<group>
<clip-path
android:pathData="M0,0h8v8h-8z"/>
<path
android:pathData="M4,0C4.2761,0 4.5,0.2239 4.5,0.5V3.5H7.5C7.7761,3.5 8,3.7239 8,4C8,4.2761 7.7761,4.5 7.5,4.5H4.5V7.5C4.5,7.7761 4.2761,8 4,8C3.7239,8 3.5,7.7761 3.5,7.5V4.5H0.5C0.2239,4.5 0,4.2761 0,4C0,3.7239 0.2239,3.5 0.5,3.5H3.5V0.5C3.5,0.2239 3.7239,0 4,0Z"
android:fillColor="@color/text_neutral"
android:fillType="evenOdd"/>
</group>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="8dp"
android:height="8dp"
android:viewportWidth="8"
android:viewportHeight="8">
<path
android:pathData="M6.4395,2C7.0684,2 7.418,2.7274 7.0252,3.2185L4.5856,6.2679C4.2854,6.6432 3.7146,6.6432 3.4144,6.2679L0.9748,3.2185C0.582,2.7274 0.9316,2 1.5605,2H6.4395Z"
android:fillColor="@color/text_neutral"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="8dp"
android:height="8dp"
android:viewportWidth="8"
android:viewportHeight="8">
<path
android:pathData="M6.4395,6C7.0684,6 7.418,5.2726 7.0252,4.7815L4.5856,1.7321C4.2854,1.3568 3.7146,1.3568 3.4144,1.7321L0.9748,4.7815C0.582,5.2726 0.9316,6 1.5605,6H6.4395Z"
android:fillColor="@color/text_neutral"/>
</vector>

View File

@ -122,41 +122,6 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/user_name">
<LinearLayout
android:id="@+id/levelContainer"
android:layout_width="wrap_content"
android:layout_height="16dp"
android:layout_marginRight="8dp"
android:background="@drawable/bg_user_level"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:visibility="gone"
tools:visibility="visible">
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:src="@drawable/ic_level" />
<TextView
android:id="@+id/levelTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:paddingLeft="1dp"
android:textColor="@color/white"
android:textSize="10sp"
android:textStyle="bold|italic"
tools:text="Lv0" />
<ImageView
android:layout_width="6dp"
android:layout_height="8dp"
android:src="@drawable/ic_user_more" />
</LinearLayout>
<RelativeLayout
android:id="@+id/badge_container"
android:layout_width="wrap_content"

View File

@ -1,5 +1,6 @@
<com.gh.gamecenter.common.view.MaterializedConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
@ -29,7 +30,7 @@
android:layout_height="40dp"
android:background="@color/home_realname_error"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/bottomTabContainer"
app:layout_constraintBottom_toTopOf="@+id/installApiContainer"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
@ -41,7 +42,8 @@
android:src="@drawable/ic_realname_error_hint"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
<TextView
android:id="@+id/realNameErrorHintTv"
@ -77,6 +79,60 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/installApiContainer"
android:layout_width="0dp"
android:layout_height="52dp"
android:background="@color/ui_surface"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/bottomTabContainer"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:visibility="visible">
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/primary_theme_10" />
<ImageView
android:id="@+id/installApiCloseIv"
android:layout_width="8dp"
android:layout_height="8dp"
android:layout_marginStart="16dp"
android:src="@drawable/ic_install_api_close"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/installApiContentTv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="8dp"
android:text="您未授予已安装列表权限,可能导致无法安装及更新等异常情况,建议开启权限!"
android:textSize="@dimen/secondary_size"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/installApiBtn"
app:layout_constraintStart_toEndOf="@id/installApiCloseIv"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/installApiBtn"
style="@style/BtnSmallStyle"
android:layout_width="64dp"
android:layout_height="28dp"
android:layout_marginEnd="16dp"
android:background="@drawable/bg_common_button_fill_gradient_blue"
android:text="去开启"
android:textColor="@color/text_aw_primary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:id="@+id/bottomTabContainer"
android:layout_width="0dp"

View File

@ -197,9 +197,9 @@
<string name="concern_cancel_failure">取消失敗,請稍後再試</string>
<string name="third_party_sdk_title">光環助手接入第三方SDK目錄</string>
<string name="third_party_sdk_statement_url">https://resource.ghzs.com/page/third_party_sdk/index.html</string>
<string name="third_party_sdk_statement_url">https://and-static.ghzs66.com/page/third_party_sdk/index.html</string>
<string name="comment_rules_title">光環助手評論規則</string>
<string name="comment_rules_url">https://resource.ghzs.com/page/rule_page/comment_rules.html</string>
<string name="comment_rules_url">https://and-static.ghzs66.com/page/rule_page/comment_rules.html</string>
<string name="collection_cancel">取消收藏</string>
<string name="collection_cancel_failure">取消收藏失敗</string>
<string name="collection_success">收藏成功</string>
@ -307,14 +307,14 @@
<string name="share_news_article_url">https://m.ghzs666.com/article/%1$s</string>
<string name="comment_hide_hint">該內容已被刪除</string>
<string name="personal_home_rating_command">%1$s 在 <Data><![CDATA[<font color="#1383EB">%2$s</font>]]></Data> 發表了評論</string>
<string name="upload_game_policy_url">https://resource.ghzs.com/page/game_rule/game_rule.html</string>
<string name="info_list_url">https://resource.ghzs.com/page/privacy_policies/Personal_information_collection_list.html</string>
<string name="sdk_list_url">https://resource.ghzs.com/page/privacy_policies/sdk_directory.html</string>
<string name="permission_and_usage_url">https://resource.ghzs.com/page/privacy_policies/Permission_Usage.html</string>
<string name="upload_game_policy_url">https://and-static.ghzs66.com/page/game_rule/game_rule.html</string>
<string name="info_list_url">https://and-static.ghzs66.com/page/privacy_policies/Personal_information_collection_list.html</string>
<string name="sdk_list_url">https://and-static.ghzs66.com/page/privacy_policies/sdk_directory.html</string>
<string name="permission_and_usage_url">https://and-static.ghzs66.com/page/privacy_policies/Permission_Usage.html</string>
<string name="children_policy_url">https://resource.junrui66.com/page/privacy_policies/Child_privacy_statement_GA.html</string>
<string name="community_rule_title">問答版塊規則</string>
<string name="community_rule_url">https://resource.ghzs.com/page/section_rule/section_rule.html</string>
<string name="community_rule_url">https://and-static.ghzs66.com/page/section_rule/section_rule.html</string>
<string name="upload_protocol">我已閱讀並同意《視頻上傳服務準則》</string>
@ -327,7 +327,7 @@
<string name="upload_game_category_hint">分類<Data><![CDATA[<font color="#ff4147">*</font>]]></Data></string>
<string name="upload_game_video_source_hint">視頻來源<Data><![CDATA[<font color="#ff4147">*</font>]]></Data></string>
<string name="upload_protocol_url"> https://resource.ghzs.com/page/video_rule/video_rule.html</string>
<string name="upload_protocol_url"> https://and-static.ghzs66.com/page/video_rule/video_rule.html</string>
<string name="upload_protocol_title">視頻上傳服務準則</string>
<string name="video_upload_draft_dialog_content">草稿保存之後會關閉視頻上傳頁面!下次可在<Data><![CDATA[<font color="#151515"><b>視頻投稿-草稿箱</b></font>]]></Data>中繼續上傳</string>

View File

@ -199,9 +199,9 @@
<string name="concern_cancel_failure">取消失败,请稍后再试</string>
<string name="third_party_sdk_title">光环助手接入第三方SDK目录</string>
<string name="third_party_sdk_statement_url">https://resource.ghzs.com/page/third_party_sdk/index.html</string>
<string name="third_party_sdk_statement_url">https://and-static.ghzs66.com/page/third_party_sdk/index.html</string>
<string name="comment_rules_title">光环助手评论规则</string>
<string name="comment_rules_url">https://resource.ghzs.com/page/rule_page/comment_rules.html</string>
<string name="comment_rules_url">https://and-static.ghzs66.com/page/rule_page/comment_rules.html</string>
<string name="collection_cancel">取消收藏</string>
<string name="collection_cancel_failure">取消收藏失败</string>
<string name="collection_success">收藏成功</string>
@ -309,14 +309,14 @@
<string name="share_news_article_url">https://m.ghzs666.com/article/%1$s</string>
<string name="comment_hide_hint">该内容已被删除</string>
<string name="personal_home_rating_command">%1$s 在 <Data><![CDATA[<font color="#1383EB">%2$s</font>]]></Data> 发表了评论</string>
<string name="upload_game_policy_url">https://resource.ghzs.com/page/game_rule/game_rule.html</string>
<string name="info_list_url">https://resource.ghzs.com/page/privacy_policies/Personal_information_collection_list.html</string>
<string name="sdk_list_url">https://resource.ghzs.com/page/privacy_policies/sdk_directory.html</string>
<string name="permission_and_usage_url">https://resource.ghzs.com/page/privacy_policies/Permission_Usage.html</string>
<string name="children_policy_url">https://resource.ghzs.com/page/privacy_policies/Child_privacy_statement.html</string>
<string name="upload_game_policy_url">https://and-static.ghzs66.com/page/game_rule/game_rule.html</string>
<string name="info_list_url">https://and-static.ghzs66.com/page/privacy_policies/Personal_information_collection_list.html</string>
<string name="sdk_list_url">https://and-static.ghzs66.com/page/privacy_policies/sdk_directory.html</string>
<string name="permission_and_usage_url">https://and-static.ghzs66.com/page/privacy_policies/Permission_Usage.html</string>
<string name="children_policy_url">https://and-static.ghzs66.com/page/privacy_policies/Child_privacy_statement.html</string>
<string name="community_rule_title">问答版块规则</string>
<string name="community_rule_url">https://resource.ghzs.com/page/section_rule/section_rule.html</string>
<string name="community_rule_url">https://and-static.ghzs66.com/page/section_rule/section_rule.html</string>
<string name="upload_protocol">我已阅读并同意《视频上传服务准则》</string>
@ -329,7 +329,7 @@
<string name="upload_game_category_hint">分类<Data><![CDATA[<font color="#ff4147">*</font>]]></Data></string>
<string name="upload_game_video_source_hint">视频来源<Data><![CDATA[<font color="#ff4147">*</font>]]></Data></string>
<string name="upload_protocol_url"> https://resource.ghzs.com/page/video_rule/video_rule.html</string>
<string name="upload_protocol_url"> https://and-static.ghzs66.com/page/video_rule/video_rule.html</string>
<string name="upload_protocol_title">视频上传服务准则</string>
<string name="video_upload_draft_dialog_content">草稿保存之后会关闭视频上传页面!下次可在<Data><![CDATA[<font color="#151515"><b>视频投稿-草稿箱</b></font>]]></Data>中继续上传</string>

View File

@ -125,7 +125,7 @@ ext {
composeCompilerVersion = "1.3.2"
constraintlayoutCompose = "1.0.1"
sensorsDataVersion = "6.7.10"
sensorsDataVersion = "6.8.0"
documentfile = "1.0.1"

View File

@ -41,5 +41,9 @@ class ACloudPushProviderImpl : IPushProvider {
return ""
}
override fun cleanBadgeNumber(applicationContext: Context) {
// do nothing
}
override fun init(p0: Context?) {}
}

View File

@ -15,6 +15,8 @@ import com.lightgame.utils.Utils
object JPushHelper {
const val TAG = "JPushHelper"
private var badgeCount = 0 // 角标计数
fun init(applicationContext: Context) {
JPushInterface.setDebugMode(BuildConfig.DEBUG)
JPushInterface.init(applicationContext)
@ -45,4 +47,20 @@ object JPushHelper {
Utils.log(TAG, "bind error $it")
})
}
// 角标+1
fun appendBadgeNumber(applicationContext: Context) {
JPushInterface.setBadgeNumber(applicationContext, ++badgeCount)
}
// 角标-1
fun subtractBadgeNumber(applicationContext: Context) {
JPushInterface.setBadgeNumber(applicationContext, if (badgeCount > 0) --badgeCount else 0)
}
// 清除角标
fun cleanBadgeNumber(applicationContext: Context) {
badgeCount = 0
JPushInterface.setBadgeNumber(applicationContext, badgeCount)
}
}

View File

@ -47,5 +47,9 @@ class JGPushProviderImpl : IPushProvider {
return JPushHelper.getRegistrationId(context)
}
override fun cleanBadgeNumber(applicationContext: Context) {
JPushHelper.cleanBadgeNumber(applicationContext)
}
override fun init(p0: Context?) {}
}

View File

@ -1,6 +1,7 @@
package com.gh.gamecenter.jg.push.service
import android.content.Context
import cn.jpush.android.api.NotificationMessage
import cn.jpush.android.service.JPushMessageService
import com.gh.gamecenter.jg.push.JPushHelper
import com.lightgame.utils.Utils
@ -11,6 +12,27 @@ class HaloJPushMessageService: JPushMessageService() {
JPushHelper.bindRegistrationId(registrationId)
}
override fun onNotifyMessageArrived(context: Context, message: NotificationMessage) {
super.onNotifyMessageArrived(context, message)
Utils.log(TAG, "onNotifyMessageArrived: $message")
JPushHelper.appendBadgeNumber(context.applicationContext)
}
override fun onNotifyMessageOpened(context: Context, message: NotificationMessage) {
super.onNotifyMessageOpened(context, message)
Utils.log(TAG, "onNotifyMessageOpened: $message")
JPushHelper.subtractBadgeNumber(context.applicationContext)
}
override fun onNotifyMessageDismiss(context: Context, message: NotificationMessage) {
super.onNotifyMessageDismiss(context, message)
Utils.log(TAG, "onNotifyMessageDismiss: $message")
JPushHelper.subtractBadgeNumber(context.applicationContext)
}
companion object {
const val TAG = "HaloJPushMessageService"
}

View File

@ -1,10 +1,8 @@
package com.gh.gamecenter.feedback.view.help
import android.os.Build
import android.os.Bundle
import android.view.Gravity
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.view.*
import android.view.ViewGroup.MarginLayoutParams
import android.widget.FrameLayout
import android.widget.LinearLayout
@ -21,6 +19,7 @@ import androidx.recyclerview.widget.RecyclerView.SimpleOnItemTouchListener
import androidx.viewpager2.widget.ViewPager2
import com.gh.gamecenter.common.base.fragment.BaseLazyFragment
import com.gh.gamecenter.common.baselist.LoadStatus
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.databinding.ItemIconTabBinding
import com.gh.gamecenter.common.databinding.PopupAllTabsBinding
import com.gh.gamecenter.common.utils.*
@ -35,6 +34,7 @@ import com.gh.gamecenter.feedback.view.qa.HelpQaDefaultAdapter
import com.gh.gamecenter.feedback.view.qa.QaActivity
import com.gh.gamecenter.feedback.view.qa.QaSearchActivity
import com.gh.gamecenter.feedback.view.suggest.SuggestionActivity
import com.lightgame.utils.Util_System_ClipboardManager
import splitties.views.bottomPadding
import kotlin.math.abs
@ -214,6 +214,7 @@ class HelpAndFeedbackFragment : BaseLazyFragment() {
}
}
updateFeedbackContentIfAvailable()
observeData()
}
@ -228,6 +229,42 @@ class HelpAndFeedbackFragment : BaseLazyFragment() {
mHelpVideoAdapter?.startScroll()
}
/**
* 根据历史功能,如果剪贴板中有符合条件的内容(插件跳转时的反馈内容),就更新 argument 里的 content
*/
private fun updateFeedbackContentIfAvailable() {
// 默认不带参跳转内容包含 null
if (arguments?.getString(EntranceConsts.KEY_CONTENT)?.contains("null") == false) {
return
}
val updateArgumentClosure = {
val clipboardText = Util_System_ClipboardManager.getText(requireContext())
if (clipboardText != null
&& clipboardText.contains("游戏名")
&& clipboardText.contains("游戏ID")
&& clipboardText.contains("游戏包MD5")
) {
arguments?.putString(EntranceConsts.KEY_CONTENT, clipboardText)
}
}
// Android 10.0 及以后版本需要在获取到了 windowsFocus 后才能访问粘贴版内容
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
val listener = object : ViewTreeObserver.OnWindowFocusChangeListener {
override fun onWindowFocusChanged(hasFocus: Boolean) {
if (hasFocus) {
updateArgumentClosure.invoke()
mBinding.root.viewTreeObserver.removeOnWindowFocusChangeListener(this)
}
}
}
mCachedView?.viewTreeObserver?.addOnWindowFocusChangeListener(listener)
} else {
updateArgumentClosure.invoke()
}
}
private fun showCategoryPopupWindow() {
val binding = PopupAllTabsBinding.inflate(LayoutInflater.from(requireContext()), null, false)
val popupWindow = PopupWindow(

View File

@ -58,11 +58,11 @@ DEV_CSJ_APPID=5410486
CSJ_APPID=5429125
# hosts
DEV_API_HOST=https\://dev-and-api.ghzs.com/v5d5d0/
API_HOST=https\://and-api.ghzs.com/v5d5d0/
DEV_API_HOST=https\://dev-and-api.ghzs6.com/v5d5d0/
API_HOST=https\://and-api.ghzs6.com/v5d5d0/
API_HOST_GAT=https\://and-api.junrui66.com/v5d5d0/
NEW_DEV_API_HOST=https\://dev-app-api.ghzs.com/
NEW_API_HOST=https\://app-api.ghzs.com/
NEW_DEV_API_HOST=https\://dev-app-api.ghzs6.com/
NEW_API_HOST=https\://app-api.ghzs6.com/
NEW_API_HOST_GAT=https\://app-api.junrui66.com/
DEV_VAPI_HOST=https://dev-app-api.796697.com
VAPI_HOST=https://app-api.796697.com

View File

@ -421,14 +421,14 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements IBus
, () -> {
}
, () -> {
if (SPUtils.getBoolean(Constants.SP_HAS_GET_PHONE_INFO) || NetworkUtils.isOpenMobileData(BaseActivity.this)) {
IQuickLoginProvider quickLoginConfig = (IQuickLoginProvider) ARouter.getInstance().build(RouteConsts.provider.quickLogin).navigation();
quickLoginConfig.startLogin(BaseActivity.this, "你的账号已在另外一台设备登录多设备-重新登录");
} else {
ARouter.getInstance().build(RouteConsts.activity.loginActivity)
.withString(EntranceConsts.KEY_ENTRANCE, "你的账号已在另外一台设备登录多设备-重新登录")
.navigation();
}
// if (SPUtils.getBoolean(Constants.SP_HAS_GET_PHONE_INFO) || NetworkUtils.isOpenMobileData(BaseActivity.this)) {
// IQuickLoginProvider quickLoginConfig = (IQuickLoginProvider) ARouter.getInstance().build(RouteConsts.provider.quickLogin).navigation();
// quickLoginConfig.startLogin(BaseActivity.this, "你的账号已在另外一台设备登录多设备-重新登录");
// } else {
ARouter.getInstance().build(RouteConsts.activity.loginActivity)
.withString(EntranceConsts.KEY_ENTRANCE, "你的账号已在另外一台设备登录多设备-重新登录")
.navigation();
// }
}
);
IQGameProvider<?> qProvider = (IQGameProvider<?>) ARouter

View File

@ -7,8 +7,6 @@ import com.gh.gamecenter.core.utils.TimeUtils;
public class Constants {
private static final IPackageUtilsProvider packageUtilsConfig = (IPackageUtilsProvider) ARouter.getInstance().build(RouteConsts.provider.packageUtils).navigation();
public static final int SEND_NEWS_FEEDBACK = 0x126;
public static final int SEND_COMMENT_FEEDBACK = 0x127;
public final static int LIST_FOOTER_ITEM = 1;
public final static int LIST_HEAD_ITEM = 1;
@ -25,20 +23,12 @@ public class Constants {
public static final String DEVICE_KEY = "deviceKey";
public static final String HAS_REQUESTED_NOTIFICATION_PERMISSIONS = "has_requested_notification_permissions";
public static final String SHOULD_SHOW_VIDEO_MOBILE_WARNING = "should_show_video_mobile_warning";
public static final String GAME_DETAIL_COME_IN = "game_detail_come_in"; // 从游戏详情进入
public static final String SPLASH_AD = "splash_ad"; // 启动广告
public static final String XPOSED_INSTALLER_PACKAGE_NAME = "de.robv.android.xposed.installer";
public static final String EB_QUIT_LOGIN = "quit_login";
public static final String EB_SHOW_AD = "show_ad";
public static final String EB_GAME_DETAIL = "eb_game_detail";
// 用于避免历史下载影响到部分依赖名字作为数据更新条件的修饰符
@ -77,7 +67,6 @@ public class Constants {
public static final String EXTRA_DOWNLOAD_TYPE = "extra_download_type";
public static final String EXTRA_IS_MODDED_GAME = "extra_is_modded_game"; // 是否是修改版游戏
public static final String SILENT_UPDATE = "静默更新";
public static final String SILENT_DOWNLOAD = "silent_download"; // 静默下载(不需要显示在下载管理里)
public static final String SIMULATOR_DOWNLOAD = "下载模拟器";
public static final String SIMULATOR_GAME = "simulator_game";
public static final String SIMULATOR = "simulator";
@ -90,12 +79,10 @@ public class Constants {
public static final String GAME_CATEGORY = "game_category"; // 游戏类型
public static final String GAME_CATEGORY_IN_CHINESE = "game_category_in_chinese"; // 游戏类型,以中文显示
public static final String SIMULATOR_DOWNLOAD_START_TIME = "simulator_download_start_time";
public static final String LAST_GHZS_UPDATE_FILE_SIZE = "last_ghzs_update_file_size";
// 新用户首次启动光环的时间
public static final String SP_INITIAL_USAGE_TIME = "initial_usage_time";
public static final String SP_IMEI = "imei";
public static final String SP_ANDROID_ID = "android_id";
// 安装类型
@ -129,8 +116,6 @@ public class Constants {
public static final String SP_MARK_INSTALLED_GAME_USER_HOME = "mark_installed_game_user_home" + packageUtilsConfig.getGhVersionName();
// 标记安装的游戏为已玩过弹窗(我的游戏最多弹一次)
public static final String SP_MARK_INSTALLED_GAME_MY_GAME = "mark_installed_game_my_game" + packageUtilsConfig.getGhVersionName();
//顶部视频声音状态,重启恢复
public static final String SP_TOP_VIDEO_VOICE = "top_video_voice";
//我的光环提醒设置已读
public static final String SP_ADDONS_FUNCS_HAVE_READ = "addons_funcs_have_read";
//视频非wifi提醒只提醒一次重启恢复
@ -147,21 +132,13 @@ public class Constants {
public static final String SP_FILTER_TAGS = "filter_tags";
//我的光环小红点提示
public static final String SP_GH_RED_POINT_REMIND = "gh_red_point_remind";
//论坛首页引导
public static final String SP_FORUM_GUIDE = "forum_guide";
//礼仪考试开启状态
public static final String SP_REGULATION_TEST_LAST_REMIND_TIME = "regulation_test_last_remind_time";
public static final String SP_REGULATION_TEST_STATUS = "regulation_test_status";
public static final String SP_REGULATION_TEST_PASS_STATUS = "regulation_test_pass_status";
//相同设备号,每一种第三方登录方式登录后弹出绑定手机页面的次数
// public static final String SP_QQ_SHOW_BIND_PHONE_TIME = "qq_show_bind_phone_time" + HaloApp.getInstance().getGid();
// public static final String SP_WECHAT_SHOW_BIND_PHONE_TIME = "wechat_show_bind_phone_time" + HaloApp.getInstance().getGid();
// public static final String SP_WEIBO_SHOW_BIND_PHONE_TIME = "weibo_show_bind_phone_time" + HaloApp.getInstance().getGid();
// public static final String SP_DOUYIN_SHOW_BIND_PHONE_TIME = "douyin_show_bind_phone_time" + HaloApp.getInstance().getGid();
//隐私政策是否有更新
public static final String SP_PRIVACY_CURRENT_MD5 = "sp_privacy_current_md5";
public static final String SP_PRIVACY_MINE_MD5 = "sp_privacy_mine_md5";
public static final String SP_PRIVACY_SETTING_MD5 = "sp_privacy_setting_md5";
public static final String SP_PRIVACY_MD5 = "sp_privacy_md5";
public static final String SP_IS_USER_ACCEPTED_PRIVACY_STATEMENT = "has_user_accepted_privacy_statement";
@ -209,6 +186,9 @@ public class Constants {
// 用户是否曾经永久拒绝过存储权限
public static final String SP_USER_HAS_PERMANENTLY_DENIED_STORAGE_PERMISSION = "user_has_permanently_denied_storage_permission";
// 用户是否曾经永久拒绝过获取应用安装列表权限
public static final String SP_USER_HAS_PERMANENTLY_DENIED_GET_INSTALL_LIST_PERMISSION = "user_has_permanently_denied_get_install_list_permission";
// 是否已经填写邀请码
public static final String SP_HAS_COMPLETE_INVITE_CODE = "has_complete_invite_code";
@ -262,8 +242,6 @@ public class Constants {
//游戏库导航栏小红点提示
public static final String SP_GAME_NAVIGATION = "game_navigation";
// V游戏空间是否被使用过
public static final String SP_IS_VSPACE_USED = "is_vspace_used";
//webview version code
public static final String SP_WEBVIEW_VERSION_CODE = "webview_version_code";
//webview abi
@ -273,33 +251,25 @@ public class Constants {
// 发现页列表数据是否强制刷新
public static final String SP_DISCOVER_FORCE_REFRESH = "discover_force_refresh";
//手机号码匹配规则
public static final String REGEX_MOBILE = "^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$";
public static final String REGEX_ACCOUNT = "^[a-zA-Z_]\\w{5,17}$";
public static final String REGEX_PASSWORD = "^[a-zA-Z]\\w{5,31}$";
//输入规则
public static final String INPUT_RULE = "0123456789abcdefghijklnmopqrstuvwxyzABCDEFGHIJKLNMOPQRSTUVWXYZ_";
// 微信绑定地址
public static final String WECHAT_BIND_ADDRESS_DEV = "https://dev-and-static.ghzs.com/web/wechat_bind/index.html#/";
public static final String WECHAT_BIND_ADDRESS = "https://and-static.ghzs.com/web/wechat_bind/index.html#/";
// 礼仪考试地址
public static final String REGULATION_TEST_ADDRESS_DEV = "https://static-web.ghzs.com/etiquette-dev/index.html#/";
public static final String REGULATION_TEST_ADDRESS = "https://static-web.ghzs.com/etiquette/index.html#/";
public static final String REGULATION_TEST_ADDRESS_DEV = "https://dev-and-static.ghzs66.com/web/etiquette/index.html#/";
public static final String REGULATION_TEST_ADDRESS = "https://and-static.ghzs66.com/web/etiquette/index.html#/";
// 徽章中心
public static final String BADGE_ADDRESS_DEV = "https://static-web.ghzs.com/badge-dev/index.html#/";
public static final String BADGE_ADDRESS = "https://static-web.ghzs.com/badge/index.html#/";
public static final String BADGE_ADDRESS_DEV = "https://dev-and-static.ghzs66.com/web/badge/index.html#/";
public static final String BADGE_ADDRESS = "https://and-static.ghzs66.com/web/badge/index.html#/";
// 徽章详情
public static final String BADGE_DETAIL_ADDRESS_DEV = "https://static-web.ghzs.com/badge-dev/index.html#/badgedetail";
public static final String BADGE_DETAIL_ADDRESS = "https://static-web.ghzs.com/badge/index.html#/badgedetail";
public static final String BADGE_DETAIL_ADDRESS_DEV = "https://dev-and-static.ghzs66.com/web/badge/index.html#/badgedetail";
public static final String BADGE_DETAIL_ADDRESS = "https://and-static.ghzs66.com/web/badge/index.html#/badgedetail";
// 分享个人主页地址
public static final String SHARE_USER_HOME_ADDRESS_DEV = "https://static-web.ghzs.com/ghzs-userhome-dev/index.html#/";
public static final String SHARE_USER_HOME_ADDRESS = "https://static-web.ghzs.com/ghzs-userhome/index.html#/";
public static final String SHARE_USER_HOME_ADDRESS_DEV = "https://dev-and-static.ghzs66.com/web/ghzs-userhome/index.html#/";
public static final String SHARE_USER_HOME_ADDRESS = "https://and-static.ghzs66.com/web/ghzs-userhome/index.html#/";
// 腾讯企点地址
public static final String TENCENT_QIDIAN_ADDRESS = "https://admin.qidian.qq.com/template/blue/mp/menu/qr-code-jump.html?linkType=0&env=ol&kfuin=2355094296&fid=457&key=c76dcb2e3d582b6ffbfb5bb22cde85ff&cate=1&source=&isLBS=&isCustomEntry=&type=16&ftype=1&_type=wpa&qidian=true";
@ -308,105 +278,50 @@ public class Constants {
public static final String FORUM_REGULATIONS_NEWS_ID = "5f4db9cc34d44d01b92fd670";
// 权限使用场景地址
public static final String PERMISSION_SCENARIO_ADDRESS = "https://resource.ghzs.com/page/privacy_policies/permissions.html";
public static final String PERMISSION_SCENARIO_ADDRESS = "https://and-static.ghzs66.com/page/privacy_policies/permissions.html";
//帮助内容详情
public static final String HELP_ADDRESS_DEV = "https://static-web.ghzs.com/ghzs_help_dev/help.html?content=";
public static final String HELP_ADDRESS = "https://static-web.ghzs.com/ghzs_help/help.html?content=";
public static final String HELP_ADDRESS_DEV = "https://dev-and-static.ghzs66.com/web/ghzs_help/help.html?content=";
public static final String HELP_ADDRESS = "https://and-static.ghzs66.com/web/ghzs_help/help.html?content=";
// 畅玩助手相关
public static final String SMOOTH_GAME_PRIVACY_POLICY_ADDRESS = "https://sdg-static.79887.com/misc/privacy_CW.html";
// 注销页面
public static final String LOGOUT_ADDRESS_DEV = "https://static-web.ghzs.com/ghzs_help_dev/help.html?content=5f6b1f02786564003944a693&from=ghzs";
public static final String LOGOUT_ADDRESS = "https://static-web.ghzs.com/ghzs_help/help.html?content=5f534111b1f72909fc225672&from=ghzs";
// 商品详情
public static final String COMMODITY_DETAIL_ADDRESS_DEV = "https://static-web.ghzs.com/shop-dev/index.html#/product?from=ghzs";
public static final String COMMODITY_DETAIL_ADDRESS = "https://static-web.ghzs.com/shop/index.html#/product?from=ghzs";
// 光能记录
public static final String ENERGY_RECORD_ADDRESS_DEV = "https://static-web.ghzs.com/shop-dev/index.html#/record?from=ghzs";
public static final String ENERGY_RECORD_ADDRESS = "https://static-web.ghzs.com/shop/index.html#/record?from=ghzs";
// 订单中心
public static final String ORDER_CENTER_ADDRESS_DEV = "https://static-web.ghzs.com/shop-dev/index.html#/orders?from=ghzs";
public static final String ORDER_CENTER_ADDRESS = "https://static-web.ghzs.com/shop/index.html#/orders?from=ghzs";
// 订单详情
public static final String ORDER_DETAIL_ADDRESS_DEV = "https://static-web.ghzs.com/shop-dev/index.html#/order-detail?from=ghzs";
public static final String ORDER_DETAIL_ADDRESS = "https://static-web.ghzs.com/shop/index.html#/order-detail?from=ghzs";
// 邀请好友
public static final String INVITE_FRIENDS_ADDRESS_DEV = "https://static-web.ghzs.com/ghzs_activity_dev/inviteFriends.html#/invite";
public static final String INVITE_FRIENDS_ADDRESS = "https://static-web.ghzs.com/ghzs_activity_prod/inviteFriends.html#/invite";
// 等级页面
public static final String LEVEL_ADDRESS_DEV = "https://static-web.ghzs.com/ghzs-userhome-dev/index.html#/level";
public static final String LEVEL_ADDRESS = "https://static-web.ghzs.com/ghzs-userhome/index.html#/level";
// 兑换规则
public static final String EXCHANGE_RULE_ADDRESS_DEV = "https://static-web.ghzs.com/shop-dev/index.html#/exchange-rule?from=ghzs";
public static final String EXCHANGE_RULE_ADDRESS = "https://static-web.ghzs.com/shop/index.html#/exchange-rule?from=ghzs";
// 光能规则
public static final String ENERGY_RULE_ADDRESS_DEV = "https://static-web.ghzs.com/shop-dev/index.html#/energy-rule?from=ghzs";
public static final String ENERGY_RULE_ADDRESS = "https://static-web.ghzs.com/shop/index.html#/energy-rule?from=ghzs";
// 兑换商品
public static final String EXCHANGE_COMMODITY_ADDRESS_DEV = "https://static-web.ghzs.com/shop-dev/index.html#/exchange-log?from=ghzs";
public static final String EXCHANGE_COMMODITY_ADDRESS = "https://static-web.ghzs.com/shop/index.html#/exchange-log?from=ghzs";
// 抽奖乐园
public static final String LOTTERY_PARADISE_ADDRESS_DEV = "https://static-web.ghzs.com/shop-dev/index.html#/lottery-list?from=ghzs";
public static final String LOTTERY_PARADISE_ADDRESS = "https://static-web.ghzs.com/shop/index.html#/lottery-list?from=ghzs";
// 我的奖品
public static final String MY_PRIZE_ADDRESS_DEV = "https://static-web.ghzs.com/shop-dev/index.html#/mywin?from=ghzs";
public static final String MY_PRIZE_ADDRESS = "https://static-web.ghzs.com/shop/index.html#/mywin?from=ghzs";
// 中奖订单详情
public static final String WIN_ORDER_DETAIL_ADDRESS_DEV = "https://static-web.ghzs.com/shop-dev/index.html#/win-order-detail?from=ghzs";
public static final String WIN_ORDER_DETAIL_ADDRESS = "https://static-web.ghzs.com/shop/index.html#/win-order-detail?from=ghzs";
public static final String LOGOUT_ADDRESS_DEV = "https://dev-and-static.ghzs66.com/web/ghzs_help/help.html?content=5f6b1f02786564003944a693&from=ghzs";
public static final String LOGOUT_ADDRESS = "https://and-static.ghzs66.com/web/ghzs_help/help.html?content=5f534111b1f72909fc225672&from=ghzs";
// 地址信息
public static final String ADDRESS_INFO_ADDRESS_DEV = "https://static-web.ghzs.com/shop-dev/index.html#/address-list?from=ghzs";
public static final String ADDRESS_INFO_ADDRESS = "https://static-web.ghzs.com/shop/index.html#/address-list?from=ghzs";
public static final String ADDRESS_INFO_ADDRESS_DEV = "https://dev-and-static.ghzs66.com/web/shop/index.html#/address-list?from=ghzs";
public static final String ADDRESS_INFO_ADDRESS = "https://and-static.ghzs66.com/web/shop/index.html#/address-list?from=ghzs";
// 领奖信息
public static final String PRIZE_INFO_ADDRESS_DEV = "https://static-web.ghzs.com/shop-dev/index.html#/user-info?from=ghzs";
public static final String PRIZE_INFO_ADDRESS = "https://static-web.ghzs.com/shop/index.html#/user-info?from=ghzs";
public static final String PRIZE_INFO_ADDRESS_DEV = "https://dev-and-static.ghzs66.com/web/shop/index.html#/user-info?from=ghzs";
public static final String PRIZE_INFO_ADDRESS = "https://and-static.ghzs66.com/web/shop/index.html#/user-info?from=ghzs";
// 提现信息
public static final String WITHDRAW_INFO_ADDRESS_DEV = "https://static-web.ghzs.com/shop-dev/index.html#/cash?from=ghzs";
public static final String WITHDRAW_INFO_ADDRESS = "https://static-web.ghzs.com/shop/index.html#/cash?from=ghzs";
public static final String WITHDRAW_INFO_ADDRESS_DEV = "https://dev-and-static.ghzs66.com/web/shop/index.html#/cash?from=ghzs";
public static final String WITHDRAW_INFO_ADDRESS = "https://and-static.ghzs66.com/web/shop/index.html#/cash?from=ghzs";
// 活动详情
public static final String ACTIVITY_DETAIL_ADDRESS_DEV = "https://static-web.ghzs.com/ghzs_activity_dev/common.html";
public static final String ACTIVITY_DETAIL_ADDRESS = "https://static-web.ghzs.com/ghzs_activity_prod/common.html";
public static final String ACTIVITY_DETAIL_ADDRESS_DEV = "https://dev-and-static.ghzs66.com/web/ghzs_activity/common.html";
public static final String ACTIVITY_DETAIL_ADDRESS = "https://and-static.ghzs66.com/web/ghzs_activity/common.html";
// 游戏单详情分享链接
public static final String GAME_COLLECTION_SHARE_ADDRESS_DEV = "https://dev-and-static.ghzs.com/web/game_collection/index.html#/?from=ghzs";
public static final String GAME_COLLECTION_SHARE_ADDRESS = "https://and-static.ghzs.com/web/game_collection/index.html#/?from=ghzs";
// 游戏单活动分享链接 https://git.shanqu.cc/pm/halo-app-issues/-/issues/1638
public static final String GAME_COLLECTION_ACTIVITY_ADDRESS_DEV = "https://dev-and-static.ghzs.com/web/ghzs_activity/haoyouUnlock.html";
public static final String GAME_COLLECTION_ACTIVITY_ADDRESS = "https://and-static.ghzs.com/web/ghzs_activity/haoyouUnlock.html";
// 青少年模式找回密码
public static final String TEEN_MODE_RESET_PASSWORD = "https://resource.ghzs.com/page/privacy_policies/help_password.html";
public static final String TEEN_MODE_RESET_PASSWORD = "https://and-static.ghzs66.com/page/privacy_policies/help_password.html";
// 儿童/青少年使用须知
public static final String TEEN_MODE_RULE = "https://resource.ghzs.com/page/privacy_policies/teenager_privacy.html";
public static final String TEEN_MODE_RULE = "https://and-static.ghzs66.com/page/privacy_policies/teenager_privacy.html";
//游戏单管理规范
public static final String GAME_COLLECTION_RULE = "https://resource.ghzs.com/page/privacy_policies/game_collection.html";
public static final String GAME_COLLECTION_RULE = "https://and-static.ghzs66.com/page/privacy_policies/game_collection.html";
public static final String SP_IS_DEV_ENV = "is_dev_env";
//最少需要多少数据才能上传
public static final int DATA_AMOUNT = 20;
public static final String[] REPORT_LIST = new String[]{"垃圾广告营销", "恶意攻击谩骂", "淫秽色情信息", "违法有害信息", "其他原因"};
public static final String[] FEEDBACK_REASON_LIST = new String[]{"重复推荐", "不感兴趣", "与推荐描述不符", "已经玩过了", "游戏质量差", "游戏太旧"};
@ -417,9 +332,6 @@ public class Constants {
// 触发了安装事件的标记
public static final String MARK_ALREADY_TRIGGERED_INSTALLATION = "triggered_installation";
// 标记下载重试标记(值为任务已下载大小,为空表示需要重试)
public static final String MARK_RETRY_DOWNLOAD = "retry_download";
// 工具箱历史记录最多4个
public static final String TOOLBOX_HISTORY = "toolbox_history";
@ -428,10 +340,8 @@ public class Constants {
// 浏览器安装说明url
public static final String SP_BROWSER_HINT_URL = "browser_hint_url";
public static final String DEFAULT_OPPO_BROWSER_HINT_URL = "https://static-web.ghzs.com/ghzs_help/help.html?content=5fa90fe143d91a022e0d33ff";
public static final String DEFAULT_VIVO_BROWSER_HINT_URL = "https://static-web.ghzs.com/ghzs_help/help.html?content=618112ce04796e63e97643a4&from=ghzs";
public static final int FOLLOW_HINT_TRIGGER_HEIGHT = 10;
public static final String DEFAULT_OPPO_BROWSER_HINT_URL = "https://and-static.ghzs66.com/web/ghzs_help/help.html?content=5fa90fe143d91a022e0d33ff";
public static final String DEFAULT_VIVO_BROWSER_HINT_URL = "https://and-static.ghzs66.com/web/ghzs_help/help.html?content=618112ce04796e63e97643a4&from=ghzs";
// 深色模式
public static final String SP_DARK_MODE_ENABLED = "dark_mode_is_enabled";
@ -447,8 +357,6 @@ public class Constants {
// 登出标识
public static final String LOGOUT_TAG = "logout_tag";
public static final String GIT_LOG_MD5 = "git_log_md5";
public static final String SP_ADDONS_RECOMMEND_HAVE_READ = "addons_recommend_have_read";
//启动广告
public static final String SP_STARTUP_AD_TIMESTAMP = "startup_ad_timestamp";
@ -469,14 +377,10 @@ public class Constants {
public static final String DOWNLOAD_STATUS_IN_CHINESE = "download_status_in_chinese";
public static final String EB_REALNAME_RESULT = "realname_result";
public static final String SP_REALNAME_ERROR_HINT_IGNORED = "realname_error_hint_ignored";
public static final String SP_SENSORS_IS_FIRST_TIME = "sensors_is_first_time";
public static final String SP_SENSORS_IS_FIRST_TIME_HOME_BOTTOM_TAB_SELECT = "sensors_is_first_time_home_bottom_tab_select";
public static final String SP_SENSORS_IS_FIRST_TIME_VIEW_FORUM = "sensors_is_first_time_view_forum";
public static final String SP_SENSORS_IS_FIRST_TIME_ARTICLE_LIKE_CLICK = "sensors_is_first_time_article_like_click";
@ -489,7 +393,6 @@ public class Constants {
public static final String SP_SENSORS_IS_FIRST_TIME_ARTICLE_SHARE = "sensors_is_first_time_article_share";
public static final String SP_HOME_PUSH_POP_UP_SET = "home_push_pop_up_map";
public static final String SP_PULL_DOWN_PUSH_POP_UP_SET = "pull_down_push_pop_up_set";
public static final String FINISH_PULL_DOWN_PUSH = "finish_pull_down_push";
public static final String APK_SIZE = "apk_size";

View File

@ -18,10 +18,7 @@ import android.text.Spanned
import android.view.Gravity
import android.view.LayoutInflater
import android.view.Window
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.content.res.AppCompatResources
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentActivity
import com.alibaba.android.arouter.launcher.ARouter
@ -51,41 +48,43 @@ object PermissionHelper {
*/
@SuppressLint("CheckResult")
fun requestGetInstalledAppsListPermission(
context: FragmentActivity,
ignoreResult: Boolean = false,
emptyCallback: EmptyCallback
activity: FragmentActivity,
resultCallback: (Boolean) -> Unit
) {
try {
val rxPermission = RxPermissions(context)
val rxPermission = RxPermissions(activity)
rxPermission
.requestEachCombined(PERMISSION_GET_INSTALLED_LIST)
.subscribe { permission ->
when {
permission.granted -> {
emptyCallback.onCallback()
resultCallback.invoke(true)
}
permission.shouldShowRequestPermissionRationale -> {
if (ignoreResult) {
emptyCallback.onCallback()
}
resultCallback.invoke(false)
}
else -> {
if (ignoreResult) {
emptyCallback.onCallback()
if (SPUtils.getBoolean(Constants.SP_USER_HAS_PERMANENTLY_DENIED_GET_INSTALL_LIST_PERMISSION)) {
showPermissionPermanentlyDeniedDialog(
activity = activity,
permissionName = "获取已安装应用列表权限"
) {
resultCallback.invoke(false)
}
} else {
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
intent.data = Uri.parse("package:" + context.packageName)
context.startActivity(intent)
SPUtils.setBoolean(
Constants.SP_USER_HAS_PERMANENTLY_DENIED_GET_INSTALL_LIST_PERMISSION,
true
)
resultCallback.invoke(false)
}
}
}
}
} catch (e: Exception) {
if (ignoreResult) {
emptyCallback.onCallback()
}
resultCallback.invoke(false)
}
}
@ -155,7 +154,10 @@ object PermissionHelper {
else -> {
if (SPUtils.getBoolean(Constants.SP_USER_HAS_PERMANENTLY_DENIED_STORAGE_PERMISSION)) {
showStoragePermissionPermanentlyDeniedDialog(activity = activity) {
showPermissionPermanentlyDeniedDialog(
activity = activity,
permissionName = "存储权限"
) {
resultCallback.invoke(false)
}
} else {
@ -168,11 +170,15 @@ object PermissionHelper {
}
}
private fun showStoragePermissionPermanentlyDeniedDialog(activity: Activity, callback: () -> Unit) {
private fun showPermissionPermanentlyDeniedDialog(
activity: Activity,
permissionName: String,
callback: () -> Unit
) {
DialogHelper.showDialog(
context = activity,
title = "权限申请",
content = "在设置-应用-光环助手-权限中开启存储权限,以保证能正常使用相关功能",
content = "在设置-应用-光环助手-权限中开启${permissionName},以保证能正常使用相关功能",
confirmText = "去设置",
cancelText = "放弃",
confirmClickCallback = {
@ -239,9 +245,59 @@ object PermissionHelper {
}
/**
* 展示获取存储权限提示弹窗并请求存储权限
* 展示获取已安装列表权限提示弹窗并请求权限
*/
private fun showStoragePermissionDialogAndRequestPermission(activity: FragmentActivity, emptyCallback: EmptyCallback) {
fun showGetInstalledAppsListPermissionDialogAndRequestPermission(
activity: FragmentActivity,
resultCallback: (Boolean) -> Unit
): Dialog? {
val solidContext = activity as? Activity ?: AppManager.getInstance().currentActivity() ?: return null
val dialog = Dialog(solidContext, R.style.GhAlertDialog)
val binding = DialogExternalStoragePermissionIntroBinding.inflate(LayoutInflater.from(solidContext))
val spannableBuilder = SpannableStringBuilder("当您使用APP时以下场景向您申请已安装列表权限\n")
val liStringList = arrayListOf("游戏更新提醒")
for (li in liStringList) {
val liSpanned = SpannableStringBuilder(li).apply {
setSpan(
ImprovedBulletSpan(bulletRadius = 1.5F.dip2px(), gapWidth = 14F.dip2px()),
0,
li.length,
Spanned.SPAN_INCLUSIVE_EXCLUSIVE
)
}
spannableBuilder.append(liSpanned)
}
binding.contentTv.text = spannableBuilder
binding.titleTv.text = "权限使用说明"
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
dialog.setContentView(binding.root)
dialog.window?.setDimAmount(0F)
dialog.window?.setGravity(Gravity.TOP)
dialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
requestGetInstalledAppsListPermission(activity) { granted ->
resultCallback.invoke(granted)
dialog.dismiss()
}
dialog.show()
return dialog
}
/**
* 展示获取提示弹窗并请求存储权限
*/
private fun showStoragePermissionDialogAndRequestPermission(
activity: FragmentActivity,
emptyCallback: EmptyCallback
) {
val solidContext = activity as? Activity ?: AppManager.getInstance().currentActivity() ?: return
val dialog = Dialog(solidContext, R.style.GhAlertDialog)
@ -336,18 +392,18 @@ object PermissionHelper {
@JvmStatic
fun checkGetInstalledAppsListBeforeAction(
context: Context,
emptyCallback: EmptyCallback
resultCallback: (Boolean) -> Unit
) {
if (context is AppCompatActivity && isGetInstalledListPermissionDisabled(context)) {
showDialogBeforeRequestingGetInstalledListDialog(context, emptyCallback)
showDialogBeforeRequestingGetInstalledListDialog(context, resultCallback)
} else {
emptyCallback.onCallback()
resultCallback.invoke(true)
}
}
private fun showDialogBeforeRequestingGetInstalledListDialog(
context: FragmentActivity,
emptyCallback: EmptyCallback
resultCallback: (Boolean) -> Unit
) {
DialogHelper.showDialog(
context,
@ -356,7 +412,7 @@ object PermissionHelper {
cancelText = "放弃",
confirmText = "去授权",
cancelClickCallback = null,
confirmClickCallback = { requestGetInstalledAppsListPermission(context, false, emptyCallback) },
confirmClickCallback = { requestGetInstalledAppsListPermission(context, resultCallback) },
extraConfig = DialogHelper.Config(hint = HINT_CHECK_USAGE),
uiModificationCallback = {
it.hintTv.setTextColor(ContextCompat.getColor(context, R.color.text_theme))

View File

@ -26,6 +26,7 @@ import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.alibaba.android.arouter.utils.PackageUtils;
import com.gh.gamecenter.common.R;
import com.gh.gamecenter.common.callback.BiCallback;
import com.gh.gamecenter.common.constant.EntranceConsts;
@ -264,17 +265,10 @@ public class ShareUtils {
//检查是否安装手机QQ
public static boolean isQQClientAvailable(Context context) {
IPackageUtilsProvider packageUtilsConfig = (IPackageUtilsProvider) ARouter.getInstance().build(RouteConsts.provider.packageUtils).navigation();
List<PackageInfo> pinfo = packageUtilsConfig.getInstalledPackages(context, 0);
if (pinfo != null) {
for (int i = 0; i < pinfo.size(); i++) {
String pn = pinfo.get(i).packageName;
if ("com.tencent.mobileqq".equals(pn) || "com.tencent.tim".equals(pn)) {
return true;
}
}
}
return false;
IPackageUtilsProvider packageUtilsImpl = (IPackageUtilsProvider) ARouter.getInstance().build(RouteConsts.provider.packageUtils).navigation();
return packageUtilsImpl.isInstalledWithLauncherIcon(context, "com.tencent.mobileqq")
|| packageUtilsImpl.isInstalledWithLauncherIcon(context, "com.tencent.tim");
}
// 邀请好友(专属链接)

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="999dp" />
<solid android:color="@color/primary_theme" />
</shape>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="999dp" />
<gradient
android:endColor="@color/primary_theme"
android:startColor="@color/button_gradient_blue_start" />
</shape>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="999dp" />
<gradient
android:endColor="@color/button_gradient_green_end"
android:startColor="@color/button_gradient_green_start" />
</shape>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="999dp" />
<gradient android:startColor="@color/button_gradient_yellow_start"
android:endColor="@color/button_gradient_yellow_end"/>
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="999dp" />
<solid android:color="@color/primary_theme_10" />
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="999dp" />
<solid android:color="@color/ui_container_2" />
</shape>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="999dp" />
<stroke android:color="@color/primary_theme"
android:width="1dp"/>
</shape>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="999dp" />
<stroke android:color="@color/button_stroke_gray"
android:width="1dp"/>
</shape>

View File

@ -364,4 +364,10 @@
<color name="text_666666_alpha_60">#99666666</color>
<color name="bg_21282E_alpha_40">#6621282E</color>
<color name="text_FFFFFF">@color/white</color>
<color name="button_stroke_gray">#0Affffff</color>
<color name="button_gradient_blue_start">#44AEEB</color>
<color name="button_gradient_green_start">#27C2A3</color>
<color name="button_gradient_green_end">#14A3A3</color>
<color name="button_gradient_yellow_start">#E5A82E</color>
<color name="button_gradient_yellow_end">#E58627</color>
</resources>

View File

@ -71,7 +71,7 @@
<string name="pic_max_hint">圖片不能大於%1$dMB請重新選擇</string>
<string name="title_suggest_game">請選出你要指定的遊戲</string>
<string name="copyright_title">版權保護申訴指引</string>
<string name="copyright_rules_url">https://resource.ghzs.com/page/copyright_guide/copyright_guide.html</string>
<string name="copyright_rules_url">https://and-static.ghzs66.com/page/copyright_guide/copyright_guide.html</string>
<string name="suggestion_game_name">遊戲名字<Data><![CDATA[<font color="#ff4147">*</font>]]></Data></string>
<string name="is_dark_mode_on_id">is_dark_mode_on_id</string>

View File

@ -411,5 +411,10 @@
<color name="bg_21282E_alpha_40">#6621282E</color>
<color name="text_FFFFFF">@color/white</color>
<color name="button_stroke_gray">#12000000</color>
<color name="button_gradient_blue_start">#4BC7FF</color>
<color name="button_gradient_green_start">#00DBB0</color>
<color name="button_gradient_green_end">#00B8B8</color>
<color name="button_gradient_yellow_start">#FFC247</color>
<color name="button_gradient_yellow_end">#FF9933</color>
</resources>

View File

@ -43,9 +43,9 @@
<string name="view_bounded_object">view绑定的对象</string>
<string name="disclaimer_title">用户协议与免责声明</string>
<string name="disclaimer_url">https://resource.ghzs.com/page/privacy_policies/User_agreement.html</string>
<string name="disclaimer_url">https://and-static.ghzs66.com/page/privacy_policies/User_agreement.html</string>
<string name="privacy_policy_title">隐私政策</string>
<string name="privacy_policy_url">https://resource.ghzs.com/page/privacy_policies/privacy_policies.html</string>
<string name="privacy_policy_url">https://and-static.ghzs66.com/page/privacy_policies/privacy_policies.html</string>
<string name="icp">备案查询入口</string>
<string name="icp_url">https://beian.miit.gov.cn/</string>
@ -72,7 +72,7 @@
<string name="pic_max_hint">图片不能大于%1$dMB请重新选择</string>
<string name="title_suggest_game">请选出你要指定的游戏</string>
<string name="copyright_title">版权保护申诉指引</string>
<string name="copyright_rules_url">https://resource.ghzs.com/page/copyright_guide/copyright_guide.html</string>
<string name="copyright_rules_url">https://and-static.ghzs66.com/page/copyright_guide/copyright_guide.html</string>
<string name="suggestion_game_name">游戏名字<Data><![CDATA[<font color="#ff4147">*</font>]]></Data></string>
<string name="is_dark_mode_on_id">is_dark_mode_on_id</string>

View File

@ -228,5 +228,67 @@
<item name="android:textStyle">bold</item>
</style>
<!-- 按钮1 -->
<style name="TextButton1">
<item name="android:textSize">16sp</item>
<item name="android:textStyle">normal</item>
</style>
<!-- 按钮2 -->
<style name="TextButton2">
<item name="android:textSize">14sp</item>
<item name="android:textStyle">normal</item>
</style>
<!-- 按钮3 -->
<style name="TextButton3">
<item name="android:textSize">12sp</item>
<item name="android:textStyle">normal</item>
</style>
<!-- 按钮样式 btn-mini -->
<style name="BtnMiniStyle">
<item name="android:gravity">center</item>
<item name="android:minWidth">48dp</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">24dp</item>
<item name="android:textSize">12sp</item>
<item name="android:paddingLeft">12dp</item>
<item name="android:paddingRight">12dp</item>
</style>
<!-- 按钮样式 btn-small -->
<style name="BtnSmallStyle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">28dp</item>
<item name="android:gravity">center</item>
<item name="android:minWidth">56dp</item>
<item name="android:textSize">12sp</item>
<item name="android:paddingLeft">12dp</item>
<item name="android:paddingRight">12dp</item>
</style>
<!-- 按钮样式3 btn-regular -->
<style name="BtnRegularStyle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">40dp</item>
<item name="android:gravity">center</item>
<item name="android:minWidth">60dp</item>
<item name="android:textSize">14sp</item>
<item name="android:paddingLeft">16dp</item>
<item name="android:paddingRight">16dp</item>
</style>
<!-- 按钮样式4 btn-large -->
<style name="BtnLargeStyle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">44dp</item>
<item name="android:gravity">center</item>
<item name="android:minWidth">66dp</item>
<item name="android:height">44dp</item>
<item name="android:textSize">16sp</item>
<item name="android:paddingLeft">16dp</item>
<item name="android:paddingRight">16dp</item>
</style>
</resources>

View File

@ -11,20 +11,6 @@ interface IDirectProvider : IProvider {
fun directToQqConversation(context: Context, qq: String)
fun directToCommodityDetail(context: Context, commodityId: String)
fun directToEnergyRecord(context: Context)
fun directToEnergyRulePage(context: Context)
fun directToInviteFriends(context: Context)
fun directToExchangeRulePage(context: Context)
fun directToExchangeCommodityPage(context: Context)
fun directToLotteryParadisePage(context: Context)
fun directDouyin(context: Context, userId: String)
fun directToSuggestionFromDiagnosis(context: Context, content: String, diagnosis: String)
@ -63,16 +49,6 @@ interface IDirectProvider : IProvider {
path: String? = ""
)
fun directToOrderCenter(context: Context)
fun directToOrderDetail(context: Context, orderId: String)
fun directToEnergyRecord(context: Context, position: Int)
fun directToMyPrizePage(context: Context)
fun directToWinOrderDetail(context: Context, orderId: String, activityId: String)
fun directToQGame(context: Context)
fun directToExternalBrowser(context: Context, url: String)

View File

@ -12,6 +12,8 @@ interface IPackageUtilsProvider : IProvider {
fun getGhVersionCode(): Int
fun isInstalledWithLauncherIcon(context: Context, packageName: String): Boolean
fun getInstalledPackages(context: Context, flag: Int): List<PackageInfo>
fun getApkSignatureByPackageName(context: Context, packageName: String): Array<String>

View File

@ -47,5 +47,16 @@ interface IPushProvider : IProvider {
*/
fun bindChannel(channel: String): Single<String>
/**
* 获取极光推送 Registration Id
* @param context 上下文
* @return 极光推送 Registration Id
*/
fun getRegistrationId(context: Context): String
/**
* 清除桌面角标
* @param applicationContext 上下文
*/
fun cleanBadgeNumber(applicationContext: Context)
}

View File

@ -54,5 +54,5 @@ dependencies {
implementation(project(path: ":module_common"))
implementation(project(path: ":module_core_feature"))
api project(":module_lib")
// api project(":module_lib")
}

View File

@ -20,16 +20,16 @@
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="com.gh.gamecenter.login.view.QuickLoginHelperActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.Fullscreen.Transparent" />
<!-- <activity-->
<!-- android:name="com.gh.gamecenter.login.view.QuickLoginHelperActivity"-->
<!-- android:screenOrientation="portrait"-->
<!-- android:theme="@style/Theme.AppCompat.Light.Fullscreen.Transparent" />-->
<activity
android:name="com.cmic.gen.sdk.view.GenLoginAuthActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
<!-- <activity-->
<!-- android:name="com.cmic.gen.sdk.view.GenLoginAuthActivity"-->
<!-- android:configChanges="orientation|keyboardHidden|screenSize"-->
<!-- android:launchMode="singleTop"-->
<!-- android:screenOrientation="portrait" />-->
<activity
android:name="${applicationId}.wxapi.WXEntryActivity"

View File

@ -2,29 +2,26 @@ package com.gh.gamecenter.login.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.cmic.gen.sdk.auth.GenAuthnHelper
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IQuickLoginProvider
import com.gh.gamecenter.login.utils.QuickLoginHelper
import org.json.JSONException
@Route(path = RouteConsts.provider.quickLogin, name = "一键登录暴露服务")
class QuickLoginProviderImpl : IQuickLoginProvider {
override fun startLogin(context: Context, entrance: String) {
QuickLoginHelper.startLogin(context, entrance)
// QuickLoginHelper.startLogin(context, entrance)
}
override fun isOpenMobileData(context: Context): Boolean {
val helper = GenAuthnHelper.getInstance(context)
val jsonObject = helper.getNetworkType(context)
val net: Int
try {
net = jsonObject.getString("networktype").toInt()
if (net == 1 || net == 3) return true
} catch (e: JSONException) {
e.printStackTrace()
}
// val helper = GenAuthnHelper.getInstance(context)
// val jsonObject = helper.getNetworkType(context)
// val net: Int
// try {
// net = jsonObject.getString("networktype").toInt()
// if (net == 1 || net == 3) return true
// } catch (e: JSONException) {
// e.printStackTrace()
// }
return false
}

View File

@ -49,7 +49,6 @@ import com.gh.gamecenter.login.retrofit.RetrofitManager;
import com.gh.gamecenter.login.utils.LoginHelper;
import com.gh.gamecenter.login.utils.LoginUtils;
import com.gh.gamecenter.login.utils.NewLogUtils;
import com.gh.gamecenter.login.utils.QuickLoginHelper;
import com.lightgame.utils.Utils;
import org.greenrobot.eventbus.EventBus;
@ -171,7 +170,7 @@ public class UserRepository {
dataUtils.getDeviceCertification();
// 退出登录后进行预取号
QuickLoginHelper.getPhoneInfo();
// QuickLoginHelper.getPhoneInfo();
}
public LiveData<ApiResponse<UserInfoEntity>> getLoginUserInfo() {

View File

@ -56,7 +56,6 @@ import com.gh.gamecenter.login.utils.DialogHelper;
import com.gh.gamecenter.login.utils.LoginHelper;
import com.gh.gamecenter.login.utils.LoginUtils;
import com.gh.gamecenter.login.utils.NewFlatLogUtils;
import com.gh.gamecenter.login.utils.QuickLoginHelper;
import org.greenrobot.eventbus.EventBus;
import org.jetbrains.annotations.NotNull;
@ -466,10 +465,10 @@ public class LoginFragment
if (getActivity() != null && UserManager.getInstance().isLoggedIn()) {
getActivity().finish();
// 如果是从一键登录页跳转过来的登录成功后也要finish一键登录页
if (mIsFromQuickLogin) {
QuickLoginHelper.finishAuthActivity();
}
// // 如果是从一键登录页跳转过来的登录成功后也要finish一键登录页
// if (mIsFromQuickLogin) {
// QuickLoginHelper.finishAuthActivity();
// }
}
}
}

View File

@ -1,142 +1,142 @@
package com.gh.gamecenter.login.view
import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.text.TextUtils
import androidx.activity.viewModels
import androidx.lifecycle.Observer
import com.alibaba.android.arouter.launcher.ARouter
import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.base.fragment.WaitingDialogFragment
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.retrofit.ApiResponse
import com.gh.gamecenter.core.provider.ILogUtilsProvider
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.login.HaloApp
import com.gh.gamecenter.login.R
import com.gh.gamecenter.login.entity.UserInfoEntity
import com.gh.gamecenter.login.user.LoginTag
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.login.user.UserViewModel
import com.gh.gamecenter.login.utils.LoginHelper
import com.gh.gamecenter.login.utils.NewFlatLogUtils
import com.gh.gamecenter.login.utils.QuickLoginHelper
import org.json.JSONObject
/**
* 快速登录辅助页,此页面为透明页面,用于执行各快速登录流程
*/
class QuickLoginHelperActivity : BaseActivity(), LoginHelper.LoginCallback, Observer<ApiResponse<UserInfoEntity>> {
private var mLoginTag: LoginTag? = null
private var mLoginDialog: WaitingDialogFragment? = null
private val mUserViewModel: UserViewModel by viewModels { UserViewModel.Factory(HaloApp.getInstance()) }
override fun getLayoutId() = 0
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mUserViewModel.loginObsUserinfo.observe(this, this)
handleLoginType()
}
private fun handleLoginType() {
mLoginTag = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
intent?.getSerializableExtra(EntranceConsts.KET_TYPE) as? LoginTag
} else {
intent?.getSerializableExtra(EntranceConsts.KET_TYPE, LoginTag::class.java)
}
when (mLoginTag ?: finish()) {
LoginTag.qq -> LoginHelper.loginWithQQ(this, this)
LoginTag.wechat -> LoginHelper.loginWithWechat(this)
LoginTag.weibo -> LoginHelper.loginWithWeibo(this, this)
LoginTag.oauth -> {
val token = intent.getStringExtra(EntranceConsts.KEY_DATA) ?: finish()
login(JSONObject(mapOf("token" to token)), LoginTag.oauth)
}
}
}
private fun login(content: JSONObject, loginTag: LoginTag) {
val logUtils = ARouter.getInstance().build(RouteConsts.provider.logUtils).navigation() as? ILogUtilsProvider
logUtils?.login("logging", loginTag.name, mEntrance)
if (loginTag != LoginTag.oauth) {
mLoginDialog = WaitingDialogFragment.newInstance(getString(R.string.logging))
mLoginDialog?.show(supportFragmentManager, null)
}
mUserViewModel.login(content, loginTag)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
when (requestCode) {
// QQ Login callback
com.tencent.connect.common.Constants.REQUEST_LOGIN -> LoginHelper.onQQLoginCallback(
requestCode,
resultCode,
data
)
// WeiBo Login callback
32973 -> LoginHelper.onWeiboLoginCallback(this, requestCode, resultCode, data)
}
}
override fun onLoginSuccess(loginType: LoginTag, jsonContent: JSONObject) {
login(jsonContent, loginType)
}
override fun onLoginFailure(loginType: LoginTag, error: String) {
toast(error)
finish()
}
override fun onChanged(response: ApiResponse<UserInfoEntity>?) {
if (response != null && mLoginDialog != null) {
mLoginDialog?.dismissAllowingStateLoss()
mLoginDialog = null
}
if (response?.data != null) {
val loginTokenEntity = UserManager.getInstance().loginTokenEntity
if (loginTokenEntity != null) {
val loginType = loginTokenEntity.loginType
val logUtils =
ARouter.getInstance().build(RouteConsts.provider.logUtils).navigation() as? ILogUtilsProvider
logUtils?.login("success", loginType, mEntrance)
if (loginType == LoginTag.oauth.name) {
SPUtils.setBoolean(Constants.SP_HAS_GET_PHONE_INFO, false)
NewFlatLogUtils.logFastLoginResult("成功")
}
// 第三方登录方式登录后跳转绑定手机页面https://gitlab.ghzs.com/pm/halo-app-issues/-/issues/1206
val isThirdPartyLogin =
LoginTag.qq.name == loginType || LoginTag.wechat.name == loginType || LoginTag.weibo.name == loginType || LoginTag.douyin.name == loginType
if (isThirdPartyLogin
&& TextUtils.isEmpty(response.data.loginMobile)
) {
ARouter.getInstance().build(RouteConsts.activity.bindPhoneActivity)
.withBoolean(EntranceConsts.KEY_FROM_LOGIN, true)
.withBoolean(EntranceConsts.KEY_CHANGE_PHONE, false)
.navigation()
}
}
// 防止UserManager数据丢失后重复登录
if (TextUtils.isEmpty(UserManager.getInstance().token)) {
mUserViewModel.retryCheckLogin()
}
finish()
if (UserManager.getInstance().isLoggedIn) {
QuickLoginHelper.finishAuthActivity()
}
} else if ((response?.httpException != null || response?.throwable != null) && mLoginTag == LoginTag.oauth) {
NewFlatLogUtils.logFastLoginResult("失败")
}
}
}
//package com.gh.gamecenter.login.view
//
//import android.content.Intent
//import android.os.Build
//import android.os.Bundle
//import android.text.TextUtils
//import androidx.activity.viewModels
//import androidx.lifecycle.Observer
//import com.alibaba.android.arouter.launcher.ARouter
//import com.gh.gamecenter.common.base.activity.BaseActivity
//import com.gh.gamecenter.common.base.fragment.WaitingDialogFragment
//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.retrofit.ApiResponse
//import com.gh.gamecenter.core.provider.ILogUtilsProvider
//import com.gh.gamecenter.core.utils.SPUtils
//import com.gh.gamecenter.login.HaloApp
//import com.gh.gamecenter.login.R
//import com.gh.gamecenter.login.entity.UserInfoEntity
//import com.gh.gamecenter.login.user.LoginTag
//import com.gh.gamecenter.login.user.UserManager
//import com.gh.gamecenter.login.user.UserViewModel
//import com.gh.gamecenter.login.utils.LoginHelper
//import com.gh.gamecenter.login.utils.NewFlatLogUtils
//import com.gh.gamecenter.login.utils.QuickLoginHelper
//import org.json.JSONObject
//
///**
// * 快速登录辅助页,此页面为透明页面,用于执行各快速登录流程
// */
//class QuickLoginHelperActivity : BaseActivity(), LoginHelper.LoginCallback, Observer<ApiResponse<UserInfoEntity>> {
//
// private var mLoginTag: LoginTag? = null
// private var mLoginDialog: WaitingDialogFragment? = null
// private val mUserViewModel: UserViewModel by viewModels { UserViewModel.Factory(HaloApp.getInstance()) }
//
// override fun getLayoutId() = 0
//
// override fun onCreate(savedInstanceState: Bundle?) {
// super.onCreate(savedInstanceState)
// mUserViewModel.loginObsUserinfo.observe(this, this)
// handleLoginType()
// }
//
// private fun handleLoginType() {
// mLoginTag = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
// intent?.getSerializableExtra(EntranceConsts.KET_TYPE) as? LoginTag
// } else {
// intent?.getSerializableExtra(EntranceConsts.KET_TYPE, LoginTag::class.java)
// }
// when (mLoginTag ?: finish()) {
// LoginTag.qq -> LoginHelper.loginWithQQ(this, this)
// LoginTag.wechat -> LoginHelper.loginWithWechat(this)
// LoginTag.weibo -> LoginHelper.loginWithWeibo(this, this)
// LoginTag.oauth -> {
// val token = intent.getStringExtra(EntranceConsts.KEY_DATA) ?: finish()
// login(JSONObject(mapOf("token" to token)), LoginTag.oauth)
// }
// }
// }
//
// private fun login(content: JSONObject, loginTag: LoginTag) {
// val logUtils = ARouter.getInstance().build(RouteConsts.provider.logUtils).navigation() as? ILogUtilsProvider
// logUtils?.login("logging", loginTag.name, mEntrance)
// if (loginTag != LoginTag.oauth) {
// mLoginDialog = WaitingDialogFragment.newInstance(getString(R.string.logging))
// mLoginDialog?.show(supportFragmentManager, null)
// }
// mUserViewModel.login(content, loginTag)
// }
//
// override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
// super.onActivityResult(requestCode, resultCode, data)
// when (requestCode) {
// // QQ Login callback
// com.tencent.connect.common.Constants.REQUEST_LOGIN -> LoginHelper.onQQLoginCallback(
// requestCode,
// resultCode,
// data
// )
// // WeiBo Login callback
// 32973 -> LoginHelper.onWeiboLoginCallback(this, requestCode, resultCode, data)
// }
// }
//
// override fun onLoginSuccess(loginType: LoginTag, jsonContent: JSONObject) {
// login(jsonContent, loginType)
// }
//
// override fun onLoginFailure(loginType: LoginTag, error: String) {
// toast(error)
// finish()
// }
//
// override fun onChanged(response: ApiResponse<UserInfoEntity>?) {
// if (response != null && mLoginDialog != null) {
// mLoginDialog?.dismissAllowingStateLoss()
// mLoginDialog = null
// }
//
// if (response?.data != null) {
// val loginTokenEntity = UserManager.getInstance().loginTokenEntity
// if (loginTokenEntity != null) {
//
// val loginType = loginTokenEntity.loginType
// val logUtils =
// ARouter.getInstance().build(RouteConsts.provider.logUtils).navigation() as? ILogUtilsProvider
// logUtils?.login("success", loginType, mEntrance)
//
// if (loginType == LoginTag.oauth.name) {
// SPUtils.setBoolean(Constants.SP_HAS_GET_PHONE_INFO, false)
// NewFlatLogUtils.logFastLoginResult("成功")
// }
//
// // 第三方登录方式登录后跳转绑定手机页面https://gitlab.ghzs.com/pm/halo-app-issues/-/issues/1206
// val isThirdPartyLogin =
// LoginTag.qq.name == loginType || LoginTag.wechat.name == loginType || LoginTag.weibo.name == loginType || LoginTag.douyin.name == loginType
// if (isThirdPartyLogin
// && TextUtils.isEmpty(response.data.loginMobile)
// ) {
// ARouter.getInstance().build(RouteConsts.activity.bindPhoneActivity)
// .withBoolean(EntranceConsts.KEY_FROM_LOGIN, true)
// .withBoolean(EntranceConsts.KEY_CHANGE_PHONE, false)
// .navigation()
// }
// }
//
// // 防止UserManager数据丢失后重复登录
// if (TextUtils.isEmpty(UserManager.getInstance().token)) {
// mUserViewModel.retryCheckLogin()
// }
//
// finish()
// if (UserManager.getInstance().isLoggedIn) {
// QuickLoginHelper.finishAuthActivity()
// }
// } else if ((response?.httpException != null || response?.throwable != null) && mLoginTag == LoginTag.oauth) {
// NewFlatLogUtils.logFastLoginResult("失败")
// }
// }
//}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 346 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 348 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

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