|
15 | 15 | #import "SettingPhoneViewController.h"
|
16 | 16 | #import "Coding_NetAPIManager.h"
|
17 | 17 | #import "Login.h"
|
| 18 | +#import "Close2FAViewController.h" |
18 | 19 |
|
19 | 20 | @interface SettingAccountViewController ()
|
20 | 21 | @property (strong, nonatomic) User *myUser;
|
21 |
| - |
22 | 22 | @property (strong, nonatomic) UITableView *myTableView;
|
| 23 | +@property (assign, nonatomic) BOOL is2FAOpen; |
23 | 24 | @end
|
24 | 25 |
|
25 | 26 | @implementation SettingAccountViewController
|
@@ -53,12 +54,23 @@ - (void)viewWillAppear:(BOOL)animated{
|
53 | 54 | [super viewWillAppear:animated];
|
54 | 55 | self.myUser = [Login curLoginUser];
|
55 | 56 | [self.myTableView reloadData];
|
| 57 | + [self refresh2FA]; |
| 58 | +} |
| 59 | + |
| 60 | +- (void)refresh2FA{ |
| 61 | + __weak typeof(self) weakSelf = self; |
| 62 | + [[Coding_NetAPIManager sharedManager] get_is2FAOpenBlock:^(BOOL data, NSError *error) { |
| 63 | + if (!error) { |
| 64 | + weakSelf.is2FAOpen = data; |
| 65 | + [weakSelf.myTableView reloadData]; |
| 66 | + } |
| 67 | + }]; |
56 | 68 | }
|
57 | 69 |
|
58 | 70 | #pragma mark TableM
|
59 | 71 |
|
60 | 72 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
61 |
| - return 3; |
| 73 | + return _is2FAOpen? 4: 3; |
62 | 74 | }
|
63 | 75 |
|
64 | 76 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
@@ -95,7 +107,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
|
95 | 107 | }
|
96 | 108 | }else{
|
97 | 109 | TitleDisclosureCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_TitleDisclosure forIndexPath:indexPath];
|
98 |
| - [cell setTitleStr:@"修改密码"]; |
| 110 | + [cell setTitleStr:indexPath.section == 2? @"修改密码": @"关闭两步验证"]; |
99 | 111 | [tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
|
100 | 112 | return cell;
|
101 | 113 | }
|
@@ -137,6 +149,11 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
|
137 | 149 | SettingPasswordViewController *vc = [[SettingPasswordViewController alloc] init];
|
138 | 150 | vc.myUser = self.myUser;
|
139 | 151 | [self.navigationController pushViewController:vc animated:YES];
|
| 152 | + }else if (indexPath.section == 3){ |
| 153 | + Close2FAViewController *vc = [Close2FAViewController vcWithPhone:_myUser.phone sucessBlock:^(UIViewController *vcc) { |
| 154 | + [vcc.navigationController popToRootViewControllerAnimated:YES]; |
| 155 | + }]; |
| 156 | + [self.navigationController pushViewController:vc animated:YES]; |
140 | 157 | }
|
141 | 158 | }
|
142 | 159 |
|
|
0 commit comments