// // KBUserSessionManager.h // keyBoard // // Created by Mac on 2025/12/1. // // KBUserSessionManager.h // 主 App + 键盘扩展 共用的登录会话管理 #import @class KBUser; NS_ASSUME_NONNULL_BEGIN @interface KBUserSessionManager : NSObject + (instancetype)shared; /// 当前登录用户(可能为 nil) @property (atomic, strong, readonly, nullable) KBUser *currentUser; /// 是否已登录:由 KBAuthManager 基于 accessToken 判断 @property (nonatomic, assign, readonly) BOOL isLoggedIn; /// 启动时调用:做“卸载重装”检测 & 恢复本地缓存 - (void)bootstrapIfNeeded; /// 当前 accessToken,可能为 nil/空字符串 - (nullable NSString *)accessToken; /// 登录成功统一入口:写 Keychain + 缓存用户信息 - (void)handleLoginSuccessWithUser:(KBUser *)user; /// 退出登录:清 Keychain + 本地缓存 - (void)logout; @end NS_ASSUME_NONNULL_END