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
This commit is contained in:
edwinQQQ
2025-10-09 16:19:14 +08:00
commit a35a711be6
5582 changed files with 408913 additions and 0 deletions

View File

@@ -0,0 +1,82 @@
//
// XPSkillCardPlayerManager.h
// YuMi
//
// Created by GreenLand on 2022/3/9.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import "UserInfoModel.h"
@class BravoGiftTabInfomationModel;
typedef enum : NSUInteger {
MICState_None = 0,
MICState_Open = 1,
MICState_Close = 2,
MICState_Music = 3,
} MICState;
@interface XPSkillCardPlayerManager : NSObject
////获取已解锁照片id列表
@property(nonatomic,strong) NSMutableArray *photoIdList;
///播放器
@property (nonatomic, strong) AVAudioPlayer *player;
///是否正在播放
@property (nonatomic,assign) BOOL isPlay;
///播放音量大小
@property (nonatomic, assign) CGFloat volume;
@property (nonatomic,assign) BOOL isInRoomFirstRecharge;
///是否在房间
@property (nonatomic,assign) BOOL isInRoom;
///是否在房间控制器里,用于播放动画的判断
@property (nonatomic,assign) BOOL isInRoomVC;
///是否在首充不弹出界面
///所在房间的id
@property (nonatomic,copy) NSString *roomUid;
///我是否在上麦,在麦上时不能录音
@property (nonatomic,assign) BOOL isMineInMic;
// 用户在 mic 的状态
@property (nonatomic, assign) MICState micState;
// 作为全局获取当前用户数据的 model需要在相关 user/get 调用处更新,目前只在 mine tab 更新
@property(nonatomic, strong) UserInfoModel *userInfoModel;
@property(nonatomic, assign) BOOL is9Mic; // 当前房间是否 9 mic
+ (instancetype)shareInstance;
- (void)requestBravoGiftTabInfomation;
- (NSArray <BravoGiftTabInfomationModel*>*)loadBravoGiftTabInfomation;
/**
播放一次音频
@param filePath 本地路径
@param completionBlock 播放完成回调
*/
- (void)playerVoiceWithPath:(NSString *)filePath completionBlock:(void (^)(void))completionBlock;
/**
新的播放一次音频
@param filePath 本地路径
@param completionBlock 播放完成回调
*/
- (void)playerNewVoiceWithPath:(NSString *)filePath completionBlock:(void (^)(void))completionBlock;
/**
停止音乐
*/
- (void)stopMusic;
/**
停止音乐 是否需要执行完成回调更新UI
*/
- (void)stopMusicIsNeedCompletion:(BOOL)isNeedCompletion;
///关闭麦克风、听筒
- (void)closeMicroAndVoiceWithBroadcast:(BOOL)isBroadcast;
///恢复之前的 麦克风、听筒听筒状态
- (void)recoverMicroAndVoiceWithBroadcast:(BOOL)isBroadcast;
@end

View File

