Commit cba0f68f by pidan

fixed bugs

parent 7458f44b
Showing with 81 additions and 119 deletions
...@@ -195,7 +195,8 @@ ...@@ -195,7 +195,8 @@
NSString *roomPassword = @""; NSString *roomPassword = @"";
BOOL isPusher = FUSConfig.sharedInstanced.liveConfigs.isAnchor; BOOL isPusher = FUSConfig.sharedInstanced.liveConfigs.isAnchor;
if (isPusher) { if (isPusher
&& FUSRouter.liveRouter.fus_liveScopeType == 4) {
roomPassword = FUSRouter.liveRouter.liveRoomPassword; roomPassword = FUSRouter.liveRouter.liveRoomPassword;
} }
......
...@@ -197,7 +197,11 @@ static const NSString *FUSCidUDKey = @"FUSCidUDKey"; ...@@ -197,7 +197,11 @@ static const NSString *FUSCidUDKey = @"FUSCidUDKey";
- (instancetype)init { - (instancetype)init {
self = [super init]; self = [super init];
if (self) { if (self) {
self.devLevel = FUSDevlopLevelRelease;
#ifdef DEBUG
self.devLevel = FUSDevlopLevelDeveloper; self.devLevel = FUSDevlopLevelDeveloper;
#endif
self.postJsonList = [NSMutableArray array]; self.postJsonList = [NSMutableArray array];
} }
return self; return self;
......
...@@ -220,9 +220,9 @@ typedef void(^ConnectBlock)(BOOL isSuccess); // 连接回调 ...@@ -220,9 +220,9 @@ typedef void(^ConnectBlock)(BOOL isSuccess); // 连接回调
// 发送消息队列中的离线消息 // 发送消息队列中的离线消息
[self sendMessageFromMessageQueue]; [self sendMessageFromMessageQueue];
// 每隔10s像服务器发送心跳包 // 每隔30s像服务器发送心跳包
[mConnectTimer invalidate]; [mConnectTimer invalidate];
mConnectTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:[YYWeakProxy proxyWithTarget:self] selector:@selector(sendHeartbeatPacket) userInfo:nil repeats:YES]; mConnectTimer = [NSTimer scheduledTimerWithTimeInterval:30 target:[YYWeakProxy proxyWithTarget:self] selector:@selector(sendHeartbeatPacket) userInfo:nil repeats:YES];
[mConnectTimer fire]; [mConnectTimer fire];
if (mConnectBlock) mConnectBlock(YES); if (mConnectBlock) mConnectBlock(YES);
...@@ -324,6 +324,7 @@ typedef void(^ConnectBlock)(BOOL isSuccess); // 连接回调 ...@@ -324,6 +324,7 @@ typedef void(^ConnectBlock)(BOOL isSuccess); // 连接回调
// 循环读取发送消息队列中的消息 // 循环读取发送消息队列中的消息
while ([mSocketQueue fus_isHaveSendMessage]) while ([mSocketQueue fus_isHaveSendMessage])
{ {
FUSLogInfo(@"--->发送SocketMessage while ([mSocketQueue fus_isHaveSendMessage])");
// 读取消息队列中的消息 // 读取消息队列中的消息
NSData *data = [mSocketQueue fus_readSendMessage]; NSData *data = [mSocketQueue fus_readSendMessage];
if ([NSObject isNullWithData:data]) { if ([NSObject isNullWithData:data]) {
......
...@@ -96,7 +96,10 @@ ...@@ -96,7 +96,10 @@
if (image == nil) { if (image == nil) {
image = [UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; image = [UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil];
} }
FUSLogInfo(@"pidan record imageNamed = %@, bundle = %@",imageName, bundle);
if (image == nil || bundle == nil) {
FUSLogInfo(@"pidan record nil imageNamed = %@, bundle = %@",imageName, bundle);
}
return image; return image;
} }
......
...@@ -664,7 +664,7 @@ ...@@ -664,7 +664,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements; CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 202506260001; CURRENT_PROJECT_VERSION = 202506260002;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 6GG26BHUMC; DEVELOPMENT_TEAM = 6GG26BHUMC;
ENABLE_ON_DEMAND_RESOURCES = NO; ENABLE_ON_DEMAND_RESOURCES = NO;
...@@ -932,7 +932,7 @@ ...@@ -932,7 +932,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements; CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 202506260001; CURRENT_PROJECT_VERSION = 202506260002;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 6GG26BHUMC; DEVELOPMENT_TEAM = 6GG26BHUMC;
ENABLE_ON_DEMAND_RESOURCES = NO; ENABLE_ON_DEMAND_RESOURCES = NO;
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
disableMainThreadChecker = "YES" disableMainThreadChecker = "YES"
disablePerformanceAntipatternChecker = "YES"
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
if (i == 0) { if (i == 0) {
NSMutableArray *animationIamgesList = [[NSMutableArray alloc] init]; NSMutableArray *animationIamgesList = [[NSMutableArray alloc] init];
for (int i = 0; i < 99; i++) { for (int i = 0; i < 24; i++) {
UIImage *tempImage = [FUSShowRoomCenterBunble imageNamed:[NSString stringWithFormat:@"fusi_home_navi_follow_animate_%d",i]]; UIImage *tempImage = [FUSShowRoomCenterBunble imageNamed:[NSString stringWithFormat:@"fusi_home_navi_follow_animate_%d",i]];
if (tempImage == nil) { if (tempImage == nil) {
break; break;
......
...@@ -596,11 +596,11 @@ typedef NS_ENUM(NSInteger, FUSStreamState) { ...@@ -596,11 +596,11 @@ typedef NS_ENUM(NSInteger, FUSStreamState) {
}]; }];
self.playView.playerVideoFrameCallBackHandler = ^(NSString *uid, CVPixelBufferRef videoFrame) { // self.playView.playerVideoFrameCallBackHandler = ^(NSString *uid, CVPixelBufferRef videoFrame) {
if (weakSelf.pipController && [uid isEqualToString:weakSelf.playView.mainUID]) { // if (weakSelf.pipController && [uid isEqualToString:weakSelf.playView.mainUID]) {
[weakSelf.pipController enqueuePixelBuffer:videoFrame]; // [weakSelf.pipController enqueuePixelBuffer:videoFrame];
} // }
}; // };
return; return;
} }
...@@ -2245,6 +2245,7 @@ typedef NS_ENUM(NSInteger, FUSStreamState) { ...@@ -2245,6 +2245,7 @@ typedef NS_ENUM(NSInteger, FUSStreamState) {
[self performSelector:@selector(setupPictureInPicture) afterDelay:0.3]; [self performSelector:@selector(setupPictureInPicture) afterDelay:0.3];
} }
- (void)setupPictureInPicture { - (void)setupPictureInPicture {
return;
if (self.autoStartPictureInPicture == NO) { if (self.autoStartPictureInPicture == NO) {
return; return;
} }
......
...@@ -808,15 +808,15 @@ ...@@ -808,15 +808,15 @@
} }
// 进入包房错误消息处理 // 进入包房错误消息处理
+ (void)joinRoomFailuerWithErrorDict:(NSDictionary *)errorDict code:(int)code msg:(NSString *)msg { - (void)joinRoomFailuerWithErrorDict:(NSDictionary *)errorDict code:(int)code msg:(NSString *)msg currentRoomId:(NSString *)currentRoomId password:(NSString *)password {
[[FUSLiveHelper shareInstance].liveVC.liveFunctionView fus_cleanFunctionView];
[[FUSLiveHelper shareInstance].liveVC.playView fus_stopWithUID:[FUSLiveHelper shareInstance].roomInfoModel.roomId];
[[[FUSLiveHelper shareInstance] liveVC] fus_showLiveLoadingViewWithType:liveLoadingDismiss];
[[[FUSLiveHelper shareInstance]liveVC] fus_stopPlay];
FUSLogInfo(@"%@", msg);
if (code == -20036) { if (code == -20036) {
[[[FUSLiveHelper shareInstance] roomInfoModel] fus_setValueWithDict:errorDict]; [[[FUSLiveHelper shareInstance] roomInfoModel] fus_setValueWithDict:errorDict];
[[FUSLiveHelper shareInstance].liveVC.playView fus_stopALLPlayer];
// 官方控制违规下播 // 官方控制违规下播
if ([errorDict[@"cause"] intValue] == 1) { if ([errorDict[@"cause"] intValue] == 1) {
FUSVideoOfficialEndV2View *officialEndView = [[FUSVideoOfficialEndV2View alloc] initWithFrame:UIView.fus_screenFrame]; FUSVideoOfficialEndV2View *officialEndView = [[FUSVideoOfficialEndV2View alloc] initWithFrame:UIView.fus_screenFrame];
...@@ -826,7 +826,7 @@ ...@@ -826,7 +826,7 @@
paragraphStyle.lineSpacing = 5.0f; paragraphStyle.lineSpacing = 5.0f;
NSString *errMsg = errorDict[@"msg"]; NSString *errMsg = errorDict[@"msg"];
// NSString *errMsg = @"由于出现违规内容,本直播间被停止播放了,请稍后再试,本直播间被停止播放了,请稍后再试,本直播间被停止播放了,请稍后再试"; // NSString *errMsg = @"由于出现违规内容,本直播间被停止播放了,请稍后再试,本直播间被停止播放了,请稍后再试,本直播间被停止播放了,请稍后再试";
if ([NSString isNull:errMsg]) { if ([NSString isNull:errMsg]) {
errMsg = @""; errMsg = @"";
} }
...@@ -848,17 +848,36 @@ ...@@ -848,17 +848,36 @@
// 直播已结束 // 直播已结束
[[[FUSLiveHelper shareInstance] liveVC] initLiveEndViewWithInfoDict:errorDict]; [[[FUSLiveHelper shareInstance] liveVC] initLiveEndViewWithInfoDict:errorDict];
[[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveNotificationKeys.fus_BaoFang_Did_End_Live_Notification object:currentRoomId];
[[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveNotificationKeys.fus_BaoFang_Refresh object:nil];
} else if (code == -20060) { } else if (code == -20060) {
[[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveNotificationKeys.fus_BaoFang_Refresh object:nil];
// V6.1.0 改成直接退出toast提示 // V6.1.0 改成直接退出toast提示
[FUSLiveHelper fus_quitLiveWithCompletion:nil]; [FUSLiveHelper fus_quitLiveWithCompletion:nil];
[FUSDialogView fus_showDialog:[NSString fus_localString:@"您已被踢出房间,暂时不能进入"]]; [FUSDialogView fus_showDialog:[NSString fus_localString:@"您已被踢出房间,暂时不能进入"]];
// 您已被移除直播,暂时不能进入 // // 您已被移除直播,暂时不能进入
} else if (code == -20019) { } else if (code == -20080) {
// 包房已满 [[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveNotificationKeys.fus_BaoFang_Refresh object:nil];
[FUSAlertView showAlertWithTitle:nil message:[NSString fus_localString:@"包房已满,请稍后再试"] cancelButtonTitle:[NSString fus_localString:@"确定"] otherButtonTitles:nil clickBlock:^(NSInteger buttonIndex) { // 没有私密房权限
[self.currentFunctionView fus_hideAllFunctionLayers];
[FUSAlertView showAlertWithTitle:nil message:errorDict[@"msg"] cancelButtonTitle:[NSString fus_localString:@"确定"] otherButtonTitles:nil clickBlock:^(NSInteger buttonIndex) {
[FUSLiveHelper fus_quitLiveWithCompletion:nil]; [FUSLiveHelper fus_quitLiveWithCompletion:nil];
}]; }];
} else {
// 其他情况
[FUSAlertView showAlertWithTitle:nil message:msg cancelButtonTitle:nil otherButtonTitles:@[[NSString fus_localString:@"确定"], [NSString fus_localString:@"退出"]] clickBlock:^(NSInteger buttonIndex) {
if (buttonIndex == 0) {
[self fus_audienceJoinRoomWithRoomId:currentRoomId password:password];
}else{
[FUSLiveHelper fus_quitLiveWithCompletion:nil];
}
}];
}
if(self.enterRoomFailureBlock){
self.enterRoomFailureBlock();
} }
} }
...@@ -1253,19 +1272,8 @@ ...@@ -1253,19 +1272,8 @@
FUSLogInfo(@"不是当前包房"); FUSLogInfo(@"不是当前包房");
return; return;
} }
// 其他情况
[FUSAlertView showAlertWithTitle:nil message:[NSString fus_localString:@"网络出错,是否重新进入包房?"] cancelButtonTitle:nil otherButtonTitles:@[[NSString fus_localString:@"确定"], [NSString fus_localString:@"退出"]] clickBlock:^(NSInteger buttonIndex) {
if (buttonIndex == 0) { [weakSelf joinRoomFailuerWithErrorDict:errorDict code:code msg:msg currentRoomId:currentRoomId password:@""];
[self fus_audienceJoinRoomWithStreamUrl:originalStreamUrl roomId:currentRoomId];
}else{
[FUSLiveHelper fus_quitLiveWithCompletion:nil];
}
}];
if(weakSelf.enterRoomFailureBlock){
weakSelf.enterRoomFailureBlock();
}
}]; }];
} }
...@@ -1388,77 +1396,7 @@ ...@@ -1388,77 +1396,7 @@
FUSLogInfo(@"不是当前包房"); FUSLogInfo(@"不是当前包房");
return; return;
} }
[weakSelf joinRoomFailuerWithErrorDict:errorDict code:code msg:msg currentRoomId:currentRoomId password:password];
[[[FUSLiveHelper shareInstance] liveVC] fus_showLiveLoadingViewWithType:liveLoadingDismiss];
[[[FUSLiveHelper shareInstance]liveVC] fus_stopPlay];
FUSLogInfo(@"%@", msg);
if (code == -20036) {
[[[FUSLiveHelper shareInstance] roomInfoModel] fus_setValueWithDict:errorDict];
// 官方控制违规下播
if ([errorDict[@"cause"] intValue] == 1) {
FUSVideoOfficialEndV2View *officialEndView = [[FUSVideoOfficialEndV2View alloc] initWithFrame:UIView.fus_screenFrame];
[[[FUSLiveHelper shareInstance] liveVC].view addSubview:officialEndView];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.alignment = NSTextAlignmentCenter;
paragraphStyle.lineSpacing = 5.0f;
NSString *errMsg = errorDict[@"msg"];
// NSString *errMsg = @"由于出现违规内容,本直播间被停止播放了,请稍后再试,本直播间被停止播放了,请稍后再试,本直播间被停止播放了,请稍后再试";
if ([NSString isNull:errMsg]) {
errMsg = @"";
}
NSAttributedString *str = [[NSAttributedString alloc] initWithString:errMsg attributes:@{NSParagraphStyleAttributeName: paragraphStyle,NSForegroundColorAttributeName: [UIColor whiteColor]}];
officialEndView.contentLabel.attributedText = str;
officialEndView.closeClickBlock = ^() {
[FUSLiveHelper fus_quitLiveWithCompletion:nil];
};
return;
} else if ([errorDict[@"cause"] intValue] == 2) {
[FUSAlertView showAlertWithTitle:nil message:errorDict[@"msg"] cancelButtonTitle:[NSString fus_localString:@"确定"] otherButtonTitles:nil clickBlock:^(NSInteger buttonIndex) {
[FUSLiveHelper fus_quitLiveWithCompletion:nil];
}];
return;
}
// 直播已结束
[[[FUSLiveHelper shareInstance] liveVC] initLiveEndViewWithInfoDict:errorDict];
[[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveNotificationKeys.fus_BaoFang_Did_End_Live_Notification object:currentRoomId];
[[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveNotificationKeys.fus_BaoFang_Refresh object:nil];
} else if (code == -20060) {
[[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveNotificationKeys.fus_BaoFang_Refresh object:nil];
// V6.1.0 改成直接退出toast提示
[FUSLiveHelper fus_quitLiveWithCompletion:nil];
[FUSDialogView fus_showDialog:[NSString fus_localString:@"您已被踢出房间,暂时不能进入"]];
// // 您已被移除直播,暂时不能进入
} else if (code == -20080) {
[[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveNotificationKeys.fus_BaoFang_Refresh object:nil];
// 没有私密房权限
[self.currentFunctionView fus_hideAllFunctionLayers];
[FUSAlertView showAlertWithTitle:nil message:errorDict[@"msg"] cancelButtonTitle:[NSString fus_localString:@"确定"] otherButtonTitles:nil clickBlock:^(NSInteger buttonIndex) {
[FUSLiveHelper fus_quitLiveWithCompletion:nil];
}];
} else {
// 其他情况
[FUSAlertView showAlertWithTitle:nil message:msg cancelButtonTitle:nil otherButtonTitles:@[[NSString fus_localString:@"确定"], [NSString fus_localString:@"退出"]] clickBlock:^(NSInteger buttonIndex) {
if (buttonIndex == 0) {
[self fus_audienceJoinRoomWithRoomId:currentRoomId password:password];
}else{
[FUSLiveHelper fus_quitLiveWithCompletion:nil];
}
}];
}
if(weakSelf.enterRoomFailureBlock){
weakSelf.enterRoomFailureBlock();
}
}]; }];
} }
......
...@@ -851,7 +851,7 @@ static FUSLiveGiftView *giftView = nil; ...@@ -851,7 +851,7 @@ static FUSLiveGiftView *giftView = nil;
[_gemBtn setTitle:@"0" forState:UIControlStateNormal]; [_gemBtn setTitle:@"0" forState:UIControlStateNormal];
_gemBtn.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; _gemBtn.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
_gemBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; _gemBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
[_gemBtn setImage:[FUSShowRoomCenterBunble imageNamed:@"live_room_diamond_giftPanel"] forState:UIControlStateNormal]; // [_gemBtn setImage:[FUSShowRoomCenterBunble imageNamed:@"live_room_diamond_giftPanel"] forState:UIControlStateNormal];
[_gemBtn setTitleColor:[UIColor fus_diamondBlue] forState:UIControlStateNormal]; [_gemBtn setTitleColor:[UIColor fus_diamondBlue] forState:UIControlStateNormal];
_gemBtn.titleLabel.font = [UIFont fus_themeFont:13]; _gemBtn.titleLabel.font = [UIFont fus_themeFont:13];
[_gemBtn sizeToFit]; [_gemBtn sizeToFit];
......
...@@ -5829,9 +5829,10 @@ BDAlphaPlayerMetalViewDelegate ...@@ -5829,9 +5829,10 @@ BDAlphaPlayerMetalViewDelegate
self.passwordRoomIconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(12, self.popularView.bottom + 10, 49, 49)]; self.passwordRoomIconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(12, self.popularView.bottom + 10, 49, 49)];
self.passwordRoomIconImageView.centerX = self.popularView.centerX; self.passwordRoomIconImageView.centerX = self.popularView.centerX;
self.passwordRoomIconImageView.image = [FUSShowRoomCenterBunble imageNamed:@"live_room_password_room_icon"]; self.passwordRoomIconImageView.image = [FUSShowRoomCenterBunble imageNamed:@"live_room_password_room_icon"];
[[self fus_viewWithLayer:FUSLiveFunctionLayerRoomInfos] addSubview:self.passwordRoomIconImageView]; [[self fus_viewWithLayer:FUSLiveFunctionLayerRoomInfos] addSubview:self.passwordRoomIconImageView];
if (FUSLiveHelper.shareInstance.liveType == FUSLiveTypeAnchor) {
[self.passwordAnimPlayView stop]; [self.passwordAnimPlayView stop];
[self.passwordAnimPlayView removeFromSuperview]; [self.passwordAnimPlayView removeFromSuperview];
self.passwordAnimPlayView = nil; self.passwordAnimPlayView = nil;
...@@ -5849,6 +5850,7 @@ BDAlphaPlayerMetalViewDelegate ...@@ -5849,6 +5850,7 @@ BDAlphaPlayerMetalViewDelegate
configuration.orientation = BDAlphaPlayerOrientationPortrait; configuration.orientation = BDAlphaPlayerOrientationPortrait;
[self.passwordAnimPlayView playWithMetalConfiguration:configuration]; [self.passwordAnimPlayView playWithMetalConfiguration:configuration];
}
} }
- (void)fus_setAnchorAudioClose:(BOOL)closed { - (void)fus_setAnchorAudioClose:(BOOL)closed {
......
...@@ -327,7 +327,11 @@ ...@@ -327,7 +327,11 @@
[dict enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, FUSLiveShareToChatModel *_Nonnull model, BOOL * _Nonnull stop) { [dict enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, FUSLiveShareToChatModel *_Nonnull model, BOOL * _Nonnull stop) {
[FUSRouter.chatRouter fus_sendLiveRoomShareWith:roomModel toUser:model.uid userFace:model.face userNick:model.nickname password:roomModel.encryptionData.password]; NSString *password = @"";
if (FUSLiveHelper.shareInstance.roomScopeType == FUSLiveRoomScopeTypePassword) {
password = roomModel.encryptionData.password;
}
[FUSRouter.chatRouter fus_sendLiveRoomShareWith:roomModel toUser:model.uid userFace:model.face userNick:model.nickname password:password];
}]; }];
[FUSLoadingView fus_dismissProgressView]; [FUSLoadingView fus_dismissProgressView];
[FUSDialogView fus_showDialog:[NSString fus_localString:@"分享成功"]]; [FUSDialogView fus_showDialog:[NSString fus_localString:@"分享成功"]];
......
...@@ -11,13 +11,14 @@ import RxSwift ...@@ -11,13 +11,14 @@ import RxSwift
@objcMembers public class FUSLiveStartSetPasswordView: UIView { @objcMembers public class FUSLiveStartSetPasswordView: UIView {
///可以用这个快速创建,本身内部不请求改变房间类型,用于开播前 ///可以用这个快速创建,本身内部不请求改变房间类型,用于开播前
static public func fus_create(clickHandler: @escaping (_ password: String) -> Void){ static public func fus_create(clickHandler: @escaping (_ succeed: Bool, _ password: String) -> Void){
guard let showVC = UINavigationController.fus_top() else { return } guard let showVC = UINavigationController.fus_top() else { return }
let view = FUSLiveStartSetPasswordView(frame: showVC.view.bounds, isAudience: false, password: FUSRouter.live().liveRoomPassword()) let view = FUSLiveStartSetPasswordView(frame: showVC.view.bounds, isAudience: false, password: FUSRouter.live().liveRoomPassword())
view.clickHandler = { password in
clickHandler(password) view.clickWithSucceedHandler = { succeed, password in
clickHandler(succeed, password)
} }
showVC.view.addSubview(view) showVC.view.addSubview(view)
...@@ -43,7 +44,6 @@ import RxSwift ...@@ -43,7 +44,6 @@ import RxSwift
let disposeBag = DisposeBag() let disposeBag = DisposeBag()
var clickHandler:((String)->Void)?
var clickWithSucceedHandler:((Bool, String)->Void)? var clickWithSucceedHandler:((Bool, String)->Void)?
var password:String = "" var password:String = ""
var isAudience:Bool = false var isAudience:Bool = false
...@@ -218,7 +218,6 @@ import RxSwift ...@@ -218,7 +218,6 @@ import RxSwift
} }
func fus_dismissWithAnimation(){ func fus_dismissWithAnimation(){
self.clickHandler?(self.password)
UIView.animate(withDuration: 0.3) { UIView.animate(withDuration: 0.3) {
self.contentView.y = UIView.fus_screenH() self.contentView.y = UIView.fus_screenH()
} completion: { _ in } completion: { _ in
......
...@@ -155,11 +155,14 @@ import FUSCommon ...@@ -155,11 +155,14 @@ import FUSCommon
self.contentView.y = UIView.fus_screenH() self.contentView.y = UIView.fus_screenH()
} completion: { _ in } completion: { _ in
FUSLiveStartSetPasswordView.fus_create { [weak self] password in FUSLiveStartSetPasswordView.fus_create(clickHandler: { [weak self] succeed, password in
guard let self = self else { return } guard let self = self else { return }
//在内部请求 //在内部请求
if succeed {
self.fus_changeScopeRequest(scopeType: self.scopeType, password: password) self.fus_changeScopeRequest(scopeType: self.scopeType, password: password)
} }
})
} }
} }
} }
......
...@@ -197,15 +197,20 @@ import FUSCommon ...@@ -197,15 +197,20 @@ import FUSCommon
guard let model = self?.startLiveModel.value else { return } guard let model = self?.startLiveModel.value else { return }
FUSLiveStartSetPrivacyView.fus_create(defaultScopeType: model.scopeType) {[weak self] scopeType in FUSLiveStartSetPrivacyView.fus_create(defaultScopeType: model.scopeType) {[weak self] scopeType in
model.scopeType = scopeType
if scopeType == .password { if scopeType == .password {
FUSLiveStartSetPasswordView.fus_create { password in FUSLiveStartSetPasswordView.fus_create(clickHandler: { [weak self] succeed, password in
if succeed {
model.scopeType = scopeType
model.password = password model.password = password
FUSLiveHelper.shareInstance().roomInfoModel?.encryptionData.password = password FUSLiveHelper.shareInstance().roomInfoModel?.encryptionData.password = password
self?.startLiveModel.accept(model) self?.startLiveModel.accept(model)
} }
})
} else { } else {
model.scopeType = scopeType
self?.startLiveModel.accept(model) self?.startLiveModel.accept(model)
} }
} }
...@@ -221,11 +226,13 @@ import FUSCommon ...@@ -221,11 +226,13 @@ import FUSCommon
//关闭按钮 //关闭按钮
passwordBtn.rx.tap.subscribe(onNext: {[weak self] in passwordBtn.rx.tap.subscribe(onNext: {[weak self] in
guard let model = self?.startLiveModel.value else { return } guard let model = self?.startLiveModel.value else { return }
FUSLiveStartSetPasswordView.fus_create { password in FUSLiveStartSetPasswordView.fus_create(clickHandler: { [weak self] succeed, password in
if succeed {
model.password = password model.password = password
FUSLiveHelper.shareInstance().roomInfoModel?.encryptionData.password = password FUSLiveHelper.shareInstance().roomInfoModel?.encryptionData.password = password
self?.startLiveModel.accept(model) self?.startLiveModel.accept(model)
} }
})
}).disposed(by: disposeBag) }).disposed(by: disposeBag)
//关闭按钮 //关闭按钮
......
...@@ -32,8 +32,6 @@ ...@@ -32,8 +32,6 @@
#import "FUSCommon/FUSCommon-Swift.h" #import "FUSCommon/FUSCommon-Swift.h"
//#import <Bugly/Bugly.h>
@interface FUSLoginHelper () @interface FUSLoginHelper ()
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment