284 lines
14 KiB
TypeScript
284 lines
14 KiB
TypeScript
/* Metro module 14445; source: modules/guilds_bar/native/GuildsBarCreateJoinButton.tsx; dependencies: [57, 5, 31, 27, 14162, 1226, 3969, 661, 1376, 1880, 33, 14395, 4508, 4501, 14446, 10748, 1962, 12025, 6823, 7882, 6789, 12558, 6947, 1478, 1357, 3860, 697, 566, 1423, 1457, 1365, 7013, 14447, 14448, 1244, 478, 2] */
|
|
function _fun109300(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#109300, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14642:6, offset: 0x023452ba, size: 442 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const renderUnreadIndicatorNoEntering = function(a0, a1, a2, a3) {
|
|
var value = a2;
|
|
var moduleValue = require(dependencyMap[11]);
|
|
return moduleValue.renderUnreadIndicator(a0, a1,
|
|
value !== require(dependencyMap[12]).TransitionStates.ENTERED ? value : require(dependencyMap[12]).TransitionStates.MOUNTED,
|
|
|
|
a3);
|
|
};
|
|
const closure = function() {
|
|
return _handleCreateJoinGuildPress.apply(this, arguments);
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(57) /* metro dependency 57 */;
|
|
const env0_4 = importDefault(5) /* metro dependency 5 */;
|
|
let value = importAll(31) /* metro dependency 31 */;
|
|
const env0_6 = (require(27) /* metro dependency 27 */).View;
|
|
const mobileGameCommunitiesStore = importDefault(14162) /* metro dependency 14162: MobileGameCommunitiesStore */;
|
|
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
|
|
const selectedGuildStore = importDefault(3969) /* metro dependency 3969: SelectedGuildStore */;
|
|
const constantsModule = require(661) /* metro dependency 661: Constants */;
|
|
const env0_10 = constantsModule.AnalyticsPages;
|
|
const env0_11 = constantsModule.DM_WIDTH;
|
|
const env0_12 = constantsModule.TooltipNames;
|
|
const env0_13 = constantsModule.UpsellTypes;
|
|
const env0_14 = constantsModule.MOBILE_GUILD_UPSELL_LIST;
|
|
const env0_15 = (require(1376) /* metro dependency 1376: DismissibleContentConstants */).ContentDismissActionType;
|
|
const env0_16 = (require(1880) /* metro dependency 1880: PremiumConstants */).PremiumUpsellTypes;
|
|
const value3 = require(33) /* metro dependency 33 */;
|
|
const env0_17 = value3.jsx;
|
|
const env0_18 = value3.jsxs;
|
|
const env0_19 = (require(4501) /* metro dependency 4501: createStyles */).createStyles(function(a0) {
|
|
var object = {};
|
|
var value = 0;
|
|
object.marginOverrides = {marginTop: value};
|
|
var object3 = {'position': 'absolute', 'left': null, 'top': 0};
|
|
object3.left = -(DM_WIDTH - require(dependencyMap[14]).BG_CONTAINER_SIZE) / 2 - (a0 ? value : 1);
|
|
object.guildIndicator = object3;
|
|
return object;
|
|
});
|
|
value = value.memo(GuildsBarCreateJoinButton);
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guilds_bar/native/GuildsBarCreateJoinButton.tsx');
|
|
exports.default = value;
|
|
exports.handleCreateJoinGuildPress = closure;
|
|
}
|
|
|
|
function _handleCreateJoinGuildPress() { // fn#109303, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14642:789, offset: 0x023454e4, size: 50 bytes, params: 1, frame: 14
|
|
return env0_4(_fun109305).apply(this, arguments);
|
|
}
|
|
|
|
function GuildsBarCreateJoinButton() { // fn#109307, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14642:1468, offset: 0x02345746, size: 1013 bytes, params: 1, frame: 29
|
|
const height = importDefault(dependencyMap[23])().height;
|
|
const value2 = importDefault(dependencyMap[24])('GuildsBarCreateJoinButton');
|
|
const moduleValue = require(dependencyMap[25]);
|
|
const useToken = moduleValue.useToken;
|
|
const GUILD_BAR_ITEM_SIZE = importDefault(dependencyMap[26]).modules.mobile.GUILD_BAR_ITEM_SIZE;
|
|
const value3 = Reflect.apply(useToken, moduleValue, [GUILD_BAR_ITEM_SIZE]);
|
|
const GameCommunityUpsellMultiExperiment = require(dependencyMap[21]).GameCommunityUpsellMultiExperiment;
|
|
const useConfig = GameCommunityUpsellMultiExperiment.useConfig;
|
|
const enabled = Reflect.apply(useConfig, GameCommunityUpsellMultiExperiment,
|
|
[{location: 'GuildsBarCreateJoinButton'}]).enabled;
|
|
const value4 = require(dependencyMap[27]).useStateFromStores([SelectedGuildStore], function() {
|
|
return SelectedGuildStore.getGuildId() === MOBILE_GUILD_UPSELL_LIST;
|
|
});
|
|
const env0_3 = value4;
|
|
const styles = useStyles(value4);
|
|
const value5 = require(dependencyMap[27]).useStateFromStoresArray([MobileGameCommunitiesStore], _fun109309);
|
|
const value6 = require(dependencyMap[27]).useStateFromStores([AuthenticationStore], _fun109310);
|
|
const env0_5 = value6;
|
|
let binding = env0_5;
|
|
let useMemo = binding.useMemo;
|
|
const value7 = Reflect.apply(useMemo, binding, [_fun109311, [enabled, value5, value3]]);
|
|
let r17 = value7 != null && value7.length >= 2;
|
|
binding = env0_5;
|
|
useMemo = binding.useMemo;
|
|
const value12 = env0_3(require(dependencyMap[31]).useSelectedDismissibleContent(Reflect.apply(useMemo, binding,
|
|
[_fun109313, [value6, r17]])), 2);
|
|
const property = value12[0];
|
|
const property2 = value12[1];
|
|
r17 = r17 && property != null;
|
|
binding = env0_5;
|
|
const [property3, env0_10] = env0_3(binding.useState(false), 2);
|
|
const value16 = binding.useRef(null);
|
|
const env0_12 = binding.useRef(null);
|
|
const env0_13 = binding.useRef(null);
|
|
const env0_14 = binding.useRef(false);
|
|
const value17 = binding.useCallback(_fun109314, []);
|
|
binding.useEffect(_fun109315, [r17, height]);
|
|
const value18 = binding.useCallback(_fun109320, [enabled, property, property2]);
|
|
const value19 = binding.useMemo(_fun109321, [value4, enabled]);
|
|
const defaultImport2 = importDefault(dependencyMap[14]);
|
|
const defaultImport2Props = {iconSource: importDefault(value2 ? dependencyMap[32] : dependencyMap[33]),
|
|
backgroundIcons: value7, isExpanded: property3, onPress: value18};
|
|
const intl = require(dependencyMap[34]).intl;
|
|
defaultImport2Props.accessibilityLabel = intl.string(require(dependencyMap[34]).t.l5WIbf);
|
|
defaultImport2Props.selected = value4;
|
|
defaultImport2Props.style = styles.marginOverrides;
|
|
const defaultImport22 = ((Component) => <Component {...defaultImport2Props} />)(defaultImport2);
|
|
const TransitionItem = require(dependencyMap[12]).TransitionItem;
|
|
const moduleValue6 = require(dependencyMap[35]);
|
|
return (
|
|
<View ref={value16} onLayout={value17}>
|
|
{defaultImport22}
|
|
<View style={styles.guildIndicator}>
|
|
<TransitionItem
|
|
item={value19}
|
|
renderItem={moduleValue6.isAndroid() ? renderUnreadIndicatorNoEntering : require(dependencyMap[11]).renderUnreadIndicator}
|
|
/>
|
|
</View>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
function* _fun109305() { // fn#109305, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14642:866, offset: 0x02345521, size: 443 bytes, params: 1, frame: 21
|
|
var GameCommunityUpsellMultiExperiment;
|
|
var object2;
|
|
var binding4;
|
|
var value11;
|
|
var handleShowUpsellAlert;
|
|
if (true) {
|
|
value = environment.__proto__.__proto__;
|
|
var binding = env2_0;
|
|
var binding2 = env2_2;
|
|
var value3 = binding(binding2[16]);
|
|
var property = binding2[15];
|
|
yield value3(property, binding2.paths);
|
|
var value4 = undefined;
|
|
if (false) {
|
|
return value4;
|
|
}
|
|
property = value4.default;
|
|
binding = env2_0;
|
|
var binding3 = env2_2;
|
|
yield binding(binding3[16])(binding3[17], binding3.paths);
|
|
var value7 = undefined;
|
|
if (false) {
|
|
return value7;
|
|
}
|
|
var property3 = value7.default;
|
|
var acknowledgeTooltip = property.acknowledgeTooltip;
|
|
var GUILD_TOOLTIP = env2_12.GUILD_TOOLTIP;
|
|
Reflect.apply(acknowledgeTooltip, property, [GUILD_TOOLTIP]);
|
|
var value9 = env2_0(env2_2[18]);
|
|
if (value9.isAtGuildCapAndNonPremium()) {
|
|
binding = env2_1;
|
|
binding4 = env2_2;
|
|
value11 = binding(binding4[19]);
|
|
handleShowUpsellAlert = value11.handleShowUpsellAlert;
|
|
object2 = {};
|
|
object2.initialUpsellKey = env2_13.GUILD_CAP;
|
|
object2.analyticsLocation = {page: env2_10.CREATE_JOIN_GUILD_MODAL};
|
|
object2.analyticsLocations = [binding(binding4[20]).NEW_GUILD_BUTTON];
|
|
object2.analyticsProperties = {type: env2_16.GUILD_CAP_MODAL_UPSELL};
|
|
Reflect.apply(handleShowUpsellAlert, value11, [object2]);
|
|
} else {
|
|
binding = env2_0;
|
|
GameCommunityUpsellMultiExperiment = binding(env2_2[21]).GameCommunityUpsellMultiExperiment;
|
|
if (GameCommunityUpsellMultiExperiment.getConfig({location: 'GuildsBarCreateJoinButton'}).enabled) {
|
|
binding = env2_7;
|
|
if (binding.hasGuilds()) {
|
|
env2_0(env2_2[22]).transitionToGuild(env2_14);
|
|
} else {
|
|
property3.openCreateGuildModal();
|
|
}
|
|
} else {
|
|
property3.openCreateGuildModal();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function _fun109309() { // fn#109309, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14642:1845, offset: 0x02345b56, size: 35 bytes, params: 1, frame: 13
|
|
const value = environment.__proto__;
|
|
return MobileGameCommunitiesStore.getPresentableUpsellGuilds().slice(0, 2);
|
|
}
|
|
|
|
function _fun109311() { // fn#109311, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14642:1970, offset: 0x02345b92, size: 61 bytes, params: 1, frame: 11
|
|
if (enabled) {
|
|
return env0_4.length < 2 ? [] : env0_4.map(_fun109312);
|
|
}
|
|
}
|
|
|
|
function _fun109313() { // fn#109313, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14642:2199, offset: 0x02345c48, size: 73 bytes, params: 1, frame: 12
|
|
return env0_5 && env0_6 ? [(require(1365) /* metro dependency 1365: dismissible_content */).DismissibleContent.MOBILE_MULTI_GUILD_CREATE_UPSELL_ANIMATION] : [];
|
|
}
|
|
|
|
function _fun109315() { // fn#109315, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14642:2532, offset: 0x02345c91, size: 64 bytes, params: 1, frame: 15
|
|
if (env0_9) {
|
|
env0_13.current = global.setInterval(_fun109316, 500);
|
|
return _fun109319;
|
|
}
|
|
}
|
|
|
|
function _fun109320() { // fn#109320, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14642:2827, offset: 0x02345db6, size: 112 bytes, params: 1, frame: 13
|
|
var clearInterval;
|
|
var current;
|
|
var clearTimeout;
|
|
var binding;
|
|
if (enabled) {
|
|
clearInterval = global.clearInterval;
|
|
current = env0_13.current;
|
|
clearInterval(current);
|
|
clearTimeout = global.clearTimeout;
|
|
current = env0_12.current;
|
|
clearTimeout(current);
|
|
env0_10(false);
|
|
if (env0_7 != null) {
|
|
binding = env0_8;
|
|
value = environment.__proto__;
|
|
binding(ContentDismissActionType.TAKE_ACTION);
|
|
}
|
|
}
|
|
handleCreateJoinGuildPress();
|
|
}
|
|
|
|
function _fun109321() { // fn#109321, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14642:2971, offset: 0x02345e26, size: 42 bytes, params: 1, frame: 2
|
|
if (env0_3) {
|
|
if (enabled) {
|
|
return {selected: env0_3, id: 'unread'};
|
|
}
|
|
}
|
|
}
|
|
|
|
function _fun109312({icon, id}) { // fn#109312, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14642:2008, offset: 0x02345bcf, size: 121 bytes, params: 2, frame: 16
|
|
let value = null;
|
|
const r4 = value != icon ? icon : value;
|
|
value = environment.__proto__.__proto__;
|
|
const defaultImport = importDefault(1423) /* metro dependency 1423: AvatarUtils */;
|
|
const getGuildIconSource = defaultImport.getGuildIconSource;
|
|
const object2 = {};
|
|
object2.id = id;
|
|
object2.icon = r4;
|
|
object2.canAnimate = false;
|
|
const binding = env1_1;
|
|
value = require(1457) /* metro dependency 1457: ImageLoaderUtils */;
|
|
const getDevicePixelRatio = value.getDevicePixelRatio;
|
|
object2.size = binding * Reflect.apply(getDevicePixelRatio, value, []);
|
|
return Reflect.apply(getGuildIconSource, defaultImport, [object2]);
|
|
}
|
|
|
|
function _fun109316() { // fn#109316, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14642:2572, offset: 0x02345cd1, size: 54 bytes, params: 1, frame: 11
|
|
let current = env1_14.current;
|
|
if (current) {
|
|
current = env1_11.current;
|
|
if (current != null) {
|
|
current.measureInWindow(_fun109317);
|
|
}
|
|
}
|
|
}
|
|
|
|
function _fun109319() { // fn#109319, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14642:2742, offset: 0x02345d85, size: 49 bytes, params: 1, frame: 13
|
|
global.clearInterval(env1_13.current);
|
|
global.clearTimeout(env1_12.current);
|
|
}
|
|
|
|
function _fun109317(a0, a1, a2, a3) { // fn#109317, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14642:2635, offset: 0x02345d07, size: 108 bytes, params: 5, frame: 14
|
|
var environment;
|
|
var r0;
|
|
var clearInterval;
|
|
let value = a3 > 0;
|
|
if (value) {
|
|
value = environment.__proto__.__proto__;
|
|
value = a1 < height;
|
|
r0 = value;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
r0 = r0 && a1 + a3 > 0;
|
|
if (r0) {
|
|
clearInterval = global.clearInterval;
|
|
value = environment.__proto__.__proto__;
|
|
clearInterval(env2_13.current);
|
|
env2_12.current = global.setTimeout(_fun109318, 1000);
|
|
}
|
|
}
|
|
|
|
function _fun109318() { // fn#109318, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14642:2712, offset: 0x02345d73, size: 18 bytes, params: 1, frame: 11
|
|
env3_10(true);
|
|
}
|
|
|