Commit 51a4c3d5 by suolong

Merge branch 'feature/v57版本pk迁移' of http://git.yabolive.net:88/pidan/FuSiLive…

Merge branch 'feature/v57版本pk迁移' of http://git.yabolive.net:88/pidan/FuSiLive into feature/v57版本pk迁移
parents 3455844c 3a7cd110
...@@ -60,4 +60,7 @@ ...@@ -60,4 +60,7 @@
*/ */
+ (void)fus_addSocketMessageWithModel:(FUSSocketMessageModel *)messageModel; + (void)fus_addSocketMessageWithModel:(FUSSocketMessageModel *)messageModel;
/// 重设心跳时间
+ (void)fus_setSocketHeartbeatInterval:(NSTimeInterval)interval;
@end @end
...@@ -35,6 +35,8 @@ typedef void(^ConnectBlock)(BOOL isSuccess); // 连接回调 ...@@ -35,6 +35,8 @@ typedef void(^ConnectBlock)(BOOL isSuccess); // 连接回调
FUSPublicSocketMessageDBOperate *mSockeDBOperate; // 数据库操作助手 FUSPublicSocketMessageDBOperate *mSockeDBOperate; // 数据库操作助手
ConnectBlock mConnectBlock; // Socket连接回调 ConnectBlock mConnectBlock; // Socket连接回调
NSTimeInterval mHeartbeatInterval;
} }
...@@ -89,6 +91,11 @@ typedef void(^ConnectBlock)(BOOL isSuccess); // 连接回调 ...@@ -89,6 +91,11 @@ typedef void(^ConnectBlock)(BOOL isSuccess); // 连接回调
[[FUSSocketMessageCenter shareInstance] fus_monitorSocketStatus:block]; [[FUSSocketMessageCenter shareInstance] fus_monitorSocketStatus:block];
} }
+ (void)fus_setSocketHeartbeatInterval:(NSTimeInterval)interval
{
[[FUSSocketMessageCenter shareInstance] fus_setSocketHeartbeatInterval:interval];
}
/** /**
* 切断Socket * 切断Socket
...@@ -143,6 +150,8 @@ typedef void(^ConnectBlock)(BOOL isSuccess); // 连接回调 ...@@ -143,6 +150,8 @@ typedef void(^ConnectBlock)(BOOL isSuccess); // 连接回调
mSockeDBOperate = [FUSRouter.chatRouter createSocketMessageDBOperate]; mSockeDBOperate = [FUSRouter.chatRouter createSocketMessageDBOperate];
// 监测Socket连接状态 // 监测Socket连接状态
[self fus_monitorSocketStatus:nil]; [self fus_monitorSocketStatus:nil];
// 默认心跳30
mHeartbeatInterval = 30;
} }
return self; return self;
} }
...@@ -222,7 +231,7 @@ typedef void(^ConnectBlock)(BOOL isSuccess); // 连接回调 ...@@ -222,7 +231,7 @@ typedef void(^ConnectBlock)(BOOL isSuccess); // 连接回调
// 每隔30s像服务器发送心跳包 // 每隔30s像服务器发送心跳包
[mConnectTimer invalidate]; [mConnectTimer invalidate];
mConnectTimer = [NSTimer scheduledTimerWithTimeInterval:30 target:[YYWeakProxy proxyWithTarget:self] selector:@selector(sendHeartbeatPacket) userInfo:nil repeats:YES]; mConnectTimer = [NSTimer scheduledTimerWithTimeInterval:[self heartbeatIntervalValue] target:[YYWeakProxy proxyWithTarget:self] selector:@selector(sendHeartbeatPacket) userInfo:nil repeats:YES];
[mConnectTimer fire]; [mConnectTimer fire];
if (mConnectBlock) mConnectBlock(YES); if (mConnectBlock) mConnectBlock(YES);
...@@ -352,6 +361,27 @@ typedef void(^ConnectBlock)(BOOL isSuccess); // 连接回调 ...@@ -352,6 +361,27 @@ typedef void(^ConnectBlock)(BOOL isSuccess); // 连接回调
[FUSSocketMessageHelper fus_sendSocketHeartbeatMessage]; [FUSSocketMessageHelper fus_sendSocketHeartbeatMessage];
} }
- (void)fus_setSocketHeartbeatInterval:(NSTimeInterval)interval
{
if (interval > 0) {
mHeartbeatInterval = interval;
if ([self isConnected]) {
[mConnectTimer invalidate];
mConnectTimer = [NSTimer scheduledTimerWithTimeInterval:[self heartbeatIntervalValue] target:[YYWeakProxy proxyWithTarget:self] selector:@selector(sendHeartbeatPacket) userInfo:nil repeats:YES];
[mConnectTimer fire];
// 先发送一次
[self sendHeartbeatPacket];
}
}
}
- (NSTimeInterval)heartbeatIntervalValue
{
if (mHeartbeatInterval > 0) return mHeartbeatInterval;
return 30;
}
#pragma mark -- 接收消息处理 #pragma mark -- 接收消息处理
......
...@@ -40,6 +40,10 @@ ...@@ -40,6 +40,10 @@
*/ */
+ (void)fus_sendSocketHeartbeatMessage; + (void)fus_sendSocketHeartbeatMessage;
/// 重设心跳时间
+ (void)fus_setSocketHeartbeatInterval:(NSTimeInterval)interval;
/** /**
* 发送文本消息 * 发送文本消息
* *
......
...@@ -46,6 +46,12 @@ typedef void(^VerifyBlock)(NSDictionary *dataDict); // Socket验证回调 ...@@ -46,6 +46,12 @@ typedef void(^VerifyBlock)(NSDictionary *dataDict); // Socket验证回调
[[FUSSocketMessageHelper shareInstance] fus_sendSocketHeartbeatMessage]; [[FUSSocketMessageHelper shareInstance] fus_sendSocketHeartbeatMessage];
} }
+ (void)fus_setSocketHeartbeatInterval:(NSTimeInterval)interval {
if (interval > 0) {
[FUSSocketMessageCenter fus_setSocketHeartbeatInterval:interval];
}
}
/** /**
* 发送文本消息 * 发送文本消息
......
...@@ -673,7 +673,7 @@ ...@@ -673,7 +673,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements; CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 202506260030; CURRENT_PROJECT_VERSION = 202506260031;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 6GG26BHUMC; DEVELOPMENT_TEAM = 6GG26BHUMC;
ENABLE_ON_DEMAND_RESOURCES = NO; ENABLE_ON_DEMAND_RESOURCES = NO;
...@@ -938,7 +938,7 @@ ...@@ -938,7 +938,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements; CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 202506260030; CURRENT_PROJECT_VERSION = 202506260031;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 6GG26BHUMC; DEVELOPMENT_TEAM = 6GG26BHUMC;
ENABLE_ON_DEMAND_RESOURCES = NO; ENABLE_ON_DEMAND_RESOURCES = NO;
......
...@@ -2779,10 +2779,14 @@ ...@@ -2779,10 +2779,14 @@
inputFileListPaths = ( inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-FUSChatCenterModule/Pods-FUSChatCenterModule-resources-${CONFIGURATION}-input-files.xcfilelist", "${PODS_ROOT}/Target Support Files/Pods-FUSChatCenterModule/Pods-FUSChatCenterModule-resources-${CONFIGURATION}-input-files.xcfilelist",
); );
inputPaths = (
);
name = "[CP] Copy Pods Resources"; name = "[CP] Copy Pods Resources";
outputFileListPaths = ( outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-FUSChatCenterModule/Pods-FUSChatCenterModule-resources-${CONFIGURATION}-output-files.xcfilelist", "${PODS_ROOT}/Target Support Files/Pods-FUSChatCenterModule/Pods-FUSChatCenterModule-resources-${CONFIGURATION}-output-files.xcfilelist",
); );
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-FUSChatCenterModule/Pods-FUSChatCenterModule-resources.sh\"\n"; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-FUSChatCenterModule/Pods-FUSChatCenterModule-resources.sh\"\n";
......
...@@ -239,38 +239,41 @@ class FUSSwiftAgoraSession: NSObject { ...@@ -239,38 +239,41 @@ class FUSSwiftAgoraSession: NSObject {
return return
} }
FUSLog.info("------执行加入频道:\(channelId) uid:\(uid)") FUSLog.info("------执行加入频道: rtcToken:\(self.rtcData.rtcToken) channelId:\(channelId) uid:\(uid)")
let code = rtcEngine?.joinChannel(byToken: self.rtcData.rtcToken, channelId: channelId, info: nil, uid: uid.uintValue, rtcSuccess: nil) { [weak self] channelid, uid, elapsed in
if rtcEngine is FUSSingleChatAgoraRTC {
FUSLog.info("------加入频道成功:\(channelId) uid:\(uid)")
completion?(true, channelId)
self?.state.accept(.joinedChannel)
switch type { let code = rtcEngine?.joinChannel(byToken: self.rtcData.rtcToken, channelId: channelId, info: nil, uid: uid.uintValue, rtcSuccess: nil) { [weak self] channelid, uid, elapsed in
case .none:
break FUSLog.info("------加入频道成功:\(channelId) uid:\(uid)")
case .audio: completion?(true, channelId)
// self.videoEnable = false self?.state.accept(.joinedChannel)
self?.audioEnable = true
case .video: switch type {
self?.videoEnable = true case .none:
self?.audioEnable = true break
break case .audio:
default: // self.videoEnable = false
break self?.audioEnable = true
case .video:
self?.videoEnable = true
self?.audioEnable = true
break
default:
break
}
} }
} if code != 0 {
if FUSConfig.sharedInstanced().devConfigs.devLevel == .developer{
if code != 0 { FUSDialogView.fus_showDialog("加入频道失败:\(channelId) uid:\(uid) code:\(String(describing: code))")
if FUSConfig.sharedInstanced().devConfigs.devLevel == .developer{ }
FUSDialogView.fus_showDialog("加入频道失败:\(channelId) uid:\(uid) code:\(String(describing: code))") sessionType.accept(.none)
completion?(false, "")
} }
sessionType.accept(.none)
completion?(false, "")
} }
else if rtcEngine is FUSSingleChatByteRTC {
if rtcEngine is FUSSingleChatByteRTC {
rtcEngine?.joinChannel(byToken: self.rtcData.rtcToken, channelId: channelId, info: nil, uid: uid.uintValue, rtcSuccess: {[weak self] code in rtcEngine?.joinChannel(byToken: self.rtcData.rtcToken, channelId: channelId, info: nil, uid: uid.uintValue, rtcSuccess: {[weak self] code in
FUSLog.info("------RTC test 加入频道成功:\(channelId) uid:\(uid)") FUSLog.info("------RTC test 加入频道成功:\(channelId) uid:\(uid)")
......
...@@ -142,7 +142,7 @@ import SwiftyJSON ...@@ -142,7 +142,7 @@ import SwiftyJSON
self.otherFriendInfoIsReady.distinctUntilChanged() self.otherFriendInfoIsReady.distinctUntilChanged()
.timeout(.seconds(10), scheduler: MainScheduler.instance) .timeout(.seconds(10), scheduler: MainScheduler.instance)
.subscribe(onNext: {[weak self] model in .subscribe(onNext: {[weak self] model in
print(model?.uid) FUSLog.info("FUSChatCallHelper---监听获取到对方的信息:\(model?.uid ?? "")")
guard let model = model else { return } guard let model = model else { return }
if model.uid == fid{ if model.uid == fid{
FUSLoadingView.fus_dismissProgressView() FUSLoadingView.fus_dismissProgressView()
...@@ -713,6 +713,19 @@ import SwiftyJSON ...@@ -713,6 +713,19 @@ import SwiftyJSON
setupCMDMessage() setupCMDMessage()
setupSocketListener() setupSocketListener()
self.callType
.map({ $0 != .none })
.distinctUntilChanged()
.skip(1)
.subscribe(onNext: { isCall in
if isCall {
FUSSocketMessageHelper.fus_setSocketHeartbeatInterval(10.0)
}else {
FUSSocketMessageHelper.fus_setSocketHeartbeatInterval(30.0)
}
})
.disposed(by: disposeBag)
// 通话计时 // 通话计时
state.distinctUntilChanged().subscribe(onNext: {[weak self] state in state.distinctUntilChanged().subscribe(onNext: {[weak self] state in
...@@ -1177,6 +1190,7 @@ extension FUSChatCallHelper { ...@@ -1177,6 +1190,7 @@ extension FUSChatCallHelper {
// 其他情况统一为通话失败 // 其他情况统一为通话失败
self!.endCall(reason: .failedNeedNotice) self!.endCall(reason: .failedNeedNotice)
FUSDialogView.fus_showDialog(msg) FUSDialogView.fus_showDialog(msg)
FUSLoadingView.fus_dismissProgressView()
} }
} }
......
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