decord/beta/source/modules/activities/native/EmbeddedActivitiesNativeManager.tsx

185 lines
7.6 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 16:32:48 +00:00
// Module ID: 14799
// Function ID: 14800
// Name: EmbeddedActivitiesNativeManager
2026-10-12 16:32:48 +00:00
// Dependencies: [17, 2065, 5110, 2064, 1085, 1382, 14800, 14801, 5296, 4739, 1265, 584, 14721, 10853, 5300, 1126, 4809, 1388, 10928, 2]
2026-10-12 16:32:48 +00:00
// Module 14799 (EmbeddedActivitiesNativeManager)
2026-10-01 14:13:23 +00:00
import react_native from "react-native" /* 17 */;
2026-10-07 22:43:51 +00:00
import DispatcherDefault from "Dispatcher" /* 584 */;
import Constants from "Constants" /* 1085 */;
2026-10-12 16:32:48 +00:00
import intl2 from "intl" /* 1126 */;
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1265 */;
import GlobalUtils from "GlobalUtils" /* 1388 */;
import ToastActionCreatorsDefault from "ToastActionCreators" /* 4809 */;
import ThermalUtilsDefault from "ThermalUtils" /* 5296 */;
import actions_AlertActionCreatorsDefault from "actions/AlertActionCreators" /* 5300 */;
import EmbeddedActivitiesActionCreators from "EmbeddedActivitiesActionCreators" /* 10853 */;
import activityWebViewController from "activityWebViewController" /* 10928 */;
import react_nativeDefault from "react-native" /* 14800 */;
import ChannelStore from "ChannelStore" /* 2065 */;
import RTCConnectionStore from "RTCConnectionStore" /* 5110 */;
import EmbeddedActivitiesStore from "EmbeddedActivitiesStore" /* 2064 */;
import PlatformUtils from "PlatformUtils" /* 1382 */;
import EmbeddedActivitiesManager from "EmbeddedActivitiesManager" /* 14801 */;
2026-10-01 14:13:23 +00:00
import size from "module_2" /* 2 */;
2026-10-12 16:32:48 +00:00
let basicChannel, currentEmbeddedActivity, rawThermalState;
2026-10-01 14:13:23 +00:00
const NativeEventEmitter = react_native.NativeEventEmitter;
2026-10-07 22:43:51 +00:00
const AnalyticEvents = Constants.AnalyticEvents;
let nativeEventEmitter = null;
if (PlatformUtils.isAndroid()) {
2026-10-01 14:13:23 +00:00
let self = this;
const self2 = this;
nativeEventEmitter = new NativeEventEmitter(react_nativeDefault);
}
2026-10-01 14:13:23 +00:00
class EmbeddedActivitiesNativeManager extends EmbeddedActivitiesManager {
_initialize() {
2026-10-01 14:13:23 +00:00
let mediaSessionId;
const self = this;
super._initialize();
const lifecycleSubscription = this.lifecycleSubscription;
if (lifecycleSubscription != null) {
2026-10-01 14:13:23 +00:00
lifecycleSubscription.remove();
}
2026-10-07 22:43:51 +00:00
let obj = nativeEventEmitter;
2026-10-01 14:13:23 +00:00
let addListenerResult;
if (nativeEventEmitter != null) {
addListenerResult = obj.addListener("onHostDestroy", () => {
2026-10-07 22:43:51 +00:00
currentEmbeddedActivity = EmbeddedActivitiesStore.getCurrentEmbeddedActivity();
if (null != currentEmbeddedActivity) {
const obj = { location: null, applicationId: null };
({ location: obj.location, applicationId: obj.applicationId } = currentEmbeddedActivity);
self.leaveActivity(obj);
}
});
}
self.lifecycleSubscription = addListenerResult;
2026-10-01 14:13:23 +00:00
const thermalStateSubscription = self.thermalStateSubscription;
if (thermalStateSubscription != null) {
2026-10-01 14:13:23 +00:00
thermalStateSubscription.remove();
}
2026-10-07 22:43:51 +00:00
const obj2 = ThermalUtilsDefault;
self.thermalStateSubscription = obj2.addListener((rawThermalState) => {
2026-10-01 14:13:23 +00:00
let guild_id;
rawThermalState = rawThermalState.rawThermalState;
2026-10-07 22:43:51 +00:00
currentEmbeddedActivity = currentEmbeddedActivity.getCurrentEmbeddedActivity();
let _location;
const getEmbeddedActivityLocationChannelId = self(dependencyMap[9]).getEmbeddedActivityLocationChannelId;
self(dependencyMap[9]);
if (currentEmbeddedActivity != null) {
_location = currentEmbeddedActivity.location;
}
2026-10-07 22:43:51 +00:00
const embeddedActivityLocationChannelId = getEmbeddedActivityLocationChannelId(_location);
basicChannel = basicChannel.getBasicChannel(embeddedActivityLocationChannelId);
let compositeInstanceId;
2026-10-07 22:43:51 +00:00
if (currentEmbeddedActivity != null) {
compositeInstanceId = currentEmbeddedActivity.compositeInstanceId;
}
let applicationId;
2026-10-07 22:43:51 +00:00
if (currentEmbeddedActivity != null) {
applicationId = currentEmbeddedActivity.applicationId;
}
2026-10-07 22:43:51 +00:00
const obj = { channel_id: embeddedActivityLocationChannelId, application_id: applicationId, activity_session_id: compositeInstanceId, thermal_state: rawThermalState, guild_id, media_session_id: mediaSessionId.getMediaSessionId() };
2026-10-01 14:13:23 +00:00
guild_id = undefined;
const track = AnalyticsUtilsDefault.track;
const ACTIVITY_DEVICE_THERMAL_STATE_CHANGED = constants.ACTIVITY_DEVICE_THERMAL_STATE_CHANGED;
AnalyticsUtilsDefault;
if (basicChannel != null) {
guild_id = basicChannel.guild_id;
}
2026-10-07 22:43:51 +00:00
track(ACTIVITY_DEVICE_THERMAL_STATE_CHANGED, obj);
const tmp10Result = DispatcherDefault;
tmp10Result.dispatch({ type: "THERMAL_STATE_CHANGE", applicationId });
let tmp16 = null != compositeInstanceId;
const tmp2Result = self(dependencyMap[12]);
const thermalState = tmp2Result.getThermalState();
if (tmp16) {
tmp16 = null != applicationId;
}
2026-10-07 22:43:51 +00:00
if (tmp16) {
tmp16 = thermalState >= tmp2(tmp3[12]).ThermalStates.SERIOUS;
}
2026-10-07 22:43:51 +00:00
if (tmp16) {
const tmp2Result2 = self(dependencyMap[13]);
const respondToSeriousThermalState = tmp2Result2.requestRespondToSeriousThermalState();
}
});
}
_terminate() {
2026-10-01 14:13:23 +00:00
const self = this;
super._terminate();
const lifecycleSubscription = this.lifecycleSubscription;
if (lifecycleSubscription != null) {
2026-10-01 14:13:23 +00:00
lifecycleSubscription.remove();
}
2026-10-01 14:13:23 +00:00
const thermalStateSubscription = self.thermalStateSubscription;
if (thermalStateSubscription != null) {
2026-10-01 14:13:23 +00:00
thermalStateSubscription.remove();
}
2026-10-07 22:43:51 +00:00
self.releaseWebView();
}
2026-10-01 14:13:23 +00:00
showErrorModal(reason) {
let code;
let intl;
let message;
({ code, message } = reason);
2026-10-12 16:32:48 +00:00
const obj = { title: intl.formatToPlainString(intl2.t.hbiAO6, { code }), body: message };
2026-10-01 14:13:23 +00:00
const show = actions_AlertActionCreatorsDefault.show;
actions_AlertActionCreatorsDefault;
2026-10-12 16:32:48 +00:00
intl = intl2.intl;
2026-10-01 14:13:23 +00:00
show(obj);
}
showDevShelfOverrideEnabled() {
let intl;
2026-10-12 16:32:48 +00:00
const obj = { text: intl.string(intl2.t.JfA7IK), variant: "success" };
2026-10-01 14:13:23 +00:00
const open = ToastActionCreatorsDefault.open;
ToastActionCreatorsDefault;
2026-10-12 16:32:48 +00:00
intl = intl2.intl;
open("EMBEDDED_ACTIVITIES_DEV_SHELF_URL_OVERRIDE_ENABLED", obj);
}
2026-10-01 14:13:23 +00:00
leaveActivity(arg0) {
let _location;
let applicationId;
let showFeedback;
const self = this;
({ location: _location, applicationId, showFeedback } = arg0);
let isNotNullishResult = null != _location;
const releaseWebViewResult = this.releaseWebView();
if (isNotNullishResult) {
2026-10-07 22:43:51 +00:00
const obj = GlobalUtils;
2026-10-01 14:13:23 +00:00
isNotNullishResult = obj.isNotNullish(applicationId);
}
if (isNotNullishResult) {
let tmp5 = null != releaseWebViewResult;
const clearEmbeddedActivityState = self.clearEmbeddedActivityState;
if (tmp5) {
tmp5 = showFeedback;
}
const result = clearEmbeddedActivityState(_location, applicationId, tmp5);
}
}
2026-10-01 14:13:23 +00:00
hidePIPEmbed(arg0) {
if (arg0 == null) {
throw new TypeError("Cannot destructure 'undefined' or 'null'.");
}
}
2026-10-01 14:13:23 +00:00
clearEmbeddedActivityState(_location, applicationId, showFeedback) {
2026-10-07 22:43:51 +00:00
const obj = EmbeddedActivitiesActionCreators;
2026-10-01 14:13:23 +00:00
const obj2 = { location: _location, applicationId, showFeedback };
obj.stopEmbeddedActivity(obj2);
const obj3 = DispatcherDefault;
const obj4 = { type: "EMBEDDED_ACTIVITY_SET_ORIENTATION_LOCK_STATE", applicationId, lockState: null, pictureInPictureLockState: null, gridLockState: null };
obj3.dispatch(obj4);
}
2026-10-07 22:43:51 +00:00
releaseWebView() {
2026-10-12 16:32:48 +00:00
const obj = activityWebViewController;
return obj.releaseActivityWebView();
2026-10-07 22:43:51 +00:00
}
2026-10-01 14:13:23 +00:00
}
2026-10-07 22:43:51 +00:00
let closure_8 = EmbeddedActivitiesNativeManager.prototype;
const embeddedActivitiesNativeManager = new EmbeddedActivitiesNativeManager();
let result = size.fileFinishedImporting("modules/activities/native/EmbeddedActivitiesNativeManager.tsx");
export default embeddedActivitiesNativeManager;