decord/source/modules/shared_space_warnings/SharedSpacesWarningManager.tsx
github-actions 777dc50a28 chore: update source for alpha 346.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4790.js (118.4 MB)
2026-09-10 19:12:31 +00:00

187 lines
6.7 KiB
TypeScript

// Module ID: 13809
// Function ID: 13810
// Name: SharedSpacesWarningManager
// Dependencies: [1957, 4628, 4253, 13810, 13808, 1090, 13811, 1093, 13815, 7170, 2]
// Exports: userBlockedWarningInCooldown, voiceBlockedWarningInCooldownForUsers
// Module 13809 (SharedSpacesWarningManager)
import DurationsDefault from "Durations" /* 1090 */;
import ConstantsIOS from "ConstantsIOS" /* 1093 */;
import showGdmBlockedUserModal from "showGdmBlockedUserModal" /* 13811 */;
import showVoiceChannelBlockedUserWarning from "showVoiceChannelBlockedUserWarning" /* 13815 */;
import ChannelStore from "ChannelStore" /* 1957 */;
import RTCConnectionStore from "RTCConnectionStore" /* 4628 */;
import RelationshipStore from "RelationshipStore" /* 4253 */;
import VoiceChannelBlockedUserStore from "VoiceChannelBlockedUserStore" /* 13808 */;
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 7170 */;
require = fn;
function handleChannelSelect(channelId) {
channelId = channelId.channelId;
if (null != channelId) {
const channel = ChannelStore.getChannel(channelId);
if (null != channel) {
if (channel.isGroupDM()) {
const recipients = channel.recipients;
const found = recipients.filter((item) => RelationshipStore.isBlocked(item));
const recipients1 = channel.recipients;
const found1 = recipients1.filter((item) => RelationshipStore.isIgnored(item));
if (tmp) {
let blockedUserWarningDismissed = channel.blockedUserWarningDismissed;
if (!blockedUserWarningDismissed) {
let num2 = hasOwnProperty(channelId);
if (num2 == null) {
num2 = 0;
}
const _Date = Date;
blockedUserWarningDismissed = num2 > Date.now() - closure_11;
}
if (!blockedUserWarningDismissed) {
const obj2 = { channelId, blockedUserIds: found, ignoredUserIds: found1 };
const result = showGdmBlockedUserModal.showGdmBlockedUserModal(obj2);
}
}
tmp = found.length > 0 || found1.length > 0;
}
}
}
}
function handleAppStateChanged(state) {
if (state.state === ConstantsIOS.AppStates.ACTIVE) {
const channelId = RTCConnectionStore.getChannelId();
if (null != channelId) {
const blockedUsersForVoiceChannel = VoiceChannelBlockedUserStore.getBlockedUsersForVoiceChannel(channelId);
const ignoredUsersForVoiceChannel = VoiceChannelBlockedUserStore.getIgnoredUsersForVoiceChannel(channelId);
if (blockedUsersForVoiceChannel.size > 0) {
if (React6()) {
const _Set = Set;
const items = [];
HermesBuiltin.arraySpread(ignoredUsersForVoiceChannel, HermesBuiltin.arraySpread(blockedUsersForVoiceChannel, 0));
const set = new Set(items);
let num3 = React5();
if (num3 == null) {
num3 = 0;
}
const _Date = Date;
let everyResult = num3 > Date.now() - HOUR;
if (!everyResult) {
const _Array = Array;
everyResult = Array.from(set).every((item) => {
let flag = false;
{
let num = closure_1_6(item);
if (num == null) {
num = 0;
}
const _Date = Date;
flag = num > Date.now() - closure_1_12;
}
return flag;
});
const arr = Array.from(set);
}
if (!everyResult) {
const items1 = [];
HermesBuiltin.arraySpread(ignoredUsersForVoiceChannel, HermesBuiltin.arraySpread(blockedUsersForVoiceChannel, 0));
const result = showVoiceChannelBlockedUserWarning.showVoiceChannelBlockedUserWarning(channelId, items1[0]);
const tmpResult = showVoiceChannelBlockedUserWarning;
}
}
}
React7();
} else {
React7();
}
}
}
const SharedSpacesWarningStore = fn(13810);
({ getChannelDismissTimestamp: hasOwnProperty, getUserDismissTimestamp: metroRequire, getGlobalDismissTimestamp: closure_7, isBlockedWarningQueued: closure_8, dequeueBlockWarning: closure_9 } = SharedSpacesWarningStore);
let closure_11 = 3 * DurationsDefault.Millis.DAY;
let closure_12 = 2 * DurationsDefault.Millis.DAY;
const HOUR = DurationsDefault.Millis.HOUR;
class SharedSpacesWarningManager extends tmp3 {
constructor() {
applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
obj = { CHANNEL_SELECT: handleChannelSelect, APP_STATE_UPDATE: handleAppStateChanged };
applyArgumentsResult.actions = obj;
return applyArgumentsResult;
}
}
SharedSpacesWarningManager.prototype["handleBlockedOrIgnoredUserVoiceChannelJoin"] = function handleBlockedOrIgnoredUserVoiceChannelJoin(channelId, userId) {
channelId = RTCConnectionStore.getChannelId();
if (channelId === channelId) {
if (null != ChannelStore.getChannel(channelId)) {
let num = React5();
if (num == null) {
num = 0;
}
const _Date = Date;
const tmp5 = num <= Date.now() - HOUR;
let tmp6 = !tmp5;
if (tmp5) {
let num2 = timestampProducer(userId);
if (num2 == null) {
num2 = 0;
}
const _Date2 = Date;
tmp6 = num2 > Date.now() - closure_12;
}
if (!tmp6) {
const result = showVoiceChannelBlockedUserWarning.showVoiceChannelBlockedUserWarning(channelId, userId);
}
}
}
};
const sharedSpacesWarningManager = new SharedSpacesWarningManager();
const size = fn(2);
let result = size.fileFinishedImporting("modules/shared_space_warnings/SharedSpacesWarningManager.tsx");
export default sharedSpacesWarningManager;
export const voiceBlockedWarningInCooldownForUsers = function voiceBlockedWarningInCooldownForUsers(arg0) {
let num = React5();
if (num == null) {
num = 0;
}
let everyResult = num > Date.now() - HOUR;
if (!everyResult) {
const _Array = Array;
everyResult = Array.from(arg0).every((item) => {
let flag = false;
{
let num = closure_1_6(item);
if (num == null) {
num = 0;
}
const _Date = Date;
flag = num > Date.now() - closure_1_12;
}
return flag;
});
const arr = Array.from(arg0);
}
return everyResult;
};
export const userBlockedWarningInCooldown = function userBlockedWarningInCooldown(arg0) {
let flag = arg1;
if (arg1 === undefined) {
flag = false;
}
if (!flag) {
let num = React5();
if (num == null) {
num = 0;
}
const _Date = Date;
flag = num <= Date.now() - HOUR;
}
let tmp5 = !flag;
if (flag) {
let num2 = timestampProducer(arg0);
if (num2 == null) {
num2 = 0;
}
const _Date2 = Date;
tmp5 = num2 > Date.now() - closure_12;
}
return tmp5;
};