Files
keyboard/keyBoard/Class/Manager/KBUserSessionManager.h
2025-12-02 18:29:04 +08:00

43 lines
944 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.

//
// KBUserSessionManager.h
// keyBoard
//
// Created by Mac on 2025/12/1.
//
// KBUserSessionManager.h
// 主 App + 键盘扩展 共用的登录会话管理
#import <Foundation/Foundation.h>
@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