Skip to content

Commit 338d1db

Browse files
committed
addOneAuthURL
1 parent d5436d4 commit 338d1db

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Coding_iOS/Ease_2FA/Controllers/OTPListViewController.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,10 @@ - (void)beginButtonClicked:(id)sender{
186186
}
187187

188188
- (void)addOneAuthURL:(OTPAuthURL *)authURL{
189+
BOOL alreadyHave = NO;
189190
for (OTPAuthURL *item in self.authURLs) {
190191
if ([authURL.name isEqualToString:item.name]) {
192+
alreadyHave = YES;
191193
if ([authURL.otpCode isEqualToString:item.otpCode]) {
192194
kTipAlert(@"该二维码已被保存为账户名:%@", authURL.name);
193195
}else{
@@ -211,6 +213,12 @@ - (void)addOneAuthURL:(OTPAuthURL *)authURL{
211213
break;
212214
}
213215
}
216+
if (!alreadyHave) {
217+
[authURL saveToKeychain];
218+
[self.authURLs addObject:authURL];
219+
[self configUI];
220+
kTipAlert(@"添加账户成功:%@", authURL.name);
221+
}
214222
}
215223

216224
- (void)deleteOneAuthURL:(OTPAuthURL *)authURL{

0 commit comments

Comments
 (0)