Files
2026-07-28 01:06:53 +03:00

332 lines
17 KiB
TypeScript

/* Metro module 5096; source: modules/recent_channels/NewChannelsStore.tsx; dependencies: [6, 7, 15, 17, 18, 1348, 1226, 1379, 1935, 1945, 1867, 4605, 4864, 661, 672, 4793, 694, 5097, 21, 566, 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 SnowflakeUtils from '../../utils/SnowflakeUtils.tsx'; /* Metro dependency 21 */
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import AuthenticationStore from '../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
import UserSettingsProtoStore from '../user_settings/UserSettingsProtoStore.tsx'; /* Metro dependency 1348 */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import GuildStore from '../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
import GuildChannelStore from '../../stores/GuildChannelStore.tsx'; /* Metro dependency 1935 */
import GuildMemberStore from '../../stores/GuildMemberStore.tsx'; /* Metro dependency 1945 */
import ReadStateStore from '../../stores/ReadStateStore.tsx'; /* Metro dependency 4605 */
import UserGuildSettingsStore from '../../stores/UserGuildSettingsStore.tsx'; /* Metro dependency 4864 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as GuildChannelStoreModule from '../../stores/GuildChannelStore.tsx'; /* Metro dependency 1935 */
import * as ReadStateActionCreatorsModule from '../../actions/ReadStateActionCreators.tsx'; /* Metro dependency 5097 */
function _fun44450(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#44450, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:6, offset: 0x011710f8, size: 589 bytes, params: 8, frame: 20
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const Set = global.Set;
let set = new Set();
const env0_21 = {};
const env0_22 = {};
const Store = (Flux).Store;
_fun44462(Store).displayName = 'NewChannelsStore';
set = new set(importDefault(694) /* metro dependency 694: Dispatcher */,
{BULK_CLEAR_RECENTS: BULK_CLEAR_RECENTS_44467, CHANNEL_ACK: function() {
return true;
}, CHANNEL_SELECT: CHANNEL_SELECT_44470, SIDEBAR_VIEW_CHANNEL: SIDEBAR_VIEW_CHANNEL_44471,
SIDEBAR_VIEW_GUILD: SIDEBAR_VIEW_GUILD_44472, GUILD_DELETE: GUILD_DELETE_44473,
CHANNEL_CREATE: CHANNEL_CREATE_44474});
(FileImportTrackerModule).fileFinishedImporting('modules/recent_channels/NewChannelsStore.tsx');
exports.default = set;
function _isNativeReflectConstruct_44451() { // fn#44451, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:346, offset: 0x01171345, size: 94 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_44451_isNativeReflectConstruct = function() {
return !!result;
})();
}
function maybeAckViewedChannel(a0, a1) { // fn#44454, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:563, offset: 0x011713a3, size: 174 bytes, params: 3, frame: 16
var isOptInEnabled2;
var channel;
const env0_0 = a1;
const property = env0_21[a0];
let r2 = property != null && a1 != null && property.has(a1);
if (r2) {
isOptInEnabled2 = UserGuildSettingsStore.isOptInEnabled(a0);
if (isOptInEnabled2) {
channel = ChannelStore.getChannel(a1);
r2 = channel != null && channel.isThread();
} else {
r2 = !isOptInEnabled2;
}
r2 = !r2 ? ReadStateStore.ackMessageId(a1) != null : r2;
if (!r2) {
(importDefault(694) /* metro dependency 694: Dispatcher */).wait(_fun44455);
}
}
function _fun44455() { // fn#44455, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:744, offset: 0x01171451, size: 116 bytes, params: 1, frame: 20
let value = environment.__proto__;
const ack = ReadStateActionCreatorsModule.ack;
const object = {};
const ACK_RECENT_CHANNEL_NEW_CHANNEL_VIEWED = AnalyticsObjects.ACK_RECENT_CHANNEL_NEW_CHANNEL_VIEWED;
object.object = ACK_RECENT_CHANNEL_NEW_CHANNEL_VIEWED;
const ACK_AUTOMATIC = AnalyticsObjectTypes.ACK_AUTOMATIC;
object.objectType = ACK_AUTOMATIC;
value = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
value = value.atPreviousMillisecond(require);
return Reflect.apply(ack, ReadStateActionCreatorsModule, [require, object, true, true, value]);
}
}
function initializeNewChannels(a0) { // fn#44456, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:883, offset: 0x011714c5, size: 285 bytes, params: 2, frame: 18
var value3;
var guildMemberStoreBinding;
var getMember;
var authenticationStoreBinding;
var binding;
var Set;
var prototype;
var value6;
var set;
var Date;
var value8;
var date;
var value10;
var value11;
const env0_0 = a0;
if (env0_21[a0] == null) {
value3 = GuildChannelStore.getChannels(a0)[GUILD_SELECTABLE_CHANNELS_KEY].map(function(a0) {
return a0.channel.id;
});
guildMemberStoreBinding = GuildMemberStore;
getMember = guildMemberStoreBinding.getMember;
authenticationStoreBinding = AuthenticationStore;
if (Reflect.apply(getMember, guildMemberStoreBinding, [a0,
authenticationStoreBinding.getId()])?.joinedAt != null) {
binding = env0_21;
Set = global.Set;
prototype = Set.prototype;
value6 = Object.create(prototype, {constructor: {value: Set}});
set = new Set();
binding[a0] = set instanceof Object ? set : value6;
Date = global.Date;
prototype = Date.prototype;
value8 = Object.create(prototype, {constructor: {value: Date}});
date = new Date();
var env0_1 = (date instanceof Object ? date : value8).getTime();
if (value3.length !== 0) {
binding = env0_21;
Set = global.Set;
value10 = value3.filter(_fun44458);
value11 = Object.create(Set.prototype, {constructor: {value: Set}});
set = new Set();
binding[a0] = set instanceof Object ? set : value11;
binding = env0_22;
Date = global.Date;
binding[a0] = Date.now();
}
}
}
function _fun44458(a0) { // fn#44458, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:1133, offset: 0x011715e2, size: 194 bytes, params: 2, frame: 18
const value = environment.__proto__;
const value2 = (SnowflakeUtils).extractTimestamp(a0);
let r0 = ReadStateStore.getTrackedAckMessageId(a0) == null && value2 > global.Date.now() - (importDefault(672) /* metro dependency 672: Durations */).Millis.WEEK && value2 > UserSettingsProtoStore.getGuildRecentsDismissedAt(env0_0);
r0 = r0 && value2 > env0_1 && !UserGuildSettingsStore.isChannelOrParentOptedIn(env0_0, a0);
return r0;
}
}
function pruneNewChannels() { // fn#44459, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:1345, offset: 0x011716a4, size: 58 bytes, params: 1, frame: 12
(SnowflakeUtils).keys(env0_21).forEach(_fun44460);
function _fun44460(a0) { // fn#44460, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:1399, offset: 0x011716de, size: 88 bytes, params: 2, frame: 17
var environment;
const env0_0 = a0;
let value = environment.__proto__;
const property = env1_21[a0];
const binding = env1_21;
const Set = global.Set;
const items2 = [];
arraySpread(items2, property, 0, undefined);
value = items2.filter(_fun44461);
const value2 = Object.create(Set.prototype, {constructor: {value: Set}});
const set = new Set(value);
binding[a0] = set instanceof Object ? set : value2;
function _fun44461(a0) { // fn#44461, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:1442, offset: 0x01171736, size: 34 bytes, params: 2, frame: 13
const userGuildSettingsStoreBinding = UserGuildSettingsStore;
return !userGuildSettingsStoreBinding.isChannelOrParentOptedIn(env0_0, a0);
}
}
}
function _fun44462(a0) { // fn#44462, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:1490, offset: 0x01171758, size: 114 bytes, params: 2, frame: 16
const NewChannelsStore2 = NewChannelsStore;
Inherits(NewChannelsStore2, a0);
return CreateClass(NewChannelsStore2, [{key: 'initialize', value: function() {
this.waitFor(AuthenticationStore, ChannelStore, GuildChannelStore, GuildMemberStore, GuildStore, ReadStateStore,
UserGuildSettingsStore, UserSettingsProtoStore);
this.syncWith([UserGuildSettingsStore], pruneNewChannels);
}}, {key: 'getNewChannelIds', value: value_44465}, {key: 'shouldIndicateNewChannel', value: value_44466}]);
function NewChannelsStore() { // fn#44463, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:1502, offset: 0x011717ca, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_3(this, NewChannelsStore);
const value3 = env1_6(NewChannelsStore);
return env1_5(this, _isNativeReflectConstruct_44451() ? global.Reflect.construct(value3, arguments,
env1_6(this).constructor) : value3.apply(this, arguments));
}
function value_44465(a0) { // fn#44465, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:1909, offset: 0x0117188e, size: 72 bytes, params: 2, frame: 12
var r0;
let value = a0 != null;
if (value) {
value = environment.__proto__;
value = env1_21[a0] == null;
r0 = value;
} else {
r0 = value;
}
if (r0) {
value = environment.__proto__;
initializeNewChannels(a0);
}
return a0 == null ? env1_20 : env1_21[a0] ?? env1_20;
}
function value_44466(a0, a1) { // fn#44466, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:2048, offset: 0x011718d6, size: 166 bytes, params: 3, frame: 16
var r0;
if (a0 == null) {
return false;
}
const value = environment.__proto__;
const guild = GuildStore.getGuild(a0);
let r1 = guild == null || !guild.features.has(GuildFeatures.COMMUNITY);
if (r1) {
r0 = !r1;
} else {
r1 = a0 != null && env1_21[a0] == null;
if (r1) {
initializeNewChannels(a0);
}
r1 = env1_21[a0]?.has(a1);
r1 = r1 && ReadStateStore.getTrackedAckMessageId(a1) == null;
r0 = r1;
}
return r0;
}
}
function BULK_CLEAR_RECENTS_44467({guildId, channelIds}) { // fn#44467, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:2367, offset: 0x0117197c, size: 87 bytes, params: 2, frame: 14
if (env0_21[guildId] == null) {
return false;
}
channelIds.forEach(_fun44468);
if (env0_21[guildId].size === 0) {
delete env0_21[guildId];
}
function _fun44468(a0) { // fn#44468, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:2459, offset: 0x011719d3, size: 33 bytes, params: 2, frame: 11
return env1_21[guildId].delete(a0);
}
}
function CHANNEL_SELECT_44470({guildId, channelId}) { // fn#44470, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:2541, offset: 0x011719f4, size: 145 bytes, params: 2, frame: 19
var r1;
var r0;
var value3;
const value = guildId != null;
if (value) {
if (env0_21[guildId] == null) {
initializeNewChannels(guildId);
r1 = true;
} else if (env0_22[guildId] < global.Date.now() - (importDefault(672) /* metro dependency 672: Durations */).Millis.HOUR) {
initializeNewChannels(guildId);
r1 = true;
} else {
value3 = false;
if (channelId != null) {
maybeAckViewedChannel(guildId, channelId);
r1 = value3;
} else {
r1 = value3;
}
}
r0 = r1;
} else {
r0 = value;
}
return r0;
}
function SIDEBAR_VIEW_CHANNEL_44471({guildId, channelId, sidebarType}) { // fn#44471, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:2755, offset: 0x01171a85, size: 91 bytes, params: 2, frame: 16
if (!(guildId == null || sidebarType !== (require(4793) /* metro dependency 4793: SidebarActionTypes */).SidebarType.VIEW_CHANNEL)) {
maybeAckViewedChannel(guildId, channelId);
}
return false;
}
function SIDEBAR_VIEW_GUILD_44472({guildId, baseChannelId}) { // fn#44472, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:2933, offset: 0x01171ae0, size: 39 bytes, params: 2, frame: 13
if (guildId != null) {
maybeAckViewedChannel(guildId, baseChannelId);
}
return false;
}
function GUILD_DELETE_44473({guild}) { // fn#44473, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:3054, offset: 0x01171b07, size: 28 bytes, params: 2, frame: 2
delete env0_21[guild.id];
}
function CHANNEL_CREATE_44474({channel}) { // fn#44474, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5274:3123, offset: 0x01171b23, size: 116 bytes, params: 2, frame: 15
var r2;
var binding;
var guild_id;
var property;
var set;
if (!channel.isVocal()) {
binding = env0_21;
guild_id = channel.guild_id;
property = env0_21[channel.guild_id];
if (property != null) {
r2 = property;
} else {
set = new global.Set();
}
binding[guild_id] = r2;
binding = env0_21;
guild_id = channel.guild_id;
property = binding[guild_id];
property.add(channel.id);
}
}
}
global.__d(_fun44450, 5096, [6, 7, 15, 17, 18, 1348, 1226, 1379, 1935, 1945, 1867, 4605, 4864, 661, 672, 4793, 694,
5097, 21, 566,
2]) /* metro module 5096, dependencies: [6, 7, 15, 17, 18, 1348, 1226, 1379, 1935, 1945, 1867, 4605, 4864, 661, 672, 4793, 694, 5097, 21, 566, 2] */;