267 lines
14 KiB
TypeScript
267 lines
14 KiB
TypeScript
/* Metro module 6586; source: stores/FrecencyStore.tsx; dependencies: [6, 7, 15, 17, 18, 1348, 1379, 1867, 1934, 3969, 661, 670, 4393, 22, 566, 694, 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 Flux from '../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import UserSettingsProtoStore from '../modules/user_settings/UserSettingsProtoStore.tsx'; /* Metro dependency 1348 */
|
|
import ChannelStore from './ChannelStore.tsx'; /* Metro dependency 1379 */
|
|
import GuildStore from './GuildStore.tsx'; /* Metro dependency 1867 */
|
|
import SelectedChannelStore from './SelectedChannelStore.tsx'; /* Metro dependency 1934 */
|
|
import SelectedGuildStore from './SelectedGuildStore.tsx'; /* Metro dependency 3969 */
|
|
import Frecency from '../lib/Frecency.tsx'; /* Metro dependency 4393 */
|
|
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as UserSettingsConstantsModule from '../modules/user_settings/UserSettingsConstants.tsx'; /* Metro dependency 670 */
|
|
|
|
function _fun51828(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#51828, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6764:6, offset: 0x012e5944, size: 546 bytes, params: 8, frame: 22
|
|
const CHANNEL_SELECT_518322 = CHANNEL_SELECT_51832;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = Frecency;
|
|
value = new value({computeBonus: function() {
|
|
return 100;
|
|
}, computeWeight: function(a0) {
|
|
return a0 === 0 ? 100 : a0 >= 1 && a0 < 2 ? 70 : a0 >= 2 && a0 < 4 ? 50 : a0 >= 4 && a0 < 7 ? 30 : a0 >= 7 ? 10 : 1;
|
|
}, lookupKey: lookupKey_51838, afterCompute: function() {
|
|
}, numFrequentlyItems: 100, maxSamples: 10});
|
|
object = {pendingUsages: []};
|
|
const PersistedStore = (Flux).PersistedStore;
|
|
value = _fun51840(PersistedStore);
|
|
value.displayName = 'FrecencyStore';
|
|
value.persistKey = 'FrecencyStore';
|
|
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {CHANNEL_SELECT: CHANNEL_SELECT_518322,
|
|
VOICE_CHANNEL_SELECT: CHANNEL_SELECT_518322, USER_SETTINGS_PROTO_UPDATE: USER_SETTINGS_PROTO_UPDATE_51853});
|
|
(FileImportTrackerModule).fileFinishedImporting('stores/FrecencyStore.tsx');
|
|
exports.default = value;
|
|
exports.MAX_NUM_SELECTED_ITEMS = 100;
|
|
function _isNativeReflectConstruct_51829() { // fn#51829, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6764:247, offset: 0x012e5b66, 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_51829_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function CHANNEL_SELECT_51832({guildId, channelId}) { // fn#51832, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6764:780, offset: 0x012e5bc4, size: 259 bytes, params: 2, frame: 17
|
|
var r4;
|
|
var r0;
|
|
var r1;
|
|
var value3;
|
|
var pendingUsages;
|
|
var push;
|
|
var object;
|
|
var value7;
|
|
if (channelId === env0_15) {
|
|
r1 = false;
|
|
} else {
|
|
value3 = null;
|
|
r4 = value3 != channelId ? channelId : value3;
|
|
if (value3 != channelId && ID_REGEX.test(channelId)) {
|
|
env0_14.track(channelId);
|
|
pendingUsages = env0_17.pendingUsages;
|
|
push = pendingUsages.push;
|
|
object = {key: channelId};
|
|
object.timestamp = global.Date.now();
|
|
Reflect.apply(push, pendingUsages, [object]);
|
|
r0 = true;
|
|
} else {
|
|
r0 = false;
|
|
}
|
|
r1 = r0;
|
|
}
|
|
if (guildId === env0_16) {
|
|
r0 = r1;
|
|
} else {
|
|
value7 = null;
|
|
r4 = value7 != guildId ? guildId : value7;
|
|
if (value7 != guildId && ID_REGEX.test(guildId)) {
|
|
env0_14.track(guildId);
|
|
pendingUsages = env0_17.pendingUsages;
|
|
push = pendingUsages.push;
|
|
object = {key: guildId};
|
|
object.timestamp = global.Date.now();
|
|
Reflect.apply(push, pendingUsages, [object]);
|
|
r1 = true;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function initFrecency() { // fn#51833, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6764:1082, offset: 0x012e5cc7, size: 113 bytes, params: 1, frame: 17
|
|
const guildAndChannelFrecency = UserSettingsProtoStore.frecencyWithoutFetchingLatest.guildAndChannelFrecency;
|
|
const value2 = undefined;
|
|
const guildAndChannels = guildAndChannelFrecency == null ? value2 : guildAndChannelFrecency.guildAndChannels;
|
|
if (guildAndChannels == null) {
|
|
return false;
|
|
}
|
|
const binding = env0_14;
|
|
binding.overwriteHistory((importDefault(22) /* metro dependency 22 */).mapValues(guildAndChannels, function(a0) {
|
|
var r3;
|
|
var object = {};
|
|
copyDataProperties(object, a0, r3);
|
|
var value = a0.recentUses.map(global.Number);
|
|
value = value.filter(_fun51835);
|
|
object['recentUses'] = value;
|
|
return object;
|
|
}), env0_17.pendingUsages);
|
|
return value2;
|
|
function _fun51834(a0) { // fn#51834, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6764:1267, offset: 0x012e5d38, size: 67 bytes, params: 2, frame: 13
|
|
const object = {};
|
|
copyDataProperties(object, a0, undefined);
|
|
const recentUses = a0.recentUses;
|
|
const map = recentUses.map;
|
|
const Number = global.Number;
|
|
let value = Reflect.apply(map, recentUses, [Number]);
|
|
value = value.filter(function(a0) {
|
|
return a0 > 0;
|
|
});
|
|
object['recentUses'] = value;
|
|
return object;
|
|
}
|
|
|
|
}
|
|
|
|
function lookupKey_51838(a0) { // fn#51838, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6764:598, offset: 0x012e5dd5, size: 72 bytes, params: 2, frame: 14
|
|
let r0 = GuildStore.getGuild(a0) ?? ChannelStore.getChannel(a0);
|
|
r0 = r0 ?? ChannelStore.getChannel(ChannelStore.getDMFromUserId(a0));
|
|
return r0;
|
|
}
|
|
|
|
function _fun51840(a0) { // fn#51840, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6764:1378, offset: 0x012e5e1d, size: 281 bytes, params: 2, frame: 16
|
|
const FrecencyStore2 = FrecencyStore;
|
|
Inherits(FrecencyStore2, a0);
|
|
return CreateClass(FrecencyStore2, [{key: 'initialize', value: function(a0) {
|
|
this.waitFor(ChannelStore, GuildStore, SelectedChannelStore, SelectedGuildStore, UserSettingsProtoStore);
|
|
if (a0 != null) {
|
|
a0.pendingUsages = a0.pendingUsages.filter(_fun51843);
|
|
env1_17 = a0;
|
|
}
|
|
this.syncWith([UserSettingsProtoStore], initFrecency);
|
|
}}, {key: 'getState', value: value_51844}, {key: 'hasPendingUsage', value: value_51845},
|
|
{key: 'frecencyWithoutFetchingLatest', get: get_51846}, {key: 'getFrequentlyWithoutFetchingLatest',
|
|
value: value_51847}, {key: 'getScoreWithoutFetchingLatest', value: value_51848},
|
|
{key: 'getScoreForDMWithoutFetchingLatest', value: value_51849}, {key: 'getMaxScore', value: function() {
|
|
return 1000;
|
|
}}, {key: 'getBonusScore', value: function() {
|
|
return 100;
|
|
}}, {key: 'getVersion', value: value_51852}]);
|
|
function FrecencyStore() { // fn#51841, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6764:1390, offset: 0x01176269, size: 113 bytes, params: 1, frame: 20
|
|
const value = environment.__proto__;
|
|
env1_2(this, FrecencyStore);
|
|
const value3 = env1_5(FrecencyStore);
|
|
return env1_4(this, _isNativeReflectConstruct_51829() ? global.Reflect.construct(value3, arguments,
|
|
env1_5(this).constructor) : value3.apply(this, arguments));
|
|
}
|
|
|
|
function value_51842(a0) { // fn#51842, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6764:1673, offset: 0x012e5f36, size: 113 bytes, params: 2, frame: 21
|
|
var pendingUsages;
|
|
this.waitFor(ChannelStore, GuildStore, SelectedChannelStore, SelectedGuildStore, UserSettingsProtoStore);
|
|
if (a0 != null) {
|
|
pendingUsages = a0.pendingUsages;
|
|
a0.pendingUsages = pendingUsages.filter(_fun51843);
|
|
env1_17 = a0;
|
|
}
|
|
this.syncWith([UserSettingsProtoStore], initFrecency);
|
|
function _fun51843(a0) { // fn#51843, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6764:1759, offset: 0x012e5fa7, size: 36 bytes, params: 2, frame: 12
|
|
var r0;
|
|
let value = a0 != null;
|
|
if (value) {
|
|
value = environment.__proto__.__proto__;
|
|
value = ID_REGEX.test(a0.key);
|
|
r0 = value;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
}
|
|
|
|
function value_51844() { // fn#51844, offset: 0x00e07553, size: 9 bytes, params: 1, frame: 1
|
|
return env1_17;
|
|
}
|
|
|
|
function value_51845() { // fn#51845, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6764:1899, offset: 0x012e5fcb, size: 26 bytes, params: 1, frame: 2
|
|
return env1_17.pendingUsages.length > 0;
|
|
}
|
|
|
|
function get_51846() { // fn#51846, offset: 0x00df0f5a, size: 9 bytes, params: 1, frame: 1
|
|
return env1_14;
|
|
}
|
|
|
|
function value_51847() { // fn#51847, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6764:2055, offset: 0x012e5fe5, size: 15 bytes, params: 1, frame: 1
|
|
return env1_14.frequently;
|
|
}
|
|
|
|
function value_51848(a0) { // fn#51848, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6764:2131, offset: 0x012e5ff4, size: 39 bytes, params: 2, frame: 11
|
|
const value = environment.__proto__;
|
|
return env1_14.getFrecency(a0) ?? 0;
|
|
}
|
|
|
|
function value_51849(a0) { // fn#51849, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6764:2237, offset: 0x012e601b, size: 48 bytes, params: 2, frame: 12
|
|
var r0;
|
|
let value = environment.__proto__;
|
|
value = ChannelStore.getDMFromUserId(a0);
|
|
if (value != null) {
|
|
value = this.getScoreWithoutFetchingLatest(value);
|
|
r0 = value;
|
|
} else {
|
|
r0 = 0;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function value_51852() { // fn#51852, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6764:2457, offset: 0x012e6053, size: 15 bytes, params: 1, frame: 1
|
|
return env1_14.version;
|
|
}
|
|
|
|
}
|
|
|
|
function USER_SETTINGS_PROTO_UPDATE_51853({settings, wasSaved}) { // fn#51853, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6764:2699, offset: 0x012e6062, size: 67 bytes, params: 2, frame: 4
|
|
var r0;
|
|
const type = settings.type;
|
|
const FRECENCY_AND_FAVORITES_SETTINGS = UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS;
|
|
const r2 = type !== FRECENCY_AND_FAVORITES_SETTINGS || !wasSaved;
|
|
if (r2) {
|
|
r0 = !r2;
|
|
} else {
|
|
env0_17.pendingUsages = [];
|
|
r0 = true;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
}
|
|
|
|
function _fun51835(a0) { // fn#51835, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6764:1321, offset: 0x011bbce4, size: 11 bytes, params: 2, frame: 2
|
|
return a0 > 0;
|
|
}
|
|
|
|
global.__d(_fun51828, 6586, [6, 7, 15, 17, 18, 1348, 1379, 1867, 1934, 3969, 661, 670, 4393, 22, 566, 694,
|
|
2]) /* metro module 6586, dependencies: [6, 7, 15, 17, 18, 1348, 1379, 1867, 1934, 3969, 661, 670, 4393, 22, 566, 694, 2] */;
|