This commit is contained in:
2025-11-17 20:07:39 +08:00
parent ee433db4ad
commit 005e3c7581
43 changed files with 529 additions and 172 deletions

View File

@@ -71,7 +71,7 @@
}];
} else {
UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
[btn setTitle:@"需要 iOS13+ 才能使用 Apple 登录" forState:UIControlStateNormal];
[btn setTitle:KBLocalized(@"需要 iOS13+ 才能使用 Apple 登录") forState:UIControlStateNormal];
btn.enabled = NO;
btn.layer.cornerRadius = 8.0;
btn.layer.borderWidth = 1.0;
@@ -100,7 +100,7 @@
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [UILabel new];
_titleLabel.text = @"登录后可使用全部功能";
_titleLabel.text = KBLocalized(@"Sign in to unlock all features");
_titleLabel.font = [UIFont boldSystemFontOfSize:18];
_titleLabel.textColor = [UIColor blackColor];
_titleLabel.textAlignment = NSTextAlignmentCenter;
@@ -112,7 +112,7 @@
- (UILabel *)descLabel {
if (!_descLabel) {
_descLabel = [UILabel new];
_descLabel.text = @"我们将使用 Apple 进行快速安全登录";
_descLabel.text = KBLocalized(@"We'll use Apple for a quick, secure sign-in");
_descLabel.font = [UIFont systemFontOfSize:14];
_descLabel.textColor = [UIColor colorWithWhite:0.2 alpha:0.8];
_descLabel.textAlignment = NSTextAlignmentCenter;
@@ -140,4 +140,3 @@
}
@end

View File

@@ -68,7 +68,7 @@
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [UILabel new];
_titleLabel.text = @"登录";
_titleLabel.text = KBLocalized(@"Log In");
_titleLabel.font = [UIFont boldSystemFontOfSize:24];
_titleLabel.textAlignment = NSTextAlignmentCenter;
}
@@ -107,7 +107,7 @@
- (UIButton *)compatHintButton {
if (!_compatHintButton) {
_compatHintButton = [UIButton buttonWithType:UIButtonTypeSystem];
[_compatHintButton setTitle:@"需要 iOS13+ 才能使用 Apple 登录" forState:UIControlStateNormal];
[_compatHintButton setTitle:KBLocalized(@"需要 iOS13+ 才能使用 Apple 登录") forState:UIControlStateNormal];
_compatHintButton.enabled = NO;
}
return _compatHintButton;

View File

@@ -30,7 +30,7 @@
[[AppleSignInManager shared] signInFromViewController:presenter completion:^(ASAuthorizationAppleIDCredential * _Nullable credential, NSError * _Nullable error) {
if (error) { if (completion) completion(NO, error); return; }
if (![credential isKindOfClass:[ASAuthorizationAppleIDCredential class]]) {
if (completion) completion(NO, [NSError errorWithDomain:@"KBLogin" code:-1 userInfo:@{NSLocalizedDescriptionKey: @"无效的登录凭证"}]);
if (completion) completion(NO, [NSError errorWithDomain:@"KBLogin" code:-1 userInfo:@{NSLocalizedDescriptionKey: KBLocalized(@"无效的登录凭证")}]);
return;
}
@@ -54,7 +54,7 @@
self.currentUser = user;
NSString *token = user.token ?: [self.class tokenFromResponseObject:jsonOrData];
if (token.length == 0) {
if (completion) completion(NO, [NSError errorWithDomain:@"KBLogin" code:-2 userInfo:@{NSLocalizedDescriptionKey: @"未返回 token"}]);
if (completion) completion(NO, [NSError errorWithDomain:@"KBLogin" code:-2 userInfo:@{NSLocalizedDescriptionKey: KBLocalized(@"未返回 token")}]);
return;
}
@@ -63,7 +63,7 @@
refreshToken:nil
expiryDate:nil
userIdentifier:cred.user];
if (completion) completion(ok, ok ? nil : [NSError errorWithDomain:@"KBLogin" code:-3 userInfo:@{NSLocalizedDescriptionKey: @"保存登录态失败"}]);
if (completion) completion(ok, ok ? nil : [NSError errorWithDomain:@"KBLogin" code:-3 userInfo:@{NSLocalizedDescriptionKey: KBLocalized(@"保存登录态失败")}]);
}];
}];
}