Files
2026-03-01 15:59:27 +08:00

37 lines
873 B
Objective-C
Raw Permalink 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.
//
// AVUserManager.h
// AVDemo
//
// 用户管理类 - 管理用户登录状态
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface AVUserManager : NSObject
/// 单例
+ (instancetype)sharedManager;
/// 检查用户是否已登录
@property (nonatomic, assign, readonly) BOOL isLoggedIn;
/// 当前用户名(可选)
@property (nonatomic, copy, nullable) NSString *currentUsername;
/// 登录(异步,带回调)
/// @param username 用户名
/// @param password 密码
/// @param completion 完成回调success 表示是否成功errorMessage 为错误信息(成功时为 nil
- (void)loginWithUsername:(NSString *)username
password:(NSString *)password
completion:(void (^)(BOOL success, NSString * _Nullable errorMessage))completion;
/// 登出
- (void)logout;
@end
NS_ASSUME_NONNULL_END