265 lines
14 KiB
TypeScript
265 lines
14 KiB
TypeScript
/* Metro module 12580; source: modules/shared_space_warnings/SharedSpacesWarningManager.tsx; dependencies: [6, 7, 15, 17, 18, 1379, 4294, 3793, 12581, 12579, 672, 12582, 676, 12586, 4860, 2] */
|
|
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
|
|
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
|
|
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
|
|
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
|
|
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
|
|
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
|
|
import RelationshipStore from '../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */
|
|
import RTCConnectionStore from '../../stores/RTCConnectionStore.tsx'; /* Metro dependency 4294 */
|
|
import VoiceChannelBlockedUserStore from './VoiceChannelBlockedUserStore.tsx'; /* Metro dependency 12579 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ConstantsIOSModule from '../../ConstantsIOS.tsx'; /* Metro dependency 676 */
|
|
import * as SharedSpacesWarningStoreModule from './SharedSpacesWarningStore.tsx'; /* Metro dependency 12581 */
|
|
|
|
function _fun96382(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#96382, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12770:6, offset: 0x0215c11d, size: 513 bytes, params: 8, frame: 23
|
|
const env0_0 = require;
|
|
const voiceBlockedWarningInCooldownForUsers2 = voiceBlockedWarningInCooldownForUsers;
|
|
const userBlockedWarningInCooldown2 = userBlockedWarningInCooldown;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = SharedSpacesWarningStoreModule;
|
|
const env0_10 = value.getChannelDismissTimestamp;
|
|
const env0_11 = value.getUserDismissTimestamp;
|
|
const env0_12 = value.getGlobalDismissTimestamp;
|
|
const env0_13 = value.isBlockedWarningQueued;
|
|
const env0_14 = value.dequeueBlockWarning;
|
|
let Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
let DAY = Millis.DAY;
|
|
const env0_16 = 3 * DAY;
|
|
Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
DAY = Millis.DAY;
|
|
const env0_17 = 2 * DAY;
|
|
Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
const HOUR = Millis.HOUR;
|
|
const env0_18 = 1 * HOUR;
|
|
value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
|
|
value = _fun96394(value);
|
|
value = new value();
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/shared_space_warnings/SharedSpacesWarningManager.tsx');
|
|
exports.default = value;
|
|
exports.voiceBlockedWarningInCooldownForUsers = voiceBlockedWarningInCooldownForUsers2;
|
|
exports.userBlockedWarningInCooldown = userBlockedWarningInCooldown2;
|
|
function _isNativeReflectConstruct_96383() { // fn#96383, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12770:338, offset: 0x0215c31e, size: 98 bytes, params: 1, frame: 18
|
|
var Boolean;
|
|
var prototype;
|
|
var valueOf;
|
|
var call;
|
|
var Reflect;
|
|
var construct;
|
|
var closure;
|
|
var value;
|
|
var error;
|
|
try {
|
|
Boolean = global.Boolean;
|
|
prototype = Boolean.prototype;
|
|
valueOf = prototype.valueOf;
|
|
call = valueOf.call;
|
|
Reflect = global.Reflect;
|
|
construct = Reflect.construct;
|
|
Boolean = global.Boolean;
|
|
closure = function() {
|
|
};
|
|
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
|
|
value = Reflect.apply(call, valueOf, [value]);
|
|
var result = !value;
|
|
} catch (error) {
|
|
}
|
|
return (_isNativeReflectConstruct_96383_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function handleChannelSelect_96386({channelId}) { // fn#96386, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12770:608, offset: 0x0215c380, size: 248 bytes, params: 2, frame: 17
|
|
var value;
|
|
var channel;
|
|
var recipients;
|
|
var value3;
|
|
var value4;
|
|
var length;
|
|
var value5;
|
|
if (channelId != null) {
|
|
channel = ChannelStore.getChannel(channelId);
|
|
if (channel != null) {
|
|
if (channel.isGroupDM()) {
|
|
recipients = channel.recipients;
|
|
value3 = recipients.filter(function(a0) {
|
|
return RelationshipStore.isBlocked(a0);
|
|
});
|
|
recipients = channel.recipients;
|
|
value4 = recipients.filter(_fun96388);
|
|
length = value3.length;
|
|
value5 = 0;
|
|
if (length > value5 || value4.length > value5) {
|
|
if (!(channel.blockedUserWarningDismissed || (getChannelDismissTimestamp(channelId) ?? value5) > global.Date.now() - env0_16)) {
|
|
value = require(12582) /* metro dependency 12582: showGdmBlockedUserModalNative */;
|
|
value.showGdmBlockedUserModal({channelId: channelId, blockedUserIds: value3,
|
|
ignoredUserIds: value4});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function _fun96388(a0) { // fn#96388, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12770:783, offset: 0x0215c48f, size: 23 bytes, params: 2, frame: 11
|
|
return RelationshipStore.isIgnored(a0);
|
|
}
|
|
|
|
}
|
|
|
|
function handleAppStateChanged({state}) { // fn#96389, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12770:1037, offset: 0x0215c4a6, size: 295 bytes, params: 2, frame: 20
|
|
var channelId;
|
|
var blockedUsersForVoiceChannel;
|
|
var ignoredUsersForVoiceChannel;
|
|
var voiceBlockedWarningInCooldownForUsersBinding;
|
|
var Set;
|
|
var items2;
|
|
var value5;
|
|
var set;
|
|
var showVoiceChannelBlockedUserWarning;
|
|
var value;
|
|
const AppStates = (ConstantsIOSModule).AppStates;
|
|
const ACTIVE = AppStates.ACTIVE;
|
|
if (state === ACTIVE) {
|
|
channelId = RTCConnectionStore.getChannelId();
|
|
if (channelId != null) {
|
|
blockedUsersForVoiceChannel = VoiceChannelBlockedUserStore.getBlockedUsersForVoiceChannel(channelId);
|
|
ignoredUsersForVoiceChannel = VoiceChannelBlockedUserStore.getIgnoredUsersForVoiceChannel(channelId);
|
|
if (blockedUsersForVoiceChannel.size > 0) {
|
|
if (isBlockedWarningQueued()) {
|
|
voiceBlockedWarningInCooldownForUsersBinding = voiceBlockedWarningInCooldownForUsers;
|
|
Set = global.Set;
|
|
items2 = [];
|
|
arraySpread(items2, ignoredUsersForVoiceChannel, arraySpread(items2, blockedUsersForVoiceChannel, 0,
|
|
Set),
|
|
Set);
|
|
value5 = Object.create(Set.prototype, {constructor: {value: Set}});
|
|
set = new Set();
|
|
if (voiceBlockedWarningInCooldownForUsersBinding(set instanceof Object ? set : value5)) {
|
|
dequeueBlockWarning();
|
|
} else {
|
|
value = require(12586) /* metro dependency 12586: showVoiceChannelBlockedUserWarningNative */;
|
|
showVoiceChannelBlockedUserWarning = value.showVoiceChannelBlockedUserWarning;
|
|
items2 = [];
|
|
arraySpread(items2, ignoredUsersForVoiceChannel, arraySpread(items2,
|
|
blockedUsersForVoiceChannel, 0,
|
|
Set),
|
|
Set);
|
|
Reflect.apply(showVoiceChannelBlockedUserWarning, value, [channelId, items2[0]]);
|
|
}
|
|
} else {
|
|
dequeueBlockWarning();
|
|
}
|
|
} else if (ignoredUsersForVoiceChannel.size > 0) {
|
|
if (isBlockedWarningQueued()) {
|
|
voiceBlockedWarningInCooldownForUsersBinding = voiceBlockedWarningInCooldownForUsers;
|
|
Set = global.Set;
|
|
items2 = [];
|
|
arraySpread(items2, ignoredUsersForVoiceChannel, arraySpread(items2, blockedUsersForVoiceChannel, 0,
|
|
Set),
|
|
Set);
|
|
value5 = Object.create(Set.prototype, {constructor: {value: Set}});
|
|
set = new Set();
|
|
if (voiceBlockedWarningInCooldownForUsersBinding(set instanceof Object ? set : value5)) {
|
|
dequeueBlockWarning();
|
|
} else {
|
|
value = require(12586) /* metro dependency 12586: showVoiceChannelBlockedUserWarningNative */;
|
|
showVoiceChannelBlockedUserWarning = value.showVoiceChannelBlockedUserWarning;
|
|
items2 = [];
|
|
arraySpread(items2, ignoredUsersForVoiceChannel, arraySpread(items2,
|
|
blockedUsersForVoiceChannel, 0,
|
|
Set),
|
|
Set);
|
|
Reflect.apply(showVoiceChannelBlockedUserWarning, value, [channelId, items2[0]]);
|
|
}
|
|
} else {
|
|
dequeueBlockWarning();
|
|
}
|
|
} else {
|
|
dequeueBlockWarning();
|
|
}
|
|
} else {
|
|
dequeueBlockWarning();
|
|
}
|
|
}
|
|
}
|
|
|
|
function isGlobalDismissTimestampInCooldown() { // fn#96390, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12770:1392, offset: 0x0215c5cd, size: 58 bytes, params: 1, frame: 11
|
|
const r1 = getGlobalDismissTimestamp() ?? 0;
|
|
const Date = global.Date;
|
|
return r1 > Date.now() - env0_18;
|
|
}
|
|
|
|
function voiceBlockedWarningInCooldownForUsers(a0) { // fn#96391, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12770:1483, offset: 0x0215c607, size: 59 bytes, params: 2, frame: 12
|
|
var r0;
|
|
let value = isGlobalDismissTimestampInCooldown();
|
|
if (value) {
|
|
r0 = value;
|
|
} else {
|
|
value = global.Array.from(a0);
|
|
value = value.every(function(a0) {
|
|
return userBlockedWarningInCooldown(a0, true);
|
|
});
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function userBlockedWarningInCooldown(a0) { // fn#96393, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12770:1639, offset: 0x0215c658, size: 94 bytes, params: 2, frame: 13
|
|
const value = a1;
|
|
let r0 = value !== undefined ? value : false;
|
|
r0 = !r0 ? !isGlobalDismissTimestampInCooldown() : r0;
|
|
r0 = r0 ? (getUserDismissTimestamp(a0) ?? 0) > global.Date.now() - env0_17 : !r0;
|
|
return r0;
|
|
}
|
|
|
|
function _fun96394(a0) { // fn#96394, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12770:1786, offset: 0x0215c6b6, size: 74 bytes, params: 2, frame: 15
|
|
const SharedSpacesWarningManager2 = SharedSpacesWarningManager;
|
|
Inherits(SharedSpacesWarningManager2, a0);
|
|
return CreateClass(SharedSpacesWarningManager2, [{key: 'handleBlockedOrIgnoredUserVoiceChannelJoin',
|
|
value: value_96396}]);
|
|
function SharedSpacesWarningManager(a0) { // fn#96395, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12770:1798, offset: 0x0215c700, size: 152 bytes, params: 2, frame: 20
|
|
var r0;
|
|
var Reflect;
|
|
let value = copyRestArgs(0, undefined);
|
|
let binding = env1_2;
|
|
binding(this, SharedSpacesWarningManager);
|
|
const items2 = [];
|
|
arraySpread(items2, value, 0, items2);
|
|
value = env1_5(SharedSpacesWarningManager);
|
|
binding = env1_4;
|
|
if (_isNativeReflectConstruct_96383()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value, items2, env1_5(this).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value.apply(this, items2);
|
|
r0 = value;
|
|
}
|
|
value = binding(this, r0);
|
|
value.actions = {CHANNEL_SELECT: handleChannelSelect_96386, APP_STATE_UPDATE: handleAppStateChanged};
|
|
return value;
|
|
}
|
|
|
|
function value_96396(a0, a1) { // fn#96396, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12770:2275, offset: 0x0215c798, size: 97 bytes, params: 3, frame: 15
|
|
const value = environment.__proto__;
|
|
const channelId = RTCConnectionStore.getChannelId();
|
|
if (a0 === channelId) {
|
|
if (ChannelStore.getChannel(a0) != null) {
|
|
if (!userBlockedWarningInCooldown(a1)) {
|
|
(require(12586) /* metro dependency 12586: showVoiceChannelBlockedUserWarningNative */).showVoiceChannelBlockedUserWarning(channelId,
|
|
|
|
|
|
|
|
a1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun96382, 12580, [6, 7, 15, 17, 18, 1379, 4294, 3793, 12581, 12579, 672, 12582, 676, 12586, 4860,
|
|
2]) /* metro module 12580, dependencies: [6, 7, 15, 17, 18, 1379, 4294, 3793, 12581, 12579, 672, 12582, 676, 12586, 4860, 2] */;
|