312 lines
14 KiB
TypeScript
312 lines
14 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] */
|
|
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 env0_3 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_4 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_5 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_6 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_7 = importDefault(18) /* metro dependency 18 */;
|
|
const userSettingsProtoStore = importDefault(1348) /* metro dependency 1348: UserSettingsProtoStore */;
|
|
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const guildChannelStore = importDefault(1935) /* metro dependency 1935: GuildChannelStore */;
|
|
const env0_12 = (require(1935) /* metro dependency 1935: GuildChannelStore */).GUILD_SELECTABLE_CHANNELS_KEY;
|
|
const guildMemberStore = importDefault(1945) /* metro dependency 1945: GuildMemberStore */;
|
|
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
|
|
const readStateStore = importDefault(4605) /* metro dependency 4605: ReadStateStore */;
|
|
const userGuildSettingsStore = importDefault(4864) /* metro dependency 4864: UserGuildSettingsStore */;
|
|
const constantsModule = require(661) /* metro dependency 661: Constants */;
|
|
const env0_17 = constantsModule.AnalyticsObjects;
|
|
const env0_18 = constantsModule.AnalyticsObjectTypes;
|
|
const env0_19 = constantsModule.GuildFeatures;
|
|
const Set = global.Set;
|
|
let set = new Set();
|
|
const env0_21 = {};
|
|
const env0_22 = {};
|
|
const Store = (importDefault(566) /* metro dependency 566: 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});
|
|
(require(2) /* metro dependency 2 */).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 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 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;
|
|
});
|
|
if (GuildMemberStore.getMember(a0, AuthenticationStore.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 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
|
|
(importDefault(21) /* metro dependency 21: SnowflakeUtils */).keys(env0_21).forEach(_fun44460);
|
|
}
|
|
|
|
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 closure = NewChannelsStore;
|
|
env0_7(closure, a0);
|
|
return env0_4(closure, [{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 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 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);
|
|
}
|
|
}
|
|
|
|
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 readStateActionCreatorsModule = require(5097) /* metro dependency 5097: ReadStateActionCreators */;
|
|
const ack = readStateActionCreatorsModule.ack;
|
|
const object2 = {};
|
|
const ACK_RECENT_CHANNEL_NEW_CHANNEL_VIEWED = AnalyticsObjects.ACK_RECENT_CHANNEL_NEW_CHANNEL_VIEWED;
|
|
object2.object = ACK_RECENT_CHANNEL_NEW_CHANNEL_VIEWED;
|
|
const ACK_AUTOMATIC = AnalyticsObjectTypes.ACK_AUTOMATIC;
|
|
object2.objectType = ACK_AUTOMATIC;
|
|
value = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
|
|
value = value.atPreviousMillisecond(require);
|
|
return Reflect.apply(ack, readStateActionCreatorsModule, [require, object2, true, true, value]);
|
|
}
|
|
|
|
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 = (importDefault(21) /* metro dependency 21: 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 _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 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 _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 _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
|
|
return !UserGuildSettingsStore.isChannelOrParentOptedIn(env0_0, a0);
|
|
}
|
|
|