217 lines
10 KiB
TypeScript
217 lines
10 KiB
TypeScript
/* Metro module 5039; source: modules/connections/ConnectionsHooks.tsx; dependencies: [57, 31, 5040, 1878, 661, 5047, 672, 566, 5049, 4239, 22, 4915, 2] */
|
|
function _fun43582(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#43582, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5217:6, offset: 0x01156c4b, size: 574 bytes, params: 8, frame: 27
|
|
const env0_0 = require;
|
|
const closure = usePlatformAllowed;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(57) /* metro dependency 57 */;
|
|
const env0_4 = importAll(31) /* metro dependency 31 */;
|
|
const connectedAccountsStore = importDefault(5040) /* metro dependency 5040: ConnectedAccountsStore */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
const constantsModule = require(661) /* metro dependency 661: Constants */;
|
|
const env0_7 = constantsModule.ACTIVITY_PLATFORM_TYPES;
|
|
const PlatformTypes = constantsModule.PlatformTypes;
|
|
const env0_9 = (require(5047) /* metro dependency 5047: KeyboardConstants */).KeyboardKeysUpdated;
|
|
object = {};
|
|
let INSTAGRAM = PlatformTypes.INSTAGRAM;
|
|
object[INSTAGRAM] = ['1036753656588017764'];
|
|
let Map = global.Map;
|
|
INSTAGRAM = PlatformTypes.INSTAGRAM;
|
|
object = [INSTAGRAM];
|
|
const Date = global.Date;
|
|
const date = new Date(2023, 1, 18);
|
|
const getTime = date.getTime;
|
|
object[1] = Reflect.apply(getTime, date, []);
|
|
let map = new Map([object]);
|
|
const Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
const DAY = Millis.DAY;
|
|
const env0_12 = 30 * DAY;
|
|
Map = global.Map;
|
|
const PLAYSTATION = PlatformTypes.PLAYSTATION;
|
|
const XBOX = PlatformTypes.XBOX;
|
|
const SPOTIFY = PlatformTypes.SPOTIFY;
|
|
const STEAM = PlatformTypes.STEAM;
|
|
const TWITCH = PlatformTypes.TWITCH;
|
|
map = new Map([[PLAYSTATION, 2], [XBOX, 2], [SPOTIFY, 1], [STEAM, 1], [TWITCH, 1]]);
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/connections/ConnectionsHooks.tsx');
|
|
exports.usePlatformAllowed = closure;
|
|
exports.usePlatforms = usePlatforms;
|
|
exports.useEmptyStatePlatforms = useEmptyStatePlatforms;
|
|
exports.useLegacyPlatformType = useLegacyPlatformType;
|
|
}
|
|
|
|
function usePlatformAllowed({forUserProfile}) { // fn#43583, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5217:345, offset: 0x01156e89, size: 167 bytes, params: 2, frame: 17
|
|
const env0_1 = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], function() {
|
|
return UserStore.getCurrentUser();
|
|
});
|
|
const PlayStationVoiceExperiment = (require(5049) /* metro dependency 5049: PlayStationVoiceExperiment */).PlayStationVoiceExperiment;
|
|
const useConfig = PlayStationVoiceExperiment.useConfig;
|
|
const env0_2 = Reflect.apply(useConfig, PlayStationVoiceExperiment,
|
|
[{location: 'f2f7ef_1'}]).allowPlayStationStaging;
|
|
const env0_3 = (require(4239) /* metro dependency 4239: riotSocialSDKMigration */).useIsRiotSocialSDKMigrationEnabled({location: 'usePlatformAllowed'});
|
|
return _fun43585;
|
|
}
|
|
|
|
function usePlatforms() { // fn#43586, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5217:999, offset: 0x01156fca, size: 143 bytes, params: 1, frame: 16
|
|
const accounts = (require(566) /* metro dependency 566: flux */).useStateFromStores([ConnectedAccountsStore],
|
|
function() {
|
|
return ConnectedAccountsStore.getAccounts();
|
|
});
|
|
let value2 = usePlatformAllowed({forUserProfile: false});
|
|
const binding = env0_4;
|
|
return binding.useMemo(_fun43590, [binding.useMemo(function() {
|
|
var Set = global.Set;
|
|
var value2 = new Set();
|
|
var env0_0 = value2;
|
|
accounts.forEach(_fun43589);
|
|
return value2;
|
|
}, [accounts]), value2]);
|
|
}
|
|
|
|
function useEmptyStatePlatforms() { // fn#43596, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5217:1437, offset: 0x011571db, size: 59 bytes, params: 1, frame: 14
|
|
return env0_4.useMemo(_fun43597, [usePlatformAllowed({forUserProfile: false})]);
|
|
}
|
|
|
|
function useLegacyPlatformType(a0) { // fn#43600, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5217:1668, offset: 0x011572a5, size: 129 bytes, params: 2, frame: 17
|
|
const value = a0;
|
|
const binding = env0_4;
|
|
const [property, env0_0] = env0_3(binding.useState(false), 2);
|
|
binding.useEffect(function() {
|
|
global.window.addEventListener('keydown', handleKeyDown);
|
|
global.window.addEventListener('keyup', handleKeyUp);
|
|
return _fun43604;
|
|
}, []);
|
|
return property ? value !== PlatformTypes.TWITTER ? value : PlatformTypes.TWITTER_LEGACY : value;
|
|
}
|
|
|
|
function _fun43585(a0) { // fn#43585, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5217:635, offset: 0x01156f30, size: 154 bytes, params: 2, frame: 14
|
|
var r1;
|
|
var r5;
|
|
var r2;
|
|
var r0;
|
|
var currentUserBinding;
|
|
var value3;
|
|
var value4;
|
|
var property;
|
|
var forUserProfileBinding;
|
|
const type = a0.type;
|
|
const value = environment.__proto__;
|
|
const PLAYSTATION_STAGING = PlatformTypes.PLAYSTATION_STAGING;
|
|
if (type === PLAYSTATION_STAGING) {
|
|
r0 = allowPlayStationStaging;
|
|
} else {
|
|
currentUserBinding = currentUser;
|
|
value3 = undefined;
|
|
value4 = value3 === currentUserBinding;
|
|
if (value4) {
|
|
r1 = value4;
|
|
r5 = value3;
|
|
} else {
|
|
property = env1_10[a0.type];
|
|
r1 = property == null;
|
|
r5 = property;
|
|
}
|
|
r1 = !r1 ? !r5.includes(currentUser.id) : r1;
|
|
if (r1) {
|
|
forUserProfileBinding = forUserProfile;
|
|
if (forUserProfileBinding) {
|
|
r1 = !!forUserProfileBinding;
|
|
} else {
|
|
r2 = a0.replacedBy == null || !env0_3;
|
|
r2 = r2 && a0.enabled;
|
|
r1 = r2;
|
|
}
|
|
r0 = r1;
|
|
} else {
|
|
r0 = !r1;
|
|
}
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function _fun43588() { // fn#43588, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5217:1138, offset: 0x0115706c, size: 58 bytes, params: 1, frame: 12
|
|
const Set = global.Set;
|
|
const set = new Set();
|
|
accounts.forEach(_fun43589);
|
|
return set;
|
|
}
|
|
|
|
function _fun43590() { // fn#43590, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5217:1221, offset: 0x011570c1, size: 119 bytes, params: 1, frame: 16
|
|
var environment;
|
|
let value = environment.__proto__;
|
|
value = importDefault(22) /* metro dependency 22 */;
|
|
return value.sortBy((importDefault(4915) /* metro dependency 4915: Platforms */).filter(env0_1), [_fun43591,
|
|
_fun43592, function(a0) {
|
|
return a0.hasMetadata;
|
|
}, function(a0) {
|
|
return !ACTIVITY_PLATFORM_TYPES.has(a0.type);
|
|
}, function(a0) {
|
|
return a0.name;
|
|
}]);
|
|
}
|
|
|
|
function _fun43597() { // fn#43597, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5217:1535, offset: 0x01157216, size: 92 bytes, params: 1, frame: 16
|
|
var environment;
|
|
let value = environment.__proto__;
|
|
value = importDefault(22) /* metro dependency 22 */;
|
|
return value.sortBy((importDefault(4915) /* metro dependency 4915: Platforms */).filter(env0_0), [_fun43598,
|
|
function(a0) {
|
|
return a0.name;
|
|
}]);
|
|
}
|
|
|
|
function handleKeyDown({key}) { // fn#43601, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5217:1746, owner: useLegacyPlatformType.handleKeyDown, offset: 0x01157326, size: 45 bytes, params: 2, frame: 11
|
|
const SHIFT = KeyboardKeysUpdated.SHIFT;
|
|
if (key === SHIFT) {
|
|
env0_0(true);
|
|
}
|
|
}
|
|
|
|
function handleKeyUp({key}) { // fn#43602, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5217:1797, owner: useLegacyPlatformType.handleKeyUp, offset: 0x01157353, size: 45 bytes, params: 2, frame: 11
|
|
const SHIFT = KeyboardKeysUpdated.SHIFT;
|
|
if (key === SHIFT) {
|
|
env0_0(false);
|
|
}
|
|
}
|
|
|
|
function _fun43603() { // fn#43603, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5217:1866, offset: 0x01157380, size: 70 bytes, params: 1, frame: 15
|
|
let window = global.window;
|
|
window.addEventListener('keydown', handleKeyDown);
|
|
window = global.window;
|
|
window.addEventListener('keyup', handleKeyUp);
|
|
return function() {
|
|
global.window.removeEventListener('keydown', handleKeyDown);
|
|
global.window.removeEventListener('keyup', handleKeyUp);
|
|
};
|
|
}
|
|
|
|
function _fun43589({type}) { // fn#43589, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5217:1175, offset: 0x011570a6, size: 27 bytes, params: 2, frame: 11
|
|
return env0_0.add(type);
|
|
}
|
|
|
|
function _fun43591(a0) { // fn#43591, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5217:1261, offset: 0x01157138, size: 95 bytes, params: 2, frame: 14
|
|
var r0;
|
|
var value3;
|
|
const value = environment.__proto__.__proto__;
|
|
let binding = env2_11;
|
|
const value2 = binding.has(a0.type);
|
|
if (value2) {
|
|
value3 = global.Date.now();
|
|
binding = env2_11;
|
|
r0 = value3 < (binding.get(a0.type) ?? 0) + env2_12;
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
return !r0;
|
|
}
|
|
|
|
function _fun43592({type}) { // fn#43592, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5217:1339, offset: 0x01157197, size: 27 bytes, params: 2, frame: 11
|
|
return env1_2.has(type);
|
|
}
|
|
|
|
function _fun43598({type}) { // fn#43598, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5217:1575, offset: 0x01157272, size: 51 bytes, params: 2, frame: 11
|
|
const value = environment.__proto__.__proto__;
|
|
return -1 * (env2_13.get(type) ?? 0);
|
|
}
|
|
|