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,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} />)
});
}
@@ -0,0 +1,18 @@
// Metro module 10525 (f10526).
import ChannelRTCStore from "../../calls/ChannelRTCStore";
import useIsActivityFocused from "../useIsActivityFocused";
import { useIsModalOpen } from "../../main_tabs_v2/helpers/NavigationRouteUtils.native";
import ChannelCallModal from "../../video_calls/native/components/ChannelCallModal";
import { useStateFromStores } from "../../../_bundle/Module589";
export function useIsViewingActivity({ channelId }) {
let r13 = useIsActivityFocused(channelId);
const isModalOpen = useIsModalOpen(ChannelCallModal);
const stateFromStores = useStateFromStores([ChannelRTCStore], () => ChannelRTCStore.getChatOpen(channelId), [channelId]);
if (r13) {
r13 = isModalOpen;
}
if (r13) {
r13 = !stateFromStores;
}
return r13;
}
@@ -0,0 +1,20 @@
// Metro module 13542 (f13543).
import { dismissKeyboard } from "../../utils/native/ChatInputUtils";
import ModalActionCreators from "../../actions/ModalActionCreators";
let c9401_3 = "ACTIVITY_SHARE_LINK_MODAL";
export const ACTIVITY_SHARE_LINK_MODAL = "ACTIVITY_SHARE_LINK_MODAL";
export function openActivityShareLinkModal({ applicationId, customId, linkId, message, onShare }) {
dismissKeyboard();
ModalActionCreators.pushLazy(import("./native/ActivityShareLinkModal"), {
applicationId,
customId,
linkId,
message,
onShare
}, c9401_3, {
presentation: "modal"
});
}
export function closeActivityShareLinkModal() {
ModalActionCreators.popWithKey(c9401_3);
}
@@ -0,0 +1,42 @@
// Metro module 5688 (f5689).
const r11 = {
DISCONNECTED: "disconnected",
LAUNCHING_WITH_ORIENTATION_CHANGE: "launching_with_orientation_change",
PANEL: "panel",
PIP: "pip",
ACTIVITY_POPOUT_WINDOW: "activity_popout_window"
};
const r17 = {
NO_CHAT: 0,
0: "NO_CHAT",
RESIZABLE: 1,
1: "RESIZABLE"
};
export { r11 as ActivityPanelModes };
export const SCREEN_HEADER_HEIGHT = 64;
export const ACTIVITY_PANEL_LAYOUT_PHYSICS = {
stiffness: 320,
mass: 0.25,
damping: 15,
overshootClamping: true
};
export { r17 as FocusedActivityLayouts };
export const LANDSCAPE_ACTIVITY_ASPECT_RATIO = 1.7777777777777777;
export const ACTIVITY_PANEL_PORTRAIT_HEADER_HEIGHT = 48;
export const LANDSCAPE_IFRAME_HORIZONTAL_MARGIN = 64;
export const ACTIVITY_PIP_SIZE = {
width: 120,
height: 120
};
export const ACTIVITY_LAYOUT_PHYSICS_GESTURE = {
stiffness: 150,
mass: 0.25,
damping: 40,
overshootClamping: true
};
export const ACTIVITY_LAYOUT_PHYSICS_DEFAULT = {
stiffness: 150,
mass: 0.35,
damping: 40,
overshootClamping: true
};
@@ -0,0 +1,172 @@
// Metro module 15853 (f15854).
import { useState, useCallback, useEffect } from "react";
import { View } from "react-native";
import { setSendState, useInstantInviteSendStates } from "../../../instant_invite/InstantInviteSendStateStore";
import InviteSuggestionsStore from "../../../../stores/InviteSuggestionsStore";
import { ActivityActionTypes } from "../../../../Constants";
import { InviteSendStates, InviteTargetTypes } from "../../../instant_invite/Constants";
import { NOOP_NULL } from "../../../../_bundle/Module505";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import UserPlaceholderRow from "../../../main_tabs_v2/native/shared_components/user_list/UserPlaceholderRow";
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import showUserProfileActionSheet from "../../../user_profile/native/showUserProfileActionSheet";
import { RowTypes } from "../../../../utils/InstantInviteUtils";
import ActivitiesActionCreators from "../../../../actions/ActivitiesActionCreators";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { loadInviteSuggestions, searchInviteSuggestions } from "../../../../actions/InviteSuggestionsActionCreators";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetTitleHeader } from "../../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { intl, t } from "../../../../intl/index.native";
import { EmptyState } from "../../../../design/void/native";
import { AppCrash } from "../../../../design/components/Illustration/native/redesign/generated/AppCrash";
import { SearchField } from "../../../../design/components/TextField/native/SearchField.native";
import ActivityInviteSheetList from "./ActivityInviteSheetList";
let useStyles;
const Loading = function Loading() {
const styles = useStyles();
const r9 = [];
let key = 0;
while (true) {
r9.push(<UserPlaceholderRow key={key} row={key} />);
key = key + 1;
if (!(key < 10)) {
return <>
<View style={styles.placeholderHeader} />
<View style={styles.placeholderLabel} />
{r9}
</>;
}
}
};
useStyles = createStyles({
placeholderHeader: {
height: 16,
width: "80%",
margin: 16,
marginBottom: 8,
borderRadius: Module712.radii.sm,
backgroundColor: Module712.colors.BACKGROUND_MOD_MUTED
},
placeholderLabel: {
height: 16,
width: "40%",
margin: 16,
borderRadius: Module712.radii.sm,
backgroundColor: Module712.colors.BACKGROUND_MOD_MUTED
},
emptyState: {
backgroundColor: "transparent"
},
searchAndShareContainer: {
borderTopWidth: 1,
borderColor: Module712.colors.BORDER_SUBTLE,
marginTop: Module712.space.PX_8,
paddingVertical: Module712.space.PX_8,
paddingHorizontal: Module712.space.PX_12,
flexDirection: "column",
gap: Module712.space.PX_12
}
});
export default function ActivityInviteSheet(props) {
let setState2;
const activity = props.activity;
setState2 = void 0;
const styles = useStyles();
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.ACTIVITY_INVITE_SHEET).analyticsLocations;
const [title, setState] = useState(null);
const instantInviteSendStates = useInstantInviteSendStates((a0) => a0);
const callback3 = useCallback((a0) => {
const id3 = activity.party?.id;
const id2 = a0.item.id;
const r10 = id3 != null;
let r11 = null;
if (r10) {
const r13 = instantInviteSendStates[id3];
r11 = r13 == null ? void 0 : r13[id2];
}
return r11;
}, [activity, instantInviteSendStates]);
const callback = useCallback((a0) => {
ActionSheetActionCreators.hideActionSheet();
showUserProfileActionSheet({
userId: a0,
sourceAnalyticsLocations: analyticsLocations
});
}, [analyticsLocations]);
const callback2 = useCallback((a0) => {
let c28167_0, id;
L13: {
c28167_0 = a0;
if (activity != null) {
id = activity.party?.id;
if (id != null) {
const markInviteSent = function markInviteSent() {
if (id != null) {
setSendState(id, c28167_0.item.id, InviteSendStates.SENT);
}
};
setSendState(id, a0.item.id, InviteSendStates.SENDING);
if (a0.type === RowTypes.CHANNEL) {
const id3 = a0.item.id;
try {
ActivitiesActionCreators.sendActivityInvite({
channelId: id3,
type: ActivityActionTypes.JOIN,
activity,
location: AnalyticsLocation.ACTIVITY_INVITE_SHEET
}).then(markInviteSent).catch((error) => {
setState(String(error));
});
} catch ($e) {
setState(String($e));
}
} else {
if (a0.type !== RowTypes.DM && a0.type !== RowTypes.FRIEND) {
break L13;
}
const id2 = a0.item.id;
try {
ActivitiesActionCreators.sendActivityInviteUser({
userId: id2,
type: ActivityActionTypes.JOIN,
activity,
location: AnalyticsLocation.ACTIVITY_INVITE_SHEET
}).then(markInviteSent).catch((error) => setState(String(error)));
} catch ($e) {
setState(String($e));
}
}
}
}
}
}, [activity]);
const stateFromStores = useStateFromStores([InviteSuggestionsStore], () => InviteSuggestionsStore.getInviteSuggestionRows());
let state;
[state, setState2] = useState(false);
useEffect(() => {
setState2(true);
loadInviteSuggestions({
omitUserIds: new Set(),
inviteTargetType: InviteTargetTypes.EMBEDDED_APPLICATION
}).catch(NOOP_NULL).finally(() => {
setState2(false);
});
}, []);
const r69 = stateFromStores.length === 0 && state;
const r71 = stateFromStores.length === 0 && !state;
return <AnalyticsLocationProvider value={analyticsLocations}>
<BottomSheet showGradient={title != null || !r69 || !r71} scrollable startExpanded header={<BottomSheetTitleHeader title={intl.string(t["OzOM/q"])} />}>
{title != null ? <EmptyState style={styles.emptyState} Illustration={AppCrash} title={title} /> : r69 ? <Loading /> : <>
<View>
<View style={styles.searchAndShareContainer}>
<SearchField size="md" isRound onChange={searchInviteSuggestions} placeholder={intl.string(t.iI1gMg)} />
</View>
</View>
{r71 ? <EmptyState style={styles.emptyState} title={intl.string(t.ojoWgX)} /> : <ActivityInviteSheetList data={stateFromStores} error={title} getSendState={callback3} onInviteSent={callback2} onPressAvatar={callback} />}
</>}
</BottomSheet>
</AnalyticsLocationProvider>;
};
@@ -0,0 +1,71 @@
// Metro module 15854 (f15855).
import { useCallback } from "react";
import { Fonts } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import TextStyles from "../../../rebrand/native/TextStyles";
import Module712 from "../../../../_bundle/Module712";
import { RefreshEmptyState } from "../../../../design/void/native";
import { intl, t } from "../../../../intl/index.native";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { getRootNavigationRef } from "../../../main_tabs_v2/RootNavigationRef.native";
import { Text } from "../../../../design/components/Text/native/Text";
import ActivityInviteSheetRow from "./ActivityInviteSheetRow";
import useSafeAreaInsetsKeyboardAware_native from "../../../safe_area/useSafeAreaInsetsKeyboardAware.native";
import { BottomSheetFlatList } from "../../../../_bundle/Module5245";
let useStyles, FriendsEmptyComponent;
const keyExtractor = function keyExtractor(a0) {
return a0.item.id;
};
FriendsEmptyComponent = function FriendsEmptyComponent() {
const styles = useStyles();
return <>
<RefreshEmptyState title={intl.string(t.dz4UlO)} body={intl.string(t.MBQBI7)} titleStyle={styles.emptyTitle} bodyStyle={styles.emptyBody} />
<PressableOpacity onPress={() => {
ActionSheetActionCreators.hideActionSheet();
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null) {
rootNavigationRef.navigate("friends", {
screen: "add-friends",
params: {
sourcePage: "Instant Invite Empty State"
}
});
}
}} accessibilityRole="link" accessibilityLabel={intl.string(t.a7FVbE)} hitSlop={{
top: 8,
left: 8,
bottom: 8,
right: 8
}}>
<Text style={[styles.goToFriendsLink]} variant="text-sm/semibold" color="text-link">
{intl.string(t.a7FVbE)}
</Text>
</PressableOpacity>
</>;
};
useStyles = createStyles({
emptyTitle: {
...TextStyles(Fonts.DISPLAY_EXTRABOLD, Module712.colors.MOBILE_TEXT_HEADING_PRIMARY, 18),
textTransform: "none",
lineHeight: 24
},
emptyBody: {
...TextStyles(Fonts.PRIMARY_MEDIUM, Module712.colors.TEXT_SUBTLE, 16),
lineHeight: 20,
fontWeight: "600"
},
goToFriendsLink: {
textAlign: "center"
}
});
export default function ActivityInviteSheetList(props) {
const { data, error, getSendState, isSubmitting, onInviteSent, onPressAvatar } = props;
const callback = useCallback(({ item, index }) => <ActivityInviteSheetRow start={index === 0} end={index === data.length - 1} row={item} onPressAvatar={onPressAvatar} onInviteSent={onInviteSent} isSubmitting={isSubmitting} error={error} sendState={getSendState(item)} />, [error, isSubmitting, getSendState, onPressAvatar, onInviteSent, data.length]);
return <BottomSheetFlatList contentContainerStyle={{
paddingBottom: useSafeAreaInsetsKeyboardAware_native({
isKeyboardAwareOnAndroid: false
}).insets.bottom + Module712.space.PX_16,
paddingHorizontal: Module712.space.PX_12
}} bounces={false} renderItem={callback} data={data} keyExtractor={keyExtractor} keyboardShouldPersistTaps="always" ListEmptyComponent={FriendsEmptyComponent} />;
};
@@ -0,0 +1,132 @@
// Metro module 15855 (f15856).
import { memo } from "react";
import { View } from "react-native";
import ChannelStore from "../../../../stores/ChannelStore";
import GuildStore from "../../../../stores/GuildStore";
import UserStore from "../../../../stores/UserStore";
import { InviteSendStates } from "../../../instant_invite/Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import useChannelName from "../../../channel/useChannelName";
import { RowTypes } from "../../../../utils/InstantInviteUtils";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { Avatar, AvatarSizes } from "../../../../design/void/native";
import DiscordTag from "../../../user_profile/native/DiscordTag";
import UserUtils from "../../../../utils/UserUtils";
import { intl, t } from "../../../../intl/index.native";
import AvatarUtils from "../../../../utils/AvatarUtils";
import { getAcronym } from "../../../../utils/StringUtils";
import { Text } from "../../../../design/components/Text/native/Text";
import { TableRow } from "../../../../design/components/TableRow/native/TableRow.native";
import InviteButton from "../../../instant_invite/native/components/InviteButton";
const useStyles = createStyles({
acronym: {
width: 32,
height: 32,
borderRadius: Module712.radii.lg,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
alignItems: "center",
justifyContent: "center",
overflow: "hidden",
marginTop: 0,
marginRight: 10,
borderColor: Module712.colors.BORDER_MUTED,
borderStyle: "solid",
borderWidth: 2
}
});
const r50 = memo(function ActivityInviteSheetRow(props) {
let accessibilityActions, end, error, icon, isSubmitting, label, onAccessibilityAction, sendState, start;
let onInviteSent, onPressAvatar, row, id;
L31: {
end = props.end;
error = props.error;
isSubmitting = props.isSubmitting;
onInviteSent = props.onInviteSent;
onPressAvatar = props.onPressAvatar;
row = props.row;
sendState = props.sendState;
start = props.start;
id = void 0;
const styles = useStyles();
id = row.item.id;
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(id));
let r40 = useChannelName(stateFromStores);
const type = row.type;
if (RowTypes.DM !== type && RowTypes.FRIEND !== type) {
if (RowTypes.GROUP_DM === type) {
const r104 = stateFromStores != null ? <Avatar source={AvatarUtils.makeSource(AvatarUtils.getChannelIconURL({
id: stateFromStores.id,
icon: stateFromStores.icon,
applicationId: stateFromStores.application_id,
size: 32
}))} size={AvatarSizes.REFRESH_MEDIUM_32} /> : null;
if (r40 == null) {
r40 = "";
}
label = r40;
onAccessibilityAction = void 0;
accessibilityActions = void 0;
icon = r104;
break L31;
}
if (RowTypes.CHANNEL === type) {
const r25 = stateFromStores?.guild_id != null ? GuildStore.getGuild(stateFromStores.guild_id) : void 0;
if (r25 == null) {
return null;
}
icon = r25.icon != null ? <Avatar source={AvatarUtils.makeSource(AvatarUtils.getGuildIconURL({
id: r25.id,
icon: r25.icon,
size: 32
}))} size={AvatarSizes.REFRESH_MEDIUM_32} /> : <View style={styles.acronym}>
<Text variant="text-sm/bold">
{getAcronym(r25.name)}
</Text>
</View>;
label = r40 == null ? "" : `#${r40}`;
onAccessibilityAction = void 0;
accessibilityActions = void 0;
break L31;
}
return null;
}
const user = UserStore.getUser(id);
let source = user == null ? void 0 : user.getAvatarSource(void 0);
if (source == null) {
source = null;
}
const r146 = <PressableOpacity importantForAccessibility="no-hide-descendants" accessibilityElementsHidden onPress={(event) => {
event.stopPropagation();
if (onPressAvatar != null) {
onPressAvatar(id);
}
}} style={{
padding: 8,
margin: -8
}}>
<Avatar source={source} size={AvatarSizes.REFRESH_MEDIUM_32} />
</PressableOpacity>;
const r154 = <DiscordTag nick={UserUtils.getGlobalName(user)} user={user} />;
const r156 = onPressAvatar != null ? [{
name: "viewProfile",
label: intl.formatToPlainString(t.uCenkh, {
username: user?.tag
})
}] : void 0;
onAccessibilityAction = (a0) => {
if (a0.nativeEvent.actionName === "viewProfile" && onPressAvatar !== null && onPressAvatar != null) {
onPressAvatar(id);
}
};
accessibilityActions = r156;
label = r154;
icon = r146;
}
const handlePress = function handlePress() {
onInviteSent(row);
};
return <TableRow start={start} end={end} icon={icon} label={label} trailing={<InviteButton sendState={sendState} onPressSend={handlePress} />} onPress={handlePress} disabled={error != null || isSubmitting || sendState === InviteSendStates.SENT} accessibilityActions={accessibilityActions} onAccessibilityAction={onAccessibilityAction} />;
});
export default r50;
@@ -0,0 +1,27 @@
// Metro module 15832 (f15833).
import { memo } from "react";
import ChannelStore from "../../../../stores/ChannelStore";
import SelectedChannelStore from "../../../../stores/SelectedChannelStore";
import EmbeddedActivitiesStore from "../../EmbeddedActivitiesStore";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { getEmbeddedActivityLocationChannelId } from "../../utils/embeddedActivityLocationUtils";
import { ChannelTypes } from "../../../../_bundle/Module692";
import ActivityPanelController from "./ActivityPanelController";
import ActivityPanelUI from "./ActivityPanelUI";
const r26 = memo(function ActivityPanelContainer() {
return useStateFromStores([EmbeddedActivitiesStore, ChannelStore, SelectedChannelStore], () => {
const connectedActivityLocation = EmbeddedActivitiesStore.getConnectedActivityLocation();
if (connectedActivityLocation == null) {
return false;
}
const embeddedActivityLocationChannelId = getEmbeddedActivityLocationChannelId(connectedActivityLocation);
if (embeddedActivityLocationChannelId == null) {
return false;
}
const channel = ChannelStore.getChannel(embeddedActivityLocationChannelId);
return channel?.type === ChannelTypes.GUILD_TEXT || ((channel == null ? void 0 : channel.isPrivate()) === true ? SelectedChannelStore.getVoiceChannelId() !== embeddedActivityLocationChannelId : void 0);
}, []) ? <ActivityPanelController>
<ActivityPanelUI />
</ActivityPanelController> : null;
});
export default r26;
@@ -0,0 +1,270 @@
// Metro module 15833 (f15834).
import { useRef, useEffect, useLayoutEffect, useId, useState, useMemo } from "react";
import ApplicationStore from "../../../applications/ApplicationStore";
import AppFreezeStore from "../../../panels/morphable/AppFreezeStore";
import SafeAreaDisabledStore from "../../../panels/morphable/native/SafeAreaDisabledStore";
import ChannelStore from "../../../../stores/ChannelStore";
import EmbeddedActivitiesStore from "../../EmbeddedActivitiesStore";
import { ACTIVITY_LANDSCAPE_ASPECT_RATIO, ACTIVITY_PORTRAIT_ASPECT_RATIO, OrientationLockState } from "../../Constants";
import { ActivityPanelModes } from "../ActivityPanelConstants";
import { cachedFunction } from "../../../../utils/FunctionUtils";
import { useIsActivityPanelFullscreen } from "./utils/ActivityPanelUtils";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import { useSharedValue, useAnimatedReaction } from "../../../reanimated/ReanimatedRexport";
import { restoreDefaultOrientation } from "../../../device/native/DeviceOrientation";
import applyActivityOrientationLock from "../../native/applyActivityOrientationLock";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
import usePIPAvoidanceSpecs from "./pip/usePIPAvoidanceSpecs";
import useActivityWebViewLockManager from "./useActivityWebViewLockManager";
import { getIsTabletActivitySurface, getDefaultOrientationLockState } from "../../native/getDefaultOrientationLockState";
import { useIsVoicePanelFullscreen } from "../../../voice_panel/VoicePanelUtils.native";
import useHandleOAuthNavigation from "../../utils/native/useHandleOAuthNavigation";
import { useNavigatorBackPressHandler } from "../../../../design/components/Navigator/native/useNavigatorBackPressHandler.native";
import doesOrientationMatchLockState from "../../native/doesOrientationMatchLockState";
import { dismissKeyboard } from "../../../../utils/native/ChatInputUtils";
import { useStateFromStoresObject } from "../../../../_bundle/Module589";
import { getEmbeddedActivityLocationChannelId } from "../../utils/embeddedActivityLocationUtils";
import isVoiceEmbeddedActivity from "../../utils/isVoiceEmbeddedActivity";
import SelectedChannelActionCreators from "../../../../actions/SelectedChannelActionCreators";
import { transitionToChannel } from "../../../routing/transitionToChannel";
import ActivityPanelStateContext from "./ActivityPanelStateContext";
import * as _EmbeddedActivitiesActionCreators from "../../EmbeddedActivitiesActionCreators";
let c11326_16, c11326_17, __initData, __initData2;
const BaseActivityPanelController = function BaseActivityPanelController(props) {
const { children, context } = props;
let orientationLockStateForApp = props.orientationLockStateForApp;
const { mode, hasConnectedActivity: hasConnectedActivity3, connectedActivityAppId, currentApp, updateActivityPanelMode } = props;
const safeAreaInsets_native = useSafeAreaInsets_native();
const windowDimensions_native = useWindowDimensions_native();
const sharedValue = useSharedValue({
x: -1,
y: -1
});
const pipAvoidanceSpecs = usePIPAvoidanceSpecs(safeAreaInsets_native);
const sharedValue2 = useSharedValue(c11326_16);
const ref = useRef(mode);
const useActivityWebViewLock = useActivityWebViewLockManager();
const isTabletActivitySurface = getIsTabletActivitySurface();
const r22 = orientationLockStateForApp == null ? getDefaultOrientationLockState(currentApp) : orientationLockStateForApp;
let hasConnectedActivity, mode2, isVoicePanelFullscreen, UNLOCKED;
const defaultOrientationLockState = r22;
const wrapperDimensions = c11326_17(windowDimensions_native, safeAreaInsets_native.top, defaultOrientationLockState, isTabletActivitySurface);
const ref2 = useRef(connectedActivityAppId);
const isVoicePanelFullscreen3 = useIsVoicePanelFullscreen();
useHandleOAuthNavigation();
useNavigatorBackPressHandler(() => {
let r0 = mode === ActivityPanelModes.PANEL;
if (r0) {
updateActivityPanelMode(ActivityPanelModes.PIP);
r0 = true;
}
return r0;
});
useEffect(() => {
L13: {
if (connectedActivityAppId != null && ref2.current == null) {
if (!doesOrientationMatchLockState(wrapperDimensions.isWindowLandscape, defaultOrientationLockState) && !isTabletActivitySurface) {
updateActivityPanelMode(ActivityPanelModes.LAUNCHING_WITH_ORIENTATION_CHANGE);
break L13;
}
updateActivityPanelMode(ActivityPanelModes.PANEL);
} else if (connectedActivityAppId == null && ref2.current != null) {
updateActivityPanelMode(ActivityPanelModes.DISCONNECTED);
} else if (mode === ActivityPanelModes.LAUNCHING_WITH_ORIENTATION_CHANGE && doesOrientationMatchLockState(wrapperDimensions.isWindowLandscape, defaultOrientationLockState)) {
updateActivityPanelMode(ActivityPanelModes.PANEL);
}
}
ref2.current = connectedActivityAppId;
}, [connectedActivityAppId, defaultOrientationLockState, mode, wrapperDimensions.isWindowLandscape, isTabletActivitySurface, updateActivityPanelMode]);
useEffect(() => {
if (mode === ActivityPanelModes.PANEL && ref.current !== ActivityPanelModes.PANEL) {
dismissKeyboard();
sharedValue2.set(c11326_16);
}
ref.current = mode;
}, [mode, sharedValue2]);
hasConnectedActivity = hasConnectedActivity3;
mode2 = mode;
isVoicePanelFullscreen = isVoicePanelFullscreen3;
UNLOCKED = void 0;
if (orientationLockStateForApp == null) {
orientationLockStateForApp = OrientationLockState.UNLOCKED;
}
UNLOCKED = orientationLockStateForApp;
useLayoutEffect(() => {
L6: {
if (!isVoicePanelFullscreen) {
if (!(mode2 !== ActivityPanelModes.PANEL && mode2 !== ActivityPanelModes.LAUNCHING_WITH_ORIENTATION_CHANGE) && hasConnectedActivity) {
applyActivityOrientationLock(UNLOCKED);
break L6;
}
restoreDefaultOrientation();
}
}
}, [connectedActivityAppId, hasConnectedActivity, mode, UNLOCKED, isVoicePanelFullscreen]);
useLayoutEffect(() => () => restoreDefaultOrientation(), []);
const r90 = hasConnectedActivity ? mode === ActivityPanelModes.PANEL : hasConnectedActivity;
let sharedValue3, isActivityPanelFullscreen, state, setState, id2;
const hasConnectedActivity2 = hasConnectedActivity;
const lockEnabled = r90;
const isVoicePanelFullscreen2 = isVoicePanelFullscreen;
const id = useId();
useLayoutEffect(() => {
if (isVoicePanelFullscreen2) {
return void 0;
}
let r7 = void 0;
if (hasConnectedActivity2) {
SafeAreaDisabledStore.getState().requestSafeAreaDisableLock({
key: id,
lockEnabled
});
r7 = () => {
SafeAreaDisabledStore.getState().requestSafeAreaDisableLock({
key: id,
lockEnabled: false
});
};
}
return r7;
}, [id, hasConnectedActivity, lockEnabled, isVoicePanelFullscreen]);
sharedValue3 = sharedValue2;
isActivityPanelFullscreen = void 0;
state = void 0;
setState = void 0;
id2 = void 0;
isActivityPanelFullscreen = useIsActivityPanelFullscreen();
[state, setState] = useState(false);
id2 = useId();
const l = () => sharedValue3.get().gestureActive;
l.__closure = {
wrapperOffset: sharedValue2
};
l.__workletHash = 5299695936442;
l.__initData = __initData;
const r121 = function(a0, a1) {
if (a0 !== a1) {
_ReanimatedRexport.runOnJS(setState)(a0);
}
};
r121.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
setWrapperGestureInProgress: setState
};
r121.__workletHash = 5831467313798;
r121.__initData = __initData2;
useAnimatedReaction(l, r121);
useEffect(() => {
const state2 = AppFreezeStore.getState();
let lockEnabled2 = isActivityPanelFullscreen;
if (isActivityPanelFullscreen) {
lockEnabled2 = state;
}
state2.requestFreezeLock({
lockEnabled: lockEnabled2,
key: id2
});
return () => {
AppFreezeStore.getState().requestFreezeLock({
lockEnabled: false,
key: id2
});
};
}, [isActivityPanelFullscreen, state, id2]);
return <context.Provider value={useMemo(() => ({
mode,
setMode: updateActivityPanelMode,
wrapperDimensions,
pipState: sharedValue,
pipAvoidanceSpecs,
wrapperOffset: sharedValue2,
useActivityWebViewLock
}), [mode, pipAvoidanceSpecs, sharedValue, updateActivityPanelMode, useActivityWebViewLock, wrapperDimensions, sharedValue2])}>{children}</context.Provider>;
};
c11326_16 = {
x: 0,
y: 0,
gestureActive: false
};
c11326_17 = cachedFunction(({ width, height }, a1, a2, a3) => {
const isWindowLandscape = width > height;
if (OrientationLockState.LANDSCAPE === a2) {
return a3 && !isWindowLandscape ? {
width,
height: width * ACTIVITY_LANDSCAPE_ASPECT_RATIO - a1,
isLandscape: true,
isWindowLandscape
} : {
width: Math.max(width, height),
height: Math.min(height, width),
isLandscape: true,
isWindowLandscape: true
};
}
if (OrientationLockState.PORTRAIT === a2) {
return a3 && isWindowLandscape ? {
width: height * ACTIVITY_PORTRAIT_ASPECT_RATIO,
height,
isLandscape: false,
isWindowLandscape
} : {
width: Math.min(width, height),
height: Math.max(height, width) - a1,
isLandscape: false,
isWindowLandscape: false
};
}
OrientationLockState.UNLOCKED;
return {
width,
height: isWindowLandscape ? height : height - a1,
isLandscape: isWindowLandscape,
isWindowLandscape
};
});
__initData = {
code: "function ActivityPanelControllerTsx1(){const{wrapperOffset}=this.__closure;return wrapperOffset.get().gestureActive;}"
};
__initData2 = {
code: "function ActivityPanelControllerTsx2(gestureActive,previous){const{runOnJS,setWrapperGestureInProgress}=this.__closure;if(gestureActive===previous)return;runOnJS(setWrapperGestureInProgress)(gestureActive);}"
};
export default function ActivityPanelController(props) {
let mode3, connectedActivityInTextChannelId;
const children = props.children;
mode3 = void 0;
connectedActivityInTextChannelId = void 0;
const stateFromStoresObject = useStateFromStoresObject([EmbeddedActivitiesStore, ApplicationStore], () => {
const activityPanelMode = EmbeddedActivitiesStore.getActivityPanelMode();
const connectedActivityLocation = EmbeddedActivitiesStore.getConnectedActivityLocation();
const selfEmbeddedActivityForLocation = EmbeddedActivitiesStore.getSelfEmbeddedActivityForLocation(connectedActivityLocation);
const applicationId = selfEmbeddedActivityForLocation?.applicationId;
const currentApp = applicationId != null ? ApplicationStore.getApplication(applicationId) : void 0;
const embeddedActivityLocationChannelId = getEmbeddedActivityLocationChannelId(connectedActivityLocation);
return {
mode: activityPanelMode,
connectedActivityInTextChannelId: embeddedActivityLocationChannelId == null ? void 0 : isVoiceEmbeddedActivity(embeddedActivityLocationChannelId) ? void 0 : embeddedActivityLocationChannelId,
hasConnectedActivity: selfEmbeddedActivityForLocation != null,
connectedActivityAppId: applicationId,
currentApp,
orientationLockStateForApp: applicationId == null ? void 0 : EmbeddedActivitiesStore.getOrientationLockStateForApp(applicationId)
};
}, []);
mode3 = stateFromStoresObject.mode;
connectedActivityInTextChannelId = stateFromStoresObject.connectedActivityInTextChannelId;
const { hasConnectedActivity: hasConnectedActivity3, connectedActivityAppId: connectedActivityAppId2, currentApp, orientationLockStateForApp } = stateFromStoresObject;
useEffect(() => {
if (mode3 === ActivityPanelModes.PANEL) {
const channel = ChannelStore.getChannel(connectedActivityInTextChannelId);
if (channel !== void 0) {
SelectedChannelActionCreators.selectChannel({
guildId: channel.guild_id,
channelId: channel.id
});
transitionToChannel(channel.id);
}
}
}, [mode3, connectedActivityInTextChannelId]);
return <BaseActivityPanelController context={ActivityPanelStateContext} orientationLockStateForApp={orientationLockStateForApp} mode={mode3} hasConnectedActivity={hasConnectedActivity3} connectedActivityAppId={connectedActivityAppId2} currentApp={currentApp} updateActivityPanelMode={_EmbeddedActivitiesActionCreators.updateActivityPanelMode}>{children}</BaseActivityPanelController>;
};
export { BaseActivityPanelController };
@@ -0,0 +1,273 @@
// Metro module 15849 (f15850).
import * as Module19 from "react";
import { useContext, useMemo, useCallback } from "react";
import { StyleSheet } from "react-native";
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import ChannelStore from "../../../../stores/ChannelStore";
import EmbeddedActivitiesStore from "../../EmbeddedActivitiesStore";
import { ActivityLayoutMode } from "../../Constants";
import * as _ActivityPanelConstants from "../ActivityPanelConstants";
import { ActivityPanelModes } from "../ActivityPanelConstants";
import { DEFAULT_PORTRAIT_LETTERBOX_CONFIG, DEFAULT_PORTRAIT_SAFE_AREAS_CONFIG } from "./ActivityPanelNativeConstants";
import { ThemeTypes } from "../../../../Constants";
import * as _VoicePanelConstants from "../../../voice_panel/VoicePanelConstants";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { useStateFromStores, useStateFromStoresObject } from "../../../../_bundle/Module589";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
import { useLockedWebView } from "./useActivityWebViewLockManager";
import useAnimatedKeyboardHeight from "../../../keyboard/native/useAnimatedKeyboardHeight";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import * as _TransitionGroup from "../../../../design/components/TransitionGroup/TransitionGroup";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import * as _spring from "../../../../design/animation/reanimated/spring/spring";
import { ThemeContextProvider } from "../../../../_bundle/Module3901";
import { AccessibilityViewAnimated } from "../../../../design/components/AccessibilityView/AccessibilityView.native";
import { getEmbeddedActivityLocationChannelId } from "../../utils/embeddedActivityLocationUtils";
import ActivityPanelStateContext from "./ActivityPanelStateContext";
import ActivityPanelHeader from "./ActivityPanelHeader";
import { updateActivityPanelMode } from "../../EmbeddedActivitiesActionCreators";
import EmbeddedActivityView from "../../native/EmbeddedActivityView";
function $mk97942($env) {
return () => {
const r3 = $env;
return r3[1] ? $env.$parent[13] : {
right: {
disable: false,
override: Math.max(64, r3[0].right)
}
};
};
}
let c11340_18, useStyles, c11340_20, c11340_21, c11340_22, c11340_23;
let env11340 = {};
export function BaseActivityPanelFocusedView(props) {
let c22511_4, c22511_5, c22511_6, wrapperDimensions, wrapperOffset, shown, c22511_10, lg, animatedStyle;
const { children, header, transitionState, transitionCleanUp, updateActivityPanelModeToPIP, hasActivity: hasActivity2, context } = props;
c22511_4 = void 0;
c22511_5 = void 0;
c22511_6 = void 0;
wrapperDimensions = void 0;
wrapperOffset = void 0;
shown = void 0;
c22511_10 = void 0;
lg = void 0;
animatedStyle = void 0;
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
const styles = useStyles();
c22511_4 = styles;
const windowDimensions_native = useWindowDimensions_native();
c22511_5 = windowDimensions_native;
const safeAreaInsets_native = useSafeAreaInsets_native();
c22511_6 = safeAreaInsets_native;
const context2 = useContext(context);
wrapperDimensions = context2.wrapperDimensions;
wrapperOffset = context2.wrapperOffset;
const lockedWebView = useLockedWebView({
transitionState,
context
});
shown = lockedWebView.shown;
const renderWebView = lockedWebView.renderWebView;
const animatedKeyboardHeight = useAnimatedKeyboardHeight();
c22511_10 = animatedKeyboardHeight;
lg = Module712.radii.lg;
const _ = function _() {
const borderTopStartRadius = wrapperDimensions.isWindowLandscape ? 0 : lg;
const r10 = _VoicePanelConstants.IS_IOS ? c22511_10.get() : 0;
const width = c22511_5.width;
const height = c22511_5.height - r10 - (wrapperDimensions.isWindowLandscape ? 0 : c22511_6.top);
const r16 = shown.get() ? wrapperOffset.get().y : c22511_5.height;
const transitionComplete = function transitionComplete(r3 = false) {
if (r3) {
r3 = transitionState === _TransitionGroup.TransitionStates.YEETED;
}
if (r3) {
_ReanimatedRexport.runOnJS(transitionCleanUp)();
}
};
transitionComplete.__closure = {
transitionState,
TransitionStates: _TransitionGroup.TransitionStates,
runOnJS: _ReanimatedRexport.runOnJS,
transitionCleanUp
};
transitionComplete.__workletHash = 16073739070225;
transitionComplete.__initData = c11340_21;
const r52 = stateFromStores ? shown.get() ? 1 - wrapperOffset.get().y / c22511_5.height : 0 : 0;
return {
opacity: stateFromStores ? _timing.withTiming(r52, c11340_18, shown.get() ? wrapperOffset.get().gestureActive ? "animate-never" : "animate-always" : "animate-always", transitionComplete) : 1,
transform: [{
translateY: stateFromStores ? 0 : _spring.withSpring(r16, wrapperOffset.get().gestureActive && transitionState !== _TransitionGroup.TransitionStates.YEETED ? _ActivityPanelConstants.ACTIVITY_LAYOUT_PHYSICS_GESTURE : _ActivityPanelConstants.ACTIVITY_LAYOUT_PHYSICS_DEFAULT, "animate-always", transitionComplete)
}],
top: wrapperDimensions.isWindowLandscape ? 0 : c22511_6.top,
width,
height,
borderTopStartRadius,
borderTopEndRadius: borderTopStartRadius
};
};
_.__closure = {
wrapperDimensions,
lg,
IS_IOS: _VoicePanelConstants.IS_IOS,
animatedKeyboardHeight,
windowDimensions: windowDimensions_native,
safeArea: safeAreaInsets_native,
shown,
wrapperOffset,
transitionState,
TransitionStates: _TransitionGroup.TransitionStates,
runOnJS: _ReanimatedRexport.runOnJS,
transitionCleanUp,
reduceMotion: stateFromStores,
withTiming: _timing.withTiming,
REDUCED_MOTION_TIMING: c11340_18,
withSpring: _spring.withSpring,
ACTIVITY_LAYOUT_PHYSICS_GESTURE: _ActivityPanelConstants.ACTIVITY_LAYOUT_PHYSICS_GESTURE,
ACTIVITY_LAYOUT_PHYSICS_DEFAULT: _ActivityPanelConstants.ACTIVITY_LAYOUT_PHYSICS_DEFAULT
};
_.__workletHash = 3642447648301;
_.__initData = c11340_20;
animatedStyle = useAnimatedStyle(_);
const T = function T() {
return {
opacity: _spring.withSpring(wrapperOffset.get().gestureActive ? 1 - wrapperOffset.get().y / c22511_5.height : shown.get() ? 1 : 0, _ActivityPanelConstants.ACTIVITY_LAYOUT_PHYSICS_DEFAULT)
};
};
T.__closure = {
wrapperOffset,
shown,
windowDimensions: windowDimensions_native,
withSpring: _spring.withSpring,
ACTIVITY_LAYOUT_PHYSICS_DEFAULT: _ActivityPanelConstants.ACTIVITY_LAYOUT_PHYSICS_DEFAULT
};
T.__workletHash = 8351375063373;
T.__initData = c11340_22;
const animatedStyle2 = useAnimatedStyle(T);
const memo3 = useMemo(() => [c22511_4.wrapper, animatedStyle], [animatedStyle, styles.wrapper]);
const A = function A() {
return {
width: wrapperDimensions.width,
height: wrapperDimensions.height - (_VoicePanelConstants.IS_IOS ? c22511_10.get() : 0)
};
};
A.__closure = {
IS_IOS: _VoicePanelConstants.IS_IOS,
animatedKeyboardHeight,
wrapperDimensions
};
A.__workletHash = 10029372697959;
A.__initData = c11340_23;
const animatedStyle3 = useAnimatedStyle(A);
return <ThemeContextProvider theme={ThemeTypes.DARK}>
<ReanimatedRexport.View style={[styles.shade, animatedStyle2]} pointerEvents="none" />
<AccessibilityViewAnimated style={memo3} nativeID="activity-panel-focused-view" accessibilityViewIsModal onAccessibilityEscape={useCallback(() => {
updateActivityPanelModeToPIP();
}, [updateActivityPanelModeToPIP])}>
<ReanimatedRexport.View style={animatedStyle3}>
{renderWebView ? hasActivity2 ? children : null : null}
</ReanimatedRexport.View>
{header}
</AccessibilityViewAnimated>
</ThemeContextProvider>;
}
c11340_18 = {
duration: 300
};
useStyles = createStyles({
wrapper: {
position: "absolute",
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
overflow: "hidden",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
shade: {
...StyleSheet.absoluteFillObject,
backgroundColor: Module712.colors.BLACK
}
});
c11340_20 = {
code: "function ActivityPanelFocusedViewTsx1(){const{wrapperDimensions,lg,IS_IOS,animatedKeyboardHeight,windowDimensions,safeArea,shown,wrapperOffset,transitionState,TransitionStates,runOnJS,transitionCleanUp,reduceMotion,withTiming,REDUCED_MOTION_TIMING,withSpring,ACTIVITY_LAYOUT_PHYSICS_GESTURE,ACTIVITY_LAYOUT_PHYSICS_DEFAULT}=this.__closure;const topBorderRadius=!wrapperDimensions.isWindowLandscape?lg:0;const keyboardHeight=IS_IOS?animatedKeyboardHeight.get():0;const width=windowDimensions.width;const height=windowDimensions.height-keyboardHeight-(!wrapperDimensions.isWindowLandscape?safeArea.top:0);const y=shown.get()?wrapperOffset.get().y:windowDimensions.height;function transitionComplete(finished=false){if(finished&&transitionState===TransitionStates.YEETED){runOnJS(transitionCleanUp)();}}const targetOpacity=reduceMotion&&shown.get()?1-wrapperOffset.get().y/windowDimensions.height:0;return{opacity:reduceMotion?withTiming(targetOpacity,REDUCED_MOTION_TIMING,shown.get()&&wrapperOffset.get().gestureActive?'animate-never':'animate-always',transitionComplete):1,transform:[{translateY:!reduceMotion?withSpring(y,wrapperOffset.get().gestureActive&&transitionState!==TransitionStates.YEETED?ACTIVITY_LAYOUT_PHYSICS_GESTURE:ACTIVITY_LAYOUT_PHYSICS_DEFAULT,'animate-always',transitionComplete):0}],top:!wrapperDimensions.isWindowLandscape?safeArea.top:0,width:width,height:height,borderTopStartRadius:topBorderRadius,borderTopEndRadius:topBorderRadius};}"
};
c11340_21 = {
code: "function transitionComplete_ActivityPanelFocusedViewTsx2(finished=false){const{transitionState,TransitionStates,runOnJS,transitionCleanUp}=this.__closure;if(finished&&transitionState===TransitionStates.YEETED){runOnJS(transitionCleanUp)();}}"
};
c11340_22 = {
code: "function ActivityPanelFocusedViewTsx3(){const{wrapperOffset,shown,windowDimensions,withSpring,ACTIVITY_LAYOUT_PHYSICS_DEFAULT}=this.__closure;const opacity=function(){if(!wrapperOffset.get().gestureActive){return shown.get()?1:0;}return 1-wrapperOffset.get().y/windowDimensions.height;}();return{opacity:withSpring(opacity,ACTIVITY_LAYOUT_PHYSICS_DEFAULT)};}"
};
c11340_23 = {
code: "function ActivityPanelFocusedViewTsx4(){const{IS_IOS,animatedKeyboardHeight,wrapperDimensions}=this.__closure;const keyboardHeight=IS_IOS?animatedKeyboardHeight.get():0;return{width:wrapperDimensions.width,height:wrapperDimensions.height-keyboardHeight};}"
};
const r74 = Module19.memo(function({ transitionState: transitionState2, transitionCleanUp: transitionCleanUp2 }) {
let channel, hasActivity, portraitSafeAreasConfig, memo, memo2, callback;
let env22513;
channel = void 0;
hasActivity = void 0;
portraitSafeAreasConfig = void 0;
memo = void 0;
memo2 = void 0;
callback = void 0;
const stateFromStoresObject = useStateFromStoresObject([EmbeddedActivitiesStore, ChannelStore], () => {
const connectedActivityLocation = EmbeddedActivitiesStore.getConnectedActivityLocation();
const selfEmbeddedActivityForLocation = EmbeddedActivitiesStore.getSelfEmbeddedActivityForLocation(connectedActivityLocation);
return {
channel: ChannelStore.getChannel(getEmbeddedActivityLocationChannelId(connectedActivityLocation)),
hasActivity: selfEmbeddedActivityForLocation != null
};
}, []);
channel = stateFromStoresObject.channel;
hasActivity = stateFromStoresObject.hasActivity;
const r24 = env22513 = {
$parent: env11340
};
env22513[0] = void 0;
env22513[1] = void 0;
const safeAreaInsets_native = useSafeAreaInsets_native();
env22513[0] = safeAreaInsets_native;
const wrapperDimensions2 = useContext(ActivityPanelStateContext).wrapperDimensions;
const r32 = wrapperDimensions2.isLandscape && !wrapperDimensions2.isWindowLandscape;
const isLandscape = wrapperDimensions2.isLandscape;
const r33 = isLandscape ? !isLandscape : wrapperDimensions2.isWindowLandscape;
env22513[1] = r33;
const r34 = r32 ? DEFAULT_PORTRAIT_LETTERBOX_CONFIG : DEFAULT_PORTRAIT_SAFE_AREAS_CONFIG;
const r37 = [safeAreaInsets_native.right, r33];
const memo3 = useMemo($mk97942(r24), r37);
portraitSafeAreasConfig = r34;
memo = memo3;
memo2 = useMemo(() => (0, jsx)(ActivityPanelHeader, {}), []);
callback = useCallback(() => {
updateActivityPanelMode(ActivityPanelModes.PIP);
}, []);
return useMemo(() => <BaseActivityPanelFocusedView transitionState={transitionState2} transitionCleanUp={transitionCleanUp2} updateActivityPanelModeToPIP={callback} hasActivity={hasActivity} context={ActivityPanelStateContext} header={memo2}>
<EmbeddedActivityView channel={channel} layoutMode={ActivityLayoutMode.FOCUSED} portraitSafeAreasConfig={portraitSafeAreasConfig} landscapeSafeAreasConfig={memo} />
</BaseActivityPanelFocusedView>, [transitionState2, transitionCleanUp2, callback, hasActivity, memo2, channel, portraitSafeAreasConfig, memo]);
});
export default r74;
export function useBaseActivityPanelFocusedView(a0) {
let env22510;
const r2 = env22510 = {
$parent: env11340
};
const context = a0.context;
env22510[0] = void 0;
env22510[1] = void 0;
const safeAreaInsets_native = useSafeAreaInsets_native();
env22510[0] = safeAreaInsets_native;
const wrapperDimensions2 = useContext(context).wrapperDimensions;
const r15 = wrapperDimensions2.isLandscape && !wrapperDimensions2.isWindowLandscape;
const isLandscape = wrapperDimensions2.isLandscape;
const r17 = isLandscape ? !isLandscape : wrapperDimensions2.isWindowLandscape;
env22510[1] = r17;
const portraitSafeAreasConfig2 = r15 ? DEFAULT_PORTRAIT_LETTERBOX_CONFIG : DEFAULT_PORTRAIT_SAFE_AREAS_CONFIG;
const r22 = [safeAreaInsets_native.right, r17];
return {
portraitSafeAreasConfig: portraitSafeAreasConfig2,
landscapeSafeAreasConfig: useMemo($mk97942(r2), r22)
};
}
@@ -0,0 +1,228 @@
// Metro module 15850 (f15851).
import * as Module19 from "react";
import { useMemo, useCallback, useContext } from "react";
import { StyleSheet, View } from "react-native";
import EmbeddedActivitiesStore from "../../EmbeddedActivitiesStore";
import * as _ActivityPanelConstants from "../ActivityPanelConstants";
import { ThemeTypes } from "../../../../_bundle/Module505";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import useMorphablePanelGesture, { MorphablePanelModes } from "../../../panels/morphable/native/useMorphablePanelGesture";
import { ThemeContextProvider } from "../../../../_bundle/Module3901";
import { GestureDetector } from "../../../../_bundle/Module5273";
import BlurVisualEffectView from "./BlurVisualEffectView";
import { useStateFromStores } from "../../../../_bundle/Module589";
import useGetOrFetchApplications from "../../../applications/useGetOrFetchApplications";
import InviteActivityButton from "./InviteActivityButton";
import MinimizeActivityButton from "./MinimizeActivityButton";
import QuestActivityButton from "../../../frames/panel/native/QuestActivityButton";
import LeaveActivityButton from "./LeaveActivityButton";
import ActivityPanelStateContext from "./ActivityPanelStateContext";
function $mk97956($env) {
return () => {
let bottom, height, left, width;
const r4 = $env;
const isWindowLandscape = r4[1].isWindowLandscape;
const r8 = $env.$parent;
if (isWindowLandscape) {
width = r8[9];
bottom = 0;
left = null;
height = "auto";
} else {
height = r8[8];
width = "auto";
bottom = null;
left = 0;
}
return [r4[0].headerContainer, {
width,
height,
right: 0,
left,
bottom
}];
};
}
let BaseActivityPanelContent, useStyles, c11341_15, useStyles2, ActivityPanelHeaderContentInner;
let env11341 = {};
export function useBaseActivityPanelHeaderContent({ landscape, setMode, wrapperOffset, pipState }) {
const styles = useStyles();
let c22514_2 = styles;
const safeAreaInsets_native = useSafeAreaInsets_native();
let c22514_3 = safeAreaInsets_native;
const memo = useMemo(() => {
const borderTopStartRadius = landscape ? 0 : Module712.radii.lg;
return [StyleSheet.absoluteFill, {
borderTopStartRadius,
borderTopEndRadius: borderTopStartRadius
}];
}, [landscape]);
const memo2 = useMemo(() => {
const paddingTop = landscape ? 24 : 8;
const r3 = [c22514_2.panelHeader, landscape ? c22514_2.panelLandscape : void 0, ,];
const paddingBottom = landscape ? 24 : 8;
let paddingRight = 16;
const paddingLeft = landscape ? 16 : 8 + c22514_3.left;
if (!landscape) {
paddingRight = 8 + c22514_3.right;
}
r3[2] = {
paddingTop,
paddingBottom,
paddingLeft,
paddingRight
};
return r3;
}, [landscape, safeAreaInsets_native, styles.panelHeader, styles.panelLandscape]);
const c = function c() {
_ReanimatedRexport.runOnJS(setMode)(_ActivityPanelConstants.ActivityPanelModes.PIP);
};
c.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
setMode,
ActivityPanelModes: _ActivityPanelConstants.ActivityPanelModes
};
c.__workletHash = 14504167937928;
c.__initData = c11341_15;
return {
gesture: useMorphablePanelGesture({
mode: MorphablePanelModes.PANEL,
panGestureEnabled: true,
pipState,
swipeRequiresPop: true,
wrapperOffset,
onPanMinimizeGestureEnd: useCallback(c, [setMode]),
disableHorizontalSafeAreas: true
}),
headerWrapperStyles: memo,
headerStyles: memo2,
styles
};
}
BaseActivityPanelContent = function BaseActivityPanelContent(props) {
const { children, hasConnectedActivity, gesture, headerWrapperStyles, headerStyles, landscape: landscape2 } = props;
const styles = useStyles();
return hasConnectedActivity ? <ThemeContextProvider theme={ThemeTypes.DARK}>
<GestureDetector gesture={gesture}>
<View style={headerWrapperStyles}>
<BlurVisualEffectView />
{landscape2 ? !landscape2 : <View style={styles.pullIndicator} />}
<View style={headerStyles}>{children}</View>
</View>
</GestureDetector>
</ThemeContextProvider> : null;
};
const StyleSheet2 = StyleSheet;
useStyles = createStyles({
panelHeader: {
...StyleSheet2.absoluteFillObject,
justifyContent: "space-between",
alignItems: "center",
flexDirection: "row",
gap: 8
},
panelLandscape: {
flexDirection: "column-reverse"
},
headerContainer: {
position: "absolute",
top: 0
},
pullIndicator: {
backgroundColor: Module712.colors.WHITE,
borderRadius: Module712.radii.sm,
width: 32,
height: 4,
alignSelf: "center",
marginTop: 4,
opacity: 0.3
}
});
c11341_15 = {
code: "function ActivityPanelHeaderTsx1(){const{runOnJS,setMode,ActivityPanelModes}=this.__closure;runOnJS(setMode)(ActivityPanelModes.PIP);}"
};
const useStyles3 = createStyles({
buttonContainer: {
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_8,
flexShrink: 1
},
buttonContainerLandscape: {
flexDirection: "column-reverse"
}
});
useStyles2 = useStyles3;
ActivityPanelHeaderContentInner = Module19.memo(function ActivityPanelHeaderContentInner(props) {
const { landscape: landscape2, setMode: setMode2 } = props;
const baseActivityPanelHeaderContent = useBaseActivityPanelHeaderContent({
landscape: landscape2,
setMode: setMode2,
wrapperOffset: props.wrapperOffset,
pipState: props.pipState
});
const { gesture, headerWrapperStyles, headerStyles } = baseActivityPanelHeaderContent;
const stateFromStores = useStateFromStores([EmbeddedActivitiesStore], () => EmbeddedActivitiesStore.getSelfEmbeddedActivityForLocation(EmbeddedActivitiesStore.getConnectedActivityLocation()), []);
const applicationId = stateFromStores?.applicationId;
const [r19] = useGetOrFetchApplications([applicationId]);
const styles2 = useStyles2();
const r14 = <InviteActivityButton applicationId={r19?.id} />;
const children = [<View style={[styles2.buttonContainer, landscape2 ? styles2.buttonContainerLandscape : void 0]}>
<MinimizeActivityButton activityName={landscape2 ? void 0 : r19?.name} setMode={setMode2} />
{applicationId != null && <QuestActivityButton applicationId={applicationId} />}
{landscape2 ? r14 : null}
</View>, landscape2 ? null : r14, ,];
let selfEmbeddedActivity = stateFromStores;
if (selfEmbeddedActivity == null) {
selfEmbeddedActivity = void 0;
}
children[2] = <LeaveActivityButton selfEmbeddedActivity={selfEmbeddedActivity} setMode={setMode2} />;
return <BaseActivityPanelContent hasConnectedActivity={stateFromStores != null} gesture={gesture} headerWrapperStyles={headerWrapperStyles} headerStyles={headerStyles} landscape={landscape2}>{children}</BaseActivityPanelContent>;
});
const r79 = Module19.memo(function() {
let env22516;
const r12 = env22516 = {
$parent: env11341
};
env22516[0] = void 0;
env22516[1] = void 0;
const styles = useStyles();
env22516[0] = styles;
const context = useContext(ActivityPanelStateContext);
const wrapperDimensions = context.wrapperDimensions;
env22516[1] = wrapperDimensions;
const { setMode: setMode2, wrapperOffset, pipState } = context;
const r18 = [styles.headerContainer, wrapperDimensions.isWindowLandscape];
return <View style={useMemo($mk97956(r12), r18)}>
<ActivityPanelHeaderContentInner landscape={wrapperDimensions.isWindowLandscape} setMode={setMode2} wrapperOffset={wrapperOffset} pipState={pipState} />
</View>;
});
export default r79;
export { BaseActivityPanelContent };
export { useStyles3 as useMinimizeAndQuestButtonContainerStyles };
export function useBaseActivityPanelHeader(a0) {
let env22515;
const r6 = env22515 = {
$parent: env11341
};
const context = a0.context;
env22515[0] = void 0;
env22515[1] = void 0;
const styles = useStyles();
env22515[0] = styles;
const context2 = useContext(context);
const wrapperDimensions = context2.wrapperDimensions;
env22515[1] = wrapperDimensions;
const { setMode: setMode2, wrapperOffset, pipState } = context2;
const r16 = [styles.headerContainer, wrapperDimensions.isWindowLandscape];
return {
headerStyles: useMemo($mk97956(r6), r16),
wrapperDimensions,
setMode: setMode2,
wrapperOffset,
pipState
};
}
@@ -0,0 +1,25 @@
// Metro module 15844 (f15845).
import { ACTIVITY_PANEL_PORTRAIT_HEADER_HEIGHT } from "../ActivityPanelConstants";
const r14 = {
top: {
disable: false,
override: ACTIVITY_PANEL_PORTRAIT_HEADER_HEIGHT
}
};
export { r14 as DEFAULT_PORTRAIT_SAFE_AREAS_CONFIG };
export const DEFAULT_PORTRAIT_LETTERBOX_CONFIG = {
top: {
disable: true
},
bottom: {
disable: true
}
};
export const DEFAULT_LANDSCAPE_PILLERBOX_CONFIG = {
left: {
disable: true
},
right: {
disable: true
}
};
@@ -0,0 +1,287 @@
// Metro module 15843 (f15844).
import * as Module19 from "react";
import { useContext, useEffect, useMemo, useCallback } from "react";
import { View } from "react-native";
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import SafeAreaDisabledStore from "../../../panels/morphable/native/SafeAreaDisabledStore";
import ChannelStore from "../../../../stores/ChannelStore";
import EmbeddedActivitiesStore from "../../EmbeddedActivitiesStore";
import { ActivityLayoutMode } from "../../Constants";
import * as _ActivityPanelConstants from "../ActivityPanelConstants";
import { DEFAULT_PORTRAIT_LETTERBOX_CONFIG } from "./ActivityPanelNativeConstants";
import { ThemeTypes } from "../../../../Constants";
import * as _MorphablePanelConstants from "../../../panels/morphable/native/MorphablePanelConstants";
import { generateBoxShadowStyle, EXPERIMENTAL_HIGH_ELEVATION_SHADOW_PARAMS } from "../../../../design/void/native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { useStateFromStores, useStateFromStoresObject } from "../../../../_bundle/Module589";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
import { useLockedWebView } from "./useActivityWebViewLockManager";
import updateSharedValueIfChanged_native from "../../../reanimated/utils/updateSharedValueIfChanged.native";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import * as _MorphablePanelUtils from "../../../panels/morphable/native/MorphablePanelUtils";
import * as _TransitionGroup from "../../../../design/components/TransitionGroup/TransitionGroup";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import * as _spring from "../../../../design/animation/reanimated/spring/spring";
import getActivityContainerPIPStylesSpec from "./pip/getActivityContainerPIPStylesSpec";
import useMorphablePanelGesture, { MorphablePanelModes } from "../../../panels/morphable/native/useMorphablePanelGesture";
import { intl, t } from "../../../../intl/index.native";
import { ThemeContextProvider } from "../../../../_bundle/Module3901";
import { GestureDetector } from "../../../../_bundle/Module5273";
import { getEmbeddedActivityLocationChannelId } from "../../utils/embeddedActivityLocationUtils";
import ActivityPanelStateContext from "./ActivityPanelStateContext";
import EmbeddedActivityView from "../../native/EmbeddedActivityView";
function $mk97923($env) {
return () => {
const r8 = Math;
const r6 = $env.$parent[14];
let r5 = $env[0]?.right;
if (r5 == null) {
r5 = 0;
}
return {
right: {
disable: false,
override: r8.max(r6, r5)
}
};
};
}
let c11335_19, useStyles, c11335_21, c11335_22, c11335_23;
let env11335 = {};
export function BaseActivityPanelPIPView(props) {
let windowDimensions, safeArea, wrapperOffset, setMode, pipState, pipAvoidanceSpecs, shown, disableHorizontalSafeAreas, width, height;
const { children, transitionState, transitionCleanUp, pipOrientationLockState, hasActivity, context } = props;
windowDimensions = void 0;
safeArea = void 0;
wrapperOffset = void 0;
setMode = void 0;
pipState = void 0;
pipAvoidanceSpecs = void 0;
shown = void 0;
disableHorizontalSafeAreas = void 0;
width = void 0;
height = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
windowDimensions = useWindowDimensions_native();
safeArea = useSafeAreaInsets_native();
const context2 = useContext(context);
wrapperOffset = context2.wrapperOffset;
setMode = context2.setMode;
pipState = context2.pipState;
pipAvoidanceSpecs = context2.pipAvoidanceSpecs;
const wrapperDimensions = context2.wrapperDimensions;
const lockedWebView = useLockedWebView({
transitionState,
context
});
shown = lockedWebView.shown;
const renderWebView = lockedWebView.renderWebView;
useEffect(() => {
updateSharedValueIfChanged_native(wrapperOffset, {
gestureActive: false
});
}, [wrapperOffset]);
disableHorizontalSafeAreas = SafeAreaDisabledStore((a0) => a0.shouldDisableSafeAreas());
const J = function J() {
const r23 = pipState.get();
const pipX = r23.x;
const clampedPIPPosition = _MorphablePanelUtils.getClampedPIPPosition({
pipX,
pipY: r23.y,
width: _ActivityPanelConstants.ACTIVITY_PIP_SIZE.width,
height: _ActivityPanelConstants.ACTIVITY_PIP_SIZE.height,
windowDimensions,
safeArea,
bottomAvoidanceRegion: pipAvoidanceSpecs.get().bottom,
topAvoidanceRegion: pipAvoidanceSpecs.get().top,
positionOffset: wrapperOffset.get().gestureActive ? wrapperOffset.get() : void 0,
disableHorizontalSafeAreas
});
let r42 = clampedPIPPosition.x;
const r43 = clampedPIPPosition.y;
if (!(shown.get() || stateFromStores)) {
r42 = pipX < 0.5 && pipX >= 0 ? -(_ActivityPanelConstants.ACTIVITY_PIP_SIZE.width + Math.max(safeArea.right, _MorphablePanelConstants.PIP_WINDOW_OFFSET)) : windowDimensions.width + Math.max(safeArea.right, _MorphablePanelConstants.PIP_WINDOW_OFFSET);
}
const transitionComplete = function transitionComplete(r3 = false) {
if (r3) {
r3 = transitionState === _TransitionGroup.TransitionStates.YEETED;
}
if (r3) {
_ReanimatedRexport.runOnJS(transitionCleanUp)();
}
};
transitionComplete.__closure = {
transitionState,
TransitionStates: _TransitionGroup.TransitionStates,
runOnJS: _ReanimatedRexport.runOnJS,
transitionCleanUp
};
transitionComplete.__workletHash = 7625774548373;
transitionComplete.__initData = c11335_22;
return {
opacity: stateFromStores ? _timing.withTiming(shown.get() ? 1 : 0, c11335_19, "animate-always", transitionComplete) : 1,
transform: [{
translateY: _spring.withSpring(r43, wrapperOffset.get().gestureActive ? _ActivityPanelConstants.ACTIVITY_LAYOUT_PHYSICS_GESTURE : _ActivityPanelConstants.ACTIVITY_LAYOUT_PHYSICS_DEFAULT, "animate-always")
}, {
translateX: _spring.withSpring(r42, wrapperOffset.get().gestureActive ? _ActivityPanelConstants.ACTIVITY_LAYOUT_PHYSICS_GESTURE : _ActivityPanelConstants.ACTIVITY_LAYOUT_PHYSICS_DEFAULT, "animate-always", stateFromStores ? void 0 : transitionComplete)
}]
};
};
J.__closure = {
pipState,
getClampedPIPPosition: _MorphablePanelUtils.getClampedPIPPosition,
ACTIVITY_PIP_SIZE: _ActivityPanelConstants.ACTIVITY_PIP_SIZE,
windowDimensions,
safeArea,
pipAvoidanceSpecs,
wrapperOffset,
disableHorizontalSafeAreas,
shown,
reduceMotion: stateFromStores,
PIP_WINDOW_OFFSET: _MorphablePanelConstants.PIP_WINDOW_OFFSET,
transitionState,
TransitionStates: _TransitionGroup.TransitionStates,
runOnJS: _ReanimatedRexport.runOnJS,
transitionCleanUp,
withTiming: _timing.withTiming,
REDUCED_MOTION_TIMING: c11335_19,
withSpring: _spring.withSpring,
ACTIVITY_LAYOUT_PHYSICS_GESTURE: _ActivityPanelConstants.ACTIVITY_LAYOUT_PHYSICS_GESTURE,
ACTIVITY_LAYOUT_PHYSICS_DEFAULT: _ActivityPanelConstants.ACTIVITY_LAYOUT_PHYSICS_DEFAULT
};
J.__workletHash = 14326479117867;
J.__initData = c11335_21;
const animatedStyle = useAnimatedStyle(J);
const activityContainerPIPStylesSpec = getActivityContainerPIPStylesSpec({
pipWidth: _ActivityPanelConstants.ACTIVITY_PIP_SIZE.width,
pipHeight: _ActivityPanelConstants.ACTIVITY_PIP_SIZE.height,
pipOrientationLockState,
isLandscape: wrapperDimensions.isLandscape
});
width = activityContainerPIPStylesSpec.width;
height = activityContainerPIPStylesSpec.height;
const memo3 = useMemo(() => ({
width,
height,
pointerEvents: "none"
}), [width, height]);
const W = function W() {
_ReanimatedRexport.runOnJS(setMode)(_ActivityPanelConstants.ActivityPanelModes.PANEL);
};
W.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
setMode,
ActivityPanelModes: _ActivityPanelConstants.ActivityPanelModes
};
W.__workletHash = 2951177166574;
W.__initData = c11335_23;
const morphablePanelGesture = useMorphablePanelGesture({
panGestureEnabled: true,
onTapGestureStart: useCallback(W, [setMode]),
mode: MorphablePanelModes.PIP,
pipState,
wrapperOffset,
disableHorizontalSafeAreas: false
});
const memo2 = useMemo(() => ({
accessible: true,
accessibilityLabel: intl.string(t["3ejJer"]),
accessibilityRole: "button",
accessibilityActions: [{
name: "activate"
}],
onAccessibilityAction: () => {
setMode(_ActivityPanelConstants.ActivityPanelModes.PANEL);
}
}), [setMode]);
const r2 = renderWebView ? !hasActivity : !renderWebView;
return <ThemeContextProvider theme={ThemeTypes.DARK}>
<ReanimatedRexport.View style={[styles.wrapper, animatedStyle]} {...memo2}>
<GestureDetector gesture={morphablePanelGesture}>
<View style={styles.mask}>
{r2 ? !r2 : <View style={memo3}>{children}</View>}
</View>
</GestureDetector>
</ReanimatedRexport.View>
</ThemeContextProvider>;
}
const ACTIVITY_PIP_SIZE2 = _ActivityPanelConstants.ACTIVITY_PIP_SIZE;
c11335_19 = {
duration: 300
};
useStyles = createStyles({
wrapper: {
borderRadius: Module712.radii.lg,
...ACTIVITY_PIP_SIZE2,
...generateBoxShadowStyle(EXPERIMENTAL_HIGH_ELEVATION_SHADOW_PARAMS)
},
mask: {
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
overflow: "hidden",
borderRadius: Module712.radii.lg,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
...ACTIVITY_PIP_SIZE2
}
});
c11335_21 = {
code: "function ActivityPanelPIPViewTsx1(){const{pipState,getClampedPIPPosition,ACTIVITY_PIP_SIZE,windowDimensions,safeArea,pipAvoidanceSpecs,wrapperOffset,disableHorizontalSafeAreas,shown,reduceMotion,PIP_WINDOW_OFFSET,transitionState,TransitionStates,runOnJS,transitionCleanUp,withTiming,REDUCED_MOTION_TIMING,withSpring,ACTIVITY_LAYOUT_PHYSICS_GESTURE,ACTIVITY_LAYOUT_PHYSICS_DEFAULT}=this.__closure;const{x:pipX,y:pipY}=pipState.get();let{x:x,y:y}=getClampedPIPPosition({pipX:pipX,pipY:pipY,width:ACTIVITY_PIP_SIZE.width,height:ACTIVITY_PIP_SIZE.height,windowDimensions:windowDimensions,safeArea:safeArea,bottomAvoidanceRegion:pipAvoidanceSpecs.get().bottom,topAvoidanceRegion:pipAvoidanceSpecs.get().top,positionOffset:wrapperOffset.get().gestureActive?wrapperOffset.get():undefined,disableHorizontalSafeAreas:disableHorizontalSafeAreas});if(!shown.get()&&!reduceMotion){if(pipX<0.5&&pipX>=0){x=-(ACTIVITY_PIP_SIZE.width+Math.max(safeArea.right,PIP_WINDOW_OFFSET));}else{x=windowDimensions.width+Math.max(safeArea.right,PIP_WINDOW_OFFSET);}}function transitionComplete(finished=false){if(finished&&transitionState===TransitionStates.YEETED){runOnJS(transitionCleanUp)();}}return{opacity:reduceMotion?withTiming(shown.get()?1:0,REDUCED_MOTION_TIMING,'animate-always',transitionComplete):1,transform:[{translateY:withSpring(y,wrapperOffset.get().gestureActive?ACTIVITY_LAYOUT_PHYSICS_GESTURE:ACTIVITY_LAYOUT_PHYSICS_DEFAULT,'animate-always')},{translateX:withSpring(x,wrapperOffset.get().gestureActive?ACTIVITY_LAYOUT_PHYSICS_GESTURE:ACTIVITY_LAYOUT_PHYSICS_DEFAULT,'animate-always',!reduceMotion?transitionComplete:undefined)}]};}"
};
c11335_22 = {
code: "function transitionComplete_ActivityPanelPIPViewTsx2(finished=false){const{transitionState,TransitionStates,runOnJS,transitionCleanUp}=this.__closure;if(finished&&transitionState===TransitionStates.YEETED){runOnJS(transitionCleanUp)();}}"
};
c11335_23 = {
code: "function ActivityPanelPIPViewTsx3(){const{runOnJS,setMode,ActivityPanelModes}=this.__closure;runOnJS(setMode)(ActivityPanelModes.PANEL);}"
};
const r91 = Module19.memo(function({ transitionState: transitionState2, transitionCleanUp: transitionCleanUp2 }) {
let channelId, activity, applicationId, stateFromStores2, stateFromStores3, memo;
channelId = void 0;
activity = void 0;
applicationId = void 0;
stateFromStores2 = void 0;
stateFromStores3 = void 0;
memo = void 0;
const stateFromStoresObject = useStateFromStoresObject([EmbeddedActivitiesStore], () => {
const connectedActivityLocation = EmbeddedActivitiesStore.getConnectedActivityLocation();
return {
channelId: getEmbeddedActivityLocationChannelId(connectedActivityLocation),
activity: EmbeddedActivitiesStore.getSelfEmbeddedActivityForLocation(connectedActivityLocation)
};
});
channelId = stateFromStoresObject.channelId;
activity = stateFromStoresObject.activity;
const applicationId2 = activity?.applicationId;
let env22508;
applicationId = applicationId2;
stateFromStores2 = useStateFromStores([EmbeddedActivitiesStore], () => applicationId == null ? void 0 : EmbeddedActivitiesStore.getPipOrientationLockStateForApp(applicationId));
stateFromStores3 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId));
const r33 = env22508 = {
$parent: env11335
};
env22508[0] = void 0;
const safeAreaInsets_native = useSafeAreaInsets_native();
env22508[0] = safeAreaInsets_native;
const r41 = [safeAreaInsets_native.right];
memo = useMemo($mk97923(r33), r41);
return useMemo(() => <BaseActivityPanelPIPView transitionState={transitionState2} transitionCleanUp={transitionCleanUp2} pipOrientationLockState={stateFromStores2} hasActivity={activity != null} context={ActivityPanelStateContext}>
<EmbeddedActivityView channel={stateFromStores3} layoutMode={ActivityLayoutMode.PIP} portraitSafeAreasConfig={DEFAULT_PORTRAIT_LETTERBOX_CONFIG} landscapeSafeAreasConfig={memo} />
</BaseActivityPanelPIPView>, [activity, stateFromStores3, memo, stateFromStores2, transitionCleanUp2, transitionState2]);
});
export default r91;
export function useBaseActivityPanelPIPView() {
let env22505;
const r2 = env22505 = {
$parent: env11335
};
const safeAreaInsets_native = useSafeAreaInsets_native();
env22505[0] = safeAreaInsets_native;
const r11 = [safeAreaInsets_native.right];
return {
landscapeSafeAreasConfig: useMemo($mk97923(r2), r11)
};
}
@@ -0,0 +1,33 @@
// Metro module 15841 (f15842).
import { createContext } from "react";
import { ActivityPanelModes } from "../ActivityPanelConstants";
import { createFakeSharedValue } from "../../../reanimated/ReanimatedHelperTypes";
const r18 = {
mode: ActivityPanelModes.PANEL,
setMode: () => {
throw new Error("ActivityPanelStateContextType.Provider.setMode: not called within a context provider");
},
wrapperDimensions: {
width: 9,
height: 16,
isLandscape: false,
isWindowLandscape: false
},
pipState: createFakeSharedValue({
x: -1,
y: -1
}),
pipAvoidanceSpecs: createFakeSharedValue({
top: 0,
bottom: 0
}),
wrapperOffset: createFakeSharedValue({
x: 0,
y: 0,
gestureActive: false
}),
useActivityWebViewLock: () => true
};
const context = createContext(r18);
export default context;
export { r18 as activityPanelStateContextDefault };
@@ -0,0 +1,25 @@
// Metro module 15864 (f15865).
import { memo, useContext } from "react";
import { ActivityPanelModes } from "../ActivityPanelConstants";
import ActivityPanelStateContext from "./ActivityPanelStateContext";
import { isIOS } from "../../../../utils/PlatformUtils";
import StatusBar_android from "../../../status_bar/native/components/StatusBar.android";
import HomeIndicator from "../../../voice_panel/native/HomeIndicator";
const BaseActivityPanelSystemUIManager = function BaseActivityPanelSystemUIManager(props) {
const { mode, isWindowLandscape } = props;
let prefersHidden = mode === ActivityPanelModes.PANEL;
const PIP = ActivityPanelModes.PIP;
const prefersDeferringSystemGestures = !!isIOS() && prefersHidden;
const r28 = [mode !== PIP ? <StatusBar_android hidden={!(isWindowLandscape ? !prefersHidden : !isWindowLandscape)} barStyle="light-content" /> : null, ,];
if (prefersHidden) {
prefersHidden = !prefersDeferringSystemGestures;
}
r28[1] = <HomeIndicator prefersHidden={prefersHidden} prefersDeferringSystemGestures={prefersDeferringSystemGestures} />;
return <>{r28}</>;
};
const r26 = memo(function() {
const context = useContext(ActivityPanelStateContext);
return <BaseActivityPanelSystemUIManager mode={context.mode} isWindowLandscape={context.wrapperDimensions.isWindowLandscape} />;
});
export default r26;
export { BaseActivityPanelSystemUIManager };
@@ -0,0 +1,61 @@
// Metro module 15842 (f15843).
import { useContext, useMemo, useCallback } from "react";
import { StyleSheet, View } from "react-native";
import { ActivityPanelModes } from "../ActivityPanelConstants";
import ActivityPanelPIPView from "./ActivityPanelPIPView";
import ActivityPanelFocusedView from "./ActivityPanelFocusedView";
import useIsConnectedToVoiceChannel from "../../../voice_panel/native/hooks/useIsConnectedToVoiceChannel";
import { LayerScope } from "../../../../design/components/Layers/native/LayerScope.native";
import { TransitionGroup } from "../../../../design/components/TransitionGroup/TransitionGroup";
import ActivityPanelSystemUIManager from "./ActivityPanelSystemUIManager";
import ActivityPanelStateContext from "./ActivityPanelStateContext";
let getKey, wrapChildren, c11334_12, _excluded, _excluded2, BaseActivityPanelUI;
const renderActivityOrPIP = function renderActivityOrPIP(a0, a1, a2, a3) {
return a1 === "pip" ? <ActivityPanelPIPView key={a0} transitionState={a2} transitionCleanUp={a3} /> : <ActivityPanelFocusedView key={a0} transitionState={a2} transitionCleanUp={a3} />;
};
getKey = function getKey(a0) {
return a0;
};
wrapChildren = function wrapChildren(a0) {
return <View style={StyleSheet.absoluteFill} pointerEvents="box-none">
{a0}
</View>;
};
BaseActivityPanelUI = function BaseActivityPanelUI(props) {
const { renderActivityOrPIP: renderActivityOrPIP2, context, renderActivityPanelSystemUIManager } = props;
const mode = useContext(context).mode;
const isConnectedToVoiceChannel = useIsConnectedToVoiceChannel();
let c22503_1 = isConnectedToVoiceChannel;
const memo = useMemo(() => {
let r8;
L8: {
L7: {
if (mode !== ActivityPanelModes.DISCONNECTED) {
if (mode === ActivityPanelModes.PIP && c22503_1) {
break L7;
}
if (mode === ActivityPanelModes.PIP) {
r8 = _excluded;
break L8;
}
r8 = _excluded2;
break L8;
}
}
r8 = c11334_12;
}
return r8;
}, [mode, isConnectedToVoiceChannel]);
return <LayerScope>
{renderActivityPanelSystemUIManager()}
<TransitionGroup items={memo} renderItem={renderActivityOrPIP2} getItemKey={getKey} wrapChildren={wrapChildren} />
</LayerScope>;
};
c11334_12 = [];
_excluded = ["pip"];
_excluded2 = ["activity"];
export default function ActivityPanelUI() {
const callback = useCallback(() => <ActivityPanelSystemUIManager />, []);
return useMemo(() => <BaseActivityPanelUI renderActivityOrPIP={renderActivityOrPIP} context={ActivityPanelStateContext} renderActivityPanelSystemUIManager={callback} />, [callback]);
};
export { BaseActivityPanelUI };
@@ -0,0 +1,13 @@
// Metro module 15851 (f15852).
import { memo } from "react";
import { StyleSheet } from "react-native";
import { hexWithOpacity, hexToRgbaString } from "../../../../utils/ColorUtils";
import Module712 from "../../../../_bundle/Module712";
import { useToken } from "../../../../design/tokens/native/useToken";
import VisualEffectView from "../../../visual_effect_view/native/VisualEffectView";
let c11342_5 = hexWithOpacity(Module712.unsafe_rawColors.BLACK, 0.24);
const r32 = memo(function() {
const token = useToken(Module712.colors.VOICE_VIDEO_VIDEO_TILE_BLUR_FALLBACK, "dark");
return <VisualEffectView style={StyleSheet.absoluteFill} blurStyle="default" blurTintRgba={hexToRgbaString(c11342_5)} android_fallbackColor={token} blurAmount={0.24} blurTheme="dark" />;
});
export default r32;
@@ -0,0 +1,20 @@
// Metro module 15852 (f15853).
import { memo } from "react";
import LocalActivityStore from "../../../../stores/LocalActivityStore";
import SelfPresenceStore from "../../../../stores/SelfPresenceStore";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { useStateFromStores } from "../../../../_bundle/Module589";
import getCurrentUserPresenceActivity from "../../utils/getCurrentUserPresenceActivity";
import { Button } from "../../../../design/components/Button/native/Button.native";
import Module10223 from "../../../../_bundle/Module10223";
import { intl, t } from "../../../../intl/index.native";
const r24 = memo(function InviteActivityButton(props) {
const applicationId = props.applicationId;
const stateFromStores = useStateFromStores([LocalActivityStore, SelfPresenceStore], () => getCurrentUserPresenceActivity(LocalActivityStore, SelfPresenceStore, applicationId), [applicationId]);
return stateFromStores != null ? <Button onPress={() => {
ActionSheetActionCreators.openLazy(import("./ActivityInviteSheet"), `ActivityInviteSheet-${stateFromStores.session_id}`, {
activity: stateFromStores
});
}} icon={Module10223} text={intl.string(t["OzOM/q"])} accessibilityLabel={intl.string(t["OzOM/q"])} variant="secondary-overlay" size="sm" shrink maxFontSizeMultiplier={1} /> : null;
});
export default r24;
@@ -0,0 +1,24 @@
// Metro module 15862 (f15863).
import { memo } from "react";
import { ActivityPanelModes } from "../ActivityPanelConstants";
import { Button } from "../../../../design/components/Button/native/Button.native";
import Module10711 from "../../../../_bundle/Module10711";
import { intl, t } from "../../../../intl/index.native";
import EmbeddedActivitiesNativeManager from "../../native/EmbeddedActivitiesNativeManager";
const BaseLeaveActivityButton = function BaseLeaveActivityButton(props) {
return <Button onPress={props.onPress} icon={Module10711} text={intl.string(t["Hi1/aQ"])} accessibilityLabel={intl.string(t.k0Aph0)} variant="destructive" size="sm" maxFontSizeMultiplier={1} />;
};
const r24 = memo(function LeaveActivityButton(props) {
const { selfEmbeddedActivity, setMode } = props;
return <BaseLeaveActivityButton onPress={function onPress() {
setMode(ActivityPanelModes.DISCONNECTED);
setTimeout(() => {
EmbeddedActivitiesNativeManager.leaveActivity({
location: selfEmbeddedActivity?.location,
applicationId: selfEmbeddedActivity?.applicationId
});
}, 400);
}} />;
});
export default r24;
export { BaseLeaveActivityButton };
@@ -0,0 +1,25 @@
// Metro module 15856 (f15857).
import { memo, useCallback } from "react";
import { View } from "react-native";
import { ActivityPanelModes } from "../ActivityPanelConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { Button } from "../../../../design/components/Button/native/Button.native";
import Module8393 from "../../../../_bundle/Module8393";
import { intl, t } from "../../../../intl/index.native";
import { IconButton } from "../../../../design/components/Button/native/IconButton.native";
const useStyles = createStyles({
buttonParent: {
flexShrink: 1
}
});
const r32 = memo(function MinimizeActivityButton(props) {
const { activityName, setMode } = props;
const callback = useCallback(() => {
setMode(ActivityPanelModes.PIP);
}, [setMode]);
const styles = useStyles();
return activityName !== void 0 && activityName !== "" ? <View style={styles.buttonParent}>
<Button icon={Module8393} accessibilityLabel={intl.string(t.brPQ5U)} onPress={callback} text={activityName} size="sm" variant="secondary-overlay" maxFontSizeMultiplier={1} shrink />
</View> : <IconButton icon={Module8393} accessibilityLabel={intl.string(t.brPQ5U)} onPress={callback} size="sm" variant="secondary-overlay" maxFontSizeMultiplier={1} />;
});
export default r32;
@@ -0,0 +1,54 @@
// Metro module 15846 (f15847).
import { OrientationLockState } from "../../../Constants";
import { LANDSCAPE_ACTIVITY_ASPECT_RATIO } from "../../ActivityPanelConstants";
import roundToNearestPixel from "../../../../voice_panel/native/utils/roundToNearestPixel";
const t = function t(a0) {
let marginLeft, marginTop, shouldHorizontallyCenter, shouldVerticallyCenter, width;
const pipWidth = a0.pipWidth;
let pipHeight = a0.pipHeight;
let pipOrientationLockState = a0.pipOrientationLockState;
const isLandscape = a0.isLandscape;
if (pipOrientationLockState == null) {
pipOrientationLockState = OrientationLockState.UNLOCKED;
}
L7: {
L6: {
if (pipOrientationLockState !== OrientationLockState.PORTRAIT) {
if (pipOrientationLockState === OrientationLockState.UNLOCKED && !isLandscape) {
break L6;
}
width = pipHeight * LANDSCAPE_ACTIVITY_ASPECT_RATIO;
marginLeft = -1 * roundToNearestPixel(width / 2);
marginTop = 0;
shouldVerticallyCenter = false;
shouldHorizontallyCenter = true;
break L7;
}
}
const r31 = pipWidth * LANDSCAPE_ACTIVITY_ASPECT_RATIO;
marginTop = -1 * roundToNearestPixel(r31 / 2);
marginLeft = 0;
shouldVerticallyCenter = true;
shouldHorizontallyCenter = false;
pipHeight = r31;
width = pipWidth;
}
return {
width,
height: pipHeight,
shouldHorizontallyCenter,
shouldVerticallyCenter,
marginLeft,
marginTop
};
};
t.__closure = {
OrientationLockState,
LANDSCAPE_ACTIVITY_ASPECT_RATIO,
roundToNearestPixel
};
t.__workletHash = 7141745103186;
t.__initData = {
code: "function getActivityContainerPipStylesSpec_getActivityContainerPIPStylesSpecTsx1({pipWidth:pipWidth,pipHeight:pipHeight,pipOrientationLockState:pipOrientationLockState,isLandscape:isLandscape}){const{OrientationLockState,LANDSCAPE_ACTIVITY_ASPECT_RATIO,roundToNearestPixel}=this.__closure;const nonNullPipOrientationLockState=pipOrientationLockState!==null&&pipOrientationLockState!==void 0?pipOrientationLockState:OrientationLockState.UNLOCKED;const shouldUsePortraitAspectRatio=nonNullPipOrientationLockState===OrientationLockState.PORTRAIT||nonNullPipOrientationLockState===OrientationLockState.UNLOCKED&&!isLandscape;let width=pipWidth;let height=pipHeight;let shouldHorizontallyCenter=false;let shouldVerticallyCenter=false;let marginLeft=0;let marginTop=0;if(shouldUsePortraitAspectRatio){width=pipWidth;height=width*LANDSCAPE_ACTIVITY_ASPECT_RATIO;shouldVerticallyCenter=true;marginTop=roundToNearestPixel(height/2)*-1;}else{height=pipHeight;width=height*LANDSCAPE_ACTIVITY_ASPECT_RATIO;shouldHorizontallyCenter=true;marginLeft=roundToNearestPixel(width/2)*-1;}return{width:width,height:height,shouldHorizontallyCenter:shouldHorizontallyCenter,shouldVerticallyCenter:shouldVerticallyCenter,marginLeft:marginLeft,marginTop:marginTop};}"
};
export default t;
@@ -0,0 +1,61 @@
// Metro module 15836 (f15837).
import { useSharedValue, useAnimatedReaction } from "../../../../reanimated/ReanimatedRexport";
import useAnimatedKeyboardHeight from "../../../../keyboard/native/useAnimatedKeyboardHeight";
import useScreenNameSharedValue from "../../../../panels/morphable/native/useScreenNameSharedValue";
import * as _cheapWorkletShallowEqual from "../../../../reanimated/native/cheapWorkletShallowEqual";
import getPIPBottomOffsetForPIPMode from "../../../../panels/morphable/native/getPIPBottomOffsetForPIPMode";
import getAdjustedBottomOffsets from "../../../../panels/morphable/native/getAdjustedBottomOffsets";
import updateSharedValueIfChanged_native from "../../../../reanimated/utils/updateSharedValueIfChanged.native";
const __initData = {
code: "function usePIPAvoidanceSpecsTsx1(){const{keyboardHeight,safeArea,screenName}=this.__closure;return{keyboardHeight:keyboardHeight.get(),safeAreaBottom:safeArea.bottom,screenName:screenName.get()};}"
};
const __initData2 = {
code: "function usePIPAvoidanceSpecsTsx2(props,previous){const{cheapWorkletShallowEqual,getPIPBottomOffsetForPIPMode,getAdjustedBottomOffsets,updateSharedValueIfChanged,pipAvoidanceSpecs}=this.__closure;if(cheapWorkletShallowEqual(props,previous!==null&&previous!==void 0?previous:undefined))return;const{keyboardHeight:keyboardHeight,safeAreaBottom:safeAreaBottom,screenName:screenName}=props;const screenBottomOffset=getPIPBottomOffsetForPIPMode(screenName);const{bottomOffset:bottomOffset}=getAdjustedBottomOffsets({screenBottomOffset:screenBottomOffset,safeAreaBottom:safeAreaBottom,keyboardHeight:keyboardHeight});updateSharedValueIfChanged(pipAvoidanceSpecs,{top:0,bottom:bottomOffset});}"
};
export default function usePIPAvoidanceSpecs(a0) {
let c22500_0 = a0;
const sharedValue = useSharedValue({
top: 0,
bottom: 0
});
const animatedKeyboardHeight = useAnimatedKeyboardHeight();
let c22500_2 = animatedKeyboardHeight;
const screenNameSharedValue = useScreenNameSharedValue();
let c22500_3 = screenNameSharedValue;
const n = () => ({
keyboardHeight: c22500_2.get(),
safeAreaBottom: c22500_0.bottom,
screenName: c22500_3.get()
});
n.__closure = {
keyboardHeight: animatedKeyboardHeight,
safeArea: a0,
screenName: screenNameSharedValue
};
n.__workletHash = 9790941132204;
n.__initData = __initData;
const f = function f(a0, a1) {
if (!_cheapWorkletShallowEqual.cheapWorkletShallowEqual(a0, a1 == null ? void 0 : a1)) {
const { keyboardHeight, safeAreaBottom } = a0;
updateSharedValueIfChanged_native(sharedValue, {
top: 0,
bottom: getAdjustedBottomOffsets({
screenBottomOffset: getPIPBottomOffsetForPIPMode(a0.screenName),
safeAreaBottom,
keyboardHeight
}).bottomOffset
});
}
};
f.__closure = {
cheapWorkletShallowEqual: _cheapWorkletShallowEqual.cheapWorkletShallowEqual,
getPIPBottomOffsetForPIPMode,
getAdjustedBottomOffsets,
updateSharedValueIfChanged: updateSharedValueIfChanged_native,
pipAvoidanceSpecs: sharedValue
};
f.__workletHash = 643938425459;
f.__initData = __initData2;
useAnimatedReaction(n, f);
return sharedValue;
};
@@ -0,0 +1,72 @@
// Metro module 15839 (f15840).
import { useState, useId, useInsertionEffect, useLayoutEffect, useContext, useEffect } from "react";
import { useSharedValue } from "../../../reanimated/ReanimatedRexport";
import { TransitionStates } from "../../../../design/components/TransitionGroup/TransitionGroup";
export default function useActivityWebViewLockManager() {
return useState(() => {
let c28165_0, c28165_1, c28165_2, $mk117053 = function() {
return () => {
for (const item of c28165_2) {
const [r12, r34] = item;
const { canRender, callback } = r34;
const canRender2 = getCanRender2(r12);
if (canRender2 !== canRender) {
const callback2 = callback;
c28165_2.set(r12, {
canRender: canRender2,
callback: callback2
});
callback2(canRender2);
}
}
c28165_0 = void 0;
};
};
const getCanRender2 = function getCanRender(a0) {
return c28165_1.size === 0 || c28165_1.values().next()?.value === a0;
};
c28165_1 = new Set();
c28165_2 = new Map();
return function() {
const id = useId();
const [state, setState] = useState(() => c28165_1.size === 0 || c28165_1.values().next()?.value === id);
useInsertionEffect(() => {
c28165_1.add(id);
c28165_2.set(id, {
callback: setState,
canRender: c28165_1.size === 0 || c28165_1.values().next()?.value === id
});
return () => {
c28165_1.delete(id);
c28165_2.delete(id);
};
}, [id]);
useLayoutEffect(() => {
if (c28165_0 == null) {
c28165_0 = Promise.resolve().then($mk117053());
}
return () => {
if (c28165_0 == null) {
c28165_0 = Promise.resolve().then($mk117053());
}
};
}, [id, setState]);
return state;
};
})[0];
};
export function useLockedWebView({ transitionState, context }) {
const sharedValue = useSharedValue(false);
const activityWebViewLock = (0, useContext(context).useActivityWebViewLock)();
useEffect(() => {
if (transitionState !== TransitionStates.YEETED && activityWebViewLock) {
sharedValue.set(true);
} else {
sharedValue.set(false);
}
}, [sharedValue, transitionState, activityWebViewLock]);
return {
shown: sharedValue,
renderWebView: activityWebViewLock
};
}
@@ -0,0 +1,12 @@
// Metro module 15834 (f15835).
import EmbeddedActivitiesStore from "../../../EmbeddedActivitiesStore";
import { ActivityPanelModes } from "../../ActivityPanelConstants";
import { useStateFromStores } from "../../../../../_bundle/Module589";
import { getEmbeddedActivityLocationChannelId } from "../../../utils/embeddedActivityLocationUtils";
import isVoiceEmbeddedActivity from "../../../utils/isVoiceEmbeddedActivity";
export function useIsActivityPanelFullscreen() {
return useStateFromStores([EmbeddedActivitiesStore], () => {
const embeddedActivityLocationChannelId = getEmbeddedActivityLocationChannelId(EmbeddedActivitiesStore.getConnectedActivityLocation());
return EmbeddedActivitiesStore.getActivityPanelMode() === ActivityPanelModes.PANEL && !isVoiceEmbeddedActivity(embeddedActivityLocationChannelId);
});
}
@@ -0,0 +1,29 @@
// Metro module 12282 (f12283).
import { decodeCustomActivityLink, CustomLinkType } from "../../../_bundle/Module12283";
import { getAssetImage } from "../../../utils/ApplicationAssetUtils";
import { getQuickLinkImage } from "../utils/CustomActivityLinkUtils";
class CustomActivityLinkRecord {
constructor(a0) {
const prototype = new.target.prototype;
let type = decodeCustomActivityLink(a0.link_id)?.type;
if (type == null) {
type = null;
}
const r15 = {
__proto__: prototype
};
r15.type = type;
r15.applicationId = a0.application_id;
r15.linkId = a0.link_id;
r15.assetId = "asset_id" in a0 ? a0.asset_id : void 0;
r15.assetPath = "asset_path" in a0 ? a0.asset_path : void 0;
r15.title = a0.title;
r15.description = a0.description;
r15.customId = a0.custom_id;
return r15;
}
getAssetURL() {
return this.type === CustomLinkType.MANAGED ? getAssetImage(this.applicationId, this.assetId, 512) : this.type === CustomLinkType.QUICK ? getQuickLinkImage(this.assetPath) : void 0;
}
}
export default CustomActivityLinkRecord;
@@ -0,0 +1,25 @@
// Metro module 12281 (f12282).
import CustomActivityLinkRecord from "../records/CustomActivityLinkRecord";
import Module589 from "../../../_bundle/Module589";
import Dispatcher from "../../../Dispatcher";
let c8481_1 = {};
class CustomActivityLinksStore extends Module589.Store {
static displayName = "CustomActivityLinksStore";
getOne(a0, a1) {
if (c8481_1[a0] != null) {
return c8481_1[a0][a1];
}
}
}
const customActivityLinksStore = new CustomActivityLinksStore(Dispatcher, {
CUSTOM_ACTIVITY_LINK_FETCH_SUCCESS: function handleFetchSuccess({ applicationId, link }) {
if (c8481_1[applicationId] == null) {
c8481_1[applicationId] = Object.create(null);
}
c8481_1[applicationId][link.link_id] = new CustomActivityLinkRecord(link);
},
LOGOUT: function handleLogout() {
c8481_1 = {};
}
});
export default customActivityLinksStore;
@@ -0,0 +1,18 @@
// Metro module 16177 (f16178).
import { AnalyticEvents } from "../../Constants";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
export default function trackActivityProblem({ problem, channel, embeddedActivityLocation, feedback, activityApplication, analyticsData = {}, location: location2, rating = null }) {
AnalyticsUtils.track(AnalyticEvents.ACTIVITY_REPORT_PROBLEM, {
reason: problem,
guild_id: channel == null ? void 0 : channel.getGuildId(),
channel_id: channel?.id,
application_id: activityApplication?.id,
application_name: activityApplication?.name,
location: location2,
rating,
feedback,
embedded_activity_location_kind: embeddedActivityLocation.kind,
rtc_connection_id: analyticsData.rtc_connection_id,
media_session_id: analyticsData.media_session_id
});
};
@@ -0,0 +1,18 @@
// Metro module 15882 (f15883).
import ChannelStore from "../../stores/ChannelStore";
import RTCConnectionStore from "../../stores/RTCConnectionStore";
import EmbeddedActivitiesStore from "./EmbeddedActivitiesStore";
import { AnalyticEvents } from "../../Constants";
import { getEmbeddedActivityLocationChannelId } from "./utils/embeddedActivityLocationUtils";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
export function trackActivityThermalStateNoticeShown() {
const currentEmbeddedActivity = EmbeddedActivitiesStore.getCurrentEmbeddedActivity();
const embeddedActivityLocationChannelId = getEmbeddedActivityLocationChannelId(currentEmbeddedActivity?.location);
AnalyticsUtils.track(AnalyticEvents.ACTIVITY_THERMAL_STATE_NOTICE_SHOWN, {
channel_id: embeddedActivityLocationChannelId,
application_id: currentEmbeddedActivity?.applicationId,
activity_session_id: currentEmbeddedActivity?.compositeInstanceId,
guild_id: ChannelStore.getBasicChannel(embeddedActivityLocationChannelId)?.guild_id,
media_session_id: RTCConnectionStore.getMediaSessionId()
});
}
@@ -0,0 +1,42 @@
// Metro module 11214 (f11215).
import { useMemo } from "react";
import UserStore from "../../stores/UserStore";
import TestModeStore from "../../stores/game_store/TestModeStore";
import EmbeddedActivitiesStore from "./EmbeddedActivitiesStore";
import { useStateFromStores, useStateFromStoresArray } from "../../_bundle/Module589";
import useGetOrFetchApplications from "../applications/useGetOrFetchApplications";
import { isNotNullish } from "../../utils/GlobalUtils";
import getPlatform from "./utils/getPlatform";
import { getOS } from "../../utils/PlatformUtils";
import isApplicationAgeRestricted from "../applications/utils/isApplicationAgeRestricted";
export function useActivityShelfData(c18627_0) {
let stateFromStores2, c18627_4, memo, memo2, memo3;
const stateFromStores = useStateFromStores([UserStore], UserStore.getCurrentUser);
const stateFromStoresArray = useStateFromStoresArray([EmbeddedActivitiesStore], () => EmbeddedActivitiesStore.getShelfActivities(c18627_0));
stateFromStores2 = useStateFromStores([TestModeStore], () => TestModeStore.testModeEmbeddedApplicationId);
const r34 = stateFromStoresArray.map((item) => item.application_id);
const getOrFetchApplications = useGetOrFetchApplications(stateFromStores2 != null ? [stateFromStores2, ...r34] : r34);
c18627_4 = getOrFetchApplications;
memo = useMemo(() => c18627_4.filter(isNotNullish), [getOrFetchApplications]);
memo2 = useMemo(() => stateFromStores2 != null && (memo.length > 0 && (memo[0].id === stateFromStores2 && memo[0].embeddedActivityConfig != null)) ? [{
activity: memo[0].embeddedActivityConfig,
application: memo[0]
}] : [], [memo, stateFromStores2]);
memo3 = useMemo(() => stateFromStoresArray.map((a0) => {
const application = memo.find((item) => item.id === a0.application_id);
return application != null ? {
activity: a0,
application
} : null;
}).filter(isNotNullish), [stateFromStoresArray, memo]);
return useMemo(() => [...memo2, ...memo3].filter((item) => {
let supported_platforms = item.activity.supported_platforms;
if (supported_platforms == null) {
supported_platforms = [];
}
return supported_platforms.includes(getPlatform(getOS()));
}).filter((item) => {
const requires_age_gate = item.activity.requires_age_gate;
return (requires_age_gate ? stateFromStores?.nsfwAllowed === true : !requires_age_gate) || stateFromStores?.nsfwAllowed == null;
}).filter(({ application }) => !(stateFromStores?.nsfwAllowed === false && isApplicationAgeRestricted(application.id))), [stateFromStores?.nsfwAllowed, memo3, memo2]);
}
@@ -0,0 +1,16 @@
// Metro module 15969 (f15970).
import { useMemo } from "react";
import useActivityShelfItems from "./useActivityShelfItems";
export function useActivityShelfItemData(a0, a1) {
const activityShelfItems = useActivityShelfItems({
guildId: a0
});
let c22662_1 = activityShelfItems;
return useMemo(() => {
let r5 = c22662_1.find((item) => item.application.id === a1);
if (r5 == null) {
r5 = null;
}
return r5;
}, [activityShelfItems, a1]);
}
@@ -0,0 +1,33 @@
// Metro module 11213 (f11214).
import { useMemo } from "react";
import DeveloperActivityShelfStore from "./DeveloperActivityShelfStore";
import { useStateFromStoresObject } from "../../_bundle/Module589";
import { useActivityShelfData } from "./useActivityShelfData";
import useActivityShelfItemsSorting from "./useActivityShelfItemsSorting";
import { useDeveloperActivityShelfItems } from "./useDeveloperActivityShelfItems";
export default function useActivityShelfItems({ guildId, enableFilter = false }) {
let c18626_2, developerActivityShelfItems;
let c18626_0 = enableFilter;
c18626_2 = void 0;
developerActivityShelfItems = void 0;
const filter = useStateFromStoresObject([DeveloperActivityShelfStore], () => ({
filter: DeveloperActivityShelfStore.getFilter()
})).filter;
const activityShelfItemsSorting = useActivityShelfItemsSorting(useActivityShelfData(guildId));
c18626_2 = activityShelfItemsSorting;
developerActivityShelfItems = useDeveloperActivityShelfItems();
return useMemo(() => {
const shouldKeepShelfItem = function shouldKeepShelfItem(a0) {
return c18626_0 ? filter === "" || !!a0.application.name.toLowerCase().includes(filter.toLowerCase()) : !c18626_0;
};
const r23 = [...developerActivityShelfItems].filter(shouldKeepShelfItem);
const set = new Set(r23.map((item) => item.application.id));
for (const item of c18626_2) {
const r40 = set.has(item.application.id);
if (r40 ? !r40 : shouldKeepShelfItem(item)) {
r23.push(item);
}
}
return r23;
}, [developerActivityShelfItems, enableFilter, filter, activityShelfItemsSorting]);
};
@@ -0,0 +1,45 @@
// Metro module 11215 (f11216).
import { useMemo } from "react";
import { FrecencyUserSettingsActionCreators } from "../user_settings/UserSettingsProtoActionCreators";
import getPlatform from "./utils/getPlatform";
import { getOS } from "../../utils/PlatformUtils";
import { EmbeddedActivityLabelTypes } from "../../flow/Server";
export default function useActivityShelfItemsSorting(a0) {
FrecencyUserSettingsActionCreators.loadIfNecessary();
return useMemo(() => {
let c26972_0, c26972_1;
const r5 = [];
let c26971_0 = r5;
a0.forEach((item) => c26971_0.push(item.application.id));
const r14 = [...r5];
r14.sort((c30371_0, c30371_1) => c26971_0.findIndex((item) => item === c30371_0) < c26971_0.findIndex((item) => item === c30371_1) ? -1 : 1);
c26972_0 = void 0;
c26972_1 = void 0;
c26972_0 = [...a0];
c26972_1 = 0;
r14.forEach((c31618_0) => {
const r7 = c26972_0.findIndex((item) => item.application.id === c31618_0);
if (r7 !== -1) {
const r14 = c26972_0[r7];
c26972_0.splice(r7, 1);
c26972_0 = [...c26972_0.slice(0, c26972_1), r14, ...c26972_0.slice(c26972_1)];
c26972_1 = c26972_1 + 1;
}
});
c26972_0.map((item, index) => [item, index]).filter((item) => {
const [r22] = item;
const embeddedActivityConfig = r22.application.embeddedActivityConfig;
const r27 = embeddedActivityConfig == null ? void 0 : embeddedActivityConfig.client_platform_config[getPlatform(getOS())]?.label_type;
return r27 != null && (r27 === EmbeddedActivityLabelTypes.NEW || r27 === EmbeddedActivityLabelTypes.UPDATED);
}).forEach((item) => {
const [r27, r10] = item;
const r9 = r27.application.embeddedActivityConfig != null ? r27.application.embeddedActivityConfig.shelf_rank != null ? r27.application.embeddedActivityConfig.shelf_rank - 1 : r10 : r10;
if (r9 < r10) {
const r41 = c26972_0[r10];
c26972_0.splice(r10, 1);
c26972_0 = [...c26972_0.slice(0, r9), r41, ...c26972_0.slice(r9)];
}
});
return c26972_0;
}, [a0]);
};
+13
View File
@@ -0,0 +1,13 @@
// Metro module 15975 (f15976).
import UserStore from "../../stores/UserStore";
import EmbeddedActivitiesStore from "./EmbeddedActivitiesStore";
import { useStateFromStoresArray } from "../../_bundle/defaultAreStatesEqual";
export default function useActivityUsers(a0, a1) {
return useStateFromStoresArray([EmbeddedActivitiesStore, UserStore], () => {
if (a1 == null) {
return [];
}
const r9 = EmbeddedActivitiesStore.getEmbeddedActivitiesForChannel(a1).find((item) => item.applicationId === a0);
return r9 == null ? [] : Array.from(r9.userIds).map((item) => UserStore.getUser(item)).filter((item) => item != null);
}, [a1, a0]);
};
@@ -0,0 +1,27 @@
// Metro module 11216 (f11217).
import { useMemo } from "react";
import DeveloperActivityShelfStore from "./DeveloperActivityShelfStore";
import { DEFAULT_EMBEDDED_ACTIVITY_CONFIG } from "./Constants";
import { useStateFromStoresObject, useStateFromStoresArray } from "../../_bundle/Module589";
export function useDeveloperActivityShelfItems() {
let isEnabled, lastUsedObject, stateFromStoresArray;
const stateFromStoresObject = useStateFromStoresObject([DeveloperActivityShelfStore], () => ({
isEnabled: DeveloperActivityShelfStore.getIsEnabled(),
lastUsedObject: DeveloperActivityShelfStore.getLastUsedObject()
}), []);
isEnabled = stateFromStoresObject.isEnabled;
lastUsedObject = stateFromStoresObject.lastUsedObject;
stateFromStoresArray = useStateFromStoresArray([DeveloperActivityShelfStore], () => DeveloperActivityShelfStore.getDeveloperShelfItems(), []);
return useMemo(() => isEnabled ? stateFromStoresArray.map((item) => ({
application: item,
activity: {
...DEFAULT_EMBEDDED_ACTIVITY_CONFIG,
...item.embeddedActivityConfig,
application_id: item.id
}
})).sort((a, b) => {
const r5 = lastUsedObject[a.application.id];
const r4 = lastUsedObject[b.application.id];
return r5 == null ? 1 : r4 == null ? -1 : r4 - r5;
}) : [], [stateFromStoresArray, isEnabled, lastUsedObject]);
}
@@ -0,0 +1,15 @@
// Metro module 10661 (f10662).
import { useEffect } from "react";
import Dispatcher from "../../Dispatcher";
export default function useDispatchOpenActivity({ connectedEmbeddedActivity }) {
const applicationId = connectedEmbeddedActivity?.applicationId;
useEffect(() => {
if (connectedEmbeddedActivity != null && applicationId != null) {
Dispatcher.dispatch({
type: "EMBEDDED_ACTIVITY_OPEN",
location: connectedEmbeddedActivity.location,
applicationId
});
}
}, [applicationId, connectedEmbeddedActivity]);
};
@@ -0,0 +1,92 @@
// Metro module 11233 (f11234).
import { useMemo } from "react";
import PresenceStore from "../../stores/PresenceStore";
import UserStore from "../../stores/UserStore";
import EmbeddedActivitiesStore, { NO_ACTIVITIES } from "./EmbeddedActivitiesStore";
import { useStateFromStoresArray, useStateFromStores, statesWillNeverBeEqual } from "../../_bundle/Module589";
import { getEmbeddedActivityLocationChannelId } from "./utils/embeddedActivityLocationUtils";
import useGetOrFetchApplications from "../applications/useGetOrFetchApplications";
import { isNotNullish } from "../../utils/GlobalUtils";
const useEmbeddedApps = function useEmbeddedApps(a0, a1) {
let c18644_2, c18644_3, stateFromStoresArray;
const getOrFetchApplications = useGetOrFetchApplications(a0.map((item) => item.applicationId));
c18644_2 = getOrFetchApplications;
const set = new Set([]);
c18644_3 = set;
for (const item of a0) {
for (const userId of item.userIds) {
set.add(userId);
}
}
stateFromStoresArray = useStateFromStoresArray([UserStore], () => {
const r0 = [];
for (const item of c18644_3) {
r0.push(UserStore.getUser(item));
}
return r0;
}, [set]);
return useMemo(() => {
let c26976_0 = new Map();
stateFromStoresArray.forEach((item) => {
if (item != null) {
c26976_0.set(item.id, item);
}
});
return a0.map((item, index) => {
const application = c18644_2[index];
const userParticipantAvatarUrls = [];
for (const userId of item.userIds) {
const r31 = c26976_0.get(userId);
if (r31 != null) {
if (a1 != null) {
const r35 = a1(r31);
if (r35 != null) {
userParticipantAvatarUrls.push(r35);
}
}
}
}
return application == null ? null : {
embeddedActivity: item,
application,
userParticipantAvatarUrls
};
}).filter(isNotNullish);
}, [a0, getOrFetchApplications, stateFromStoresArray, a1]);
};
export default function useEmbeddedAppsForChannel(c18645_0, a1) {
return useEmbeddedApps(useStateFromStoresArray([EmbeddedActivitiesStore], () => c18645_0 != null && (c18645_0.id != null && c18645_0.id !== "") ? EmbeddedActivitiesStore.getEmbeddedActivitiesForChannel(c18645_0.id) : NO_ACTIVITIES), a1);
};
export function useEmbeddedAppsByChannel(c18646_0) {
const embeddedApps = useEmbeddedApps(useStateFromStores([EmbeddedActivitiesStore], () => c18646_0 != null ? EmbeddedActivitiesStore.getEmbeddedActivitiesForGuild(c18646_0) : NO_ACTIVITIES));
return useMemo(() => {
const map = new Map();
let c26977_0 = map;
embeddedApps.forEach((embeddedApp) => {
const embeddedActivityLocationChannelId = getEmbeddedActivityLocationChannelId(embeddedApp.embeddedActivity.location);
if (embeddedActivityLocationChannelId != null) {
let r15 = c26977_0.get(embeddedActivityLocationChannelId);
if (r15 == null) {
r15 = [];
}
r15.push(embeddedApp);
c26977_0.set(embeddedActivityLocationChannelId, r15);
}
});
return map;
}, [embeddedApps]);
}
export { useEmbeddedApps };
export function useEmbeddedAppsWithPresence(a0) {
return useStateFromStores([PresenceStore], () => {
const map = new Map();
let c26978_0 = map;
a0.forEach((item) => {
c26978_0.set(item == null ? void 0 : item.application?.id, {
...item,
presenceActivity: PresenceStore.findActivity(item == null ? void 0 : item.embeddedActivity.userIds.values().next().value, ({ application_id }) => application_id === (item == null ? void 0 : item.application?.id))
});
});
return map;
}, [a0], statesWillNeverBeEqual);
}
@@ -0,0 +1,25 @@
// Metro module 11291 (f11292).
import { useEffect } from "react";
import DeveloperActivityShelfStore, { DevShelfFetchState } from "./DeveloperActivityShelfStore";
import { useIsActivitiesEnabledForCurrentPlatform } from "./useIsActivitiesEnabledForCurrentPlatform";
import { DeveloperMode } from "../user_settings/UserSettings";
import { useStateFromStores } from "../../_bundle/Module589";
import { fetchDeveloperApplications } from "./EmbeddedActivitiesActionCreators";
export function useFetchDeveloperActivityShelfItems() {
const isActivitiesEnabledForCurrentPlatform = useIsActivitiesEnabledForCurrentPlatform();
const setting = DeveloperMode.getSetting();
const stateFromStores = useStateFromStores([DeveloperActivityShelfStore], () => DeveloperActivityShelfStore.getFetchState(), []);
useEffect(() => {
let r1 = isActivitiesEnabledForCurrentPlatform;
if (isActivitiesEnabledForCurrentPlatform) {
r1 = setting;
}
if (r1) {
r1 = stateFromStores === DevShelfFetchState.INITIALIZED;
}
if (r1) {
fetchDeveloperApplications();
}
}, [isActivitiesEnabledForCurrentPlatform, stateFromStores, setting]);
return null;
}
@@ -0,0 +1,23 @@
// Metro module 10532 (f10533).
import { useEffect } from "react";
import { useIsActivitiesEnabledForCurrentPlatform } from "./useIsActivitiesEnabledForCurrentPlatform";
import useIsPrivateChannelWithEnabledActivities from "./utils/useIsPrivateChannelWithEnabledActivities";
import { fetchShelf } from "./EmbeddedActivitiesActionCreators";
export default function useIsActivitiesAvailableInShelf(a0, a1) {
const guildId = a0;
const isActivitiesEnabledForCurrentPlatform = useIsActivitiesEnabledForCurrentPlatform();
const isPrivateChannelWithEnabledActivities = useIsPrivateChannelWithEnabledActivities(a1);
let r17 = a0 != null && a0 !== "" || isPrivateChannelWithEnabledActivities;
let c18113_2 = r17;
useEffect(() => {
if (c18113_2 && isActivitiesEnabledForCurrentPlatform) {
fetchShelf({
guildId
});
}
}, [a0, isActivitiesEnabledForCurrentPlatform, r17]);
if (r17) {
r17 = isActivitiesEnabledForCurrentPlatform;
}
return r17;
};
@@ -0,0 +1,8 @@
// Metro module 10533 (f10534).
import { isTablet } from "../../_bundle/Module4426";
export function useIsActivitiesEnabledForCurrentPlatform() {
return !isTablet;
}
export function getIsActivitiesEnabledForCurrentPlatform() {
return !isTablet;
}
@@ -0,0 +1,23 @@
// Metro module 10510 (f10511).
import ChannelRTCStore from "../calls/ChannelRTCStore";
import EmbeddedActivitiesStore from "./EmbeddedActivitiesStore";
import { getEmbeddedActivityParticipantId } from "../calls/ChannelRTCParticipants";
import { useStateFromStores } from "../../_bundle/Module589";
export default function useIsActivityFocused(c18091_0) {
return useStateFromStores([ChannelRTCStore, EmbeddedActivitiesStore], () => {
const selectedParticipant = ChannelRTCStore.getSelectedParticipant(c18091_0);
const currentEmbeddedActivity = EmbeddedActivitiesStore.getCurrentEmbeddedActivity();
return selectedParticipant != null && currentEmbeddedActivity != null && selectedParticipant.id === getEmbeddedActivityParticipantId({
applicationId: currentEmbeddedActivity.applicationId,
instanceId: currentEmbeddedActivity?.compositeInstanceId
});
});
};
export function isActivityFocused({ channelId, ChannelRTCStore: ChannelRTCStore2, EmbeddedActivitiesStore: EmbeddedActivitiesStore2 }) {
const selectedParticipant = ChannelRTCStore2.getSelectedParticipant(channelId);
const currentEmbeddedActivity = EmbeddedActivitiesStore2.getCurrentEmbeddedActivity();
return selectedParticipant != null && currentEmbeddedActivity != null && selectedParticipant.id === getEmbeddedActivityParticipantId({
applicationId: currentEmbeddedActivity.applicationId,
instanceId: currentEmbeddedActivity?.compositeInstanceId
});
}
@@ -0,0 +1,73 @@
// Metro module 10481 (f10482).
import { useMemo, useEffect } from "react";
import PresenceSubscriptionsStore from "../presence_subscriptions/PresenceSubscriptionsStore";
import PresenceStore from "../../stores/PresenceStore";
import { useStateFromStoresArray } from "../../_bundle/Module589";
import { subscribe } from "../presence_subscriptions/PresenceSubscriptionsActionCreators";
let c7027_6 = [];
let c7027_7 = [];
let c7027_8 = [];
export default function useSubscribeMissingActivities(a0, a1) {
let c17994_0;
let c17995_2, stateFromStoresArray;
let c17995_0 = a0;
const [r10, r17] = useMemo(() => {
let r9;
if (a1.isPrivate()) {
const r12 = c17995_0.filter((item) => item.application?.id != null && item.activity?.party_id != null);
r9 = [r12, r12.map((item) => item.id)];
} else {
r9 = [c7027_8, c7027_7];
}
return r9;
}, [a0, a1]);
c17995_2 = r10;
stateFromStoresArray = useStateFromStoresArray([PresenceStore], () => {
const r4 = [];
let c26681_0 = r4;
c17995_2.forEach((item) => {
if (PresenceStore.findActivity(item.author.id, (a0) => {
const application_id = a0.application_id;
return application_id === item.application?.id && a0.party?.id === item.activity?.party_id;
}, null, true) != null) {
c26681_0.push(item.id);
}
});
return r4;
}, [r10]);
const [r32, r33] = [r17, useMemo(() => {
let r7;
let c26682_1;
const stateFromStoresArray2 = stateFromStoresArray;
if (c17995_2.length === 0) {
r7 = c7027_6;
} else {
r7 = [];
c26682_1 = r7;
c17995_2.forEach((item) => {
const id = item.application?.id;
const party_id = item.activity?.party_id;
if (!(item.id in stateFromStoresArray2) && id != null && party_id != null) {
c26682_1.push({
userId: item.author.id,
applicationId: id,
partyId: party_id,
messageId: item.id,
channelId: item.channel_id,
inviteTime: item.timestamp.getTime()
});
}
});
}
return r7;
}, [r10, stateFromStoresArray])];
c17994_0 = r33;
useEffect(() => {
for (const item of c17994_0) {
if (!PresenceSubscriptionsStore.isSubscribed(item)) {
subscribe(item);
}
}
}, [r33]);
return [r32, r33];
};
@@ -0,0 +1,40 @@
// Metro module 10477 (f10478).
import { ActivityFlags, ActivityPartyPrivacy } from "../../../Constants";
import { AllowActivityPartyPrivacyFriends, AllowActivityPartyPrivacyVoiceChannel } from "../../user_settings/UserSettings";
import { Storage } from "../../../_bundle/Module595";
import { hasFlag } from "../../../_bundle/Module1384";
import isEmbeddedActivity from "./isEmbeddedActivity";
export function computeActivityFlags({ secrets }, r11 = false, r7 = false, r10 = false, r9 = ActivityPartyPrivacy.PRIVATE) {
let r33;
const r0 = r11 ? ActivityFlags.INSTANCE | 0 : 0;
const r1 = secrets?.join != null ? r0 | ActivityFlags.JOIN : r0;
const r20 = r10 ? r1 | ActivityFlags.CONTEXTLESS : r1;
if (r7) {
const r55 = r20 | ActivityFlags.EMBEDDED;
const setting3 = AllowActivityPartyPrivacyFriends.getSetting();
const setting4 = AllowActivityPartyPrivacyVoiceChannel.getSetting();
const PARTY_PRIVACY_FRIENDS2 = ActivityFlags.PARTY_PRIVACY_FRIENDS;
const r70 = setting3 ? r55 | PARTY_PRIVACY_FRIENDS2 : r55 & ~PARTY_PRIVACY_FRIENDS2;
const PARTY_PRIVACY_VOICE_CHANNEL2 = ActivityFlags.PARTY_PRIVACY_VOICE_CHANNEL;
r33 = r55 | (setting4 ? r70 | PARTY_PRIVACY_VOICE_CHANNEL2 : r70 & ~PARTY_PRIVACY_VOICE_CHANNEL2);
} else {
const r25 = r9 === ActivityPartyPrivacy.PUBLIC || Storage.get("ACTIVITIES_FORCE_PUBLIC");
r33 = r20;
if (r25) {
const setting = AllowActivityPartyPrivacyFriends.getSetting();
const setting2 = AllowActivityPartyPrivacyVoiceChannel.getSetting();
const PARTY_PRIVACY_FRIENDS = ActivityFlags.PARTY_PRIVACY_FRIENDS;
const r2 = setting ? r20 | PARTY_PRIVACY_FRIENDS : r20 & ~PARTY_PRIVACY_FRIENDS;
const PARTY_PRIVACY_VOICE_CHANNEL = ActivityFlags.PARTY_PRIVACY_VOICE_CHANNEL;
r33 = r20 | (setting2 ? r2 | PARTY_PRIVACY_VOICE_CHANNEL : r2 & ~PARTY_PRIVACY_VOICE_CHANNEL);
}
}
return r33;
}
export function isContextlessEmbeddedActivity(a0) {
let r11 = a0?.flags;
if (r11 == null) {
r11 = 0;
}
return hasFlag(r11, ActivityFlags.CONTEXTLESS) && isEmbeddedActivity(a0);
}
@@ -0,0 +1,161 @@
// Metro module 12280 (f12281).
import CustomActivityLinksStore from "../stores/CustomActivityLinksStore";
import { Endpoints } from "../../../Constants";
import { decodeCustomActivityLink, CustomLinkType } from "../../../_bundle/Module12283";
import { HTTP } from "../../../_bundle/sendRequest";
import Dispatcher from "../../../Dispatcher";
let loadCustomActivityLink, c8480_11;
const fetchCustomActivityLink = async function fetchCustomActivityLink(c27281_0, c27281_1) {
let body, body2;
L24: {
L23: {
L22: {
L19: {
if (c27281_0 == null) {
break L24;
}
if (c27281_1 == null) {
break L24;
}
const r36 = decodeCustomActivityLink(c27281_1);
if (r36 == null) {
break L23;
}
const type = r36.type;
if (CustomLinkType.MANAGED === type) {
body2 = (await HTTP.get({
url: Endpoints.APPLICATION_MANAGED_ACTIVITY_LINK(c27281_0, r36.decodedLinkId),
rejectWithError: false
})).body;
break L22;
}
if (CustomLinkType.QUICK === type) {
body = (await HTTP.get({
url: Endpoints.APPLICATION_QUICK_ACTIVITY_LINK(c27281_0, r36.decodedLinkId),
rejectWithError: false
})).body;
break L19;
}
r36.type;
return null;
}
return body;
}
return body2;
}
return null;
}
return null;
};
loadCustomActivityLink = async function loadCustomActivityLink(c27283_0, c27283_1) {
let r30, r54;
let c27283_3;
let c30518_0, c30518_1;
L16: {
L15: {
L14: {
c27283_3 = void 0;
c30518_0 = c27283_0;
c30518_1 = void 0;
if (c27283_0 != null && c27283_1 != null) {
c30518_1 = await fetchCustomActivityLink(c27283_0, c27283_1);
if (c30518_1 == null) {
r54 = Promise.reject("fetchCustomActivityLink body is null");
break L15;
}
Dispatcher.dispatch({
type: "CUSTOM_ACTIVITY_LINK_FETCH_SUCCESS",
applicationId: c30518_0,
link: c30518_1
});
break L14;
}
r30 = Promise.reject("appId or linkId null");
break L16;
}
return void 0;
}
return r54;
}
return r30;
};
c8480_11 = new Set();
export { fetchCustomActivityLink };
export async function getCustomActivityLinkParams(c27282_0, c27282_1, c27282_2) {
let r28, r30, r52;
let customId;
let c27282_6 = 0;
let c30517_0;
L20: {
L19: {
try {
c30517_0 = void 0;
customId = c27282_2;
if (customId == null) {
customId = void 0;
}
if (c27282_1 == null) {
r28 = {
customId
};
break L20;
}
if (customId != null) {
r30 = {
customId
};
break L19;
}
c27282_6 = 1;
c30517_0 = await fetchCustomActivityLink(c27282_0, c27282_1);
r52 = c30517_0 == null ? {
customId: void 0
} : {
customId: c30517_0.custom_id
};
c27282_6 = 0;
} catch ($e) {
let r24 = $e;
if (c27282_6 !== 0) {
while (true) {
try {
c27282_6 = 0;
} catch ($e) {
r24 = $e;
if (c27282_6 === 0) {
break;
}
continue;
}
return {
customId: void 0
};
}
}
throw r24;
}
return r52;
}
return r30;
}
return r28;
}
export function getQuickLinkImage(a0) {
if (a0 != null) {
return `${location.protocol}//${window.GLOBAL_ENV.CDN_HOST}/attachments-quick-links/${a0}`;
}
}
export { loadCustomActivityLink };
export function getOrFetchCustomActivityLink(a0, a1) {
let r8 = CustomActivityLinksStore.getOne(a0, a1);
if (r8 == null) {
const r10 = c8480_11.has(a1);
r8 = null;
if (!r10) {
loadCustomActivityLink(a0, a1);
c8480_11.add(a1);
r8 = null;
}
}
return r8;
}
@@ -0,0 +1,86 @@
// Metro module 12376 (f12377).
import UserStore from "../../../stores/UserStore";
import { ActivityActionTypes } from "../../../Constants";
import { intl, t } from "../../../intl/index.native";
import RequestToStream_messages from "../../request_to_stream/RequestToStream.messages";
import { getName } from "../../../utils/NicknameUtils";
const getAskToJoinText = function getAskToJoinText(a0, a1, a2, a3, a4) {
if (a0.author.id === a3) {
if (a2.isPrivate()) {
const user = UserStore.getUser(a2.getRecipientId());
if (user != null) {
return a4 ? intl.formatToPlainString(t.JddpN2, {
username: user.globalName,
appName: a1
}) : intl.formatToPlainString(t.gYVkSW, {
username: user.globalName,
appName: a1
});
}
}
return a4 ? intl.formatToPlainString(t["2N1kNS"], {
appName: a1
}) : intl.formatToPlainString(t.IA6uDV, {
appName: a1
});
}
return a4 ? intl.formatToPlainString(t.XE8axA, {
username: a0.author.globalName,
appName: a1
}) : intl.formatToPlainString(t.hgcjOn, {
username: a0.author.globalName,
appName: a1
});
};
export function getHeaderText(a0, a1, a2) {
if (ActivityActionTypes.LISTEN === a1) {
return intl.formatToPlainString(t["/8czH4"], {
name: a0
});
}
if (ActivityActionTypes.WATCH === a1) {
return intl.formatToPlainString(t.BBJXVk, {
name: a0
});
}
if (ActivityActionTypes.JOIN === a1) {
return a2 ? void 0 : intl.string(t.pkq6Vq);
}
if (ActivityActionTypes.STREAM_REQUEST === a1) {
return intl.string(RequestToStream_messages.DKHhec);
}
ActivityActionTypes.JOIN_REQUEST;
return intl.string(t.Ckxb6j);
}
export function getRequestToStreamText(a0, a1, a2) {
return a0.author.id === a2 ? intl.string(RequestToStream_messages["8B3U5O"]) : intl.formatToPlainString(RequestToStream_messages["d/qbC0"], {
username: getName(a1.guild_id, a1.id, a0.author)
});
}
export { getAskToJoinText };
export function getDeadGameInviteText(a0, a1, a2, a3, a4) {
const type = a0.activity?.type;
if (ActivityActionTypes.LISTEN !== type && ActivityActionTypes.WATCH !== type && ActivityActionTypes.JOIN !== type) {
if (ActivityActionTypes.STREAM_REQUEST === type) {
return a0.author.id === a3 ? intl.string(RequestToStream_messages["8B3U5O"]) : intl.formatToPlainString(RequestToStream_messages["d/qbC0"], {
username: getName(a2.guild_id, a2.id, a0.author)
});
}
ActivityActionTypes.JOIN_REQUEST;
return getAskToJoinText(a0, a1, a2, a3, true);
}
return intl.string(a4 ? t.x1UXGR : t["Ek+51n"]);
}
export function getPartyText({ activityActionType, maxPartySize, partySize }) {
return activityActionType !== ActivityActionTypes.STREAM_REQUEST ? activityActionType === ActivityActionTypes.LISTEN ? maxPartySize > 0 ? intl.formatToPlainString(t.Zogoou, {
partySize,
maxPartySize
}) : intl.formatToPlainString(t.UGei0j, {
partySize
}) : maxPartySize > 0 ? intl.formatToPlainString(t.gLu7NU, {
partySize,
maxPartySize
}) : intl.formatToPlainString(t["65JnWC"], {
partySize
}) : "";
}
@@ -0,0 +1,104 @@
// Metro module 10638 (f10639).
import DeveloperActivityShelfStore, { DevShelfFetchState } from "../DeveloperActivityShelfStore";
import { AbortCodes } from "../../../Constants";
import { intl, t } from "../../../intl/index.native";
import EmbeddedActivityClientError from "../../errors/EmbeddedActivityClientError";
import { DeveloperMode } from "../../user_settings/UserSettings";
import { fetchDeveloperApplications } from "../EmbeddedActivitiesActionCreators";
import InteractionCallbackError from "../../errors/InteractionCallbackError";
import { interactionCallbackErrorReason } from "../../interactions/InteractionUtils";
let c7139_7 = {
ClientError: 0,
0: "ClientError",
CallbackError: 1,
1: "CallbackError",
ApiError: 2,
2: "ApiError"
};
export { c7139_7 as ActivityLaunchFailErrorType };
export async function getActivityLaunchErrorInfo(c26768_0, c26768_1) {
let r317;
let c26768_2, c26768_4;
let c30271_0, c30271_1, c30271_2, c30271_3, c30271_4, c30271_5;
L46: {
c26768_4 = void 0;
c30271_0 = c26768_0;
c30271_1 = c26768_1;
c30271_2 = void 0;
c30271_3 = void 0;
c30271_4 = void 0;
c30271_5 = void 0;
c30271_5 = intl.string(t["IOy+I5"]);
if (c26768_0 instanceof EmbeddedActivityClientError) {
c30271_2 = c7139_7.ClientError;
c30271_4 = c26768_0.reason;
const fetchState = DeveloperActivityShelfStore.getFetchState();
if (DeveloperMode.getSetting() && fetchState !== DevShelfFetchState.LOADED) {
await fetchDeveloperApplications();
const reason2 = c30271_0.reason;
if (EmbeddedActivityClientError.Reasons.PRIMARY_APP_COMMAND_NOT_FOUND === reason2) {
if (DeveloperActivityShelfStore.inDevModeForApplication(c30271_1)) {
c30271_5 = intl.string(t.hXRXfz);
}
} else if (EmbeddedActivityClientError.Reasons.INVALID_CHANNEL === reason2) {
c30271_5 = intl.string(t.j29zCr);
} else if (EmbeddedActivityClientError.Reasons.LEGACY_LAUNCH_CLIENT_VALIDATION_FAILED === reason2) {
c30271_3 = c30271_0.detailCode;
}
r317 = {
message: c30271_5,
errorType: c30271_2,
errorStatus: c30271_3,
errorCode: c30271_4
};
break L46;
}
const reason = c30271_0.reason;
if (EmbeddedActivityClientError.Reasons.PRIMARY_APP_COMMAND_NOT_FOUND === reason) {
if (DeveloperActivityShelfStore.inDevModeForApplication(c30271_1)) {
c30271_5 = intl.string(t.hXRXfz);
}
} else if (EmbeddedActivityClientError.Reasons.INVALID_CHANNEL === reason) {
c30271_5 = intl.string(t.j29zCr);
} else if (EmbeddedActivityClientError.Reasons.LEGACY_LAUNCH_CLIENT_VALIDATION_FAILED === reason) {
c30271_3 = c30271_0.detailCode;
}
} else if (c26768_0 instanceof InteractionCallbackError) {
c30271_2 = c7139_7.CallbackError;
c30271_4 = c26768_0.reason;
const r71 = interactionCallbackErrorReason(c26768_0.reason, c26768_1);
c26768_2 = r71;
if (r71 == null) {
c26768_2 = c30271_5;
}
c30271_5 = c26768_2;
} else {
c30271_2 = c7139_7.ApiError;
c30271_3 = c26768_0.status;
c30271_4 = c26768_0.code;
const code = c26768_0.code;
if (AbortCodes.INVALID_ACTIVITY_LAUNCH_NO_ACCESS === code) {
c30271_5 = intl.string(t.GyzcrS);
} else if (AbortCodes.INVALID_ACTIVITY_LAUNCH_PREMIUM_TIER === code) {
c30271_5 = intl.string(t.zxv7EF);
} else if (AbortCodes.INVALID_PERMISSIONS === code) {
c30271_5 = intl.string(t.hHGrWz);
} else if (AbortCodes.INVALID_ACTIVITY_LAUNCH_AFK_CHANNEL === code) {
c30271_5 = intl.string(t.j29zCr);
} else if (AbortCodes.INVALID_ACTIVITY_LAUNCH_AGE_GATED === code) {
c30271_5 = intl.string(t["4WuFRE"]);
} else if (AbortCodes.INVALID_ACTIVITY_LAUNCH_DEV_PREVIEW_GUILD_SIZE === code) {
c30271_5 = intl.string(t.RvkXdb);
} else if (AbortCodes.ACTIVITY_CONFIGURATION_DOES_NOT_SUPPORT_PLATFORM === code) {
c30271_5 = intl.string(t.uGDCcw);
}
}
return {
message: c30271_5,
errorType: c30271_2,
errorStatus: c30271_3,
errorCode: c30271_4
};
}
return r317;
}
@@ -0,0 +1,21 @@
// Metro module 13544 (f13545).
import { parseQuestsEmbedCode } from "../../coded_links/findCodedLinks";
import URLUtils from "../../../utils/URLUtils";
import { intl, t } from "../../../intl/index.native";
let c9403_3 = [parseQuestsEmbedCode];
export function resolveActivityShareMessageContent(a0, a1, a2) {
let c20524_0 = false;
const r14 = a0.replaceAll(URLUtils.URL_REGEX, (a0) => {
const r7 = c9403_3.some((item) => item(a0) != null);
if (r7) {
c20524_0 = true;
}
return r7 ? a0 : `\`${a0}\``;
});
return c20524_0 ? r14 : `${r14}
${intl.formatToMarkdownString(t.dZJpdG, {
applicationName: a1.name,
link: a2
})}`;
}
+5
View File
@@ -0,0 +1,5 @@
// Metro module 10668 (f10669).
import { APPLICATIONS_WITH_ALLOWED_POPUPS } from "../Constants";
export function allowPopups(a0) {
return a0 != null && (!!APPLICATIONS_WITH_ALLOWED_POPUPS.has(a0.id) || ("embeddedActivityConfig" in a0 ? a0.embeddedActivityConfig?.displays_advertisements === true : "embedded_activity_config" in a0 && a0.embedded_activity_config?.displays_advertisements === true));
}
@@ -0,0 +1,8 @@
// Metro module 10655 (f10656).
import { getBestActiveInputForChannelId } from "../../../utils/native/ChatInputUtils";
export default function closeCustomKeyboard(a0) {
const bestActiveInputForChannelId = getBestActiveInputForChannelId(a0);
if (bestActiveInputForChannelId != null) {
bestActiveInputForChannelId.closeCustomKeyboard();
}
};
@@ -0,0 +1,328 @@
// Metro module 10647 (f10648).
import ChannelStore from "../../../stores/ChannelStore";
import EmbeddedActivitiesStore from "../EmbeddedActivitiesStore";
import { ApplicationFlags } from "../../../Constants";
import getCachedOrFetchActivityApplicationForLaunch from "./getCachedOrFetchActivityApplicationForLaunch";
import { EmbeddedActivityLocationKind } from "../../../_bundle/Module10648";
import Dispatcher from "../../../Dispatcher";
import { APIError } from "../../../errors/index";
import { getEmbeddedActivityLocationChannelId } from "./embeddedActivityLocationUtils";
import confirmActivityChangeAlert from "../confirmActivityChangeAlert";
import { confirmActivityAgeGateAlert } from "../confirmActivityAgeGateAlert.native";
import * as _ApplicationFlagUtils from "../../applications/utils/ApplicationFlagUtils";
import { confirmExternalAppLaunchAlert } from "../confirmExternalAppLaunchAlert.native";
function $mk116032($env) {
return (a0) => {
const r8 = $env;
let env31581 = {
$parent: $env
};
env31581[0] = a0;
const selfEmbeddedActivities = EmbeddedActivitiesStore.getSelfEmbeddedActivities();
const r7 = r8[0];
const r21 = selfEmbeddedActivities.get(r7.id);
env31581[1] = r21;
const channel = ChannelStore.getChannel(getEmbeddedActivityLocationChannelId(r21?.location));
if (r21 != null && channel != null) {
const r32 = r8[2];
if (r32 != null) {
r32();
}
confirmActivityChangeAlert(r7, channel, () => {
const r3 = env31581.$parent.$parent;
const r5 = (0, r3[1])(r3[2][10])();
const r14 = env31581.$parent;
r5.leaveActivity({
location: env31581[1].location,
applicationId: r14[0].id,
shouldClosePopout: r14[1]
});
(0, env31581[0])(true);
}, () => (0, env31581[0])(false));
} else {
a0(true);
}
};
}
function $mk116033($env) {
return (c31582_0) => {
const r6 = $env;
const r8 = r6[4];
if (r8 != null) {
r8();
}
confirmActivityAgeGateAlert({
application: r6[5],
channelId: r6[2]?.id,
onAgree: () => c31582_0(true),
onDisagree: () => c31582_0(false)
});
};
}
function $mk116034($env) {
return (c31583_0) => {
const r5 = $env;
const r6 = r5[3];
if (r6 != null) {
r6();
}
confirmExternalAppLaunchAlert({
application: r5[4],
onConfirm: () => c31583_0(true),
onCancel: () => c31583_0(false)
});
};
}
function $mk116036($env) {
return function confirmActivityAgeGate() {
return $env[10].apply(this, arguments);
};
}
function $mk116037($env) {
return function confirmExternalAppLaunch() {
return $env[11].apply(this, arguments);
};
}
let env7147 = {};
const getOrFetchApplicationForLaunch = async function getOrFetchApplicationForLaunch(c26777_0) {
let cachedOrFetchActivityApplicationForLaunch;
let channelId, guildId, c26777_5;
let c26777_6 = 0;
let c30276_0, c30276_1, c30276_2, c30276_3, c30276_4;
try {
c30276_0 = void 0;
c30276_1 = void 0;
c30276_2 = void 0;
c30276_0 = c26777_0.applicationId;
c30276_1 = c26777_0.channelId;
c30276_2 = c26777_0.guildId;
c30276_3 = void 0;
await void 0;
c26777_6 = 1;
cachedOrFetchActivityApplicationForLaunch = await getCachedOrFetchActivityApplicationForLaunch(c30276_0, c30276_1);
c26777_6 = 0;
} catch ($e) {
const r31 = $e;
let r8 = r31;
c26777_5 = r31;
if (c26777_6 !== 0) {
while (true) {
try {
const r84 = c26777_5;
c26777_6 = 0;
c30276_4 = r84;
c30276_3 = c30276_2 != null ? EmbeddedActivityLocationKind.GUILD_CHANNEL : EmbeddedActivityLocationKind.PRIVATE_CHANNEL;
channelId = c30276_1;
if (channelId == null) {
channelId = null;
}
guildId = c30276_2;
if (guildId == null) {
guildId = null;
}
Dispatcher.dispatch({
type: "EMBEDDED_ACTIVITY_LAUNCH_FAIL",
nonce: "",
applicationId: c30276_0,
channelId,
guildId,
error: new APIError(c30276_4),
locationKind: c30276_3
});
} catch (r81) {
r8 = r81;
c26777_5 = r81;
if (c26777_6 === 0) {
break;
}
continue;
}
return void 0;
}
}
throw r8;
}
return cachedOrFetchActivityApplicationForLaunch;
};
env7147[9] = function _confirmActivityChange() {
const r8 = async (c26778_0) => {
let c26778_1;
L11: {
L15: {
let env30277;
const r9 = env30277 = {
$parent: env7147
};
c26778_1 = r9;
env30277[0] = void 0;
env30277[1] = void 0;
env30277[2] = void 0;
env30277[0] = c26778_0.currentEmbeddedApplication;
env30277[1] = c26778_0.shouldClosePopoutOnLeaveCurrentEmbeddedApplication;
env30277[2] = c26778_0.onConfirmActivityLaunchChecksAlertOpen;
await void 0;
if (env30277[0] != null) {
if (await new Promise($mk116032(c26778_1))) {
break L11;
}
break L15;
}
break L11;
}
return false;
}
return true;
};
env7147[9] = r8;
return r8.apply(this, arguments);
};
env7147[10] = function _confirmActivityAgeGate() {
const r8 = async (c26779_0) => {
let c26779_1, guildId2, c26779_3, c26779_4;
L32: {
L23: {
let env30278;
const r29 = env7147;
c26779_4 = r29;
const r9 = env30278 = {
$parent: r29
};
c26779_3 = r9;
env30278[0] = void 0;
env30278[1] = void 0;
env30278[2] = void 0;
env30278[3] = void 0;
env30278[4] = void 0;
env30278[0] = c26779_0.application;
env30278[1] = c26779_0.applicationId;
env30278[2] = c26779_0.channel;
env30278[3] = c26779_0.user;
env30278[4] = c26779_0.onConfirmActivityLaunchChecksAlertOpen;
env30278[5] = void 0;
await void 0;
if (env30278[3].nsfwAllowed != null) {
break L32;
}
const r53 = env30278[0];
c26779_1 = r53;
if (r53 == null) {
const id = env30278[2]?.id;
const r92 = env30278[2];
guildId2 = r92 == null ? void 0 : r92.getGuildId();
if (guildId2 == null) {
guildId2 = void 0;
}
c26779_1 = await getOrFetchApplicationForLaunch({
applicationId: env30278[1],
channelId: id,
guildId: guildId2
});
}
env30278[5] = c26779_1;
if (env30278[5] == null) {
break L23;
}
const requires_age_gate = env30278[5].embeddedActivityConfig?.requires_age_gate;
if (requires_age_gate == null) {
break L32;
}
if (!requires_age_gate) {
break L32;
}
if (await new Promise($mk116033(c26779_3))) {
break L32;
}
return false;
}
return false;
}
return true;
};
env7147[10] = r8;
return r8.apply(this, arguments);
};
env7147[11] = function _confirmExternalAppLaunch() {
const r8 = async (c26780_0) => {
let guildId3;
let env30279;
const r28 = env7147;
let c26780_4 = r28;
const r9 = env30279 = {
$parent: r28
};
let c26780_3 = r9;
env30279[0] = void 0;
env30279[1] = void 0;
env30279[2] = void 0;
env30279[3] = void 0;
env30279[0] = c26780_0.application;
env30279[1] = c26780_0.applicationId;
env30279[2] = c26780_0.channel;
env30279[3] = c26780_0.onConfirmActivityLaunchChecksAlertOpen;
env30279[4] = void 0;
await void 0;
const r47 = env30279[0];
let c26780_1 = r47;
if (r47 == null) {
const id = env30279[2]?.id;
const r92 = env30279[2];
guildId3 = r92 == null ? void 0 : r92.getGuildId();
if (guildId3 == null) {
guildId3 = void 0;
}
c26780_1 = await getOrFetchApplicationForLaunch({
applicationId: env30279[1],
channelId: id,
guildId: guildId3
});
}
env30279[4] = c26780_1;
let r59 = env30279[4] != null;
if (r59) {
const hasApplicationFlag = _ApplicationFlagUtils.hasApplicationFlag(env30279[4], ApplicationFlags.EMBEDDED_RELEASED);
const r73 = hasApplicationFlag ? !hasApplicationFlag : !env30279[4].isVerified;
r59 = r73 ? !!EmbeddedActivitiesStore.hasActivityEverBeenLaunched(env30279[1]) || new Promise($mk116034(c26780_3)) : !r73;
}
return r59;
};
env7147[11] = r8;
return r8.apply(this, arguments);
};
export async function confirmActivityLaunchChecks(c26781_0) {
let r90;
let c26781_1;
L19: {
L16: {
let env30280;
const r10 = env30280 = {
$parent: env7147
};
c26781_1 = r10;
env30280[0] = c26781_0;
env30280[1] = void 0;
env30280[2] = void 0;
env30280[3] = void 0;
env30280[1] = await (function confirmActivityChange() {
return env7147[9].apply(this, arguments);
})({
currentEmbeddedApplication: c26781_0.currentEmbeddedApplication,
shouldClosePopoutOnLeaveCurrentEmbeddedApplication: c26781_0.shouldClosePopoutOnLeaveCurrentEmbeddedApplication,
onConfirmActivityLaunchChecksAlertOpen: c26781_0.onConfirmActivityLaunchChecksAlertOpen
});
if (env30280[1]) {
const r48 = env30280[0];
env30280[2] = await $mk116036(env7147)(r48);
if (env30280[2]) {
const r69 = env30280[0];
env30280[3] = await $mk116037(env7147)(r69);
r90 = !env30280[3];
break L19;
}
break L16;
}
return false;
}
return false;
}
return !r90;
}
@@ -0,0 +1,14 @@
// Metro module 12421 (f12422).
import Dispatcher from "../../../Dispatcher";
export default function deferJoinActivityApplication(a0) {
const { channelId, applicationId } = a0;
Dispatcher.dispatch({
type: "EMBEDDED_ACTIVITY_DEFERRED_OPEN",
channelId,
applicationId,
intent: a0.intent,
inviterUserId: a0.inviterUserId,
analyticsLocations: a0.analyticsLocations,
commandOrigin: a0.commandOrigin
});
};
@@ -0,0 +1,13 @@
// Metro module 8485 (f8486).
let c5435_0 = "discord7937464";
let c5435_1 = "www.xbox.com";
let c5435_2 = "msxbox";
export const XBOX_DISCORD_OCID = "discord7937464";
export const XBOX_GAME_PASS_STORE_HOSTNAME = "www.xbox.com";
export const XBOX_GAME_PASS_PROTOCOL = "msxbox";
export function buildXboxGamePassStoreUrl(a0) {
return `https://${c5435_1}/games/store/title/${encodeURIComponent(a0)}?ocid=${c5435_0}`;
}
export function buildXboxGamePassStoreDeepLinkUrl(a0) {
return `${c5435_2}://game/?productid=${encodeURIComponent(a0)}&ocid=${c5435_0}`;
}
@@ -0,0 +1,11 @@
// Metro module 3807 (f3808).
export function getEmbeddedActivityLocationChannelId(a0) {
if (a0 != null) {
return "channel_id" in a0 ? a0.channel_id : void 0;
}
}
export function getEmbeddedActivityLocationGuildId(a0) {
if (a0 != null) {
return "guild_id" in a0 ? a0.guild_id : void 0;
}
}
@@ -0,0 +1,46 @@
// Metro module 13540 (f13541).
import { Endpoints } from "../../../Constants";
import { HTTP } from "../../../_bundle/sendRequest";
export async function fetchIsLinkTrusted(c27499_0, url) {
let r59;
let c27499_4 = 0;
let c30637_0;
L12: {
try {
c30637_0 = void 0;
if (c27499_0 === void 0) {
break L12;
}
c27499_4 = 1;
c30637_0 = (await HTTP.get({
url: Endpoints.ACTIVITIES_TRUSTED_LINKS(c27499_0),
rejectWithError: false,
query: {
url
},
timeout: 500
})).body;
r59 = Boolean(c30637_0.trusted);
c27499_4 = 0;
} catch ($e) {
let r26 = $e;
if (c27499_4 !== 0) {
while (true) {
try {
c27499_4 = 0;
} catch ($e) {
r26 = $e;
if (c27499_4 === 0) {
break;
}
continue;
}
return false;
}
}
throw r26;
}
return r59;
}
return false;
}
@@ -0,0 +1,27 @@
// Metro module 15058 (f15059).
import RelationshipStore from "../../../stores/RelationshipStore";
export default function findActivityWithMostParticipants(a0) {
const length2 = a0.length;
return length2 !== 0 ? length2 === 1 ? a0[0] : a0.reduce((acc, item) => acc.userIds.size < item.userIds.size ? item : acc, a0[0]) : null;
};
export function findActivityWithMostNonBlockedOrIgnoredParticipants(a0) {
const length2 = a0.length;
if (length2 === 0) {
return null;
}
if (length2 === 1) {
return a0[0];
}
let c21631_0, length;
const r5 = [a0[0], [...a0[0].userIds].map((item) => !RelationshipStore.isBlockedOrIgnored(item)).length];
c21631_0 = r5[0];
length = r5[1];
a0.forEach((item) => {
const length2 = [...item.userIds].filter((item) => !RelationshipStore.isBlockedOrIgnored(item)).length;
if (length2 > length) {
length = length2;
c21631_0 = item;
}
});
return c21631_0;
}
@@ -0,0 +1,26 @@
// Metro module 12026 (f12027).
import { isTextChannel } from "../../../records/ChannelRecord";
import ChannelStore from "../../../stores/ChannelStore";
import VoiceStateStore from "../../../stores/VoiceStateStore";
export default function getActivityChannelId({ channelId, userId, activity }) {
let r12;
const channel = ChannelStore.getChannel(channelId);
const session_id = activity?.session_id;
L10: {
r12 = channelId;
if (session_id != null) {
if (channel != null) {
const isTextChannel2 = isTextChannel(channel.type);
r12 = channelId;
if (isTextChannel2) {
break L10;
}
}
r12 = VoiceStateStore.getVoiceStateForSession(userId, activity?.session_id)?.channelId;
}
}
if (r12 == null) {
r12 = void 0;
}
return r12;
};
@@ -0,0 +1,88 @@
// Metro module 12027 (f12028).
import { ActivityFlags, ChannelTypes, GuildFeatures } from "../../../Constants";
import getCurrentUserPresenceActivity from "./getCurrentUserPresenceActivity";
import { getIsInParty } from "./getIsInParty";
import getEmbeddedActivityJoinability, { EmbeddedActivityJoinability } from "./getEmbeddedActivityJoinability";
import { getIsActivitiesEnabledForCurrentPlatform } from "../useIsActivitiesEnabledForCurrentPlatform";
import hasFlag from "./hasFlag";
import isActivityJoinableOnCurrentPlatform from "./isActivityJoinableOnCurrentPlatform";
import { platformSupportsActivityJoin } from "../../../utils/PlatformUtils";
import { getPartySize } from "./getPartySize";
import { hasPartySize } from "./hasPartySize";
import { isPartyFull } from "./isPartyFull";
let c8267_6 = {
CAN_JOIN: "can_join",
CANNOT_JOIN: "cannot_join",
JOINED: "joined"
};
export default function getActivityJoinability(a0) {
L50: {
const { user, activity, application, channelId, currentUser, isEmbedded, ChannelStore, GuildStore, GuildMemberCountStore, RelationshipStore, SelectedChannelStore, VoiceStateStore, PermissionStore, LocalActivityStore, SelfPresenceStore, EmbeddedActivitiesStore } = a0;
if (!isEmbedded) {
const currentUserPresenceActivity = getCurrentUserPresenceActivity(LocalActivityStore, SelfPresenceStore, activity?.application_id);
if (currentUserPresenceActivity != null && getIsInParty(currentUserPresenceActivity, activity)) {
break L50;
}
}
if (isEmbedded) {
const currentEmbeddedActivity = EmbeddedActivitiesStore.getCurrentEmbeddedActivity();
if (currentEmbeddedActivity != null && currentEmbeddedActivity.applicationId === activity?.application_id) {
break L50;
}
}
if (user == null) {
return c8267_6.CANNOT_JOIN;
}
if (isEmbedded && channelId != null) {
return getEmbeddedActivityJoinability({
userId: user.id,
activity,
channelId,
currentUser,
application,
isActivitiesEnabledForCurrentPlatform: getIsActivitiesEnabledForCurrentPlatform(),
ChannelStore,
VoiceStateStore,
PermissionStore,
GuildStore
}) === EmbeddedActivityJoinability.CAN_JOIN ? c8267_6.CAN_JOIN : c8267_6.CANNOT_JOIN;
}
if (isEmbedded && channelId == null && !hasFlag(activity, ActivityFlags.CONTEXTLESS)) {
return c8267_6.CANNOT_JOIN;
}
L23: {
if (!isEmbedded) {
if (isActivityJoinableOnCurrentPlatform(activity) && platformSupportsActivityJoin()) {
break L23;
}
return c8267_6.CANNOT_JOIN;
}
}
const partySize = getPartySize(activity);
if (hasPartySize(partySize) && !isPartyFull(partySize)) {
if (hasFlag(activity, ActivityFlags.PARTY_PRIVACY_FRIENDS) && RelationshipStore.isFriend(user.id)) {
return c8267_6.CAN_JOIN;
}
if (hasFlag(activity, ActivityFlags.PARTY_PRIVACY_VOICE_CHANNEL)) {
const channel = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId());
if (channel != null && VoiceStateStore.isInChannel(channel.id, user.id)) {
const type = channel.type;
if (ChannelTypes.DM !== type && ChannelTypes.GROUP_DM !== type) {
const guild = GuildStore.getGuild(channel.getGuildId());
if (guild != null && !guild.features.has(GuildFeatures.COMMUNITY)) {
const memberCount = GuildMemberCountStore.getMemberCount(guild.id);
return memberCount != null && memberCount < 100 ? c8267_6.CAN_JOIN : c8267_6.CANNOT_JOIN;
}
return c8267_6.CANNOT_JOIN;
}
return c8267_6.CAN_JOIN;
}
return c8267_6.CANNOT_JOIN;
}
return c8267_6.CANNOT_JOIN;
}
return c8267_6.CANNOT_JOIN;
}
return c8267_6.JOINED;
};
export { c8267_6 as ActivityJoinability };
@@ -0,0 +1,7 @@
// Metro module 12375 (f12376).
import ApplicationRecord from "../../../records/ApplicationRecord";
import { SpotifyApplication } from "../../../records/SpotifyApplicationRecord";
import { isSpotifyParty } from "../../spotify/SpotifyConstants";
export function getApplicationFromMessage(a0) {
return a0.application != null ? ApplicationRecord.createFromServer(a0.application) : a0.activity != null ? a0.activity.party_id != null ? isSpotifyParty(a0.activity.party_id) ? SpotifyApplication : void 0 : void 0 : void 0;
}
Loaded 100 of 33051 files, more files were not shown because too many files have changed in this diff. Show more