From d891af33a03dd488dd59c728503e3bb65f202f0c Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 18 四月 2023 19:53:08 +0800
Subject: [PATCH] 0312 测试

---
 SdkProject/plugins/quick/java/com/secondworld/sdk/QuickSdkMgr.java |   69 ++++++++++++++++++++--------------
 1 files changed, 40 insertions(+), 29 deletions(-)

diff --git a/SdkProject/plugins/quick/java/com/secondworld/sdk/QuickSdkMgr.java b/SdkProject/plugins/quick/java/com/secondworld/sdk/QuickSdkMgr.java
index 5b74e1f..4e92c13 100644
--- a/SdkProject/plugins/quick/java/com/secondworld/sdk/QuickSdkMgr.java
+++ b/SdkProject/plugins/quick/java/com/secondworld/sdk/QuickSdkMgr.java
@@ -76,8 +76,16 @@
 //        ActivityCompat.requestPermissions(activity, new String[]{
 //                        Manifest.permission.WRITE_EXTERNAL_STORAGE}, RequestCode.QUICK);
         try {
-            QuickSdkMgr.I.register(PlatformDiff.I.platformProductCode(), PlatformDiff.I.platformProductKey());
-            QuickSdkMgr.I.init(activity);
+            if (!hasPermissions(activity)) {
+                ActivityCompat.requestPermissions(activity, new String[]{
+                        Manifest.permission.WRITE_EXTERNAL_STORAGE}, RequestCode.QUICK);
+            }
+            else
+            {
+                QuickSdkMgr.I.register(PlatformDiff.I.platformProductCode(), PlatformDiff.I.platformProductKey());
+                QuickSdkMgr.I.init(activity);
+            }
+
         }
         catch (Exception e) {
             LogUtil.i("SdkManager", "requestPermissions 鍒濆鍖朣DK澶辫触");
@@ -86,33 +94,36 @@
 
     public void onRequestPermissionsResult(Activity activity, int requestCode, int[] grantResults) {
         if (requestCode != RequestCode.QUICK) return;
-//        if (hasPermissions(activity)) {
-//            //鐢宠鎴愬姛
-//            QuickSdkMgr.I.register(PlatformDiff.I.platformProductCode(), PlatformDiff.I.platformProductKey());
-//            QuickSdkMgr.I.init(activity);
-//            return;
-//        }
-//        final AlertDialog.Builder normalDialog = new AlertDialog.Builder(activity);
-//        normalDialog.setTitle("鏉冮檺璁剧疆");
-//        normalDialog.setMessage("娓告垙闇�瑕侀儴鍒嗘潈闄愭墠鑳芥甯歌繍琛岋紝璇峰墠寰�璁剧疆涓墦寮�鐢佃瘽鏉冮檺涓庡瓨鍌ㄦ潈闄�");
-//        normalDialog.setPositiveButton("鍓嶅線璁剧疆", new DialogInterface.OnClickListener() {
-//            @Override
-//            public void onClick(DialogInterface dialog, int which) {
-//                Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
-//                Uri uri = Uri.fromParts("package", activity.getPackageName(), null);
-//                intent.setData(uri);
-//                activity.startActivityForResult(intent, REQUEST_RECORD_PERMISSION_SETTING);
-//                dialog.dismiss();
-//            }
-//        });
-//        normalDialog.setNegativeButton("閫�鍑�", new DialogInterface.OnClickListener() {
-//            @Override
-//            public void onClick(DialogInterface dialog, int which) {
-//                GameAppProxy.appExit();
-//            }
-//        });
-//        // 鏄剧ず
-//        normalDialog.show();
+
+        //1768娓犻亾涓�瀹氶渶瑕佹潈闄�
+        if (hasPermissions(activity)) {
+            LogUtil.i("SdkManager", "onRequestPermissionsResult 鐢宠鎴愬姛");
+            //鐢宠鎴愬姛
+            QuickSdkMgr.I.register(PlatformDiff.I.platformProductCode(), PlatformDiff.I.platformProductKey());
+            QuickSdkMgr.I.init(activity);
+            return;
+        }
+        final AlertDialog.Builder normalDialog = new AlertDialog.Builder(activity);
+        normalDialog.setTitle("鏉冮檺璁剧疆");
+        normalDialog.setMessage("娓告垙闇�瑕侀儴鍒嗘潈闄愭墠鑳芥甯歌繍琛岋紝璇峰墠寰�璁剧疆涓墦寮�瀛樺偍鏉冮檺");
+        normalDialog.setPositiveButton("鍓嶅線璁剧疆", new DialogInterface.OnClickListener() {
+            @Override
+            public void onClick(DialogInterface dialog, int which) {
+                Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
+                Uri uri = Uri.fromParts("package", activity.getPackageName(), null);
+                intent.setData(uri);
+                activity.startActivityForResult(intent, REQUEST_RECORD_PERMISSION_SETTING);
+                dialog.dismiss();
+            }
+        });
+        normalDialog.setNegativeButton("閫�鍑�", new DialogInterface.OnClickListener() {
+            @Override
+            public void onClick(DialogInterface dialog, int which) {
+                GameAppProxy.appExit();
+            }
+        });
+        // 鏄剧ず
+        normalDialog.show();
     }
 
     public void onActivityResult(Activity activity, int requestCode) {

--
Gitblit v1.8.0