decord/source/modules/messages/VoiceSessionUtils.tsx

110 lines
4.3 KiB
TypeScript
Raw Normal View History

2026-07-24 07:16:23 +00:00
// Module ID: 7840
// Function ID: 61870
2026-07-20 16:05:17 +00:00
// Name: getSortedVoiceSessionParticipants
2026-07-24 07:16:23 +00:00
// Dependencies: [31, 6901, 1348, 1849, 7841, 566, 7756, 4360, 1212, 22, 2]
2026-07-20 16:05:17 +00:00
// Exports: getVoiceSessionMessageContent, useSortedVoiceSessionParticipants
2026-07-24 07:16:23 +00:00
// Module 7840 (getSortedVoiceSessionParticipants)
2026-07-23 10:11:24 +00:00
import result from "result";
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import closure_5 from "_isNativeReflectConstruct";
import closure_6 from "_isNativeReflectConstruct";
let require = arg1;
2026-07-20 16:05:17 +00:00
function getSortedVoiceSessionParticipants(channel_id) {
2026-07-23 10:11:24 +00:00
userAffinitiesMap = userAffinitiesMap.getUserAffinitiesMap();
const tmp = (function getVoiceSessionParticipants(call) {
let closure_0 = call;
2026-07-20 16:05:17 +00:00
call = call.call;
let reduced;
if (null != call) {
const participants = call.participants;
reduced = participants.reduce((arg0, arg1) => {
2026-07-23 10:11:24 +00:00
const user = outer2_6.getUser(arg1);
2026-07-20 16:05:17 +00:00
let tmp2 = arg0;
if (null != user) {
tmp2 = arg0;
2026-07-23 10:11:24 +00:00
if (user.id !== author.author.id) {
2026-07-20 16:05:17 +00:00
const items = [];
const arraySpreadResult = HermesBuiltin.arraySpread(arg0, 0);
items[arraySpreadResult] = user;
const sum = arraySpreadResult + 1;
tmp2 = items;
}
}
return tmp2;
}, []);
}
if (null == reduced) {
reduced = [];
}
return reduced;
2026-07-23 10:11:24 +00:00
})(channel_id);
2026-07-24 07:16:23 +00:00
return require(7841) /* maybeSortByProbability */.maybeSortByProbability(tmp, userAffinitiesMap, "VoiceSessionUtils - participants");
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const result = require("_isNativeReflectConstruct").fileFinishedImporting("modules/messages/VoiceSessionUtils.tsx");
2026-07-20 16:05:17 +00:00
export { getSortedVoiceSessionParticipants };
export const useSortedVoiceSessionParticipants = function useSortedVoiceSessionParticipants(author) {
2026-07-23 10:11:24 +00:00
const tmp = (function useVoiceSessionParticipants(author) {
const items = [outer1_6];
2026-07-20 16:05:17 +00:00
const items1 = [author.author.id, author.call];
2026-07-23 10:11:24 +00:00
return author(outer1_2[5]).useStateFromStoresArray(items, () => {
const call = closure_0.call;
2026-07-20 16:05:17 +00:00
let participants;
if (null != call) {
participants = call.participants;
}
if (null != participants) {
2026-07-23 10:11:24 +00:00
const participants1 = closure_0.call.participants;
const mapped = participants1.map((arg0) => outer3_6.getUser(arg0));
2026-07-20 16:05:17 +00:00
const found = mapped.filter((arg0) => null != arg0);
2026-07-23 10:11:24 +00:00
let found1 = found.filter((id) => id.id !== outer1_0.author.id);
2026-07-20 16:05:17 +00:00
} else {
found1 = [];
}
return found1;
}, items1);
2026-07-23 10:11:24 +00:00
})(author);
const require = tmp;
let items = [_isNativeReflectConstruct];
const stateFromStores = require(566) /* initialize */.useStateFromStores(items, () => outer1_4.getUserAffinitiesMap(), []);
let items1 = [tmp, stateFromStores];
return React.useMemo(() => tmp(outer1_2[4]).maybeSortByProbability(tmp, stateFromStores, "VoiceSessionUtils - participants"), items1);
2026-07-20 16:05:17 +00:00
};
export const getVoiceSessionMessageContent = function getVoiceSessionMessageContent(channel_id) {
2026-07-23 10:11:24 +00:00
const _require = channel.getChannel(channel_id.channel_id);
2026-07-24 07:16:23 +00:00
const tmp = importDefault(7756)(channel_id);
2026-07-23 10:11:24 +00:00
let obj = _require(4360);
2026-07-20 16:05:17 +00:00
const messageAuthor = obj.getMessageAuthor(channel_id);
const mapped = getSortedVoiceSessionParticipants(channel_id).map((user) => {
2026-07-23 10:11:24 +00:00
const obj = { user, messageAuthor: callback(outer1_2[7]).getUserAuthor(user, callback) };
2026-07-20 16:05:17 +00:00
return obj;
});
if (null == tmp) {
2026-07-23 10:11:24 +00:00
const intl = _require(1212).intl;
obj = { username: messageAuthor.nick, usernameOnClick: _require(22).identity };
let formatToPlainStringResult = intl.formatToPlainString(_require(1212).t.HzBfIN, obj);
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
const intl2 = _require(1212).intl;
obj = { userCount: mapped.length + 1, username: messageAuthor.nick, usernameOnClick: _require(22).identity };
2026-07-20 16:05:17 +00:00
const first = mapped[0];
let nick;
if (null != first) {
nick = first.messageAuthor.nick;
}
obj.username2 = nick;
2026-07-23 10:11:24 +00:00
obj.username2OnClick = _require(22).identity;
2026-07-20 16:05:17 +00:00
let nick1;
if (null != mapped[1]) {
nick1 = tmp6.messageAuthor.nick;
}
obj.username3 = nick1;
2026-07-23 10:11:24 +00:00
obj.username3OnClick = _require(22).identity;
2026-07-20 16:05:17 +00:00
obj.otherCount = mapped.length - 1;
obj.duration = tmp;
2026-07-23 10:11:24 +00:00
formatToPlainStringResult = intl2.formatToPlainString(_require(1212).t.atbXuX, obj);
2026-07-20 16:05:17 +00:00
}
return formatToPlainStringResult;
};