173 lines
7.7 KiB
TypeScript
173 lines
7.7 KiB
TypeScript
/* Metro module 5244; source: modules/friend_suggestions/FriendSuggestionStore.tsx; dependencies: [6, 7, 15, 17, 18, 1885, 1878, 22, 5245, 5246, 566, 694, 2] */
|
|
function _fun46665(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#46665, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5422:6, offset: 0x011acc3e, size: 389 bytes, params: 8, frame: 19
|
|
const closure = transformFriendSuggestions;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_2 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_3 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_4 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_5 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_6 = importDefault(18) /* metro dependency 18 */;
|
|
const userRecord = importDefault(1885) /* metro dependency 1885: UserRecord */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
let env0_9 = {};
|
|
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
|
|
let value = _fun46673(Store);
|
|
value.displayName = 'FriendSuggestionStore';
|
|
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
|
|
{CONNECTION_OPEN: CONNECTION_OPEN_46680, FRIEND_SUGGESTION_CREATE: FRIEND_SUGGESTION_CREATE,
|
|
FRIEND_SUGGESTION_DELETE: FRIEND_SUGGESTION_DELETE, LOAD_FRIEND_SUGGESTIONS_SUCCESS: function(a0) {
|
|
env0_11 = false;
|
|
env0_10 = importDefault(dependencyMap[7]).keys(transformFriendSuggestions(a0.suggestions)).length;
|
|
}, LOAD_FRIEND_SUGGESTIONS_FAILURE: function() {
|
|
env0_11 = false;
|
|
env0_9 = {};
|
|
}});
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/friend_suggestions/FriendSuggestionStore.tsx');
|
|
exports.default = value;
|
|
exports.transformFriendSuggestions = closure;
|
|
}
|
|
|
|
function _isNativeReflectConstruct_46666() { // fn#46666, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5422:168, offset: 0x011acdc3, 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_46666_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function transformSuggestion(a0) { // fn#46669, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5422:384, offset: 0x011ace21, size: 185 bytes, params: 2, frame: 18
|
|
const r1 = a0.contact_names == null ? [] : a0.contact_names.length >= 2 ? a0.contact_names.slice(0, 2) : [];
|
|
const object2 = {};
|
|
object2.key = a0.suggested_user.id;
|
|
const value2 = undefined;
|
|
const defaultImport = importDefault(22) /* metro dependency 22 */;
|
|
const value3 = defaultImport.first(a0.reasons);
|
|
object2.name = value3 == null ? value2 : value3.name;
|
|
const userRecord = new UserRecord(a0.suggested_user);
|
|
object2.user = userRecord;
|
|
object2.mutualFriendsCount = a0.mutual_friends_count;
|
|
object2.contactNames = r1;
|
|
return object2;
|
|
}
|
|
|
|
function transformFriendSuggestions(a0) { // fn#46670, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5422:675, offset: 0x011aceda, size: 83 bytes, params: 2, frame: 12
|
|
let value = importDefault(22) /* metro dependency 22 */;
|
|
value = value.chain(a0);
|
|
value = value.map(function(a0) {
|
|
return transformSuggestion(a0);
|
|
});
|
|
value = value.keyBy(function(a0) {
|
|
return a0.key;
|
|
});
|
|
return value.value();
|
|
}
|
|
|
|
function _fun46673(a0) { // fn#46673, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5422:803, offset: 0x011acf40, size: 139 bytes, params: 2, frame: 16
|
|
const closure = FriendSuggestionStore;
|
|
env0_6(closure, a0);
|
|
return env0_3(closure, [{key: 'initialize', value: function() {
|
|
this.waitFor(UserStore);
|
|
}}, {key: 'getSuggestionCount', value: value_46676}, {key: 'getSuggestions', value: value_46677},
|
|
{key: 'getSuggestion', value: value_46679}]);
|
|
}
|
|
|
|
function CONNECTION_OPEN_46680({friendSuggestionCount}) { // fn#46680, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5422:1453, offset: 0x011acff8, size: 125 bytes, params: 2, frame: 12
|
|
env0_9 = {};
|
|
if (friendSuggestionCount > 0) {
|
|
if (!env0_11 && true) {
|
|
(importDefault(5245) /* metro dependency 5245: FriendSuggestionActionCreators */).fetch();
|
|
}
|
|
} else {
|
|
(importDefault(5246) /* metro dependency 5246: maybeDispatchDevOnlyDummyFriendSuggestions */)();
|
|
}
|
|
}
|
|
|
|
function FRIEND_SUGGESTION_CREATE({suggestion}) { // fn#46681, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5422:1624, offset: 0x011ad075, size: 86 bytes, params: 2, frame: 14
|
|
const value2 = transformSuggestion(suggestion);
|
|
let binding = env0_9;
|
|
if (binding[value2.key] != null) {
|
|
return false;
|
|
}
|
|
binding = env0_10;
|
|
env0_10 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
|
|
const object2 = {};
|
|
copyDataProperties(object2, env0_9, value2);
|
|
object2[value2.key] = value2;
|
|
}
|
|
|
|
function FRIEND_SUGGESTION_DELETE({suggestedUserId}) { // fn#46682, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5422:1781, offset: 0x011ad0cb, size: 60 bytes, params: 2, frame: 14
|
|
const Math = global.Math;
|
|
const max = Math.max;
|
|
const binding = env0_10;
|
|
env0_10 = Reflect.apply(max, Math, [0, typeof binding === 'bigint' ? binding - 1n : +binding - 1]);
|
|
delete env0_9[suggestedUserId];
|
|
}
|
|
|
|
function value_46677() { // fn#46677, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5422:1249, offset: 0x011acfcb, size: 45 bytes, params: 1, frame: 11
|
|
var environment;
|
|
const Object = global.Object;
|
|
const entries = Object.entries;
|
|
let value = environment.__proto__;
|
|
return Reflect.apply(entries, Object, [env1_9]).map(function(a0) {
|
|
var r0;
|
|
var r1;
|
|
var r2;
|
|
var item3;
|
|
var value3;
|
|
var iterator = a0[Symbol.iterator]();
|
|
var iterator2 = iterator.next;
|
|
var item2 = Reflect.apply(iterator2, iterator, []);
|
|
var item = item2.value;
|
|
item2 = item2.done ? undefined : iterator;
|
|
var value = undefined;
|
|
var value2 = item2 === value;
|
|
if (value2) {
|
|
r0 = value;
|
|
r1 = item2;
|
|
r2 = value2;
|
|
} else {
|
|
item3 = Reflect.apply(iterator2, item2, []);
|
|
item = item3.value;
|
|
item3 = item3.done ? undefined : item2;
|
|
value3 = item3 === value;
|
|
if (value3) {
|
|
r0 = value;
|
|
r1 = item3;
|
|
r2 = value3;
|
|
} else {
|
|
r0 = item;
|
|
r1 = item3;
|
|
r2 = value3;
|
|
}
|
|
}
|
|
if (!r2) {
|
|
r1.return();
|
|
}
|
|
return r0;
|
|
});
|
|
}
|
|
|