This commit is contained in:
2025-11-03 20:02:11 +08:00
parent cac2f13b88
commit 5af2612ff7
8 changed files with 26 additions and 41 deletions

View File

@@ -11,10 +11,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface KBLoginSheetViewController : UIViewController
/// Called when the login finished successfully; sheet will dismiss itself as well.
@property (nonatomic, copy, nullable) void (^onLoginSuccess)(void);
/// Present the sheet from a top most view controller.
+ (void)presentIfNeededFrom:(UIViewController *)presenting;
@end

View File

@@ -35,7 +35,6 @@
}
- (void)buildUI {
//
self.backdrop = [[UIControl alloc] init];
self.backdrop.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.15];
[self.backdrop addTarget:self action:@selector(dismissSelf) forControlEvents:UIControlEventTouchUpInside];
@@ -44,11 +43,9 @@
make.edges.equalTo(self.view);
}];
//
self.sheet = [[UIView alloc] init];
self.sheet.backgroundColor = [UIColor whiteColor];
self.sheet.layer.cornerRadius = 12.0;
self.sheet.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner; //
self.sheet.layer.masksToBounds = YES;
[self.view addSubview:self.sheet];
[self.sheet mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -57,7 +54,6 @@
make.height.mas_equalTo(160);
}];
// +
self.checkButton = [UIButton buttonWithType:UIButtonTypeSystem];
self.checkButton.layer.cornerRadius = 16;
self.checkButton.layer.borderWidth = 2;
@@ -84,7 +80,6 @@
make.right.lessThanOrEqualTo(self.sheet).offset(-20);
}];
// Continue
self.continueButton = [UIButton buttonWithType:UIButtonTypeSystem];
self.continueButton.backgroundColor = [UIColor whiteColor];
self.continueButton.layer.cornerRadius = 10;
@@ -136,12 +131,10 @@
}
- (void)onContinue {
// Apple
LoginViewController *login = [LoginViewController new];
__weak typeof(self) weakSelf = self;
login.onLoginSuccess = ^(NSDictionary * _Nonnull userInfo) {
__strong typeof(weakSelf) self = weakSelf; if (!self) return;
//
[self dismissViewControllerAnimated:YES completion:^{
if (self.onLoginSuccess) self.onLoginSuccess();
[self dismissSelf];

View File

@@ -13,7 +13,7 @@
@property (nonatomic, strong) UILabel *titleLabel;
// Apple
@property (nonatomic, strong) UIView *appleContainer;
// iOS13+ Apple
// Apple
@property (nonatomic, strong) ASAuthorizationAppleIDButton *appleButton API_AVAILABLE(ios(13.0));
// iOS13
@property (nonatomic, strong) UIButton *compatHintButton;