Explorar o código

1.图片上传权限没开 弹框跳转设置页面设置

huangxiaodong hai 1 ano
pai
achega
b40e3d3f64

+ 4 - 4
创维盒子/双子星云手机/AppDelegate/PrefixHeader.pch

@@ -108,16 +108,16 @@ isBangsScreen; \
 //#define shareService   @"http://testprivacy.phone.armclouding.com:1801/h5/#/pages/fileSharing/index?productType=Private-X&token="
 
 //创维盒子 测试地址 正在使用
-//#define CloudService   @"http://testprivacy.phone.androidscloud.com:1801"
-//#define shareService   @"http://testprivacy.phone.androidscloud.com:1801/h5/#/pages/fileSharing/index?productType=Private-X&token="
+#define CloudService   @"http://testprivacy.phone.androidscloud.com:1801"
+#define shareService   @"http://testprivacy.phone.androidscloud.com:1801/h5/#/pages/fileSharing/index?productType=Private-X&token="
 
 //预生产环境
 //#define CloudService   @"http://testprivacy.phone.androidscloud.com:10900"
 //#define shareService   @"http://testprivacy.phone.androidscloud.com:10900/h5/#/pages/fileSharing/index?productType=Private-X&token="
 
 //生产环境
-#define CloudService   @"http://hiboxde.armclouding.com:7780"
-#define shareService   @"http://hiboxde.armclouding.com:7780/h5/#/pages/fileSharing/index?productType=Private-X&token="
+//#define CloudService   @"http://hiboxde.armclouding.com:7780"
+//#define shareService   @"http://hiboxde.armclouding.com:7780/h5/#/pages/fileSharing/index?productType=Private-X&token="
 
 #define AESCODEKEEYY @"fvO8gAfNSr1tbdQe"
 

+ 33 - 26
创维盒子/双子星云手机/Class/Set/uploadFile/uploadImageOrVideoViewController.m

@@ -17,6 +17,7 @@
 #import "uploadFileRecordViewController.h"
 #import "couldPhoneBaseInfoModel.h"
 #import "fileTransferPathCheckViewController.h"
+#import "ComontAlretViewController.h"
 
 @interface uploadImageOrVideoViewController ()<AJPhotoGroupViewProtocol,UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
 {
@@ -228,16 +229,20 @@
     
     //相册权限
     if (![[TZImageManager manager] authorizationStatusAuthorized]){
+        KWeakSelf
         [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
             if(status == PHAuthorizationStatusAuthorized){
                 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-                    [self.photoGroupView setupGroup];
-                    [self delayedSetPhotoGroupViewFrameFun];
+                    [weakSelf.photoGroupView setupGroup];
+                    [weakSelf delayedSetPhotoGroupViewFrameFun];
                 });
             }
           else if (status == PHAuthorizationStatusDenied || status == PHAuthorizationStatusRestricted) {
-              // 用户拒绝授权或设备受限,提示用户去系统设置中开启权限
-              [self requestPhotoLibraryAccessWithAlert];
+                  mainBlock(^{
+                      // 用户拒绝授权或设备受限,提示用户去系统设置中开启权限
+                      [weakSelf requestPhotoLibraryAccessWithAlert];
+                  });
+              
            }
         }];
     }
@@ -770,28 +775,30 @@
 
 #pragma mark 用户拒接授权相册
 - (void)requestPhotoLibraryAccessWithAlert {
-    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"相册访问被拒绝"
-                                                                   message:@"为了正常使用应用功能,请允许访问您的相册。"
-                                                            preferredStyle:UIAlertControllerStyleAlert];
-      
-    UIAlertAction *settingsAction = [UIAlertAction actionWithTitle:@"去设置"
-                                                            style:UIAlertActionStyleDefault
-                                                          handler:^(UIAlertAction *action) {
-                                                              // 打开应用的设置页面
-                                                              NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
-                                                              if ([[UIApplication sharedApplication] canOpenURL:url]) {
-                                                                  [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
-                                                              }
-                                                          }];
-      
-    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消"
-                                                           style:UIAlertActionStyleCancel
-                                                         handler:nil];
-      
-    [alert addAction:settingsAction];
-    [alert addAction:cancelAction];
-      
-    [self presentViewController:alert animated:YES completion:nil];
+    
+    KWeakSelf
+    /*弹窗提示重启*/
+    ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"enable_photo_permission",nil)
+                                                                                     msg:NSLocalizedString(@"enable_photo_permission_tip",nil)
+                                                                                imageStr:@""
+                                                                             cancelTitle:NSLocalizedString(@"other_cancel",nil)
+                                                                                 okTitle:NSLocalizedString(@"more_set",nil) isOkBtnHighlight:YES
+                                                                              didClickOk:^{
+        // 打开应用的设置页面
+        NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
+        if ([[UIApplication sharedApplication] canOpenURL:url]) {
+            [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
+        }
+        
+    } didClickCancel:^{
+        
+    }];
+    nextVC.modalPresentationStyle = UIModalPresentationCustom;
+
+    [self presentViewController:nextVC animated:YES completion:^{
+        nextVC.view.superview.backgroundColor = [UIColor clearColor];
+    }];
+    
 }
 
 @end