Skip to content

Commit 5b68bfd

Browse files
author
ccharlesren
committed
合规整改:修改账号密码登录页面,获取验证码和微信登录需要同意隐私条款限制,补充相册权限开关
Change-Id: Ib5beb03e7cfa7e742f3a0773e693456633b75804
1 parent bf92393 commit 5b68bfd

File tree

4 files changed

+100
-4
lines changed

4 files changed

+100
-4
lines changed

Source/LinkApp/Classes/Module/Login/Controller/TIoTVCLoginAccountVC.m

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,8 +886,7 @@ - (void)loginStyleChange:(UIButton *)sender {
886886

887887
- (void)loginSure {
888888

889-
if (!self.procolBtn.selected) {
890-
[MBProgressHUD showError:NSLocalizedString(@"agree_userAgreement_privacyPolicy", @"请同意用户协议和隐私协议后才能登录")];
889+
if (![self agreementToast]) {
891890
return;
892891
}
893892

@@ -1032,9 +1031,21 @@ - (void)changePasswordTextShow:(UIButton *)button {
10321031

10331032
}
10341033

1034+
- (BOOL)agreementToast {
1035+
if (!self.procolBtn.selected) {
1036+
[MBProgressHUD showError:NSLocalizedString(@"agree_userAgreement_privacyPolicy", @"请同意用户协议和隐私协议后才能登录")];
1037+
return NO;
1038+
}else {
1039+
return YES;
1040+
}
1041+
}
10351042

10361043
#pragma mark - 发送验证码
10371044
- (void)sendCode:(UIButton *)button {
1045+
1046+
if (![self agreementToast]) {
1047+
return;
1048+
}
10381049

10391050
[MBProgressHUD showLodingNoneEnabledInView:nil withMessage:@""];
10401051

@@ -1114,6 +1125,11 @@ - (void)judgeCancelAccountTip {
11141125
}
11151126

11161127
- (void)wxLoginClick:(id)sender{
1128+
1129+
if (![self agreementToast]) {
1130+
return;
1131+
}
1132+
11171133
[[WxManager sharedWxManager] authFromWxComplete:^(id obj, NSError *error) {
11181134
if (!error) {
11191135
[self getTokenByOpenId:[NSString stringWithFormat:@"%@",obj]];

Source/LinkApp/Classes/Module/Mine/Controller/TIoTAuthentationVC.m

Lines changed: 80 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#import <CoreLocation/CoreLocation.h>
1010
#import <AVFoundation/AVFoundation.h>
1111
#import "TIoTCoreUtil.h"
12+
#import <Photos/Photos.h>
1213

1314
@interface TIoTAuthentationVC ()<UITableViewDelegate, UITableViewDataSource, CBCentralManagerDelegate,CLLocationManagerDelegate>
1415
@property (nonatomic, strong) UITableView *tableView;
@@ -19,6 +20,7 @@ @interface TIoTAuthentationVC ()<UITableViewDelegate, UITableViewDataSource, CBC
1920

2021
@property (nonatomic, strong) CLLocationManager *locationManager;
2122
@property (nonatomic, assign) BOOL locationAvailable; //地图是否可用
23+
@property (strong, nonatomic) UIImagePickerController *picker;
2224
@end
2325

2426
@implementation TIoTAuthentationVC
@@ -101,8 +103,10 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
101103
}else if (indexPath.section == 2) {
102104
cell.arrowSwitch.on = [self audioAuthority:AVMediaTypeVideo];
103105
}else if (indexPath.section == 3) {
104-
cell.arrowSwitch.on = [self audioAuthority:AVMediaTypeAudio];
106+
cell.arrowSwitch.on = [self authoriedPhotoAlbum];
105107
}else if (indexPath.section == 4) {
108+
cell.arrowSwitch.on = [self audioAuthority:AVMediaTypeAudio];
109+
}else if (indexPath.section == 5) {
106110
cell.arrowSwitch.on = self.bluetoothAvailable;
107111
}
108112

@@ -140,6 +144,39 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
140144
[self jumpSetting];
141145
}
142146
}else if (indexPath.section == 3) {
147+
if ([self getPhoteNotDetermStatus]) {
148+
BOOL isAuth = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary];
149+
if (!isAuth) return;
150+
[PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) { //弹出访问权限提示框
151+
if (status == PHAuthorizationStatusAuthorized) {
152+
dispatch_async(dispatch_get_main_queue(),^{
153+
//同意授权
154+
switchControl.on = YES;
155+
156+
});
157+
}if (status == PHAuthorizationStatusRestricted || status == PHAuthorizationStatusNotDetermined) {
158+
//未授权
159+
switchControl.on = NO;
160+
}if (status == PHAuthorizationStatusDenied) {
161+
dispatch_async(dispatch_get_main_queue(),^{
162+
//拒绝授权
163+
switchControl.on = NO;
164+
});
165+
}else {
166+
if (@available(iOS 14, *)) {
167+
if (status == PHAuthorizationStatusLimited) {
168+
dispatch_async(dispatch_get_main_queue(),^{
169+
//权限只在 accessLevel 为 PHAccessLevelReadWrite 时生效
170+
switchControl.on = YES;
171+
});
172+
}
173+
}
174+
}
175+
}];
176+
}else {
177+
[self jumpSetting];
178+
}
179+
}else if (indexPath.section == 4) {
143180
if ([self getMediaNotDetermStatusWithType:AVMediaTypeAudio]) {
144181
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeAudio
145182
completionHandler:^(BOOL granted) {
@@ -156,7 +193,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
156193
}else {
157194
[self jumpSetting];
158195
}
159-
}else if (indexPath.section == 4) {
196+
}else {
160197
if (self.centralManager.state == CBManagerStateUnauthorized) {
161198
//判断蓝牙是否开启
162199
self.centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil options:nil];
@@ -210,6 +247,7 @@ - (NSMutableArray *)dataArr{
210247
@[@{@"title":NSLocalizedString(@"authentation_privacy_conte1", @"通知推送权限"),@"value":@"",@"vc":@"",@"haveArrow":@"2"}],
211248
@[@{@"title":NSLocalizedString(@"authentation_privacy_conte2", @"位置信息"),@"value":@"",@"vc":@"",@"haveArrow":@"2"}],
212249
@[@{@"title":NSLocalizedString(@"authentation_privacy_conte3", @"摄像头权限"),@"value":@"",@"vc":@"",@"haveArrow":@"2"}],
250+
@[@{@"title":NSLocalizedString(@"authentation_privacy_conte6", @"相册权限"),@"value":@"",@"vc":@"",@"haveArrow":@"2"}],
213251
@[@{@"title":NSLocalizedString(@"authentation_privacy_conte5", @"麦克风权限"),@"value":@"",@"vc":@"",@"haveArrow":@"2"}],
214252
@[@{@"title":NSLocalizedString(@"authentation_privacy_conte4", @"蓝牙权限"),@"value":@"",@"vc":@"",@"haveArrow":@"2"}],
215253
]];
@@ -228,6 +266,15 @@ - (BOOL)getMediaNotDetermStatusWithType:(AVMediaType)mediaType {
228266
}
229267
}
230268

269+
- (BOOL)getPhoteNotDetermStatus {
270+
PHAuthorizationStatus status= [PHPhotoLibrary authorizationStatus];
271+
if (status == PHAuthorizationStatusNotDetermined) {
272+
return YES;
273+
}else {
274+
return NO;
275+
}
276+
}
277+
231278
- (void)jumpSetting {
232279
NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
233280
if ([[UIApplication sharedApplication] canOpenURL:url]){
@@ -297,6 +344,27 @@ - (BOOL)locationAuthority {
297344
return YES;
298345
}
299346

347+
- (BOOL)authoriedPhotoAlbum {
348+
BOOL isAccess = NO;
349+
PHAuthorizationStatus status= [PHPhotoLibrary authorizationStatus];
350+
if (status == PHAuthorizationStatusNotDetermined) {
351+
isAccess = NO;
352+
}else if (status == PHAuthorizationStatusRestricted || status == PHAuthorizationStatusDenied) {
353+
isAccess = NO;
354+
}else if (status == PHAuthorizationStatusAuthorized) {
355+
isAccess = YES;
356+
}else {
357+
if (@available(iOS 14, *)) {
358+
if (status == PHAuthorizationStatusLimited) {
359+
isAccess = YES;
360+
}
361+
}else {
362+
isAccess = NO;
363+
}
364+
}
365+
return isAccess;
366+
}
367+
300368
- (BOOL)audioAuthority:(AVMediaType)type {
301369
// return [TIoTCoreUtil requestMediaAuthorization:type];
302370
return [TIoTCoreUtil userAccessMediaAuthorization:type];
@@ -368,4 +436,14 @@ - (void)locationManagerDidChangeAuthorization:(CLLocationManager *)manager API_A
368436
}
369437
[self.tableView reloadData];
370438
}
439+
440+
#pragma mark - lazyloading
441+
- (UIImagePickerController *)picker
442+
{
443+
if (!_picker) {
444+
_picker = [[UIImagePickerController alloc]init];
445+
_picker.allowsEditing = NO;
446+
}
447+
return _picker;
448+
}
371449
@end

Source/LinkApp/Supporting Files/Resource/en.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,7 @@ If the problem still persists, we recommend you remove the device and add it aga
947947
"authentation_privacy_conte3" = "Camera";
948948
"authentation_privacy_conte4" = "Bluetooth";
949949
"authentation_privacy_conte5" = "Microphone";
950+
"authentation_privacy_conte6" = "Photoalbum";
950951
"authentation_alert_btn" = "Allow";
951952
"authentation_alert_wifi_title" = "Please authorize Tencent LLink the following permissions";
952953
"authentation_alert_wifi_conte" = "This step will configure the WiFi network for the hardware device to achieve communication, and bind the relationship between the hardware device and the APP user. Therefore, Tencent LLink needs to obtain the following permissions:";

Source/LinkApp/Supporting Files/Resource/zh-Hans.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,7 @@
942942
"authentation_privacy_conte3" = "摄像头权限";
943943
"authentation_privacy_conte4" = "蓝牙权限";
944944
"authentation_privacy_conte5" = "麦克风权限";
945+
"authentation_privacy_conte6" = "相册权限";
945946
"authentation_alert_btn" = "始终允许";
946947
"authentation_alert_wifi_title" = "请授权腾讯连连以下权限";
947948
"authentation_alert_wifi_conte" = "该步骤将为硬件设备配置WiFi网络实现通信,绑定硬件设备与APP用户之间的关系。因此 腾讯连连 需获取以下权限:";

0 commit comments

Comments
 (0)