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
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
71 additions
and
7 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 @@
...
@@ -60,4 +60,7 @@
*/
*/
+
(
void
)
fus_addSocketMessageWithModel
:(
FUSSocketMessageModel
*
)
messageModel
;
+
(
void
)
fus_addSocketMessageWithModel
:(
FUSSocketMessageModel
*
)
messageModel
;
/// 重设心跳时间
+
(
void
)
fus_setSocketHeartbeatInterval
:(
NSTimeInterval
)
interval
;
@end
@end
DevelopmentPods/FUSCommon/FUSCommon/Classes/Foundation/Socket/SocketMessage/FUSSocketMessageCenter.m
View file @
11326143
...
@@ -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 -- 接收消息处理
...
...
DevelopmentPods/FUSCommon/FUSCommon/Classes/Foundation/Socket/SocketMessage/FUSSocketMessageHelper.h
View file @
11326143
...
@@ -40,6 +40,10 @@
...
@@ -40,6 +40,10 @@
*/
*/
+
(
void
)
fus_sendSocketHeartbeatMessage
;
+
(
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验证回调
...
@@ -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
];
}
}
/**
/**
* 发送文本消息
* 发送文本消息
...
...
FuSiLive.xcodeproj/project.pbxproj
View file @
11326143
...
@@ -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
=
20250626003
0
;
CURRENT_PROJECT_VERSION
=
20250626003
1
;
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
=
20250626003
0
;
CURRENT_PROJECT_VERSION
=
20250626003
1
;
DEFINES_MODULE
=
YES
;
DEFINES_MODULE
=
YES
;
DEVELOPMENT_TEAM
=
6GG26BHUMC
;
DEVELOPMENT_TEAM
=
6GG26BHUMC
;
ENABLE_ON_DEMAND_RESOURCES
=
NO
;
ENABLE_ON_DEMAND_RESOURCES
=
NO
;
...
...
Modules/FUSChatCenterModule/FUSChatCenterModule.xcodeproj/project.pbxproj
View file @
11326143
...
@@ -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"
;
...
...
Modules/FUSChatCenterModule/FUSChatCenterModule/Features/InstantMessaging/Other/Agora/FUSSwiftAgoraSession.swift
View file @
11326143
...
@@ -239,7 +239,10 @@ class FUSSwiftAgoraSession: NSObject {
...
@@ -239,7 +239,10 @@ class FUSSwiftAgoraSession: NSObject {
return
return
}
}
FUSLog
.
info
(
"------执行加入频道:
\(
channelId
)
uid:
\(
uid
)
"
)
FUSLog
.
info
(
"------执行加入频道: rtcToken:
\(
self
.
rtcData
.
rtcToken
)
channelId:
\(
channelId
)
uid:
\(
uid
)
"
)
if
rtcEngine
is
FUSSingleChatAgoraRTC
{
let
code
=
rtcEngine
?
.
joinChannel
(
byToken
:
self
.
rtcData
.
rtcToken
,
channelId
:
channelId
,
info
:
nil
,
uid
:
uid
.
uintValue
,
rtcSuccess
:
nil
)
{
[
weak
self
]
channelid
,
uid
,
elapsed
in
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
)
"
)
FUSLog
.
info
(
"------加入频道成功:
\(
channelId
)
uid:
\(
uid
)
"
)
...
@@ -269,8 +272,8 @@ class FUSSwiftAgoraSession: NSObject {
...
@@ -269,8 +272,8 @@ class FUSSwiftAgoraSession: NSObject {
sessionType
.
accept
(
.
none
)
sessionType
.
accept
(
.
none
)
completion
?(
false
,
""
)
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
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
)
"
)
...
...
Modules/FUSChatCenterModule/FUSChatCenterModule/Features/InstantMessaging/Other/FUSChatCallHelper.swift
View file @
11326143
...
@@ -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
()
...
@@ -714,6 +714,19 @@ import SwiftyJSON
...
@@ -714,6 +714,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
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
...
@@ -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
()
}
}
}
}
...
...
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