Skip to content

Commit 02d45bc

Browse files
committed
OTP 的 bug
1 parent d7d2bf4 commit 02d45bc

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

Coding_iOS/Ease_2FA/Controllers/OTPListViewController.m

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,16 @@ - (void)addOneAuthURL:(OTPAuthURL *)authURL{
200200
alertV.bk_didDismissBlock = ^(UIAlertView *alertView, NSInteger buttonIndex){
201201
if (buttonIndex == 1) {
202202
@strongify(self);
203-
[authURL saveToKeychain];
204-
if ([self.authURLs indexOfObject:item] != NSNotFound) {
205-
[self.authURLs replaceObjectAtIndex:[self.authURLs indexOfObject:item] withObject:authURL];
206-
[self configUI];
207-
[self showHudTipStr:@"更新成功"];
203+
if ([authURL saveToKeychain]) {
204+
if ([self.authURLs indexOfObject:item] != NSNotFound) {
205+
[self.authURLs replaceObjectAtIndex:[self.authURLs indexOfObject:item] withObject:authURL];
206+
[self configUI];
207+
[self showHudTipStr:@"更新成功"];
208+
}
209+
}else{
210+
kTipAlert(@"保存过程中发生了异常,请重新扫描");
208211
}
212+
209213
}
210214
};
211215
[alertV show];
@@ -214,10 +218,13 @@ - (void)addOneAuthURL:(OTPAuthURL *)authURL{
214218
}
215219
}
216220
if (!alreadyHave) {
217-
[authURL saveToKeychain];
218-
[self.authURLs addObject:authURL];
219-
[self configUI];
220-
kTipAlert(@"添加账户成功:\n%@", authURL.name);
221+
if ([authURL saveToKeychain]) {
222+
[self.authURLs addObject:authURL];
223+
[self configUI];
224+
kTipAlert(@"添加账户成功:\n%@", authURL.name);
225+
}else{
226+
kTipAlert(@"保存过程中发生了异常,请重新扫描");
227+
}
221228
}
222229
}
223230

0 commit comments

Comments
 (0)