|
|
@@ -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
|