@@ -0,0 +1,204 @@
//
// XPSkillCardPlayerManager.m
// YuMi
//
// Created by GreenLand on 2022/3/9.
//
#import "XPSkillCardPlayerManager.h"
#import "XPRoomMiniManager.h"
#import "RtcManager.h"
#import "XPGiftPresenter.h"
@interface XPSkillCardPlayerManager()<AVAudioPlayerDelegate>
///
@property (nonatomic, assign) BOOL isCloseMuteAndMicro;
///
@property (nonatomic, assign) BOOL isMute;
///
@property (nonatomic, assign) BOOL isCloseMicro;
///
@property (nonatomic,assign) BOOL isBroadcast;
///
@property (nonatomic, copy) void (^playerCompletionBlock)(void);
@property (nonatomic,
copy) NSArray <BravoGiftTabInfomationModel *>*bravoGiftInfomations;
@end
@implementation XPSkillCardPlayerManager
+ (instancetype)shareInstance {
static dispatch_once_t once;
static XPSkillCardPlayerManager *sharedInstance;
dispatch_once(&once, ^{
if (sharedInstance == NULL) {
sharedInstance = [[self alloc] init];
[[AVAudioSession sharedInstance]setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionAllowBluetooth error:nil];
[[AVAudioSession sharedInstance]setActive:YES error:nil];
}
});
return sharedInstance;
}
- (void)requestBravoGiftTabInfomation {
@kWeakify(self);
XPGiftPresenter *presenter = [[XPGiftPresenter alloc] init];
[presenter bravoGetBannerList:^(NSArray<BravoGiftTabInfomationModel *> * _Nonnull array) {
@kStrongify(self);
self.bravoGiftInfomations = array;
} failure:^(NSError * _Nonnull error) {
}];
}
- (NSArray <BravoGiftTabInfomationModel*>*)loadBravoGiftTabInfomation {
return self.bravoGiftInfomations;
}
- (void)setMicState:(MICState)micState {
_micState = micState;
}
- (void)playerVoiceWithPath:(NSString *)filePath completionBlock:(void (^)(void))completionBlock{
[self playerMusicWithPath:filePath volume:1 loop:NO completionBlock:completionBlock];
}
- (void)playerNewVoiceWithPath:(NSString *)filePath completionBlock:(void (^)(void))completionBlock{
[self playerNewMusicWithPath:filePath volume:1 loop:NO completionBlock:completionBlock];
}
/**
@param filePath
@param volume
@param loop
@param completionBlock
*/
- (void)playerMusicWithPath:(NSString *)filePath volume:(CGFloat)volume loop:(BOOL)loop completionBlock:(void (^)(void))completionBlock {
[[AVAudioSession sharedInstance]setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionAllowBluetooth error:nil];
[self closeMicroAndVoiceWithBroadcast:YES];
if (self.player) {
[self.player stop];
self.player = nil;
}
NSLog(@"播放动画的路径:%@", filePath);
if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) return;
NSURL *url = [NSURL fileURLWithPath:filePath];
NSError *AVerror = NULL;
self.player = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&AVerror];
self.player.numberOfLoops = loop ? -1 : 0;
self.player.volume = volume;
if (AVerror) {//
if (completionBlock) {
completionBlock();
}
return;
}
self.isPlay = YES;
self.player.delegate = self;
[self.player prepareToPlay];
[self.player play];
self.playerCompletionBlock = completionBlock;
}
/**
@param filePath
@param volume
@param loop
@param completionBlock
*/
- (void)playerNewMusicWithPath:(NSString *)filePath volume:(CGFloat)volume loop:(BOOL)loop completionBlock:(void (^)(void))completionBlock {
[[AVAudioSession sharedInstance]setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionAllowBluetooth error:nil];
[self closeMicroAndVoiceWithBroadcast:YES];
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
if (self.player) {
[self.player stop];
self.player = nil;
}
NSLog(@"播放动画的路径:%@", filePath);
if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) return;
NSURL *url = [NSURL fileURLWithPath:filePath];
NSError *AVerror = NULL;
self.player = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&AVerror];
self.player.numberOfLoops = loop ? -1 : 0;
self.player.volume = volume;
if (AVerror) {//
if (completionBlock) {
completionBlock();
}
return;
}
self.isPlay = YES;
self.player.delegate = self;
[self.player prepareToPlay];
[self.player play];
self.playerCompletionBlock = completionBlock;
});
}
- (void)stopMusic {
[self stopMusicIsNeedCompletion:NO];
}
- (void)stopMusicIsNeedCompletion:(BOOL)isNeedCompletion {
if (self.player) {
[self.player stop];
self.player = nil;
if (isNeedCompletion && self.playerCompletionBlock) {
self.playerCompletionBlock();
}
self.playerCompletionBlock = nil;
}
self.isPlay = NO;
self.volume = 1;
[self recoverMicroAndVoiceWithBroadcast:YES];
}
///
- (void)closeMicroAndVoiceWithBroadcast:(BOOL)isBroadcast{
if (([XPSkillCardPlayerManager shareInstance].isInRoom == YES || [XPRoomMiniManager shareManager].getRoomInfo) && !self.isCloseMuteAndMicro) {
self.isMute = [RtcManager instance].isLocalMuted;
self.isCloseMicro = [RtcManager instance].isRemoteMuted;
[[RtcManager instance] setLocalMuted:YES];
[[RtcManager instance] setRemoteMuted:YES];
if(isBroadcast == YES){
self.isBroadcast = [RtcManager instance].broadcast;
[[RtcManager instance]broadcast:NO];
}
self.isCloseMuteAndMicro = YES;
}
}
///
- (void)recoverMicroAndVoiceWithBroadcast:(BOOL)isBroadcast {
if (([XPSkillCardPlayerManager shareInstance].isInRoom == YES || [XPRoomMiniManager shareManager].getRoomInfo) && self.isCloseMuteAndMicro) {
[[RtcManager instance] setLocalMuted:self.isMute];
[[RtcManager instance] setRemoteMuted:self.isCloseMicro];
if(isBroadcast == YES){
[[RtcManager instance] broadcast:self.isBroadcast];
}
self.isCloseMuteAndMicro = NO;
}
}
#pragma mark - AVAudioPlayerDelegate
///
- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag {
if (self.playerCompletionBlock) {
self.playerCompletionBlock();
self.playerCompletionBlock = nil;
self.isPlay = NO;
}
}
@end