Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
pidan
/
FuSiLive
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
11326143
authored
Mar 07, 2026
by
ludi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成私房通话
parent
eb0c88ef
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
95 additions
and
31 deletions
DevelopmentPods/FUSCommon/FUSCommon/Classes/Foundation/Socket/SocketMessage/FUSSocketMessageCenter.h
DevelopmentPods/FUSCommon/FUSCommon/Classes/Foundation/Socket/SocketMessage/FUSSocketMessageCenter.m
DevelopmentPods/FUSCommon/FUSCommon/Classes/Foundation/Socket/SocketMessage/FUSSocketMessageHelper.h
DevelopmentPods/FUSCommon/FUSCommon/Classes/Foundation/Socket/SocketMessage/FUSSocketMessageHelper.m
FuSiLive.xcodeproj/project.pbxproj
Modules/FUSChatCenterModule/FUSChatCenterModule.xcodeproj/project.pbxproj
Modules/FUSChatCenterModule/FUSChatCenterModule/Features/InstantMessaging/Other/Agora/FUSSwiftAgoraSession.swift
Modules/FUSChatCenterModule/FUSChatCenterModule/Features/InstantMessaging/Other/FUSChatCallHelper.swift
DevelopmentPods/FUSCommon/FUSCommon/Classes/Foundation/Socket/SocketMessage/FUSSocketMessageCenter.h
View file @
11326143
...
...
@@ -60,4 +60,7 @@
*/
+
(
void
)
fus_addSocketMessageWithModel
:(
FUSSocketMessageModel
*
)
messageModel
;
/// 重设心跳时间
+
(
void
)
fus_setSocketHeartbeatInterval
:(
NSTimeInterval
)
interval
;
@end
DevelopmentPods/FUSCommon/FUSCommon/Classes/Foundation/Socket/SocketMessage/FUSSocketMessageCenter.m
View file @
11326143
...
...
@@ -35,6 +35,8 @@ typedef void(^ConnectBlock)(BOOL isSuccess); // 连接回调
FUSPublicSocketMessageDBOperate
*
mSockeDBOperate
;
// 数据库操作助手
ConnectBlock
mConnectBlock
;
// Socket连接回调
NSTimeInterval
mHeartbeatInterval
;
}
...
...
@@ -89,6 +91,11 @@ typedef void(^ConnectBlock)(BOOL isSuccess); // 连接回调
[[
FUSSocketMessageCenter
shareInstance
]
fus_monitorSocketStatus
:
block
];
}
+
(
void
)
fus_setSocketHeartbeatInterval
:
(
NSTimeInterval
)
interval
{
[[
FUSSocketMessageCenter
shareInstance
]
fus_setSocketHeartbeatInterval
:
interval
];
}
/**
* 切断Socket
...
...
@@ -143,6 +150,8 @@ typedef void(^ConnectBlock)(BOOL isSuccess); // 连接回调
mSockeDBOperate
=
[
FUSRouter
.
chatRouter
createSocketMessageDBOperate
];
// 监测Socket连接状态
[
self
fus_monitorSocketStatus
:
nil
];
// 默认心跳30
mHeartbeatInterval
=
30
;
}
return
self
;
}
...
...
@@ -222,7 +231,7 @@ typedef void(^ConnectBlock)(BOOL isSuccess); // 连接回调
// 每隔30s像服务器发送心跳包
[
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
];
if
(
mConnectBlock
)
mConnectBlock
(
YES
);
...
...
@@ -352,6 +361,27 @@ typedef void(^ConnectBlock)(BOOL isSuccess); // 连接回调
[
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 -- 接收消息处理
...
...
DevelopmentPods/FUSCommon/FUSCommon/Classes/Foundation/Socket/SocketMessage/FUSSocketMessageHelper.h
View file @
11326143
...
...
@@ -40,6 +40,10 @@
*/
+
(
void
)
fus_sendSocketHeartbeatMessage
;
/// 重设心跳时间
+
(
void
)
fus_setSocketHeartbeatInterval
:(
NSTimeInterval
)
interval
;
/**
* 发送文本消息
*
...
...
DevelopmentPods/FUSCommon/FUSCommon/Classes/Foundation/Socket/SocketMessage/FUSSocketMessageHelper.m
View file @
11326143
...
...
@@ -46,6 +46,12 @@ typedef void(^VerifyBlock)(NSDictionary *dataDict); // Socket验证回调
[[
FUSSocketMessageHelper
shareInstance
]
fus_sendSocketHeartbeatMessage
];
}
+
(
void
)
fus_setSocketHeartbeatInterval
:
(
NSTimeInterval
)
interval
{
if
(
interval
>
0
)
{
[
FUSSocketMessageCenter
fus_setSocketHeartbeatInterval
:
interval
];
}
}
/**
* 发送文本消息
...
...
FuSiLive.xcodeproj/project.pbxproj
View file @
11326143
...
...
@@ -673,7 +673,7 @@
CLANG_CXX_LANGUAGE_STANDARD
=
"gnu++17"
;
CODE_SIGN_ENTITLEMENTS
=
FuSiLive/FuSiLive.entitlements
;
CODE_SIGN_STYLE
=
Automatic
;
CURRENT_PROJECT_VERSION
=
20250626003
0
;
CURRENT_PROJECT_VERSION
=
20250626003
1
;
DEFINES_MODULE
=
YES
;
DEVELOPMENT_TEAM
=
6GG26BHUMC
;
ENABLE_ON_DEMAND_RESOURCES
=
NO
;
...
...
@@ -938,7 +938,7 @@
CLANG_CXX_LANGUAGE_STANDARD
=
"gnu++17"
;
CODE_SIGN_ENTITLEMENTS
=
FuSiLive/FuSiLive.entitlements
;
CODE_SIGN_STYLE
=
Automatic
;
CURRENT_PROJECT_VERSION
=
20250626003
0
;
CURRENT_PROJECT_VERSION
=
20250626003
1
;
DEFINES_MODULE
=
YES
;
DEVELOPMENT_TEAM
=
6GG26BHUMC
;
ENABLE_ON_DEMAND_RESOURCES
=
NO
;
...
...
Modules/FUSChatCenterModule/FUSChatCenterModule.xcodeproj/project.pbxproj
View file @
11326143
...
...
@@ -2779,10 +2779,14 @@
inputFileListPaths
=
(
"${PODS_ROOT}/Target Support Files/Pods-FUSChatCenterModule/Pods-FUSChatCenterModule-resources-${CONFIGURATION}-input-files.xcfilelist"
,
);
inputPaths
=
(
);
name
=
"[CP] Copy Pods Resources"
;
outputFileListPaths
=
(
"${PODS_ROOT}/Target Support Files/Pods-FUSChatCenterModule/Pods-FUSChatCenterModule-resources-${CONFIGURATION}-output-files.xcfilelist"
,
);
outputPaths
=
(
);
runOnlyForDeploymentPostprocessing
=
0
;
shellPath
=
/bin/sh
;
shellScript
=
"\"${PODS_ROOT}/Target Support Files/Pods-FUSChatCenterModule/Pods-FUSChatCenterModule-resources.sh\"\n"
;
...
...
Modules/FUSChatCenterModule/FUSChatCenterModule/Features/InstantMessaging/Other/Agora/FUSSwiftAgoraSession.swift
View file @
11326143
...
...
@@ -239,38 +239,41 @@ class FUSSwiftAgoraSession: NSObject {
return
}
FUSLog
.
info
(
"------执行加入频道:
\(
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
FUSLog
.
info
(
"------加入频道成功:
\(
channelId
)
uid:
\(
uid
)
"
)
completion
?(
true
,
channelId
)
self
?
.
state
.
accept
(
.
joinedChannel
)
FUSLog
.
info
(
"------执行加入频道: rtcToken:
\(
self
.
rtcData
.
rtcToken
)
channelId:
\(
channelId
)
uid:
\(
uid
)
"
)
if
rtcEngine
is
FUSSingleChatAgoraRTC
{
switch
type
{
case
.
none
:
break
case
.
audio
:
// self.videoEnable = false
self
?
.
audioEnable
=
true
case
.
video
:
self
?
.
videoEnable
=
true
self
?
.
audioEnable
=
true
break
default
:
break
let
code
=
rtcEngine
?
.
joinChannel
(
byToken
:
self
.
rtcData
.
rtcToken
,
channelId
:
channelId
,
info
:
nil
,
uid
:
uid
.
uintValue
,
rtcSuccess
:
nil
)
{
[
weak
self
]
channelid
,
uid
,
elapsed
in
FUSLog
.
info
(
"------加入频道成功:
\(
channelId
)
uid:
\(
uid
)
"
)
completion
?(
true
,
channelId
)
self
?
.
state
.
accept
(
.
joinedChannel
)
switch
type
{
case
.
none
:
break
case
.
audio
:
// self.videoEnable = false
self
?
.
audioEnable
=
true
case
.
video
:
self
?
.
videoEnable
=
true
self
?
.
audioEnable
=
true
break
default
:
break
}
}
}
if
code
!=
0
{
if
FUSConfig
.
sharedInstanced
()
.
devConfigs
.
devLevel
==
.
developer
{
FUSDialogView
.
fus_showDialog
(
"加入频道失败:
\(
channelId
)
uid:
\(
uid
)
code:
\(
String
(
describing
:
code
)
)
"
)
if
code
!=
0
{
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
,
""
)
}
if
rtcEngine
is
FUSSingleChatByteRTC
{
else
if
rtcEngine
is
FUSSingleChatByteRTC
{
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
)
"
)
...
...
Modules/FUSChatCenterModule/FUSChatCenterModule/Features/InstantMessaging/Other/FUSChatCallHelper.swift
View file @
11326143
...
...
@@ -142,7 +142,7 @@ import SwiftyJSON
self
.
otherFriendInfoIsReady
.
distinctUntilChanged
()
.
timeout
(
.
seconds
(
10
),
scheduler
:
MainScheduler
.
instance
)
.
subscribe
(
onNext
:
{[
weak
self
]
model
in
print
(
model
?
.
uid
)
FUSLog
.
info
(
"FUSChatCallHelper---监听获取到对方的信息:
\(
model
?
.
uid
??
""
)
"
)
guard
let
model
=
model
else
{
return
}
if
model
.
uid
==
fid
{
FUSLoadingView
.
fus_dismissProgressView
()
...
...
@@ -713,6 +713,19 @@ import SwiftyJSON
setupCMDMessage
()
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
...
...
@@ -1177,6 +1190,7 @@ extension FUSChatCallHelper {
// 其他情况统一为通话失败
self
!.
endCall
(
reason
:
.
failedNeedNotice
)
FUSDialogView
.
fus_showDialog
(
msg
)
FUSLoadingView
.
fus_dismissProgressView
()
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment