Files
real-e-party-iOS/YuMi/Modules/YMRoom/View/XPRoomMiniManager.m
edwinQQQ a35a711be6 chore: Initial clean commit
- Removed YuMi/Library/ (138 MB, not tracked)
- Removed YuMi/Resources/ (23 MB, not tracked)
- Removed old version assets (566 files, not tracked)
- Excluded Pods/, xcuserdata/ and other build artifacts
- Clean repository optimized for company server deployment
2025-10-09 16:19:14 +08:00

92 lines
2.1 KiB
Objective-C

//
// YMRoomMiniManager.m
// YUMI
//
// Created by YUMI on 2021/12/8.
//
#import "XPRoomMiniManager.h"
#import "XPRoomMessageConstant.h"
@interface XPRoomMiniManager ()
///公屏消息
@property (nonatomic,strong) NSMutableArray *messageArray;
///房间信息
@property (nonatomic,strong) RoomInfoModel *roomInfo;
///当前播放的歌曲
@property (nonatomic,strong) Music *musicInfo;
///是否正在播放
@property (nonatomic,assign) BOOL isPlaying;
///用户信息
@property (nonatomic,strong) UserInfoModel *userInfo;
@end
@implementation XPRoomMiniManager
+ (instancetype)shareManager {
static dispatch_once_t onceToken = 0;
static XPRoomMiniManager *instance;
dispatch_once(&onceToken, ^{
instance = [[XPRoomMiniManager alloc] init];
});
return instance;
}
- (RoomInfoModel *)getRoomInfo {
return self.roomInfo;
}
- (void)configRoomInfo:(RoomInfoModel *_Nullable)roomInfo {
self.roomInfo = roomInfo;
}
- (UserInfoModel *)getUserInfo {
return self.userInfo;
}
- (void)configUserInfo:(UserInfoModel * _Nullable)userInfo {
self.userInfo = userInfo;
}
///获取当前播放的歌曲
- (Music *)getCurrentMusic {
return self.musicInfo;
}
- (BOOL)musicPlaying {
return self.isPlaying;
}
///最小化的时候也要保存一下当前播放的歌曲
- (void)configCurrentMusic:(Music *)music isPlaying:(BOOL)isPlaying {
self.musicInfo = music;
self.isPlaying = isPlaying;
}
///保存一下 房间的公屏防止最小化出去之后 被清空了
- (void)saveRoomMessage:(id)message {
[self.messageArray addObject:message];
if (self.messageArray.count > kRoomMessageMaxLength) {
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
NSArray *needRemoveMsgArray = [self.messageArray objectsAtIndexes:set];
[self.messageArray removeObjectsInArray:needRemoveMsgArray];
}
}
- (NSArray *)getLocalCurrentRoomMessage {
return [self.messageArray copy];
}
- (void)resetLocalMessage {
[self.messageArray removeAllObjects];
}
- (NSMutableArray *)messageArray {
if (!_messageArray) {
_messageArray = [NSMutableArray array];
}
return _messageArray;
}
@end