Compare commits

...

6 Commits

Author SHA1 Message Date
6b0611e05f chore: 版本更新至 5.13.7 2022-11-14 15:29:23 +08:00
384469bcae Merge branch 'feature-GHZS-209' into 'legacy-release'
feat: 还原首次启动时的权限提示弹窗和权限获取 https://jira.shanqu.cc/browse/GHZS-209

See merge request halo/android/assistant-android!431
2022-11-14 15:22:06 +08:00
0aeb37a5eb feat: 还原首次启动时的权限提示弹窗和权限获取 https://jira.shanqu.cc/browse/GHZS-209 2022-11-14 14:27:10 +08:00
900ee8e641 chore:版本更新至 5.13.6 2022-11-10 15:14:16 +08:00
bad1e32fda Merge branch 'feature-GHZS-163' into 'legacy-release'
feat:【光环助手】存储权限授权弹窗埋点补充 https://jira.shanqu.cc/browse/GHZS-163

See merge request halo/android/assistant-android!426
2022-11-10 15:11:40 +08:00
b602960882 feat:【光环助手】存储权限授权弹窗埋点补充 https://jira.shanqu.cc/browse/GHZS-163 2022-11-10 15:05:05 +08:00
5 changed files with 111 additions and 42 deletions

View File

@ -1,5 +1,6 @@
package com.gh.gamecenter
import android.Manifest
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
@ -24,6 +25,7 @@ import com.gh.common.util.GameSubstituteRepositoryHelper.updateGameSubstituteRep
import com.gh.common.util.UsageStatsHelper.checkAndPostUsageStats
import com.gh.download.DownloadManager
import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.callback.SimpleCallback
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.tracker.TrackerLogger
@ -62,6 +64,8 @@ class SplashScreenActivity : BaseActivity() {
private var mViewModel: SplashScreenViewModel? = null
private val mPermissions = arrayOf(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE,
PermissionHelper.PERMISSION_GET_INSTALLED_LIST
)
@ -151,39 +155,38 @@ class SplashScreenActivity : BaseActivity() {
private fun showPrivacyDialog(guideLayout: ViewPager) {
NewPrivacyPolicyDialogFragment.show(this, null) { isSuccess: Boolean ->
if (isSuccess) {
guideLayout.visibility = View.VISIBLE
SPUtils.setBoolean(Constants.SP_BRAND_NEW_USER, false)
// guideLayout.visibility = View.VISIBLE
// SPUtils.setBoolean(Constants.SP_BRAND_NEW_USER, false)
//
// // 恢复畅玩数据
// VHelper.recoverVDataIfPossible()
//
// requestPermission()
//
// // 检查是否有旧版本光环,有就删掉
// AppExecutor.ioExecutor.execute { deleteOutdatedUpdatePackage() }
// if (mStartMainActivityDirectly) {
// launchMainActivity()
// }
// 恢复畅玩数据
VHelper.recoverVDataIfPossible()
requestPermission()
// 检查是否有旧版本光环,有就删掉
AppExecutor.ioExecutor.execute { deleteOutdatedUpdatePackage() }
if (mStartMainActivityDirectly) {
launchMainActivity()
val callback = object : SimpleCallback<Boolean> {
override fun onCallback(arg: Boolean) {
// Dialog dismiss 后的回调
guideLayout.visibility = View.VISIBLE
SPUtils.setBoolean(Constants.SP_BRAND_NEW_USER, false)
if (arg) {
requestPermission()
} else {
mStartMainActivityDirectly = false
}
}
}
// val callback = object : SimpleCallback<Boolean> {
// override fun onCallback(arg: Boolean) {
// // Dialog dismiss 后的回调
// guideLayout.visibility = View.VISIBLE
// SPUtils.setBoolean(Constants.SP_BRAND_NEW_USER, false)
// if (arg) {
// requestPermission()
// } else {
// mStartMainActivityDirectly = false
// }
// }
// }
//
// mViewModel?.showPrivacyPolicy({
// DialogUtils.showPrivacyPolicyDialog(this@SplashScreenActivity, it, callback)
// }, {
// DialogUtils.showPrivacyPolicyDialog(this@SplashScreenActivity, PrivacyPolicyEntity.createDefaultData(), callback)
// })
mViewModel?.showPrivacyPolicy({
DialogUtils.showPrivacyPolicyDialog(this@SplashScreenActivity, it, callback)
}, {
DialogUtils.showPrivacyPolicyDialog(this@SplashScreenActivity, PrivacyPolicyEntity.createDefaultData(), callback)
})
} else {
DialogUtils.showPrivacyPolicyDisallowDialog(this, PrivacyPolicyEntity.createDefaultData(), object : EmptyCallback {
override fun onCallback() {
@ -378,10 +381,10 @@ class SplashScreenActivity : BaseActivity() {
private fun checkAndRequestPermission() {
if (EasyPermissions.hasPermissions(this, *mPermissions)) {
// 恢复畅玩数据
// VHelper.recoverVDataIfPossible()
VHelper.recoverVDataIfPossible()
// 检查是否有旧版本光环,有就删掉
// AppExecutor.ioExecutor.execute { deleteOutdatedUpdatePackage() }
AppExecutor.ioExecutor.execute { deleteOutdatedUpdatePackage() }
if (mStartMainActivityDirectly) {
if (com.gh.gamecenter.common.BuildConfig.BUILD_TIME != 0L) {
showGitLogDialogIfNeeded()

View File

@ -23,10 +23,10 @@ data class PrivacyPolicyEntity(
icon = "res:///" + R.drawable.permission_storage,
name = "存储权限",
intro = "用于下载游戏,以及实现内容缓存提升浏览体验"))
permissions.add(PermissionsEntity(
icon = "res:///" + R.drawable.permission_phone_state,
name = "设备信息",
intro = "为保障您的账号安全及使用软件与服务可安全运行"))
// permissions.add(PermissionsEntity(
// icon = "res:///" + R.drawable.permission_phone_state,
// name = "设备信息",
// intro = "为保障您的账号安全及使用软件与服务可安全运行"))
// permissions.add(PermissionsEntity(
// icon = "res:///" + R.drawable.permission_sdk,
// name = "第三方SDK使用信息提醒",

View File

@ -7,8 +7,8 @@ ext {
targetSdkVersion = 28
// application info (每个大版本之间的 versionCode 增加 20)
versionCode = 615
versionName = "5.13.5"
versionCode = 617
versionName = "5.13.7"
applicationId = "com.gh.gamecenter"
// AndroidX

View File

@ -0,0 +1,49 @@
package com.gh.gamecenter.common.utils
import com.gh.gamecenter.common.json.JsonObjectBuilder
import com.gh.gamecenter.common.json.json
import com.gh.gamecenter.common.loghub.LoghubUtils
import com.lightgame.utils.Utils
import org.json.JSONObject
object NewFlagLogUtils {
private fun log(jsonObject: JSONObject, logStore: String, uploadImmediately: Boolean) {
Utils.log("NewFlatLogUtils", jsonObject.toString(4))
LoghubUtils.log(jsonObject, logStore, uploadImmediately, true)
}
private fun parseAndPutMeta(): JsonObjectBuilder.() -> Unit = {
val meta = LogUtils.getMetaObject()
val metaKeys = meta.keys()
while (metaKeys.hasNext()) {
val key: String = metaKeys.next().toString()
val value = meta.getString(key)
key to value
}
}
/**
* 记录外部存储权限提示弹窗出现
*/
fun logExternalStoragePermissionDialogAppearance() {
val json = json {
"event" to "storage_permission_pop_show"
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
/**
* 记录外部存储权限弹窗行为
*/
fun logExternalStoragePermissionDialogAction(action: String) {
val json = json {
"event" to "storage_permission_pop_click"
"button" to action
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
}

View File

@ -244,24 +244,41 @@ object PermissionHelper {
}
private fun showDialogBeforeRequestingStorageDialog(context: FragmentActivity, emptyCallback: EmptyCallback) {
// 是否点击外部区域触发弹窗消失
var isCanceledByClickingOutside = true
NewFlagLogUtils.logExternalStoragePermissionDialogAppearance()
DialogHelper.showDialog(
context,
title = "权限申请",
content = "光环助手将向您申请开启设备的存储权限,以保证能正常使用相关功能。拒绝授权将无法正常使用部分功能。",
cancelText = "放弃",
confirmText = "去授权",
cancelClickCallback = null,
confirmClickCallback = { checkStoragePermissionBeforeAction(context, emptyCallback) },
cancelClickCallback = {
isCanceledByClickingOutside = false
NewFlagLogUtils.logExternalStoragePermissionDialogAction("放弃")
},
confirmClickCallback = {
isCanceledByClickingOutside = false
checkStoragePermissionBeforeAction(context, emptyCallback)
NewFlagLogUtils.logExternalStoragePermissionDialogAction("去授权")
},
extraConfig = DialogHelper.Config(hint = "查看权限应用场景"),
uiModificationCallback = {
it.hintTv.setTextColor(ContextCompat.getColor(context, R.color.theme_font))
it.hintTv.setOnClickListener {
val provider = ARouter.getInstance().build(RouteConsts.provider.directUtils).navigation() as? IDirectProvider
val provider =
ARouter.getInstance().build(RouteConsts.provider.directUtils).navigation() as? IDirectProvider
provider?.directToWebView(context, Constants.PERMISSION_SCENARIO_ADDRESS, "(权限弹窗)")
NewFlagLogUtils.logExternalStoragePermissionDialogAction("查看权限应用场景")
}
it.contentTv.setTextColor(ContextCompat.getColor(context, R.color.text_title))
}
)
)?.setOnDismissListener {
if (isCanceledByClickingOutside) {
NewFlagLogUtils.logExternalStoragePermissionDialogAction("点击弹窗以外空白区域")
}
}
}
private fun showDialogBeforeRequestingGetInstalledListDialog(context: FragmentActivity, emptyCallback: EmptyCallback) {