Merge branch 'main' of https://gitea.haiyihy.com/hy/chatapp3-flutter
This commit is contained in:
commit
3088dff966
@ -142,6 +142,7 @@ class RealTimeCommunicationManager extends ChangeNotifier {
|
|||||||
var rtcToken = await SCAccountRepository().getRtcToken(
|
var rtcToken = await SCAccountRepository().getRtcToken(
|
||||||
currenRoom?.roomProfile?.roomProfile?.id ?? "",
|
currenRoom?.roomProfile?.roomProfile?.id ?? "",
|
||||||
AccountStorage().getCurrentUser()?.userProfile?.id ?? "",
|
AccountStorage().getCurrentUser()?.userProfile?.id ?? "",
|
||||||
|
isPublisher: isOnMai(),
|
||||||
);
|
);
|
||||||
engine?.renewToken(rtcToken.rtcToken ?? "");
|
engine?.renewToken(rtcToken.rtcToken ?? "");
|
||||||
},
|
},
|
||||||
@ -151,6 +152,7 @@ class RealTimeCommunicationManager extends ChangeNotifier {
|
|||||||
var rtcToken = await SCAccountRepository().getRtcToken(
|
var rtcToken = await SCAccountRepository().getRtcToken(
|
||||||
currenRoom?.roomProfile?.roomProfile?.id ?? "",
|
currenRoom?.roomProfile?.roomProfile?.id ?? "",
|
||||||
AccountStorage().getCurrentUser()?.userProfile?.id ?? "",
|
AccountStorage().getCurrentUser()?.userProfile?.id ?? "",
|
||||||
|
isPublisher: false,
|
||||||
);
|
);
|
||||||
await engine?.joinChannel(
|
await engine?.joinChannel(
|
||||||
token: rtcToken.rtcToken ?? "",
|
token: rtcToken.rtcToken ?? "",
|
||||||
|
|||||||
@ -67,7 +67,11 @@ abstract class SocialChatUserRepository {
|
|||||||
Future anchorHeartbeat(String roomId);
|
Future anchorHeartbeat(String roomId);
|
||||||
|
|
||||||
///声网token
|
///声网token
|
||||||
Future<SCRtcTokenRes> getRtcToken(String channel, String userId);
|
Future<SCRtcTokenRes> getRtcToken(
|
||||||
|
String channel,
|
||||||
|
String userId, {
|
||||||
|
bool isPublisher = false,
|
||||||
|
});
|
||||||
|
|
||||||
///退出房间
|
///退出房间
|
||||||
Future<bool> quitRoom(String roomId);
|
Future<bool> quitRoom(String roomId);
|
||||||
|
|||||||
@ -211,10 +211,18 @@ class SCAccountRepository implements SocialChatUserRepository {
|
|||||||
|
|
||||||
///external/im-trtc/tmp/agora/sig
|
///external/im-trtc/tmp/agora/sig
|
||||||
@override
|
@override
|
||||||
Future<SCRtcTokenRes> getRtcToken(String channel, String userId) async {
|
Future<SCRtcTokenRes> getRtcToken(
|
||||||
|
String channel,
|
||||||
|
String userId, {
|
||||||
|
bool isPublisher = false,
|
||||||
|
}) async {
|
||||||
final result = await http.get(
|
final result = await http.get(
|
||||||
"2572c69d25a0946b0cb35b24bdfcd61c9bcef4afdaced7dfc47a641bd9584f96",
|
"2572c69d25a0946b0cb35b24bdfcd61c9bcef4afdaced7dfc47a641bd9584f96",
|
||||||
queryParams: {"channelName": channel, "userId": userId},
|
queryParams: {
|
||||||
|
"channelName": channel,
|
||||||
|
"userId": userId,
|
||||||
|
"isPublisher": isPublisher,
|
||||||
|
},
|
||||||
fromJson: (json) => SCRtcTokenRes.fromJson(json),
|
fromJson: (json) => SCRtcTokenRes.fromJson(json),
|
||||||
);
|
);
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user