228 lines
12 KiB
TypeScript
228 lines
12 KiB
TypeScript
/* Metro module 5039; source: modules/connections/ConnectionsHooks.tsx; dependencies: [57, 31, 5040, 1878, 661, 5047, 672, 566, 5049, 4239, 22, 4915, 2] */
|
|
import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import Durations from '../../utils/Durations.tsx'; /* Metro dependency 672 */
|
|
import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
|
|
import ConnectedAccountsStore from '../../stores/ConnectedAccountsStore.tsx'; /* Metro dependency 5040 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactModule from '../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as RiotSocialSDKMigrationModule from '../application_account_linking/experiments/riotSocialSDKMigration.tsx'; /* Metro dependency 4239 */
|
|
import * as KeyboardConstantsModule from '../../external/discord_common/js/shared/constants/KeyboardConstants.tsx'; /* Metro dependency 5047 */
|
|
import * as PlayStationVoiceExperimentModule from '../game_console/PlayStationVoiceExperiment.tsx'; /* Metro dependency 5049 */
|
|
|
|
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 usePlatformAllowed2 = usePlatformAllowed;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const PlatformTypes = ConstantsModule.PlatformTypes;
|
|
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 = (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]]);
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/connections/ConnectionsHooks.tsx');
|
|
exports.usePlatformAllowed = usePlatformAllowed2;
|
|
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 = (PlayStationVoiceExperimentModule).PlayStationVoiceExperiment;
|
|
const useConfig = PlayStationVoiceExperiment.useConfig;
|
|
const env0_2 = Reflect.apply(useConfig, PlayStationVoiceExperiment,
|
|
[{location: 'f2f7ef_1'}]).allowPlayStationStaging;
|
|
const env0_3 = (RiotSocialSDKMigrationModule).useIsRiotSocialSDKMigrationEnabled({location: 'usePlatformAllowed'});
|
|
return _fun43585;
|
|
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 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});
|
|
return ReactModule.useMemo(_fun43590, [ReactModule.useMemo(function() {
|
|
var Set = global.Set;
|
|
var value2 = new Set();
|
|
var env0_0 = value2;
|
|
accounts.forEach(_fun43589);
|
|
return value2;
|
|
}, [accounts]), value2]);
|
|
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 _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 _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 _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 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 ReactModule.useMemo(_fun43597, [usePlatformAllowed({forUserProfile: false})]);
|
|
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 _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);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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 [property, env0_0] = Module00057(ReactModule.useState(false), 2);
|
|
ReactModule.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 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 _fun43604() { // fn#43604, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5217:1965, offset: 0x011573c6, size: 65 bytes, params: 1, frame: 15
|
|
let window = global.window;
|
|
window.removeEventListener('keydown', handleKeyDown);
|
|
window = global.window;
|
|
window.removeEventListener('keyup', handleKeyUp);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun43582, 5039, [57, 31, 5040, 1878, 661, 5047, 672, 566, 5049, 4239, 22, 4915,
|
|
2]) /* metro module 5039, dependencies: [57, 31, 5040, 1878, 661, 5047, 672, 566, 5049, 4239, 22, 4915, 2] */;
|