This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,217 @@
// Metro module 13502 (f13503).
import AccessibilityStore from "./AccessibilityStore";
import { AnalyticEvents } from "../../Constants";
import { StickerAnimationSettings } from "../stickers/StickersConstants";
import { SettingsOverrideReasonKeys } from "../user_settings/UserSettingsConstants";
import Dispatcher from "../../Dispatcher";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import UserSettingsActionCreators from "../../actions/UserSettingsActionCreators";
export function setFontSize(a0) {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SET_FONT_SIZE",
fontSize: a0
});
}
export function setMessageGroupSpacing(messageGroupSpacing = null) {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SET_MESSAGE_GROUP_SPACING",
messageGroupSpacing
});
}
export function setZoom(a0) {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SET_ZOOM",
zoom: a0
});
}
export function resetToDefault() {
Dispatcher.dispatch({
type: "ACCESSIBILITY_RESET_TO_DEFAULT"
});
}
export function enableKeyboardMode() {
Dispatcher.dispatch({
type: "ACCESSIBILITY_KEYBOARD_MODE_ENABLE"
});
AnalyticsUtils.track(AnalyticEvents.KEYBOARD_MODE_TOGGLED, {
enabled: true
});
}
export function disableKeyboardMode() {
Dispatcher.dispatch({
type: "ACCESSIBILITY_KEYBOARD_MODE_DISABLE"
});
AnalyticsUtils.track(AnalyticEvents.KEYBOARD_MODE_TOGGLED, {
enabled: false
});
}
export function toggleDesaturateUserColors() {
Dispatcher.dispatch({
type: "ACCESSIBILITY_DESATURATE_ROLES_TOGGLE"
});
}
export function toggleColorblindMode() {
Dispatcher.dispatch({
type: "ACCESSIBILITY_COLORBLIND_TOGGLE"
});
}
export function forcedColorsModalSeen() {
Dispatcher.dispatch({
type: "ACCESSIBILITY_FORCED_COLORS_MODAL_SEEN"
});
}
export function keyboardNavigationExplainerModalSeen() {
Dispatcher.dispatch({
type: "KEYBOARD_NAVIGATION_EXPLAINER_MODAL_SEEN"
});
}
export function systemPrefersReducedMotionChanged(a0) {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SYSTEM_PREFERS_REDUCED_MOTION_CHANGED",
systemPrefersReducedMotion: a0
});
}
export function systemPrefersCrossfadesChanged(a0) {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SYSTEM_PREFERS_CROSSFADES_CHANGED",
systemPrefersCrossfades: a0
});
}
export function setLowContrastMode(a0) {
Dispatcher.dispatch({
type: "ACCESSIBILITY_LOW_CONTRAST_TOGGLE",
lowContrastMode: a0
});
}
export function setSaturation(a0) {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SET_SATURATION",
saturation: a0
});
}
export function setPrefersReducedMotion(a0) {
let useReducedMotion = AccessibilityStore.useReducedMotion;
Dispatcher.dispatch({
type: "ACCESSIBILITY_SET_PREFERS_REDUCED_MOTION",
prefersReducedMotion: a0
});
if (!useReducedMotion && AccessibilityStore.useReducedMotion) {
UserSettingsActionCreators.applySettingsOverride({
gifAutoPlay: {
value: false,
reasonKey: SettingsOverrideReasonKeys.REDUCED_MOTION
},
animateEmoji: {
value: false,
reasonKey: SettingsOverrideReasonKeys.REDUCED_MOTION
},
animateStickers: {
value: StickerAnimationSettings.ANIMATE_ON_INTERACTION,
reasonKey: SettingsOverrideReasonKeys.REDUCED_MOTION_STICKERS
}
});
} else {
if (useReducedMotion) {
useReducedMotion = !AccessibilityStore.useReducedMotion;
}
if (useReducedMotion) {
UserSettingsActionCreators.clearSettingsOverride("gifAutoPlay", "animateEmoji", "animateStickers");
}
}
}
export function setSyncForcedColors(a0) {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SET_SYNC_FORCED_COLORS",
syncForcedColors: a0
});
}
export function systemColorPreferencesChanged(a0) {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SYSTEM_COLOR_PREFERENCES_CHANGED",
systemForcedColors: a0
});
}
export function systemPrefersContrastChanged(a0) {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SYSTEM_PREFERS_CONTRAST_CHANGED",
systemPrefersContrast: a0
});
}
export function setAlwaysShowLinkDecorations(a0) {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SET_ALWAYS_SHOW_LINK_DECORATIONS",
alwaysShowLinkDecorations: a0
});
}
export function setEnableCustomCursor(a0) {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SET_ENABLE_CUSTOM_CURSOR",
enableCustomCursor: a0
});
}
export function setRoleStyle(a0) {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SET_ROLE_STYLE",
roleStyle: a0
});
AnalyticsUtils.track(AnalyticEvents.ROLE_STYLE_SETTING_UPDATED, {
role_style: a0
});
}
export function setOfficialMessageStyle(a0) {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SET_OFFICIAL_MESSAGE_STYLE",
officialMessageStyle: a0
});
AnalyticsUtils.track(AnalyticEvents.OFFICIAL_MESSAGE_STYLE_SETTING_UPDATED, {
official_message_style: a0
});
}
export function setDisplayNameStylesEnabled(a0) {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SET_DISPLAY_NAME_STYLES_ENABLED",
enabled: a0
});
}
export function toggleSubmitButton() {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SUBMIT_BUTTON_TOGGLE"
});
}
export function toggleSyncProfileThemeWithUserTheme() {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SYNC_PROFILE_THEME_WITH_USER_THEME_TOGGLE"
});
}
export function setContrast(a0) {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SET_CONTRAST",
contrast: a0
});
}
export function setContrastMode(a0) {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SET_CONTRAST_MODE",
contrastMode: a0
});
}
export function setSwitchIconsEnabled(a0) {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SET_SWITCH_ICONS_ENABLED",
switchIconsEnabled: a0
});
}
export function setChatBarSettings(a0) {
Dispatcher.dispatch({
type: "ACCESSIBILITY_SET_CHAT_BAR_SETTINGS",
...a0
});
}
export function setHDRDynamicRange(a0) {
Dispatcher.dispatch({
type: "UNSYNCED_USER_SETTINGS_UPDATE",
settings: {
hdrDynamicRange: a0
}
});
}
+60
View File
@@ -0,0 +1,60 @@
// Metro module 13259 (f13260).
const r9 = {
NONE: 0,
0: "NONE",
SCREENREADER: 1,
1: "SCREENREADER",
REDUCED_MOTION: 2,
2: "REDUCED_MOTION",
REDUCED_MOTION_PREFERS_CROSSFADES: 4194304
};
r9[4194304] = "REDUCED_MOTION_PREFERS_CROSSFADES";
r9.REDUCED_TRANSPARENCY = 4;
r9[4] = "REDUCED_TRANSPARENCY";
r9.HIGH_CONTRAST = 8;
r9[8] = "HIGH_CONTRAST";
r9.BOLD_TEXT = 16;
r9[16] = "BOLD_TEXT";
r9.GRAYSCALE = 32;
r9[32] = "GRAYSCALE";
r9.INVERT_COLORS = 64;
r9[64] = "INVERT_COLORS";
r9.PREFERS_COLOR_SCHEME_LIGHT = 128;
r9[128] = "PREFERS_COLOR_SCHEME_LIGHT";
r9.PREFERS_COLOR_SCHEME_DARK = 256;
r9[256] = "PREFERS_COLOR_SCHEME_DARK";
r9.CHAT_FONT_SCALE_INCREASED = 512;
r9[512] = "CHAT_FONT_SCALE_INCREASED";
r9.CHAT_FONT_SCALE_DECREASED = 1024;
r9[1024] = "CHAT_FONT_SCALE_DECREASED";
r9.ZOOM_LEVEL_INCREASED = 2048;
r9[2048] = "ZOOM_LEVEL_INCREASED";
r9.ZOOM_LEVEL_DECREASED = 4096;
r9[4096] = "ZOOM_LEVEL_DECREASED";
r9.MESSAGE_GROUP_SPACING_INCREASED = 8192;
r9[8192] = "MESSAGE_GROUP_SPACING_INCREASED";
r9.MESSAGE_GROUP_SPACING_DECREASED = 16384;
r9[16384] = "MESSAGE_GROUP_SPACING_DECREASED";
r9.DARK_SIDEBAR = 32768;
r9[32768] = "DARK_SIDEBAR";
r9.REDUCED_MOTION_FROM_USER_SETTINGS = 65536;
r9[65536] = "REDUCED_MOTION_FROM_USER_SETTINGS";
r9.SATURATION_LEVEL_DECREASED = 131072;
r9[131072] = "SATURATION_LEVEL_DECREASED";
r9.FORCED_COLORS = 262144;
r9[262144] = "FORCED_COLORS";
r9.FORCED_COLORS_FROM_USER_SETTINGS = 524288;
r9[524288] = "FORCED_COLORS_FROM_USER_SETTINGS";
r9.ROLE_STYLE_ADJUSTED = 1048576;
r9[1048576] = "ROLE_STYLE_ADJUSTED";
r9.SYNC_PROFILE_THEME_WITH_USER_THEME = 2097152;
r9[2097152] = "SYNC_PROFILE_THEME_WITH_USER_THEME";
r9.CONTRAST_LEVEL_INCREASED = 8388608;
r9[8388608] = "CONTRAST_LEVEL_INCREASED";
r9.CONTRAST_LEVEL_DECREASED = 16777216;
r9[16777216] = "CONTRAST_LEVEL_DECREASED";
r9.UI_DENSITY_COMPACT = 33554432;
r9[33554432] = "UI_DENSITY_COMPACT";
r9.UI_DENSITY_SPACIOUS = 67108864;
r9[67108864] = "UI_DENSITY_SPACIOUS";
export { r9 as AccessibilityFeatureFlags };
+565
View File
@@ -0,0 +1,565 @@
// Metro module 4181 (f4182).
import _objectWithoutProperties from "../../_bundle/_objectWithoutProperties";
import ThemeStore from "../user_settings/ThemeStore";
import UserSettingsProtoStore from "../user_settings/UserSettingsProtoStore";
import { Accessibility, ThemeTypes } from "../../Constants";
import { DEFAULT_COMPACT_SPACING, DEFAULT_COZY_SPACING, MESSAGE_GROUP_SPACING } from "../messages/MessageConstants";
import CrossPlatformNativeUtils_native from "../../utils/CrossPlatformNativeUtils.native";
import { ClientThemeSettings, MessageDisplayCompact } from "../user_settings/UserSettings";
import Module589 from "../../_bundle/Module589";
import { Storage } from "../../_bundle/Module595";
import { LOW_SATURATION_THRESHOLD } from "../../design/shared";
import Dispatcher from "../../Dispatcher";
import { HermesBuiltin } from "../../_hermes/prelude";
let _excluded, c2407_12, c2407_13, c2407_14, c2407_15, c2407_16;
const maybeApplyNoTextColorForLightCustomTheme = function maybeApplyNoTextColorForLightCustomTheme() {
const officialMessageStyleExplicitlySet = c2407_15.officialMessageStyleExplicitlySet;
let r3 = !officialMessageStyleExplicitlySet;
if (!officialMessageStyleExplicitlySet) {
let r1 = c2407_15.officialMessageStyle !== "default" || ThemeStore.theme !== ThemeTypes.LIGHT;
if (!r1) {
const setting = ClientThemeSettings.getSetting();
let r2 = setting.backgroundGradientPresetId != null;
if (!r2) {
const customUserThemeSettings = setting.customUserThemeSettings;
let r26 = customUserThemeSettings == null ? void 0 : customUserThemeSettings.colors?.length;
if (r26 == null) {
r26 = 0;
}
r2 = r26 > 0;
}
r1 = !r2;
}
let r29 = !r1;
if (!r1) {
c2407_15.officialMessageStyle = "no_text_color";
r29 = true;
}
r3 = r29;
}
return r3;
};
_excluded = ["fontScale"];
c2407_12 = {
DEFAULT: "default",
HIGH: "high"
};
c2407_13 = {
FLEXIBLE: "flexible",
CONDENSED: "condensed",
HIDDEN: "hidden"
};
c2407_14 = {
fontSize: Accessibility.FONT_SIZE_DEFAULT,
zoom: Accessibility.ZOOM_DEFAULT,
keyboardModeEnabled: false,
contrastMode: c2407_12.DEFAULT,
colorblindMode: false,
lowContrastMode: false,
saturation: 1,
contrast: 1,
desaturateUserColors: false,
forcedColorsModalSeen: false,
keyboardNavigationExplainerModalSeen: false,
messageGroupSpacing: null,
systemPrefersReducedMotion: "no-preference",
systemPrefersCrossfades: false,
prefersReducedMotion: "auto",
systemForcedColors: "none",
syncForcedColors: true,
systemPrefersContrast: "no-preference",
alwaysShowLinkDecorations: false,
roleStyle: "username",
officialMessageStyle: "default",
officialMessageStyleExplicitlySet: false,
displayNameStylesEnabled: true,
submitButtonEnabled: false,
syncProfileThemeWithUserTheme: false,
enableCustomCursor: true,
switchIconsEnabled: false,
appsButtonEnabled: true,
expressionPickerFormat: c2407_13.FLEXIBLE,
condensePickerWhenNarrow: true,
emojiButtonEnabled: true,
gifButtonEnabled: true,
stickerButtonEnabled: true
};
c2407_15 = c2407_14;
c2407_16 = {
12: "font-size-12",
14: "font-size-14",
15: "font-size-15",
16: "font-size-16",
18: "font-size-18",
20: "font-size-20",
24: "font-size-24"
};
class AccessibilityStore extends Module589.DeviceSettingsStore {
static displayName = "AccessibilityStore";
static persistKey = "AccessibilityStore";
static migrations = [() => {
const fontScale2 = Storage.get("a11yFontScale") || 100;
const zoom2 = Storage.get("a11yZoom") || Accessibility.ZOOM_DEFAULT;
const colorblindMode2 = Storage.get("a11yColorblindMode") || false;
Storage.remove("a11yFontScale");
Storage.remove("a11yZoom");
Storage.remove("a11yColorblindMode");
return {
fontScale: fontScale2,
zoom: zoom2,
colorblindMode: colorblindMode2,
keyboardModeEnabled: false
};
}, (a0) => {
const fontScale2 = a0.fontScale;
return {
..._objectWithoutProperties(a0, _excluded),
fontSize: fontScale2 === 82 ? 12 : fontScale2 === 92 ? 15 : fontScale2 !== 100 ? fontScale2 === 110 ? 18 : fontScale2 === 125 ? 20 : fontScale2 === 150 ? 24 : 16 : 16
};
}, (a0) => ({
...a0,
darkSidebar: false
}), (a0) => ({
...a0,
messageGroupSpacing: null
}), (a0) => ({
...a0,
systemPrefersReducedMotion: "no-preference",
prefersReducedMotion: "auto"
}), (a0) => ({
...a0,
alwaysShowLinkDecorations: a0.saturation <= LOW_SATURATION_THRESHOLD
}), (a0) => ({
...a0,
disableVoiceBackgrounds: false
}), (a0) => {
try {
delete a0["disableVoiceBackgrounds"];
} catch ($e) {}
return a0;
}, (a0) => {
try {
delete a0["hideGuildTags"];
} catch ($e) {}
return a0;
}, (a0) => ({
...a0,
enableCustomCursor: true
}), (a0) => ({
...a0,
appsButtonEnabled: true,
expressionPickerFormat: c2407_13.FLEXIBLE,
condensePickerWhenNarrow: true,
emojiButtonEnabled: true,
gifButtonEnabled: true,
stickerButtonEnabled: true
})];
initialize(a0) {
let r6 = a0;
this.waitFor(UserSettingsProtoStore);
const r14 = {
...c2407_14
};
if (a0 == null) {
r6 = null;
}
HermesBuiltin.copyDataProperties(r14, r6);
c2407_15 = r14;
if (isNaN(c2407_15.fontSize)) {
c2407_15.fontSize = Accessibility.FONT_SIZE_DEFAULT;
}
if (MESSAGE_GROUP_SPACING.indexOf(c2407_15.messageGroupSpacing != null ? c2407_15.messageGroupSpacing : -1) < 0) {
c2407_15.messageGroupSpacing = null;
}
this.syncWith([UserSettingsProtoStore], maybeApplyNoTextColorForLightCustomTheme);
}
get fontScale() {
return c2407_15.fontSize / Accessibility.FONT_SIZE_DEFAULT * 100;
}
get fontSize() {
return c2407_15.fontSize;
}
get isFontScaledUp() {
return c2407_15.fontSize > Accessibility.FONT_SIZE_DEFAULT;
}
get isFontScaledDown() {
return c2407_15.fontSize < Accessibility.FONT_SIZE_DEFAULT;
}
get fontScaleClass() {
let r12;
let r4 = c2407_16[this.fontSize];
if (r4 == null) {
r4 = "";
}
if (this.isFontScaledUp) {
r12 = `a11y-font-scaled-up ${r4}`;
} else {
const isFontScaledDown2 = this.isFontScaledDown;
const concat = HermesInternal.concat;
r12 = isFontScaledDown2 ? concat.call("a11y-font-scaled-down ", r4) : concat.call("", r4);
}
return r12;
}
get zoom() {
return c2407_15.zoom;
}
get isZoomedIn() {
return c2407_15.zoom > Accessibility.ZOOM_DEFAULT;
}
get isZoomedOut() {
return c2407_15.zoom < Accessibility.ZOOM_DEFAULT;
}
get keyboardModeEnabled() {
return c2407_15.keyboardModeEnabled;
}
get colorblindMode() {
return c2407_15.colorblindMode;
}
get lowContrastMode() {
return c2407_15.lowContrastMode;
}
get saturation() {
return c2407_15.saturation;
}
get contrast() {
return c2407_15.contrast;
}
get desaturateUserColors() {
return c2407_15.desaturateUserColors;
}
get forcedColorsModalSeen() {
return c2407_15.forcedColorsModalSeen;
}
get keyboardNavigationExplainerModalSeen() {
return c2407_15.keyboardNavigationExplainerModalSeen;
}
get messageGroupSpacing() {
return c2407_15.messageGroupSpacing != null ? c2407_15.messageGroupSpacing : MessageDisplayCompact.getSetting() ? DEFAULT_COMPACT_SPACING : DEFAULT_COZY_SPACING;
}
get isMessageGroupSpacingIncreased() {
return this.messageGroupSpacing > (MessageDisplayCompact.getSetting() ? DEFAULT_COMPACT_SPACING : DEFAULT_COZY_SPACING);
}
get isMessageGroupSpacingDecreased() {
return this.messageGroupSpacing < (MessageDisplayCompact.getSetting() ? DEFAULT_COMPACT_SPACING : DEFAULT_COZY_SPACING);
}
get isSubmitButtonEnabled() {
return c2407_15.submitButtonEnabled;
}
get syncProfileThemeWithUserTheme() {
return c2407_15.syncProfileThemeWithUserTheme;
}
get systemPrefersReducedMotion() {
return c2407_15.systemPrefersReducedMotion;
}
get rawPrefersReducedMotion() {
return c2407_15.prefersReducedMotion;
}
get useReducedMotion() {
const prefersReducedMotion = c2407_15.prefersReducedMotion;
if (prefersReducedMotion === "no-preference") {
return false;
}
if (prefersReducedMotion === "reduce") {
return true;
}
return c2407_15.systemPrefersReducedMotion === "reduce";
}
get systemForcedColors() {
return c2407_15.systemForcedColors;
}
get syncForcedColors() {
return c2407_15.syncForcedColors;
}
get useForcedColors() {
const syncForcedColors2 = c2407_15.syncForcedColors;
return !(syncForcedColors2 ? c2407_15.systemForcedColors !== "active" : !syncForcedColors2);
}
get systemPrefersContrast() {
return c2407_15.systemPrefersContrast;
}
get systemPrefersCrossfades() {
return c2407_15.systemPrefersCrossfades;
}
get alwaysShowLinkDecorations() {
return c2407_15.alwaysShowLinkDecorations;
}
get enableCustomCursor() {
return c2407_15.enableCustomCursor;
}
get roleStyle() {
return c2407_15.roleStyle;
}
get officialMessageStyle() {
return c2407_15.officialMessageStyle;
}
get displayNameStylesEnabled() {
return c2407_15.displayNameStylesEnabled;
}
get isHighContrastModeEnabled() {
return c2407_15.contrastMode === c2407_12.HIGH;
}
get isSwitchIconsEnabled() {
return c2407_15.switchIconsEnabled;
}
get isAppsButtonEnabled() {
return c2407_15.appsButtonEnabled;
}
get expressionPickerFormat() {
return c2407_15.expressionPickerFormat;
}
get condensePickerWhenNarrow() {
return c2407_15.condensePickerWhenNarrow;
}
get isEmojiButtonEnabled() {
return c2407_15.emojiButtonEnabled;
}
get isGifButtonEnabled() {
return c2407_15.gifButtonEnabled;
}
get isStickerButtonEnabled() {
return c2407_15.stickerButtonEnabled;
}
getUserAgnosticState() {
return c2407_15;
}
}
const accessibilityStore = new AccessibilityStore(Dispatcher, {
ACCESSIBILITY_SET_FONT_SIZE: function handleFontScaleTo({ fontSize: fontSize2 }) {
if (!(Accessibility.FONT_SIZES.indexOf(fontSize2) >= 0)) {
fontSize2 = Accessibility.FONT_SIZE_DEFAULT;
}
if (!(fontSize2 > Accessibility.FONT_SIZE_MAX) && !(fontSize2 < Accessibility.FONT_SIZE_MIN) && c2407_15.fontSize !== fontSize2) {
const r15 = {
...c2407_15
};
c2407_15 = r15;
r15.fontSize = fontSize2;
return void 0;
}
return false;
},
ACCESSIBILITY_SET_ZOOM: function handleZoomTo(a0) {
if (!(a0.zoom < Accessibility.ZOOM_MIN) && !(a0.zoom > Accessibility.ZOOM_MAX) && c2407_15.zoom !== a0.zoom) {
const r13 = {
...c2407_15
};
c2407_15 = r13;
r13.zoom = a0.zoom;
CrossPlatformNativeUtils_native.setZoomFactor(c2407_15.zoom);
return void 0;
}
return false;
},
ACCESSIBILITY_RESET_TO_DEFAULT: function handleResetToDefault() {
const fontSize2 = c2407_15.fontSize;
const FONT_SIZE_DEFAULT = Accessibility.FONT_SIZE_DEFAULT;
const zoom2 = c2407_15.zoom;
const ZOOM_DEFAULT = Accessibility.ZOOM_DEFAULT;
if (fontSize2 === FONT_SIZE_DEFAULT && zoom2 === ZOOM_DEFAULT) {
return false;
}
const r11 = {
...c2407_15
};
c2407_15 = r11;
if (r11.fontSize !== Accessibility.FONT_SIZE_DEFAULT) {
c2407_15.fontSize = Accessibility.FONT_SIZE_DEFAULT;
}
if (c2407_15.zoom !== Accessibility.ZOOM_DEFAULT) {
c2407_15.zoom = Accessibility.ZOOM_DEFAULT;
CrossPlatformNativeUtils_native.setZoomFactor(c2407_15.zoom);
}
},
ACCESSIBILITY_KEYBOARD_MODE_ENABLE: function handleEnableKeyboardMode() {
if (c2407_15.keyboardModeEnabled) {
return false;
}
const r7 = {
...c2407_15
};
c2407_15 = r7;
r7.keyboardModeEnabled = true;
},
ACCESSIBILITY_KEYBOARD_MODE_DISABLE: function handleDisableKeyboardMode() {
if (c2407_15.keyboardModeEnabled) {
const r7 = {
...c2407_15
};
c2407_15 = r7;
r7.keyboardModeEnabled = false;
return void 0;
}
return false;
},
ACCESSIBILITY_COLORBLIND_TOGGLE: function handleToggleColorblindMode() {
const r1 = {
...c2407_15
};
c2407_15 = r1;
r1.colorblindMode = !r1.colorblindMode;
},
ACCESSIBILITY_LOW_CONTRAST_TOGGLE: function handleToggleLowContrastMode() {
const r1 = {
...c2407_15
};
c2407_15 = r1;
r1.lowContrastMode = !r1.lowContrastMode;
},
ACCESSIBILITY_SET_SATURATION: function handleSetSaturation(a0) {
const r2 = {
...c2407_15
};
c2407_15 = r2;
r2.saturation = a0.saturation;
},
ACCESSIBILITY_DESATURATE_ROLES_TOGGLE: function handledesaturateUserColorsToggle() {
const r1 = {
...c2407_15
};
c2407_15 = r1;
r1.desaturateUserColors = !r1.desaturateUserColors;
},
ACCESSIBILITY_SYSTEM_COLOR_PREFERENCES_CHANGED: function handleSystemColorPreferencesChanged({ systemForcedColors: systemForcedColors2 }) {
if (systemForcedColors2 == null) {
systemForcedColors2 = "none";
}
c2407_15 = {
...c2407_15,
systemForcedColors: systemForcedColors2
};
},
ACCESSIBILITY_SYSTEM_PREFERS_CONTRAST_CHANGED: function handleSystemPrefersContrastChanged(a0) {
if (c2407_15.systemPrefersContrast === a0.systemPrefersContrast) {
return false;
}
c2407_15 = {
...c2407_15,
systemPrefersContrast: a0.systemPrefersContrast
};
},
ACCESSIBILITY_SYSTEM_PREFERS_REDUCED_MOTION_CHANGED: function handleSystemPrefersReducedMotionChanged(a0) {
if (c2407_15.systemPrefersReducedMotion === a0.systemPrefersReducedMotion) {
return false;
}
c2407_15 = {
...c2407_15,
systemPrefersReducedMotion: a0.systemPrefersReducedMotion
};
},
ACCESSIBILITY_SYSTEM_PREFERS_CROSSFADES_CHANGED: function handleSystemPrefersCrossfadesChanged(a0) {
if (c2407_15.systemPrefersCrossfades === a0.systemPrefersCrossfades) {
return false;
}
c2407_15 = {
...c2407_15,
systemPrefersCrossfades: a0.systemPrefersCrossfades
};
},
ACCESSIBILITY_SET_PREFERS_REDUCED_MOTION: function handleSetPrefersReducedMotion(a0) {
if (c2407_15.prefersReducedMotion === a0.prefersReducedMotion) {
return false;
}
c2407_15 = {
...c2407_15,
prefersReducedMotion: a0.prefersReducedMotion
};
},
ACCESSIBILITY_SET_SYNC_FORCED_COLORS: function handleSetSyncForcedColors(a0) {
c2407_15.syncForcedColors = a0.syncForcedColors;
},
ACCESSIBILITY_SET_ALWAYS_SHOW_LINK_DECORATIONS: function handleSetAlwaysShowLinkDecorations(a0) {
c2407_15 = {
...c2407_15,
alwaysShowLinkDecorations: a0.alwaysShowLinkDecorations
};
},
ACCESSIBILITY_SET_ENABLE_CUSTOM_CURSOR: function handleSetEnableCustomCursor(a0) {
c2407_15 = {
...c2407_15,
enableCustomCursor: a0.enableCustomCursor
};
},
ACCESSIBILITY_SET_ROLE_STYLE: function handleSetRoleStyle(a0) {
c2407_15.roleStyle = a0.roleStyle;
},
ACCESSIBILITY_SET_OFFICIAL_MESSAGE_STYLE: function handleSetOfficialMessageStyle(a0) {
c2407_15.officialMessageStyle = a0.officialMessageStyle;
c2407_15.officialMessageStyleExplicitlySet = true;
},
ACCESSIBILITY_SET_DISPLAY_NAME_STYLES_ENABLED: function handleSetDisplayNameStylesEnabled(a0) {
c2407_15.displayNameStylesEnabled = a0.enabled;
},
ACCESSIBILITY_FORCED_COLORS_MODAL_SEEN: function handleForcedColorsModalSeen() {
c2407_15.forcedColorsModalSeen = true;
},
KEYBOARD_NAVIGATION_EXPLAINER_MODAL_SEEN: function handleKeyboardNavigationExplainerModalSeen() {
c2407_15 = {
...c2407_15,
keyboardNavigationExplainerModalSeen: true
};
},
ACCESSIBILITY_SET_MESSAGE_GROUP_SPACING: function handleMessageGroupSpacingChange(a0) {
c2407_15 = {
...c2407_15,
messageGroupSpacing: a0.messageGroupSpacing
};
},
ACCESSIBILITY_SUBMIT_BUTTON_TOGGLE: function handleSubmitButtonToggle() {
const r1 = {
...c2407_15
};
c2407_15 = r1;
r1.submitButtonEnabled = !r1.submitButtonEnabled;
},
ACCESSIBILITY_SYNC_PROFILE_THEME_WITH_USER_THEME_TOGGLE: function handleSyncProfileThemeWithUserThemeToggle() {
const r1 = {
...c2407_15
};
c2407_15 = r1;
r1.syncProfileThemeWithUserTheme = !r1.syncProfileThemeWithUserTheme;
},
ACCESSIBILITY_SET_CONTRAST: function handleSetContrast(a0) {
c2407_15 = {
...c2407_15,
contrast: a0.contrast
};
},
ACCESSIBILITY_SET_CONTRAST_MODE: function handleSetContrastMode(a0) {
c2407_15 = {
...c2407_15,
contrastMode: a0.contrastMode
};
},
ACCESSIBILITY_SET_SWITCH_ICONS_ENABLED: function handleSetSwitchIconsEnabled(a0) {
c2407_15 = {
...c2407_15,
switchIconsEnabled: a0.switchIconsEnabled
};
},
ACCESSIBILITY_SET_CHAT_BAR_SETTINGS: function handleSetChatBarSettings(a0) {
c2407_15 = {
...c2407_15,
...a0.appsButtonEnabled != null && {
appsButtonEnabled: a0.appsButtonEnabled
},
...a0.expressionPickerFormat != null && {
expressionPickerFormat: a0.expressionPickerFormat
},
...a0.condensePickerWhenNarrow != null && {
condensePickerWhenNarrow: a0.condensePickerWhenNarrow
},
...a0.emojiButtonEnabled != null && {
emojiButtonEnabled: a0.emojiButtonEnabled
},
...a0.gifButtonEnabled != null && {
gifButtonEnabled: a0.gifButtonEnabled
},
...a0.stickerButtonEnabled != null && {
stickerButtonEnabled: a0.stickerButtonEnabled
}
};
}
});
export default accessibilityStore;
export { c2407_12 as AccessibilityContrastMode };
export { c2407_13 as ExpressionPickerFormat };
@@ -0,0 +1,100 @@
// Metro module 13507 (f13508).
import AuthenticationStore from "../../../stores/AuthenticationStore";
import ChannelStore from "../../../stores/ChannelStore";
import RelationshipStore from "../../../stores/RelationshipStore";
import UserStore from "../../../stores/UserStore";
import { isIOS } from "../../../utils/PlatformUtils";
import { NativePhoneIntegrationEnabled } from "../../user_settings/UserSettings";
import { computeChannelName } from "../../channel/useChannelName";
import { AccessibilityAnnouncer } from "../../../design/shared";
import { intl, t } from "../../../intl/index.native";
import LifecycleManager from "../../../lib/LifecycleManager";
import Dispatcher from "../../../Dispatcher";
let c9376_7 = new Set();
let c9376_8 = new Map();
class AccessibilityCallManager extends LifecycleManager {
handleCallCreate = ({ channelId, ongoingRings }) => {
const id = AuthenticationStore.getId();
const r0 = id != null && id in ongoingRings;
L9: {
c9376_8.set(channelId, r0);
if (r0 && !c9376_7.has(channelId)) {
if (isIOS() && NativePhoneIntegrationEnabled.getSetting()) {
break L9;
}
const channel = ChannelStore.getChannel(channelId);
if (channel != null) {
const callLocation = computeChannelName(channel, UserStore, RelationshipStore);
if (callLocation != null) {
c9376_7.add(channelId);
AccessibilityAnnouncer.announce(intl.formatToPlainString(t["Bm0A/p"], {
callLocation
}), "assertive");
}
}
}
}
};
handleCallUpdate = ({ channelId, ongoingRings }) => {
const id = AuthenticationStore.getId();
let r17 = c9376_8.get(channelId);
if (r17 == null) {
r17 = false;
}
const r0 = id != null && id in ongoingRings;
L16: {
c9376_8.set(channelId, r0);
if (!r17 && r0) {
if (c9376_7.has(channelId)) {
break L16;
}
if (isIOS() && NativePhoneIntegrationEnabled.getSetting()) {
break L16;
}
const channel = ChannelStore.getChannel(channelId);
if (channel == null) {
break L16;
}
const callLocation = computeChannelName(channel, UserStore, RelationshipStore);
if (callLocation == null) {
break L16;
}
c9376_7.add(channelId);
AccessibilityAnnouncer.announce(intl.formatToPlainString(t["Bm0A/p"], {
callLocation
}), "assertive");
} else {
if (r17) {
r17 = !r0;
}
if (r17) {
c9376_7.delete(channelId);
}
}
}
};
handleCallDelete = ({ channelId }) => {
c9376_8.delete(channelId);
c9376_7.delete(channelId);
};
handleConnectionOpen = () => {
c9376_8.clear();
c9376_7.clear();
};
_initialize() {
Dispatcher.subscribe("CALL_CREATE", this.handleCallCreate);
Dispatcher.subscribe("CALL_UPDATE", this.handleCallUpdate);
Dispatcher.subscribe("CALL_DELETE", this.handleCallDelete);
Dispatcher.subscribe("CONNECTION_OPEN", this.handleConnectionOpen);
}
_terminate() {
Dispatcher.unsubscribe("CALL_CREATE", this.handleCallCreate);
Dispatcher.unsubscribe("CALL_UPDATE", this.handleCallUpdate);
Dispatcher.unsubscribe("CALL_DELETE", this.handleCallDelete);
Dispatcher.unsubscribe("CONNECTION_OPEN", this.handleConnectionOpen);
c9376_8.clear();
c9376_7.clear();
}
}
const accessibilityCallManager = new AccessibilityCallManager();
export default accessibilityCallManager;
@@ -0,0 +1,84 @@
// Metro module 4585 (f4586).
import { NativeModules } from "react-native";
import Logger from "../../debug/Logger";
import LifecycleManager from "../../../lib/LifecycleManager";
import { getIsScreenReaderEnabled, addScreenReaderEnabledListener } from "./useIsScreenReaderEnabled.native";
import { isAndroid } from "../../../utils/PlatformUtils";
import Module4587 from "../../../_bundle/Module4587";
let c2792_4 = new Logger("AccessibilityFocusLockManager");
class AccessibilityFocusLockManager extends LifecycleManager {
_screenReaderEnabled = getIsScreenReaderEnabled();
_focusLockedNativeIDGroups = new Map();
_focusLockEnabled = false;
_focusLockEnabledDelayTimeoutId = -1;
_focusLockEnabledDelayTimeout = 250;
_updateAccessibilityFocusLock(r3 = false) {
let c14333_1;
let c14333_0 = r3;
let r4 = void 0;
c14333_1 = void 0;
clearTimeout(this._focusLockEnabledDelayTimeoutId);
c14333_1 = void 0;
for (const item of this._focusLockedNativeIDGroups.values()) {
r4 = item;
c14333_1 = item;
}
if (r4 != null && this._screenReaderEnabled) {
this._focusLockEnabledDelayTimeoutId = setTimeout(() => {
if (isAndroid()) {
Module4587.enableFocusLock(c14333_1, c14333_0);
} else {
NativeModules.DCDAccessibilityManager.enableFocusLock(c14333_1, c14333_0);
}
}, this._focusLockEnabledDelayTimeout);
this._focusLockEnabled = true;
} else if (this._focusLockEnabled) {
if (isAndroid()) {
Module4587.disableFocusLock();
} else {
NativeModules.DCDAccessibilityManager.disableFocusLock();
}
this._focusLockEnabled = false;
}
}
_initialize() {
this._screenReaderEnabledListener = addScreenReaderEnabledListener((a0) => {
this._screenReaderEnabled = a0;
this._updateAccessibilityFocusLock();
});
}
_terminate() {
const _screenReaderEnabledListener = this._screenReaderEnabledListener;
if (_screenReaderEnabledListener != null) {
_screenReaderEnabledListener.call(this);
}
this._focusLockedNativeIDGroups.clear();
this._updateAccessibilityFocusLock();
}
enableAccessibilityFocusLock(a0) {
if (a0.length === 0) {
c2792_4.error("No target view nativeIDs to add.");
}
for (const item of this._focusLockedNativeIDGroups.values()) {
for (const item2 of item) {
if (a0.includes(item2)) {
c2792_4.error(`Duplicate target view nativeID ${item2} already accessibility focus locked.`);
}
}
}
this._focusLockedNativeIDGroups.set(a0[0], a0);
this._updateAccessibilityFocusLock(true);
}
disableAccessibilityFocusLock(a0) {
if (a0.length === 0) {
c2792_4.error("No target view nativeIDs to remove.");
}
if (!this._focusLockedNativeIDGroups.has(a0[0])) {
c2792_4.error(`No target view nativeID ${a0[0]} accessibility focus locked.`);
}
this._focusLockedNativeIDGroups.delete(a0[0]);
this._updateAccessibilityFocusLock();
}
}
const accessibilityFocusLockManager = new AccessibilityFocusLockManager();
export default accessibilityFocusLockManager;
@@ -0,0 +1,22 @@
// Metro module 7735 (f7736).
import { createApexExperiment } from "../../experiments/apex/index";
import { getIsScreenReaderEnabled } from "./useIsScreenReaderEnabled.native";
const apexExperiment = createApexExperiment({
kind: "user",
name: "2026-03-mobile-accessibility-label-optimization",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
const config = apexExperiment.getConfig({
location: "default"
});
export default apexExperiment;
export function shouldSkipAccessibilityLabels() {
return config.enabled && !getIsScreenReaderEnabled();
}
@@ -0,0 +1,82 @@
// Metro module 13499 (f13500).
import { AccessibilityInfo, Appearance } from "react-native";
import AccessibilityStore from "../AccessibilityStore";
import { AnalyticEvents } from "../../../Constants";
import { SystemTheme } from "../../user_settings/ThemeConstants";
import AccessibilitySystemFeatures from "./AccessibilitySystemFeatures";
import Dispatcher from "../../../Dispatcher";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { updateSaturation } from "../../themes/native/updateSaturation";
import updateSharedValueIfChanged_native from "../../reanimated/utils/updateSharedValueIfChanged.native";
import { accessibilityPreferencesSharedValue } from "./AccessibilityPreferencesSharedValue";
import { setSystemTheme } from "../../user_settings/ThemeActionCreators";
import { AccessibilityAnnouncer } from "../../../design/shared";
const r27 = {
init: function init() {
AccessibilitySystemFeatures.init();
this.updateNativeColors();
this.updateMotionSettings();
AccessibilityStore.addChangeListener(this.updateNativeColors);
AccessibilityStore.addChangeListener(this.updateMotionSettings);
Dispatcher.subscribe("CONNECTION_OPEN", this.updateMotionSettings);
Appearance.addChangeListener(this.updateSystemAppearance);
AccessibilityInfo.addEventListener("screenReaderChanged", (a0) => {
this.updateScreenReaderEnabled(a0);
});
Dispatcher.subscribe("ACCESSIBILITY_COLORBLIND_TOGGLE", () => {
AnalyticsUtils.track(AnalyticEvents.LOCAL_SETTINGS_UPDATED, {
colorblind_enabled: AccessibilityStore.colorblindMode
});
});
this.startAnnouncementQueue();
},
updateNativeColors: () => {
updateSaturation(AccessibilityStore.saturation);
},
updateMotionSettings: () => {
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, {
reduceMotion: AccessibilityStore.useReducedMotion,
prefersCrossfades: AccessibilityStore.systemPrefersCrossfades
});
},
checkScreenreaderEnabled: async function checkScreenreaderEnabled() {
const _this = this;
let c27478_1;
c27478_1 = void 0;
let c30632_0 = await AccessibilityInfo.isScreenReaderEnabled();
_this.updateScreenReaderEnabled(c30632_0);
},
updateScreenReaderEnabled: (a0) => {
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, {
screenReaderEnabled: a0
});
},
updateSystemAppearance: (a0) => {
let NO_PREFERENCE = SystemTheme.NO_PREFERENCE;
const colorScheme = a0.colorScheme;
if (colorScheme === "light") {
NO_PREFERENCE = SystemTheme.LIGHT;
} else if (colorScheme === "dark") {
NO_PREFERENCE = SystemTheme.DARK;
}
setSystemTheme(NO_PREFERENCE);
},
startAnnouncementQueue: () => {
let c20500_0 = new Set();
AccessibilityInfo.addEventListener("announcementFinished", (a0) => {
if (!a0.success) {
if (!c20500_0.has(a0.announcement)) {
c20500_0.add(a0.announcement);
setTimeout(() => {
AccessibilityAnnouncer.announce(a0.announcement);
}, 150);
} else {
c20500_0.delete(a0.announcement);
}
} else {
c20500_0.delete(a0.announcement);
}
});
}
};
export default r27;
@@ -0,0 +1,35 @@
// Metro module 13625 (f13626).
import { useMemo } from "react";
import AccessibilityStore from "../AccessibilityStore";
import { useStateFromStoresObject, useStateFromStores } from "../../../_bundle/Module589";
import { AccessibilityPreferencesContext } from "../../../_bundle/Module3908";
export default function AccessibilityPreferencesContextProvider(props) {
let stateFromStores, stateFromStoresObject2, stateFromStores2, stateFromStores3, stateFromStores4;
const children = props.children;
stateFromStores = void 0;
stateFromStoresObject2 = void 0;
stateFromStores2 = void 0;
stateFromStores3 = void 0;
stateFromStores4 = void 0;
const stateFromStoresObject = useStateFromStoresObject([AccessibilityStore], () => ({
enabled: AccessibilityStore.useReducedMotion,
rawValue: AccessibilityStore.rawPrefersReducedMotion
}));
stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.systemPrefersCrossfades);
stateFromStoresObject2 = useStateFromStoresObject([AccessibilityStore], () => ({
enabled: AccessibilityStore.useForcedColors,
rawValue: AccessibilityStore.systemForcedColors
}));
stateFromStores2 = useStateFromStores([AccessibilityStore], () => AccessibilityStore.alwaysShowLinkDecorations);
stateFromStores3 = useStateFromStores([AccessibilityStore], () => AccessibilityStore.keyboardModeEnabled);
stateFromStores4 = useStateFromStores([AccessibilityStore], () => AccessibilityStore.isSwitchIconsEnabled);
return <AccessibilityPreferencesContext.Provider value={useMemo(() => ({
reducedMotion: stateFromStoresObject,
prefersCrossfades: stateFromStores,
forcedColors: stateFromStoresObject2,
alwaysShowLinkDecorations: stateFromStores2,
highContrastModeEnabled: false,
keyboardModeEnabled: stateFromStores3,
switchIconsEnabled: stateFromStores4
}), [stateFromStoresObject, stateFromStores, stateFromStoresObject2, stateFromStores2, stateFromStores3, stateFromStores4])}>{children}</AccessibilityPreferencesContext.Provider>;
};
@@ -0,0 +1,9 @@
// Metro module 13501 (f13502).
import { AccessibilityFeatureFlags } from "../AccessibilityConstants";
import * as _native from "../../../design/native";
const r13 = {};
r13[AccessibilityFeatureFlags.REDUCED_MOTION] = "reduceMotion";
r13[AccessibilityFeatureFlags.REDUCED_MOTION_PREFERS_CROSSFADES] = "prefersCrossfades";
r13[AccessibilityFeatureFlags.SCREENREADER] = "screenReaderEnabled";
export { r13 as A11Y_FEATURE_MAP };
export const accessibilityPreferencesSharedValue = _native.accessibilityPreferencesSharedValue;
@@ -0,0 +1,257 @@
// Metro module 13500 (f13501).
import { AccessibilityInfo, AppState, Appearance } from "react-native";
import AccessibilityStore from "../AccessibilityStore";
import { AccessibilityFeatureFlags } from "../AccessibilityConstants";
import { A11Y_FEATURE_MAP, accessibilityPreferencesSharedValue } from "./AccessibilityPreferencesSharedValue";
import updateSharedValueIfChanged_native from "../../reanimated/utils/updateSharedValueIfChanged.native";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { systemPrefersReducedMotionChanged, systemPrefersCrossfadesChanged } from "../AccessibilityActionCreators";
const NONE = AccessibilityFeatureFlags.NONE;
const r24 = {
init: function init() {
AccessibilityStore.addChangeListener(this.handleAccessibilityStoreChanged);
AccessibilityInfo.addEventListener("reduceMotionChanged", this.handleReduceMotionChanged);
AccessibilityInfo.isReduceMotionEnabled().then(this.handleReduceMotionChanged);
AccessibilityInfo.addEventListener("reduceTransparencyChanged", this.handleReduceTransparencyChanged);
AccessibilityInfo.isReduceTransparencyEnabled().then(this.handleReduceTransparencyChanged);
AccessibilityInfo.addEventListener("boldTextChanged", this.handleBoldTextChanged);
AccessibilityInfo.isBoldTextEnabled().then(this.handleBoldTextChanged);
AccessibilityInfo.addEventListener("grayscaleChanged", this.handleGrayscaleChanged);
AccessibilityInfo.isGrayscaleEnabled().then(this.handleGrayscaleChanged);
AccessibilityInfo.addEventListener("invertColorsChanged", this.handleInvertColorsChanged);
AccessibilityInfo.isInvertColorsEnabled().then(this.handleInvertColorsChanged);
this.handlePreferredColorSchemeChanged({
colorScheme: Appearance.getColorScheme()
});
Appearance.addChangeListener(this.handlePreferredColorSchemeChanged);
AppState.addEventListener("change", this.handleAppStateChange);
AnalyticsUtils.setSystemAccessibilityFeatures(this.getActiveFeatures);
},
getActiveFeatures: () => NONE,
handleReduceMotionChanged: (a0) => {
systemPrefersReducedMotionChanged(a0 ? "reduce" : "no-preference");
const REDUCED_MOTION = AccessibilityFeatureFlags.REDUCED_MOTION;
if (AccessibilityStore.useReducedMotion) {
NONE = NONE | REDUCED_MOTION;
} else {
NONE = NONE & ~REDUCED_MOTION;
}
const r22 = A11Y_FEATURE_MAP[REDUCED_MOTION];
if (r22 != null) {
const r29 = {};
r29[r22] = AccessibilityStore.useReducedMotion;
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, r29);
}
},
handleReduceTransparencyChanged: (a0) => {
const REDUCED_TRANSPARENCY = AccessibilityFeatureFlags.REDUCED_TRANSPARENCY;
if (a0) {
NONE = NONE | REDUCED_TRANSPARENCY;
} else {
NONE = NONE & ~REDUCED_TRANSPARENCY;
}
const r15 = A11Y_FEATURE_MAP[REDUCED_TRANSPARENCY];
if (r15 != null) {
const r22 = {};
r22[r15] = a0;
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, r22);
}
},
handleBoldTextChanged: (a0) => {
const BOLD_TEXT = AccessibilityFeatureFlags.BOLD_TEXT;
if (a0) {
NONE = NONE | BOLD_TEXT;
} else {
NONE = NONE & ~BOLD_TEXT;
}
const r15 = A11Y_FEATURE_MAP[BOLD_TEXT];
if (r15 != null) {
const r22 = {};
r22[r15] = a0;
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, r22);
}
},
handleGrayscaleChanged: (a0) => {
const GRAYSCALE = AccessibilityFeatureFlags.GRAYSCALE;
if (a0) {
NONE = NONE | GRAYSCALE;
} else {
NONE = NONE & ~GRAYSCALE;
}
const r15 = A11Y_FEATURE_MAP[GRAYSCALE];
if (r15 != null) {
const r22 = {};
r22[r15] = a0;
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, r22);
}
},
handleInvertColorsChanged: (a0) => {
const INVERT_COLORS = AccessibilityFeatureFlags.INVERT_COLORS;
if (a0) {
NONE = NONE | INVERT_COLORS;
} else {
NONE = NONE & ~INVERT_COLORS;
}
const r15 = A11Y_FEATURE_MAP[INVERT_COLORS];
if (r15 != null) {
const r22 = {};
r22[r15] = a0;
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, r22);
}
},
handlePreferredColorSchemeChanged: ({ colorScheme }) => {
if (colorScheme === "dark") {
const PREFERS_COLOR_SCHEME_LIGHT3 = AccessibilityFeatureFlags.PREFERS_COLOR_SCHEME_LIGHT;
NONE = NONE & ~PREFERS_COLOR_SCHEME_LIGHT3;
const r93 = A11Y_FEATURE_MAP[PREFERS_COLOR_SCHEME_LIGHT3];
if (r93 != null) {
const r101 = {};
r101[r93] = false;
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, r101);
}
const PREFERS_COLOR_SCHEME_DARK3 = AccessibilityFeatureFlags.PREFERS_COLOR_SCHEME_DARK;
NONE = NONE | PREFERS_COLOR_SCHEME_DARK3;
const r110 = A11Y_FEATURE_MAP[PREFERS_COLOR_SCHEME_DARK3];
if (r110 != null) {
const r117 = {};
r117[r110] = true;
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, r117);
}
} else if (colorScheme === "light") {
const PREFERS_COLOR_SCHEME_DARK2 = AccessibilityFeatureFlags.PREFERS_COLOR_SCHEME_DARK;
NONE = NONE & ~PREFERS_COLOR_SCHEME_DARK2;
const r55 = A11Y_FEATURE_MAP[PREFERS_COLOR_SCHEME_DARK2];
if (r55 != null) {
const r63 = {};
r63[r55] = false;
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, r63);
}
const PREFERS_COLOR_SCHEME_LIGHT2 = AccessibilityFeatureFlags.PREFERS_COLOR_SCHEME_LIGHT;
NONE = NONE | PREFERS_COLOR_SCHEME_LIGHT2;
const r72 = A11Y_FEATURE_MAP[PREFERS_COLOR_SCHEME_LIGHT2];
if (r72 != null) {
const r79 = {};
r79[r72] = true;
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, r79);
}
} else {
const PREFERS_COLOR_SCHEME_DARK = AccessibilityFeatureFlags.PREFERS_COLOR_SCHEME_DARK;
NONE = NONE & ~PREFERS_COLOR_SCHEME_DARK;
const r10 = A11Y_FEATURE_MAP[PREFERS_COLOR_SCHEME_DARK];
if (r10 != null) {
const r25 = {};
r25[r10] = false;
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, r25);
}
const PREFERS_COLOR_SCHEME_LIGHT = AccessibilityFeatureFlags.PREFERS_COLOR_SCHEME_LIGHT;
NONE = NONE & ~PREFERS_COLOR_SCHEME_LIGHT;
const r34 = A11Y_FEATURE_MAP[PREFERS_COLOR_SCHEME_LIGHT];
if (r34 != null) {
const r41 = {};
r41[r34] = false;
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, r41);
}
}
},
handleAccessibilityStoreChanged: () => {
const REDUCED_MOTION = AccessibilityFeatureFlags.REDUCED_MOTION;
if (AccessibilityStore.useReducedMotion) {
NONE = NONE | REDUCED_MOTION;
} else {
NONE = NONE & ~REDUCED_MOTION;
}
const r12 = A11Y_FEATURE_MAP[REDUCED_MOTION];
if (r12 != null) {
const r25 = {};
r25[r12] = AccessibilityStore.useReducedMotion;
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, r25);
}
const REDUCED_MOTION_FROM_USER_SETTINGS = AccessibilityFeatureFlags.REDUCED_MOTION_FROM_USER_SETTINGS;
const r2 = AccessibilityStore.rawPrefersReducedMotion !== "auto";
if (r2) {
NONE = NONE | REDUCED_MOTION_FROM_USER_SETTINGS;
} else {
NONE = NONE & ~REDUCED_MOTION_FROM_USER_SETTINGS;
}
const r37 = A11Y_FEATURE_MAP[REDUCED_MOTION_FROM_USER_SETTINGS];
if (r37 != null) {
const r44 = {};
r44[r37] = r2;
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, r44);
}
const SATURATION_LEVEL_DECREASED = AccessibilityFeatureFlags.SATURATION_LEVEL_DECREASED;
const r48 = AccessibilityStore.saturation < 1;
if (r48) {
NONE = NONE | SATURATION_LEVEL_DECREASED;
} else {
NONE = NONE & ~SATURATION_LEVEL_DECREASED;
}
const r56 = A11Y_FEATURE_MAP[SATURATION_LEVEL_DECREASED];
if (r56 != null) {
const r63 = {};
r63[r56] = r48;
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, r63);
}
const CONTRAST_LEVEL_DECREASED = AccessibilityFeatureFlags.CONTRAST_LEVEL_DECREASED;
const r67 = AccessibilityStore.contrast < 1;
if (r67) {
NONE = NONE | CONTRAST_LEVEL_DECREASED;
} else {
NONE = NONE & ~CONTRAST_LEVEL_DECREASED;
}
const r75 = A11Y_FEATURE_MAP[CONTRAST_LEVEL_DECREASED];
if (r75 != null) {
const r82 = {};
r82[r75] = r67;
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, r82);
}
const CONTRAST_LEVEL_INCREASED = AccessibilityFeatureFlags.CONTRAST_LEVEL_INCREASED;
const r86 = AccessibilityStore.contrast > 1;
if (r86) {
NONE = NONE | CONTRAST_LEVEL_INCREASED;
} else {
NONE = NONE & ~CONTRAST_LEVEL_INCREASED;
}
const r94 = A11Y_FEATURE_MAP[CONTRAST_LEVEL_INCREASED];
if (r94 != null) {
const r101 = {};
r101[r94] = r86;
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, r101);
}
},
handleAppStateChange: (a0) => {
if (a0 === "active") {
AccessibilityInfo.isReduceMotionEnabled().then((result) => {
systemPrefersReducedMotionChanged(result ? "reduce" : "no-preference");
const REDUCED_MOTION = AccessibilityFeatureFlags.REDUCED_MOTION;
if (AccessibilityStore.useReducedMotion) {
NONE = NONE | REDUCED_MOTION;
} else {
NONE = NONE & ~REDUCED_MOTION;
}
const r22 = A11Y_FEATURE_MAP[REDUCED_MOTION];
if (r22 != null) {
const r29 = {};
r29[r22] = AccessibilityStore.useReducedMotion;
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, r29);
}
});
AccessibilityInfo.prefersCrossFadeTransitions().then((result) => {
const REDUCED_MOTION_PREFERS_CROSSFADES = AccessibilityFeatureFlags.REDUCED_MOTION_PREFERS_CROSSFADES;
if (result) {
NONE = NONE | REDUCED_MOTION_PREFERS_CROSSFADES;
} else {
NONE = NONE & ~REDUCED_MOTION_PREFERS_CROSSFADES;
}
const r8 = A11Y_FEATURE_MAP[REDUCED_MOTION_PREFERS_CROSSFADES];
if (r8 != null) {
const r22 = {};
r22[r8] = result;
updateSharedValueIfChanged_native(accessibilityPreferencesSharedValue, r22);
}
systemPrefersCrossfadesChanged(result);
});
}
}
};
export default r24;
@@ -0,0 +1,15 @@
// Metro module 11728 (f11729).
import * as _Module17 from "react-native";
import { isIosFabric } from "../../../utils/native/FabricUtils";
import * as _Module11729 from "../../../_bundle/Module11729";
let View2 = _Module17.View;
if (isIosFabric()) {
View2 = _Module11729.default;
}
const View = View2;
export default function PortalAccessibilityWorkaroundView(props) {
return <View {...props} {...isIosFabric() ? {
accessibilityLabel: " ",
accessible: false
} : null} collapsable={false} />;
};
@@ -0,0 +1,8 @@
// Metro module 4532 (f4533).
import { NativeModules } from "react-native";
import { isIOS } from "../../../utils/PlatformUtils";
export default function markAccessibilityFocus() {
if (isIOS()) {
NativeModules.DCDAccessibilityManager.markCurrentFocus();
}
};
@@ -0,0 +1,23 @@
// Metro module 4596 (f4597).
import { AccessibilityInfo, findNodeHandle } from "react-native";
import Logger from "../../debug/Logger";
import Module4587 from "../../../_bundle/Module4587";
import { isFabric } from "../../../utils/native/FabricUtils";
let c2799_5 = new Logger("setAccessibilityFocus");
export function setAccessibilityFocus({ ref, delay = 0 }) {
let c14339_0;
c14339_0 = void 0;
if (ref != null) {
const r10 = findNodeHandle(ref.current);
c14339_0 = r10;
if (r10 != null) {
setTimeout(() => {
if (isFabric()) {
AccessibilityInfo.setAccessibilityFocus(c14339_0);
} else {
Module4587.setAccessibilityFocus(c14339_0).catch((error) => c2799_5.warn("Failed with reason:", error));
}
}, delay);
}
}
}
@@ -0,0 +1,8 @@
// Metro module 4531 (f4532).
import { NativeModules } from "react-native";
import { isIOS } from "../../../utils/PlatformUtils";
export default function setAccessibilityFocusPrevious() {
if (isIOS()) {
NativeModules.DCDAccessibilityManager.restorePreviousFocus();
}
};
@@ -0,0 +1,21 @@
// Metro module 8293 (f8294).
import { useRef, useEffect, useMemo } from "react";
export default function useAccessibilityPress(a0, a1) {
const current = a0;
const label = a1;
const ref = useRef(a0);
useEffect(() => {
ref.current = current;
}, [a0]);
return useMemo(() => ({
onAccessibilityAction: (a0) => {
if (a0.nativeEvent.actionName === "activate") {
ref.current();
}
},
accessibilityActions: [{
name: "activate",
label
}]
}), [a1]);
};
@@ -0,0 +1,55 @@
// Metro module 10186 (f10187).
import { useRef, useEffect, useCallback } from "react";
import { AccessibilityInfo } from "react-native";
import { AccessibilityAnnouncer } from "../../../design/shared";
import { isIOS } from "../../../utils/PlatformUtils";
import { getIsScreenReaderEnabled } from "./useIsScreenReaderEnabled.native";
export default function useAnnounceAsyncCompletion() {
const ref = useRef(null);
useEffect(() => () => {
const current = ref.current;
if (current != null) {
current.call(ref);
}
ref.current = null;
}, []);
return useCallback(function(a0) {
let r26;
let c26630_0 = a0;
let r6 = arguments[1];
if (r6 === void 0) {
r6 = "assertive";
}
AccessibilityAnnouncer.announce(a0, r6);
if (isIOS() && getIsScreenReaderEnabled()) {
const current = ref.current;
if (current != null) {
current.call(ref);
}
r26 = new Promise((c30202_0) => {
let c30202_2;
let c30202_1 = setTimeout(() => {
const current = ref.current;
return current == null ? void 0 : current.call(ref);
}, 1800);
c30202_2 = AccessibilityInfo.addEventListener("announcementFinished", (a0) => {
if (a0.announcement === c26630_0 && a0.success) {
const current = ref.current;
if (current != null) {
current.call(ref);
}
}
});
ref.current = () => {
clearTimeout(c30202_1);
c30202_2.remove();
ref.current = null;
c30202_0();
};
});
} else {
r26 = Promise.resolve();
}
return r26;
}, []);
};
@@ -0,0 +1,68 @@
// Metro module 4586 (f4587).
import { AccessibilityInfo } from "react-native";
import { Storage } from "../../../_bundle/Module595";
import { create } from "../../../_bundle/Module644";
import { batchUpdates } from "../../../_bundle/Module705";
function $mk103931($env) {
return () => $env.$parent[0]($mk114597($env));
}
function $mk114597($env) {
return (a0) => {
let r1 = a0;
const screenReaderEnabled = a0.screenReaderEnabled;
const screenReaderEnabled2 = $env[0];
if (screenReaderEnabled !== screenReaderEnabled2) {
const r7 = $env.$parent.$parent;
(0, r7[0])(r7[1][1]).Storage.set(r7[4], screenReaderEnabled2);
r1 = {
screenReaderEnabled: screenReaderEnabled2
};
}
return r1;
};
}
let c2793_4, c2793_5;
let env2793 = {};
const SCREEN_READER_ENABLED_GETTER = (a0) => a0.screenReaderEnabled;
c2793_4 = "screenReaderEnabled";
c2793_5 = create((a0) => {
let env14335 = {
$parent: env2793
};
env14335[0] = a0;
const updateScreenReaderEnabled = function updateScreenReaderEnabled(a0) {
let env25250;
const r1 = env25250 = {
$parent: env14335
};
env25250[0] = a0;
batchUpdates($mk103931(r1));
};
AccessibilityInfo.isScreenReaderEnabled().then(updateScreenReaderEnabled).catch(() => {
let env25251;
const r1 = env25251 = {
$parent: env14335
};
env25251[0] = false;
batchUpdates($mk103931(r1));
});
AccessibilityInfo.addEventListener("screenReaderChanged", updateScreenReaderEnabled);
let screenReaderEnabled = Storage.get(c2793_4);
if (screenReaderEnabled == null) {
screenReaderEnabled = false;
}
return {
screenReaderEnabled
};
});
export function addScreenReaderEnabledListener(c14336_0) {
return c2793_5.subscribe((a0) => {
c14336_0(a0.screenReaderEnabled);
});
}
export function getIsScreenReaderEnabled() {
return c2793_5.getState().screenReaderEnabled;
}
export function useIsScreenReaderEnabled() {
return c2793_5(SCREEN_READER_ENABLED_GETTER);
}
@@ -0,0 +1,137 @@
// Metro module 11819 (f11820).
import { useState, useEffect } from "react";
import { ActivityIndicator, ImageBackground, View } from "react-native";
import { InviteStates } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { assertNever } from "../../../utils/GlobalUtils";
import { useToken } from "../../../design/tokens/native/useToken";
import { DeprecatedLayoutAnimation } from "../../animations/native/DeprecatedLayoutAnimation";
import InviteDetails from "./InviteDetails";
import InviteError from "./InviteError";
import AvatarUtils from "../../../utils/AvatarUtils";
import { getDevicePixelRatio } from "../../image_upload/ImageLoaderUtils";
import Module11828 from "../../../_bundle/Module11828";
import useWindowDimensions_native from "../../screen/useWindowDimensions.native";
import { Card } from "../../../design/components/Card/native/Card.native";
let useStyles, c8106_12, InviteResolving, AcceptInviteCardComponent;
const getInviteState = function getInviteState(invite) {
const r8 = invite?.state == null && invite?.channel == null;
if (invite != null && invite.state != null && !r8) {
const state2 = invite.state;
if (InviteStates.RESOLVED !== state2 && InviteStates.ACCEPTED !== state2) {
if (InviteStates.EXPIRED !== state2 && InviteStates.BANNED !== state2 && InviteStates.ERROR !== state2) {
if (InviteStates.RESOLVING !== state2 && InviteStates.APP_NOT_OPENED !== state2 && InviteStates.APP_OPENED !== state2 && InviteStates.APP_OPENING !== state2 && InviteStates.ACCEPTING !== state2) {
assertNever(state2);
return void 0;
}
return c8106_12.LOADING;
}
return c8106_12.ERROR;
}
return c8106_12.DETAILS;
}
return c8106_12.LOADING;
};
InviteResolving = function InviteResolving() {
return <View style={useStyles().resolvingContainer}>
<ActivityIndicator color={useToken(Module712.colors.INTERACTIVE_TEXT_DEFAULT)} size="large" />
</View>;
};
AcceptInviteCardComponent = function AcceptInviteCardComponent(props) {
const invite = props.invite;
const [state, setState] = useState(getInviteState(invite));
useEffect(() => {
const inviteState = getInviteState(invite);
if (inviteState !== state) {
DeprecatedLayoutAnimation();
setState(inviteState);
}
}, [invite, state]);
if (invite == null) {
return <InviteResolving />;
}
if (c8106_12.DETAILS === state) {
return <InviteDetails {...props} invite={invite} />;
}
if (c8106_12.ERROR === state) {
return <InviteError {...props} invite={invite} />;
}
return <InviteResolving />;
};
useStyles = createStyles({
parentContainer: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
alignItems: "center",
justifyContent: "center"
},
imageStyle: {
marginVertical: 0,
resizeMode: "cover"
},
cardContainer: {
position: "absolute",
flex: 1,
width: "90%",
alignItems: "center",
justifyContent: "center",
padding: 0,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
},
cardContent: {
padding: 16,
flex: 1,
justifyContent: "center",
alignItems: "center",
width: "100%"
},
resolvingContainer: {
padding: 64
}
});
c8106_12 = {
LOADING: 0,
0: "LOADING",
DETAILS: 1,
1: "DETAILS",
ERROR: 2,
2: "ERROR"
};
export default function AcceptInvite(props) {
let source;
const { invite: invite2, ...props2 } = props;
const styles = useStyles();
const windowDimensions_native = useWindowDimensions_native();
const { height, width } = windowDimensions_native;
let r23 = invite2;
if (r23 == null) {
r23 = {};
}
const guild = r23.guild;
if (guild?.splash != null) {
source = AvatarUtils.getGuildSplashSource({
id: guild.id,
splash: guild.splash,
size: width * getDevicePixelRatio()
});
if (source == null) {
source = Module11828;
}
} else {
source = Module11828;
}
return <View style={[styles.parentContainer, {
height,
width
}]}>
<ImageBackground source={source} imageStyle={styles.imageStyle} style={{
height,
width
}} />
<Card style={styles.cardContainer}>
<View style={styles.cardContent}>
<AcceptInviteCardComponent invite={invite2} {...props2} />
</View>
</Card>
</View>;
};
@@ -0,0 +1,2 @@
// Metro module 5955 (f5956).
export const ACCEPT_INVITE_MODAL_KEY = "accept-invite";
@@ -0,0 +1,185 @@
// Metro module 16120 (f16121).
import AuthenticationStore from "../../../stores/AuthenticationStore";
import ChannelStore from "../../../stores/ChannelStore";
import GuildMemberStore from "../../../stores/GuildMemberStore";
import GuildStore from "../../../stores/GuildStore";
import InviteStore from "../../../stores/InviteStore";
import PermissionStore from "../../../stores/PermissionStore";
import { ACCEPT_INVITE_MODAL_KEY } from "./AcceptInviteConstants";
import { GuildFeatures, InviteStates, JoinGuildSources, Permissions, Routes } from "../../../Constants";
import * as _InviteTypeUtils from "../../instant_invite/InviteTypeUtils";
import { isGroupDMInvite, isGuildScheduledEventInviteEmbed, isRoleSubscriptionInvite } from "../../instant_invite/InviteTypeUtils";
import { getMobileLurkerServerPreview } from "../../lurker_mode/experiments/MobileLurkerServerPreviewExperiment";
import { transitionTo } from "../../routing/router_utils";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import AutomaticLifecycleManager from "../../../lib/AutomaticLifecycleManager";
import { acceptFriendInvite } from "../../friend_invites/native/FriendInviteUtils";
import Dispatcher from "../../../Dispatcher";
import { clearDisplayedInvite } from "../../../actions/native/DisplayedInviteActionCreators";
import { startLurking } from "../../../utils/GuildDiscoveryUtils";
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
class AcceptInviteManager extends AutomaticLifecycleManager {
constructor() {
super(...arguments);
const _this = this;
this._deferredFromDeeplink = false;
this._isRegistration = false;
this.actions = {
DISPLAYED_INVITE_SHOW: (a0) => _this._handleShowInvite(a0),
DISPLAYED_INVITE_CLEAR: () => _this._handleClearInvite(),
DEFERRED_INVITE_SHOW: () => _this._handleShowDeferredInvite(),
REGISTER_SUCCESS: () => _this._handleRegisterSuccess()
};
this._handleShowInvite = ({ code: code2, deeplinkAttemptId: deeplinkAttemptId2, fromDeeplink, invite_instance_id }) => {
const isAuthenticated = AuthenticationStore.isAuthenticated();
if (isAuthenticated) {
_this._handleInvite(code2, deeplinkAttemptId2, fromDeeplink === true, invite_instance_id);
} else {
_this._deferredCode = code2;
_this._deferredFromDeeplink = fromDeeplink === true;
}
};
this._handleClearInvite = () => {
_this._deferredCode = null;
_this._deferredFromDeeplink = false;
_this._isRegistration = false;
ModalActionCreators.popWithKey(ACCEPT_INVITE_MODAL_KEY);
};
this._handleShowDeferredInvite = () => {
if (_this._deferredCode != null) {
_this._handleInvite(_this._deferredCode, void 0, _this._deferredFromDeeplink);
_this._deferredCode = null;
_this._deferredFromDeeplink = false;
}
};
this._handleInvite = function _handleInvite(code, deeplinkAttemptId, r6 = false) {
let c28227_2 = r6;
const inviteInstanceId = arguments[3];
InviteStore.addConditionalChangeListener(() => {
let r37;
L5: {
const invite = InviteStore.getInvite(code);
if (invite != null) {
if (invite.state !== InviteStates.RESOLVED && invite.state !== InviteStates.EXPIRED && invite.state !== InviteStates.BANNED && invite.state !== InviteStates.ERROR) {
break L5;
}
L62: {
if (invite.channel == null && (invite.guild == null && invite.inviter != null)) {
acceptFriendInvite(invite, {
location: deeplinkAttemptId != null ? "Deep Link" : "Accept Invite"
});
Dispatcher.wait(() => clearDisplayedInvite());
} else {
L28: {
const state = invite.state;
const RESOLVED = InviteStates.RESOLVED;
r37 = false;
if (state === RESOLVED) {
const isStreamInvite = _InviteTypeUtils.isStreamInvite(invite);
r37 = false;
if (!isStreamInvite) {
const id = invite.guild?.id;
const target_channel_id = invite.target_channel_id;
const r43 = id == null;
r37 = false;
if (!r43) {
const r44 = target_channel_id == null;
r37 = false;
if (!r44) {
const r48 = GuildStore.getGuild(id) == null;
r37 = false;
if (!r48) {
if (invite.roles != null && invite.roles.length > 0) {
const r18 = Set;
let r57 = GuildMemberStore.getSelfMember(id)?.roles;
if (r57 == null) {
r57 = [];
}
let c30953_0 = new r18(r57);
const r64 = invite.roles.some((role) => !c30953_0.has(role.id));
r37 = false;
if (r64) {
break L28;
}
}
let r73 = !!PermissionStore.can(Permissions.VIEW_CHANNEL, ChannelStore.getChannel(target_channel_id));
if (r73) {
let target_message_id = invite.target_message_id;
if (target_message_id == null) {
target_message_id = void 0;
}
transitionTo(Routes.CHANNEL(id, target_channel_id, target_message_id), {
navigationReplace: true,
openChannel: true
});
r73 = true;
}
r37 = r73;
}
}
}
}
}
}
if (r37) {
Dispatcher.wait(() => clearDisplayedInvite());
} else {
if (c28227_2 && invite.state === InviteStates.RESOLVED) {
let r87 = invite.guild == null || isGroupDMInvite(invite) || _InviteTypeUtils.isStreamInvite(invite) || isGuildScheduledEventInviteEmbed(invite) || isRoleSubscriptionInvite(invite);
if (!r87) {
const features = invite.guild.features;
r87 = !(features == null ? void 0 : features.includes(GuildFeatures.DISCOVERABLE));
}
if (r87 ? !r87 : getMobileLurkerServerPreview("AcceptInviteManager").enabled) {
Dispatcher.wait(() => clearDisplayedInvite());
let target_channel_id2 = invite.target_channel_id;
if (target_channel_id2 == null) {
target_channel_id2 = void 0;
}
const id2 = invite.guild.id;
let channelId = target_channel_id2;
if (channelId == null) {
channelId = invite.channel?.id;
}
const r172 = target_channel_id2 != null;
let messageId = void 0;
if (r172) {
let target_message_id2 = invite.target_message_id;
if (target_message_id2 == null) {
target_message_id2 = void 0;
}
messageId = target_message_id2;
}
startLurking(id2, {}, {
channelId,
messageId,
joinSource: JoinGuildSources.DISCOVERABLE_GUILD_INVITE_LURKER
}, [AnalyticsLocation.DEEPLINK]);
break L62;
}
}
const _isRegistration = _this._isRegistration;
ActionSheetActionCreators.hideActionSheet();
ModalActionCreators.pushLazy(import("./components/AcceptInviteModal"), {
code,
isRegistration: _isRegistration,
deeplinkAttemptId,
inviteInstanceId
}, ACCEPT_INVITE_MODAL_KEY);
}
}
}
return false;
}
}
return true;
});
};
this._handleRegisterSuccess = () => {
_this._isRegistration = true;
};
}
}
const acceptInviteManager = new AcceptInviteManager();
export default acceptInviteManager;
@@ -0,0 +1,297 @@
// Metro module 11820 (f11821).
import { useMemo, useState } from "react";
import { View } from "react-native";
import MultiAccountStore from "../../multi_account/MultiAccountStore";
import UserRecord from "../../../records/UserRecord";
import UserStore from "../../../stores/UserStore";
import { AnalyticEvents, InviteStates } from "../../../Constants";
import { INVITE_ROUTING_HUB_GUILD_ID } from "../../hub/HubConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { DARK_1_LIGHT_04 } from "../../../design/migrations/native/LegacyTokens";
import { isGroupDMInvite, isFriendInvite, isStreamInvite } from "../../instant_invite/InviteTypeUtils";
import { Avatar, AvatarSizes } from "../../../design/void/native";
import GuildInviteIcon from "../../guild/native/GuildInviteIcon";
import UserUtils from "../../../utils/UserUtils";
import { intl, t } from "../../../intl/index.native";
import GuildBadge from "../../guild/native/GuildBadge";
import { Heading, Text } from "../../../design/components/Text/native/Text";
import AvatarUtils from "../../../utils/AvatarUtils";
import FastImage from "../../../components_native/common/FastImage";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { useStateFromStores } from "../../../_bundle/Module589";
import InviteRolesList from "./InviteRolesList";
import { GuildEventCardHeader, GuildEventCardMetaInfo, GuildEventCardGuildInfo } from "../../guild_scheduled_events/native/components/GuildEventCardComponents";
import { Button } from "../../../design/components/Button/native/Button.native";
import { ButtonGroup } from "../../../design/components/ButtonGroup/native/ButtonGroup.native";
let useStyles, InviteDestinationIcon, InviteHeader, InviteJoinContext, InviteMemberCounts, c8107_21;
const shouldShowInviter = function shouldShowInviter(a0, a1) {
let r1 = a0.inviter != null && !(a1 ? a0.state !== InviteStates.ACCEPTED : a1);
if (r1) {
let approximate_presence_count = a0.approximate_presence_count;
if (approximate_presence_count == null) {
approximate_presence_count = 0;
}
let approximate_member_count = a0.approximate_member_count;
if (approximate_member_count == null) {
approximate_member_count = 0;
}
const r12 = {
onlineCount: approximate_presence_count,
memberCount: approximate_member_count
};
let r16 = (r12.memberCount !== 0 ? r12 : null)?.memberCount;
if (r16 == null) {
r16 = 0;
}
r1 = !(r16 > 100);
}
return r1;
};
InviteDestinationIcon = function InviteDestinationIcon(props) {
const invite3 = props.invite;
const styles = useStyles();
return <View style={[styles.avatarContainer]}>
{isGroupDMInvite(invite3) && invite3.inviter != null ? invite3.inviter != null ? <Avatar avatarStyle={styles.avatar} user={new UserRecord(invite3.inviter)} guildId={void 0} size={AvatarSizes.XLARGE} /> : null : invite3.guild != null ? <GuildInviteIcon style={styles.avatar} guild={invite3.guild} size={GuildInviteIcon.Sizes.LARGE} textScale={2} /> : null}
</View>;
};
InviteHeader = function InviteHeader(props) {
let r11;
const invite3 = props.invite;
const styles = useStyles();
if (isGroupDMInvite(invite3)) {
let r24 = invite3.channel?.name;
if (r24 == null) {
r24 = UserUtils.getFormattedName(invite3.inviter);
}
r11 = r24;
} else {
r11 = invite3.guild?.name;
}
if (isFriendInvite(invite3)) {
r11 = intl.formatToPlainString(t["4aF92R"], {
username: UserUtils.getFormattedName(invite3.inviter)
});
}
return r11 != null ? <View style={styles.guildNameContainer}>
<GuildBadge guild={invite3.guild} style={styles.featureIcon} disableColor />
<Heading style={styles.guildNameText} variant="heading-xl/extrabold" color="mobile-text-heading-primary">{r11}</Heading>
</View> : null;
};
InviteJoinContext = function InviteJoinContext(props) {
let r51, memo, styles;
let invite, isGuildMember;
L22: {
invite = props.invite;
const isRegistration = props.isRegistration;
isGuildMember = props.isGuildMember;
styles = useStyles();
memo = useMemo(() => isStreamInvite(invite) && invite.target_user != null ? AvatarUtils.getUserAvatarSource(invite.target_user) : shouldShowInviter(invite, isGuildMember) ? invite.inviter != null ? AvatarUtils.getUserAvatarSource(invite.inviter) : null : null, [invite, isGuildMember]);
const r31 = intl.string(t["3rE1P8"]);
if (isFriendInvite(invite)) {
r51 = intl.format(t.Quj7HX, {
username: UserUtils.getFormattedName(invite.inviter)
});
} else if (isGroupDMInvite(invite)) {
r51 = invite.channel != null && invite.inviter != null ? intl.format(t.Lu4h18, {
username: UserUtils.getFormattedName(invite.inviter)
}) : intl.string(t.OsdY8B);
} else {
if (isStreamInvite(invite) && invite.target_user != null) {
r51 = intl.formatToPlainString(t.x2L32Q, {
username: UserUtils.getFormattedName(invite.target_user)
});
break L22;
}
r51 = (isGuildMember ? invite.state !== InviteStates.ACCEPTED : isGuildMember) ? isRegistration ? intl.string(t.jpwYbt) : intl.string(t["FDsl+J"]) : shouldShowInviter(invite, isGuildMember) && invite.inviter != null ? intl.format(t.spU2mI, {
username: UserUtils.getFormattedName(invite.inviter)
}) : r31;
}
}
return <View style={styles.inviteJoinContainer}>
{memo == null ? null : isFriendInvite(invite) ? null : <View style={styles.inviterIconWrapper}>
<FastImage source={memo} style={styles.inviterIcon} />
</View>}
<Text style={styles.inviteJoinText} variant="text-sm/normal" color="text-default">{r51}</Text>
</View>;
};
InviteMemberCounts = function InviteMemberCounts(props) {
const { invite: invite3, isGuildMember: isGuildMember2 } = props;
const styles = useStyles();
let approximate_presence_count = invite3.approximate_presence_count;
if (approximate_presence_count == null) {
approximate_presence_count = 0;
}
let approximate_member_count = invite3.approximate_member_count;
if (approximate_member_count == null) {
approximate_member_count = 0;
}
const r24 = {
onlineCount: approximate_presence_count,
memberCount: approximate_member_count
};
const r19 = r24.memberCount !== 0 ? r24 : null;
return r19 == null ? null : shouldShowInviter(invite3, isGuildMember2) ? null : (invite3 == null ? void 0 : invite3.guild?.id) !== INVITE_ROUTING_HUB_GUILD_ID ? <View style={styles.memberInfo}>
{r19.onlineCount != null ? <>
<View style={styles.dotOnline} />
<Text variant="text-xs/medium" color="text-default">
{intl.format(t["LC+S+m"], {
membersOnline: r19.onlineCount
})}
</Text>
</> : null}
{r19.memberCount != null ? <>
<View style={styles.dotOffline} />
<Text variant="text-xs/medium" color="text-default">
{intl.format(t.zRl6XR, {
count: r19.memberCount
})}
</Text>
</> : null}
</View> : null;
};
useStyles = createStyles({
avatar: {
height: 64,
width: 64,
margin: 0,
borderRadius: Module712.radii.lg
},
avatarContainer: {
borderRadius: Module712.radii.none,
height: 64,
width: 64,
marginBottom: 24,
marginTop: 24
},
inviteJoinContainer: {
flexDirection: "row",
alignItems: "flex-start",
marginBottom: 8,
marginLeft: 16,
marginRight: 16
},
inviteJoinText: {
textAlign: "center"
},
inviterIconWrapper: {
borderRadius: Module712.radii.none,
marginRight: 8
},
inviterIcon: {
width: 20,
height: 20,
borderRadius: Module712.radii.md
},
guildNameContainer: {
flexDirection: "row",
alignItems: "center",
marginBottom: 8
},
guildNameText: {
textAlign: "center"
},
featureIcon: {
flexGrow: 0,
marginRight: 8,
opacity: DARK_1_LIGHT_04
},
memberInfo: {
flexDirection: "row",
alignItems: "center",
marginBottom: 8
},
rolesList: {
marginTop: 8,
marginBottom: 8,
alignItems: "center"
},
dotOnline: {
width: 8,
height: 8,
borderRadius: Module712.radii.sm,
marginRight: 4,
backgroundColor: Module712.unsafe_rawColors.GREEN_360
},
dotOffline: {
width: 8,
height: 8,
borderRadius: Module712.radii.sm,
marginRight: 4,
marginLeft: 16,
backgroundColor: Module712.unsafe_rawColors.PRIMARY_400
},
embedDetailsCard: {
width: "100%",
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
padding: 16,
borderRadius: Module712.radii.sm,
marginTop: 16,
marginBottom: 8
}
});
c8107_21 = {
ACCEPT: 0,
0: "ACCEPT",
DECLINE: 1,
1: "DECLINE"
};
export default function InviteDetails(props) {
let accessibilityLabel, text;
const invite2 = props.invite;
let isGuildMember2 = props.isGuildMember;
const { onPressJoin, onPressClose, isRegistration } = props;
const styles = useStyles();
const [state, setState] = useState();
const props2 = {
invite: invite2,
isGuildMember: isGuildMember2,
isRegistration
};
const guild_scheduled_event = invite2.guild_scheduled_event;
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
let r47 = useStateFromStores([MultiAccountStore], () => MultiAccountStore.getCanUseMultiAccountMobile());
const r52 = [<InviteDestinationIcon {...props2} />, <InviteJoinContext {...props2} />, <InviteHeader {...props2} />, <InviteMemberCounts {...props2} />, <InviteRolesList invite={invite2} style={styles.rolesList} />, guild_scheduled_event != null && <View style={styles.embedDetailsCard}>
<GuildEventCardHeader event={guild_scheduled_event} />
<GuildEventCardMetaInfo event={guild_scheduled_event} />
<GuildEventCardGuildInfo event={guild_scheduled_event} />
</View>, ,];
if (isGuildMember2) {
isGuildMember2 = invite2.state !== InviteStates.ACCEPTED;
}
const source = stateFromStores != null ? AvatarUtils.getUserAvatarSource(stateFromStores, false, 20) : null;
const icon = source != null ? <Button.Icon source={source} variant="entity" /> : void 0;
const r111 = stateFromStores != null ? intl.formatToPlainString(t["9sWQNT"], {
usernameHook: () => `${stateFromStores.username}${stateFromStores.hasUniqueUsername() ? "" : `#${stateFromStores.discriminator}`}`
}) : void 0;
const r130 = intl.string(t["e/6Ogt"]);
if (isGuildMember2) {
accessibilityLabel = intl.string(t.IRoQXr);
text = accessibilityLabel;
} else {
if (r47) {
r47 = r111 != null;
}
accessibilityLabel = r111;
text = r130;
if (r47) {
accessibilityLabel = r111;
text = accessibilityLabel;
}
}
r52[6] = <ButtonGroup>
<Button icon={icon} variant="primary" size="lg" text={text} accessibilityLabel={accessibilityLabel} onPress={function handleAcceptInvitePress() {
setState(c8107_21.ACCEPT);
onPressJoin();
}} loading={state === c8107_21.ACCEPT} disabled={state === c8107_21.ACCEPT} />
<Button variant="secondary" size="lg" text={isGuildMember2 ? intl.string(t.WAI6xu) : intl.string(t.ndsK4Z)} onPress={function handleCancelPress() {
setState(c8107_21.DECLINE);
AnalyticsUtils.track(AnalyticEvents.INVITE_ACCEPT_DISMISSED, {
invite_code: invite2.code,
guild_id: invite2.guild?.id
});
onPressClose();
}} loading={state === c8107_21.DECLINE} disabled={state === c8107_21.DECLINE} />
</ButtonGroup>;
return <>{r52}</>;
};
@@ -0,0 +1,120 @@
// Metro module 11823 (f11824).
import { Image as Image2, View } from "react-native";
import { AbortCodes, HelpdeskArticles, InviteStates } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { isThemeDark } from "../../../design/shared";
import useTheme from "../../../hooks/useTheme";
import Module11824 from "../../../_bundle/Module11824";
import Module11825 from "../../../_bundle/Module11825";
import { getDescriptiveInviteError } from "../../../utils/InviteErrorUtils";
import { intl, t } from "../../../intl/index.native";
import { Text } from "../../../design/components/Text/native/Text";
import { Button } from "../../../design/components/Button/native/Button.native";
import AvatarUtils from "../../../utils/AvatarUtils";
import { Icon } from "../../../design/void/native";
import Module11827 from "../../../_bundle/Module11827";
import GuildIcon, { GuildIconSizes } from "../../guild/native/GuildIcon";
import HelpdeskUtils from "../../../utils/HelpdeskUtils";
let useStyles, InviteDisabledError;
const InviteErrorBase = function InviteErrorBase(props) {
let r12;
const { invite, onPressClose, inviteError } = props;
const styles = useStyles();
const source = isThemeDark(useTheme()) ? Module11824 : Module11825;
const descriptiveInviteError = getDescriptiveInviteError(inviteError?.code);
if (invite.state === InviteStates.BANNED) {
r12 = intl.string(t["GzD/aa"]);
} else {
r12 = descriptiveInviteError?.description;
if (r12 == null) {
r12 = intl.string(t.FWkU6P);
}
}
const r58 = [<Image2 style={styles.expiredImage} source={source} />, , , ,];
let r65 = descriptiveInviteError?.title;
if (r65 == null) {
r65 = intl.string(t.u9zxnX);
}
const handlePressClose2 = function handlePressClose() {
onPressClose();
};
r58[1] = <Text style={styles.expiredTitle} variant="heading-xl/extrabold" color="mobile-text-heading-primary">{r65}</Text>;
r58[2] = <Text style={styles.expiredBody} variant="text-sm/medium" color="text-default">{r12}</Text>;
r58[3] = <Button variant="primary" size="lg" text={intl.string(t.wcqOoF)} onPress={handlePressClose2} />;
return <>{r58}</>;
};
InviteDisabledError = function InviteDisabledError(props) {
const { invite, onPressClose: onPressClose2 } = props;
const styles = useStyles();
const guild = invite.guild;
if (guild == null) {
return null;
}
return <>
<View style={styles.disabledView}>
<Icon style={styles.disabledPauseIcon} source={Module11827} />
<GuildIcon style={styles.guildIcon} icon={AvatarUtils.getGuildIconURL({
id: guild.id,
icon: guild.icon,
size: 64,
canAnimate: false
})} size={GuildIconSizes.XLARGE} />
</View>
<Text style={styles.disabledTitle} variant="heading-xl/semibold" color="text-feedback-critical">
{intl.string(t.jlLX2Z)}
</Text>
<Text style={styles.disabledBody} variant="text-md/normal" color="text-default">
{intl.format(t.RXSeLl, {
articleLink: HelpdeskUtils.getArticleURL(HelpdeskArticles.INVITE_DISABLED)
})}
</Text>
<Button variant="primary" size="lg" text={intl.string(t["yD/zkn"])} onPress={function handlePressClose() {
onPressClose2();
}} />
</>;
};
useStyles = createStyles({
expiredImage: {
marginTop: 32,
marginBottom: 32
},
expiredTitle: {
marginBottom: 8,
backgroundColor: "transparent",
textAlign: "center"
},
expiredBody: {
backgroundColor: "transparent",
marginBottom: 24
},
disabledView: {
justifyContent: "center",
alignItems: "center"
},
disabledPauseIcon: {
position: "absolute",
alignSelf: "center",
tintColor: Module712.colors.WHITE,
width: 42,
height: 42
},
guildIcon: {
borderRadius: Module712.radii.lg,
opacity: 0.2,
zIndex: -999
},
disabledTitle: {
marginTop: 16,
marginBottom: 8,
textAlign: "center"
},
disabledBody: {
textAlign: "center",
marginBottom: 16
}
});
export default function InviteError(props) {
const inviteError = props.inviteError;
return inviteError == null ? <InviteErrorBase {...props} /> : inviteError.code === AbortCodes.INVITES_DISABLED ? <InviteDisabledError {...props} /> : <InviteErrorBase {...props} />;
};
@@ -0,0 +1,31 @@
// Metro module 11822 (f11823).
import { useMemo } from "react";
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { sortInviteRoles, inviteRoleToDisplayData } from "../../../utils/GuildRoleUtils";
import { Stack } from "../../../design/components/Stack/native/Stack.native";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import RolePill from "../../../components_native/common/RolePill";
const useStyles = createStyles({
rolesRow: {
flexDirection: "row",
flexWrap: "wrap",
justifyContent: "center",
gap: 4
}
});
export default function InviteRolesList(props) {
const { invite, style } = props;
const styles = useStyles();
const { guild, roles } = invite;
const memo = useMemo(() => guild != null && (roles != null && roles.length !== 0) ? [...roles].sort(sortInviteRoles).map((item) => inviteRoleToDisplayData(guild.id, item)) : [], [guild, roles]);
return guild == null ? null : memo.length !== 0 ? <Stack spacing={4} style={style}>
<Text variant="text-sm/semibold" color="text-default">
{intl.string(t.stcSfI)}
</Text>
<View style={styles.rolesRow}>
{memo.map((item) => <RolePill key={item.id} role={item} guildId={guild.id} />)}
</View>
</Stack> : null;
};
+109
View File
@@ -0,0 +1,109 @@
// Metro module 9222 (f9223).
import { useCallback } from "react";
import { ScrollView, View } from "react-native";
import { CREATE_GUILD_SMALL_SCREEN_MAX_HEIGHT, CreateGuildModalStates } from "../../create_guild/native/CreateGuildConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import useSafeAreaInsetsKeyboardAware_native from "../../safe_area/useSafeAreaInsetsKeyboardAware.native";
import { useNavigation } from "../../../design/components/Navigator/native/useNavigation.native";
import useWindowDimensions_native from "../../screen/useWindowDimensions.native";
import FreeFormInputGroup from "../../../design/void/Form/native/FreeFormInputGroup";
import { Button } from "../../../design/components/Button/native/Button.native";
let useStyles, _excluded, placeholder;
const OrSeparator = function OrSeparator() {
const styles = useStyles();
return <View style={styles.separator}>
<View style={styles.innerSeparator} />
<Text style={styles.orText} variant="text-sm/semibold" color="text-muted">
{intl.string(t.HEuagM)}
</Text>
<View style={styles.innerSeparator} />
</View>;
};
useStyles = createStyles({
growSpacing: {
flexGrow: 2,
minHeight: Module712.space.PX_24
},
container: {
flexGrow: 2,
paddingHorizontal: Module712.space.PX_16,
paddingBottom: Module712.space.PX_16
},
textInput: {
borderRadius: Module712.radii.lg
},
innerSeparator: {
height: 1,
flexGrow: 2,
backgroundColor: Module712.colors.BORDER_SUBTLE
},
separator: {
paddingVertical: 12,
flexDirection: "row",
justifyContent: "center",
alignItems: "center"
},
orText: {
textAlign: "center",
marginHorizontal: Module712.space.PX_8,
textTransform: "uppercase"
},
header: {
textAlign: "center"
},
description: {
textAlign: "center",
marginTop: 8,
marginBottom: 32
},
exampleText: {
marginTop: 8
}
});
_excluded = ["https://discord.gg/hTKzmak", "hTKzmak", "https://discord.gg/wumpus-friends"];
placeholder = _excluded[0];
export default function JoinServer(props) {
const { error, inviteString, onInviteChange, onDone, submitting } = props;
const styles = useStyles();
const insets = useSafeAreaInsetsKeyboardAware_native().insets;
const navigation = useNavigation();
const height = useWindowDimensions_native().height;
const callback = useCallback(() => {
navigation.push(CreateGuildModalStates.JOIN_STUDENT_HUB);
}, [navigation]);
return <ScrollView keyboardShouldPersistTaps="handled" contentContainerStyle={[styles.container, {
paddingBottom: insets.bottom + Module712.space.PX_16
}]}>
<View>
{height <= CREATE_GUILD_SMALL_SCREEN_MAX_HEIGHT ? null : <>
<Text style={styles.header} accessibilityRole="header" variant="heading-xl/bold" color="mobile-text-heading-primary">
{intl.string(t.jlfuFW)}
</Text>
<Text style={styles.description} variant="text-sm/medium" color="text-default">
{intl.string(t.lVvN3A)}
</Text>
</>}
<FreeFormInputGroup label={intl.string(t.qreV25)} error={error} value={inviteString} onChangeText={onInviteChange} placeholder={placeholder} accessibilityLabel={intl.string(t.qreV25)} autoFocus autoCapitalize="none" autoCorrect={false} returnKeyType="join" textStyle={styles.textInput} onSubmitEditing={onDone} />
<Text style={styles.exampleText} variant="text-sm/medium" color="text-muted">
{intl.format(t.vwWaTe, {
example1: _excluded[0],
example2: _excluded[1],
example3: _excluded[2],
exampleHook: (a0, a1) => <Text key={a1} variant="text-sm/medium" color="text-default">
{a0}
</Text>
})}
</Text>
</View>
<>
<View style={styles.growSpacing} />
<Button size="lg" text={intl.string(t["+H/coT"])} accessibilityLabel={intl.string(t["+H/coT"])} loading={submitting} disabled={submitting} onPress={onDone} />
<OrSeparator />
<Button size="lg" variant="secondary" text={intl.string(t["MOqX/G"])} accessibilityLabel={intl.string(t["MOqX/G"])} onPress={callback} />
</>
</ScrollView>;
};
export { OrSeparator };
@@ -0,0 +1,27 @@
// Metro module 16121 (f16122).
import { useEffect, useMemo } from "react";
import { CreateGuildModalStates } from "../../../create_guild/native/CreateGuildConstants";
import { ImpressionNames } from "../../../../_bundle/Module503";
import { parseInviteCodeFromInviteKey } from "../../../instant_invite/InviteCodeUtils";
import AcceptInviteContainer from "../../../create_guild/native/components/AcceptInviteContainer";
import { clearDisplayedInvite } from "../../../../actions/native/DisplayedInviteActionCreators";
import { Navigator } from "../../../../design/components/Navigator/native/Navigator.native";
export default function AcceptInviteModal(props) {
let c22804_0 = props;
useEffect(() => () => {}, []);
return <Navigator screens={useMemo(() => {
let c28228_0 = c22804_0;
const r10 = {};
r10[CreateGuildModalStates.ACCEPT_INVITE] = {
fullscreen: true,
headerShown: false,
impressionName: ImpressionNames.INVITE_ACCEPT,
impressionProperties: {
deeplink_attempt_id: c22804_0.deeplinkAttemptId,
invite_code: parseInviteCodeFromInviteKey(c22804_0.code)
},
render: () => <AcceptInviteContainer {...c28228_0} onPressClose={clearDisplayedInvite} />
};
return r10;
}, [props])} initialRouteName={CreateGuildModalStates.ACCEPT_INVITE} />;
};
@@ -0,0 +1,96 @@
// Metro module 4157 (f4158).
import _objectWithoutProperties from "../../../_bundle/_objectWithoutProperties";
import { jsx } from "react/jsx-runtime";
import Dispatcher from "../../../Dispatcher";
function $mk73639($env) {
return () => {
const r4 = $env;
if (!r4[6]) {
const r6 = $env.$parent;
(0, r6[0])(r6[2][4]).triggerHapticFeedback((0, r6[1])(r6[2][5]).IMPACT_LIGHT);
}
const r15 = $env.$parent;
(0, r15[0])(r15[2][6]).dismissGlobalKeyboard();
(0, r15[1])(r15[2][3]).dispatch({
type: "SHOW_ACTION_SHEET",
content: r4[0],
key: r4[1],
impressionName: r4[2],
impressionProperties: r4[3],
backdropKind: r4[4],
stackingBehavior: r4[5],
appEntryKey: r4[7]
});
};
}
let env2393 = {};
const _excluded = ["impressionName", "impressionProperties", "backdropKind", "disableHapticOnOpen", "appEntryKey"];
const r22 = {
openLazy: (a0, c13872_0, c13872_1, c13872_2) => {
(a0 instanceof Promise ? a0.then((result) => result.default) : a0()).then((result) => {
let r11 = c13872_1;
if (r11 == null) {
r11 = {};
}
let env24943;
const { impressionName, impressionProperties, backdropKind, disableHapticOnOpen, appEntryKey } = r11;
const r2 = env2393;
const r18 = jsx(result, {
..._objectWithoutProperties(r11, _excluded)
});
const r21 = env24943 = {
$parent: r2
};
env24943[0] = r18;
env24943[1] = c13872_0;
env24943[2] = impressionName;
env24943[3] = impressionProperties;
env24943[4] = backdropKind;
env24943[5] = c13872_2;
env24943[6] = disableHapticOnOpen;
env24943[7] = appEntryKey;
Dispatcher.wait($mk73639(r21));
});
},
hideActionSheet: (a0) => {
Dispatcher.dispatch({
type: "HIDE_ACTION_SHEET",
key: a0
});
},
hideAllActionSheets: () => {
Dispatcher.dispatch({
type: "HIDE_ALL_ACTION_SHEETS"
});
},
setActionSheetZIndex: (a0) => {
Dispatcher.dispatch({
type: "SET_ACTION_SHEET_Z_INDEX",
zIndex: a0
});
},
resetActionSheetsForAppEntryKey: (a0) => {
Dispatcher.dispatch({
type: "RESET_ACTION_SHEETS_FOR_APP_ENTRY_KEY",
appEntryKey: a0
});
}
};
export default r22;
export const ACTION_SHEET_HEIGHT_HALF = "start";
export const ACTION_SHEET_HEIGHT_EXPANDED = "expanded";
export function showActionSheet(a0) {
let env13871;
const r1 = env13871 = {
$parent: env2393
};
env13871[0] = a0.content;
env13871[1] = a0.key;
env13871[2] = a0.impressionName;
env13871[3] = a0.impressionProperties;
env13871[4] = a0.backdropKind;
env13871[5] = a0.stackingBehavior;
env13871[6] = a0.disableHapticOnOpen;
env13871[7] = a0.appEntryKey;
Dispatcher.wait($mk73639(r1));
}
@@ -0,0 +1,27 @@
// Metro module 5244 (f5245).
export const ACTION_SHEET_START_HEIGHT_RATIO = 0.6;
export const ACTION_SHEET_MAX_DYNAMIC_CONTENT_SIZE_RATIO = 0.85;
export const ACTION_SHEET_BORDER_RADIUS_LEGACY = 8;
export const ACTION_SHEET_BORDER_RADIUS_REDESIGN = 24;
export const ACTION_SHEET_INNER_BORDER_RADIUS_LEGACY = 6;
export const ACTION_SHEET_INNER_BORDER_RADIUS_REDESIGN = 22;
export const ACTION_SHEET_MAX_WIDTH = 500;
export const ACTION_SHEET_SPRING_CONFIG = {
damping: 17,
stiffness: 240,
mass: 0.5,
restDisplacementThreshold: 0.4
};
export const ACTION_SHEET_SPRING_CONFIG_REDUCED_MOTION = {
duration: 250
};
export const ACTION_SHEET_BORDER_RADIUS = 24;
export const ACTION_SHEET_INNER_BORDER_RADIUS = 22;
export const ACTION_SHEET_GRADIENT_BORDER_WIDTH = 2;
export const ACTION_SHEET_GRADIENT_BORDER_RADIUS = 20;
export const ACTION_SHEET_HANDLE_PADDING = 8;
export const ACTION_SHEET_HANDLE_HEIGHT = 4;
export const ACTION_SHEET_HANDLE_SPACING = 20;
export const ACTION_SHEET_HANDLE_SPACING_REDESIGN = 12;
export const ACTION_SHEET_HANDLE_OVERHANG_REDESIGN = 8;
export const ACTION_SHEET_MINIMUM_BOTTOM_PADDING = 16;
@@ -0,0 +1,4 @@
// Metro module 5497 (f5498).
import { createContext } from "react";
const context = createContext(null);
export default context;
@@ -0,0 +1,117 @@
// Metro module 3882 (f3883).
import Module589 from "../../../_bundle/Module589";
import Dispatcher from "../../../Dispatcher";
function $mk73177($env) {
return (a0) => a0.key !== $env[0];
}
let zIndex;
let c2205_0 = new Array();
zIndex = void 0;
const key = "QuickSwitcher";
const setContent = (a0) => {};
class ActionSheetStore extends Module589.Store {
static displayName = "ActionSheetStore";
getContent = () => c2205_0.at(-1)?.content;
getStack = () => c2205_0;
isOpen = () => c2205_0.length > 0;
getKey = () => c2205_0.at(-1)?.key;
initialize() {}
get impressionName() {
return c2205_0.at(-1)?.impressionName;
}
get impressionProperties() {
return c2205_0.at(-1)?.impressionProperties;
}
get backdropKind() {
return c2205_0.at(-1)?.backdropKind;
}
}
const actionSheetStore = new ActionSheetStore(Dispatcher, {
SHOW_ACTION_SHEET: function handleShowActionSheet({ content, key: key2, impressionName: impressionName2, impressionProperties: impressionProperties2, backdropKind: backdropKind2, stackingBehavior = "replaceTopSheet", appEntryKey: appEntryKey2 = "main" }) {
let r29;
L13: {
const r7 = {
content,
key: key2,
impressionName: impressionName2,
impressionProperties: impressionProperties2,
backdropKind: backdropKind2,
appEntryKey: appEntryKey2,
zIndex
};
const r2 = c2205_0.length < 3;
if (stackingBehavior === "replaceAll") {
r29 = [r7];
} else {
if (stackingBehavior === "stack" && r2) {
r29 = [...c2205_0, r7];
break L13;
}
r29 = c2205_0.slice(0, -1).concat(r7);
}
}
c2205_0 = r29;
},
SHOW_ACTION_SHEET_QUICK_SWITCHER: function handleShowActionSheetQuickSwitcher(a0) {
let r32;
const r4 = {
key,
...a0
};
const { content, key: key2, impressionName: impressionName2, impressionProperties: impressionProperties2, backdropKind: backdropKind2, stackingBehavior = "replaceTopSheet", appEntryKey: appEntryKey2 = "main" } = r4;
L13: {
const r21 = {
content,
key: key2,
impressionName: impressionName2,
impressionProperties: impressionProperties2,
backdropKind: backdropKind2,
appEntryKey: appEntryKey2,
zIndex
};
const r2 = c2205_0.length < 3;
if (stackingBehavior === "replaceAll") {
r32 = [r21];
} else {
if (stackingBehavior === "stack" && r2) {
r32 = [...c2205_0, r21];
break L13;
}
r32 = c2205_0.slice(0, -1).concat(r21);
}
}
c2205_0 = r32;
},
HIDE_ACTION_SHEET: function handleHideActionSheet({ key: key2 }) {
let env13713;
const r7 = env13713 = {};
env13713[0] = key2;
if (key2 == null) {
c2205_0 = c2205_0.slice(0, -1);
}
c2205_0 = c2205_0.filter($mk73177(r7));
},
HIDE_ALL_ACTION_SHEETS: function handleHideAllActionSheets() {
c2205_0 = [];
},
HIDE_ACTION_SHEET_QUICK_SWITCHER: function handleHideActionSheetQuickSwitcher() {
let env13714;
const r3 = env13714 = {};
env13714[0] = key;
if (key == null) {
c2205_0 = c2205_0.slice(0, -1);
}
c2205_0 = c2205_0.filter($mk73177(r3));
},
SET_ACTION_SHEET_Z_INDEX: function handleSetActionSheetZIndex(a0) {
zIndex = a0.zIndex;
},
RESET_ACTION_SHEETS_FOR_APP_ENTRY_KEY: function handleResetActionSheetsForAppEntryKey({ appEntryKey }) {
const r8 = c2205_0.filter((item) => item.appEntryKey !== appEntryKey);
if (r8.length === c2205_0.length) {
return false;
}
c2205_0 = r8;
}
});
export default actionSheetStore;
@@ -0,0 +1,233 @@
// Metro module 10867 (f10868).
import { STANDARD_EASING } from "../../../design/void/native";
import * as _spring from "../../../design/animation/reanimated/spring/spring";
import * as _timing from "../../../design/animation/reanimated/timing/timing";
import { useSharedValue } from "../../reanimated/ReanimatedRexport";
import { Gesture } from "../../../_bundle/Module5273";
function $mk118274($env) {
return (a0, a1) => {
const r7 = Math;
const r8 = $env[0];
const r11 = r7.abs(a0 - r8);
const r16 = Math.abs(a1 - r8);
return r11 < r16 ? -1 : r11 > r16 ? 1 : 0;
};
}
let getNearestValue, withPanGestureSpring, withPanGestureTiming, __initData2, __initData3, __initData4, __initData5;
let c7305_2 = {
damping: 30,
mass: 1,
stiffness: 250,
overshootClamping: true,
restSpeedThreshold: 0.001,
restDisplacementThreshold: 0.001
};
let c7305_3 = {
duration: 500,
easing: STANDARD_EASING
};
const __initData = {
code: "function getSortedByMeasure_PanGestureAnimationsTsx2(array,measure){const sorted=new Array(...array).sort(function(left,right){const al=Math.abs(left-measure);const ar=Math.abs(right-measure);return al<ar?-1:al>ar?1:0;});return sorted;}"
};
const getNearestValue2 = function getNearestValue(a0, a1) {
let r31;
let c26817_0 = a1;
let r7 = arguments[2];
if (r7 === void 0) {
r7 = 0;
}
const r0 = r7 < 0 ? -1 : r7 > 0 ? 1 : 0;
let c26817_1 = r0;
const getSortedByMeasure = function getSortedByMeasure(a0, a1) {
let env31591;
const r1 = env31591 = {};
env31591[0] = a1;
return new Array(...[...a0]).sort($mk118274(r1));
};
getSortedByMeasure.__closure = {};
getSortedByMeasure.__workletHash = 9192847351523;
getSortedByMeasure.__initData = __initData;
if (a0.length === 0) {
return a1;
}
let env26818;
const r20 = env26818 = {};
env26818[0] = a1;
const r30 = new Array(...[...a0]).sort($mk118274(r20));
if (r0 !== 0) {
let r34 = r30.find((item) => c26817_1 < 0 ? c26817_0 > item : c26817_0 < item);
if (r34 == null) {
r34 = r30[0];
}
r31 = r34;
} else {
r31 = r30[0];
}
return r31;
};
getNearestValue2.__closure = {};
getNearestValue2.__workletHash = 4186929947751;
getNearestValue2.__initData = {
code: "function getNearestValue_PanGestureAnimationsTsx1(array,measure,velocity=0){const unitVector=velocity<0?-1:velocity>0?1:0;function getSortedByMeasure(array,measure){'worklet';const sorted=new Array(...array).sort(function(left,right){const al=Math.abs(left-measure);const ar=Math.abs(right-measure);return al<ar?-1:al>ar?1:0;});return sorted;}if(array.length===0){return measure;}const sorted=getSortedByMeasure(array,measure);if(unitVector!==0){var _sorted$find;return(_sorted$find=sorted.find(function(value){const result=unitVector<0?measure>value:measure<value;return result;}))!==null&&_sorted$find!==void 0?_sorted$find:sorted[0];}return sorted[0];}"
};
getNearestValue = getNearestValue2;
const withPanGestureSpring2 = function withPanGestureSpring(a0, a1, a2) {
return _spring.withSpring(a0, {
...a2 == null ? c7305_2 : a2,
velocity: a1
});
};
withPanGestureSpring2.__closure = {
SPRING_CONFIG: c7305_2,
withSpring: _spring.withSpring
};
withPanGestureSpring2.__workletHash = 12189464558811;
withPanGestureSpring2.__initData = {
code: "function withPanGestureSpring_PanGestureAnimationsTsx3(destination,velocity,config){const{SPRING_CONFIG,withSpring}=this.__closure;const springConfig=config!==null&&config!==void 0?config:SPRING_CONFIG;return withSpring(destination,{...springConfig,velocity:velocity});}"
};
withPanGestureSpring = withPanGestureSpring2;
const withPanGestureTiming2 = function withPanGestureTiming(a0, a1) {
return _timing.withTiming(a0, a1 == null ? c7305_3 : a1);
};
withPanGestureTiming2.__closure = {
TIMING_CONFIG: c7305_3,
withTiming: _timing.withTiming
};
withPanGestureTiming2.__workletHash = 7636074551896;
withPanGestureTiming2.__initData = {
code: "function withPanGestureTiming_PanGestureAnimationsTsx4(destination,config){const{TIMING_CONFIG,withTiming}=this.__closure;const timingConfig=config!==null&&config!==void 0?config:TIMING_CONFIG;return withTiming(destination,timingConfig);}"
};
withPanGestureTiming = withPanGestureTiming2;
__initData2 = {
code: "function PanGestureAnimationsTsx5(){const{isGestureInProgress}=this.__closure;if(isGestureInProgress!=null){isGestureInProgress.set(false);}}"
};
__initData3 = {
code: "function PanGestureAnimationsTsx6(event,success){const{start,translate,snapPositions,velocity,swipeVelocityThreshold,getNearestValue,withPanGestureSpring,withPanGestureTiming,onEnd}=this.__closure;start.set(translate.get());if(snapPositions!=null){var _onEnd;const swipeVelocity=Math.abs(velocity.get())>swipeVelocityThreshold?velocity.get():0;const snapPoint=getNearestValue(snapPositions.get(),translate.get(),swipeVelocity);if(swipeVelocity!==0){translate.set(withPanGestureSpring(snapPoint,velocity.get()));}else{translate.set(withPanGestureTiming(snapPoint));}(_onEnd=onEnd)===null||_onEnd===void 0||_onEnd(event,{success:success,destination:snapPoint,startPosition:start.get()});}}"
};
__initData4 = {
code: "function PanGestureAnimationsTsx7(event){const{start,vertical,LowerBounds,upperBounds,velocity,translate,onChange}=this.__closure;var _onChange;const{velocityY:velocityY,translationY:translationY,velocityX:velocityX,translationX:translationX}=event;let next=start.get()+(vertical?translationY:translationX);if(LowerBounds!=null&&next<LowerBounds){next=LowerBounds;}else if(upperBounds!=null&&next>upperBounds){next=upperBounds;}velocity.set(vertical?velocityY:velocityX);translate.set(next);(_onChange=onChange)===null||_onChange===void 0||_onChange(event,{destination:translate.get(),startPosition:start.get()});}"
};
__initData5 = {
code: "function PanGestureAnimationsTsx8(event){const{start,translate,velocity,isGestureInProgress,onStart}=this.__closure;var _onStart;start.set(translate.get());velocity.set(0);if(isGestureInProgress!=null){isGestureInProgress.set(true);}(_onStart=onStart)===null||_onStart===void 0||_onStart(event,{destination:start.get(),startPosition:start.get()});}"
};
export default function usePanGesture(a0) {
const { LowerBounds, upperBounds, snapPositions, swipeVelocityThreshold = 300 } = a0;
let c18325_3 = swipeVelocityThreshold;
const { translate, onStart, onChange, onEnd, vertical = true } = a0;
let c18325_8 = vertical;
const isGestureInProgress = a0.isGestureInProgress;
const sharedValue = useSharedValue(0);
const sharedValue2 = useSharedValue(0);
const r30 = Gesture.Pan();
const N = function N(a0) {
sharedValue.set(translate.get());
sharedValue2.set(0);
if (isGestureInProgress != null) {
isGestureInProgress.set(true);
}
if (onStart != null) {
onStart(a0, {
destination: sharedValue.get(),
startPosition: sharedValue.get()
});
}
};
N.__closure = {
start: sharedValue,
translate,
velocity: sharedValue2,
isGestureInProgress,
onStart
};
N.__workletHash = 7008504704609;
N.__initData = __initData5;
const r36 = r30.onStart(N);
const C = function C(a0) {
const { velocityY, translationY } = a0;
let velocityX = a0.velocityX;
let translationX = a0.translationX;
const r12 = sharedValue.get();
if (c18325_8) {
translationX = translationY;
}
const r13 = r12 + translationX;
let r14 = LowerBounds;
if (!(LowerBounds != null && r13 < LowerBounds)) {
r14 = upperBounds != null && r13 > upperBounds ? upperBounds : r13;
}
if (c18325_8) {
velocityX = velocityY;
}
sharedValue2.set(velocityX);
translate.set(r14);
if (onChange != null) {
onChange(a0, {
destination: translate.get(),
startPosition: sharedValue.get()
});
}
};
C.__closure = {
start: sharedValue,
vertical,
LowerBounds,
upperBounds,
velocity: sharedValue2,
translate,
onChange
};
C.__workletHash = 15962975179371;
C.__initData = __initData4;
const r42 = r36.onChange(C);
const T = function T(a0, a1) {
sharedValue.set(translate.get());
if (snapPositions != null) {
const r24 = Math.abs(sharedValue2.get()) > c18325_3 ? sharedValue2.get() : 0;
const nearestValue = getNearestValue(snapPositions.get(), translate.get(), r24);
if (r24 !== 0) {
translate.set(_spring.withSpring(nearestValue, {
...c7305_2,
velocity: sharedValue2.get()
}));
} else {
translate.set(_timing.withTiming(nearestValue, c7305_3));
}
if (onEnd != null) {
onEnd(a0, {
success: a1,
destination: nearestValue,
startPosition: sharedValue.get()
});
}
}
};
T.__closure = {
start: sharedValue,
translate,
snapPositions,
velocity: sharedValue2,
swipeVelocityThreshold,
getNearestValue,
withPanGestureSpring,
withPanGestureTiming,
onEnd
};
T.__workletHash = 15665959414289;
T.__initData = __initData3;
const r51 = r42.onEnd(T);
const S = function S() {
if (isGestureInProgress != null) {
isGestureInProgress.set(false);
}
};
S.__closure = {
isGestureInProgress
};
S.__workletHash = 11128244755178;
S.__initData = __initData2;
return r51.onFinalize(S);
};
export { c7305_2 as SPRING_CONFIG };
export { c7305_3 as TIMING_CONFIG };
export { withPanGestureSpring };
export { withPanGestureTiming };
@@ -0,0 +1,70 @@
// Metro module 8198 (f8199).
import { AnalyticEvents } from "../../../Constants";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { getMobileMediaViewerShareExperimentEnabled } from "../../media_viewer/native/MobileMediaViewerShareExperiment";
import { decideFileExtension } from "../../media/FileExtensionUtils";
export function trackAppClickInNativeShareSheet(a0, a1) {
let package_name = a0;
const NATIVE_SHARE_SHEET_APP_CLICKED = AnalyticEvents.NATIVE_SHARE_SHEET_APP_CLICKED;
if (a0 == null) {
package_name = "";
}
AnalyticsUtils.track(NATIVE_SHARE_SHEET_APP_CLICKED, {
package_name,
location: a1
});
}
export function getMediaShareParams(a0) {
if (getMobileMediaViewerShareExperimentEnabled("shareMediaSource") && a0.disableDownload !== true) {
if (a0.isGIFV === true) {
let embedURI = a0.embedURI;
if (embedURI == null) {
embedURI = a0.sourceURI;
}
if (embedURI == null) {
embedURI = a0.uri;
}
return {
mediaFallbackUrl: embedURI
};
}
const { videoURI, contentType } = a0;
if (videoURI != null) {
const fileExtension2 = decideFileExtension(videoURI, contentType, true);
return {
mediaFallbackUrl: videoURI,
mediaStagingOptions: fileExtension2 != null ? {
url: videoURI,
fileExtension: fileExtension2,
mediaType: "video"
} : void 0
};
}
const fileExtension = decideFileExtension(a0.uri, contentType, true);
let sourceURI = a0.sourceURI;
if (sourceURI == null) {
sourceURI = a0.uri;
}
return {
mediaFallbackUrl: sourceURI,
mediaStagingOptions: fileExtension != null ? {
url: a0.uri,
fileExtension,
mediaType: "image"
} : void 0
};
}
let videoURI2 = a0.videoURI;
if (videoURI2 == null) {
videoURI2 = a0.sourceURI;
}
if (videoURI2 == null) {
videoURI2 = a0.uri;
}
return {
mediaFallbackUrl: videoURI2
};
}
export function resolveShareFileExtension(a0, a1) {
return decideFileExtension(a0, a1, true);
}
@@ -0,0 +1,3 @@
// Metro module 15741 (f15742).
import { ActionSheetPresenter } from "../../../../design/components/Sheet/native/ActionSheetPresenter.native";
export default ActionSheetPresenter;
@@ -0,0 +1,3 @@
// Metro module 11350 (f11351).
import { BottomSheetTextInput } from "../../../../design/components/Sheet/native/BottomSheetTextInput.native";
export default BottomSheetTextInput;
@@ -0,0 +1,29 @@
// Metro module 9965 (f9966).
import { View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { ActionSheetHeaderPressableText } from "../../../../design/components/Sheet/native/ActionSheetHeaderPressableText.native";
import { intl, t } from "../../../../intl/index.native";
const useStyles = createStyles({
headerContainer: {
paddingVertical: 12,
paddingHorizontal: 16,
alignItems: "flex-start"
}
});
export default function ContextMenuSubmenuActionSheetHeader(props) {
let onBack = props.onBack;
const props2 = {
style: useStyles().headerContainer,
children: null
};
const props3 = {
label: intl.string(t["13/7kX"]),
onPress: null
};
if (onBack == null) {
onBack = () => {};
}
props3.onPress = onBack;
props2.children = <ActionSheetHeaderPressableText {...props3} />;
return <View {...props2} />;
};
@@ -0,0 +1,62 @@
// Metro module 9967 (f9968).
import { View } from "react-native";
import { ACTION_SHEET_MAX_WIDTH } from "../ActionSheetConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import ActionSheetActionCreators from "../ActionSheetActionCreators";
import { triggerHapticFeedback, HapticFeedbackTypes } from "../../../haptics/HapticUtils.native";
import { addReaction, ReactionLocations } from "../../../reactions/ReactionActionCreators";
import { toReactionEmoji } from "../../../reactions/ReactionUtils";
import MessageActionCreators from "../../../../actions/MessageActionCreators";
import { maybeShowDoubleTapReminderToast } from "../../../double_tap_to_react/native/DoubleTapReminderToast";
import { useToken } from "../../../../design/tokens/native/useToken";
import Module712 from "../../../../_bundle/Module712";
import { useEmojisForReactionRow } from "../../../reactions/native/useEmojisForReactionRow";
import { EmojiReactionRowButton, getEmojiKey, EmojiPickerRowButton } from "../../../reactions/native/EmojiReactionRowButton";
import { handleAddNewReactions } from "../../../reactions/native/ReactionUtils";
import { DoubleTapEmojiEditNudge } from "../../../double_tap_to_react/native/DoubleTapEmojiEditNudge";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
const useStyles = createStyles({
emojiRowContainer: {
flexDirection: "column",
justifyContent: "center",
alignItems: "center"
},
emojiRow: {
height: 52,
alignSelf: "stretch",
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
marginTop: 0,
marginBottom: 0
}
});
export default function EmojiRow(props) {
const { message, channel } = props;
const token = useToken(Module712.modules.mobile.EMOJI_ROW_EMOJI_SIZE);
const token2 = useToken(Module712.modules.mobile.EMOJI_ROW_EMOJI_FONT_SIZE);
const token3 = useToken(Module712.modules.mobile.EMOJI_ROW_EMOJI_LINE_HEIGHT);
const token4 = useToken(Module712.modules.mobile.EMOJI_ROW_EMOJI_CONTAINER_SIZE);
const emojisForReactionRow = useEmojisForReactionRow(channel, ACTION_SHEET_MAX_WIDTH, token4 + useToken(Module712.modules.mobile.EMOJI_ROW_EMOJI_MIN_SPACING));
const styles = useStyles();
return <View style={styles.emojiRowContainer}>
<View style={styles.emojiRow}>
{emojisForReactionRow.map((item, index) => {
return <EmojiReactionRowButton key={getEmojiKey(item, index)} emoji={item} onPress={() => {
ActionSheetActionCreators.hideActionSheet();
if (item != null) {
triggerHapticFeedback(HapticFeedbackTypes.IMPACT_LIGHT);
addReaction(message.channel_id, message.id, toReactionEmoji(item));
MessageActionCreators.focusMessage({
channelId: message.channel_id,
messageId: message.id
});
maybeShowDoubleTapReminderToast(item);
}
}} emojiSize={token} emojiFontSize={token2} emojiLineHeight={token3} emojiContainerSize={token4} />;
})}
<EmojiPickerRowButton emojiContainerSize={token4} onPress={() => handleAddNewReactions(channel, message.id, ReactionLocations.MESSAGE)} />
</View>
<DoubleTapEmojiEditNudge location={AnalyticsLocation.MESSAGE_LONG_PRESS_MENU} />
</View>;
};
@@ -0,0 +1,6 @@
// Metro module 9966 (f9967).
import { MessageFlags, MessageStates, MessageTypes } from "../../../../Constants";
import { hasFlag } from "../../../../_bundle/Module1384";
export function shouldShowEmojiRow(a0, a1, a2) {
return (a0 ? a2 : a0) && a1.state !== MessageStates.SEND_FAILED && a1.state !== MessageStates.SENDING && a1.type !== MessageTypes.THREAD_STARTER_MESSAGE && !hasFlag(a1.flags, MessageFlags.EPHEMERAL);
}
@@ -0,0 +1,374 @@
// Metro module 10365 (f10366).
import LurkingStore from "../../../lurker_mode/LurkingStore";
import JoinedThreadsStore from "../../../threads/JoinedThreadsStore";
import ThreadMessageStore from "../../../threads/ThreadMessageStore";
import AuthenticationStore from "../../../../stores/AuthenticationStore";
import GuildStore from "../../../../stores/GuildStore";
import { AnalyticsObjectTypes, AnalyticsObjects, AnalyticsSections, ChannelSettingsSections } from "../../../../Constants";
import { ChannelFlags } from "../../../channel/ChannelConstants";
import buildFavoritesSectionButtons from "../../../favorites/native/buildFavoritesSectionButtons";
import { intl, t } from "../../../../intl/index.native";
import { EyeIcon } from "../../../../design/components/Icon/native/redesign/generated/EyeIcon";
import { ack } from "../../../../actions/ReadStateActionCreators";
import { UserMinusIcon } from "../../../../design/components/Icon/native/redesign/generated/UserMinusIcon";
import ThreadActionCreators from "../../../threads/ThreadActionCreators";
import { BellIcon } from "../../../../design/components/Icon/native/redesign/generated/BellIcon";
import { ClockIcon } from "../../../../design/components/Icon/native/redesign/generated/ClockIcon";
import { XLargeIcon } from "../../../../design/components/Icon/native/redesign/generated/XLargeIcon";
import { LockUnlockedIcon } from "../../../../design/components/Icon/native/redesign/generated/LockUnlockedIcon";
import { LockIcon } from "../../../../design/components/Icon/native/redesign/generated/LockIcon";
import { PencilIcon } from "../../../../design/components/Icon/native/redesign/generated/PencilIcon";
import { openCreateForumPostModal } from "../../../forums/native/composer/ForumComposerModalActionCreators";
import SnowflakeUtils from "../../../../utils/SnowflakeUtils";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
import { SettingsIcon } from "../../../../design/components/Icon/native/redesign/generated/SettingsIcon";
import ChannelSettingsActionCreators from "../../../../actions/ChannelSettingsActionCreators";
import { TagsIcon } from "../../../../design/components/Icon/native/redesign/generated/TagsIcon";
import ActionSheetActionCreators from "../ActionSheetActionCreators";
import { LinkIcon } from "../../../../design/components/Icon/native/redesign/generated/LinkIcon";
import { handleCopyLinkForumPost } from "../../../messages/native/MessagesUtils";
import { BellSlashIcon } from "../../../../design/components/Icon/native/redesign/generated/BellSlashIcon";
import { ChannelNotificationIcon } from "../../../../design/components/Icon/native/redesign/generated/ChannelNotificationIcon";
import { showThreadNotificationsBottomSheet } from "../../../threads/native/threadActionSheets";
import { PinIcon } from "../../../../design/components/Icon/native/redesign/generated/PinIcon";
import AlertActionCreators from "../../../../actions/AlertActionCreators";
import { TrashIcon } from "../../../../design/components/Icon/native/redesign/generated/TrashIcon";
import MessageActionCreators from "../../../../actions/MessageActionCreators";
import { Avatar, AvatarSizes, ButtonColors } from "../../../../design/void/native";
import { IdIcon } from "../../../../design/components/Icon/native/redesign/generated/IdIcon";
import { copy } from "../../../../utils/ClipboardUtils.native";
import { presentPostIdCopied } from "../../../toast/native/ToastUtils";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useFirstForumPostMessage } from "../../../forums/ForumPostDataLoader";
import { useIsThreadModerator, useCanManageThread, useCanUnarchiveThread } from "../../../threads/ThreadHooks";
import { useExistingPin } from "../../../forums/ForumHooks";
import { DeveloperMode } from "../../../user_settings/UserSettings";
import useChannelName from "../../../channel/useChannelName";
import useFavoritesGuildChannelActions from "../../../favorites/native/action/useFavoritesGuildChannelActions";
import GuildIcon, { GuildIconSizes } from "../../../guild/native/GuildIcon";
import { ActionSheet } from "../../../../design/components/Sheet/native/ActionSheet.native";
import { isMetaQuest } from "../../../device/MetaQuestUtils.android";
import { ActionSheetIconHeader } from "../../../../design/components/Sheet/native/ActionSheetIconHeader.native";
import { ActionSheetRow } from "../../../../design/components/Sheet/native/ActionSheetRow.native";
export default function ForumPostLongPressActionSheet(props) {
const { thread, parentChannel: parentChannel2, onClose } = props;
const guildId = thread.getGuildId();
const stateFromStores4 = useStateFromStores([GuildStore], () => GuildStore.getGuild(guildId));
const stateFromStores5 = useStateFromStores([JoinedThreadsStore], () => JoinedThreadsStore.hasJoined(thread.id));
const stateFromStores3 = useStateFromStores([JoinedThreadsStore], () => JoinedThreadsStore.isMuted(thread.id));
const stateFromStores2 = useStateFromStores([LurkingStore], () => guildId != null && LurkingStore.isLurking(guildId));
const firstMessage = useFirstForumPostMessage(thread).firstMessage;
const isThreadModerator2 = useIsThreadModerator(parentChannel2);
const canManageThread2 = useCanManageThread(thread);
const canUnarchiveThread = useCanUnarchiveThread(thread);
const existingPin2 = useExistingPin(thread);
const stateFromStores6 = useStateFromStores([ThreadMessageStore], () => {
let r8 = ThreadMessageStore.getCount(thread.id);
if (r8 == null) {
r8 = 0;
}
return r8;
});
const setting = DeveloperMode.useSetting();
const stateFromStores7 = useStateFromStores([AuthenticationStore], () => AuthenticationStore.getId());
const r89 = firstMessage == null ? void 0 : firstMessage.author.id;
const channelName = useChannelName(thread, true);
const favoritesGuildChannelActions = useFavoritesGuildChannelActions(thread, "ForumPostLongPressActionSheet");
const icon = stateFromStores4 != null ? <GuildIcon guild={stateFromStores4} size={GuildIconSizes.LARGE} /> : <Avatar size={AvatarSizes.LARGE} channel={thread} />;
let c17904_7;
let r114 = stateFromStores7 === r89;
const thread2 = thread;
const stateFromStores = stateFromStores3;
const isThreadModerator = isThreadModerator2;
let c17904_3 = r114;
const canManageThread = canManageThread2;
const existingPin = existingPin2;
const parentChannel = parentChannel2;
const archived = thread.threadMetadata?.archived;
const locked = thread.threadMetadata?.locked;
const r121 = [];
const hasFlag = thread.hasFlag(ChannelFlags.PINNED);
const r128 = buildFavoritesSectionButtons(favoritesGuildChannelActions);
if (r128 != null) {
r121.push({
sectionKey: "favorites",
buttons: [r128]
});
}
r121.push({
sectionKey: "mark-as-read",
buttons: [{
label: intl.string(t.e6RscS),
IconComponent: EyeIcon,
onPress: () => {
ack(thread2.id, {
object: AnalyticsObjects.MARK_FORUM_POST_AS_READ_BUTTON,
objectType: AnalyticsObjectTypes.ACK_MANUAL
}, true, true);
}
}]
});
const r151 = {
sectionKey: "channel-actions",
buttons: []
};
if (!stateFromStores2) {
const buttons = r151.buttons;
const r154 = {
label: null,
IconComponent: null,
onPress: null
};
if (stateFromStores5) {
r154.label = intl.string(t["2LsZdT"]);
r154.IconComponent = UserMinusIcon;
r154.onPress = () => ThreadActionCreators.leaveThread(thread2, "Context Menu");
buttons.push(r154);
} else {
r154.label = intl.string(t.ihLPiO);
r154.IconComponent = BellIcon;
r154.onPress = () => ThreadActionCreators.joinThread(thread2, "Context Menu");
buttons.push(r154);
}
}
if (archived) {
if (canUnarchiveThread) {
r151.buttons.push({
label: intl.string(t.cnRubV),
IconComponent: ClockIcon,
onPress: () => {
ThreadActionCreators.unarchiveThread(thread2, false);
}
});
}
} else if (canManageThread) {
r151.buttons.push({
label: intl.string(t.BTs4Kb),
IconComponent: XLargeIcon,
onPress: () => {
ThreadActionCreators.archiveThread(thread2, false);
}
});
}
if (canManageThread) {
const buttons2 = r151.buttons;
const r211 = {
label: null,
IconComponent: null,
onPress: null
};
if (locked) {
r211.label = intl.string(t["/OKSxp"]);
r211.IconComponent = LockUnlockedIcon;
r211.onPress = () => {
ThreadActionCreators.unlockThread(thread2);
};
buttons2.push(r211);
} else {
r211.label = intl.string(t["Ur/0Na"]);
r211.IconComponent = LockIcon;
r211.onPress = () => {
ThreadActionCreators.lockThread(thread2);
};
buttons2.push(r211);
}
}
const r233 = isThreadModerator ? !isThreadModerator : thread.isLockedThread();
if (r114 ? !r233 : r114) {
r151.buttons.push({
label: intl.string(t.NP1yHG),
IconComponent: PencilIcon,
onPress: () => {
openCreateForumPostModal({
guildId: parentChannel.guild_id,
parentChannelId: parentChannel.id,
threadId: thread2.id,
messageId: SnowflakeUtils.castChannelIdAsMessageId(thread2.id),
isEdit: true,
analyticsLocations: [AnalyticsLocation.FORUM_CHANNEL, AnalyticsLocation.GUILD_CHANNEL],
analyticsLocationObject: {
section: AnalyticsSections.CHANNEL_LIST,
object: AnalyticsObjects.CONTEXT_MENU
}
});
}
});
}
if (canManageThread) {
r151.buttons.push({
label: intl.string(t.SGuVbR),
IconComponent: SettingsIcon,
onPress: () => {
ChannelSettingsActionCreators.setSection(ChannelSettingsSections.OVERVIEW);
ChannelSettingsActionCreators.open(thread2.id);
}
});
if (parentChannel.availableTags.length > 0) {
r151.buttons.push({
label: intl.string(t["436ZFw"]),
IconComponent: TagsIcon,
onPress: () => {
ActionSheetActionCreators.openLazy(import("../../../forums/native/ForumPostTagsActionSheet"), "ForumPostTagsActionSheet", {
thread: thread2,
parentChannel,
canManageThread
});
}
});
}
}
r151.buttons.push({
label: intl.string(t.WqhZss),
IconComponent: LinkIcon,
onPress: () => {
handleCopyLinkForumPost(thread2.guild_id, thread2.id, {
section: AnalyticsSections.CONTEXT_MENU
});
}
});
r121.push(r151);
if (!stateFromStores2) {
const r309 = {
sectionKey: "notifications",
buttons: []
};
const buttons3 = r309.buttons;
const r312 = {
label: null,
IconComponent: null,
onPress: null
};
if (stateFromStores) {
r312.label = intl.string(t["0JQfsP"]);
r312.IconComponent = BellIcon;
r312.onPress = () => ThreadActionCreators.setNotificationSettings(thread2, {
muted: !stateFromStores
});
buttons3.push(r312);
} else {
r312.label = intl.string(t["nP+Ykd"]);
r312.IconComponent = BellSlashIcon;
r312.onPress = () => {
ActionSheetActionCreators.openLazy(import("../../../main_tabs_v2/native/sidebar/details/screens/MuteSettingsActionSheet"), `muteSettings${thread2.id}`, {
guildId: thread2.getGuildId(),
channelId: thread2.id
});
};
buttons3.push(r312);
}
r309.buttons.push({
label: intl.string(t.HcoRu0),
IconComponent: ChannelNotificationIcon,
onPress: () => showThreadNotificationsBottomSheet(thread2),
disableColor: true
});
r121.push(r309);
}
const r354 = {
sectionKey: "admin-actions",
buttons: []
};
if (isThreadModerator) {
const buttons4 = r354.buttons;
const r357 = {
label: null,
IconComponent: null,
onPress: null
};
if (hasFlag) {
r357.label = intl.string(t.trD8ao);
r357.IconComponent = PinIcon;
r357.onPress = () => ThreadActionCreators.unpin(thread2);
buttons4.push(r357);
} else {
r357.label = intl.string(t.EnaWhu);
r357.IconComponent = PinIcon;
r357.onPress = () => {
if (existingPin != null) {
AlertActionCreators.show({
title: intl.string(t.IMbjxo),
body: intl.string(t["mi5+Vl"]),
cancelText: intl.string(t.gm1Vej),
confirmText: intl.string(t.p89ACt),
onConfirm: () => {
ThreadActionCreators.replacePin(existingPin, thread2);
}
});
} else {
ThreadActionCreators.pin(thread2);
}
};
buttons4.push(r357);
}
}
if (!(!isThreadModerator && !r114)) {
if (r114) {
r114 = !isThreadModerator;
}
if (r114) {
r114 = stateFromStores6 > 0;
}
c17904_7 = r114;
r354.buttons.push({
label: r114 ? intl.string(t.xwMqD7) : intl.string(t.nEOg1N),
IconComponent: TrashIcon,
onPress: () => {
let body, title;
const r22 = intl.string(t.nEOg1N);
const r32 = intl.format(t.su3voL, {
postName: `"${thread2.name}"`
});
if (c17904_7) {
title = intl.string(t.xwMqD7);
body = intl.string(t.RUHcyk);
} else {
const r33 = c17904_3 && !isThreadModerator;
body = r32;
title = r22;
if (r33) {
body = intl.format(t["6/pY2+"], {
postName: `"${thread2.name}"`
});
title = r22;
}
}
AlertActionCreators.show({
title,
body,
cancelText: intl.string(t.gm1Vej),
confirmText: intl.string(t.p89ACt),
onConfirm: () => {
if (c17904_7) {
MessageActionCreators.deleteMessage(thread2.id, SnowflakeUtils.castChannelIdAsMessageId(thread2.id));
} else {
ChannelSettingsActionCreators.deleteChannel(thread2.id);
}
},
confirmColor: ButtonColors.RED
});
}
});
}
r121.push(r354);
if (setting) {
r121.push({
sectionKey: "developer-actions",
buttons: [{
label: intl.string(t.DQ797g),
IconComponent: IdIcon,
onPress: () => {
copy(thread2.id);
presentPostIdCopied();
}
}]
});
}
return <ActionSheet showGradient startExpanded={isMetaQuest()} header={<ActionSheetIconHeader title={channelName} icon={icon} />}>
{r121.map((item) => <ActionSheetRow.Group key={item.sectionKey} hasIcons>
{item.buttons.map(({ label, IconComponent, onPress: onPress2, disableColor, isDestructive }, index) => <ActionSheetRow key={index} variant={label === intl.string(t.nEOg1N) || label === intl.string(t.xwMqD7) ? "danger" : isDestructive === true ? "danger" : void 0} icon={<ActionSheetRow.Icon IconComponent={IconComponent} disableColor={disableColor} />} label={label} onPress={() => {
onPress2();
onClose();
}} />)}
</ActionSheetRow.Group>)}
</ActionSheet>;
};
@@ -0,0 +1,57 @@
// Metro module 9877 (f9878).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import { ActivityIndicator, View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { DARK_PRIMARY_300_LIGHT_PRIMARY_400 } from "../../../../design/migrations/native/LegacyTokens";
import useChannelFollowerStats from "../../../channel_following/useChannelFollowerStats";
import { LegacyText } from "../../../../design/void/native";
import { t, intl } from "../../../../intl/index.native";
const useStyles = createStyles({
alertContainer: {
paddingTop: 16
},
alertLoading: {
paddingTop: 62,
paddingBottom: 46
},
alertBodyText: {
marginBottom: 16,
fontSize: 16,
lineHeight: 24,
color: DARK_PRIMARY_300_LIGHT_PRIMARY_400
}
});
export default function PublishModal(props) {
let props2;
const channelId = props.channelId;
const styles = useStyles();
const r23 = _slicedToArray(useChannelFollowerStats(channelId), 2);
const r13 = r23[0];
if (r23[1]) {
return <View style={styles.alertLoading}>
<ActivityIndicator animating />
</View>;
}
const r26 = r13?.guildsFollowing != null && r13?.guildsFollowing > 0;
const r12 = {
style: styles.alertBodyText,
children: null
};
if (r26) {
const GCGrNP = t.GCGrNP;
let numGuildsFollowing = r13?.guildsFollowing;
if (numGuildsFollowing == null) {
numGuildsFollowing = 0;
}
r12.children = intl.format(GCGrNP, {
numGuildsFollowing
});
props2 = r12;
} else {
r12.children = intl.string(t["8FpqOs"]);
props2 = r12;
}
return <View style={styles.alertContainer}>
<LegacyText {...props2} />
</View>;
};
@@ -0,0 +1,9 @@
// Metro module 10364 (f10365).
import ActionSheetActionCreators from "../ActionSheetActionCreators";
export default function showLongPressForumPostActionSheet(a0, a1, onClose = ActionSheetActionCreators.hideActionSheet) {
ActionSheetActionCreators.openLazy(import("./LongPressForumPostActionSheet"), "ForumPostLongPressActionSheet", {
thread: a0,
parentChannel: a1,
onClose
});
};
@@ -0,0 +1,68 @@
// Metro module 8196 (f8197).
import { NativeEventEmitter } from "react-native";
import { isAndroid } from "../../../_bundle/Module501";
import Module8197 from "../../../_bundle/Module8197";
import { trackAppClickInNativeShareSheet, getMediaShareParams } from "./ShowShareActionSheetUtils";
import SentryUtils_native from "../../../utils/SentryUtils.native";
if (isAndroid()) {
new NativeEventEmitter(Module8197).addListener("share-broadcast-receiver-app-clicked", (a0) => {
trackAppClickInNativeShareSheet(a0.app, a0.location);
});
}
export function showShareActionSheet(a0, a1) {
let r9 = a1;
const r16 = a0.source != null ? getMediaShareParams(a0.source) : {
mediaFallbackUrl: void 0,
mediaStagingOptions: void 0
};
let mediaFallbackUrl = r16.mediaFallbackUrl;
let mediaStagingOptions = r16.mediaStagingOptions;
if (a0.source == null) {
mediaFallbackUrl = a0.url;
}
let message = a0.message;
if (message == null) {
message = null;
}
if (mediaFallbackUrl == null) {
mediaFallbackUrl = null;
}
let subject = a0.subject;
if (subject == null) {
subject = null;
}
if (a1 == null) {
r9 = null;
}
if (mediaStagingOptions == null) {
mediaStagingOptions = null;
}
Module8197.share(message, mediaFallbackUrl, subject, r9, mediaStagingOptions).then((result) => {
if (result != null) {
const { success, method } = result;
const iOSOnlyShareCallback = a0.iOSOnlyShareCallback;
if (iOSOnlyShareCallback != null) {
let r7 = method;
if (r7 == null) {
r7 = null;
}
iOSOnlyShareCallback.call(a0, success, r7);
}
trackAppClickInNativeShareSheet(method, a1);
}
}).catch((error) => {
let location2 = a1;
if (location2 == null) {
location2 = "";
}
SentryUtils_native.captureException(error, {
tags: {
location: location2
}
});
const iOSOnlyShareCallback = a0.iOSOnlyShareCallback;
if (iOSOnlyShareCallback != null) {
iOSOnlyShareCallback.call(a0, false, null);
}
});
}
@@ -0,0 +1,3 @@
// Metro module 5548 (f5549).
import * as _showSimpleActionSheet_native from "../../../design/components/Sheet/native/showSimpleActionSheet.native";
export const showSimpleActionSheet = _showSimpleActionSheet_native.showSimpleActionSheet;
@@ -0,0 +1,6 @@
// Metro module 9584 (f9585).
import { ACTION_SHEET_START_HEIGHT_RATIO } from "./ActionSheetConstants";
import useWindowDimensions_native from "../../screen/useWindowDimensions.native";
export default function useActionSheetHeight() {
return useWindowDimensions_native().height * ACTION_SHEET_START_HEIGHT_RATIO;
};
@@ -0,0 +1,51 @@
// Metro module 11254 (f11255).
import { useMemo } from "react";
import AccessibilityStore from "../../a11y/AccessibilityStore";
import { isAndroid } from "../../../utils/PlatformUtils";
import { getSystemKeyboardHeight } from "../../keyboard/native/useSystemKeyboardHeight.native";
import { getKeyboardTypePrevious } from "../../keyboard/native/useKeyboardType";
import { KeyboardTypes } from "../../keyboard/native/KeyboardTypes";
import useWindowDimensions_native from "../../screen/useWindowDimensions.native";
import useKeyboardActionSheetHeight from "./useKeyboardActionSheetHeight";
import useInitialValue from "../../../hooks/useInitialValue";
import { IS_SYSTEM_KEYBOARD_EXTERNAL } from "../../main_tabs_v2/native/channel/useSafeAreaBottomKeyboardInfoController";
export default function useCustomKeyboardBottomSheetConfig(a0) {
let forceMaxHeight = a0.forceMaxHeight;
if (forceMaxHeight === void 0) {
forceMaxHeight = false;
}
let c18684_0 = forceMaxHeight;
let enablePanDownToClose = a0.enablePanDownToClose;
if (enablePanDownToClose === void 0) {
enablePanDownToClose = false;
}
const windowDimensions_native = useWindowDimensions_native({
ignoreKeyboard: true
});
let c18684_1 = windowDimensions_native;
const keyboardActionSheetHeight = useKeyboardActionSheetHeight();
const { minimum, maximum } = keyboardActionSheetHeight;
const initialValue = useInitialValue(() => {
const r6 = {
initialPosition: c18684_1.height - minimum,
animateOnMount: false
};
return isAndroid() ? r6 : AccessibilityStore.useReducedMotion ? r6 : getSystemKeyboardHeight() === 0 ? getKeyboardTypePrevious() === KeyboardTypes.SYSTEM ? {
animateOnMount: true
} : r6 : r6;
});
const { initialPosition, animateOnMount } = initialValue;
const memo = useMemo(() => c18684_0 ? [maximum, maximum] : [minimum, maximum], [forceMaxHeight, maximum, minimum]);
return {
animateOnMount,
enablePanDownToClose,
accessible: !!isAndroid() && void 0,
contentHeight: maximum,
containerHeight: windowDimensions_native.height,
enableDynamicSizing: false,
initialPosition,
keyboardBehavior: "extend",
android_keyboardInputMode: IS_SYSTEM_KEYBOARD_EXTERNAL ? "adjustResize" : void 0,
snapPoints: memo
};
};
@@ -0,0 +1,35 @@
// Metro module 11210 (f11211).
import { NAV_BAR_HEIGHT_MULTILINE } from "../../../design/components/Navigator/native/NavigatorConstants.native";
import useSafeAreaInsets_native, { getSafeAreaInsets } from "../../safe_area/useSafeAreaInsets.native";
import useWindowDimensions_native, { getWindowDimensions } from "../../screen/useWindowDimensions.native";
import useCustomKeyboardHeight, { getCustomKeyboardHeight } from "../../keyboard/native/useCustomKeyboardHeight";
export default function useKeyboardActionSheetHeight() {
const safeAreaInsets_native = useSafeAreaInsets_native();
const windowDimensions_native = useWindowDimensions_native({
ignoreKeyboard: true
});
const customKeyboardHeight = useCustomKeyboardHeight();
let maximum = windowDimensions_native.height - NAV_BAR_HEIGHT_MULTILINE - safeAreaInsets_native.top;
if (customKeyboardHeight >= maximum) {
maximum = customKeyboardHeight;
}
return {
minimum: customKeyboardHeight,
maximum
};
};
export function getKeyboardActionSheetHeight() {
const safeAreaInsets = getSafeAreaInsets();
const windowDimensions = getWindowDimensions({
ignoreKeyboard: true
});
const customKeyboardHeight = getCustomKeyboardHeight();
let maximum = windowDimensions.height - NAV_BAR_HEIGHT_MULTILINE - safeAreaInsets.top;
if (customKeyboardHeight >= maximum) {
maximum = customKeyboardHeight;
}
return {
minimum: customKeyboardHeight,
maximum
};
}
@@ -0,0 +1,6 @@
// Metro module 13015 (f13016).
import { PlatformTypes } from "../../Constants";
import { ConsoleOAuthApplications } from "../../_bundle/Module8974";
export function clientIdToActivateDevicePlatform(a0) {
return a0 === ConsoleOAuthApplications.PLAYSTATION_APPLICATION_ID ? PlatformTypes.PLAYSTATION : a0 === ConsoleOAuthApplications.PLAYSTATION_STAGING_APPLICATION_ID ? PlatformTypes.PLAYSTATION_STAGING : null;
}
@@ -0,0 +1,127 @@
// Metro module 13013 (f13014).
import { useState, useCallback, useEffect } from "react";
import { ActivityIndicator, ImageBackground, ScrollView, View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useActivateDeviceStepTracking } from "../useActivateDeviceStepTracking";
import { useDeviceCodeAuthorizeCallback } from "../useDeviceCodeAuthorizeCallback";
import { openOAuth2Modal } from "../../../utils/native/ApplicationUtils";
import { ConsoleOAuthApplications } from "../../../_bundle/Module8974";
import Module13017 from "../../../_bundle/Module13017";
import { isSocialLayerUmbrellaScope } from "../../oauth2/scopes";
import Module13018 from "../../../_bundle/Module13018";
import FastImage from "../../../components_native/common/FastImage";
import { UserCodeInput } from "./UserCodeInput";
import { ActivateDeviceSuccess } from "./ActivateDeviceSuccess";
import { ActivateDeviceError } from "./ActivateDeviceError";
import { makeSource } from "../../../utils/AvatarUtils";
import Module13025 from "../../../_bundle/Module13025";
import { SafeAreaPaddingView } from "../../../components_native/common/SafeAreaView";
const useStyles = createStyles({
background: {
flex: 1
},
imageStyle: {
marginVertical: 0,
resizeMode: "cover",
backgroundColor: Module712.colors.TEXT_BRAND
},
safeArea: {
flex: 1,
justifyContent: "center",
alignItems: "center"
},
content: {
maxWidth: 480,
backgroundColor: Module712.colors.PANEL_BG,
alignItems: "center",
justifyContent: "center",
borderRadius: Module712.radii.lg,
padding: 24,
marginHorizontal: 24,
marginVertical: 36,
shadowColor: Module712.colors.BLACK,
shadowOpacity: 0.2,
shadowOffset: {
width: 0,
height: 4
},
shadowRadius: 4
},
scroller: {
alignSelf: "stretch",
flexGrow: 0
},
scrollerContent: {
flexDirection: "column",
gap: 16
}
});
export const ActivateDevice = ({ onClose, prefilledUserCode }) => {
let deviceCodeAuthorizeCallback;
deviceCodeAuthorizeCallback = void 0;
const styles = useStyles();
const [state, setState] = useState({
type: "user-code-input",
usePrefilledCode: true
});
const [state2, setState2] = useState(null);
useActivateDeviceStepTracking(state);
const callback = useCallback(() => {
setState({
type: "user-code-input"
});
}, [setState]);
const callback2 = useCallback((a0) => {
setState({
type: "success",
userCodeData: a0
});
}, [setState]);
deviceCodeAuthorizeCallback = useDeviceCodeAuthorizeCallback(callback, useCallback((a0) => {
setState({
type: "error",
userCodeData: a0
});
}, [setState]), callback2);
const callback3 = useCallback((a0) => {
let c27396_0 = a0;
setState({
type: "authorization",
userCodeData: a0
});
openOAuth2Modal({
clientId: a0.clientId,
scopes: a0.scopes,
responseType: "code",
isTrustedName: true,
isEmbeddedFlow: true,
withBackPressHandler: false,
callbackWithoutPost: (a0) => deviceCodeAuthorizeCallback(c27396_0, a0)
});
}, [deviceCodeAuthorizeCallback]);
useEffect(() => {
if ("userCodeData" in state) {
const userCodeData = state.userCodeData;
if ([ConsoleOAuthApplications.PLAYSTATION_APPLICATION_ID, ConsoleOAuthApplications.PLAYSTATION_STAGING_APPLICATION_ID].includes(userCodeData.clientId)) {
setState2(Module13017);
} else if (userCodeData.scopes.some((scope) => isSocialLayerUmbrellaScope(scope))) {
setState2(Module13018);
}
}
}, [state]);
useEffect(() => {
if (state2 != null) {
FastImage.preload(state2);
}
}, [state2]);
const type = state.type;
const r62 = type === "user-code-input" ? <UserCodeInput prefilledUserCode={state.usePrefilledCode ? prefilledUserCode : void 0} onUserCodeAccepted={callback3} onClose={onClose} /> : type === "authorization" ? <ActivityIndicator animating /> : type === "success" ? <ActivateDeviceSuccess onComplete={onClose} data={state.userCodeData} successImage={state2} /> : type === "error" ? <ActivateDeviceError onRetry={callback} /> : null;
return <ImageBackground source={makeSource(Module13025)} imageStyle={styles.imageStyle} style={[styles.background]}>
<SafeAreaPaddingView bottom top style={styles.safeArea}>
<View style={styles.content}>
<ScrollView bounces={false} style={styles.scroller} contentContainerStyle={styles.scrollerContent}>{r62}</ScrollView>
</View>
</SafeAreaPaddingView>
</ImageBackground>;
};
@@ -0,0 +1,30 @@
// Metro module 13024 (f13025).
import { Image as Image2, View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module8981 from "../../../_bundle/Module8981";
import ActivateDeviceSharedStyles from "./ActivateDeviceSharedStyles";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import { Button } from "../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
image: {
width: 254,
height: 127,
alignSelf: "center"
}
});
export function ActivateDeviceError(props) {
const onRetry = props.onRetry;
return <>
<Image2 source={Module8981} style={useStyles().image} />
<View style={ActivateDeviceSharedStyles.innerContent}>
<Text variant="heading-lg/bold" color="mobile-text-heading-primary" style={ActivateDeviceSharedStyles.centerText}>
{intl.string(t["3dgwPD"])}
</Text>
<Text variant="text-md/medium" color="text-default" style={ActivateDeviceSharedStyles.centerText}>
{intl.string(t["/GAO1P"])}
</Text>
</View>
<Button size="lg" text={intl.string(t["5911Lb"])} onPress={onRetry} grow />
</>;
}
@@ -0,0 +1,29 @@
// Metro module 13012 (f13013).
import { useMemo } from "react";
import ActivateDeviceModalActionCreators from "./ActivateDeviceModalActionCreators";
import { HeaderActionButton } from "../../../design/components/Navigator/native/HeaderActionButton.native";
import Module7699 from "../../../_bundle/Module7699";
import { intl, t } from "../../../intl/index.native";
import { ActivateDevice } from "./ActivateDevice";
import { Navigator } from "../../../design/components/Navigator/native/Navigator.native";
let c8978_5 = {
ACTIVATE_DEVICE: "activate-device"
};
export default function ActivateDeviceModal(props) {
const userCode = props.userCode;
return <Navigator screens={useMemo(() => {
const userCode2 = userCode;
const onClose2 = function onClose() {
return ActivateDeviceModalActionCreators.hideModal();
};
const r8 = {};
r8[c8978_5.ACTIVATE_DEVICE] = {
fullscreen: true,
headerTitle: () => null,
headerLeft: () => <HeaderActionButton source={Module7699} onPress={onClose2} accessibilityLabel={intl.string(t.cpT0Cq)} />,
headerRight: () => null,
render: () => <ActivateDevice onClose={onClose2} prefilledUserCode={userCode2} />
};
return r8;
}, [userCode])} initialRouteName={c8978_5.ACTIVATE_DEVICE} headerBackTitle={intl.string(t["13/7kX"])} />;
};
@@ -0,0 +1,14 @@
// Metro module 13011 (f13012).
import ModalActionCreators from "../../../actions/ModalActionCreators";
let c8977_3 = "ACTIVATE_DEVICE_MODAL_KEY";
const r15 = {
showModal: (a0) => {
ModalActionCreators.pushLazy(import("./ActivateDeviceModal"), {
userCode: a0
}, c8977_3);
},
hideModal: () => {
ModalActionCreators.popWithKey(c8977_3);
}
};
export default r15;
@@ -0,0 +1,11 @@
// Metro module 13022 (f13023).
export default {
innerContent: {
flexDirection: "column",
gap: 8,
alignItems: "center"
},
centerText: {
textAlign: "center"
}
};
@@ -0,0 +1,30 @@
// Metro module 13023 (f13024).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { intl, t } from "../../../intl/index.native";
import { isSocialLayerUmbrellaScope } from "../../oauth2/scopes";
import FastImage from "../../../components_native/common/FastImage";
import { makeSource } from "../../../utils/AvatarUtils";
import ActivateDeviceSharedStyles from "./ActivateDeviceSharedStyles";
import { Text } from "../../../design/components/Text/native/Text";
import { Button } from "../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
image: {
width: 300,
height: 200,
alignSelf: "center"
}
});
export function ActivateDeviceSuccess(props) {
const { data, onComplete, successImage } = props;
const styles = useStyles();
const r15 = data.twoWayLinkCode != null ? intl.string(t.QhATl2) : data.scopes.some((scope) => isSocialLayerUmbrellaScope(scope)) ? intl.string(t.vBPvK3) : null;
return <>
{[successImage != null ? <FastImage source={makeSource(successImage)} style={styles.image} resizeMode="contain" /> : null, <View style={ActivateDeviceSharedStyles.innerContent}>
<Text variant="heading-lg/bold" color="mobile-text-heading-primary" style={ActivateDeviceSharedStyles.centerText}>
{intl.string(t.qDtJmD)}
</Text>
{r15 != null ? <Text variant="text-md/medium" color="text-default" style={ActivateDeviceSharedStyles.centerText}>{r15}</Text> : null}
</View>, <Button size="lg" text={intl.string(t.cpT0Cq)} onPress={onComplete} grow />]}
</>;
}
@@ -0,0 +1,41 @@
// Metro module 13019 (f13020).
import { useState } from "react";
import { View } from "react-native";
import { OAuthConstants } from "../../../_bundle/Module13020";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { useUserCodeSubmit } from "../useUserCodeSubmit";
import ActivateDeviceSharedStyles from "./ActivateDeviceSharedStyles";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import { TextInput } from "../../../design/components/TextInput/native/TextInput.native";
import { Button } from "../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
text: {
textAlign: "center"
}
});
export function UserCodeInput(props) {
const { onClose, onUserCodeAccepted } = props;
let prefilledUserCode = props.prefilledUserCode;
const styles = useStyles();
if (prefilledUserCode == null) {
prefilledUserCode = "";
}
const [value, setState] = useState(prefilledUserCode);
const userCodeSubmit = useUserCodeSubmit(value, onUserCodeAccepted, onClose);
const { manualSubmit, error, submitting } = userCodeSubmit;
return <>
<View style={ActivateDeviceSharedStyles.innerContent}>
<Text variant="heading-lg/bold" color="mobile-text-heading-primary" style={styles.text}>
{intl.string(t.KYPNUv)}
</Text>
<Text variant="text-md/medium" color="text-default" style={styles.text}>
{intl.string(t.xRHk7f)}
</Text>
</View>
<TextInput onChange={(event) => setState(event)} maxLength={OAuthConstants.USER_CODE_LENGTH} value={value} autoFocus autoComplete="off" placeholder={intl.formatToPlainString(t["0tbz6x"], {
number: OAuthConstants.USER_CODE_LENGTH
})} errorMessage={error} />
<Button size="lg" text={intl.string(t["3PatSz"])} onPress={manualSubmit} loading={submitting} disabled={value.length !== OAuthConstants.USER_CODE_LENGTH} grow />
</>;
}
@@ -0,0 +1,19 @@
// Metro module 13014 (f13015).
import { useEffect } from "react";
import { AnalyticEvents } from "../../Constants";
import usePrevious from "../../hooks/usePrevious";
import { clientIdToActivateDevicePlatform } from "./ActivateDeviceUtils";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
export function useActivateDeviceStepTracking(a0) {
const previous = usePrevious(a0);
let c20339_1 = previous;
useEffect(() => {
if (a0 !== c20339_1) {
AnalyticsUtils.track(AnalyticEvents.DEVICE_LINK_STEP, {
previous_step: c20339_1?.type,
current_step: a0.type,
platform_type: a0.type !== "user-code-input" && a0.type !== "handoff" ? clientIdToActivateDevicePlatform(a0.userCodeData.clientId) : null
});
}
}, [previous, a0]);
}
@@ -0,0 +1,241 @@
// Metro module 13016 (f13017).
import { useCallback } from "react";
import { clientIdToActivateDevicePlatform } from "./ActivateDeviceUtils";
import ConnectedAccountsActionCreators from "../../actions/ConnectedAccountsActionCreators";
import { TwoWayLinkType } from "../../_bundle/Module8943";
import Module38 from "../../_bundle/Module38";
import { getCallbackParamsFromURL } from "../connections/ConnectionsUtils";
import { finishUserCodeTwoWayLinkError, finishUserCode } from "../oauth2/actions";
let silentlyFinishTwoWayLinkError;
let env8982 = {};
env8982[5] = function _createTwoWayLink() {
const r8 = async (c27397_0, c27397_1, userCode) => {
let code, code2, c27397_7;
let c27397_8 = 0;
let c30604_0, c30604_1, c30604_2, c30604_3, c30604_4, c30604_5;
try {
c30604_0 = c27397_1;
c30604_1 = userCode;
c30604_2 = void 0;
c30604_3 = void 0;
c30604_4 = void 0;
c30604_5 = void 0;
const r61 = clientIdToActivateDevicePlatform(c27397_0);
c30604_2 = r61;
if (r61 == null) {
await silentlyFinishTwoWayLinkError(userCode, 1, "authorize");
throw new Error("Unsupported client_id for two way link");
}
c30604_3 = null;
c27397_8 = 1;
const r40 = await ConnectedAccountsActionCreators.authorize(r61, {
twoWayLinkType: TwoWayLinkType.DEVICE_CODE,
userCode
});
const r98 = "Authorize URL state query parameter must be present";
c30604_3 = r40.body.url;
c30604_4 = null;
c27397_8 = 2;
Module38(c30604_3 != null, "No URL in authorize response");
c30604_5 = getCallbackParamsFromURL(c30604_3).state;
Module38(c30604_5 != null, r98);
c30604_4 = c30604_5;
c27397_8 = 3;
await ConnectedAccountsActionCreators.callback(c30604_2, {
code: c30604_0,
state: c30604_4
});
c27397_8 = 0;
} catch ($e) {
const r54 = $e;
let r7 = r54;
c27397_7 = r54;
let r55 = c27397_8;
if (r55 !== 0) {
while (true) {
if (r55 === 1) {
try {
const r317 = c27397_7;
c27397_8 = 0;
const r320 = c30604_1;
code = r317 == null ? void 0 : r317.body?.code;
if (code == null) {
code = 0;
}
await silentlyFinishTwoWayLinkError(r320, code, "authorize");
throw new Error("error during two way authorize");
} catch (r314) {
r7 = r314;
c27397_7 = r314;
r55 = c27397_8;
if (r55 === 0) {
break;
}
}
} else if (r55 === 2) {
try {
c27397_8 = 0;
await (0, silentlyFinishTwoWayLinkError)(c30604_1, 2, "authorize");
throw new Error("error parsing callback params");
} catch (r268) {
r7 = r268;
c27397_7 = r268;
r55 = c27397_8;
if (r55 === 0) {
break;
}
}
} else {
try {
const r219 = c27397_7;
c27397_8 = 0;
const r222 = c30604_1;
code2 = r219 == null ? void 0 : r219.body?.code;
if (code2 == null) {
code2 = 0;
}
await silentlyFinishTwoWayLinkError(r222, code2, "callback");
throw new Error("error during two way callback");
} catch (r216) {
r7 = r216;
c27397_7 = r216;
r55 = c27397_8;
if (r55 === 0) {
break;
}
}
}
}
}
throw r7;
}
};
env8982[5] = r8;
return r8.apply(this, arguments);
};
silentlyFinishTwoWayLinkError = async function silentlyFinishTwoWayLinkError(c27398_0, c27398_1, c27398_2) {
let c27398_6 = 0;
L10: {
try {
c27398_6 = 1;
await finishUserCodeTwoWayLinkError(c27398_0, c27398_1, c27398_2);
c27398_6 = 0;
} catch ($e) {
let r8 = $e;
if (c27398_6 !== 0) {
while (true) {
try {
c27398_6 = 0;
break L10;
} catch ($e) {
r8 = $e;
if (c27398_6 === 0) {
break;
}
}
}
}
throw r8;
}
}
};
export function useDeviceCodeAuthorizeCallback(a0, a1, a2) {
let env20340 = {
$parent: env8982
};
env20340[0] = a0;
env20340[1] = a1;
env20340[2] = a2;
let c20341_0 = async (c30605_0, c30605_1) => {
let c30605_2, c30605_3, c30605_4;
let c30605_5 = 0;
const r10 = void 0;
const r9 = env8982;
L13: {
try {
let env31674;
c30605_3 = r10;
const r20 = env31674 = {
$parent: r9
};
c30605_2 = r20;
env31674[0] = c30605_0;
if (c30605_1) {
if (c30605_0.twoWayLinkCode == null) {
c30605_5 = 2;
await finishUserCode(c30605_0.userCode, "granted");
(0, c30605_3.$parent[2])(env31674[0]);
c30605_5 = 0;
} else {
c30605_5 = 3;
await (function createTwoWayLink() {
return env8982[5].apply(this, arguments);
})(c30605_0.clientId, c30605_0.twoWayLinkCode, c30605_0.userCode);
(0, c30605_3.$parent[2])(env31674[0]);
c30605_5 = 0;
}
} else {
c30605_5 = 1;
await finishUserCode(c30605_0.userCode, "denied");
c30605_5 = 0;
(0, c30605_3.$parent[0])();
}
} catch ($e) {
const r36 = $e;
let r7 = r36;
c30605_4 = r36;
let r37 = c30605_5;
if (r37 !== 0) {
while (true) {
if (r37 === 1) {
try {
c30605_5 = 0;
(0, c30605_3.$parent[0])();
break L13;
} catch (r167) {
r7 = r167;
c30605_4 = r167;
r37 = c30605_5;
if (r37 === 0) {
break;
}
}
} else if (r37 === 2) {
try {
const r158 = c30605_3;
c30605_5 = 0;
(0, r158.$parent[1])(env31674[0]);
break L13;
} catch (r156) {
r7 = r156;
c30605_4 = r156;
r37 = c30605_5;
if (r37 === 0) {
break;
}
}
} else {
try {
const r147 = c30605_3;
c30605_5 = 0;
(0, r147.$parent[1])(env31674[0]);
break L13;
} catch (r145) {
r7 = r145;
c30605_4 = r145;
r37 = c30605_5;
if (r37 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
};
return useCallback(function() {
return c20341_0.apply(this, arguments);
}, [a0, a1, a2]);
}
@@ -0,0 +1,95 @@
// Metro module 13021 (f13022).
import { useState, useCallback, useEffect } from "react";
import { OAuthConstants } from "../../_bundle/Module13020";
import { intl, t } from "../../intl/index.native";
import { verifyUserCode } from "../oauth2/actions";
function $mk116466($env) {
return function verifyUserCodeStatusToErrorMessage(a0) {
let r17;
L7: {
if (a0 === 429) {
r17 = intl.string(t.BPmZvj);
} else {
if (a0 !== 404 && a0 !== 400) {
r17 = intl.string(t.JNQRU4);
break L7;
}
r17 = intl.string(t.aWa1Pw);
}
}
return r17;
};
}
let env8984 = {};
export function useUserCodeSubmit(a0, a1, a2) {
const [submitting, setState] = useState(false);
const [error, setState2] = useState(null);
const callback = useCallback(async () => {
let c27399_0, c27399_1, c27399_2;
let c27399_3 = 0;
const r15 = void 0;
const r14 = env8984;
L10: {
try {
let env30606;
c27399_1 = r15;
const r30 = env30606 = {
$parent: r14
};
c27399_0 = r30;
env30606[0] = void 0;
c27399_3 = 1;
setState(true);
env30606[0] = await verifyUserCode(a0);
(0, setState)(false);
(0, a1)({
userCode: a0,
clientId: env30606[0].body.client_id,
scopes: env30606[0].body.scopes,
twoWayLinkCode: env30606[0].body.two_way_link_code
});
c27399_3 = 0;
} catch ($e) {
const r28 = $e;
let r7 = r28;
c27399_2 = r28;
if (c27399_3 !== 0) {
while (true) {
try {
const r82 = c27399_2;
c27399_3 = 0;
env30606[1] = r82;
const status = env30606[1]?.status;
setState2($mk116466(env8984)(status));
(0, setState)(false);
if (env30606[1]?.status !== 401) {
break L10;
}
(0, a2)();
break L10;
} catch (r78) {
r7 = r78;
c27399_2 = r78;
if (c27399_3 === 0) {
break;
}
}
}
}
throw r7;
}
}
}, [a0, a1, a2]);
useEffect(() => {
if (a0.length === OAuthConstants.USER_CODE_LENGTH) {
callback();
} else {
setState2(null);
}
}, [a0, callback]);
return {
manualSubmit: callback,
error,
submitting
};
}
@@ -0,0 +1,76 @@
// Metro module 15056 (f15057).
import { Endpoints } from "../../Constants";
import Dispatcher from "../../Dispatcher";
import { HTTP } from "../../_bundle/sendRequest";
import APIError from "../../errors/APIError";
export async function fetchActiveChannels(c27938_0, c27938_1) {
let r109;
let channels, c27938_5;
let c27938_6 = 0;
let c30835_1, c30835_0, c30835_2, c30835_3, c30835_4;
try {
c30835_1 = void 0;
c30835_0 = c27938_0;
if (c27938_1 !== void 0) {
c30835_1 = c27938_1;
c30835_2 = void 0;
c30835_3 = void 0;
} else {
c30835_1 = 10;
c30835_2 = void 0;
c30835_3 = void 0;
}
await void 0;
Dispatcher.dispatch({
type: "ACTIVE_CHANNELS_FETCH_START",
guildId: c30835_0
});
c27938_6 = 1;
c30835_2 = await HTTP.get({
url: Endpoints.ACTIVE_CHANNELS(c30835_0),
query: {
channel_limit: c30835_1
},
rejectWithError: true
});
channels = c30835_2.body?.channels;
if (channels == null) {
channels = [];
}
c30835_3 = channels;
Dispatcher.dispatch({
type: "ACTIVE_CHANNELS_FETCH_SUCCESS",
guildId: c30835_0,
channels: c30835_3
});
r109 = c30835_2;
c27938_6 = 0;
} catch ($e) {
const r31 = $e;
let r8 = r31;
c27938_5 = r31;
if (c27938_6 !== 0) {
while (true) {
try {
const r119 = c27938_5;
c27938_6 = 0;
c30835_4 = r119;
Dispatcher.dispatch({
type: "ACTIVE_CHANNELS_FETCH_FAILURE",
guildId: c30835_0,
error: new APIError(c30835_4)
});
throw c30835_4;
} catch (r115) {
r8 = r115;
c27938_5 = r115;
if (c27938_6 === 0) {
break;
}
}
}
}
throw r8;
}
return r109;
}
@@ -0,0 +1,32 @@
// Metro module 8014 (f8015).
import ChannelStore from "../../stores/ChannelStore";
import PermissionStore from "../../stores/PermissionStore";
import { Permissions } from "../../_bundle/Module505";
import { ChannelTypes } from "../../_bundle/Module692";
import { useStateFromStores } from "../../_bundle/Module589";
const isActivityInTextSupportedForChannel = function isActivityInTextSupportedForChannel(a0) {
if (a0 == null) {
return false;
}
const channel = ChannelStore.getChannel(a0.parent_id);
return (channel == null || channel?.type === ChannelTypes.GUILD_CATEGORY) && [ChannelTypes.GUILD_TEXT, ChannelTypes.GUILD_VOICE, ChannelTypes.GROUP_DM, ChannelTypes.DM].includes(a0.type);
};
export { isActivityInTextSupportedForChannel };
export function isActivitiesInTextEnabled(a0) {
return a0 == null ? false : a0 !== void 0 ? isActivityInTextSupportedForChannel(a0) ? a0.guild_id != null ? PermissionStore.can(Permissions.USE_EMBEDDED_ACTIVITIES, a0) ? true : false : true : false : false;
}
export function useIsActivitiesInTextEnabled(c16166_0) {
return useStateFromStores([ChannelStore, PermissionStore], () => {
const channel = ChannelStore.getChannel(c16166_0);
return channel == null ? false : channel !== void 0 ? isActivityInTextSupportedForChannel(channel) ? channel.guild_id != null ? PermissionStore.can(Permissions.USE_EMBEDDED_ACTIVITIES, channel) ? true : false : true : false : false;
});
}
export function getIsAppLauncherEnabled(a0) {
return a0?.guild_id != null || isActivityInTextSupportedForChannel(a0);
}
export function useIsAppLauncherEnabled(c16167_0) {
return useStateFromStores([ChannelStore], () => {
const channel = ChannelStore.getChannel(c16167_0);
return channel != null && (channel?.guild_id != null || isActivityInTextSupportedForChannel(channel));
});
}
@@ -0,0 +1,7 @@
// Metro module 10607 (f10608).
export function shouldOpenActivityInPopoutWindow() {
return false;
}
export function wrapPreemptiveActivityPopout(a0, a1) {
return a1();
}
+36
View File
@@ -0,0 +1,36 @@
// Metro module 10613 (f10614).
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
import { HermesBuiltin } from "../../_hermes/prelude";
let c7119_0 = {
usageByApplicationId: {},
shelfOrder: []
};
class ActivityShelfStore extends Module589.PersistedStore {
static displayName = "ActivityShelfStore";
static persistKey = "ActivityShelfStore";
initialize(a0) {
let r3 = a0;
const r2 = {
usageByApplicationId: {},
shelfOrder: []
};
if (a0 == null) {
r3 = {};
}
HermesBuiltin.copyDataProperties(r2, r3);
c7119_0 = r2;
}
getState() {
return c7119_0;
}
}
const activityShelfStore = new ActivityShelfStore(Dispatcher, {
LOGOUT: function reset() {
c7119_0 = {
usageByApplicationId: {},
shelfOrder: []
};
}
});
export default activityShelfStore;
+168
View File
@@ -0,0 +1,168 @@
// Metro module 4214 (f4215).
import { ChannelTypes } from "../../Constants";
import { EmbeddedActivityLabelTypes, EmbeddedActivitySupportedPlatforms } from "../../flow/Server";
const r20 = ["1037680572660727838", "235088799074484224", "1007373802981822582", "1067803140071620628", "1194351737264406548", "1245041113882955918", "1245040907732910201", "1245040436427489471", "1208090049871351890", "1235205910863806484", "1227719606223765687"];
const r19 = ["1247266306231898122", "1257458870390099989", "1276239071764680926"];
const r18 = {
ADS: "ADS",
FAILED_LOAD: "FAILED_LOAD",
LAGGING: "LAGGING",
CONFUSING: "CONFUSING",
NOT_FUN: "NOT_FUN",
OTHER: "OTHER"
};
const r17 = {
PLAY: 0,
0: "PLAY",
SPECTATE: 1,
1: "SPECTATE"
};
const r16 = {
DESKTOP: "desktop",
MOBILE: "mobile"
};
const r15 = {
BETRAYAL_MARKETING_TOOLTIP: "BETRAYAL_MARKETING_TOOLTIP",
FISHINGTON_MARKETING_TOOLTIP: "FISHINGTON_MARKETING_TOOLTIP",
POKER_MARKETING_TOOLTIP: "POKER_MARKETING_TOOLTIP",
YOUTUBE_MARKETING_TOOLTIP: "YOUTUBE_MARKETING_TOOLTIP"
};
const r14 = {
UNLOCKED: 1,
1: "UNLOCKED",
PORTRAIT: 2,
2: "PORTRAIT",
LANDSCAPE: 3,
3: "LANDSCAPE"
};
const set = new Set(["755600276941176913", "880218832743055411", "1050941315912835122", "880218394199220334"]);
const r11 = {
PORTRAIT: 0,
0: "PORTRAIT",
LANDSCAPE: 1,
1: "LANDSCAPE"
};
const r69 = {
FOCUSED: 0,
0: "FOCUSED",
PIP: 1,
1: "PIP",
GRID: 2,
2: "GRID"
};
const r41 = {
label_type: EmbeddedActivityLabelTypes.NONE,
release_phase: "",
label_from: null,
label_until: null,
omit_badge_from_surfaces: []
};
const client_platform_config = {};
client_platform_config[EmbeddedActivitySupportedPlatforms.WEB] = r41;
client_platform_config[EmbeddedActivitySupportedPlatforms.IOS] = r41;
client_platform_config[EmbeddedActivitySupportedPlatforms.ANDROID] = r41;
const r79 = {
application_id: "",
requires_age_gate: false,
legacy_responsive_aspect_ratio: false,
default_orientation_lock_state: r14.UNLOCKED,
tablet_default_orientation_lock_state: r14.UNLOCKED,
supported_platforms: [EmbeddedActivitySupportedPlatforms.WEB],
client_platform_config,
has_csp_exception: false,
displays_advertisements: false,
blocked_locales: [],
supported_locales: []
};
const r102 = [ChannelTypes.GUILD_TEXT, ChannelTypes.DM, ChannelTypes.GROUP_DM];
const r105 = [...r102, ChannelTypes.GUILD_VOICE];
const r109 = {
NORMAL: "normal",
FULL_SCREEN: "full-screen"
};
export const ACTIVITY_INVITE_COVER_IMAGE_SIZE = 160;
export const validStreamURL = /^https?:\/\/(?:www\.)?(twitch\.tv\/(.+)|youtube.com\/watch\?v=)/;
export const XBOX_ACTIVITY_APPLICATION_ID = "438122941302046720";
export const META_PRESENCE_APPLICATION_ID = "1417273808645259344";
export const END_GAME_APPLICATION_ID = "773336526917861400";
export const FISHINGTON_APPLICATION_ID = "814288819477020702";
export const YOUTUBE_APPLICATION_ID = "755600276941176913";
export const WATCH_YOUTUBE_DEV_APP_ID = "880218832743055411";
export const WATCH_YOUTUBE_QA_APP_ID = "1050941315912835122";
export const PUTT_PARTY_DEV_APP_ID = "910224161476083792";
export const PUTT_PARTY_QA_APP_ID = "945748195256979606";
export const JAM_SPACE_APPLICATION_ID = "1070087967294631976";
export const GARTIC_PHONE_APPLICATION_ID = "1007373802981822582";
export const GARTIC_PHONE_DEV_APPLICATION_ID = "1067803140071620628";
export const COLOR_TOGETHER_APPLICATION_ID = "1039835161136746497";
export const SPELL_CAST_APPLICATION_ID = "852509694341283871";
export const LAND_IO_APPLICATION_ID = "903769130790969345";
export const WATCH_YOUTUBE_PROD_APP_ID = "880218394199220334";
export const KWIM_APPLICATION_ID = "1078728822972764312";
export const BOBBLE_LEAGUE_APPLICATION_ID = "947957217959759964";
export const CHECKERS_IN_THE_PARK_APP_ID = "832013003968348200";
export const CHESS_IN_THE_PARK_APP_ID = "832012774040141894";
export const BLAZIN_8S_APPLICATION_ID = "832025144389533716";
export const POKER_NIGHT_APPLICATION_ID = "755827207812677713";
export const LETTER_LEAGUE_APPLICATION_ID = "879863686565621790";
export const SKETCH_HEADS_APPLICATION_ID = "902271654783242291";
export const CHEF_SHOWDOWN_APPLICATION_ID = "1037680572660727838";
export const PUTT_PARTY_PROD_APPLICATION_ID = "945737671223947305";
export const KRUNKER_STAGING_APPLICATION_ID = "1010174316991762534";
export const KRUNKER_STRIKE_APPLICATION_ID = "1011683823555199066";
export const COLONIST_APPLICATION_ID = "1106787098452832296";
export const AM_HARMONY_STG_APPLICATION_ID = "1234546995360694434";
export const AM_HARMONY_PRD_APPLICATION_ID = "1214629548377768066";
export const RYTHM_APPLICATION_ID = "235088799074484224";
export const PAPERY_MATCH_APPLICATION_ID = "1235205910863806484";
export const EXORACER_APPLICATION_ID = "1220052815590723654";
export const CLASH_GEM_CARD_PARTY_APPLICATION_ID = "1222080278672179220";
export const MAGIC_CIRCLE_APPLICATION_ID = "1227719606223765687";
export const DEATH_BY_AI_APPLICATION_ID = "1194351737264406548";
export const TINY_ROYALE_APP_1 = "1245041113882955918";
export const TINY_ROYALE_APP_2 = "1245040907732910201";
export const TINY_ROYALE_APP_3 = "1245040436427489471";
export const TINY_ROYALE_APP_4 = "1208090049871351890";
export const TWELVE_BULLETS_DEV = "1247266306231898122";
export const TWELVE_BULLETS_STG = "1257458870390099989";
export const TWELVE_BULLETS_PRD = "1276239071764680926";
export const EMBEDDED_ACTIVITY_SURVEY_URL = "https://discord.sjc1.qualtrics.com/jfe/form/SV_6SvWAOxlcSRWiEu";
export const EMBEDDED_ACTIVITIES_BLOG_POST_URL = "https://discord.com/blog/server-activities-games-voice-watch-together";
export const ImageSizes = {
SMALL: 64,
LARGE: 160
};
export const STAFF_RELEASE_PHASES = ["in_development", "activities_team", "employee_release"];
export { r20 as EXCLUDE_FULL_SCREEN_APPS };
export { r19 as SHARE_INTERACTION_APPS };
export { r18 as ActivityFeedbackReasons };
export { r17 as ActivityIntent };
export { r16 as ActivityPlatform };
export { r15 as ActivityTooltipName };
export { r14 as OrientationLockState };
export { set as APPLICATIONS_WITH_ALLOWED_POPUPS };
export { r11 as ActivityScreenOrientation };
export { r69 as ActivityLayoutMode };
export { r79 as DEFAULT_EMBEDDED_ACTIVITY_CONFIG };
export { r102 as SUPPORTED_ACTIVITY_IN_TEXT_CHANNEL_TYPES };
export { r105 as SUPPORTED_ACTIVITIES_CHANNEL_TYPES };
export function getAppIntentScheme(a0) {
if (a0 === "tiktok") {
return "tiktok://";
}
if (a0 === "photos") {
return "photos-redirect://";
}
if (a0 === "snapchat") {
return "snapchat://";
}
if (a0 === "instagram") {
return "instagram://";
}
}
export const PRIVATE_APPS_HELP_ARTICLE = "https://support-dev.discord.com/hc/en-us/articles/21692628851351-Private-Activity-Safety";
export const DISALLOWED_NAVIGATION_ERROR_CLOSE_ACTIVITY = "disallowed_navigation_error_close_activity";
export const ACTIVITY_PORTRAIT_ASPECT_RATIO = 0.5625;
export const ACTIVITY_LANDSCAPE_ASPECT_RATIO = 1.7777777777777777;
export { r109 as ActivityPopoutWindowLayouts };
export const INVITE_EXPIRATION_MS = 21600000;
@@ -0,0 +1,18 @@
// Metro module 10514 (f10515).
import { createApexExperiment } from "../experiments/apex/index";
const apexExperiment = createApexExperiment({
kind: "user",
name: "2026-06-content-classification-embedded-activity-filter",
defaultConfig: {
enabled: false
},
variations: {
0: {
enabled: false
},
1: {
enabled: true
}
}
});
export { apexExperiment as ContentClassificationEmbeddedActivityFilterExperiment };
@@ -0,0 +1,26 @@
// Metro module 10645 (f10646).
import Dispatcher from "../../Dispatcher";
export function toggleUseActivityUrlOverride() {
Dispatcher.dispatch({
type: "DEVELOPER_ACTIVITY_SHELF_TOGGLE_USE_ACTIVITY_URL_OVERRIDE"
});
}
export function setActivityUrlOverride(a0) {
Dispatcher.dispatch({
type: "DEVELOPER_ACTIVITY_SHELF_SET_ACTIVITY_URL_OVERRIDE",
activityUrlOverride: a0
});
}
export function markActivityUsed(a0) {
Dispatcher.dispatch({
type: "DEVELOPER_ACTIVITY_SHELF_MARK_ACTIVITY_USED",
applicationId: a0,
timestamp: new Date().getTime()
});
}
export function updateFilter(a0) {
Dispatcher.dispatch({
type: "DEVELOPER_ACTIVITY_SHELF_UPDATE_FILTER",
filter: a0
});
}
@@ -0,0 +1,113 @@
// Metro module 5691 (f5692).
import { ApplicationFlags } from "../../Constants";
import { hasApplicationFlag } from "../applications/utils/ApplicationFlagUtils";
import Module589 from "../../_bundle/Module589";
import { DeveloperMode } from "../user_settings/UserSettings";
import Dispatcher from "../../Dispatcher";
import { HermesBuiltin } from "../../_hermes/prelude";
let c3525_3 = {
lastUsedObject: {},
useActivityUrlOverride: false,
activityUrlOverride: null,
filter: ""
};
let c3525_4 = {
INITIALIZED: "INITIALIZED",
LOADING: "LOADING",
LOADED: "LOADED",
ERROR: "ERROR"
};
let INITIALIZED = c3525_4.INITIALIZED;
let c3525_6 = [];
class DeveloperActivityShelfStore extends Module589.PersistedStore {
static displayName = "DeveloperActivityShelfStore";
static persistKey = "DeveloperActivityShelfStore";
static migrations = [(a0) => {
delete a0["isEnabled"];
return {
...a0
};
}];
initialize(a0) {
let r3 = a0;
const r2 = {
lastUsedObject: {},
useActivityUrlOverride: false,
activityUrlOverride: null,
filter: ""
};
if (a0 == null) {
r3 = {};
}
HermesBuiltin.copyDataProperties(r2, r3);
c3525_3 = r2;
}
getState() {
return c3525_3;
}
getIsEnabled() {
return DeveloperMode.getSetting() && c3525_6.length > 0;
}
getLastUsedObject() {
return c3525_3.lastUsedObject;
}
getUseActivityUrlOverride() {
return this.getIsEnabled() && c3525_3.useActivityUrlOverride;
}
getActivityUrlOverride() {
return this.getIsEnabled() ? c3525_3.activityUrlOverride : null;
}
getFetchState() {
return INITIALIZED;
}
getFilter() {
return this.getIsEnabled() ? c3525_3.filter : "";
}
getDeveloperShelfItems() {
return this.getIsEnabled() ? c3525_6 : [];
}
inDevModeForApplication(c15001_0) {
return this.getIsEnabled() && c3525_6.find((item) => item.id === c15001_0) != null;
}
}
const developerActivityShelfStore = new DeveloperActivityShelfStore(Dispatcher, {
LOGOUT: function reset() {
c3525_3 = {
lastUsedObject: {},
useActivityUrlOverride: false,
activityUrlOverride: null,
filter: ""
};
INITIALIZED = c3525_4.INITIALIZED;
c3525_6 = [];
},
DEVELOPER_ACTIVITY_SHELF_TOGGLE_USE_ACTIVITY_URL_OVERRIDE: function handleToggleUseActivityUrlOverride() {
c3525_3.useActivityUrlOverride = !c3525_3.useActivityUrlOverride;
},
DEVELOPER_ACTIVITY_SHELF_SET_ACTIVITY_URL_OVERRIDE: function handleSetActivityUrlOverride(a0) {
c3525_3.activityUrlOverride = a0.activityUrlOverride;
},
DEVELOPER_ACTIVITY_SHELF_MARK_ACTIVITY_USED: function handleMarkActivityUsed({ applicationId, timestamp }) {
if (c3525_6.find((item) => item.id === applicationId) == null) {
return false;
}
c3525_3.lastUsedObject[applicationId] = timestamp;
},
DEVELOPER_ACTIVITY_SHELF_FETCH_START: () => {
INITIALIZED = c3525_4.LOADING;
},
DEVELOPER_ACTIVITY_SHELF_FETCH_SUCCESS: function handleEmbeddedActivitiesFetchDeveloperApplicationsSuccess({ applications }) {
INITIALIZED = c3525_4.LOADED;
c3525_6 = applications.filter((application) => hasApplicationFlag(application, ApplicationFlags.EMBEDDED));
},
DEVELOPER_ACTIVITY_SHELF_FETCH_FAIL: function handleEmbeddedActivitiesFetchDeveloperApplicationsFail(a0) {
a0.type;
INITIALIZED = c3525_4.ERROR;
},
DEVELOPER_ACTIVITY_SHELF_UPDATE_FILTER: function handleUpdateFilter(a0) {
c3525_3.filter = a0.filter;
},
USER_SETTINGS_PROTO_UPDATE: () => {}
});
export default developerActivityShelfStore;
export { c3525_4 as DevShelfFetchState };
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,823 @@
// Metro module 10612 (f10613).
import ChannelRTCStore from "../calls/ChannelRTCStore";
import { GUILD_VOCAL_CHANNEL_TYPES } from "../../records/ChannelRecord";
import AuthenticationStore from "../../stores/AuthenticationStore";
import ChannelStore from "../../stores/ChannelStore";
import RTCConnectionStore from "../../stores/RTCConnectionStore";
import SelectedChannelStore from "../../stores/SelectedChannelStore";
import UserStore from "../../stores/UserStore";
import ActivityShelfStore from "./ActivityShelfStore";
import EmbeddedActivitiesStore from "./EmbeddedActivitiesStore";
import { Endpoints, AnalyticEvents, RPCCloseCodes, RTCConnectionStates, ComponentActions } from "../../Constants";
import getPlatform from "./utils/getPlatform";
import { getOS } from "../../utils/PlatformUtils";
import { HTTP } from "../../_bundle/sendRequest";
import { getEmbeddedActivityLocationChannelId, getEmbeddedActivityLocationGuildId } from "./utils/embeddedActivityLocationUtils";
import getShelfItemData from "./getShelfItemData";
import ThermalUtils_native from "../device/ThermalUtils.native";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import { leaveCurrentFrame } from "./utils/leaveCurrentFrame";
import { tryLaunchAsFrame } from "./utils/tryLaunchAsFrame";
import { stashPendingFrameLaunch, consumePendingFrameLaunch } from "./utils/pendingFrameLaunch";
import ChannelRTCActionCreators from "../../actions/ChannelRTCActionCreators";
import { v4 } from "../../_bundle/Module514";
import { isNullOrEmpty } from "../../utils/StringUtils";
import { computeCommandContextType } from "../application_commands/CommandPermissionContext";
import LifecycleManager from "../../lib/LifecycleManager";
import { ComponentDispatch } from "../../utils/ComponentDispatchUtils";
import Dispatcher from "../../Dispatcher";
import isVoiceEmbeddedActivity from "./utils/isVoiceEmbeddedActivity";
import { isUsingDevShelfActivityUrlOverride } from "./getURLForApplication";
import { getActivityLaunchErrorInfo } from "./utils/activityLaunchErrorUtils";
import ApplicationActionCreators from "../applications/ApplicationActionCreators";
import { getIsActivitiesEnabledForCurrentPlatform } from "./useIsActivitiesEnabledForCurrentPlatform";
import { intl, t } from "../../intl/index.native";
import isActivitySupportedOnClientPlatform from "./utils/isActivitySupportedOnClientPlatform";
import { fetchShelf } from "./EmbeddedActivitiesActionCreators";
import { maybeJoinEmbeddedActivity } from "./handlePressJoinActivity";
import handleUsePrimaryEntryPointAppCommand from "./handleUsePrimaryEntryPointAppCommand";
import { InteractionTypes } from "../../flow/Server";
import AnalyticsLocation from "../app_analytics/AnalyticsLocation";
function $mk85134($env) {
return () => {
const r2 = $env;
const r5 = r2[0];
const r7 = r2[1];
const r4 = $env.$parent[19];
const r3 = r4[r5];
const r1 = r3 != null;
let r9 = void 0;
if (r1) {
const nonce = r3.nonce;
r9 = void 0;
if (nonce === r7) {
delete r4[r5];
r9 = r3;
}
}
return r9;
};
}
function $mk118170($env) {
return (a0) => a0.applicationId === $env[1];
}
let clearAwaitingAnalyticsContextImmediate, handleActivityLaunchStart, handleActivityClose, handleOpenEmbeddedActivity, c7118_18, c7118_19, c7118_20, c7118_27, c7118_28;
let env7118 = {};
const getShelfItemTrackingProperties = function getShelfItemTrackingProperties(a0) {
const r2 = a0 == null;
let releasePhase = void 0;
if (!r2) {
const activity = a0.activity;
releasePhase = activity == null ? void 0 : activity.client_platform_config[getPlatform(getOS())].release_phase;
}
return {
releasePhase
};
};
clearAwaitingAnalyticsContextImmediate = function clearAwaitingAnalyticsContextImmediate(a0, a1) {
const r6 = c7118_19[a0];
if (r6 != null && r6.nonce === a1) {
delete c7118_19[a0];
return r6;
}
};
handleActivityLaunchStart = function handleActivityLaunchStart(a0) {
const { applicationId: applicationId2, nonce, analyticsLocations } = a0;
let source = a0.source;
if (source == null) {
source = void 0;
}
if (analyticsLocations != null || source != null) {
c7118_19[applicationId2] = {
nonce,
locations: analyticsLocations,
source
};
}
};
handleActivityClose = async function handleActivityClose(c26713_0) {
let c30241_10, c30241_11, c30241_12, c30241_13;
let c30241_0 = c26713_0.applicationId;
let c30241_1 = c26713_0.location;
let c30241_2 = c26713_0.instanceId;
c30241_10 = void 0;
c30241_11 = void 0;
c30241_12 = void 0;
c30241_13 = void 0;
await void 0;
let c30241_3 = EmbeddedActivitiesStore.getEmbeddedActivityDurationMs(c30241_1.id, c30241_0);
let c30241_4 = AuthenticationStore.getSessionId();
if (c30241_2 != null && c30241_4 != null) {
await HTTP.post({
url: Endpoints.ACTIVITY_LEAVE(c30241_0, c30241_1.id, c30241_2),
body: {
session_id: c30241_4
},
retries: 2,
rejectWithError: false
});
}
let c30241_5 = c7118_18[c30241_0];
let c30241_6 = getEmbeddedActivityLocationChannelId(c30241_1);
let c30241_7 = getEmbeddedActivityLocationGuildId(c30241_1);
let c30241_8 = ChannelStore.getChannel(c30241_6);
let c30241_9 = UserStore.getCurrentUser();
if (c30241_5 != null && c30241_9 != null && c30241_5.connectedSince == null) {
c30241_10 = EmbeddedActivitiesStore.getShelfActivities(c30241_7);
c30241_11 = getShelfItemData({
applicationId: c30241_0,
activityConfigs: c30241_10
});
c30241_12 = (0, getShelfItemTrackingProperties)(c30241_11).releasePhase;
c30241_13 = ThermalUtils_native.getRawThermalState();
const ACTIVITY_SESSION_LEFT = AnalyticEvents.ACTIVITY_SESSION_LEFT;
const r160 = c30241_11;
AnalyticsUtils.track(ACTIVITY_SESSION_LEFT, {
channel_id: c30241_6,
guild_id: c30241_7,
media_session_id: c30241_5.mediaSessionIds[0],
activity_session_id: c30241_5.activitySessionId,
application_id: c30241_0,
duration_ms: c30241_3,
user_premium_tier: c30241_9.premiumType,
raw_thermal_state: c30241_13,
release_phase: c30241_12,
shelf_rank: r160 == null ? void 0 : r160.activity?.shelf_rank,
activity_user_session_id: c30241_5.activityUserSessionId,
channel_type: c30241_8?.type,
media_session_ids: c30241_5.mediaSessionIds,
embedded_activity_location_kind: c30241_1.kind
});
AnalyticsUtils.track(AnalyticEvents.ACTIVITY_IFRAME_UNMOUNT, {
channel_id: c30241_6,
guild_id: c30241_7,
application_id: c30241_0,
instance_ids: c30241_5.launchId != null ? [c30241_5.launchId] : void 0,
media_session_ids: c30241_5.mediaSessionIds,
activity_user_session_id: c30241_5.activityUserSessionId,
raw_thermal_state: c30241_13,
duration_ms: c30241_3,
embedded_activity_location_kind: c30241_1.kind
});
delete c7118_18[c30241_0];
}
};
handleOpenEmbeddedActivity = function handleOpenEmbeddedActivity({ applicationId, isFirstActivityInChannel, isStart, participants, embeddedActivity, location: location2, inviterUserId }) {
let id;
leaveCurrentFrame();
if (tryLaunchAsFrame({
applicationId
})) {
stashPendingFrameLaunch(applicationId, {
isStart,
inviterUserId,
channelId: getEmbeddedActivityLocationChannelId(location2),
guildId: getEmbeddedActivityLocationGuildId(location2),
locationKind: location2.kind,
launchId: embeddedActivity.launchId,
compositeInstanceId: embeddedActivity.compositeInstanceId,
activitiesInfraVersion: "location" in embeddedActivity ? 2 : 1
});
} else {
id = AuthenticationStore.getId();
const r46 = participants.find((participant) => participant.userId === id);
const embeddedActivityLocationChannelId = getEmbeddedActivityLocationChannelId(location2);
const embeddedActivityLocationGuildId = getEmbeddedActivityLocationGuildId(location2);
const channel = ChannelStore.getChannel(embeddedActivityLocationChannelId);
if (isStart && channel != null && channel.isPrivate() && isFirstActivityInChannel && r46 == null) {
ChannelRTCActionCreators.selectParticipant(channel.id, null);
}
if (r46 != null) {
const mediaSessionId = RTCConnectionStore.getMediaSessionId();
const compositeInstanceId = embeddedActivity.compositeInstanceId;
const r69 = mediaSessionId == null && (channel == null ? void 0 : channel.isVocal()) === true && (channel == null ? void 0 : channel.isPrivate()) === false;
if (compositeInstanceId != null && !r69) {
const activityUserSessionId = v4();
const activitiesInfraVersion = "location" in embeddedActivity ? 2 : 1;
const currentUser = UserStore.getCurrentUser();
if (currentUser != null) {
const shelfActivities = EmbeddedActivitiesStore.getShelfActivities(embeddedActivityLocationGuildId);
const shelfOrder = ActivityShelfStore.getState().shelfOrder;
const shelfItemData = getShelfItemData({
applicationId,
activityConfigs: shelfActivities
});
const r96 = 1 + shelfOrder.findIndex((item) => item === applicationId);
const r97 = shelfItemData == null;
let release_phase = void 0;
if (!r97) {
const activity = shelfItemData.activity;
release_phase = activity == null ? void 0 : activity.client_platform_config[getPlatform(getOS())].release_phase;
}
const rawThermalState = ThermalUtils_native.getRawThermalState();
const mediaSessionIds = mediaSessionId != null ? [mediaSessionId] : [];
c7118_18[applicationId] = {
activitySessionId: compositeInstanceId,
activityUserSessionId,
launchId: embeddedActivity.launchId,
mediaSessionIds,
activitiesInfraVersion
};
let r118 = c7118_19[applicationId];
if (!(isNullOrEmpty(r46.nonce) || r46.nonce === r118?.nonce)) {
r118 = void 0;
}
const ACTIVITY_SESSION_JOINED = AnalyticEvents.ACTIVITY_SESSION_JOINED;
const locations = r118?.locations;
const n_participants = channel != null ? ChannelRTCStore.getUserParticipantCount(channel.id) : null;
const shelf_rank = shelfItemData == null ? void 0 : shelfItemData.activity?.shelf_rank;
const r144 = r96 > 0;
AnalyticsUtils.track(ACTIVITY_SESSION_JOINED, {
channel_id: embeddedActivityLocationChannelId,
guild_id: embeddedActivityLocationGuildId,
media_session_id: mediaSessionIds[0],
activity_session_id: compositeInstanceId,
application_id: applicationId,
location_stack: locations,
user_premium_tier: currentUser.premiumType,
raw_thermal_state: rawThermalState,
n_participants,
is_activity_start: isStart,
release_phase,
shelf_rank,
shelf_sorted_rank: r144 ? r96 : null,
activity_user_session_id: activityUserSessionId,
channel_type: channel?.type,
source: r118?.source,
command_context_type: channel != null ? computeCommandContextType(channel, applicationId) : null,
invite_inviter_id: inviterUserId,
interaction_id: r118?.interactionId,
embedded_activity_location_kind: location2.kind
});
const ACTIVITY_IFRAME_MOUNT = AnalyticEvents.ACTIVITY_IFRAME_MOUNT;
AnalyticsUtils.track(ACTIVITY_IFRAME_MOUNT, {
location_stack: r118?.locations,
channel_id: embeddedActivityLocationChannelId,
channel_type: channel?.type,
guild_id: embeddedActivityLocationGuildId,
application_id: applicationId,
instance_id: embeddedActivity.launchId,
initial_media_session_id: mediaSessionIds[0],
activity_user_session_id: activityUserSessionId,
raw_thermal_state: rawThermalState,
is_activity_start: isStart,
shelf_rank: shelfItemData == null ? void 0 : shelfItemData.activity?.shelf_rank,
shelf_sorted_rank: r144 ? r96 : null,
activities_infra_version: activitiesInfraVersion,
embedded_activity_location_kind: location2.kind
});
}
}
}
}
};
c7118_18 = {};
c7118_19 = {};
c7118_20 = {};
c7118_27 = void 0;
class EmbeddedActivitiesManager extends LifecycleManager {
constructor() {
let c18149_0, c18149_1;
let c18150_0, c18150_1;
super(...arguments);
const _this = this;
this.handleSelectedChannelUpdate = () => {
let r25 = SelectedChannelStore.getVoiceChannelId();
for (const item of EmbeddedActivitiesStore.getSelfEmbeddedActivities().values()) {
const location2 = item.location;
const location3 = location2;
const applicationId2 = item.applicationId;
const embeddedActivityLocationChannelId = getEmbeddedActivityLocationChannelId(location2);
if (embeddedActivityLocationChannelId != null && isVoiceEmbeddedActivity(embeddedActivityLocationChannelId) && embeddedActivityLocationChannelId !== r25) {
_this.leaveActivity({
location: location3,
applicationId: applicationId2
});
}
}
if (r25 != null) {
const embeddedActivitiesForChannel = EmbeddedActivitiesStore.getEmbeddedActivitiesForChannel(r25);
const id2 = AuthenticationStore.getId();
embeddedActivitiesForChannel.forEach((item) => {
if (item.userIds.has(id2)) {
const selfEmbeddedActivityForChannel = EmbeddedActivitiesStore.getSelfEmbeddedActivityForChannel(getEmbeddedActivityLocationChannelId(item.location));
if (selfEmbeddedActivityForChannel == null) {
_this.leaveActivity({
location: item.location,
applicationId: item.applicationId
});
} else if (c7118_27 == null) {
_this.hidePIPEmbed({
location: selfEmbeddedActivityForChannel.location,
applicationId: selfEmbeddedActivityForChannel.applicationId
});
}
}
});
}
if (r25 == null) {
r25 = void 0;
}
env7118[27] = r25;
};
this.handleActivityWebViewRelease = () => {
_this.releaseWebView();
};
this.handleActivityLaunchSuccess = ({ nonce, applicationId: applicationId2 }) => {
let env26715;
const r3 = env26715 = {
$parent: env7118
};
env26715[0] = applicationId2;
env26715[1] = nonce;
setTimeout($mk85134(r3), 2000);
if (isUsingDevShelfActivityUrlOverride()) {
_this.showDevShelfOverrideEnabled();
}
};
c18149_0 = void 0;
c18149_1 = this;
c18149_0 = async (c30242_0) => {
let c30242_3;
c30242_3 = void 0;
let c31535_0 = c30242_0.error;
let c31535_1 = c30242_0.nonce;
let c31535_2 = c30242_0.channelId;
let c31535_3 = c30242_0.guildId;
let c31535_4 = c30242_0.applicationId;
let c31535_5 = c30242_0.isStart;
let c31535_6 = c30242_0.locationKind;
await void 0;
let c31535_7 = (0, clearAwaitingAnalyticsContextImmediate)(c31535_4, c31535_1);
let c31535_8 = await getActivityLaunchErrorInfo(c31535_0, c31535_4);
c18149_1.showLaunchErrorModal(c31535_8.message);
let c31535_9 = ChannelStore.getChannel(c31535_2);
let c31535_10 = ThermalUtils_native.getRawThermalState();
const ACTIVITY_SESSION_JOIN_FAILED = AnalyticEvents.ACTIVITY_SESSION_JOIN_FAILED;
let guildId = c31535_3;
if (c31535_3 == null) {
guildId = c31535_9 == null ? void 0 : c31535_9.getGuildId();
}
AnalyticsUtils.track(ACTIVITY_SESSION_JOIN_FAILED, {
channel_id: c31535_2,
guild_id: guildId,
application_id: c31535_4,
raw_thermal_state: c31535_10,
is_activity_start: c31535_5,
channel_type: c31535_9?.type,
location_stack: c31535_7?.locations,
error_type: c31535_8.errorType,
error_status: c31535_8.errorStatus,
error_code: c31535_8.errorCode,
source: c31535_7?.source,
embedded_activity_location_kind: c31535_6
});
};
this.handleActivityLaunchFail = function() {
return c18149_0.apply(this, arguments);
};
this.handleActivityLaunchCancel = ({ nonce, applicationId: applicationId2 }) => {
const r3 = c7118_19[applicationId2];
if (r3 != null && r3.nonce === nonce) {
delete c7118_19[applicationId2];
}
};
this.superHandleRPCDisconnect = (a0) => {
let r23;
const reason = a0.reason;
const id3 = a0.application.id;
if (id3 != null && reason != null) {
let r30 = EmbeddedActivitiesStore.getSelfEmbeddedActivities().values()[Symbol.iterator]();
const next = r30.next;
while (true) {
const r9 = r30 === void 0 ? void 0 : (r23 = next.call(r30)).done ? r30 = void 0 : r23.value;
if (r30 === void 0) {
if (reason.code === RPCCloseCodes.CLOSE_NORMAL) {
break;
}
AnalyticsUtils.track(AnalyticEvents.ACTIVITY_CLOSED_RPC_ERROR, {
rpc_close_code: reason.code,
rpc_message: reason.message,
application_id: id3
});
_this.showErrorModal(reason, id3);
break;
}
try {
const { applicationId: applicationId2, location: location2 } = r9;
if (applicationId2 === id3) {
_this.leaveActivity({
location: location2,
applicationId: id3
});
}
} catch (r39) {
if (r30 !== void 0 && typeof r30.return === "function") {
try {
r30.return();
} catch {}
}
throw r39;
}
}
}
};
this.handleCallDelete = ({ channelId }) => {
const voiceChannelId = SelectedChannelStore.getVoiceChannelId();
if (voiceChannelId != null && voiceChannelId === channelId) {
_this.handleCallEnded(channelId);
}
};
this.handleRTCConnectionState = (a0) => {
if (a0.state === RTCConnectionStates.DISCONNECTED) {
_this.handleCallEnded(a0.channelId);
}
};
this.handleCallEnded = (a0) => {
const selfEmbeddedActivityForChannel = EmbeddedActivitiesStore.getSelfEmbeddedActivityForChannel(a0);
if (selfEmbeddedActivityForChannel != null) {
_this.leaveActivity({
location: selfEmbeddedActivityForChannel.location,
applicationId: selfEmbeddedActivityForChannel.applicationId
});
}
};
c18150_0 = void 0;
c18150_1 = this;
c18150_0 = async (c30243_0) => {
let guildId2, size, c30243_3, c30243_4;
L49: {
L46: {
L42: {
let env31536;
c30243_4 = void 0;
const r34 = env31536 = {};
c30243_3 = r34;
env31536[0] = void 0;
env31536[1] = void 0;
env31536[2] = void 0;
env31536[3] = void 0;
env31536[4] = void 0;
env31536[0] = c30243_0.channelId;
env31536[1] = c30243_0.applicationId;
env31536[2] = c30243_0.analyticsLocations;
env31536[3] = c30243_0.commandOrigin;
env31536[4] = c30243_0.inviterUserId;
env31536[5] = void 0;
env31536[6] = void 0;
env31536[7] = void 0;
env31536[8] = void 0;
env31536[9] = void 0;
env31536[10] = void 0;
env31536[11] = void 0;
env31536[12] = void 0;
env31536[13] = void 0;
await void 0;
env31536[5] = ChannelStore.getChannel(env31536[0]);
if (env31536[5] === void 0) {
break L49;
}
if (GUILD_VOCAL_CHANNEL_TYPES.has(env31536[5]?.type)) {
if (SelectedChannelStore.getVoiceChannelId() !== env31536[0]) {
break L49;
}
}
env31536[6] = EmbeddedActivitiesStore.getSelfEmbeddedActivityForChannel(env31536[0]);
if (env31536[6]?.applicationId === env31536[1]) {
break L49;
}
env31536[7] = await ApplicationActionCreators.fetchApplication(env31536[1]);
if (getIsActivitiesEnabledForCurrentPlatform()) {
const r129 = env31536[7];
if (isActivitySupportedOnClientPlatform(r129 == null ? void 0 : r129.embedded_activity_config?.supported_platforms)) {
const r155 = env31536[5];
guildId2 = r155 == null ? void 0 : r155.getGuildId();
if (guildId2 == null) {
guildId2 = void 0;
}
env31536[8] = guildId2;
env31536[9] = await fetchShelf({
guildId: env31536[8]
});
env31536[10] = env31536[9].activityConfigs;
env31536[11] = env31536[9].applications;
if (getShelfItemData({
applicationId: env31536[1],
activityConfigs: env31536[10],
applications: env31536[11]
}) == null) {
env31536[12] = await fetchShelf({
guildId: env31536[8],
force: true
});
getShelfItemData({
applicationId: env31536[1],
activityConfigs: env31536[12].activityConfigs,
applications: env31536[12].applications
});
}
const r232 = c30243_3;
env31536[13] = EmbeddedActivitiesStore.getEmbeddedActivitiesForChannel(env31536[0]).find($mk118170(r232));
const r242 = env31536[13];
size = r242 == null ? void 0 : r242.userIds.size;
if (size == null) {
size = 0;
}
if (size > 0) {
await maybeJoinEmbeddedActivity({
channelId: env31536[0],
applicationId: env31536[1],
launchId: env31536[13]?.launchId,
inputApplication: null,
analyticsLocations: env31536[2],
inviterUserId: env31536[4]
});
break L46;
}
await handleUsePrimaryEntryPointAppCommand({
targetApplicationId: env31536[1],
channelId: env31536[0],
analyticsLocations: env31536[2],
commandOrigin: env31536[3],
inviterUserId: env31536[4]
});
break L42;
}
c18150_1.showLaunchErrorModal(intl.string(t.uGDCcw));
break L49;
}
c18150_1.showLaunchErrorModal(intl.string(t.UXoQTp));
break L49;
}
return void 0;
}
return void 0;
}
};
this.handleDeferredOpen = function() {
return c18150_0.apply(this, arguments);
};
this.handleGuildDelete = ({ guild }) => {
EmbeddedActivitiesStore.getSelfEmbeddedActivities().forEach(({ location: location2, applicationId: applicationId2 }) => {
if (guild.id === getEmbeddedActivityLocationGuildId(location2)) {
_this.leaveActivity({
location: location2,
applicationId: applicationId2
});
}
});
};
this.handleChannelDelete = (a0) => {
const selfEmbeddedActivityForChannel = EmbeddedActivitiesStore.getSelfEmbeddedActivityForChannel(a0.channel.id);
if (selfEmbeddedActivityForChannel != null) {
_this.leaveActivity({
location: selfEmbeddedActivityForChannel.location,
applicationId: selfEmbeddedActivityForChannel.applicationId
});
}
};
this.handleInteractionQueue = ({ nonce, data }) => {
if (c7118_19[data.applicationId] == null) {
const r44 = {
applicationId: data.applicationId,
nonce,
locations: data.interactionType === InteractionTypes.APPLICATION_COMMAND ? [AnalyticsLocation.INTERACTION_APPLICATION_COMMAND] : data.interactionType === InteractionTypes.MESSAGE_COMPONENT ? [AnalyticsLocation.INTERACTION_MESSAGE_COMPONENT] : data.interactionType === InteractionTypes.MODAL_SUBMIT ? [AnalyticsLocation.INTERACTION_MODAL_SUBMIT] : void 0
};
const { applicationId: applicationId2, nonce: nonce2, locations, source } = r44;
let r48 = locations != null || source != null;
if (r48) {
c7118_19[applicationId2] = {
nonce: nonce2,
locations,
source
};
r48 = true;
}
if (r48) {
c7118_20[nonce] = data.applicationId;
}
}
};
this.handleInteractionCreate = ({ nonce, interactionId }) => {
if (nonce != null) {
const r6 = c7118_20[nonce];
if (r6 != null) {
const r8 = c7118_19[r6];
if (r8 != null) {
r8.interactionId = interactionId;
}
}
}
};
this.handleInteractionSuccess = ({ nonce }) => {
if (nonce != null) {
const r4 = c7118_20[nonce];
if (r4 != null) {
let env26717;
delete c7118_20[nonce];
const r8 = env26717 = {
$parent: env7118
};
env26717[0] = r4;
env26717[1] = nonce;
setTimeout($mk85134(r8), 2000);
}
}
};
this.handleInteractionFailure = ({ nonce }) => {
if (nonce != null) {
const r3 = c7118_20[nonce];
if (r3 != null) {
delete c7118_20[nonce];
const r8 = c7118_19[r3];
if (r8 != null && r8.nonce === nonce) {
delete c7118_19[r3];
}
}
}
};
}
_initialize() {
SelectedChannelStore.addChangeListener(this.handleSelectedChannelUpdate);
ComponentDispatch.subscribe(ComponentActions.RELEASE_ACTIVITY_WEB_VIEW, this.handleActivityWebViewRelease);
ComponentDispatch.subscribe(ComponentActions.OPEN_EMBEDDED_ACTIVITY, handleOpenEmbeddedActivity);
Dispatcher.subscribe("EMBEDDED_ACTIVITY_LAUNCH_START", handleActivityLaunchStart);
Dispatcher.subscribe("EMBEDDED_ACTIVITY_LAUNCH_SUCCESS", this.handleActivityLaunchSuccess);
Dispatcher.subscribe("EMBEDDED_ACTIVITY_LAUNCH_FAIL", this.handleActivityLaunchFail);
Dispatcher.subscribe("EMBEDDED_ACTIVITY_LAUNCH_CANCEL", this.handleActivityLaunchCancel);
Dispatcher.subscribe("EMBEDDED_ACTIVITY_CLOSE", handleActivityClose);
Dispatcher.subscribe("EMBEDDED_ACTIVITY_DEFERRED_OPEN", this.handleDeferredOpen);
Dispatcher.subscribe("RPC_APP_DISCONNECTED", this.handleRPCDisconnect);
Dispatcher.subscribe("CALL_DELETE", this.handleCallDelete);
Dispatcher.subscribe("RTC_CONNECTION_STATE", this.handleRTCConnectionState);
Dispatcher.subscribe("GUILD_DELETE", this.handleGuildDelete);
Dispatcher.subscribe("CHANNEL_DELETE", this.handleChannelDelete);
Dispatcher.subscribe("INTERACTION_QUEUE", this.handleInteractionQueue);
Dispatcher.subscribe("INTERACTION_CREATE", this.handleInteractionCreate);
Dispatcher.subscribe("INTERACTION_SUCCESS", this.handleInteractionSuccess);
Dispatcher.subscribe("INTERACTION_FAILURE", this.handleInteractionFailure);
}
_terminate() {
SelectedChannelStore.removeChangeListener(this.handleSelectedChannelUpdate);
ComponentDispatch.unsubscribe(ComponentActions.RELEASE_ACTIVITY_WEB_VIEW, this.handleActivityWebViewRelease);
ComponentDispatch.unsubscribe(ComponentActions.OPEN_EMBEDDED_ACTIVITY, handleOpenEmbeddedActivity);
Dispatcher.unsubscribe("EMBEDDED_ACTIVITY_LAUNCH_START", handleActivityLaunchStart);
Dispatcher.unsubscribe("EMBEDDED_ACTIVITY_LAUNCH_SUCCESS", this.handleActivityLaunchSuccess);
Dispatcher.unsubscribe("EMBEDDED_ACTIVITY_LAUNCH_FAIL", this.handleActivityLaunchFail);
Dispatcher.unsubscribe("EMBEDDED_ACTIVITY_LAUNCH_CANCEL", this.handleActivityLaunchCancel);
Dispatcher.unsubscribe("EMBEDDED_ACTIVITY_CLOSE", handleActivityClose);
Dispatcher.unsubscribe("EMBEDDED_ACTIVITY_DEFERRED_OPEN", this.handleDeferredOpen);
Dispatcher.unsubscribe("RPC_APP_DISCONNECTED", this.handleRPCDisconnect);
Dispatcher.unsubscribe("CALL_DELETE", this.handleCallDelete);
Dispatcher.unsubscribe("RTC_CONNECTION_STATE", this.handleRTCConnectionState);
Dispatcher.unsubscribe("GUILD_DELETE", this.handleGuildDelete);
Dispatcher.unsubscribe("CHANNEL_DELETE", this.handleChannelDelete);
Dispatcher.unsubscribe("INTERACTION_QUEUE", this.handleInteractionQueue);
Dispatcher.unsubscribe("INTERACTION_CREATE", this.handleInteractionCreate);
Dispatcher.unsubscribe("INTERACTION_SUCCESS", this.handleInteractionSuccess);
Dispatcher.unsubscribe("INTERACTION_FAILURE", this.handleInteractionFailure);
}
}
c7118_28 = EmbeddedActivitiesManager;
export default EmbeddedActivitiesManager;
export function trackFrameSessionStart(a0) {
const r34 = consumePendingFrameLaunch(a0);
if (r34 != null) {
const { isStart, inviterUserId, channelId, guildId: guildId3, locationKind, launchId, compositeInstanceId, activitiesInfraVersion } = r34;
const currentUser = UserStore.getCurrentUser();
if (currentUser != null) {
const r21 = channelId != null ? ChannelStore.getChannel(channelId) : null;
const mediaSessionId = RTCConnectionStore.getMediaSessionId();
const mediaSessionIds = mediaSessionId != null ? [mediaSessionId] : [];
const activityUserSessionId = v4();
c7118_18[a0] = {
activitySessionId: compositeInstanceId,
activityUserSessionId,
launchId,
mediaSessionIds,
activitiesInfraVersion,
connectedSince: Date.now(),
frameChannelId: channelId,
frameGuildId: guildId3,
frameLocationKind: locationKind
};
const shelfActivities = EmbeddedActivitiesStore.getShelfActivities(guildId3);
const shelfOrder = ActivityShelfStore.getState().shelfOrder;
const shelfItemData = getShelfItemData({
applicationId: a0,
activityConfigs: shelfActivities
});
const r64 = 1 + shelfOrder.findIndex((item) => item === a0);
const r65 = shelfItemData == null;
let release_phase = void 0;
if (!r65) {
const activity = shelfItemData.activity;
release_phase = activity == null ? void 0 : activity.client_platform_config[getPlatform(getOS())].release_phase;
}
const rawThermalState = ThermalUtils_native.getRawThermalState();
const r81 = c7118_19[a0];
const ACTIVITY_SESSION_JOINED = AnalyticEvents.ACTIVITY_SESSION_JOINED;
const locations = r81?.locations;
const n_participants = r21 != null ? ChannelRTCStore.getUserParticipantCount(r21.id) : null;
const shelf_rank = shelfItemData == null ? void 0 : shelfItemData.activity?.shelf_rank;
const r98 = r64 > 0;
AnalyticsUtils.track(ACTIVITY_SESSION_JOINED, {
channel_id: channelId,
guild_id: guildId3,
media_session_id: mediaSessionIds[0],
activity_session_id: compositeInstanceId,
application_id: a0,
location_stack: locations,
user_premium_tier: currentUser.premiumType,
raw_thermal_state: rawThermalState,
n_participants,
is_activity_start: isStart,
release_phase,
shelf_rank,
shelf_sorted_rank: r98 ? r64 : null,
activity_user_session_id: activityUserSessionId,
channel_type: r21?.type,
source: r81?.source,
command_context_type: r21 != null ? computeCommandContextType(r21, a0) : null,
invite_inviter_id: inviterUserId,
interaction_id: r81?.interactionId,
embedded_activity_location_kind: locationKind
});
const ACTIVITY_IFRAME_MOUNT = AnalyticEvents.ACTIVITY_IFRAME_MOUNT;
AnalyticsUtils.track(ACTIVITY_IFRAME_MOUNT, {
location_stack: r81?.locations,
channel_id: channelId,
channel_type: r21?.type,
guild_id: guildId3,
application_id: a0,
instance_id: launchId,
initial_media_session_id: mediaSessionIds[0],
activity_user_session_id: activityUserSessionId,
raw_thermal_state: rawThermalState,
is_activity_start: isStart,
shelf_rank: shelfItemData == null ? void 0 : shelfItemData.activity?.shelf_rank,
shelf_sorted_rank: r98 ? r64 : null,
activities_infra_version: activitiesInfraVersion,
embedded_activity_location_kind: locationKind
});
}
}
}
export function getActiveAnalyticsSessionIDs(a0) {
return c7118_18[a0];
}
export function trackFrameSessionEnd(a0) {
const r9 = c7118_18[a0];
const currentUser = UserStore.getCurrentUser();
if (r9 != null && currentUser != null) {
let frameChannelId = r9.frameChannelId;
if (frameChannelId == null) {
frameChannelId = null;
}
let frameGuildId = r9.frameGuildId;
if (frameGuildId == null) {
frameGuildId = null;
}
const r18 = frameChannelId != null ? ChannelStore.getChannel(frameChannelId) : null;
const shelfItemData = getShelfItemData({
applicationId: a0,
activityConfigs: EmbeddedActivitiesStore.getShelfActivities(frameGuildId)
});
const r2 = shelfItemData == null;
let release_phase = void 0;
if (!r2) {
const activity = shelfItemData.activity;
release_phase = activity == null ? void 0 : activity.client_platform_config[getPlatform(getOS())].release_phase;
}
const rawThermalState = ThermalUtils_native.getRawThermalState();
const duration_ms = r9.connectedSince != null ? Date.now() - r9.connectedSince : null;
AnalyticsUtils.track(AnalyticEvents.ACTIVITY_SESSION_LEFT, {
channel_id: frameChannelId,
guild_id: frameGuildId,
media_session_id: r9.mediaSessionIds[0],
activity_session_id: r9.activitySessionId,
application_id: a0,
duration_ms,
user_premium_tier: currentUser.premiumType,
raw_thermal_state: rawThermalState,
release_phase,
shelf_rank: shelfItemData == null ? void 0 : shelfItemData.activity?.shelf_rank,
activity_user_session_id: r9.activityUserSessionId,
channel_type: r18?.type,
media_session_ids: r9.mediaSessionIds,
embedded_activity_location_kind: r9.frameLocationKind
});
AnalyticsUtils.track(AnalyticEvents.ACTIVITY_IFRAME_UNMOUNT, {
channel_id: frameChannelId,
guild_id: frameGuildId,
application_id: a0,
instance_ids: r9.launchId != null ? [r9.launchId] : void 0,
media_session_ids: r9.mediaSessionIds,
activity_user_session_id: r9.activityUserSessionId,
raw_thermal_state: rawThermalState,
duration_ms,
embedded_activity_location_kind: r9.frameLocationKind
});
delete c7118_18[a0];
}
}
@@ -0,0 +1,853 @@
// Metro module 1371 (f1372).
import _slicedToArray from "../../_bundle/_slicedToArray";
import AuthenticationStore from "../../stores/AuthenticationStore";
import ChannelStore from "../../stores/ChannelStore";
import SelectedChannelStore from "../../stores/SelectedChannelStore";
import UserStore from "../../stores/UserStore";
import { ActivityPopoutWindowLayouts } from "./Constants";
import * as _ActivityPanelConstants from "./panel/ActivityPanelConstants";
import { ComponentActions, PopoutWindowKeys } from "../../Constants";
import { ContentClassificationEmbeddedActivityFilterExperiment } from "./ContentClassificationEmbeddedActivityFilterExperiment";
import { isAgeRestrictedClassificationReference } from "../content_classification/ContentClassificationReference";
import { getEmbeddedActivityLocationChannelId, getEmbeddedActivityLocationGuildId } from "./utils/embeddedActivityLocationUtils";
import getURLForApplication from "./getURLForApplication";
import { isActivityParticipantCurrentUserCurrentSession } from "./isActivityParticipantCurrentUserCurrentSession";
import { ComponentDispatch } from "../../utils/ComponentDispatchUtils";
import { shouldOpenActivityInPopoutWindow } from "./ActivityPopoutUtils.native";
import Dispatcher from "../../Dispatcher";
import isVoiceEmbeddedActivity from "./utils/isVoiceEmbeddedActivity";
import getPlatform from "./utils/getPlatform";
import { getOS } from "../../utils/PlatformUtils";
import { EmbeddedActivitySurfaces } from "../../flow/Server";
import { CommandOrigin } from "../application_commands/ApplicationCommandTypes";
import Module589 from "../../_bundle/Module589";
function $mk69108($env) {
return (a0) => {
(0, updateEmbeddedActivities)(a0);
};
}
let updateEmbeddedActivities, c1138_13, c1138_14, c1138_16, c1138_17, c1138_18, c1138_19, c1138_20, c1138_21, c1138_22, c1138_23, c1138_24, c1138_25, c1138_26, c1138_27, c1138_28, c1138_36, c1138_35;
let env1138 = {};
const participantFromServer = function participantFromServer(a0) {
return {
userId: a0.user_id,
sessionId: a0.session_id,
nonce: a0.nonce
};
};
updateEmbeddedActivities = function updateEmbeddedActivities(a0) {
let r48;
let id;
const { application_id: application_id2, launch_id, composite_instance_id, location: location2 } = a0;
const participants = a0.participants.map(participantFromServer);
const content_classification = a0.content_classification;
const application_id = application_id2;
const uRLForApplication = getURLForApplication(application_id);
if (uRLForApplication != null) {
const embeddedActivityLocationChannelId = getEmbeddedActivityLocationChannelId(location2);
if (embeddedActivityLocationChannelId != null) {
const r15 = c1138_18.get(embeddedActivityLocationChannelId);
let r50 = r15 == null ? void 0 : r15.getItems("all");
if (r50 == null) {
r50 = c1138_13;
}
r48 = r50;
} else {
r48 = c1138_13;
}
const length = r48.length;
const r55 = c1138_19.get(location2.id);
let r57 = r55 == null ? void 0 : r55.getItems("all");
if (r57 == null) {
r57 = c1138_13;
}
const r20 = r57.find((item) => item.applicationId === application_id);
const r64 = participants.map((participant) => participant.userId);
id = AuthenticationStore.getId();
const r24 = r64.some((item) => item === id);
const sessionId = participants.find((participant) => participant.userId === id)?.sessionId;
const r29 = participants.some((participant) => isActivityParticipantCurrentUserCurrentSession(participant));
const r22 = c1138_16.get(application_id);
const r81 = c1138_20.get(`${application_id}:${embeddedActivityLocationChannelId == null ? null : embeddedActivityLocationChannelId}`);
const launchParams = r81?.launchParams;
const r84 = {
applicationId: application_id,
location: location2,
launchId: launch_id,
compositeInstanceId: composite_instance_id,
url: uRLForApplication,
userIds: new Set(r64),
participants,
contentClassification: content_classification,
referrerId: null,
customId: null,
proxyTicket: null
};
let referrerId2 = r22?.referrerId;
if (referrerId2 == null) {
referrerId2 = launchParams?.referrerId;
}
r84.referrerId = referrerId2;
let customId2 = r22?.customId;
if (customId2 == null) {
customId2 = launchParams?.customId;
}
r84.customId = customId2;
r84.proxyTicket = r81?.proxyTicket;
if (r24 && r22 != null) {
const applicationId = r22.applicationId;
let proxyTicket = r84.proxyTicket;
if (proxyTicket == null) {
proxyTicket = r22.proxyTicket;
}
c1138_16.set(applicationId, {
...r22,
...r84,
proxyTicket
});
}
L75: {
L45: {
if (r22 != null && location2.id === r22.location.id && application_id === r22.applicationId) {
if (!(!r24 && Array.from(r22.userIds).some((item) => item === id)) && r29) {
break L45;
}
c1138_16.delete(r22.applicationId);
ComponentDispatch.dispatch(ComponentActions.RELEASE_ACTIVITY_WEB_VIEW);
break L75;
}
}
if (r24) {
if (r22 != null && r22.applicationId === application_id && r22.location.id === location2.id) {
break L75;
}
L72: {
if (sessionId === AuthenticationStore.getSessionId()) {
const isStart = r20 == null;
const { referrerId, customId } = r84;
const inviterUserId = r81?.inviterUserId;
const proxyTicket2 = r84.proxyTicket;
const uRLForApplication2 = getURLForApplication(application_id);
const sessionId2 = AuthenticationStore.getSessionId();
if (uRLForApplication2 != null && sessionId2 != null) {
const r147 = c1138_16.get(application_id);
if ((r147 == null ? void 0 : r147.location.id) !== location2.id) {
const embeddedActivityLocationChannelId2 = getEmbeddedActivityLocationChannelId(location2);
const channel2 = ChannelStore.getChannel(embeddedActivityLocationChannelId2);
const r160 = channel2 == null ? void 0 : channel2.getGuildId();
if (UserStore.getCurrentUser() != null) {
if (r160 == null && !(channel2 == null ? void 0 : channel2.isPrivate())) {
break L72;
}
const isFirstActivityInChannel = length === 0;
env1138[29] = location2;
const embeddedActivity = {
applicationId: application_id,
url: uRLForApplication2,
userIds: new Set(participants.map((participant) => participant.userId)),
participants,
connectedSince: Date.now(),
launchId: launch_id,
compositeInstanceId: composite_instance_id,
location: location2,
referrerId,
customId,
proxyTicket: proxyTicket2
};
c1138_16.set(application_id, embeddedActivity);
ComponentDispatch.dispatch(ComponentActions.OPEN_EMBEDDED_ACTIVITY, {
location: location2,
applicationId: application_id,
isFirstActivityInChannel,
isStart,
participants,
embeddedActivity,
inviterUserId
});
if (shouldOpenActivityInPopoutWindow()) {
env1138[30] = _ActivityPanelConstants.ActivityPanelModes.ACTIVITY_POPOUT_WINDOW;
Dispatcher.wait(() => {
Dispatcher.dispatch({
type: "ACTIVITY_POPOUT_WINDOW_OPEN"
});
});
} else {
env1138[30] = embeddedActivityLocationChannelId2 === SelectedChannelStore.getChannelId() && !isVoiceEmbeddedActivity(embeddedActivityLocationChannelId2) ? _ActivityPanelConstants.ActivityPanelModes.PANEL : _ActivityPanelConstants.ActivityPanelModes.PIP;
}
c1138_28.set(`${location2.id}:${application_id}`, Date.now());
}
}
}
}
}
let r221 = embeddedActivityLocationChannelId;
if (r221 == null) {
r221 = null;
}
c1138_20.delete(`${application_id}:${r221}`);
}
}
const r230 = r64.length > 0 ? r84 : null;
const id3 = location2.id;
let r233 = c1138_19.get(id3);
if (r233 == null) {
const r240 = {
__proto__: ActivityBucket.prototype,
items: [],
cachedVisible: null,
cachedHidden: null
};
c1138_19.set(id3, r240);
r233 = r240;
}
r233.upsert(application_id, location2.id, r230);
const embeddedActivityLocationChannelId3 = getEmbeddedActivityLocationChannelId(location2);
if (embeddedActivityLocationChannelId3 != null) {
let r252 = c1138_18.get(embeddedActivityLocationChannelId3);
if (r252 == null) {
const r259 = {
__proto__: ActivityBucket.prototype,
items: [],
cachedVisible: null,
cachedHidden: null
};
c1138_18.set(embeddedActivityLocationChannelId3, r259);
r252 = r259;
}
r252.upsert(application_id, location2.id, r230);
let r268 = getEmbeddedActivityLocationGuildId(location2);
if (r268 == null) {
r268 = "0";
}
let r271 = c1138_17.get(r268);
const r272 = r268;
if (r271 == null) {
const r279 = {
__proto__: ActivityBucket.prototype,
items: [],
cachedVisible: null,
cachedHidden: null
};
c1138_17.set(r272, r279);
r271 = r279;
}
r271.upsert(application_id, location2.id, r230);
}
}
};
const { ActivityPanelModes: ActivityPanelModes2, FocusedActivityLayouts: FocusedActivityLayouts2 } = _ActivityPanelConstants;
const set = new Set([]);
env1138[12] = {
everLaunchedActivities: new Set(),
seenNewActivities: {},
seenUpdatedActivities: {},
lastCheckedForBadgeableActivities: null,
dateRangesForSurfaces: {}
};
c1138_13 = [];
c1138_14 = [];
class ActivityBucket {
constructor() {
return {
__proto__: new.target.prototype,
items: [],
cachedVisible: null,
cachedHidden: null
};
}
upsert(c12992_0, c12992_1, a2) {
this.items = this.items.filter((item) => !(item.applicationId === c12992_0 && item.location.id === c12992_1));
if (a2 != null) {
this.items.push(a2);
}
this.invalidate();
}
removeWhere(c12993_0) {
this.items = this.items.filter((item) => !c12993_0(item));
this.invalidate();
}
clear() {
this.items = [];
this.invalidate();
}
getItems(a0) {
if (ContentClassificationEmbeddedActivityFilterExperiment.getConfig({
location: "embedded_activity_store"
}).enabled && a0 !== "all") {
if (a0 === "visible") {
let cachedVisible = this.cachedVisible;
if (cachedVisible == null) {
const cachedVisible2 = this.items.filter((item) => !isAgeRestrictedClassificationReference(item.contentClassification));
this.cachedVisible = cachedVisible2;
cachedVisible = cachedVisible2;
}
return cachedVisible;
}
if (a0 === "hidden") {
let cachedHidden = this.cachedHidden;
if (cachedHidden == null) {
const cachedHidden2 = this.items.filter((item) => isAgeRestrictedClassificationReference(item.contentClassification));
this.cachedHidden = cachedHidden2;
cachedHidden = cachedHidden2;
}
return cachedHidden;
}
return void 0;
}
return this.items;
}
invalidate() {
this.cachedVisible = null;
this.cachedHidden = null;
}
}
c1138_16 = new Map();
c1138_17 = new Map();
c1138_18 = new Map();
c1138_19 = new Map();
c1138_20 = new Map();
c1138_21 = new Set();
c1138_22 = new Map();
c1138_23 = new Map();
c1138_24 = new Map();
c1138_25 = new Map();
c1138_26 = new Map();
c1138_27 = new Map();
c1138_28 = new Map();
env1138[29] = void 0;
env1138[30] = ActivityPanelModes2.DISCONNECTED;
env1138[31] = FocusedActivityLayouts2.RESIZABLE;
env1138[32] = ActivityPopoutWindowLayouts.NORMAL;
class EmbeddedActivitiesStoreClass extends Module589.PersistedStore {
static displayName = "EmbeddedActivitiesStore";
static persistKey = "EmbeddedActivities";
static migrations = [(a0) => ({
...a0,
seenFeaturedActivities: [],
shouldShowNewActivityIndicator: false
}), (a0) => {
delete a0["seenFeaturedActivities"];
return {
...a0
};
}, (a0) => {
delete a0["seenActivities"];
return {
...a0
};
}, (a0) => {
delete a0["currentFreeActivity"];
delete a0["lastFreeActivityRotationTimestampMs"];
delete a0["freePeriodActivities"];
delete a0["shouldShowFreeActivityIndicator"];
return {
...a0
};
}, (a0) => ({
...a0,
seenNewActivities: {},
seenUpdatedActivities: {}
}), (a0) => {
const r2 = Set;
let everLaunchedActivities = a0.everLaunchedActivities;
if (everLaunchedActivities == null) {
everLaunchedActivities = [];
}
return {
...a0,
everLaunchedActivities: new r2(everLaunchedActivities)
};
}, (a0) => {
delete a0["usersHavePlayedByApp"];
return {
...a0
};
}, (a0) => {
a0.surfacesToShowNewActivityIndicator = new Set();
if (a0.shouldShowNewActivityIndicator) {
a0.surfacesToShowNewActivityIndicator.add(EmbeddedActivitySurfaces.VOICE_LAUNCHER);
}
delete a0["shouldShowNewActivityIndicator"];
return {
...a0
};
}, (a0) => ({
...a0,
lastCheckedForBadgeableActivities: null
}), (a0) => {
delete a0["surfacesToShowNewActivityIndicator"];
return {
...a0,
dateRangesForSurfaces: {}
};
}];
constructor() {
super(...arguments);
}
initialize(a0) {
this.waitFor(AuthenticationStore, ChannelStore, SelectedChannelStore, UserStore);
const r7 = Set;
let r17 = a0?.everLaunchedActivities;
if (r17 == null) {
r17 = [];
}
const everLaunchedActivities = new r7(r17);
if (a0 != null) {
env1138[12] = {
...a0,
everLaunchedActivities
};
}
}
getState() {
return env1138[12];
}
getSelfEmbeddedActivityForChannel(a0) {
const r1 = a0 == null;
let r8 = null;
if (!r1) {
let r15 = Array.from(c1138_16.values()).find((item) => getEmbeddedActivityLocationChannelId(item.location) === a0);
if (r15 == null) {
r15 = null;
}
r8 = r15;
}
return r8;
}
getSelfEmbeddedActivityForLocation(a0) {
const r1 = a0 == null;
let r8 = null;
if (!r1) {
let r15 = Array.from(c1138_16.values()).find((item) => item.location.id === a0.id);
if (r15 == null) {
r15 = null;
}
r8 = r15;
}
return r8;
}
getSelfEmbeddedActivities() {
return c1138_16;
}
getEmbeddedActivitiesForGuild(a0) {
const r6 = c1138_17.get(a0);
let r7 = r6 == null ? void 0 : r6.getItems("visible");
if (r7 == null) {
r7 = c1138_13;
}
return r7;
}
getEmbeddedActivitiesForChannel(a0) {
const r6 = c1138_18.get(a0);
let r7 = r6 == null ? void 0 : r6.getItems("visible");
if (r7 == null) {
r7 = c1138_13;
}
return r7;
}
getEmbeddedActivitiesForLocation(a0) {
const r6 = c1138_19.get(a0.id);
let r8 = r6 == null ? void 0 : r6.getItems("visible");
if (r8 == null) {
r8 = c1138_13;
}
return r8;
}
getEmbeddedActivitiesForGuildIncludingHidden(a0) {
const r6 = c1138_17.get(a0);
let r7 = r6 == null ? void 0 : r6.getItems("all");
if (r7 == null) {
r7 = c1138_13;
}
return r7;
}
getEmbeddedActivitiesForChannelIncludingHidden(a0) {
const r6 = c1138_18.get(a0);
let r7 = r6 == null ? void 0 : r6.getItems("all");
if (r7 == null) {
r7 = c1138_13;
}
return r7;
}
getEmbeddedActivitiesForLocationIncludingHidden(a0) {
const r6 = c1138_19.get(a0.id);
let r8 = r6 == null ? void 0 : r6.getItems("all");
if (r8 == null) {
r8 = c1138_13;
}
return r8;
}
getEmbeddedActivitiesByChannel() {
const map = new Map();
let c12996_0 = map;
c1138_18.forEach((item, index) => {
const items = item.getItems("visible");
if (items.length > 0) {
c12996_0.set(index, items);
}
});
return map;
}
getEmbeddedActivityDurationMs(a0, a1) {
const r12 = c1138_28.get(`${a0}:${a1}`);
return r12 != null ? Date.now() - r12 : null;
}
isLaunchingActivity() {
return c1138_20.size > 0;
}
getShelfActivities(a0) {
let r5 = c1138_22.get(a0 == null ? "0" : a0);
if (r5 == null) {
r5 = c1138_14;
}
return r5;
}
getShelfFetchStatus(a0) {
return c1138_23.get(a0 == null ? "0" : a0);
}
shouldFetchShelf(a0) {
let r8 = c1138_23.get(a0 == null ? "0" : a0);
if (r8 == null) {
r8 = {
isFetching: false
};
}
const r6 = Date.now();
let r12 = r8?.lastFetchTimestampMs;
if (r12 == null) {
r12 = 0;
}
const r13 = r6 - r12;
const isFetching = r8?.isFetching;
return isFetching ? !isFetching : r13 > 21600000;
}
getOrientationLockStateForApp(a0) {
return c1138_24.get(a0);
}
getPipOrientationLockStateForApp(a0) {
let r6 = c1138_25.get(a0);
if (r6 == null) {
r6 = this.getOrientationLockStateForApp(a0);
}
return r6;
}
getGridOrientationLockStateForApp(a0) {
let r5 = c1138_26.get(a0);
if (r5 == null) {
r5 = c1138_25.get(a0);
}
if (r5 == null) {
r5 = this.getOrientationLockStateForApp(a0);
}
return r5;
}
getLayoutModeForApp(a0) {
return c1138_27.get(a0);
}
getConnectedActivityChannelId() {
if (env1138[29] != null) {
return getEmbeddedActivityLocationChannelId(env1138[29]);
}
}
getConnectedActivityLocation() {
return env1138[29];
}
getActivityPanelMode() {
return env1138[30];
}
getFocusedLayout() {
return env1138[31];
}
getCurrentEmbeddedActivity() {
let r5 = this.getSelfEmbeddedActivityForLocation(this.getConnectedActivityLocation());
if (r5 == null) {
r5 = void 0;
}
return r5;
}
isProxyTicketRefreshing(a0) {
return c1138_21.has(a0);
}
getEmbeddedActivityForUserId(a0, a1) {
if (a1 === void 0) {
return void 0;
}
let r27 = void 0;
loop3: for (const r11 of c1138_19) {
const r32 = _slicedToArray(r11, 2);
r32[0];
for (const item of r32[1].getItems("visible")) {
if (item.applicationId !== a1) {
continue;
}
if (!item.userIds.has(a0)) {
continue;
}
r27 = item;
break loop3;
}
}
return r27;
}
hasActivityEverBeenLaunched(a0) {
return env1138[12].everLaunchedActivities.has(a0);
}
getLaunchState(a0, a1) {
if (a0 != null) {
let r7 = a1;
if (a1 == null) {
r7 = null;
}
return c1138_20.get(`${a0}:${r7}`);
}
}
getLaunchStates() {
return c1138_20;
}
getActivityPopoutWindowLayout() {
return env1138[32];
}
}
c1138_36 = EmbeddedActivitiesStoreClass;
c1138_35 = new EmbeddedActivitiesStoreClass(Dispatcher, {
ACTIVITY_LAYOUT_MODE_UPDATE: function handleActivityLayoutModeUpdate(a0) {
c1138_27.set(a0.applicationId, a0.layoutMode);
},
CONNECTION_OPEN_SUPPLEMENTAL: function handleConnectionOpen({ guilds }) {
let id2;
id2 = void 0;
c1138_18.clear();
c1138_17.clear();
c1138_19.clear();
guilds.forEach(({ activity_instances }) => {
if (activity_instances != null) {
activity_instances.forEach($mk69108(env1138));
}
});
id2 = AuthenticationStore.getId();
const r38 = Array.from(c1138_16.values());
const _loop = function _loop(a0) {
if (!c1138_35.getEmbeddedActivitiesForLocationIncludingHidden(a0.location).some((item) => {
const applicationId = item.applicationId;
return applicationId === a0.applicationId && item.launchId === a0.launchId && item.userIds.has(id2);
})) {
c1138_16.delete(a0.applicationId);
ComponentDispatch.dispatch(ComponentActions.RELEASE_ACTIVITY_WEB_VIEW);
}
};
for (const item of r38) {
_loop(item);
}
},
GUILD_CREATE: function handleGuildCreate(a0) {
const activity_instances = a0.guild.activity_instances;
if (activity_instances != null) {
activity_instances.forEach($mk69108(env1138));
}
},
CHANNEL_DELETE: function handleChannelDelete({ channel }) {
const r10 = c1138_18.get(channel.id);
let r12 = r10 == null ? void 0 : r10.getItems("all");
if (r12 == null) {
r12 = c1138_13;
}
c1138_18.delete(channel.id);
let guild_id = channel.guild_id;
if (guild_id == null) {
guild_id = "0";
}
const r20 = c1138_17.get(guild_id);
if (r20 != null) {
r20.removeWhere((a0) => getEmbeddedActivityLocationChannelId(a0.location) === channel.id);
}
r12.forEach((item) => {
c1138_19.delete(item.location.id);
});
},
EMBEDDED_ACTIVITY_LAUNCH_START: function handleEmbeddedActivityLaunchStart(a0) {
const { applicationId, componentId, commandOrigin } = a0;
c1138_20.set(`${applicationId}:${a0.channelId}`, {
isLaunching: true,
componentId,
inviterUserId: a0.inviterUserId,
launchParams: a0.launchParams
});
env1138[31] = commandOrigin === CommandOrigin.APP_DMS_ENTRY_POINT_COMMAND_BUTTON ? _ActivityPanelConstants.FocusedActivityLayouts.NO_CHAT : _ActivityPanelConstants.FocusedActivityLayouts.RESIZABLE;
},
EMBEDDED_ACTIVITY_LAUNCH_SET_PROXY_TICKET: function handleEmbeddedActivityLaunchSetProxyTicket({ applicationId, channelId, proxyTicket }) {
const r13 = `${applicationId}:${channelId}`;
const r17 = c1138_20.get(r13);
if (r17 != null) {
c1138_20.set(r13, {
...r17,
proxyTicket
});
}
},
EMBEDDED_ACTIVITY_UPDATE_CONNECTED_PROXY_TICKET: function handleEmbeddedActivityUpdateConnectedProxyTicket({ applicationId, proxyTicket }) {
const r6 = c1138_16.get(applicationId);
if (r6 == null) {
return false;
}
c1138_16.set(applicationId, {
...r6,
proxyTicket
});
},
EMBEDDED_ACTIVITY_SET_PROXY_TICKET_REFRESHING: function handleEmbeddedActivitySetProxyTicketRefreshing({ applicationId, refreshing }) {
if (refreshing) {
c1138_21.add(applicationId);
} else {
c1138_21.delete(applicationId);
}
},
EMBEDDED_ACTIVITY_LAUNCH_SUCCESS: function handleEmbeddedActivityLaunchSuccess(a0) {
env1138[12].everLaunchedActivities.add(a0.applicationId);
},
EMBEDDED_ACTIVITY_LAUNCH_FAIL: function handleEmbeddedActivityLaunchFail(a0) {
const applicationId = a0.applicationId;
c1138_20.delete(`${applicationId}:${a0.channelId}`);
c1138_21.delete(applicationId);
},
EMBEDDED_ACTIVITY_LAUNCH_CANCEL: function handleEmbeddedActivityLaunchCancel(a0) {
const applicationId = a0.applicationId;
c1138_20.delete(`${applicationId}:${a0.channelId}`);
c1138_21.delete(applicationId);
},
EMBEDDED_ACTIVITY_CLOSE: function handleEmbeddedActivityClose({ applicationId }) {
const r9 = c1138_16.get(applicationId);
c1138_16.delete(applicationId);
if ((r9 == null ? void 0 : r9.location.id) === env1138[29]?.id) {
env1138[29] = void 0;
}
},
EMBEDDED_ACTIVITY_UPDATE_POPOUT_WINDOW_LAYOUT: function handleUpdatePopoutWindowLayout(a0) {
env1138[32] = a0.layout;
},
EMBEDDED_ACTIVITY_UPDATE_V2: function handleEmbeddedActivityUpdateV2(a0) {
updateEmbeddedActivities(a0.instance);
},
LOCAL_ACTIVITY_UPDATE: function handleLocalActivityUpdate({ activity }) {
if (activity == null) {
return false;
}
let application_id2 = activity.application_id;
if (application_id2 == null) {
application_id2 = "";
}
const r5 = c1138_16.get(application_id2);
if (r5 == null) {
return false;
}
c1138_16.set(r5.applicationId, {
...r5
});
},
EMBEDDED_ACTIVITY_SET_CONFIG: function handleSetSelfEmbeddedActivityConfig({ applicationId, config }) {
const r6 = c1138_16.get(applicationId);
if (r6 != null) {
c1138_16.set(r6.applicationId, {
...r6,
config
});
}
},
EMBEDDED_ACTIVITY_FETCH_SHELF: function handleEmbeddedActivityFetchShelf({ guildId }) {
if (guildId == null) {
guildId = "0";
}
c1138_23.set(guildId, {
isFetching: true,
lastFetchTimestampMs: c1138_23.get(guildId)?.lastFetchTimestampMs
});
env1138[12].lastCheckedForBadgeableActivities = new Date(Date.now()).toISOString();
},
EMBEDDED_ACTIVITY_FETCH_SHELF_SUCCESS: function handleEmbeddedActivityFetchShelfSuccess(a0) {
let guildId = a0.guildId;
const activities = a0.activities;
if (guildId == null) {
guildId = "0";
}
c1138_22.set(guildId, activities);
const lastFetchTimestampMs = Date.now();
let c12999_0 = lastFetchTimestampMs;
let c12999_1 = getPlatform(getOS());
env1138[12].dateRangesForSurfaces = activities.reduce((acc, activity) => {
let c28882_2, time;
const r13 = activity.client_platform_config[c12999_1];
let c28882_1 = r13;
if (r13.label_from != null && r13.label_until != null) {
c28882_2 = {
fromDate: r13.label_from,
untilDate: r13.label_until
};
time = new Date(r13.label_from).getTime();
const time2 = new Date(r13.label_until).getTime();
if (!(time > c12999_0 || time2 < c12999_0)) {
Object.values(EmbeddedActivitySurfaces).filter((item) => !c28882_1.omit_badge_from_surfaces.includes(item)).forEach((item) => {
const r5 = acc[item];
if (r5 == null || new Date(r5.fromDate).getTime() < time) {
acc[item] = c28882_2;
}
});
}
return acc;
}
return acc;
}, {});
c1138_23.set(guildId, {
isFetching: false,
lastFetchTimestampMs
});
},
EMBEDDED_ACTIVITY_FETCH_SHELF_FAIL: function handleEmbeddedActivityFetchShelfFail({ guildId }) {
if (guildId == null) {
guildId = "0";
}
c1138_23.set(guildId, {
isFetching: false,
lastFetchTimestampMs: c1138_23.get(guildId)?.lastFetchTimestampMs
});
},
EMBEDDED_ACTIVITY_SET_ORIENTATION_LOCK_STATE: function handleOrientationLockState({ applicationId, lockState, pictureInPictureLockState, gridLockState }) {
if (lockState == null) {
c1138_24.delete(applicationId);
} else {
c1138_24.set(applicationId, lockState);
}
if (pictureInPictureLockState === null) {
c1138_25.delete(applicationId);
} else if (pictureInPictureLockState !== void 0) {
c1138_25.set(applicationId, pictureInPictureLockState);
}
if (gridLockState === null) {
c1138_26.delete(applicationId);
} else if (gridLockState !== void 0) {
c1138_26.set(applicationId, gridLockState);
}
},
EMBEDDED_ACTIVITY_SET_PANEL_MODE: function handleSetPanelMode(a0) {
env1138[30] = a0.activityPanelMode;
},
EMBEDDED_ACTIVITY_SET_FOCUSED_LAYOUT: function handleSetFocusedLayout(a0) {
env1138[31] = a0.focusedActivityLayout;
},
CHANNEL_SELECT: function handleChannelSelect({ channelId }) {
if (env1138[29] != null) {
const embeddedActivityLocationChannelId = getEmbeddedActivityLocationChannelId(env1138[29]);
if (embeddedActivityLocationChannelId != null && embeddedActivityLocationChannelId !== channelId && env1138[30] === _ActivityPanelConstants.ActivityPanelModes.PANEL) {
env1138[30] = _ActivityPanelConstants.ActivityPanelModes.PIP;
}
}
},
POPOUT_WINDOW_CLOSE: function handlePopoutWindowClose(a0) {
if (a0.key === PopoutWindowKeys.ACTIVITY_POPOUT) {
env1138[30] = _ActivityPanelConstants.ActivityPanelModes.PIP;
}
}
});
export default c1138_35;
export { set as FEATURED_ACTIVITY_IDS };
export { c1138_13 as NO_ACTIVITIES };
export { c1138_14 as NO_ACTIVITY_CONFIGS };
export const ACTIVITIES_GUILD_ID_SENTINEL_FOR_PRIVATE_CHANNELS = "0";
@@ -0,0 +1,9 @@
// Metro module 12383 (f12384).
import Dispatcher from "../../Dispatcher";
export function setCoverImageURL(a0) {
Dispatcher.dispatch({
type: "SET_MESSAGE_ACTIVITY_INVITE_COVER_IMAGE_URL",
messageId: a0.messageId,
coverImageURL: a0.coverImageURL
});
}
@@ -0,0 +1,22 @@
// Metro module 12382 (f12383).
import LRUCache from "../../_bundle/LRUCache";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c8553_0 = new LRUCache({
max: 500
});
class MessageActivityInviteCoverImageStore extends Module589.Store {
static displayName = "MessageActivityInviteCoverImageStore";
getCoverImageURL(a0) {
return c8553_0.get(a0.messageId);
}
}
const messageActivityInviteCoverImageStore = new MessageActivityInviteCoverImageStore(Dispatcher, {
SET_MESSAGE_ACTIVITY_INVITE_COVER_IMAGE_URL: function handleSetMessageActivityInviteCoverImageURL({ messageId, coverImageURL }) {
if (c8553_0.get(messageId) === coverImageURL) {
return false;
}
c8553_0.set(messageId, coverImageURL);
}
});
export default messageActivityInviteCoverImageStore;
@@ -0,0 +1,48 @@
// Metro module 10650 (f10651).
import { View } from "react-native";
import { createStyles } from "../../design/components/Styles/native/createStyles";
import Module712 from "../../_bundle/Module712";
import ActivityAnnouncement from "./native/ActivityAnnouncement";
import { Text } from "../../design/components/Text/native/Text";
import { intl, t } from "../../intl/index.native";
import AlertActionCreators from "../../actions/AlertActionCreators";
import { ButtonColors } from "../../design/void/native";
let useStyles;
const ConfirmActivityGateContent = function ConfirmActivityGateContent(props) {
const description = props.description;
const styles = useStyles();
return <View style={styles.alertContainer}>
<ActivityAnnouncement />
<Text style={styles.alertBodyText} variant="text-md/normal">{description}</Text>
</View>;
};
useStyles = createStyles({
alertContainer: {
display: "flex",
alignItems: "center",
padding: 8
},
alertBodyText: {
fontSize: 16,
lineHeight: 24,
color: Module712.colors.INTERACTIVE_TEXT_DEFAULT,
textAlign: "center"
}
});
export function confirmActivityAgeGateAlert(a0) {
const application = a0.application;
a0.channelId;
const { onAgree, onDisagree } = a0;
const description = intl.formatToPlainString(t.OgmIqy, {
applicationName: application.name
});
return Promise.resolve(AlertActionCreators.show({
title: intl.string(t.SSDPOF),
children: <ConfirmActivityGateContent description={description} />,
cancelText: intl.string(t.hg1uxn),
confirmText: intl.string(t.wVq7uo),
onConfirm: onAgree,
onCancel: onDisagree,
confirmColor: ButtonColors.RED
}));
}
@@ -0,0 +1,31 @@
// Metro module 10649 (f10650).
import RelationshipStore from "../../stores/RelationshipStore";
import UserStore from "../../stores/UserStore";
import { computeChannelName } from "../channel/useChannelName";
import AlertActionCreators from "../../actions/AlertActionCreators";
import { intl, t } from "../../intl/index.native";
import { isNullOrEmpty } from "../../utils/StringUtils";
export default function confirmActivityChangeModal(a0, a1, a2, a3) {
let currentApplicationChannelName = a1 != null ? computeChannelName(a1, UserStore, RelationshipStore) : "";
const r34 = {
title: intl.string(t.XkIWkk),
cancelText: intl.string(t["ETE/oC"]),
confirmText: intl.string(t["cY+Oob"]),
onConfirm: a2,
onCancel: a3,
body: null
};
const r60 = t["5/Xort"];
let currentApplicationName = a0?.name;
if (currentApplicationName == null) {
currentApplicationName = intl.string(t.G99XFs);
}
if (isNullOrEmpty(currentApplicationChannelName)) {
currentApplicationChannelName = intl.string(t.OGUjmt);
}
r34.body = intl.format(r60, {
currentApplicationName,
currentApplicationChannelName
});
AlertActionCreators.show(r34);
};
@@ -0,0 +1,75 @@
// Metro module 10652 (f10653).
import { Image as Image2, View } from "react-native";
import { PRIVATE_APPS_HELP_ARTICLE } from "./Constants";
import { createStyles } from "../../design/components/Styles/native/createStyles";
import Module10653 from "../../_bundle/Module10653";
import { Text } from "../../design/components/Text/native/Text";
import { intl, t } from "../../intl/index.native";
import { Button } from "../../design/components/Button/native/Button.native";
import Linking from "../../lib/native/Linking";
import AlertActionCreators from "../../actions/AlertActionCreators";
let useStyles, LinkButton;
const ConfirmActivityGateContent = function ConfirmActivityGateContent(props) {
const application = props.application;
const styles = useStyles();
return <View style={styles.alertContainer}>
<Image2 source={Module10653} style={styles.announcementBirb} />
<Text style={styles.alertEyebrowText} variant="eyebrow">
{intl.string(t["06YebE"])}
</Text>
<Text style={styles.alertTitleText} variant="heading-lg/bold">
{intl.format(t["Z/eMDT"], {
activityName: application.name
})}
</Text>
<Text style={styles.alertSubtitleText} variant="text-sm/normal">
{intl.string(t.z81WwD)}
</Text>
</View>;
};
LinkButton = function LinkButton() {
return <View style={useStyles().linkWrapper}>
<Button variant="secondary" size="sm" onPress={function onPress() {
Linking.openURL(PRIVATE_APPS_HELP_ARTICLE);
}} text={intl.string(t.E0gf5l)} />
</View>;
};
useStyles = createStyles({
alertContainer: {
display: "flex",
alignItems: "center",
padding: 8
},
alertEyebrowText: {
marginTop: 40,
textAlign: "center"
},
alertTitleText: {
marginTop: 16,
textAlign: "center"
},
alertSubtitleText: {
marginTop: 16,
textAlign: "center"
},
announcementBirb: {
width: 90,
height: 100,
position: "absolute",
top: -66
},
linkWrapper: {
marginTop: 8
}
});
export function confirmExternalAppLaunchAlert({ application, onConfirm, onCancel }) {
return Promise.resolve(AlertActionCreators.show({
title: "",
children: <ConfirmActivityGateContent application={application} />,
onConfirm,
confirmText: intl.string(t["3PatSz"]),
onCancel,
cancelText: intl.string(t["ETE/oC"]),
footer: <LinkButton />
}));
}
@@ -0,0 +1,5 @@
// Metro module 13541 (f13542).
export function getActivitiesModalContextKey(a0) {
a0.application;
a0.channelId;
}
@@ -0,0 +1,28 @@
// Metro module 16176 (f16177).
import { ActivityFeedbackReasons } from "./Constants";
import { intl, t } from "../../intl/index.native";
export default function getActivityReportOptions(a0, r3 = false) {
const r24 = [{
value: ActivityFeedbackReasons.FAILED_LOAD,
label: a0 ? intl.string(t.uaiF6B) : intl.string(t.aO6OMZ)
}, {
value: ActivityFeedbackReasons.LAGGING,
label: a0 ? intl.string(t["/nJOlj"]) : intl.string(t["79HFwf"])
}, {
value: ActivityFeedbackReasons.CONFUSING,
label: a0 ? intl.string(t["/8psS7"]) : intl.string(t.iSv55N)
}, {
value: ActivityFeedbackReasons.NOT_FUN,
label: a0 ? intl.string(t["7GVmLm"]) : intl.string(t.GnVff5)
}, {
value: ActivityFeedbackReasons.OTHER,
label: intl.string(t.emlT91)
}];
if (r3) {
r24.push({
value: ActivityFeedbackReasons.ADS,
label: a0 ? intl.string(t["5o1UL6"]) : intl.string(t.XeeDhK)
});
}
return r24;
};
+13
View File
@@ -0,0 +1,13 @@
// Metro module 10614 (f10615).
import ApplicationStore from "../applications/ApplicationStore";
export default function getShelfItemData({ applicationId, activityConfigs, applications }) {
let application = applications == null ? void 0 : applications.find((application) => application.id === applicationId);
if (application == null) {
application = ApplicationStore.getApplication(applicationId);
}
const activity = activityConfigs.find((activityConfig) => activityConfig.application_id === applicationId);
return activity == null ? null : application == null ? null : {
activity,
application
};
};
@@ -0,0 +1,24 @@
// Metro module 5689 (f5690).
import TestModeStore from "../../stores/game_store/TestModeStore";
import DeveloperActivityShelfStore from "./DeveloperActivityShelfStore";
export default function getURLForApplication(a0) {
let activityUrlOverride;
const state = DeveloperActivityShelfStore.getState();
if (state.useActivityUrlOverride && state.activityUrlOverride != null && state.activityUrlOverride !== "") {
activityUrlOverride = DeveloperActivityShelfStore.getState().activityUrlOverride;
} else if (TestModeStore.inTestModeForEmbeddedApplication(a0)) {
activityUrlOverride = TestModeStore.testModeOriginURL;
} else {
const ACTIVITY_APPLICATION_HOST = window.GLOBAL_ENV.ACTIVITY_APPLICATION_HOST;
activityUrlOverride = ACTIVITY_APPLICATION_HOST != null ? `https://${a0}.${ACTIVITY_APPLICATION_HOST}` : null;
}
return activityUrlOverride;
};
export function getNonTestModeUrlForApplication(a0) {
const ACTIVITY_APPLICATION_HOST = window.GLOBAL_ENV.ACTIVITY_APPLICATION_HOST;
return ACTIVITY_APPLICATION_HOST != null ? `https://${a0}.${ACTIVITY_APPLICATION_HOST}` : null;
}
export function isUsingDevShelfActivityUrlOverride() {
const state = DeveloperActivityShelfStore.getState();
return state.useActivityUrlOverride && state.activityUrlOverride != null && state.activityUrlOverride !== "";
}
@@ -0,0 +1,175 @@
// Metro module 10606 (f10607).
import ApplicationStore from "../applications/ApplicationStore";
import ChannelStore from "../../stores/ChannelStore";
import SelectedChannelStore from "../../stores/SelectedChannelStore";
import UserStore from "../../stores/UserStore";
import EmbeddedActivitiesStore from "./EmbeddedActivitiesStore";
import { SUPPORTED_ACTIVITY_IN_TEXT_CHANNEL_TYPES } from "./Constants";
import { wrapPreemptiveActivityPopout, shouldOpenActivityInPopoutWindow } from "./ActivityPopoutUtils.native";
import getEmbeddedActivitiesManager_native from "./utils/getEmbeddedActivitiesManager.native";
import { getEmbeddedActivityLocationChannelId } from "./utils/embeddedActivityLocationUtils";
import transitionToActivity_native from "./utils/transitionToActivity.native";
import getCachedOrFetchActivityApplicationForLaunch from "./utils/getCachedOrFetchActivityApplicationForLaunch";
import { confirmActivityLaunchChecks } from "./utils/confirmActivityLaunchChecks";
import isVoiceEmbeddedActivity from "./utils/isVoiceEmbeddedActivity";
import selectAndWaitForVoiceChannelJoin_native from "./utils/selectAndWaitForVoiceChannelJoin.native";
import { isActivitiesInTextEnabled } from "./ActivitiesInTextUtils";
import closeCustomKeyboard_native from "./utils/closeCustomKeyboard.native";
import { maybeDisconnectFromCurrentActivity, runPrimaryAppCommandOrJoinEmbeddedActivity } from "./EmbeddedActivitiesActionCreators";
let _handleJoinEmbeddedActivityInternal = function _handleJoinEmbeddedActivityInternal() {
const r8 = async (c26711_0) => {
let r88, r165, r283;
let c26711_2;
let c30239_0, c30239_1, c30239_2, c30239_3, c30239_4, c30239_5, c30239_6, c30239_7, c30239_8, c30239_9, c30239_10, c30239_11, c30239_12, c30239_13, c30239_14, c30239_15, c30239_16, c30239_17, c30239_18;
L59: {
L58: {
L48: {
L57: {
L53: {
L42: {
L37: {
L30: {
c26711_2 = void 0;
c30239_0 = void 0;
c30239_1 = void 0;
c30239_2 = void 0;
c30239_3 = void 0;
c30239_4 = void 0;
c30239_5 = void 0;
c30239_6 = void 0;
c30239_7 = void 0;
c30239_8 = void 0;
c30239_9 = void 0;
c30239_0 = c26711_0.applicationId;
c30239_1 = c26711_0.activityChannelId;
c30239_2 = c26711_0.locationObject;
c30239_3 = c26711_0.analyticsLocations;
c30239_4 = c26711_0.componentId;
c30239_5 = c26711_0.sectionName;
c30239_6 = c26711_0.source;
c30239_7 = c26711_0.inviterUserId;
c30239_8 = c26711_0.customId;
c30239_9 = c26711_0.referrerId;
c30239_10 = void 0;
c30239_11 = void 0;
c30239_12 = void 0;
c30239_13 = void 0;
c30239_14 = void 0;
c30239_15 = void 0;
c30239_16 = void 0;
c30239_17 = void 0;
c30239_18 = void 0;
await void 0;
c30239_10 = getEmbeddedActivitiesManager_native();
c30239_11 = ChannelStore.getChannel(c30239_1);
const r70 = c30239_11;
c30239_12 = r70 == null ? void 0 : r70.getGuildId();
c30239_13 = UserStore.getCurrentUser();
if (c30239_13 == null) {
break L59;
}
L13: {
if (c30239_11 != null) {
if (!(c30239_12 != null && c30239_12 !== "") && !c30239_11.isPrivate()) {
break L13;
}
if (c30239_1 != null) {
c30239_14 = EmbeddedActivitiesStore.getCurrentEmbeddedActivity();
c30239_15 = void 0;
if (c30239_14?.applicationId != null) {
c30239_15 = ApplicationStore.getApplication(c30239_14?.applicationId);
}
if (SelectedChannelStore.getVoiceChannelId() === c30239_1 && c30239_14 != null) {
if (c30239_14.applicationId === c30239_0) {
if (getEmbeddedActivityLocationChannelId(c30239_14.location) === SelectedChannelStore.getVoiceChannelId()) {
transitionToActivity_native(c30239_12, c30239_14.location);
r165 = Promise.resolve(true);
break L30;
}
}
}
c30239_16 = await getCachedOrFetchActivityApplicationForLaunch(c30239_0, c30239_1);
if (await confirmActivityLaunchChecks({
applicationId: c30239_0,
application: c30239_16,
channel: c30239_11,
currentEmbeddedApplication: c30239_15,
embeddedActivitiesManager: c30239_10,
user: c30239_13
})) {
L40: {
if (c30239_11 != null) {
c30239_17 = isVoiceEmbeddedActivity(c30239_11.id);
c30239_18 = SUPPORTED_ACTIVITY_IN_TEXT_CHANNEL_TYPES.includes(c30239_11.type);
if (!c30239_17) {
if (!isActivitiesInTextEnabled(c30239_11)) {
break L53;
}
if (c30239_18) {
break L40;
}
break L53;
}
if (!await selectAndWaitForVoiceChannelJoin_native({
channelId: c30239_11.id,
bypassChangeModal: c30239_15 != null
})) {
break L57;
}
} else if (c30239_11 == null) {
break L42;
}
}
if (c30239_1 != null) {
closeCustomKeyboard_native(c30239_1);
}
if (c30239_14 != null) {
maybeDisconnectFromCurrentActivity(c30239_14.location);
}
r283 = await runPrimaryAppCommandOrJoinEmbeddedActivity({
channelId: c30239_1,
applicationId: c30239_0,
isStart: false,
embeddedActivitiesManager: c30239_10,
analyticsLocations: c30239_3,
locationObject: c30239_2,
componentId: c30239_4,
sectionName: c30239_5,
source: c30239_6,
inviterUserId: c30239_7,
customId: c30239_8,
referrerId: c30239_9
});
break L48;
}
break L37;
}
}
}
r88 = Promise.resolve(false);
break L58;
}
return r165;
}
return false;
}
return false;
}
return false;
}
return false;
}
return r283;
}
return r88;
}
return false;
};
_handleJoinEmbeddedActivityInternal = r8;
return r8.apply(this, arguments);
};
export default function handleJoinEmbeddedActivity(c18144_0) {
return wrapPreemptiveActivityPopout(shouldOpenActivityInPopoutWindow(), () => (function handleJoinEmbeddedActivityInternal() {
return _handleJoinEmbeddedActivityInternal.apply(this, arguments);
})(c18144_0));
};
@@ -0,0 +1,147 @@
// Metro module 10640 (f10641).
import ApplicationRecord from "../../records/ApplicationRecord";
import ChannelStore from "../../stores/ChannelStore";
import GuildStore from "../../stores/GuildStore";
import PermissionStore from "../../stores/PermissionStore";
import UserStore from "../../stores/UserStore";
import VoiceStateStore from "../../stores/VoiceStateStore";
import EmbeddedActivitiesStore from "./EmbeddedActivitiesStore";
import getEmbeddedActivityJoinability, { EmbeddedActivityJoinability } from "./utils/getEmbeddedActivityJoinability";
import { showActivitiesInvalidPermissionsAlert } from "../voice_calls/showActivitiesInvalidPermissionsAlert";
import AlertActionCreators from "../../actions/AlertActionCreators";
import { intl, t } from "../../intl/index.native";
import ApplicationActionCreators from "../applications/ApplicationActionCreators";
import { getIsActivitiesEnabledForCurrentPlatform } from "./useIsActivitiesEnabledForCurrentPlatform";
import handleJoinEmbeddedActivity from "./handleJoinEmbeddedActivity";
function $mk116029($env) {
return (a0) => {
const r4 = $env;
let r1 = a0.applicationId === r4[1];
if (r1) {
const r7 = r4[2];
r1 = r7 == null || a0.launchId === r7;
}
return r1;
};
}
function $mk116030($env) {
return function handleCanJoin() {
return $env[12].apply(this, arguments);
};
}
let env7140 = {};
const handlePressJoinActivity = function handlePressJoinActivity(a0) {
L16: {
const { embeddedActivityJoinability, handleCanJoin: handleCanJoin2 } = a0;
if (EmbeddedActivityJoinability.CAN_JOIN === embeddedActivityJoinability) {
if (handleCanJoin2 != null) {
handleCanJoin2();
}
} else if (EmbeddedActivityJoinability.NO_USE_EMBEDDED_ACTIVITIES_PERMISSION === embeddedActivityJoinability) {
showActivitiesInvalidPermissionsAlert();
} else if (EmbeddedActivityJoinability.ACTIVITIES_FEATURE_NOT_ENABLED_FOR_OS === embeddedActivityJoinability) {
AlertActionCreators.show({
title: intl.string(t.PtobXW),
body: intl.string(t.UXoQTp),
hideActionSheet: false
});
} else if (EmbeddedActivityJoinability.ACTIVITY_NOT_SUPPORTED_ON_OS === embeddedActivityJoinability) {
AlertActionCreators.show({
title: intl.string(t.PtobXW),
body: intl.string(t.uGDCcw),
hideActionSheet: false
});
} else if (EmbeddedActivityJoinability.ACTIVITY_AGE_GATED === embeddedActivityJoinability) {
AlertActionCreators.show({
title: intl.string(t.PtobXW),
body: intl.string(t["4WuFRE"]),
hideActionSheet: false
});
} else {
if (EmbeddedActivityJoinability.NO_CHANNEL_CONNECT_PERMISSION !== embeddedActivityJoinability && EmbeddedActivityJoinability.CHANNEL_FULL !== embeddedActivityJoinability && EmbeddedActivityJoinability.NO_CHANNEL !== embeddedActivityJoinability && EmbeddedActivityJoinability.NO_USER !== embeddedActivityJoinability) {
break L16;
}
AlertActionCreators.show({
title: intl.string(t.PtobXW),
body: intl.string(t.FUCQco),
hideActionSheet: false
});
}
}
};
export default handlePressJoinActivity;
export async function maybeJoinEmbeddedActivity(c26769_0) {
let env30272;
const r29 = env7140;
let c26769_2 = r29;
const r10 = env30272 = {
$parent: r29
};
let c26769_1 = r10;
env30272[0] = void 0;
env30272[1] = void 0;
env30272[2] = void 0;
env30272[3] = void 0;
env30272[4] = void 0;
env30272[5] = void 0;
env30272[6] = void 0;
env30272[7] = void 0;
env30272[0] = c26769_0.channelId;
env30272[1] = c26769_0.applicationId;
env30272[2] = c26769_0.launchId;
env30272[3] = c26769_0.inputApplication;
env30272[4] = c26769_0.analyticsLocations;
env30272[5] = c26769_0.launchingComponentId;
env30272[6] = c26769_0.sectionName;
env30272[7] = c26769_0.inviterUserId;
env30272[8] = void 0;
env30272[9] = void 0;
env30272[10] = void 0;
env30272[11] = void 0;
env30272[12] = function _handleCanJoin() {
const r9 = async () => {
L11: {
if (env30272[8] != null) {
await handleJoinEmbeddedActivity({
applicationId: env30272[8].applicationId,
activityChannelId: env30272[0],
locationObject: {},
analyticsLocations: env30272[4],
componentId: env30272[5],
sectionName: env30272[6],
inviterUserId: env30272[7]
});
break L11;
}
return void 0;
}
};
env30272[12] = r9;
return r9.apply(this, arguments);
};
await void 0;
env30272[8] = EmbeddedActivitiesStore.getEmbeddedActivitiesForChannel(env30272[0]).find($mk116029(c26769_1));
env30272[9] = env30272[3];
if (env30272[9] == null) {
env30272[10] = await ApplicationActionCreators.fetchApplication(env30272[1]);
env30272[9] = ApplicationRecord.createFromServer(env30272[10]);
}
if (env30272[8] != null && env30272[9] != null) {
env30272[11] = UserStore.getCurrentUser();
const id = env30272[11]?.id;
handlePressJoinActivity({
embeddedActivityJoinability: getEmbeddedActivityJoinability({
userId: id,
application: env30272[9],
channelId: env30272[0],
currentUser: env30272[11],
isActivitiesEnabledForCurrentPlatform: getIsActivitiesEnabledForCurrentPlatform(),
ChannelStore,
VoiceStateStore,
PermissionStore,
GuildStore
}),
handleCanJoin: $mk116030(c26769_1)
});
}
}
@@ -0,0 +1,148 @@
// Metro module 10642 (f10643).
import ChannelStore from "../../stores/ChannelStore";
import UserStore from "../../stores/UserStore";
import getCachedOrFetchActivityApplicationForLaunch from "./utils/getCachedOrFetchActivityApplicationForLaunch";
import { shouldOpenActivityInPopoutWindow, wrapPreemptiveActivityPopout } from "./ActivityPopoutUtils.native";
import getEmbeddedActivitiesManager_native from "./utils/getEmbeddedActivitiesManager.native";
import { markActivityUsed } from "./DeveloperActivityShelfActionCreators";
import { runPrimaryAppCommandOrJoinEmbeddedActivity } from "./EmbeddedActivitiesActionCreators";
function $mk116031($env) {
return () => {
const r1 = $env;
const r2 = {
...r1[0],
targetApplication: r1[1]
};
return $mk118260($env.$parent)(r2);
};
}
function $mk118260($env) {
return function handleUsePrimaryEntryPointAppCommandInternal() {
return $env[8].apply(this, arguments);
};
}
let env7142 = {};
env7142[8] = function _handleUsePrimaryEntryPointAppCommandInternal() {
const r8 = async (c26771_0) => {
let r63, r125;
let c30274_0, c30274_1, c30274_2, c30274_3, c30274_4, c30274_5, c30274_6, c30274_7, c30274_8, c30274_9, c30274_10, c30274_11, c30274_12, c30274_13, c30274_14;
L19: {
L18: {
c30274_0 = void 0;
c30274_1 = void 0;
c30274_2 = void 0;
c30274_3 = void 0;
c30274_4 = void 0;
c30274_5 = void 0;
c30274_6 = void 0;
c30274_7 = void 0;
c30274_8 = void 0;
c30274_9 = void 0;
c30274_10 = void 0;
c30274_11 = void 0;
c30274_12 = void 0;
c30274_0 = c26771_0.targetApplication;
c30274_1 = c26771_0.locationObject;
c30274_2 = c26771_0.channelId;
c30274_3 = c26771_0.analyticsLocations;
c30274_4 = c26771_0.componentId;
c30274_5 = c26771_0.commandOrigin;
c30274_6 = c26771_0.sectionName;
c30274_7 = c26771_0.source;
c30274_8 = c26771_0.onExecutedCallback;
c30274_9 = c26771_0.referrerId;
c30274_10 = c26771_0.customId;
c30274_11 = c26771_0.inviterUserId;
c30274_12 = c26771_0.onConfirmActivityLaunchChecksAlertOpen;
c30274_13 = void 0;
c30274_14 = void 0;
await void 0;
c30274_13 = getEmbeddedActivitiesManager_native();
c30274_14 = UserStore.getCurrentUser();
r63 = c30274_2 != null;
if (!r63) {
break L19;
}
let r71 = ChannelStore.getChannel(c30274_2) != null;
if (r71) {
const r75 = c30274_14 != null && c30274_0 != null;
if (r75) {
markActivityUsed(c30274_0.id);
r125 = await runPrimaryAppCommandOrJoinEmbeddedActivity({
channelId: c30274_2,
applicationId: c30274_0.id,
isStart: true,
embeddedActivitiesManager: c30274_13,
componentId: c30274_4,
commandOrigin: c30274_5,
sectionName: c30274_6,
locationObject: c30274_1,
analyticsLocations: c30274_3,
source: c30274_7,
onExecutedCallback: c30274_8,
referrerId: c30274_9,
customId: c30274_10,
inviterUserId: c30274_11,
onConfirmActivityLaunchChecksAlertOpen: c30274_12
});
break L18;
}
r71 = r75;
}
r63 = r71;
break L19;
}
return r125;
}
return r63;
};
env7142[8] = r8;
return r8.apply(this, arguments);
};
export default async function handleUsePrimaryEntryPointAppCommand(c26770_0) {
let r69;
let c26770_1, c26770_2;
let c26770_3 = 0;
const r11 = env7142;
L12: {
try {
let env30273;
c26770_2 = r11;
const r26 = env30273 = {
$parent: r11
};
c26770_1 = r26;
env30273[0] = c26770_0;
env30273[1] = void 0;
env30273[2] = void 0;
if (c26770_0.targetApplicationId == null) {
break L12;
}
env30273[2] = false;
c26770_3 = 1;
env30273[1] = await getCachedOrFetchActivityApplicationForLaunch(c26770_0.targetApplicationId, c26770_0.channelId);
env30273[2] = shouldOpenActivityInPopoutWindow();
c26770_3 = 0;
r69 = wrapPreemptiveActivityPopout(env30273[2], $mk116031(c26770_1));
} catch ($e) {
let r25 = $e;
if (c26770_3 !== 0) {
while (true) {
try {
c26770_3 = 0;
} catch ($e) {
r25 = $e;
if (c26770_3 === 0) {
break;
}
continue;
}
return false;
}
}
throw r25;
}
return r69;
}
return false;
};
@@ -0,0 +1,7 @@
// Metro module 13123 (f13124).
import AuthenticationStore from "../../stores/AuthenticationStore";
export function isActivityParticipantCurrentUserCurrentSession(a0, r5 = AuthenticationStore) {
const id = r5.getId();
const sessionId = r5.getSessionId();
return a0.userId === id && (a0.sessionId == null || a0.sessionId === void 0 || a0.sessionId === sessionId);
}
@@ -0,0 +1,4 @@
// Metro module 1905 (f1906).
export default function isActivityParticipantValidGuildMember(a0) {
return a0.member != null && a0.member.joined_at != null && a0.member.user.username !== "";
};
@@ -0,0 +1,65 @@
// Metro module 15971 (f15972).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { hexWithOpacity } from "../../../utils/ColorUtils";
import Module712 from "../../../_bundle/Module712";
import useThermalState, { ThermalStates } from "../../device/useThermalState";
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
import { Text } from "../../../design/components/Text/native/Text";
const useStyles = createStyles({
container: {
position: "absolute",
top: 0,
left: 0,
backgroundColor: hexWithOpacity(Module712.unsafe_rawColors.BLACK, 0.7),
paddingRight: 16,
paddingBottom: 16
},
row: {
flexDirection: "row"
}
});
export default function ActivitiesDebugOverlay() {
const styles = useStyles();
const thermalState = useThermalState();
const UNHANDLED = ThermalStates.UNHANDLED;
let color = "text-overlay-light";
let r10 = "";
if (UNHANDLED !== thermalState) {
const NOMINAL = ThermalStates.NOMINAL;
color = "text-feedback-positive";
r10 = "nominal";
if (NOMINAL !== thermalState) {
const FAIR = ThermalStates.FAIR;
color = "text-feedback-warning";
r10 = "fair";
if (FAIR !== thermalState) {
const SERIOUS = ThermalStates.SERIOUS;
r10 = "serious";
color = "text-feedback-critical";
if (SERIOUS !== thermalState) {
const CRITICAL = ThermalStates.CRITICAL;
color = void 0;
r10 = void 0;
if (CRITICAL === thermalState) {
r10 = "critical";
color = "text-feedback-critical";
}
}
}
}
}
const safeAreaInsets_native = useSafeAreaInsets_native();
return <View style={[styles.container, {
paddingTop: safeAreaInsets_native.top + 16,
paddingLeft: safeAreaInsets_native.left + 16
}]} pointerEvents="none">
<View style={styles.row}>
<Text variant="text-md/normal" color="text-overlay-light">
thermal state:
{" "}
</Text>
<Text variant="text-md/normal" color={color}>{r10}</Text>
</View>
</View>;
};
@@ -0,0 +1,85 @@
// Metro module 11877 (f11878).
import { View } from "react-native";
import AccessibilityStore from "../../a11y/AccessibilityStore";
import { EMBEDDED_ACTIVITIES_BLOG_POST_URL } from "../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../_bundle/Module589";
import * as _ReanimatedRexport from "../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useAnimatedStyle } from "../../reanimated/ReanimatedRexport";
import * as _timing from "../../../design/animation/reanimated/timing/timing";
import { Tooltip } from "../../../design/void/native";
import { intl, t } from "../../../intl/index.native";
import { Button } from "../../../design/components/Button/native/Button.native";
const TIMING_CONFIG = {
duration: 500
};
const useStyles = createStyles({
arrow: {
marginLeft: 200,
top: 9,
position: "relative",
borderTopWidth: 0,
borderRightWidth: 0,
borderBottomWidth: 16,
borderLeftWidth: 16,
transform: [{
rotateZ: "225deg"
}]
},
tooltip: {
padding: 16
},
tooltipContainer: {
position: "absolute",
width: 280,
zIndex: 2,
right: -48,
top: -8
},
tooltipText: {
textAlign: "center",
fontSize: 14
},
closeButtonWrapper: {
marginTop: 14
}
});
const __initData = {
code: "function ActivitiesPrivateChannelCallTooltipTsx1(){const{withRepeat,withSequence,withTiming,OFFSET,translateBounceOffset,TIMING_CONFIG}=this.__closure;return{transform:[{translateY:withRepeat(withSequence(withTiming(OFFSET,{duration:0}),withTiming(OFFSET+translateBounceOffset,TIMING_CONFIG),withTiming(OFFSET,TIMING_CONFIG)),10)}]};}"
};
export default function ActivitiesPrivateChannelCallTooltip(props) {
let c19245_0;
const onClosePress = props.onClosePress;
c19245_0 = void 0;
const styles = useStyles();
const translateBounceOffset = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion) ? 0 : 4;
c19245_0 = translateBounceOffset;
const T = function T() {
return {
transform: [{
translateY: _ReanimatedRexport.withRepeat(_ReanimatedRexport.withSequence(_timing.withTiming(40, {
duration: 0
}), _timing.withTiming(40 + c19245_0, TIMING_CONFIG), _timing.withTiming(40, TIMING_CONFIG)), 10)
}]
};
};
T.__closure = {
withRepeat: _ReanimatedRexport.withRepeat,
withSequence: _ReanimatedRexport.withSequence,
withTiming: _timing.withTiming,
OFFSET: 40,
translateBounceOffset,
TIMING_CONFIG
};
T.__workletHash = 4621705591670;
T.__initData = __initData;
return <ReanimatedRexport.View style={[styles.tooltipContainer, useAnimatedStyle(T)]}>
<Tooltip containerStyle={styles.tooltip} labelStyle={styles.tooltipText} arrowStyle={[styles.arrow]} label={intl.format(t.xAW71b, {
helpdeskUrl: EMBEDDED_ACTIVITIES_BLOG_POST_URL
})} title={intl.string(t.HOPqzR)}>
<View style={styles.closeButtonWrapper}>
<Button text={intl.string(t["NX+WJN"])} onPress={onClosePress} variant="secondary" size="sm" grow />
</View>
</Tooltip>
</ReanimatedRexport.View>;
};
@@ -0,0 +1,90 @@
// Metro module 10651 (f10652).
import Module8531, { Path, Defs, LinearGradient, Stop } from "../../../_bundle/Module8531";
export default function SvgComponent(props) {
return <Module8531 width={324} height={227} fill="none" {...props}>
<Path fill="#5865F2" d="m180.747 219.024 29.309.136s-13.284-17.969-30.586-3.674a2.005 2.005 0 0 0-.598 2.215 2.006 2.006 0 0 0 1.875 1.323ZM279.165 161.961l20.489 16.006a2.122 2.122 0 0 1-.058 3.413 2.13 2.13 0 0 1-1.238.397c-6.35-.045-16.711-1.75-23.911-11.113l4.718-8.703Z" />
<Path fill="#242145" d="m190.667 112.195-2.682 37.96a138.277 138.277 0 0 0 .097 20.736s.279 37.15 3.564 39.126c6.765.959 13.802 9.143 13.802 9.143h9.895a2.08 2.08 0 0 0 1.509-.643 2.073 2.073 0 0 0 .578-1.534l-.246-5.333-2.806-60.621 23.892 34.072a8.718 8.718 0 0 0 9.02 3.467l30.054-6.648a2.896 2.896 0 0 0 2.236-2.495l2.086-18.792a1.985 1.985 0 0 0-1.475-2.138 1.984 1.984 0 0 0-.935-.014l-27.988 6.293-20.865-27.398a7.256 7.256 0 0 1-1.257-6.26c.991-3.654 1.723-9.895-2.294-15.467l-36.185-3.454Z" />
<Path fill="url(#a)" d="M203.738 112.24c-10.264 46.727 8.242 106.92 8.242 106.92h-4.419c-17.386-53.11-7.329-107.568-7.329-108.19l3.506 1.27Z" />
<Path fill="#000" d="m245.41 73.425 30.126 4.095a3.057 3.057 0 0 1 2.541 3.86 3.057 3.057 0 0 1-.915 1.46c-3.24 2.839-8.56 5.457-16.323 2.67l4.322 3.61a2.41 2.41 0 0 1 .793 2.5 2.416 2.416 0 0 1-1.953 1.75c-3.35.474-8.339-.388-13.841-6.693l-.35 2.637a3.06 3.06 0 0 1-4.536 2.274 16.336 16.336 0 0 1-7.458-8.89 7.04 7.04 0 0 1 4.075-8.844 7.043 7.043 0 0 1 3.519-.429Z" />
<Path fill="#8CD9FF" d="m192.968 47.66-.136-3.052c2.249-1.587 2.139-6.033 2.139-6.033l-16.2-.382c.11 3.836 3.622 6.195 3.622 6.195l.039 3.493s-.11 15.889 9.908 23.84l12.312-5.664s-10.485-5.987-11.684-18.397Z" />
<Path fill="#29CC7A" d="m192.968 47.66-.136-3.052c2.249-1.587 2.139-6.033 2.139-6.033l-16.2-.382c.11 3.836 3.622 6.195 3.622 6.195l.039 3.493s-.11 15.889 9.908 23.84l12.312-5.664s-10.485-5.987-11.684-18.397Z" />
<Path fill="#91FFAD" d="M194.082 52.857a16.847 16.847 0 0 0-9.24 7.99 30.555 30.555 0 0 0 1.743 3.888c1.944-4.912 6.422-7.594 8.819-8.728a23.45 23.45 0 0 1-1.322-3.15Z" />
<Path fill="#8CD9FF" d="m192.968 47.66-.136-3.052c2.249-1.587 2.139-6.033 2.139-6.033l-16.2-.382c.11 3.836 3.622 6.195 3.622 6.195l.039 3.493c.105 4.423.928 8.8 2.436 12.96a16.846 16.846 0 0 1 9.241-7.99 23.063 23.063 0 0 1-1.141-5.19Z" />
<Path fill="#8CD9FF" d="M195.696 35.73c-1.549 2.852-1.445 5.496-3.065 5.107-1.737-.421-2.003-4.082-.454-6.927 1.549-2.845 4.834-4.692 6.059-3.39 1.225 1.303-1.024 2.366-2.54 5.21ZM262.246 136.553l.732 16.66c0 3.065-.732 5.067-3.052 7.018a25.312 25.312 0 0 1-5.437 3.739l12.027-2.702v-24.624l-4.27-.091Z" />
<Path fill="#8CD9FF" d="m265.408 137.914 8.34 13.608 14.904-5.703a1.837 1.837 0 0 1 2.033.492c.165.185.292.401.371.636l1.562 4.646a.698.698 0 0 0 1.03.343.7.7 0 0 0 .266-.311c.745-1.944 2.261-4.685 5.067-5.637a.7.7 0 0 0 .071-1.296l-7.426-3.311a1.791 1.791 0 0 0-1.296-.065l-15.202 6.732-5.495-11.553-4.225 1.419Z" />
<Path fill="url(#b)" d="M213.976 56.61a18.402 18.402 0 0 0 14.853 2.242 10.256 10.256 0 0 1 12.026 5.106c3.299 6.668 3.156 20.12-12.461 47.181l-1.542 4.484-36.184-3.428-.596-6.908c-5.832-9.843-1.899-19.88 2.145-23.075l21.759-25.603" />
<Path fill="#5865F2" d="m240.519 67.165 35.892-12.046a3.81 3.81 0 0 1 4.75 5.041c-2.015 4.945-6.551 10.815-16.757 11.982l6.817 1.646a3.021 3.021 0 0 1 1.05 5.391c-3.474 2.378-9.526 4.167-19.142.156l1.062 3.136c.862 2.553-1.14 4.633-3.803 5.041-3.163.48-9.468-.959-12.649-6.227-6.532-10.802-3.415-12.04 2.78-14.12Z" />
<Path fill="#3442D9" d="M69.277 30.184s30.897 30.994 67.263 6.143c0 0-19.622 84.765 8.314 146.059 0 0-28.979-12.493-42.846-49.384 0 0-12.033 19.971-13.2 47.641 0 0-34.415-53.486-19.53-150.46Z" />
<Path fill="url(#c)" d="M132.879 163.477s-19.531-32.581-2.975-123.184c-23.386 12.033-43.72 2.268-53.849-4.653a23.975 23.975 0 0 1-2.183-1.484c-2.275 18.43-6.428 80.657 12.409 122.258 0 0 3.402-22.498 17.269-36.89.026 0 11.275 32.445 29.329 43.953Z" />
<Path fill="#91FFAD" d="M190.071 105.287s13.738 7.938 38.323 5.832l-1.542 4.484s-17.943 2.592-36.185-3.428l-.596-6.888Z" />
<Path fill="#3442D9" d="M87.596 175.329s-9.13 21.255 3.24 20.678a7.99 7.99 0 0 0 4.362-1.445c2.844-2.106 5.631-7.387-7.602-19.233ZM141.037 178.103s1.471 23.082 12.234 16.977a7.89 7.89 0 0 0 3.24-3.24c1.601-3.188 1.685-9.162-15.474-13.737Z" />
<Path fill="url(#d)" d="m248.482 183.851 31.33-6.48.804-7.252-30.417 8.956a8.706 8.706 0 0 1-9.416-3.124l-27.216-35.601.448 5.23 25.66 34.895a8.726 8.726 0 0 0 3.907 2.982 8.728 8.728 0 0 0 4.9.394Z" />
<Path fill="#000" d="M256.057 82.659a.976.976 0 0 1-.421-.097 40.245 40.245 0 0 1-5.729-3.558.975.975 0 0 1-.194-1.36.973.973 0 0 1 1.361-.195 39.139 39.139 0 0 0 5.404 3.363.976.976 0 0 1 .524 1.091.972.972 0 0 1-.945.756Z" />
<Path fill="#EB459F" d="M242.488 14.684c-.059.22 8.288-8.651 1.03-11.14-7.258-2.488.959 4.07-1.03 11.14Z" />
<Path fill="#EB459F" d="M242.397 14.509s9.202-11.38 15.838-3.713c6.635 7.665-9.111.687-15.838 3.713Z" />
<Path fill="url(#e)" d="M223.016 61.203c11.849 0 21.455-9.605 21.455-21.455 0-11.85-9.606-21.455-21.455-21.455-11.85 0-21.455 9.606-21.455 21.455 0 11.85 9.605 21.456 21.455 21.456Z" />
<Path fill="#EB459F" d="M254.534 41.57s6.889 11.436-.414 15.454c-15.481 8.424-19.019-20.004-19.019-20.004-11.988 19.291-13.012-14.074-13.012-14.074s-28.784 5.637-22.771-11.282c0 0 3.474-8.534 14.84-.356 0 0 3.59 3.272 10.419-.227 9.131-4.685 21.929-1.523 24.469 11.016 0 0 2.644 10.09 13.064 9.201 10.419-.887 4.412 19.706-7.576 10.271Z" />
<Path fill="#000" d="M218.175 38.575c-.7-.53-1.497-.919-2.345-1.147a6.975 6.975 0 0 0-7.867 3.189 7.461 7.461 0 0 1-3.83-.525.97.97 0 0 0-1.389 1.08.97.97 0 0 0 .404.592c1.23.61 2.594.9 3.966.842h.058a6.997 6.997 0 0 0 4.958 8.314c.363.098.734.167 1.108.207h.11a.97.97 0 0 0 1.02-.923.973.973 0 0 0-.923-1.02 5.053 5.053 0 0 1-4.479-4.389 5.046 5.046 0 0 1 2.516-5.02 4.995 4.995 0 0 1 3.836-.487 5.059 5.059 0 0 1 1.698.83.97.97 0 0 0 1.575-.518.973.973 0 0 0-.416-1.038v.013ZM212.959 30.456c.985-1.063 1.84-1.555 1.464-2.184-.479-.784-2.436.11-3.622 1.653-1.069 1.393-1.445 3.24-.862 3.784h.032c.558.473 1.64-.5 3.351-.953 1.892-.499 3.278 0 3.343-1.043.065-1.043-1.885-1.633-3.706-1.257Z" />
<Path fill="url(#f)" d="M202.091 33.696a1.807 1.807 0 0 0-1.25.402 7.946 7.946 0 0 1-5.45 1.691L73.931 24.624a56.118 56.118 0 0 1-22.15-6.817L36.69 9.383a5.787 5.787 0 0 0-7.776 2.048c-5.184 8.612-3.713 17.95-1.945 23.69a5.83 5.83 0 0 0 7.375 3.765l15.947-5.365a56.099 56.099 0 0 1 23.03-2.696l120.528 11.062a7.662 7.662 0 0 1 5.586 3.35 2.006 2.006 0 0 0 1.445.991c1.665.162 3.285-2.514 3.622-5.974.337-3.46-.739-6.39-2.411-6.558Z" />
<Path fill="#000" d="M36.937 24.277c.476-6.543-1.135-11.992-3.598-12.17-2.463-.18-4.845 4.979-5.321 11.521-.476 6.543 1.135 11.992 3.598 12.171 2.462.18 4.845-4.98 5.32-11.522Z" />
<Path fill="#8CD9FF" d="M179.982 28.862c-1.944-.26-3.356 1.983-2.903 3.888.571 2.398 1.944 5.249 5.139 6.013 1.569.37 3.171.574 4.782.61a6.96 6.96 0 0 0 7.083-6.001c.253-1.866.123-4.432-2.262-4.121-6.292.823-6.123.362-11.839-.39Z" />
<Path fill="#57F287" d="M212.414 58.463c-11.56-4.62-17.865 11.268-17.865 11.268-15.753-9.622-21.384-25.92-21.384-25.92l-.111-1.691a14.975 14.975 0 0 1 .098-3.188 20.99 20.99 0 0 0-.136-7.44 4.933 4.933 0 0 0-2.315-3.124 4.925 4.925 0 0 0-3.861-.472l-.939.273a11.365 11.365 0 0 1-4.692.324l-1.801-.247a4.34 4.34 0 0 0-3.475 1.04 4.33 4.33 0 0 0-1.47 3.316c.059 7.516 6.817 15.778 6.817 15.778s8.385 44.77 31.506 42.71c27.495-2.457 29.251-28.772 19.628-32.627Z" />
<Path fill="#91FFAD" d="M177.351 52.183c-5.832 3.059-9.02 10.699-10.407 14.982a80.718 80.718 0 0 0 2.242 5.048c1.886-8.903 8.055-13.977 10.958-15.908a50.157 50.157 0 0 1-2.793-4.122Z" />
<Path fill="#29CC7A" d="M209.654 86.832a.81.81 0 0 1-.512-1.439c7.212-5.76 8.722-14.288 8.735-14.372a.814.814 0 0 1 .933-.668.81.81 0 0 1 .667.933 27.116 27.116 0 0 1-9.318 15.37.783.783 0 0 1-.505.176Z" />
<Path fill="#8CD9FF" d="M173.054 42.12a14.975 14.975 0 0 1 .098-3.188 20.99 20.99 0 0 0-.136-7.44 4.933 4.933 0 0 0-2.315-3.124 4.925 4.925 0 0 0-3.861-.472l-.939.273a11.365 11.365 0 0 1-4.692.324l-1.801-.247a4.34 4.34 0 0 0-3.475 1.04 4.33 4.33 0 0 0-1.47 3.316c.059 7.516 6.817 15.778 6.817 15.778a110.157 110.157 0 0 0 5.651 18.792c1.387-4.284 4.588-11.923 10.407-14.982a47.609 47.609 0 0 1-4.154-8.353l-.13-1.717Z" />
<Path fill="#3F99F2" d="M184.032 39.113a19.099 19.099 0 0 1-.693-6.09.816.816 0 0 0-.458-.778.808.808 0 0 0-.307-.078.805.805 0 0 0-.855.758c-.086 1.96.095 3.921.538 5.832.596.162 1.186.266 1.775.356ZM189.216 39.074a19.622 19.622 0 0 1-.57-5.65.812.812 0 0 0-.758-.91.807.807 0 0 0-.793.495.818.818 0 0 0-.063.324c-.09 2.028.104 4.059.577 6.033a7.323 7.323 0 0 0 1.607-.292Z" />
<Path fill="#000" d="m266.516 136.65-4.27-.097.376 8.573c1.069.266 2.21.084 3.888-.421l.006-8.055Z" />
<Path fill="#000" d="m269.627 136.469-4.219 1.445 3.921 6.389a6.62 6.62 0 0 0 3.7-.687l-3.402-7.147Z" />
<Path fill="#EB459F" d="m272.893 101.036 2.592-4.043a3.882 3.882 0 0 1 4.197-1.71c.524.126 1.017.36 1.447.686l2.592 1.944a1 1 0 0 1-.875 1.756l-2.041-.583a5.346 5.346 0 0 0-3.467.175l-4.445 1.775Z" />
<Path fill="url(#g)" d="M260.832 108.125s-16.031-1.367-13.983 15.688c2.047 17.056 39.884 27.54 48.431-8.359 2.56-10.744-15.688-.168-15.688-.168s.68-31.208-18.76-7.161Z" />
<Path fill="url(#h)" d="m263.678 106.499-3.033-.875a22.842 22.842 0 0 1-8.294-4.536l-5.741-4.886a1.887 1.887 0 0 0-2.489 0c-3.492 3.175-3.376 7.854-2.987 10.368a1.877 1.877 0 0 0 2.106 1.568l7.271-.926a22.865 22.865 0 0 1 9.409.764l3.032.901a1.298 1.298 0 0 0 1.581-.868 1.294 1.294 0 0 0-.855-1.51Z" />
<Path fill="#000" d="M245.891 103.128c.766-2.724.543-5.17-.498-5.463-1.041-.293-2.506 1.679-3.272 4.403-.766 2.725-.544 5.171.497 5.463 1.041.293 2.506-1.678 3.273-4.403Z" />
<Path fill="#5865F2" d="M288.528 118.94c.707 1.296-.557 3.305-2.592 4.88-1.814 5.722-4.892 6.732-6.875 7.342-2.644.803-6.311.337-7.951-2.631-1.639-2.968-1.166-6.37 2.022-8.126 3.188-1.756 13.763-4.413 15.396-1.465Z" />
<Path fill="#000" d="M268.408 108.404a.969.969 0 0 1-.863-.527.978.978 0 0 1 .073-1.009c.097-.13 2.384-3.298 6.395-2.702a.993.993 0 0 1 .362.128.98.98 0 0 1 .339 1.348.981.981 0 0 1-.986.468 4.947 4.947 0 0 0-4.536 1.912.963.963 0 0 1-.784.382ZM285.956 123.82c-2.184 1.49-5.236 1.393-5.269 1.393a.958.958 0 0 0-1.01.927.96.96 0 0 0 .257.699.985.985 0 0 0 .676.312h.246a13.118 13.118 0 0 0 3.979-.648c.456-.858.832-1.756 1.121-2.683Z" />
<Path fill="#91FFAD" d="M40.824 159.168a10.869 10.869 0 0 1-4.931-7.646l-.817-5.34a.57.57 0 0 0-.175-.337.493.493 0 0 0-.35-.148.495.495 0 0 0-.35.148.61.61 0 0 0-.174.337l-.817 5.34a11.017 11.017 0 0 1-4.931 7.646l-.706.447a.564.564 0 0 0-.169.707.54.54 0 0 0 .169.194l.706.447a11.026 11.026 0 0 1 4.931 7.647l.817 5.339a.53.53 0 0 0 1.05 0l.816-5.339c.225-1.553.78-3.04 1.626-4.362a10.88 10.88 0 0 1 3.305-3.285l.706-.447a.538.538 0 0 0 .227-.447.556.556 0 0 0-.227-.454l-.706-.447Z" />
<Path fill="#8CD9FF" d="M155.229 119.796a8.415 8.415 0 0 1-2.545-2.534 8.415 8.415 0 0 1-1.259-3.363l-.648-4.115a.42.42 0 0 0-.136-.259.36.36 0 0 0-.269-.116.367.367 0 0 0-.269.116.42.42 0 0 0-.136.259l-.648 4.115a8.562 8.562 0 0 1-3.804 5.897l-.544.343a.342.342 0 0 0-.13.156.435.435 0 0 0 0 .388.361.361 0 0 0 .13.149l.544.344a8.563 8.563 0 0 1 3.804 5.903l.648 4.115a.423.423 0 0 0 .136.246.406.406 0 0 0 .266.097.41.41 0 0 0 .272-.097.423.423 0 0 0 .136-.246l.648-4.115a8.504 8.504 0 0 1 1.257-3.369 8.432 8.432 0 0 1 2.547-2.534l.544-.344a.348.348 0 0 0 .13-.149.422.422 0 0 0 .045-.194.383.383 0 0 0-.045-.194.336.336 0 0 0-.13-.156l-.544-.343Z" />
<Path fill="#FF78B9" d="M306.31 106.343a8.555 8.555 0 0 1-2.547-2.533 8.377 8.377 0 0 1-1.251-3.364l-.648-4.114a.392.392 0 0 0-.136-.26.413.413 0 0 0-.265-.116.438.438 0 0 0-.273.116.411.411 0 0 0-.129.26l-.648 4.114a8.597 8.597 0 0 1-1.264 3.357 8.463 8.463 0 0 1-2.54 2.54l-.544.344a.398.398 0 0 0-.13.149.435.435 0 0 0-.045.201.422.422 0 0 0 .045.194c.03.06.075.111.13.149l.544.343a8.51 8.51 0 0 1 3.804 5.897l.648 4.115a.397.397 0 0 0 .402.35.408.408 0 0 0 .265-.097.417.417 0 0 0 .136-.253l.648-4.115a8.378 8.378 0 0 1 1.251-3.363 8.559 8.559 0 0 1 2.547-2.534l.55-.343a.476.476 0 0 0 .13-.149.42.42 0 0 0 .039-.194.433.433 0 0 0-.039-.201.476.476 0 0 0-.13-.149l-.55-.344ZM48.302 84.694a8.458 8.458 0 0 1-2.54-2.534 8.289 8.289 0 0 1-1.258-3.363l-.648-4.115a.414.414 0 0 0-.13-.26.446.446 0 0 0-.271-.116.402.402 0 0 0-.266.117.395.395 0 0 0-.136.259l-.648 4.115a8.521 8.521 0 0 1-3.797 5.897l-.551.343a.48.48 0 0 0-.13.15.364.364 0 0 0-.039.2.35.35 0 0 0 .04.194.48.48 0 0 0 .129.15l.55.343a8.605 8.605 0 0 1 2.534 2.54 8.495 8.495 0 0 1 1.296 3.357l.648 4.114a.408.408 0 0 0 .804 0l.648-4.114a8.289 8.289 0 0 1 1.257-3.364 8.458 8.458 0 0 1 2.54-2.533l.55-.344a.48.48 0 0 0 .13-.149.35.35 0 0 0 .04-.194.362.362 0 0 0-.04-.2.48.48 0 0 0-.13-.15l-.582-.343Z" />
<Path fill="#FFE75C" d="M58.222 139.275a7.139 7.139 0 0 1-3.24-5.042l-.55-3.512a.366.366 0 0 0-.117-.22.315.315 0 0 0-.355-.071.309.309 0 0 0-.105.071.366.366 0 0 0-.117.22l-.538 3.512a7.296 7.296 0 0 1-3.24 5.042l-.466.291a.355.355 0 0 0-.11.13.374.374 0 0 0 0 .33.355.355 0 0 0 .11.13l.466.298a7.128 7.128 0 0 1 2.165 2.171c.56.866.93 1.843 1.082 2.864l.538 3.512a.37.37 0 0 0 .116.214.358.358 0 0 0 .46 0 .371.371 0 0 0 .117-.214l.538-3.512a7.125 7.125 0 0 1 3.24-5.035l.466-.298a.355.355 0 0 0 .11-.13.374.374 0 0 0 0-.33.355.355 0 0 0-.11-.13l-.46-.291Z" />
<Path fill="#fff" d="M88.341 88.128c-1.367 1.374-1.82 6.713-1.82 6.713s5.346-.447 6.72-1.814a3.48 3.48 0 0 0 1.004-2.3H90.66v-3.59c-.87.029-1.697.382-2.32.99Z" />
<Path fill="#fff" fillRule="evenodd" d="m90.292 83.8 7.284 7.276 1.82-1.82 1.368 5.922 2.274-2.28v-7.284l4.536-4.536c1.821-1.821 5.463-6.195 3.642-10.925-4.737-1.821-9.072 1.82-10.925 3.641L90.292 83.8Zm14.34-4.485a2.59 2.59 0 0 0 1.833-4.425 2.59 2.59 0 0 0-3.988.393 2.59 2.59 0 0 0 2.155 4.032Z" clipRule="evenodd" />
<Path fill="#fff" d="M95.755 78.33H88.47l-2.287 2.281 5.916 1.361 3.655-3.642Z" />
<Path fill="#29CC7A" d="M199.098 71.28h.071a.81.81 0 1 0 .065-1.62 10.545 10.545 0 0 1-3.986-1.458c-.408.803-.648 1.348-.686 1.47a11.822 11.822 0 0 0 4.536 1.608Z" />
<Path fill="#000" d="m268.92 73.224-4.498-1.089a11.725 11.725 0 0 1-3.816-.37.974.974 0 0 0-1.136 1.347c.104.225.29.402.52.494 1.203.353 2.453.522 3.707.5a16.275 16.275 0 0 0 5.074-.824c.05-.016.1-.036.149-.058Z" />
<Defs>
<LinearGradient id="a" x1={204.665} x2={204.665} y1={110.97} y2={219.147} gradientUnits="userSpaceOnUse">
<Stop stopColor="#FFE75C" />
<Stop offset={1} stopColor="#FFC619" />
</LinearGradient>
<LinearGradient id="b" x1={221.642} x2={205.481} y1={54.413} y2={125.699} gradientUnits="userSpaceOnUse">
<Stop offset={0.24} stopColor="#57F287" />
<Stop offset={0.66} stopColor="#29CC7A" />
</LinearGradient>
<LinearGradient id="c" x1={102.364} x2={102.364} y1={163.477} y2={34.156} gradientUnits="userSpaceOnUse">
<Stop offset={0.29} stopColor="#5865F2" />
<Stop offset={0.51} stopColor="#5D6AF4" />
<Stop offset={0.76} stopColor="#6C77F8" />
<Stop offset={1} stopColor="#808AFF" />
</LinearGradient>
<LinearGradient id="d" x1={247.101} x2={247.101} y1={140.357} y2={184.032} gradientUnits="userSpaceOnUse">
<Stop stopColor="#FFE75C" />
<Stop offset={1} stopColor="#FFC619" />
</LinearGradient>
<LinearGradient id="e" x1={223.016} x2={223.016} y1={61.203} y2={18.287} gradientUnits="userSpaceOnUse">
<Stop stopColor="#66BCFF" />
<Stop offset={1} stopColor="#8CD9FF" />
</LinearGradient>
<LinearGradient id="f" x1={114.955} x2={114.955} y1={8.677} y2={46.235} gradientUnits="userSpaceOnUse">
<Stop stopColor="#FFE75C" />
<Stop offset={1} stopColor="#FFC619" />
</LinearGradient>
<LinearGradient id="g" x1={268.375} x2={279.113} y1={107.996} y2={148.729} gradientUnits="userSpaceOnUse">
<Stop offset={0.24} stopColor="#57F287" />
<Stop offset={0.66} stopColor="#29CC7A" />
</LinearGradient>
<LinearGradient id="h" x1={252.766} x2={252.766} y1={95.755} y2={108.987} gradientUnits="userSpaceOnUse">
<Stop stopColor="#FFE75C" />
<Stop offset={1} stopColor="#FFC619" />
</LinearGradient>
</Defs>
</Module8531>;
};
@@ -0,0 +1,58 @@
// Metro module 16175 (f16176).
import { ActivityFeedbackReasons } from "../Constants";
import { AnalyticEvents } from "../../../Constants";
import { FeedbackType } from "../../feedback/Constants";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import getActivityReportOptions from "../getActivityReportOptions";
import FeedbackActionSheet from "../../feedback/native/FeedbackActionSheet";
import { intl, t } from "../../../intl/index.native";
import { processOptOut } from "../../feedback/FeedbackUtils";
import { presentFeedbackSent } from "../../toast/native/ToastUtils";
import trackActivityProblem from "../trackActivityProblem";
const feedbackReasons = [ActivityFeedbackReasons.OTHER, ActivityFeedbackReasons.ADS, ActivityFeedbackReasons.NOT_FUN];
export default function ActivityFeedbackActionSheet(props) {
const { activityApplication, channel, embeddedActivityLocation, analyticsData } = props;
const activityReportOptions = getActivityReportOptions(true, activityApplication.embeddedActivityConfig?.displays_advertisements === true);
return <FeedbackActionSheet headerLabel={intl.formatToPlainString(t.QXYwoD, {
applicationName: activityApplication.name
})} showHeaderCloseButton ratingsBodyLabel={intl.string(t["9hk2KF"])} reasonsHeaderLabel={intl.string(t.g1q5fr)} reasons={activityReportOptions} feedbackReasons={feedbackReasons} otherKey={ActivityFeedbackReasons.OTHER} trackOpen={() => {
AnalyticsUtils.track(AnalyticEvents.OPEN_POPOUT, {
type: "Activity Feedback Sheet",
application_id: activityApplication.id,
application_name: activityApplication.name,
game_id: activityApplication.id,
source: "Activity End"
});
}} trackReport={function trackReport(a0) {
const { rating, reason } = a0;
let feedback = a0.feedback;
const dontShowAgain = a0.dontShowAgain;
const problem = reason != null ? reason.value : null;
if (dontShowAgain) {
AnalyticsUtils.track(AnalyticEvents.ACTIVITY_REPORT_DONT_SHOW, {
application_id: activityApplication.id,
rating
});
processOptOut({
feedbackType: FeedbackType.ACTIVITY,
location: "ActivityFeedbackActionSheet"
});
}
if (rating != null) {
presentFeedbackSent();
if (feedback == null) {
feedback = "";
}
trackActivityProblem({
problem,
channel,
embeddedActivityLocation,
feedback,
activityApplication,
analyticsData,
location: "Activity End",
rating
});
}
}} />;
};
@@ -0,0 +1,178 @@
// Metro module 13543 (f13544).
import _asyncToGenerator from "../../../_bundle/_asyncToGenerator";
import { useMemo, useState, useCallback, useEffect } from "react";
import { View } from "react-native";
import "../../../stores/ChannelStore";
import UserStore from "../../../stores/UserStore";
import EmbeddedActivitiesStore from "../EmbeddedActivitiesStore";
import { UserRowModes } from "../../main_tabs_v2/native/shared_components/user_list/UserRowConstants";
import "../../messages/MessageConstants";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useStateFromStores } from "../../../_bundle/Module589";
import { getDestinationIdFromChannelId, getOrResolveChannelIdFromDestinationId } from "../../share/formatResults";
import { getActivityLaunchURL } from "../../applications/getApplicationInstallURL";
import { closeActivityShareLinkModal } from "../openActivityShareLinkModal.native";
import useGetOrFetchApplications from "../../applications/useGetOrFetchApplications";
import { isNotNullish } from "../../../utils/GlobalUtils";
import { resolveActivityShareMessageContent } from "../utils/activityShareLink";
import ToastActionCreators from "../../toast/native/ToastActionCreators";
import { intl, t } from "../../../intl/index.native";
import { copy } from "../../../utils/ClipboardUtils.native";
import { presentLinkCopied } from "../../toast/native/ToastUtils";
import useWindowDimensions_native from "../../screen/useWindowDimensions.native";
import { isAndroid, isIOS } from "../../../utils/PlatformUtils";
import { Header } from "../../../_bundle/Module5150";
import { GenericHeaderTitle } from "../../main_tabs_v2/native/shared_components/HeaderShared";
import { getHeaderCloseButton } from "../../../design/components/Navigator/native/NavigatorHeader.native";
import { HeaderActionButton } from "../../../design/components/Navigator/native/HeaderActionButton.native";
import { LinkIcon } from "../../../design/components/Icon/native/redesign/generated/LinkIcon";
import ThemedGradient from "../../client_themes/native/ThemedGradient";
import SearchableDestinationList from "../../share/native/SearchableDestinationList";
import { ModalFloatingAction } from "../../../design/components/Modal/native/ModalFloatingAction.native";
function $mk116535($env) {
return function() {
let env31689 = {
$parent: $env
};
env31689[0] = (0, _asyncToGenerator)(function*(c32047_0) {
L11: {
const r30 = env31689.$parent.$parent;
const channel = r30[7].getChannel(c32047_0);
if (channel != null) {
const r16 = r30[1];
const r32 = r30[2];
yield r16(r32[19]).sendMessage(c32047_0, r16(r32[20]).parse(channel, env31689.$parent[1]), false, {
location: r30[11].ACTIVITY_SHARE
});
break L11;
}
return void 0;
}
});
return function() {
return env31689[0].apply(this, arguments);
};
};
}
let env9402 = {};
const useStyles = createStyles({
headerContainer: {
paddingHorizontal: Module712.space.PX_16,
paddingVertical: Module712.space.PX_8,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER
},
header: {
borderBottomWidth: 0,
shadowColor: "transparent",
backgroundColor: "transparent"
},
container: {
flex: 1,
display: "flex",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER
}
});
export default function ActivityShareLinkModal(props) {
let setState, state, setState2, state2, setState3, stateFromStores2, state3, setState4, c20523_14, callback, height;
const { applicationId, customId, linkId, message, onShare } = props;
setState = void 0;
state = void 0;
setState2 = void 0;
state2 = void 0;
setState3 = void 0;
stateFromStores2 = void 0;
state3 = void 0;
setState4 = void 0;
c20523_14 = void 0;
callback = void 0;
height = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([EmbeddedActivitiesStore], () => EmbeddedActivitiesStore.getConnectedActivityChannelId());
const memo = useMemo(() => stateFromStores != null ? getDestinationIdFromChannelId(stateFromStores) : void 0, [stateFromStores]);
let disabled;
[disabled, setState] = useState(false);
[state, setState2] = useState(false);
[state2, setState3] = useState([]);
const length = state2.length;
const callback2 = useCallback((a0) => {
setState3(a0);
}, []);
stateFromStores2 = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
[state3, setState4] = useState("");
useEffect(() => {
setState4(getActivityLaunchURL({
applicationId,
referrerId: stateFromStores2?.id,
customId,
linkId
}));
}, [applicationId, stateFromStores2, customId, linkId, setState4]);
const callback3 = useCallback(() => {
onShare(false, state);
closeActivityShareLinkModal();
}, [state, onShare]);
const [r78] = useGetOrFetchApplications([applicationId]);
c20523_14 = r78;
const callback4 = useCallback(async () => {
let c27500_0, c27500_1;
L13: {
let env30638;
c27500_1 = void 0;
const r9 = env30638 = {
$parent: env9402
};
c27500_0 = r9;
env30638[0] = void 0;
env30638[1] = void 0;
if (c20523_14 != null) {
const r48 = await Promise.all(state2.map(getOrResolveChannelIdFromDestinationId));
const r56 = c27500_0;
env30638[0] = r48.filter(isNotNullish);
env30638[1] = resolveActivityShareMessageContent(message, c20523_14, state3);
(0, setState)(true);
env30638[0].forEach($mk116535(r56)());
ToastActionCreators.open({
key: "ACTIVITY_SHARE_LINK_SUCCESS",
content: intl.formatToPlainString(t.jQULqL, {
applicationName: c20523_14.name
})
});
(0, onShare)(true, state);
closeActivityShareLinkModal();
break L13;
}
return void 0;
}
}, [r78, state, state3, message, onShare, state2]);
callback = useCallback(() => {
copy(state3);
setState2(true);
presentLinkCopied();
}, [state3]);
height = useWindowDimensions_native({
ignoreKeyboard: true
}).height;
const memo2 = useMemo(() => ({
height: isAndroid() ? height : "100%"
}), [height]);
return <View style={memo2}>
<View style={styles.headerContainer}>
<Header headerStyle={styles.header} title={intl.string(t.r9qKow)} headerTitle={(a0) => (0, jsx)(GenericHeaderTitle, {
title: a0.children,
subtitle: message,
variant: "redesign/heading-18/bold"
})} headerLeft={getHeaderCloseButton(callback3)} headerRight={function headerRight(a0) {
return <HeaderActionButton {...a0} onPress={callback} accessibilityLabel={intl.string(t.Xrt5Po)} IconComponent={LinkIcon} />;
}} headerStatusBarHeight={isIOS() ? 0 : void 0} headerTitleAlign="center" />
</View>
<View style={styles.container}>
<ThemedGradient absolute />
<SearchableDestinationList disableGradient disableStickySections initialSelectedDestinations={[]} insetEnd={0} onSelectedDestinationChange={callback2} originDestination={memo} rowMode={UserRowModes.TOGGLE} />
<ModalFloatingAction disabled={disabled} floatingBackgroundColor={styles.container.backgroundColor} isVisible={length > 0} loading={disabled} onPress={disabled ? void 0 : callback4} text={length === 1 ? intl.string(t.TXNS7S) : intl.formatToPlainString(t.jWtYUm, {
count: length
})} />
</View>
</View>;
};
@@ -0,0 +1,59 @@
// Metro module 11259 (f11260).
import { View } from "react-native";
import { Fonts } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { generateBoxShadowStyle, FOUR_DP_ELEVATION_SHADOW_PARAMS } from "../../../design/void/native";
import { EmbeddedActivityLabelTypes } from "../../../flow/Server";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
const useStyles = createStyles({
badge: {
position: "absolute",
top: 4,
right: 4,
display: "flex",
flexDirection: "row",
alignItems: "center",
backgroundColor: Module712.colors.STATUS_POSITIVE_BACKGROUND
},
newBadge: {
paddingLeft: 4,
paddingRight: 6,
borderRadius: Module712.radii.sm,
height: 16,
backgroundColor: Module712.colors.BADGE_NOTIFICATION_BACKGROUND
},
updatedBadge: {
paddingLeft: 4,
paddingRight: 6,
borderRadius: Module712.radii.sm,
height: 16,
backgroundColor: Module712.colors.BADGE_BACKGROUND_BRAND
},
elevationShadow: generateBoxShadowStyle(FOUR_DP_ELEVATION_SHADOW_PARAMS),
badgeText: {
textTransform: "uppercase",
marginLeft: 2,
fontFamily: Fonts.DISPLAY_EXTRABOLD,
lineHeight: 16,
fontSize: 12
}
});
export default function ActivityShelfBadge(props) {
const labelType = props.labelType;
let replacementStyles = props.replacementStyles;
const styles = useStyles();
if (replacementStyles == null) {
replacementStyles = styles.badge;
}
return labelType === EmbeddedActivityLabelTypes.NEW ? <View style={[replacementStyles, styles.newBadge, styles.elevationShadow]}>
<Text variant="text-xs/semibold" style={styles.badgeText} color="text-overlay-light">
{intl.string(t.y2b7CA)}
</Text>
</View> : labelType === EmbeddedActivityLabelTypes.UPDATED ? <View style={[replacementStyles, styles.updatedBadge, styles.elevationShadow]}>
<Text variant="text-xs/semibold" style={styles.badgeText} color="text-overlay-light">
{intl.string(t["/qdhkk"])}
</Text>
</View> : null;
};
@@ -0,0 +1,252 @@
// Metro module 10609 (f10610).
import { NativeEventEmitter } from "react-native";
import ChannelStore from "../../../stores/ChannelStore";
import RTCConnectionStore from "../../../stores/RTCConnectionStore";
import EmbeddedActivitiesStore from "../EmbeddedActivitiesStore";
import { DISALLOWED_NAVIGATION_ERROR_CLOSE_ACTIVITY } from "../Constants";
import { AnalyticEvents, ComponentActions } from "../../../Constants";
import { getWebViewProxy } from "../../../_bundle/Module6759";
import { isAndroid } from "../../../utils/PlatformUtils";
import Module10610 from "../../../_bundle/Module10610";
import getPostMessageJavaScript from "./getPostMessageJavaScript";
import SentryUtils_native from "../../../utils/SentryUtils.native";
import EmbeddedActivitiesManager from "../EmbeddedActivitiesManager";
import WebViewPostMessageTransport from "../../rpc/native/server/transports/WebViewPostMessageTransport";
import AlertActionCreators from "../../../actions/native/AlertActionCreators";
import { intl, t } from "../../../intl/index.native";
import ThermalUtils_native from "../../device/ThermalUtils.native";
import { getEmbeddedActivityLocationChannelId } from "../utils/embeddedActivityLocationUtils";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import Dispatcher from "../../../Dispatcher";
import { getThermalState, ThermalStates } from "../../device/useThermalState";
import { requestRespondToSeriousThermalState, stopEmbeddedActivity } from "../EmbeddedActivitiesActionCreators";
import ToastActionCreators from "../../toast/native/ToastActionCreators";
import Module10356 from "../../../_bundle/Module10356";
import { ComponentDispatch } from "../../../utils/ComponentDispatchUtils";
import { isNotNullish } from "../../../utils/GlobalUtils";
import { v4 } from "../../../_bundle/Module514";
import { HermesBuiltin } from "../../../_hermes/prelude";
let webViewProxy, c7117_11, prototype, EmbeddedActivitiesNativeManager;
const postMessageToWebView = async function postMessageToWebView(c26712_0) {
let c26712_3;
let c26712_4 = 0;
let c30240_0;
L10: {
try {
c26712_4 = 1;
await webViewProxy.injectJavaScript(getPostMessageJavaScript(c26712_0));
c26712_4 = 0;
} catch ($e) {
const r24 = $e;
let r8 = r24;
c26712_3 = r24;
if (c26712_4 !== 0) {
while (true) {
try {
const r55 = c26712_3;
c26712_4 = 0;
c30240_0 = r55;
SentryUtils_native.captureException(c30240_0);
break L10;
} catch (r51) {
r8 = r51;
c26712_3 = r51;
if (c26712_4 === 0) {
break;
}
}
}
}
throw r8;
}
}
};
webViewProxy = getWebViewProxy("EMBEDDED_ACTIVITY_WEB_VIEW_KEY");
c7117_11 = isAndroid() ? new NativeEventEmitter(Module10610) : null;
const EmbeddedActivitiesNativeManager2 = class EmbeddedActivitiesNativeManager extends EmbeddedActivitiesManager {
handleRPCDisconnect = ({ reason, application }) => {
const connectedActivityLocation = EmbeddedActivitiesStore.getConnectedActivityLocation();
const id = application?.id;
this.leaveActivity({
location: connectedActivityLocation,
applicationId: id
});
this.superHandleRPCDisconnect({
reason,
application
});
};
_initialize() {
Reflect.get(Object.getPrototypeOf(prototype), "_initialize", this).call(this);
const lifecycleSubscription = this.lifecycleSubscription;
if (lifecycleSubscription != null) {
lifecycleSubscription.remove();
}
this.lifecycleSubscription = c7117_11 == null ? void 0 : c7117_11.addListener("onHostDestroy", () => {
const connectedActivityLocation = EmbeddedActivitiesStore.getConnectedActivityLocation();
const r5 = connectedActivityLocation != null ? EmbeddedActivitiesStore.getSelfEmbeddedActivityForLocation(connectedActivityLocation) : null;
if (r5 != null && connectedActivityLocation != null) {
this.leaveActivity({
location: connectedActivityLocation,
applicationId: r5.applicationId
});
}
});
const scriptMessageSubscription = this.scriptMessageSubscription;
if (scriptMessageSubscription != null) {
scriptMessageSubscription.remove();
}
this.scriptMessageSubscription = webViewProxy.addOnMessageListener((a0) => {
try {
const r11 = JSON.parse(a0.data);
const connectedActivityLocation = EmbeddedActivitiesStore.getConnectedActivityLocation();
const url = (connectedActivityLocation != null ? EmbeddedActivitiesStore.getSelfEmbeddedActivityForLocation(connectedActivityLocation) : null)?.url;
if (typeof r11 === "object" ? url != null : typeof r11 === "object") {
WebViewPostMessageTransport.handleMessage(r11, url, postMessageToWebView);
}
} catch (r33) {
if (!(r33 instanceof SyntaxError)) {
throw r33;
}
if (a0.data === DISALLOWED_NAVIGATION_ERROR_CLOSE_ACTIVITY) {
const connectedActivityLocation2 = EmbeddedActivitiesStore.getConnectedActivityLocation();
const applicationId = connectedActivityLocation2 != null ? EmbeddedActivitiesStore.getSelfEmbeddedActivityForLocation(connectedActivityLocation2)?.applicationId : void 0;
if (connectedActivityLocation2 != null && applicationId != null) {
this.leaveActivity({
location: connectedActivityLocation2,
applicationId,
showFeedback: false
});
AlertActionCreators.show({
body: intl.string(t.tYBBWz),
confirmText: intl.string(t.BddRzS)
});
}
}
}
});
const thermalStateSubscription = this.thermalStateSubscription;
if (thermalStateSubscription != null) {
thermalStateSubscription.remove();
}
this.thermalStateSubscription = ThermalUtils_native.addListener(({ rawThermalState }) => {
const connectedActivityLocation = EmbeddedActivitiesStore.getConnectedActivityLocation();
const r6 = connectedActivityLocation != null ? EmbeddedActivitiesStore.getSelfEmbeddedActivityForLocation(connectedActivityLocation) : null;
const embeddedActivityLocationChannelId = getEmbeddedActivityLocationChannelId(connectedActivityLocation);
const basicChannel = ChannelStore.getBasicChannel(embeddedActivityLocationChannelId);
const compositeInstanceId = r6?.compositeInstanceId;
const applicationId = r6?.applicationId;
AnalyticsUtils.track(AnalyticEvents.ACTIVITY_DEVICE_THERMAL_STATE_CHANGED, {
channel_id: embeddedActivityLocationChannelId,
application_id: applicationId,
activity_session_id: compositeInstanceId,
thermal_state: rawThermalState,
guild_id: basicChannel?.guild_id,
media_session_id: RTCConnectionStore.getMediaSessionId()
});
Dispatcher.dispatch({
type: "THERMAL_STATE_CHANGE",
applicationId
});
const thermalState = getThermalState();
if (compositeInstanceId != null && applicationId != null && thermalState >= ThermalStates.SERIOUS) {
requestRespondToSeriousThermalState();
}
});
}
_terminate() {
Reflect.get(Object.getPrototypeOf(prototype), "_terminate", this).call(this);
const lifecycleSubscription = this.lifecycleSubscription;
if (lifecycleSubscription != null) {
lifecycleSubscription.remove();
}
const scriptMessageSubscription = this.scriptMessageSubscription;
if (scriptMessageSubscription != null) {
scriptMessageSubscription.remove();
}
const thermalStateSubscription = this.thermalStateSubscription;
if (thermalStateSubscription != null) {
thermalStateSubscription.remove();
}
}
showErrorModal({ code, message }) {
AlertActionCreators.show({
title: intl.formatToPlainString(t.hbiAO6, {
code
}),
body: message
});
}
showLaunchErrorModal(a0) {
AlertActionCreators.show({
title: intl.string(t.PtobXW),
body: a0
});
}
showDevShelfOverrideEnabled() {
ToastActionCreators.open({
key: "EMBEDDED_ACTIVITIES_DEV_SHELF_URL_OVERRIDE_ENABLED",
content: intl.string(t.JfA7IK),
icon: Module10356,
iconColor: "status-positive"
});
}
releaseWebView() {
const id = this.releaseFrameId();
if (id != null) {
ComponentDispatch.dispatch(ComponentActions.IFRAME_UNMOUNT, {
id
});
webViewProxy.releaseWebView();
}
return id;
}
leaveActivity({ location: location2, applicationId, showFeedback }) {
const r11 = this.releaseWebView();
if (location2 != null && isNotNullish(applicationId)) {
this.clearEmbeddedActivityState(location2, applicationId, r11 != null && showFeedback);
}
}
hidePIPEmbed(a0) {
if (a0 == null) {
HermesBuiltin.throwTypeError("Cannot destructure 'undefined' or 'null'.");
throw new Error("unreachable");
}
}
clearEmbeddedActivityState(a0, a1, a2) {
stopEmbeddedActivity({
location: a0,
applicationId: a1,
showFeedback: a2
});
Dispatcher.dispatch({
type: "EMBEDDED_ACTIVITY_SET_ORIENTATION_LOCK_STATE",
applicationId: a1,
lockState: null,
pictureInPictureLockState: null
});
}
releaseFrameId() {
const frameId = this.frameId;
this.frameId = void 0;
return frameId;
}
hasFrameId() {
return this.frameId != null;
}
getOrCreateFrameId() {
const frameId = this.frameId;
if (frameId != null) {
return frameId;
}
const frameId2 = v4();
this.frameId = frameId2;
return frameId2;
}
};
const prototype2 = EmbeddedActivitiesNativeManager2.prototype;
EmbeddedActivitiesNativeManager = EmbeddedActivitiesNativeManager2;
prototype = prototype2;
const embeddedActivitiesNativeManager = new EmbeddedActivitiesNativeManager();
export default embeddedActivitiesNativeManager;
export const EMBEDDED_ACTIVITY_WEB_VIEW_KEY = "EMBEDDED_ACTIVITY_WEB_VIEW_KEY";
@@ -0,0 +1,56 @@
// Metro module 10669 (f10670).
import { useState } from "react";
import { ImageBackground, StyleSheet, View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useEmbeddedActivityBackground from "../utils/useEmbeddedActivityBackground";
const useStyles = createStyles({
overlay: {
flex: 1,
opacity: 0.6,
backgroundColor: Module712.colors.BLACK
}
});
const _excluded = ["embedded_background"];
export default function EmbeddedActivityBackgroundImageWithOverlay(props) {
const application = props.application;
let dimensionsStyle = props.dimensionsStyle;
const { borderRadius, resizeMode = "contain" } = props;
const styles = useStyles();
const [state, setState] = useState(false);
let applicationId = application?.id;
if (applicationId == null) {
applicationId = "";
}
let url = useEmbeddedActivityBackground({
applicationId,
names: _excluded,
size: 1024
}).url;
let r30 = null;
if (!state) {
const r31 = url == null;
r30 = null;
if (!r31) {
r30 = null;
if (url !== "") {
if (url == null) {
url = void 0;
}
if (dimensionsStyle == null) {
dimensionsStyle = StyleSheet.absoluteFillObject;
}
r30 = <ImageBackground resizeMode={resizeMode} source={{
uri: url
}} style={dimensionsStyle} imageStyle={{
borderRadius
}} onError={() => setState(true)}>
<View style={[styles.overlay, {
borderRadius
}]} />
</ImageBackground>;
}
}
}
return r30;
};
@@ -0,0 +1,197 @@
// Metro module 10657 (f10658).
import { useState, useLayoutEffect, memo, useCallback } from "react";
import { ActivityIndicator, View } from "react-native";
import EmbeddedActivitiesStore from "../EmbeddedActivitiesStore";
import { ActivityLayoutMode, ActivityScreenOrientation } from "../Constants";
import { OBEY_SILENT_HARDWARE_SWITCH_APP_IDS } from "../../applications/ApplicationConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import * as _getDefaultOrientationLockState from "./getDefaultOrientationLockState";
import { getDefaultOrientationLockState } from "./getDefaultOrientationLockState";
import useWindowDimensions_native from "../../screen/useWindowDimensions.native";
import Dispatcher from "../../../Dispatcher";
import doesOrientationMatchLockState from "./doesOrientationMatchLockState";
import WakeLock from "../../device/native/WakeLock";
import useCurrentEmbeddedApplication from "../utils/useCurrentEmbeddedApplication";
import { useStateFromStores } from "../../../_bundle/Module589";
import useDispatchOpenActivity from "../useDispatchOpenActivity";
import EmbeddedActivitiesNativeManager, { EMBEDDED_ACTIVITY_WEB_VIEW_KEY } from "./EmbeddedActivitiesNativeManager";
import EmbeddedActivityWebView from "./EmbeddedActivityWebView";
import * as _allowPopups from "../utils/allowPopups";
let useStyles, ActivityViewLoadingIndicator, BaseActivityView;
const useBaseActivityView = function useBaseActivityView({ orientationLockState, showLoadingIndicator, setShowLoadingStateForLockingOrientation, application, setOrientationLockState }) {
const [state, setIsResetting2] = useState(false);
const defaultOrientationLockState = getDefaultOrientationLockState(application);
const id = application?.id;
const [state2, setState] = useState(false);
const windowDimensions_native = useWindowDimensions_native();
const isLandscape = windowDimensions_native.width > windowDimensions_native.height;
let c18165_9 = isLandscape;
useLayoutEffect(() => {
Dispatcher.dispatch({
type: "ACTIVITY_SCREEN_ORIENTATION_UPDATE",
screenOrientation: c18165_9 ? ActivityScreenOrientation.LANDSCAPE : ActivityScreenOrientation.PORTRAIT
});
}, [isLandscape]);
useLayoutEffect(() => {
setState(false);
}, [id]);
useLayoutEffect(() => {
if (!state2 && (orientationLockState == null && !doesOrientationMatchLockState(c18165_9, defaultOrientationLockState))) {
setShowLoadingStateForLockingOrientation(true);
} else {
setShowLoadingStateForLockingOrientation(false);
}
if (application != null) {
setOrientationLockState(application, orientationLockState);
}
}, [defaultOrientationLockState, application, orientationLockState, isLandscape, state2, setShowLoadingStateForLockingOrientation, setOrientationLockState]);
useLayoutEffect(() => {
if (doesOrientationMatchLockState(c18165_9, orientationLockState)) {
setShowLoadingStateForLockingOrientation(false);
}
}, [orientationLockState, isLandscape, setShowLoadingStateForLockingOrientation]);
useLayoutEffect(() => {
let r3 = showLoadingIndicator;
if (!showLoadingIndicator) {
r3 = state;
}
if (!r3) {
setState(true);
}
}, [showLoadingIndicator, state]);
return {
isResetting: state,
setIsResetting: setIsResetting2,
isLandscape
};
};
ActivityViewLoadingIndicator = function ActivityViewLoadingIndicator() {
return <View style={useStyles().loadingContainer}>
<ActivityIndicator size="large" />
</View>;
};
BaseActivityView = function BaseActivityView(props) {
const { children, wakeLockKey, showLoadingIndicator: showLoadingIndicator2, isResetting } = props;
return showLoadingIndicator2 ? <ActivityViewLoadingIndicator /> : isResetting ? null : <>
<WakeLock wakeLockKey={wakeLockKey} />
{children}
</>;
};
useStyles = createStyles({
loadingContainer: {
flex: 1,
justifyContent: "center"
}
});
const r46 = memo(function EmbeddedActivityViewInner(props) {
let queryParams;
let setIsResetting;
const { channel, layoutMode } = props;
let portraitSafeAreasConfig = props.portraitSafeAreasConfig;
const landscapeSafeAreasConfig = props.landscapeSafeAreasConfig;
setIsResetting = void 0;
const currentEmbeddedActivity = EmbeddedActivitiesStore.getCurrentEmbeddedActivity();
const currentEmbeddedApplication = useCurrentEmbeddedApplication();
let c18166_2 = currentEmbeddedApplication;
const stateFromStores = useStateFromStores([EmbeddedActivitiesStore], () => c18166_2 != null ? EmbeddedActivitiesStore.getOrientationLockStateForApp(c18166_2.id) : void 0, [currentEmbeddedApplication]);
const [state, setShowLoadingStateForLockingOrientation2] = useState(true);
if (currentEmbeddedActivity == null) {
queryParams = {
instance_id: ""
};
} else {
let compositeInstanceId = currentEmbeddedActivity.compositeInstanceId;
if (compositeInstanceId == null) {
compositeInstanceId = currentEmbeddedActivity.launchId;
}
const r41 = {
instance_id: compositeInstanceId,
location_id: currentEmbeddedActivity.location?.id,
launch_id: currentEmbeddedActivity.launchId
};
if (currentEmbeddedActivity.proxyTicket != null) {
r41.discord_proxy_ticket = currentEmbeddedActivity.proxyTicket;
}
if (channel != null && channel.id != null && channel.id !== "") {
r41.channel_id = channel.id;
}
const r53 = channel?.guild_id != null && channel?.guild_id !== "";
queryParams = r41;
if (r53) {
r41.guild_id = channel?.guild_id;
queryParams = r41;
}
}
useDispatchOpenActivity({
connectedEmbeddedActivity: currentEmbeddedActivity
});
useLayoutEffect(() => {
if (currentEmbeddedActivity != null) {
Dispatcher.dispatch({
type: "ACTIVITY_LAYOUT_MODE_UPDATE",
layoutMode,
applicationId: currentEmbeddedActivity.applicationId
});
}
}, [layoutMode, currentEmbeddedActivity]);
const callback = useCallback(() => {
EmbeddedActivitiesNativeManager.leaveActivity({
location: currentEmbeddedActivity?.location,
applicationId: c18166_2?.id
});
}, [currentEmbeddedApplication, currentEmbeddedActivity]);
const id = currentEmbeddedApplication?.id;
const showLoadingIndicator2 = currentEmbeddedActivity == null || currentEmbeddedActivity?.launchId == null || state || id == null || currentEmbeddedApplication == null;
const baseActivityView = useBaseActivityView({
orientationLockState: stateFromStores,
showLoadingIndicator: showLoadingIndicator2,
setShowLoadingStateForLockingOrientation: setShowLoadingStateForLockingOrientation2,
application: currentEmbeddedApplication,
setOrientationLockState: _getDefaultOrientationLockState.setOrientationLockState
});
const isResetting = baseActivityView.isResetting;
setIsResetting = baseActivityView.setIsResetting;
const isLandscape = baseActivityView.isLandscape;
const r82 = currentEmbeddedActivity == null;
let r83 = null;
if (!r82) {
const r84 = id == null;
r83 = null;
if (!r84) {
const props2 = {
onActivityCrash: () => {
setIsResetting(true);
setTimeout(() => setIsResetting(false), 0);
},
applicationId: id,
channelId: channel?.id,
guildId: channel?.guild_id,
activityUrl: currentEmbeddedActivity.url,
currentEmbeddedActivity,
activitySessionId: currentEmbeddedActivity?.compositeInstanceId,
queryParams,
onLoadError: callback,
allowPopups: _allowPopups.allowPopups(currentEmbeddedApplication),
referrerPolicy: "origin",
isPipOrGridMode: layoutMode === ActivityLayoutMode.PIP || layoutMode === ActivityLayoutMode.GRID,
webViewKey: EMBEDDED_ACTIVITY_WEB_VIEW_KEY,
safeAreasConfig: null,
ignoreSilentHardwareSwitch: null
};
if (isLandscape) {
portraitSafeAreasConfig = landscapeSafeAreasConfig;
}
props2.safeAreasConfig = portraitSafeAreasConfig;
props2.ignoreSilentHardwareSwitch = !OBEY_SILENT_HARDWARE_SWITCH_APP_IDS.has(id);
r83 = <BaseActivityView wakeLockKey="EmbeddedActivities" showLoadingIndicator={showLoadingIndicator2} isResetting={isResetting}>
<EmbeddedActivityWebView {...props2} />
</BaseActivityView>;
}
}
return r83;
});
export default r46;
export { useBaseActivityView };
export { ActivityViewLoadingIndicator };
export { BaseActivityView };
export { r46 as EmbeddedActivityView };
@@ -0,0 +1,485 @@
// Metro module 10662 (f10663).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import { useContext, useState, useMemo, useEffect, useRef, useCallback } from "react";
import { Linking } from "react-native";
import DeveloperActivityShelfStore from "../DeveloperActivityShelfStore";
import { ActivityPlatform, DISALLOWED_NAVIGATION_ERROR_CLOSE_ACTIVITY } from "../Constants";
import { ComponentActions, AnalyticEvents } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Logger from "../../debug/Logger";
import { isIOS } from "../../../utils/PlatformUtils";
import { WebViewContext } from "./WebViewContext";
import { v4 } from "../../../_bundle/Module514";
import * as _Module6759 from "../../../_bundle/Module6759";
import { getWebViewProxy } from "../../../_bundle/Module6759";
import { ComponentDispatch } from "../../../utils/ComponentDispatchUtils";
import useStableSafeAreaInsets_native, { getStableSafeAreaInsets } from "../../safe_area/useStableSafeAreaInsets.native";
import { getConstants } from "../../../utils/native/ClientInfoUtils";
import getIFrameSandboxAttributes from "../utils/getIFrameSandboxAttributes";
import createWebviewHtmlFile, { createInjectedJavascriptForIOS } from "./createWebviewHtmlFile";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
import AlertActionCreators from "../../../actions/AlertActionCreators";
import { intl, t } from "../../../intl/index.native";
import { HTTP } from "../../../_bundle/sendRequest";
import escapeStringRegexp from "../../../_bundle/escapeStringRegexp";
import URLUtils from "../../../utils/URLUtils";
import getPostMessageJavaScript from "./getPostMessageJavaScript";
import WebViewPostMessageTransport from "../../rpc/native/server/transports/WebViewPostMessageTransport";
import usePrevious from "../../../hooks/usePrevious";
import ChannelRTCActionCreators from "../../../actions/ChannelRTCActionCreators";
import EmbeddedActivitiesNativeManager from "./EmbeddedActivitiesNativeManager";
import { HermesBuiltin } from "../../../_hermes/prelude";
function $mk118866($env) {
return (a0) => `^${escapeStringRegexp(a0).replace(/\\\*/g, ".*")}`;
}
let BaseActivityWebView, useStyles, c7159_15, c7159_16;
let env7159 = {};
const getSafeArea = function getSafeArea(a0, a1) {
return a0 != null ? a0.disable ? 0 : a0.override != null ? Math.max(0, a0.override) : a0.offset != null ? Math.max(0, a1 + a0.offset) : a1 : a1;
};
BaseActivityWebView = function BaseActivityWebView(props) {
let state2, state3, setState, memo, setState2, c18170_22, iFrameSandboxAttributes, iFrameUri, ref, stateFromStores, c18170_27, c18170_28, setState3, state4, setState4, c18170_32, ref2, callback;
const { hasFrameId: hasFrameId2, getOrCreateFrameId: getOrCreateFrameId2, releaseFrameId: releaseFrameId2, hasInvalidUrlError, setHasInvalidUrlError, hadInvalidUrlError, deepLinkQueryParams = {}, activityUrl, applicationId, queryParams, onActivityCrash, onLoadError, allowPopups, referrerPolicy, isPipOrGridMode, webViewKey, ignoreSilentHardwareSwitch = true, safeAreasConfig, channelId, guildId, activitySessionId } = props;
state2 = void 0;
state3 = void 0;
setState = void 0;
memo = void 0;
setState2 = void 0;
c18170_22 = void 0;
iFrameSandboxAttributes = void 0;
iFrameUri = void 0;
ref = void 0;
stateFromStores = void 0;
c18170_27 = void 0;
c18170_28 = void 0;
setState3 = void 0;
state4 = void 0;
setState4 = void 0;
c18170_32 = void 0;
ref2 = void 0;
callback = void 0;
const styles = useStyles();
const context = useContext(WebViewContext);
const [state] = useState(() => hasFrameId2());
state2 = _slicedToArray(useState(() => webViewKey != null ? getOrCreateFrameId2() : v4()), 1)[0];
[state3, setState] = useState(null);
memo = useMemo(() => webViewKey != null ? getWebViewProxy(webViewKey) : void 0, [webViewKey]);
let state5;
[state5, setState2] = useState(null);
useEffect(() => {
let r1 = state;
if (state) {
r1 = webViewKey != null;
}
if (!r1) {
ComponentDispatch.dispatch(ComponentActions.IFRAME_MOUNT, {
id: state2
});
}
}, [state, state2, webViewKey]);
useEffect(() => () => {
if (webViewKey == null) {
ComponentDispatch.dispatch(ComponentActions.IFRAME_UNMOUNT, {
id: state2
});
}
}, [webViewKey, state2]);
const stableSafeAreaInsets_native = useStableSafeAreaInsets_native();
c18170_22 = stableSafeAreaInsets_native;
const r89 = {
...queryParams,
...deepLinkQueryParams,
frame_id: state2,
platform: ActivityPlatform.MOBILE,
mobile_app_version: getConstants().Version
};
iFrameSandboxAttributes = getIFrameSandboxAttributes({
allowPopups
});
iFrameUri = `${activityUrl}?${new URLSearchParams(r89)}`;
ref = useRef(safeAreasConfig);
useEffect(() => {
let _loadHtml2 = function _loadHtml() {
const r9 = async () => {
let c31585_5;
c31585_5 = void 0;
const stableSafeAreaInsets = getStableSafeAreaInsets();
const current = ref.current;
const left3 = current?.left;
let left = stableSafeAreaInsets?.left;
if (left == null) {
left = 0;
}
const insets = {
left: getSafeArea(left3, left),
right: null,
top: null,
bottom: null
};
const right3 = current?.right;
let right = stableSafeAreaInsets?.right;
if (right == null) {
right = 0;
}
insets.right = getSafeArea(right3, right);
const top3 = current?.top;
let top = stableSafeAreaInsets?.top;
if (top == null) {
top = 0;
}
insets.top = getSafeArea(top3, top);
const bottom3 = current?.bottom;
let bottom = stableSafeAreaInsets?.bottom;
if (bottom == null) {
bottom = 0;
}
insets.bottom = getSafeArea(bottom3, bottom);
let c32018_0 = await createWebviewHtmlFile({
iFrameUri,
iFrameSandboxAttributes,
referrerPolicy,
insets,
messageForDisallowedNavigationError: c7159_16 ? void 0 : DISALLOWED_NAVIGATION_ERROR_CLOSE_ACTIVITY
});
if (c32018_0 != null) {
(0, setState2)(c32018_0);
} else {
(0, onLoadError)();
}
};
_loadHtml2 = r9;
return r9.apply(this, arguments);
};
(function loadHtml() {
return _loadHtml2.apply(this, arguments);
})();
}, [iFrameUri, iFrameSandboxAttributes, onLoadError, referrerPolicy]);
const callback2 = useCallback((a0) => {
c7159_15.warn(`activity WebView error for appId ${applicationId}. ${JSON.stringify(a0.nativeEvent)}`);
}, [applicationId]);
const callback3 = useCallback((a0) => {
c7159_15.warn(`activity WebView render process gone for appId ${applicationId}. ${JSON.stringify(a0.nativeEvent)}`);
}, [applicationId]);
const callback4 = useCallback(() => {
c7159_15.warn(`activity WebView content process terminated for appId ${applicationId}`);
AnalyticsUtils.track(AnalyticEvents.ACTIVITY_WEB_VIEW_CONTENT_PROCESS_TERMINATED, {
application_id: applicationId,
channel_id: channelId,
guild_id: guildId,
activity_session_id: activitySessionId
});
ComponentDispatch.dispatch(ComponentActions.IFRAME_UNMOUNT, {
id: state2
});
releaseFrameId2();
if (memo != null) {
memo.releaseWebView();
}
onActivityCrash();
}, [applicationId, channelId, guildId, activitySessionId, state2, releaseFrameId2, memo, onActivityCrash]);
stateFromStores = useStateFromStores([DeveloperActivityShelfStore], () => DeveloperActivityShelfStore.getUseActivityUrlOverride());
useEffect(() => {
try {
setState(new URL(iFrameUri));
} catch (r11) {
if (!stateFromStores) {
throw r11;
}
setHasInvalidUrlError(true);
}
}, [iFrameUri, stateFromStores, setHasInvalidUrlError]);
useEffect(() => {
if (hadInvalidUrlError ? !hadInvalidUrlError : hasInvalidUrlError) {
AlertActionCreators.show({
title: intl.string(t.PtobXW),
body: intl.string(t["55iAUT"]),
confirmText: intl.string(t.BddRzS)
});
}
}, [hadInvalidUrlError, hasInvalidUrlError]);
c18170_27 = null;
const r4 = state3 != null;
let uri = null;
if (r4) {
const r151 = c7159_16 ? `file://${state5}` : `${state3.origin}/${state2}/activity.html`;
c18170_27 = r151;
uri = r151;
}
c18170_28 = c7159_16;
let state6;
[state6, setState3] = useState(false);
[state4, setState4] = useState([]);
useEffect(() => {
if (c18170_28) {
let c26784_0, _fetchAndParseCSP2;
const parseCsp2 = function parseCsp(a0, a1) {
const r7 = a1.match(a0);
return r7 !== null && r7.length >= 2 ? r7[1].split(" ").filter((item) => !c26784_0.includes(item)) : [];
};
_fetchAndParseCSP2 = function _fetchAndParseCSP() {
const r9 = async () => {
let c31586_2;
let env32019;
c31586_2 = void 0;
const r9 = env32019 = {
$parent: env7159
};
let c31586_1 = r9;
env32019[0] = void 0;
env32019[1] = void 0;
env32019[2] = void 0;
const r31 = `https://${applicationId}.discordsays.com`;
env32019[0] = r31;
env32019[1] = (await HTTP.get({
url: `${r31}/.discord/csp`,
rejectWithError: false
})).headers["content-security-policy"];
const r63 = ["about:blank", "file://*", env32019[0]];
let c31586_0 = 3;
c31586_0 = HermesBuiltin.arraySpread(r63, parseCsp2(/frame-src (.*?);/, env32019[1]), c31586_0);
c31586_0 = HermesBuiltin.arraySpread(r63, parseCsp2(/child-src (.*?);/, env32019[1]), c31586_0);
env32019[2] = r63;
setState4(env32019[2].map($mk118866(env7159)));
(0, setState3)(true);
};
_fetchAndParseCSP2 = r9;
return r9.apply(this, arguments);
};
c26784_0 = ["'self'"];
(function fetchAndParseCSP() {
return _fetchAndParseCSP2.apply(this, arguments);
})();
}
}, [applicationId, c7159_16]);
const callback5 = useCallback((a0) => {
const mainDocumentURL = a0.mainDocumentURL;
if (c18170_27 != null && mainDocumentURL != null && mainDocumentURL !== c18170_27) {
Linking.openURL(a0.url);
return false;
}
for (const item of state4) {
if (!new RegExp(item).test(a0.url)) {
continue;
}
return true;
}
let r43 = DeveloperActivityShelfStore.getActivityUrlOverride();
if (r43 == null) {
r43 = "";
}
const r44 = URLUtils.toURLSafe(r43);
const r49 = URLUtils.toURLSafe(a0.url);
return r44 != null && r49 != null && r44.origin + r44.pathname === r49.origin + r49.pathname;
}, [uri, state4]);
const r3 = uri != null && state3 != null && state5 != null;
c18170_32 = r3;
ref2 = useRef(null);
callback = useCallback((a0) => {
const current = ref2.current;
if (current != null) {
current.injectJavaScript(getPostMessageJavaScript(a0));
}
}, []);
const r183 = [webViewKey, , ,];
const origin = state3?.origin;
L89: {
const r185 = (a0) => {
if (webViewKey == null) {
const r7 = JSON.parse(a0.nativeEvent.data);
if (typeof r7 === "object" ? state3?.origin != null : typeof r7 === "object") {
WebViewPostMessageTransport.handleMessage(r7, state3?.origin, callback);
}
}
};
r183[1] = origin;
r183[2] = callback;
const callback6 = useCallback(r185, r183);
useEffect(() => {
if (c18170_32 && memo != null) {
let _tryInjectJavaScript2 = function _tryInjectJavaScript() {
const r9 = async () => {
let left2, right2, top2, bottom2;
let c31587_7 = 0;
let c32020_0;
L40: {
try {
c32020_0 = void 0;
if (memo != null) {
const r18 = isPipOrGridMode ? {
top: 0,
bottom: 0,
left: 0,
right: 0
} : c18170_22;
const left3 = safeAreasConfig?.left;
const left4 = r18?.left;
left2 = left4;
if (left4 == null) {
left2 = 0;
}
const insets = {
left: getSafeArea(left3, left2),
right: null,
top: null,
bottom: null
};
const right3 = safeAreasConfig?.right;
const right4 = r18?.right;
right2 = right4;
if (right4 == null) {
right2 = 0;
}
insets.right = getSafeArea(right3, right2);
const top3 = safeAreasConfig?.top;
top2 = r18?.top;
if (top2 == null) {
top2 = 0;
}
insets.top = getSafeArea(top3, top2);
const bottom3 = safeAreasConfig?.bottom;
const bottom4 = r18?.bottom;
bottom2 = bottom4;
if (bottom4 == null) {
bottom2 = 0;
}
insets.bottom = getSafeArea(bottom3, bottom2);
const r58 = {
type: "safeAreaUpdateEvent",
data: {
insets
}
};
c32020_0 = r58;
c31587_7 = 1;
await memo.injectJavaScript(getPostMessageJavaScript(r58));
c31587_7 = 0;
break L40;
}
} catch ($e) {
let r7 = $e;
if (c31587_7 !== 0) {
while (true) {
try {
c31587_7 = 0;
if (ref2.current == null) {
break L40;
}
callback(getPostMessageJavaScript(c32020_0));
break L40;
} catch ($e) {
r7 = $e;
if (c31587_7 === 0) {
break;
}
}
}
}
throw r7;
}
return void 0;
}
};
_tryInjectJavaScript2 = r9;
return r9.apply(this, arguments);
};
(function tryInjectJavaScript() {
return _tryInjectJavaScript2.apply(this, arguments);
})();
}
}, [stableSafeAreaInsets_native, isPipOrGridMode, r3, memo, callback, safeAreasConfig]);
if (uri != null && state3 != null) {
if (c7159_16 && state6 === false) {
break L89;
}
const left3 = safeAreasConfig?.left;
let r194 = stableSafeAreaInsets_native?.left;
if (r194 == null) {
r194 = 0;
}
const left4 = left3 != null ? left3.disable ? 0 : left3.override != null ? Math.max(0, left3.override) : left3.offset != null ? Math.max(0, r194 + left3.offset) : r194 : r194;
const right3 = safeAreasConfig?.right;
let r213 = stableSafeAreaInsets_native?.right;
if (r213 == null) {
r213 = 0;
}
const right4 = right3 != null ? right3.disable ? 0 : right3.override != null ? Math.max(0, right3.override) : right3.offset != null ? Math.max(0, r213 + right3.offset) : r213 : r213;
const top3 = safeAreasConfig?.top;
let r231 = stableSafeAreaInsets_native?.top;
if (r231 == null) {
r231 = 0;
}
const top4 = top3 != null ? top3.disable ? 0 : top3.override != null ? Math.max(0, top3.override) : top3.offset != null ? Math.max(0, r231 + top3.offset) : r231 : r231;
const bottom3 = safeAreasConfig?.bottom;
let r249 = stableSafeAreaInsets_native?.bottom;
if (r249 == null) {
r249 = 0;
}
const bottom4 = bottom3 != null ? bottom3.disable ? 0 : bottom3.override != null ? Math.max(0, bottom3.override) : bottom3.offset != null ? Math.max(0, r249 + bottom3.offset) : r249 : r249;
const injectedJavaScript = c7159_16 ? createInjectedJavascriptForIOS({
left: left4,
right: right4,
top: top4,
bottom: bottom4
}) : void 0;
return state5 == null ? null : <_Module6759.WebView style={styles.webView} ref={ref2} source={{
uri
}} androidAssetLoaderConfig={{
domain: state3.port === "" ? state3.host : `${state3.hostname}:${state3.port}`,
httpAllowed: state3.protocol === "http:",
pathHandlers: [{
type: "internal",
path: `/${state2}/`,
directory: state5.substring(0, state5.lastIndexOf("/"))
}]
}} originWhitelist={["*"]} overScrollMode="never" scrollEnabled={false} cacheEnabled onError={callback2} onContentProcessDidTerminate={callback4} onRenderProcessGone={callback3} webViewKey={webViewKey} temporaryParentNodeTag={context} messagingWithWebViewKeyEnabled={webViewKey != null} onMessage={callback6} allowFileAccess={c7159_16} injectedJavaScript={injectedJavaScript} injectedJavaScriptForMainFrameOnly={false} onShouldStartLoadWithRequest={c7159_16 ? callback5 : void 0} mediaPlaybackRequiresUserAction={false} ignoreSilentHardwareSwitch={ignoreSilentHardwareSwitch} allowsInlineMediaPlayback minimumFontSize={1} bounces={false} allowsProtectedMedia />;
}
}
return null;
};
useStyles = createStyles({
webView: {
backgroundColor: "transparent"
}
});
c7159_15 = new Logger("EmbeddedActivityWebView");
c7159_16 = isIOS();
export default function EmbeddedActivityWebView(props) {
const { channelId: channelId2, currentEmbeddedActivity, applicationId: applicationId2, ...props2 } = props;
const [state, setHasInvalidUrlError2] = useState(false);
const previous = usePrevious(state);
const state5 = state;
let c18171_4 = previous;
const deepLinkQueryParams = {};
if (currentEmbeddedActivity != null) {
if (currentEmbeddedActivity.customId != null) {
deepLinkQueryParams.custom_id = currentEmbeddedActivity.customId;
}
if (currentEmbeddedActivity.referrerId != null) {
deepLinkQueryParams.referrer_id = currentEmbeddedActivity.referrerId;
}
}
useEffect(() => {
if (c18171_4 ? !c18171_4 : state5) {
if (channelId2 != null) {
ChannelRTCActionCreators.selectParticipant(channelId2, null);
}
EmbeddedActivitiesNativeManager.leaveActivity({
location: currentEmbeddedActivity?.location,
applicationId: applicationId2,
showFeedback: false
});
}
}, [state5, previous, channelId2, applicationId2, currentEmbeddedActivity]);
return <BaseActivityWebView hasFrameId={() => EmbeddedActivitiesNativeManager.hasFrameId()} getOrCreateFrameId={() => EmbeddedActivitiesNativeManager.getOrCreateFrameId()} releaseFrameId={() => EmbeddedActivitiesNativeManager.releaseFrameId()} hasInvalidUrlError={state5} setHasInvalidUrlError={setHasInvalidUrlError2} hadInvalidUrlError={previous} deepLinkQueryParams={deepLinkQueryParams} applicationId={applicationId2} channelId={channelId2} {...props2} />;
};
export { BaseActivityWebView };
export function useHasInvalidUrlErrorState() {
const r5 = _slicedToArray(useState(false), 2);
const hasInvalidUrlError2 = r5[0];
return {
hasInvalidUrlError: hasInvalidUrlError2,
setHasInvalidUrlError: r5[1],
hadInvalidUrlError: usePrevious(hasInvalidUrlError2)
};
}
@@ -0,0 +1,33 @@
// Metro module 10537 (f10538).
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Alert from "../../../components_native/common/Alert";
import { intl, t } from "../../../intl/index.native";
import { disregardSeriousThermalState } from "../EmbeddedActivitiesActionCreators";
import { Text } from "../../../design/components/Text/native/Text";
const useStyles = createStyles({
text: {
marginTop: 16,
lineHeight: 20,
textAlign: "center"
},
header: {
textAlign: "center"
}
});
export function IgnoreThermalStateAlert(props) {
const { onConfirm, ...props2 } = props;
const styles = useStyles();
return <Alert {...props2} cancelText={intl.string(t["1fRDnT"])} onCancel={() => {
if (onConfirm != null) {
onConfirm();
}
disregardSeriousThermalState();
}} confirmText={intl.string(t.oEAioF)}>
<Text style={styles.header} variant="heading-lg/extrabold" color="mobile-text-heading-primary">
{intl.string(t.v5X4fZ)}
</Text>
<Text style={styles.text} variant="text-md/medium">
{intl.string(t.VOgTjy)}
</Text>
</Alert>;
}
@@ -0,0 +1,64 @@
// Metro module 15925 (f15926).
import { useState } from "react";
import { View } from "react-native";
import AccessibilityStore from "../../a11y/AccessibilityStore";
import { ContentDismissActionType } from "../../dismissible_content/DismissibleContentConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useIsScreenLandscape } from "../../screen/useIsScreenLandscape.native";
import { useStateFromStores } from "../../../_bundle/Module589";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import Video from "../../../components_native/common/Video";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import { Button } from "../../../design/components/Button/native/Button.native";
const src = {
videoURI: "https://cdn.discordapp.com/assets/activities/platform/activities_pipfab_tutorial_redesign.mp4"
};
const useStyles = createStyles({
videoContainer: {
borderRadius: Module712.radii.sm,
overflow: "hidden"
},
bottomSheetWrapper: {
paddingHorizontal: 24
},
contentContainer: {
flex: 1,
alignItems: "center",
paddingTop: 24,
paddingBottom: 16
},
title: {
marginTop: 16,
textAlign: "center"
},
body: {
marginTop: 8,
marginBottom: 24,
textAlign: "center"
}
});
export default function VoiceControlsToggleActionSheet(props) {
const markAsDismissed = props.markAsDismissed;
const styles = useStyles();
const [width, setState] = useState(0);
const isScreenLandscape = useIsScreenLandscape();
return <BottomSheet startExpanded onDismiss={() => markAsDismissed(ContentDismissActionType.UNKNOWN)}>
<View style={styles.bottomSheetWrapper}>
<View style={styles.contentContainer} onLayout={(event) => {
const width = event.nativeEvent.layout.width;
setState(isScreenLandscape ? width / 2 : width);
}}>
<Video style={styles.videoContainer} src={src} poster="https://cdn.discordapp.com/assets/activities/platform/activities_pipfab_tutorial_redesign.png" width={width} height={width / (isScreenLandscape ? 2.0875 : 1.5)} muted paused={useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion)} />
<Text style={styles.title} accessibilityRole="header" variant="heading-xl/extrabold" color="mobile-text-heading-primary">
{intl.string(t.pT6hue)}
</Text>
<Text style={styles.body} variant="text-sm/normal">
{intl.string(t.tNm8AZ)}
</Text>
<Button onPress={() => markAsDismissed(ContentDismissActionType.UNKNOWN)} text={intl.string(t["NX+WJN"])} />
</View>
</View>
</BottomSheet>;
};
@@ -0,0 +1,27 @@
// Metro module 10663 (f10664).
import { createContext, useState, useCallback } from "react";
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
const context = createContext(0);
const useStyles = createStyles({
placeholderWebView: {
width: 2,
height: 2,
position: "absolute",
opacity: 0
}
});
export { context as WebViewContext };
export function WebViewContextProvider(props) {
const children = props.children;
const styles = useStyles();
const [value, setState] = useState(0);
return <context.Provider value={value}>
<View style={styles.placeholderWebView} ref={useCallback((a0) => {
if (a0) {
setState(a0._nativeTag);
}
}, [setState])} pointerEvents="none" />
{children}
</context.Provider>;
}
@@ -0,0 +1,17 @@
// Metro module 15835 (f15836).
import { OrientationLockState } from "../Constants";
import { getIsTabletActivitySurface } from "./getDefaultOrientationLockState";
import { unlockOrientation, lockOrientation } from "../../device/native/DeviceOrientation";
export default function applyActivityOrientationLock(a0) {
if (!getIsTabletActivitySurface()) {
if (OrientationLockState.UNLOCKED === a0) {
unlockOrientation({
unlockAfterRotatingToPreviousLock: true
});
} else if (OrientationLockState.PORTRAIT === a0) {
lockOrientation("PORTRAIT", true);
} else if (OrientationLockState.LANDSCAPE === a0) {
lockOrientation("LANDSCAPE", true);
}
}
};
@@ -0,0 +1,226 @@
// Metro module 10666 (f10667).
import { NativeModules } from "react-native";
import * as _PlatformUtils from "../../../utils/PlatformUtils";
import Module1271 from "../../../_bundle/Module1271";
import SentryUtils_native from "../../../utils/SentryUtils.native";
function $mk116043($env) {
return function generateWebviewHtml(a0) {
const { iFrameUri, iFrameSandboxAttributes, referrerPolicy } = a0;
let insets = a0.insets;
const messageForDisallowedNavigationError = a0.messageForDisallowedNavigationError;
const isAndroid = _PlatformUtils.isAndroid();
let r9 = "";
let r8 = "";
if (isAndroid) {
if (insets == null) {
insets = {
top: 0,
bottom: 0,
left: 0,
right: 0
};
}
r8 = `
<script type="text/javascript">
var iframe = document.getElementById("activityFrame");
var iframeWindow = iframe.contentWindow;
var isIframeLoaded = false;
${`
iframeWindow.addEventListener("load", () => {
var iframeDoc = iframeWindow.document;
iframeDoc.documentElement.style.setProperty('--discord-safe-area-inset-left', '${insets.left}px');
iframeDoc.documentElement.style.setProperty('--discord-safe-area-inset-right', '${insets.right}px');
iframeDoc.documentElement.style.setProperty('--discord-safe-area-inset-top', '${insets.top}px');
iframeDoc.documentElement.style.setProperty('--discord-safe-area-inset-bottom', '${insets.bottom}px');
isIframeLoaded = true;
});
`}
${`
function updateSafeAreaVars(insets) {
var iframeDoc = iframeWindow.document;
iframeDoc.documentElement.style.setProperty('--discord-safe-area-inset-left', \`\${insets.left}px\`);
iframeDoc.documentElement.style.setProperty('--discord-safe-area-inset-right', \`\${insets.right}px\`);
iframeDoc.documentElement.style.setProperty('--discord-safe-area-inset-top', \`\${insets.top}px\`);
iframeDoc.documentElement.style.setProperty('--discord-safe-area-inset-bottom', \`\${insets.bottom}px\`);
iframeWindow.dispatchEvent(new Event('resize'));
// Force redraw
iframeDoc.documentElement.offsetHeight;
}
iframeWindow.addEventListener('message', function (e) {
const messageData = e.data;
const {type, data} = messageData;
if (type === 'safeAreaUpdateEvent') {
const {insets} = data;
if (isIframeLoaded) {
updateSafeAreaVars(insets);
} else {
iframeWindow.addEventListener("load", () => {
updateSafeAreaVars(insets);
});
}
}
});
`}
</script>
`;
}
if (messageForDisallowedNavigationError != null) {
r9 = `
<script type="text/javascript">
var iframe = document.getElementById("activityFrame");
var iframeWindow = iframe.contentWindow;
${`
iframeWindow.addEventListener('beforeunload', function (e) {
window.ReactNativeWebView.postMessage('${messageForDisallowedNavigationError}');
e.preventDefault();
});
`}
</script>
`;
}
return `
<html>
<head>
<style>
body {
padding: 0;
margin: 0;
width: 100vw;
min-height: 100vh; /* This keeps a small white gap at the bottom of the screen, the options below help prevent this. */
min-height: -moz-available; /* See: https://ilxanlar.medium.com/you-shouldnt-rely-on-css-100vh-and-here-s-why-1b4721e74487 for more info */
min-height: -webkit-fill-available;
min-height: fill-available;
}
</style>
<meta
name="viewport"
content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, viewport-fit=cover"
/>
</head>
<body>
<script type="text/javascript">
window.addEventListener('message', e => {
window.ReactNativeWebView.postMessage(JSON.stringify(e.data));
});
</script>
<iframe id="activityFrame" width="100%" height="100%" src="${iFrameUri}" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen sandbox="${iFrameSandboxAttributes}" referrerPolicy="${referrerPolicy}">
</iframe>
${r8}
${r9}
</body>
</html>
`;
};
}
let env7163 = {};
export default async function createWebviewHtmlFile(c26786_0) {
let r97;
let c26786_1, c26786_2, c26786_3;
let c26786_4 = 0;
const r16 = env7163;
try {
let env30282;
c26786_2 = r16;
const r39 = env30282 = {
$parent: r16
};
c26786_1 = r39;
env30282[0] = void 0;
env30282[1] = void 0;
env30282[2] = void 0;
env30282[3] = void 0;
env30282[4] = void 0;
env30282[0] = c26786_0.iFrameUri;
env30282[1] = c26786_0.iFrameSandboxAttributes;
env30282[2] = c26786_0.referrerPolicy;
env30282[3] = c26786_0.insets;
env30282[4] = c26786_0.messageForDisallowedNavigationError;
env30282[5] = void 0;
env30282[6] = void 0;
await void 0;
env30282[5] = "discord_activity_data/activity.html";
const r66 = {
iFrameUri: env30282[0],
iFrameSandboxAttributes: env30282[1],
referrerPolicy: env30282[2],
insets: env30282[3],
messageForDisallowedNavigationError: env30282[4]
};
env30282[6] = $mk116043(env7163)(r66);
c26786_4 = 1;
r97 = _PlatformUtils.isAndroid() ? await (Module1271 == null ? void 0 : Module1271.writeFile("cache", env30282[5], env30282[6], "utf8")) : await NativeModules.DCDFileManager.writeFile("cache", env30282[5], env30282[6], "utf8");
c26786_4 = 0;
} catch ($e) {
const r37 = $e;
let r8 = r37;
c26786_3 = r37;
if (c26786_4 !== 0) {
while (true) {
try {
const r146 = c26786_3;
c26786_4 = 0;
env30282[7] = r146;
SentryUtils_native.captureException(env30282[7]);
} catch (r142) {
r8 = r142;
c26786_3 = r142;
if (c26786_4 === 0) {
break;
}
continue;
}
return null;
}
}
throw r8;
}
return r97;
};
export function createInjectedJavascriptForIOS(a0) {
const r1 = a0 == null ? {
top: 0,
bottom: 0,
left: 0,
right: 0
} : a0;
return `
var iframeWindow = window;
var isIframeLoaded = false;
${`
iframeWindow.addEventListener("load", () => {
var iframeDoc = iframeWindow.document;
iframeDoc.documentElement.style.setProperty('--discord-safe-area-inset-left', '${r1.left}px');
iframeDoc.documentElement.style.setProperty('--discord-safe-area-inset-right', '${r1.right}px');
iframeDoc.documentElement.style.setProperty('--discord-safe-area-inset-top', '${r1.top}px');
iframeDoc.documentElement.style.setProperty('--discord-safe-area-inset-bottom', '${r1.bottom}px');
isIframeLoaded = true;
});
`}
${`
function updateSafeAreaVars(insets) {
var iframeDoc = iframeWindow.document;
iframeDoc.documentElement.style.setProperty('--discord-safe-area-inset-left', \`\${insets.left}px\`);
iframeDoc.documentElement.style.setProperty('--discord-safe-area-inset-right', \`\${insets.right}px\`);
iframeDoc.documentElement.style.setProperty('--discord-safe-area-inset-top', \`\${insets.top}px\`);
iframeDoc.documentElement.style.setProperty('--discord-safe-area-inset-bottom', \`\${insets.bottom}px\`);
iframeWindow.dispatchEvent(new Event('resize'));
// Force redraw
iframeDoc.documentElement.offsetHeight;
}
iframeWindow.addEventListener('message', function (e) {
const messageData = e.data;
const {type, data} = messageData;
if (type === 'safeAreaUpdateEvent') {
const {insets} = data;
if (isIframeLoaded) {
updateSafeAreaVars(insets);
} else {
iframeWindow.addEventListener("load", () => {
updateSafeAreaVars(insets);
});
}
}
});
`}
`;
}
@@ -0,0 +1,16 @@
// Metro module 10658 (f10659).
import { OrientationLockState } from "../Constants";
export default function doesOrientationMatchLockState(a0, a1) {
let r2 = a1 == null || a1 === OrientationLockState.UNLOCKED;
let r8 = a0;
if (!r2) {
r2 = a0 ? !a0 : a1 === OrientationLockState.PORTRAIT;
}
if (!r2) {
if (a0) {
r8 = a1 === OrientationLockState.LANDSCAPE;
}
r2 = r8;
}
return r2;
};
@@ -0,0 +1,48 @@
// Metro module 10656 (f10657).
import * as _DeviceUtils from "../../../utils/native/DeviceUtils";
import * as _MetaQuestUtils_android from "../../device/MetaQuestUtils.android";
import Dispatcher from "../../../Dispatcher";
const isIpadOS = _DeviceUtils.isIpadOS();
const isMetaQuest = _MetaQuestUtils_android.isMetaQuest();
export function getIsTabletActivitySurface() {
let r0 = isIpadOS;
if (!isIpadOS) {
r0 = isMetaQuest;
}
return r0;
}
export function setOrientationLockState(a0, a1) {
let lockState = a1;
if (a1 == null) {
const r1 = a0 != null;
let r3 = void 0;
if (r1) {
let r4 = isIpadOS;
if (!isIpadOS) {
r4 = isMetaQuest;
}
const embeddedActivityConfig = a0.embeddedActivityConfig;
const r9 = embeddedActivityConfig == null;
r3 = r4 ? r9 ? void 0 : embeddedActivityConfig.tablet_default_orientation_lock_state : r9 ? void 0 : embeddedActivityConfig.default_orientation_lock_state;
}
lockState = r3;
}
if (lockState != null) {
Dispatcher.dispatch({
type: "EMBEDDED_ACTIVITY_SET_ORIENTATION_LOCK_STATE",
applicationId: a0.id,
lockState
});
}
}
export function getDefaultOrientationLockState(a0) {
if (a0 != null) {
let r2 = isIpadOS;
if (!isIpadOS) {
r2 = isMetaQuest;
}
const embeddedActivityConfig = a0.embeddedActivityConfig;
const r6 = embeddedActivityConfig == null;
return r2 ? r6 ? void 0 : embeddedActivityConfig.tablet_default_orientation_lock_state : r6 ? void 0 : embeddedActivityConfig.default_orientation_lock_state;
}
}
@@ -0,0 +1,9 @@
// Metro module 10611 (f10612).
export default function getPostMessageJavaScript(a0) {
return `
(function() {
const iFrame = document.getElementById('activityFrame');
iFrame.contentWindow.postMessage(${JSON.stringify(a0)}, '*');
})()
`;
};
@@ -0,0 +1,77 @@
// Metro module 13117 (f13118).
import { AppLauncherRouteName } from "../../app_launcher/native/AppLauncherNativeConstants";
import ApplicationActionCreators from "../../applications/ApplicationActionCreators";
import ChannelActionCreators from "../../../actions/ChannelActionCreators";
import { getCustomActivityLinkParams } from "../utils/CustomActivityLinkUtils";
import handleUsePrimaryEntryPointAppCommand from "../handleUsePrimaryEntryPointAppCommand";
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
import { CommandOrigin } from "../../application_commands/ApplicationCommandTypes";
import { getBestActiveInput } from "../../../utils/native/ChatInputUtils";
import { KeyboardTypes } from "../../keyboard/native/KeyboardTypes";
export default async function openActivityDMLauncher(c27412_0, c27412_1, c27412_2, c27412_3, c27412_4) {
let c27412_6;
let c30614_4, c30614_0, c30614_1, c30614_2, c30614_3, c30614_5, c30614_6, c30614_7, c30614_8;
L28: {
L26: {
c27412_6 = void 0;
c30614_4 = void 0;
c30614_0 = c27412_0;
c30614_1 = c27412_1;
c30614_2 = c27412_2;
c30614_3 = c27412_3;
if (c27412_4 !== void 0) {
c30614_4 = c27412_4;
c30614_5 = void 0;
c30614_6 = void 0;
c30614_7 = void 0;
c30614_8 = void 0;
} else {
c30614_4 = false;
c30614_5 = void 0;
c30614_6 = void 0;
c30614_7 = void 0;
c30614_8 = void 0;
}
await void 0;
c30614_5 = await ApplicationActionCreators.fetchApplication(c30614_0);
c30614_6 = c30614_5.bot?.id;
if (c30614_5 == null) {
break L28;
}
if (c30614_6 != null) {
c30614_7 = await ChannelActionCreators.openPrivateChannel({
recipientIds: c30614_6
});
c30614_8 = (await getCustomActivityLinkParams(c30614_0, c30614_3, c30614_2)).customId;
if (c30614_4) {
const bestActiveInput = getBestActiveInput();
if (bestActiveInput == null) {
break L28;
}
bestActiveInput.openCustomKeyboard({
type: KeyboardTypes.APP_LAUNCHER,
context: {
application: c30614_5,
initialRouteName: AppLauncherRouteName.APPLICATION_VIEW,
customId: c30614_8,
referrerId: c30614_1
}
});
break L28;
}
await handleUsePrimaryEntryPointAppCommand({
targetApplicationId: c30614_0,
locationObject: {},
channelId: c30614_7,
analyticsLocations: [AnalyticsLocation.ACTIVITY_BOOKMARK],
commandOrigin: CommandOrigin.ACTIVITY_BOOKMARK_EMBED,
referrerId: c30614_1,
customId: c30614_8
});
break L26;
}
break L28;
}
return void 0;
}
};
@@ -0,0 +1,7 @@
// Metro module 10536 (f10537).
import AlertActionCreators from "../../../actions/native/AlertActionCreators";
export function openIgnoreThermalStateAlert(onConfirm) {
AlertActionCreators.openLazy({
importer: () => import("./IgnoreThermalStateAlert").then(({ IgnoreThermalStateAlert }) => (a0) => <IgnoreThermalStateAlert {...a0} onConfirm={onConfirm} />)
});
}
Loaded 100 of 33051 files, more files were not shown because too many files have changed in this diff. Show more