From 51eb814a4245424a5b5691e861e57923a769cc4d Mon Sep 17 00:00:00 2001 From: chenjuntao Date: Fri, 16 Jun 2023 18:04:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=8D=B8=E8=BD=BD=E9=87=8D=E8=A3=85=E5=90=8E?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=81=A2=E5=A4=8D=E7=95=85=E7=8E=A9=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E6=95=B0=E6=8D=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/gh/gamecenter/SplashScreenActivity.kt | 41 ++++++++----------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.kt b/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.kt index bb041fc139..ff9a422113 100644 --- a/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.kt +++ b/app/src/main/java/com/gh/gamecenter/SplashScreenActivity.kt @@ -51,6 +51,7 @@ import java.io.IOException import java.io.InputStreamReader import java.text.SimpleDateFormat import java.util.* +import kotlin.collections.ArrayList /** * 引导页面 @@ -182,20 +183,6 @@ class SplashScreenActivity : BaseActivity() { private fun showPrivacyDialog(guideLayout: ViewPager) { NewPrivacyPolicyDialogFragment.show(this, null) { isSuccess: Boolean -> if (isSuccess) { -// guideLayout.visibility = View.VISIBLE -// SPUtils.setBoolean(Constants.SP_BRAND_NEW_USER, false) -// -// // 恢复畅玩数据 -// VHelper.recoverVDataIfPossible() -// -// requestPermission() -// -// // 检查是否有旧版本光环,有就删掉 -// AppExecutor.ioExecutor.execute { deleteOutdatedUpdatePackage() } -// if (mStartMainActivityDirectly) { -// launchMainActivity() -// } - mShouldPrefetchData = false prefetchData() @@ -220,12 +207,10 @@ class SplashScreenActivity : BaseActivity() { } else { DialogUtils.showPrivacyPolicyDisallowDialog( this, - PrivacyPolicyEntity.createDefaultData(), - object : EmptyCallback { - override fun onCallback() { - showPrivacyDialog(guideLayout) - } - }) + PrivacyPolicyEntity.createDefaultData() + ) { + showPrivacyDialog(guideLayout) + } } } } @@ -434,11 +419,8 @@ class SplashScreenActivity : BaseActivity() { @AfterPermissionGranted(REQUEST_PERMISSION_TAG) private fun checkAndRequestPermission() { if (EasyPermissions.hasPermissions(this, *mPermissions)) { - // 恢复畅玩数据 - VHelper.recoverVDataIfPossible() + onPermissionsGranted(REQUEST_PERMISSION_TAG, ArrayList(mPermissions.toList())) - // 检查是否有旧版本光环,有就删掉 - runOnIoThread { deleteOutdatedUpdatePackage() } if (mStartMainActivityDirectly) { if (com.gh.gamecenter.common.BuildConfig.BUILD_TIME != 0L) { showGitLogDialogIfNeeded() @@ -461,6 +443,17 @@ class SplashScreenActivity : BaseActivity() { } } + override fun onPermissionsGranted(requestCode: Int, perms: MutableList?) { + super.onPermissionsGranted(requestCode, perms) + + if (perms?.contains(Manifest.permission.READ_EXTERNAL_STORAGE) == true) { + // 恢复畅玩数据 + VHelper.recoverVDataIfPossible() + // 检查是否有旧版本光环,有就删掉 + runOnIoThread { deleteOutdatedUpdatePackage() } + } + } + // 检查下载文件夹下是否有旧版本的光环助手的包,有则删除 private fun deleteOutdatedUpdatePackage() { try {