添加苹果登录的测试
This commit is contained in:
@@ -6,8 +6,10 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "KBTestVC.h"
|
#import "KBTestVC.h"
|
||||||
|
#import "LSTPopView.h"
|
||||||
#import "KBGuideVC.h"
|
#import "KBGuideVC.h"
|
||||||
#import "KBLangTestVC.h"
|
#import "KBLangTestVC.h"
|
||||||
|
#import "KBLoginPopView.h"
|
||||||
@interface KBTestVC ()<UITableViewDelegate, UITableViewDataSource>
|
@interface KBTestVC ()<UITableViewDelegate, UITableViewDataSource>
|
||||||
@property (nonatomic, strong) UITextView *textView; // 作为表头,保持原有键盘测试
|
@property (nonatomic, strong) UITextView *textView; // 作为表头,保持原有键盘测试
|
||||||
@property (nonatomic, strong) BaseTableView *tableView; // 首页列表
|
@property (nonatomic, strong) BaseTableView *tableView; // 首页列表
|
||||||
@@ -38,7 +40,7 @@
|
|||||||
self.tableView.tableHeaderView = header;
|
self.tableView.tableHeaderView = header;
|
||||||
[self.view addSubview:self.tableView];
|
[self.view addSubview:self.tableView];
|
||||||
|
|
||||||
self.items = @[ KBLocalized(@"home_item_lang_test"), KBLocalized(@"home_item_keyboard_permission"), KBLocalized(@"皮肤中心") ];
|
self.items = @[ KBLocalized(@"home_item_lang_test"), KBLocalized(@"home_item_keyboard_permission"), KBLocalized(@"皮肤中心"), KBLocalized(@"苹果登录") ];
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{ [self.textView becomeFirstResponder]; });
|
dispatch_async(dispatch_get_main_queue(), ^{ [self.textView becomeFirstResponder]; });
|
||||||
|
|
||||||
@@ -49,8 +51,8 @@
|
|||||||
|
|
||||||
- (void)viewWillAppear:(BOOL)animated{
|
- (void)viewWillAppear:(BOOL)animated{
|
||||||
[super viewWillAppear:animated];
|
[super viewWillAppear:animated];
|
||||||
self.title = KBLocalized(@"home_title");
|
self.title = KBLocalized(@"Test");
|
||||||
self.items = @[ KBLocalized(@"home_item_lang_test"), KBLocalized(@"home_item_keyboard_permission"), KBLocalized(@"皮肤中心") ];
|
self.items = @[ KBLocalized(@"home_item_lang_test"), KBLocalized(@"home_item_keyboard_permission"), KBLocalized(@"皮肤中心"), KBLocalized(@"苹果登录") ];
|
||||||
[self.tableView reloadData];
|
[self.tableView reloadData];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,6 +91,42 @@
|
|||||||
// 皮肤中心
|
// 皮肤中心
|
||||||
UIViewController *vc = [NSClassFromString(@"KBSkinCenterVC") new];
|
UIViewController *vc = [NSClassFromString(@"KBSkinCenterVC") new];
|
||||||
if (vc) { [self.navigationController pushViewController:vc animated:YES]; }
|
if (vc) { [self.navigationController pushViewController:vc animated:YES]; }
|
||||||
|
}else if (indexPath.row == 3) {
|
||||||
|
[self goLogin];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)goLogin{
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
KBLoginPopView *view = [[KBLoginPopView alloc] initWithFrame:CGRectMake(0, 0, KB_SCREEN_WIDTH, KB_SCREEN_WIDTH)];
|
||||||
|
// 创建并弹出
|
||||||
|
LSTPopView *pop = [LSTPopView initWithCustomView:view
|
||||||
|
parentView:nil
|
||||||
|
popStyle:LSTPopStyleSmoothFromBottom
|
||||||
|
dismissStyle:LSTDismissStyleSmoothToBottom];
|
||||||
|
pop.hemStyle = LSTHemStyleBottom;
|
||||||
|
pop.bgColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
|
||||||
|
pop.isClickBgDismiss = YES; // 点击背景关闭
|
||||||
|
pop.cornerRadius = 0; // 自定义 view 自处理圆角
|
||||||
|
|
||||||
|
__weak typeof(pop) weakPop = pop;
|
||||||
|
view.appleLoginHandler = ^{
|
||||||
|
[weakPop dismiss];
|
||||||
|
// 交给 VM 统一处理 Apple 登录 + 服务端登录
|
||||||
|
[[KBLoginVM shared] signInWithAppleFromViewController:KB_CURRENT_NAV completion:^(BOOL success, NSError * _Nullable error) {
|
||||||
|
if (success) {
|
||||||
|
[KBHUD showInfo:KBLocalized(@"Signed in successfully")];
|
||||||
|
} else {
|
||||||
|
NSString *msg = error.localizedDescription ?: KBLocalized(@"Sign-in failed");
|
||||||
|
[KBHUD showInfo:msg];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
view.closeHandler = ^{ [weakPop dismiss]; };
|
||||||
|
|
||||||
|
[pop pop];
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -42,7 +42,10 @@
|
|||||||
@[@{ @"title": KBLocalized(@"Feedback"), @"icon": @"my_feedback_icon", @"color": @(0xB06AFD),@"id":@"3" },
|
@[@{ @"title": KBLocalized(@"Feedback"), @"icon": @"my_feedback_icon", @"color": @(0xB06AFD),@"id":@"3" },
|
||||||
@{ @"title": KBLocalized(@"E-mail"), @"icon": @"my_email_icon", @"color": @(0xFF8A65),@"id":@"4" },
|
@{ @"title": KBLocalized(@"E-mail"), @"icon": @"my_email_icon", @"color": @(0xFF8A65),@"id":@"4" },
|
||||||
@{ @"title": KBLocalized(@"Agreement"), @"icon": @"my_agreement_icon", @"color": @(0x4CD964),@"id":@"5" },
|
@{ @"title": KBLocalized(@"Agreement"), @"icon": @"my_agreement_icon", @"color": @(0x4CD964),@"id":@"5" },
|
||||||
@{ @"title": KBLocalized(@"Privacy Policy"), @"icon": @"my_privacy_icon", @"color": @(0x5AC8FA),@"id":@"6" }]
|
@{ @"title": KBLocalized(@"Privacy Policy"), @"icon": @"my_privacy_icon", @"color": @(0x5AC8FA),@"id":@"6" },
|
||||||
|
@{ @"title": KBLocalized(@"测试"), @"icon": @"", @"color": @(0x5AC8FA),@"id":@"7" },
|
||||||
|
|
||||||
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
[self.view addSubview:self.tableView];
|
[self.view addSubview:self.tableView];
|
||||||
@@ -111,9 +114,11 @@
|
|||||||
|
|
||||||
}else if ([itemID isEqualToString:@"6"]){
|
}else if ([itemID isEqualToString:@"6"]){
|
||||||
|
|
||||||
|
}else if ([itemID isEqualToString:@"7"]){
|
||||||
|
KBTestVC *vc = [[KBTestVC alloc] init];
|
||||||
|
[self.navigationController pushViewController:vc animated:true];
|
||||||
}
|
}
|
||||||
// KBTestVC *vc = [[KBTestVC alloc] init];
|
|
||||||
// [self.navigationController pushViewController:vc animated:true];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Lazy
|
#pragma mark - Lazy
|
||||||
|
|||||||
Reference in New Issue
Block a user