784 lines
41 KiB
TypeScript
784 lines
41 KiB
TypeScript
/* Metro module 4623; source: modules/notification_center/NotificationCenterItemsStore.tsx; dependencies: [6, 7, 15, 17, 18, 4107, 4117, 3794, 3793, 1878, 661, 4624, 4625, 4788, 21, 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 SnowflakeUtils from '../../utils/SnowflakeUtils.tsx'; /* Metro dependency 21 */
|
|
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
|
|
import RelationshipStore from '../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */
|
|
import MessageRecord from '../../records/MessageRecord.tsx'; /* Metro dependency 3794 */
|
|
import ExperimentStore from '../experiments/ExperimentStore.tsx'; /* Metro dependency 4107 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as GuildScheduledEventStoreModule from '../guild_scheduled_events/GuildScheduledEventStore.tsx'; /* Metro dependency 4117 */
|
|
import * as NotificationCenterItemsTypesModule from './NotificationCenterItemsTypes.tsx'; /* Metro dependency 4624 */
|
|
|
|
function _fun39705(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#39705, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:6, offset: 0x010e85e3, size: 785 bytes, params: 8, frame: 23
|
|
const env0_0 = require;
|
|
const _validate = function(a0) {
|
|
return a0.id != null && a0.type != null;
|
|
};
|
|
const handleResetRemoteState = function() {
|
|
handleReset({keepLocalItems: true});
|
|
};
|
|
const NOTIFICATION_CENTER_ITEM_CREATE_397132 = NOTIFICATION_CENTER_ITEM_CREATE_39713;
|
|
const isItem = function(a0, a1, a2) {
|
|
var r0;
|
|
var property;
|
|
var value = a0.type === a1;
|
|
if (value) {
|
|
property = a0.other_user;
|
|
value = undefined;
|
|
value = (property == null ? value : property.id) === a2;
|
|
r0 = value;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
};
|
|
const RELATIONSHIP_ADD_397192 = RELATIONSHIP_ADD_39719;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
object = {'loading': false, 'initialized': false, 'errored': false, 'isDataStale': false};
|
|
object.notifCenterItems = [];
|
|
object.staleNotifCenterItems = [];
|
|
const Set = global.Set;
|
|
let set = new Set();
|
|
object.notifCenterIds = set;
|
|
object.notifCenterLocalItems = [];
|
|
object.paginationHasMore = true;
|
|
object.paginationCursor = undefined;
|
|
object.notifCenterActive = false;
|
|
object.notifCenterTabFocused = false;
|
|
const PersistedStore = (Flux).PersistedStore;
|
|
set = _fun39724(PersistedStore);
|
|
set.displayName = 'NotificationCenterItemsStore';
|
|
set.persistKey = 'NotificationCenterItemsStore_v2';
|
|
set = new set(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: CONNECTION_OPEN_39739,
|
|
LOGOUT: function() {
|
|
handleReset();
|
|
}, NOTIFICATION_CENTER_ITEMS_ACK: function({ids}) {
|
|
updateItemsAck(ids, true);
|
|
}, NOTIFICATION_CENTER_ITEMS_ACK_FAILURE: function({ids}) {
|
|
updateItemsAck(ids, false);
|
|
}, GUILD_SCHEDULED_EVENT_UPDATE: function({guildScheduledEvent}) {
|
|
updateGuildEvent(guildScheduledEvent);
|
|
}, NOTIFICATION_CENTER_ITEM_CREATE: NOTIFICATION_CENTER_ITEM_CREATE_397132,
|
|
NOTIFICATION_CENTER_ITEM_DELETE: NOTIFICATION_CENTER_ITEM_DELETE,
|
|
NOTIFICATION_CENTER_ITEM_DELETE_FAILURE: NOTIFICATION_CENTER_ITEM_CREATE_397132,
|
|
LOAD_NOTIFICATION_CENTER_ITEMS: LOAD_NOTIFICATION_CENTER_ITEMS,
|
|
LOAD_NOTIFICATION_CENTER_ITEMS_FAILURE: LOAD_NOTIFICATION_CENTER_ITEMS_FAILURE,
|
|
LOAD_NOTIFICATION_CENTER_ITEMS_SUCCESS: LOAD_NOTIFICATION_CENTER_ITEMS_SUCCESS_39752,
|
|
RESET_NOTIFICATION_CENTER: function() {
|
|
handleResetRemoteState();
|
|
}, NOTIFICATION_CENTER_SET_ACTIVE: NOTIFICATION_CENTER_SET_ACTIVE,
|
|
NOTIFICATION_CENTER_TAB_FOCUSED: NOTIFICATION_CENTER_TAB_FOCUSED, RELATIONSHIP_ADD: RELATIONSHIP_ADD_397192,
|
|
RELATIONSHIP_UPDATE: RELATIONSHIP_ADD_397192, RELATIONSHIP_REMOVE: RELATIONSHIP_REMOVE_39759,
|
|
GAME_RELATIONSHIP_ADD: GAME_RELATIONSHIP_ADD, GAME_RELATIONSHIP_REMOVE: GAME_RELATIONSHIP_REMOVE,
|
|
NOTIFICATION_CENTER_ITEM_COMPLETED: NOTIFICATION_CENTER_ITEM_COMPLETED, SET_RECENT_MENTIONS_FILTER: function() {
|
|
handleResetRemoteState();
|
|
}, MOBILE_NATIVE_UPDATE_CHECK_FINISHED: MOBILE_NATIVE_UPDATE_CHECK_FINISHED,
|
|
APPLICATIONS_FETCH_SUCCESS: APPLICATIONS_FETCH_SUCCESS_39771});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/notification_center/NotificationCenterItemsStore.tsx');
|
|
exports.default = set;
|
|
function _isNativeReflectConstruct_39706() { // fn#39706, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:246, offset: 0x010e88f4, 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_39706_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function handleReset() { // fn#39710, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:737, offset: 0x010e896e, size: 148 bytes, params: 1, frame: 13
|
|
const value = a0;
|
|
let keepLocalItems = (value !== undefined ? value : {}).keepLocalItems;
|
|
keepLocalItems = !(keepLocalItems === undefined) && keepLocalItems;
|
|
const object = {'loading': false, 'initialized': false, 'errored': false, 'isDataStale': false};
|
|
object.notifCenterItems = [];
|
|
object.staleNotifCenterItems = [];
|
|
const Set = global.Set;
|
|
object.notifCenterIds = new Set();
|
|
object.notifCenterLocalItems = keepLocalItems ? env0_14.notifCenterLocalItems : [];
|
|
object.paginationHasMore = true;
|
|
object.paginationCursor = undefined;
|
|
object.notifCenterActive = false;
|
|
object.notifCenterTabFocused = false;
|
|
}
|
|
|
|
function toNotificationCenterItem(a0) { // fn#39712, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:1117, offset: 0x010e8a1b, size: 229 bytes, params: 2, frame: 17
|
|
var r5;
|
|
const item_enum = a0.item_enum;
|
|
var value;
|
|
const value2 = undefined;
|
|
const ItemEnum = (require(4624) /* metro dependency 4624: NotificationCenterItemsTypes */).ItemEnum;
|
|
const FIRST_MESSAGE = ItemEnum.FIRST_MESSAGE;
|
|
if (item_enum === FIRST_MESSAGE && a0.type === (require(4624) /* metro dependency 4624: NotificationCenterItemsTypes */).NotificationCenterItems.LIFECYCLE_ITEM) {
|
|
a0.deeplink = 'https://discord.com/feature/composeMessage';
|
|
}
|
|
const object = {};
|
|
copyDataProperties(object, a0, 11);
|
|
object['kind'] = 'notification-center-item';
|
|
if (a0.message != null) {
|
|
value = require(4625) /* metro dependency 4625: MessageRecordUtils */;
|
|
value = value.createMessageRecord(a0.message);
|
|
r5 = value;
|
|
} else {
|
|
r5 = value2;
|
|
}
|
|
object['message'] = r5;
|
|
object['applicationId'] = a0.application != null ? a0.application.id : value2;
|
|
return object;
|
|
}
|
|
|
|
function NOTIFICATION_CENTER_ITEM_CREATE_39713(a0) { // fn#39713, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:1492, offset: 0x010e8b00, size: 200 bytes, params: 2, frame: 16
|
|
var notifCenterIds;
|
|
var has;
|
|
var id;
|
|
var add;
|
|
var binding;
|
|
var items2;
|
|
var notifCenterItems;
|
|
const r4 = a0.type === 'NOTIFICATION_CENTER_ITEM_CREATE' ? toNotificationCenterItem(a0.item) : a0.item;
|
|
if (env0_14.initialized) {
|
|
if (_validate(r4)) {
|
|
notifCenterIds = env0_14.notifCenterIds;
|
|
has = notifCenterIds.has;
|
|
id = r4.id;
|
|
if (Reflect.apply(has, notifCenterIds, [id])) {
|
|
return false;
|
|
}
|
|
notifCenterIds = env0_14.notifCenterIds;
|
|
add = notifCenterIds.add;
|
|
id = r4.id;
|
|
Reflect.apply(add, notifCenterIds, [id]);
|
|
binding = env0_14;
|
|
items2 = [r4];
|
|
notifCenterItems = env0_14.notifCenterItems;
|
|
arraySpread(items2, notifCenterItems, 1, notifCenterIds);
|
|
binding.notifCenterItems = items2;
|
|
notifCenterItems = env0_14.notifCenterItems;
|
|
notifCenterItems.sort(_fun39714);
|
|
return undefined;
|
|
}
|
|
}
|
|
return false;
|
|
function _fun39714({id}, {id}) { // fn#39714, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:1774, offset: 0x010e8bc8, size: 55 bytes, params: 3, frame: 13
|
|
const value = environment.__proto__;
|
|
return (SnowflakeUtils).compare(id, id);
|
|
}
|
|
|
|
}
|
|
|
|
function updateItemsAck(a0, a1) { // fn#39715, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:1811, offset: 0x010e8bff, size: 68 bytes, params: 3, frame: 13
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
const binding = env0_14;
|
|
const value2 = binding.notifCenterItems.map(_fun39716);
|
|
binding.notifCenterItems = value2.filter(_validate);
|
|
function _fun39716(a0) { // fn#39716, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:1883, offset: 0x010e8c43, size: 61 bytes, params: 2, frame: 14
|
|
var r0;
|
|
var object;
|
|
const value = a0;
|
|
const binding = env0_0;
|
|
if (binding.includes(value.id)) {
|
|
object = {};
|
|
copyDataProperties(object, value, binding);
|
|
object['acked'] = require;
|
|
r0 = object;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
}
|
|
|
|
function isGameRelationshipItem(a0, a1, a2, a3) { // fn#39718, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:2029, offset: 0x010e8cb1, size: 42 bytes, params: 5, frame: 15
|
|
return isItem(a0, a1, a2) && a0.applicationId === a3;
|
|
}
|
|
|
|
function RELATIONSHIP_ADD_39719({relationship}) { // fn#39719, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:2112, offset: 0x010e8cdb, size: 325 bytes, params: 2, frame: 25
|
|
var r2;
|
|
var userStoreBinding;
|
|
var value2;
|
|
var binding;
|
|
var notifCenterLocalItems;
|
|
var items2;
|
|
var value3;
|
|
var moduleValue;
|
|
const id = relationship.id;
|
|
const type = relationship.type;
|
|
const isSpamRequest = relationship.isSpamRequest;
|
|
const userIgnored = relationship.userIgnored;
|
|
const user = relationship.user;
|
|
const since = relationship.since;
|
|
const originApplicationId = relationship.originApplicationId;
|
|
const PENDING_INCOMING = RelationshipTypes.PENDING_INCOMING;
|
|
if (type !== PENDING_INCOMING) {
|
|
r2 = type !== RelationshipTypes.FRIEND || relationship.user == null;
|
|
r2 = !r2 ? userIgnored : r2;
|
|
if (!r2) {
|
|
binding = env0_14;
|
|
binding.notifCenterLocalItems = binding.notifCenterLocalItems.map(_fun39720);
|
|
}
|
|
r2 = type === RelationshipTypes.BLOCKED || userIgnored;
|
|
if (r2) {
|
|
binding = env0_14;
|
|
binding.notifCenterLocalItems = binding.notifCenterLocalItems.filter(_fun39721);
|
|
}
|
|
} else {
|
|
if (isSpamRequest) {
|
|
r2 = type !== RelationshipTypes.FRIEND || relationship.user == null;
|
|
r2 = !r2 ? userIgnored : r2;
|
|
if (!r2) {
|
|
binding = env0_14;
|
|
binding.notifCenterLocalItems = binding.notifCenterLocalItems.map(_fun39720);
|
|
}
|
|
r2 = type === RelationshipTypes.BLOCKED || userIgnored;
|
|
if (r2) {
|
|
binding = env0_14;
|
|
binding.notifCenterLocalItems = binding.notifCenterLocalItems.filter(_fun39721);
|
|
}
|
|
return undefined;
|
|
}
|
|
if (userIgnored) {
|
|
r2 = type !== RelationshipTypes.FRIEND || relationship.user == null;
|
|
r2 = !r2 ? userIgnored : r2;
|
|
if (!r2) {
|
|
binding = env0_14;
|
|
binding.notifCenterLocalItems = binding.notifCenterLocalItems.map(_fun39720);
|
|
}
|
|
r2 = type === RelationshipTypes.BLOCKED || userIgnored;
|
|
if (r2) {
|
|
binding = env0_14;
|
|
binding.notifCenterLocalItems = binding.notifCenterLocalItems.filter(_fun39721);
|
|
}
|
|
return undefined;
|
|
}
|
|
if (since == null) {
|
|
return null;
|
|
}
|
|
if (user != null) {
|
|
userStoreBinding = UserStore;
|
|
value2 = userStoreBinding.getUser(user.id);
|
|
if (value2 != null) {
|
|
binding = env0_14;
|
|
notifCenterLocalItems = binding.notifCenterLocalItems;
|
|
items2 = [];
|
|
value3 = arraySpread(items2, notifCenterLocalItems, 0, undefined);
|
|
moduleValue = require(4788) /* metro dependency 4788: NotificationCenterUtils */;
|
|
items2[value3] = moduleValue.incomingFriendRequestLocalItem(value2, since, originApplicationId);
|
|
value3 + 1;
|
|
binding.notifCenterLocalItems = items2;
|
|
}
|
|
}
|
|
r2 = type !== RelationshipTypes.FRIEND || relationship.user == null;
|
|
r2 = !r2 ? userIgnored : r2;
|
|
if (!r2) {
|
|
binding = env0_14;
|
|
binding.notifCenterLocalItems = binding.notifCenterLocalItems.map(_fun39720);
|
|
}
|
|
r2 = type === RelationshipTypes.BLOCKED || userIgnored;
|
|
if (r2) {
|
|
binding = env0_14;
|
|
binding.notifCenterLocalItems = binding.notifCenterLocalItems.filter(_fun39721);
|
|
}
|
|
}
|
|
function _fun39720(a0) { // fn#39720, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:2555, offset: 0x010e8e20, size: 207 bytes, params: 2, frame: 20
|
|
var r0;
|
|
var object;
|
|
let value = a0;
|
|
const isItemBinding = isItem;
|
|
const NotificationCenterLocalItems = (NotificationCenterItemsTypesModule).NotificationCenterLocalItems;
|
|
const INCOMING_FRIEND_REQUESTS = NotificationCenterLocalItems.INCOMING_FRIEND_REQUESTS;
|
|
const user2 = relationship.user;
|
|
if (isItemBinding(value, INCOMING_FRIEND_REQUESTS, user2.id)) {
|
|
object = {};
|
|
copyDataProperties(object, value, undefined);
|
|
object['acked'] = true;
|
|
object['forceUnacked'] = false;
|
|
value = 'incoming_friend_requests_accepted_' + user.id + '_' + value.id;
|
|
object['local_id'] = value;
|
|
object['type'] = NotificationCenterLocalItems.INCOMING_FRIEND_REQUESTS_ACCEPTED;
|
|
r0 = object;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function _fun39721(a0) { // fn#39721, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:2893, offset: 0x010e8eef, size: 204 bytes, params: 2, frame: 19
|
|
const value = environment.__proto__;
|
|
const isItemBinding = isItem;
|
|
const NotificationCenterLocalItems = (NotificationCenterItemsTypesModule).NotificationCenterLocalItems;
|
|
const INCOMING_FRIEND_REQUESTS = NotificationCenterLocalItems.INCOMING_FRIEND_REQUESTS;
|
|
let r0 = isItemBinding(a0, INCOMING_FRIEND_REQUESTS, id) || isItem(a0,
|
|
NotificationCenterLocalItems.INCOMING_FRIEND_REQUESTS_ACCEPTED, id);
|
|
r0 = !r0 ? isItem(a0, NotificationCenterLocalItems.INCOMING_GAME_FRIEND_REQUESTS, id) : r0;
|
|
r0 = !r0 ? isItem(a0, NotificationCenterLocalItems.INCOMING_GAME_FRIEND_REQUESTS_ACCEPTED, id) : r0;
|
|
return !r0;
|
|
}
|
|
|
|
}
|
|
|
|
function updateGuildEvent(a0) { // fn#39722, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:3233, offset: 0x010e8fbb, size: 59 bytes, params: 2, frame: 13
|
|
var binding;
|
|
const env0_0 = a0;
|
|
if (isGuildEventEnded(a0)) {
|
|
binding = env0_14;
|
|
binding.notifCenterItems = binding.notifCenterItems.map(_fun39723);
|
|
}
|
|
function _fun39723(a0) { // fn#39723, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:3312, offset: 0x010e8ff6, size: 107 bytes, params: 2, frame: 14
|
|
var r0;
|
|
var object;
|
|
const value = a0;
|
|
const type = value.type;
|
|
const NotificationCenterItems = (NotificationCenterItemsTypesModule).NotificationCenterItems;
|
|
const GUILD_SCHEDULED_EVENT_STARTED = NotificationCenterItems.GUILD_SCHEDULED_EVENT_STARTED;
|
|
if (type !== GUILD_SCHEDULED_EVENT_STARTED) {
|
|
r0 = value;
|
|
} else if (value.guild_scheduled_event_id !== env0_0.id) {
|
|
r0 = value;
|
|
} else {
|
|
object = {};
|
|
copyDataProperties(object, value, require);
|
|
object['disable_action'] = true;
|
|
r0 = object;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
}
|
|
|
|
function _fun39724(a0) { // fn#39724, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:3458, offset: 0x010e9061, size: 298 bytes, params: 2, frame: 16
|
|
const NotificationCenterItemsStore2 = NotificationCenterItemsStore;
|
|
Inherits(NotificationCenterItemsStore2, a0);
|
|
return CreateClass(NotificationCenterItemsStore2, [{key: 'initialize', value: value_39726}, {key: 'getState',
|
|
value: value_39728}, {key: 'loading', get: get_39730}, {key: 'initialized', get: get_39731}, {key: 'items',
|
|
get: get_39732}, {key: 'hasMore', get: get_39733}, {key: 'cursor', get: get_39734}, {key: 'errored',
|
|
get: get_39735}, {key: 'active', get: get_39736}, {key: 'localItems', get: get_39737}, {key: 'tabFocused',
|
|
get: get_39738}]);
|
|
function NotificationCenterItemsStore() { // fn#39725, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:3470, offset: 0x010e918b, size: 113 bytes, params: 1, frame: 20
|
|
const value = environment.__proto__;
|
|
env1_3(this, NotificationCenterItemsStore);
|
|
const value3 = env1_6(NotificationCenterItemsStore);
|
|
return env1_5(this, _isNativeReflectConstruct_39706() ? global.Reflect.construct(value3, arguments,
|
|
env1_6(this).constructor) : value3.apply(this, arguments));
|
|
}
|
|
|
|
function value_39726(a0) { // fn#39726, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:3828, offset: 0x010e91fc, size: 137 bytes, params: 2, frame: 17
|
|
var value2;
|
|
var object;
|
|
this.waitFor(UserStore, RelationshipStore, ExperimentStore);
|
|
if (a0 != null) {
|
|
value2 = a0.notifCenterItems.map(function(a0) {
|
|
var r4;
|
|
var object = {};
|
|
copyDataProperties(object, a0, r4);
|
|
object['message'] = a0.message != null ? new MessageRecord() : undefined;
|
|
return object;
|
|
});
|
|
if (value2.length > 0) {
|
|
object = {};
|
|
copyDataProperties(object, env1_14, undefined);
|
|
object['initialized'] = true;
|
|
object['isDataStale'] = true;
|
|
object['notifCenterItems'] = [];
|
|
object['staleNotifCenterItems'] = value2;
|
|
}
|
|
}
|
|
}
|
|
|
|
function value_39728() { // fn#39728, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:4086, offset: 0x010e92cf, size: 83 bytes, params: 1, frame: 14
|
|
var environment;
|
|
const closure = function(a0) {
|
|
var r3;
|
|
var object = {};
|
|
copyDataProperties(object, a0, r3);
|
|
object['message'] = a0.message?.toJS();
|
|
return object;
|
|
};
|
|
let object = {};
|
|
const value = environment.__proto__;
|
|
copyDataProperties(object, env1_14, undefined);
|
|
object['notifCenterItems'] = env1_14.notifCenterItems.map(closure);
|
|
object['staleNotifCenterItems'] = env1_14.staleNotifCenterItems.map(closure);
|
|
return object;
|
|
}
|
|
|
|
function get_39730() { // fn#39730, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:4302, offset: 0x010e935b, size: 15 bytes, params: 1, frame: 1
|
|
return env1_14.loading;
|
|
}
|
|
|
|
function get_39731() { // fn#39731, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:4355, offset: 0x010e936a, size: 15 bytes, params: 1, frame: 1
|
|
return env1_14.initialized;
|
|
}
|
|
|
|
function get_39732() { // fn#39732, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:4406, offset: 0x010e9379, size: 36 bytes, params: 1, frame: 3
|
|
const isDataStale = env1_14.isDataStale;
|
|
const binding = env1_14;
|
|
return isDataStale ? binding.staleNotifCenterItems : binding.notifCenterItems;
|
|
}
|
|
|
|
function get_39733() { // fn#39733, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:4502, offset: 0x010e939d, size: 15 bytes, params: 1, frame: 1
|
|
return env1_14.paginationHasMore;
|
|
}
|
|
|
|
function get_39734() { // fn#39734, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:4560, offset: 0x010e93ac, size: 15 bytes, params: 1, frame: 1
|
|
return env1_14.paginationCursor;
|
|
}
|
|
|
|
function get_39735() { // fn#39735, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:4618, offset: 0x010e93bb, size: 15 bytes, params: 1, frame: 1
|
|
return env1_14.errored;
|
|
}
|
|
|
|
function get_39736() { // fn#39736, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:4666, offset: 0x010e93ca, size: 15 bytes, params: 1, frame: 1
|
|
return env1_14.notifCenterActive;
|
|
}
|
|
|
|
function get_39737() { // fn#39737, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:4728, offset: 0x010e93d9, size: 15 bytes, params: 1, frame: 1
|
|
return env1_14.notifCenterLocalItems;
|
|
}
|
|
|
|
function get_39738() { // fn#39738, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:4794, offset: 0x010e93e8, size: 15 bytes, params: 1, frame: 1
|
|
return env1_14.notifCenterTabFocused;
|
|
}
|
|
|
|
}
|
|
|
|
function CONNECTION_OPEN_39739({relationships, gameRelationships, guilds}) { // fn#39739, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:4996, offset: 0x010e93f7, size: 125 bytes, params: 2, frame: 14
|
|
const Set = global.Set;
|
|
const set = new Set();
|
|
relationships.forEach(_fun39740);
|
|
gameRelationships.forEach(_fun39741);
|
|
guilds.forEach(function({guild_scheduled_events}) {
|
|
guild_scheduled_events.forEach(_fun39743);
|
|
});
|
|
env0_14.notifCenterLocalItems = [];
|
|
function _fun39740({id, type, since, is_spam_request, user_ignored, origin_application_id}) { // fn#39740, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:5073, offset: 0x010e9474, size: 165 bytes, params: 2, frame: 19
|
|
if (user_ignored) {
|
|
env0_1.add(id);
|
|
}
|
|
let value = environment.__proto__;
|
|
const PENDING_INCOMING = RelationshipTypes.PENDING_INCOMING;
|
|
if (type !== PENDING_INCOMING) {
|
|
return null;
|
|
}
|
|
if (is_spam_request) {
|
|
return null;
|
|
}
|
|
if (user_ignored) {
|
|
return null;
|
|
}
|
|
if (since == null) {
|
|
return null;
|
|
}
|
|
const user = UserStore.getUser(id);
|
|
if (user == null) {
|
|
return null;
|
|
}
|
|
const binding = env0_0;
|
|
const push = binding.push;
|
|
value = require(4788) /* metro dependency 4788: NotificationCenterUtils */;
|
|
Reflect.apply(push, binding, [value.incomingFriendRequestLocalItem(user, since, origin_application_id)]);
|
|
}
|
|
|
|
function _fun39741({type, id, application_id, since}) { // fn#39741, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:5364, offset: 0x010e9519, size: 136 bytes, params: 2, frame: 18
|
|
var binding;
|
|
var user;
|
|
var push;
|
|
let value = environment.__proto__;
|
|
const PENDING_INCOMING = RelationshipTypes.PENDING_INCOMING;
|
|
if (type === PENDING_INCOMING) {
|
|
binding = env0_1;
|
|
if (!binding.has(id)) {
|
|
user = UserStore.getUser(id);
|
|
if (user != null) {
|
|
binding = env0_0;
|
|
push = binding.push;
|
|
value = require(4788) /* metro dependency 4788: NotificationCenterUtils */;
|
|
Reflect.apply(push, binding, [value.incomingGameFriendRequestLocalItem(user, since, application_id)]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function _fun39742({guild_scheduled_events}) { // fn#39742, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:5554, offset: 0x010e95a1, size: 30 bytes, params: 2, frame: 11
|
|
guild_scheduled_events.forEach(function(a0) {
|
|
updateGuildEvent(a0);
|
|
});
|
|
function _fun39743(a0) { // fn#39743, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:5592, offset: 0x010e95bf, size: 19 bytes, params: 2, frame: 11
|
|
updateGuildEvent(a0);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function NOTIFICATION_CENTER_ITEM_DELETE({id}) { // fn#39748, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:6043, offset: 0x010e9632, size: 99 bytes, params: 2, frame: 13
|
|
var binding;
|
|
const notifCenterIds = env0_14.notifCenterIds;
|
|
if (notifCenterIds.has(id)) {
|
|
env0_14.notifCenterIds.delete(id);
|
|
binding = env0_14;
|
|
binding.notifCenterItems = binding.notifCenterItems.filter(function({id}) {
|
|
return id !== id;
|
|
});
|
|
return undefined;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function LOAD_NOTIFICATION_CENTER_ITEMS() { // fn#39750, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:6283, offset: 0x010e9695, size: 19 bytes, params: 1, frame: 2
|
|
env0_14.loading = true;
|
|
}
|
|
|
|
function LOAD_NOTIFICATION_CENTER_ITEMS_FAILURE() { // fn#39751, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:6358, offset: 0x010e96a8, size: 41 bytes, params: 1, frame: 3
|
|
env0_14.loading = false;
|
|
env0_14.initialized = true;
|
|
env0_14.errored = true;
|
|
}
|
|
|
|
function LOAD_NOTIFICATION_CENTER_ITEMS_SUCCESS_39752({items, hasMore, cursor}) { // fn#39752, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:6470, offset: 0x010e96d1, size: 281 bytes, params: 2, frame: 19
|
|
var r3;
|
|
var binding;
|
|
var length;
|
|
var notifCenterItems;
|
|
var items2;
|
|
var value6;
|
|
var value7;
|
|
if (env0_14.loading) {
|
|
env0_14.loading = false;
|
|
env0_14.initialized = true;
|
|
env0_14.errored = false;
|
|
env0_14.isDataStale = false;
|
|
r3 = cursor != null && env0_14.notifCenterIds.has(cursor);
|
|
if (!r3) {
|
|
binding = env0_14;
|
|
length = items.length;
|
|
r3 = length > 0 && hasMore;
|
|
binding.paginationHasMore = r3;
|
|
binding = env0_14;
|
|
length = items.length;
|
|
r3 = length > 0 ? cursor : undefined;
|
|
binding.paginationCursor = r3;
|
|
}
|
|
binding = env0_14;
|
|
notifCenterItems = binding.notifCenterItems;
|
|
items2 = [];
|
|
value6 = arraySpread(items2, notifCenterItems, 0, undefined);
|
|
value7 = items.map(toNotificationCenterItem);
|
|
arraySpread(items2, value7.filter(_fun39753), value6, value7);
|
|
binding.notifCenterItems = items2;
|
|
notifCenterItems = env0_14.notifCenterItems;
|
|
notifCenterItems.sort(_fun39754);
|
|
items.forEach(_fun39755);
|
|
}
|
|
function _fun39753({id}) { // fn#39753, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:6793, offset: 0x010e97ea, size: 36 bytes, params: 2, frame: 11
|
|
const notifCenterIds = env1_14.notifCenterIds;
|
|
return !notifCenterIds.has(id);
|
|
}
|
|
|
|
function _fun39754({id}, {id}) { // fn#39754, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:6852, offset: 0x010e8bc8, size: 55 bytes, params: 3, frame: 13
|
|
const value = environment.__proto__;
|
|
return (SnowflakeUtils).compare(id, id);
|
|
}
|
|
|
|
function _fun39755({id}) { // fn#39755, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:6900, offset: 0x010e980e, size: 33 bytes, params: 2, frame: 11
|
|
return env1_14.notifCenterIds.add(id);
|
|
}
|
|
|
|
}
|
|
|
|
function NOTIFICATION_CENTER_SET_ACTIVE({active}) { // fn#39757, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:7020, offset: 0x010e983e, size: 26 bytes, params: 2, frame: 2
|
|
env0_14.notifCenterActive = active;
|
|
}
|
|
|
|
function NOTIFICATION_CENTER_TAB_FOCUSED({focused}) { // fn#39758, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:7112, offset: 0x010e9858, size: 26 bytes, params: 2, frame: 2
|
|
env0_14.notifCenterTabFocused = focused;
|
|
}
|
|
|
|
function RELATIONSHIP_REMOVE_39759(a0) { // fn#39759, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:7295, offset: 0x010e9872, size: 47 bytes, params: 2, frame: 12
|
|
const env0_0 = a0;
|
|
const binding = env0_14;
|
|
binding.notifCenterLocalItems = binding.notifCenterLocalItems.filter(_fun39760);
|
|
function _fun39760(a0) { // fn#39760, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:7388, offset: 0x010e98a1, size: 135 bytes, params: 2, frame: 18
|
|
const value = environment.__proto__;
|
|
const isItemBinding = isItem;
|
|
const NotificationCenterLocalItems = (NotificationCenterItemsTypesModule).NotificationCenterLocalItems;
|
|
const INCOMING_FRIEND_REQUESTS = NotificationCenterLocalItems.INCOMING_FRIEND_REQUESTS;
|
|
return !isItemBinding(a0, INCOMING_FRIEND_REQUESTS, env0_0.relationship.id) && !isItem(a0,
|
|
NotificationCenterLocalItems.INCOMING_FRIEND_REQUESTS_ACCEPTED, env0_0.relationship.id);
|
|
}
|
|
|
|
}
|
|
|
|
function GAME_RELATIONSHIP_ADD({gameRelationship}) { // fn#39761, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:7610, offset: 0x010e9928, size: 244 bytes, params: 2, frame: 19
|
|
var binding;
|
|
var notifCenterLocalItems;
|
|
var user;
|
|
var items2;
|
|
var value5;
|
|
const id = gameRelationship.id;
|
|
const type = gameRelationship.type;
|
|
const since = gameRelationship.since;
|
|
const applicationId = gameRelationship.applicationId;
|
|
var value;
|
|
const relationshipStoreBinding = RelationshipStore;
|
|
if (relationshipStoreBinding.isBlockedOrIgnored(id)) {
|
|
return false;
|
|
}
|
|
const PENDING_INCOMING = RelationshipTypes.PENDING_INCOMING;
|
|
if (type === PENDING_INCOMING) {
|
|
user = UserStore.getUser(id);
|
|
if (since != null && user != null) {
|
|
binding = env0_14;
|
|
notifCenterLocalItems = binding.notifCenterLocalItems;
|
|
items2 = [];
|
|
value5 = arraySpread(items2, notifCenterLocalItems, 0, undefined);
|
|
value = require(4788) /* metro dependency 4788: NotificationCenterUtils */;
|
|
items2[value5] = value.incomingGameFriendRequestLocalItem(user, since, applicationId);
|
|
value5 + 1;
|
|
binding.notifCenterLocalItems = items2;
|
|
}
|
|
} else {
|
|
var FRIEND = RelationshipTypes.FRIEND;
|
|
if (type !== FRIEND) {
|
|
return false;
|
|
}
|
|
binding = env0_14;
|
|
binding.notifCenterLocalItems = binding.notifCenterLocalItems.map(_fun39762);
|
|
}
|
|
function _fun39762(a0) { // fn#39762, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:8012, offset: 0x010e9a1c, size: 198 bytes, params: 2, frame: 21
|
|
var r0;
|
|
var object;
|
|
let value = a0;
|
|
const isGameRelationshipItemBinding = isGameRelationshipItem;
|
|
const NotificationCenterLocalItems = (NotificationCenterItemsTypesModule).NotificationCenterLocalItems;
|
|
const INCOMING_GAME_FRIEND_REQUESTS = NotificationCenterLocalItems.INCOMING_GAME_FRIEND_REQUESTS;
|
|
const idBinding = id;
|
|
if (isGameRelationshipItemBinding(value, INCOMING_GAME_FRIEND_REQUESTS, idBinding, applicationId)) {
|
|
object = {};
|
|
copyDataProperties(object, value, idBinding);
|
|
object['acked'] = true;
|
|
object['forceUnacked'] = false;
|
|
value = 'incoming_game_friend_requests_accepted_' + id + '_' + value.id;
|
|
object['local_id'] = value;
|
|
object['type'] = NotificationCenterLocalItems.INCOMING_GAME_FRIEND_REQUESTS_ACCEPTED;
|
|
r0 = object;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
}
|
|
|
|
function GAME_RELATIONSHIP_REMOVE({userId, applicationId}) { // fn#39763, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:8321, offset: 0x010e9ae2, size: 61 bytes, params: 2, frame: 12
|
|
const binding = env0_14;
|
|
binding.notifCenterLocalItems = binding.notifCenterLocalItems.filter(_fun39764);
|
|
function _fun39764(a0) { // fn#39764, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:8443, offset: 0x010e9b1f, size: 125 bytes, params: 2, frame: 20
|
|
const value = environment.__proto__;
|
|
const isGameRelationshipItemBinding = isGameRelationshipItem;
|
|
const NotificationCenterLocalItems = (NotificationCenterItemsTypesModule).NotificationCenterLocalItems;
|
|
const INCOMING_GAME_FRIEND_REQUESTS = NotificationCenterLocalItems.INCOMING_GAME_FRIEND_REQUESTS;
|
|
return !isGameRelationshipItemBinding(a0, INCOMING_GAME_FRIEND_REQUESTS, userId,
|
|
applicationId) && !isGameRelationshipItem(a0,
|
|
NotificationCenterLocalItems.INCOMING_GAME_FRIEND_REQUESTS_ACCEPTED, userId, applicationId);
|
|
}
|
|
|
|
}
|
|
|
|
function NOTIFICATION_CENTER_ITEM_COMPLETED({item_enum}) { // fn#39765, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:8692, offset: 0x010e9b9c, size: 67 bytes, params: 2, frame: 13
|
|
const binding = env0_14;
|
|
const value2 = binding.notifCenterItems.map(function(a0) {
|
|
var r0;
|
|
var object;
|
|
var value = a0;
|
|
var item_enum2 = value.item_enum;
|
|
if (item_enum2 !== item_enum) {
|
|
r0 = value;
|
|
} else {
|
|
object = {};
|
|
copyDataProperties(object, value, item_enum2);
|
|
object['completed'] = true;
|
|
object['acked'] = true;
|
|
r0 = object;
|
|
}
|
|
return r0;
|
|
});
|
|
binding.notifCenterItems = value2.filter(_validate);
|
|
}
|
|
|
|
function MOBILE_NATIVE_UPDATE_CHECK_FINISHED({newBuild}) { // fn#39768, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:8938, offset: 0x010e9c1b, size: 152 bytes, params: 2, frame: 17
|
|
var value;
|
|
var value2;
|
|
var notifCenterLocalItems;
|
|
var binding;
|
|
var items2;
|
|
if (newBuild !== null) {
|
|
value2 = (require(4788) /* metro dependency 4788: NotificationCenterUtils */).mobileNativeUpdateAvailableLocalItem(newBuild);
|
|
notifCenterLocalItems = env0_14.notifCenterLocalItems;
|
|
if (notifCenterLocalItems.find(_fun39769) === undefined) {
|
|
binding = env0_14;
|
|
value = binding.notifCenterLocalItems.filter(_fun39770);
|
|
items2 = [];
|
|
value = arraySpread(items2, value, 0, notifCenterLocalItems);
|
|
items2[value] = value2;
|
|
value + 1;
|
|
binding.notifCenterLocalItems = items2;
|
|
}
|
|
}
|
|
function _fun39769({local_id}) { // fn#39769, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:9093, offset: 0x010e9cb3, size: 28 bytes, params: 2, frame: 2
|
|
return local_id === env0_0.local_id;
|
|
}
|
|
|
|
function _fun39770({kind}) { // fn#39770, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:9184, offset: 0x010e9ccf, size: 26 bytes, params: 2, frame: 2
|
|
return kind !== env0_0.kind;
|
|
}
|
|
|
|
}
|
|
|
|
function APPLICATIONS_FETCH_SUCCESS_39771({unknownApplicationIds}) { // fn#39771, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:9238, offset: 0x010e9ce9, size: 94 bytes, params: 2, frame: 13
|
|
var set;
|
|
var binding;
|
|
if (unknownApplicationIds != null) {
|
|
set = new global.Set(unknownApplicationIds);
|
|
binding = env0_14;
|
|
binding.notifCenterLocalItems = binding.notifCenterLocalItems.filter(_fun39772);
|
|
}
|
|
function _fun39772(a0) { // fn#39772, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4801:9390, offset: 0x010e9d47, size: 44 bytes, params: 2, frame: 12
|
|
return a0.applicationId == null || !env0_0.has(a0.applicationId);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun39705, 4623, [6, 7, 15, 17, 18, 4107, 4117, 3794, 3793, 1878, 661, 4624, 4625, 4788, 21, 566, 694,
|
|
2]) /* metro module 4623, dependencies: [6, 7, 15, 17, 18, 4107, 4117, 3794, 3793, 1878, 661, 4624, 4625, 4788, 21, 566, 694, 2] */;
|