Files
keyboard/keyBoard/Class/Login/VM/KBLoginVM.h
2025-11-13 19:07:59 +08:00

33 lines
986 B
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// KBLoginVM.h
// 登录相关的 ViewModel封装 Apple 登录与服务端校验、登录态落盘。
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class KBUser;
NS_ASSUME_NONNULL_BEGIN
/// 登录完成回调
typedef void(^KBLoginCompletion)(BOOL success, NSError * _Nullable error);
@interface KBLoginVM : NSObject
+ (instancetype)shared;
/// 最近一次登录/拉取到的用户信息(仅内存缓存),可选
@property (atomic, strong, readonly, nullable) KBUser *currentUser; // 最近一次解析得到的用户
/// 调起 Apple 登录并在服务端完成校验;成功后会将 token 写入共享钥匙串KBAuthManager作为“已登录”的判断依据。
- (void)signInWithAppleFromViewController:(UIViewController *)presenter
completion:(KBLoginCompletion)completion;
/// 是否已登录:由 KBAuthManager 判断(是否存在有效 token
- (BOOL)isLoggedIn;
@end
NS_ASSUME_NONNULL_END