Files
discord-decomp/_bundle/getExpoUpdatesContext.js
T
2026-11-01 12:12:55 +02:00

128 lines
4.5 KiB
JavaScript

// Metro module 1127 (f1128).
import { isExpo, isExpoGo } from "./Module1002";
import { NATIVE } from "./Module1001";
import { debug } from "./Module817";
import { getExpoUpdates, getExpoDevice } from "./Module1003";
let c935_2;
const getExpoUpdatesContext = function getExpoUpdatesContext() {
const expoUpdates = getExpoUpdates();
if (expoUpdates) {
const r13 = {
is_enabled: !!expoUpdates.isEnabled,
is_embedded_launch: !!expoUpdates.isEmbeddedLaunch,
is_emergency_launch: !!expoUpdates.isEmergencyLaunch,
is_using_embedded_assets: !!expoUpdates.isUsingEmbeddedAssets
};
const updateId = expoUpdates.updateId;
if (typeof updateId === "string" ? expoUpdates.updateId : typeof updateId === "string") {
r13.update_id = expoUpdates.updateId.toLowerCase();
}
const channel = expoUpdates.channel;
if (typeof channel === "string" ? expoUpdates.channel : typeof channel === "string") {
r13.channel = expoUpdates.channel.toLowerCase();
}
const runtimeVersion = expoUpdates.runtimeVersion;
if (typeof runtimeVersion === "string" ? expoUpdates.runtimeVersion : typeof runtimeVersion === "string") {
r13.runtime_version = expoUpdates.runtimeVersion.toLowerCase();
}
const checkAutomatically = expoUpdates.checkAutomatically;
if (typeof checkAutomatically === "string" ? expoUpdates.checkAutomatically : typeof checkAutomatically === "string") {
r13.check_automatically = expoUpdates.checkAutomatically.toLowerCase();
}
const emergencyLaunchReason = expoUpdates.emergencyLaunchReason;
if (typeof emergencyLaunchReason === "string" ? expoUpdates.emergencyLaunchReason : typeof emergencyLaunchReason === "string") {
r13.emergency_launch_reason = expoUpdates.emergencyLaunchReason;
}
if (typeof expoUpdates.launchDuration === "number") {
r13.launch_duration = expoUpdates.launchDuration;
}
if (expoUpdates.createdAt instanceof Date) {
r13.created_at = expoUpdates.createdAt.toISOString();
}
return r13;
}
return {
is_enabled: false
};
};
c935_2 = "ota_updates";
export const OTA_UPDATES_CONTEXT_KEY = "ota_updates";
export const expoContextIntegration = () => {
let expoUpdatesContext;
const getExpoUpdatesContextCached2 = function getExpoUpdatesContextCached() {
let r1 = expoUpdatesContext;
if (!r1) {
const expoUpdatesContext2 = getExpoUpdatesContext();
expoUpdatesContext = expoUpdatesContext2;
r1 = expoUpdatesContext2;
}
return r1;
};
return {
name: "ExpoContext",
setup: function setup(a0) {
a0.on("afterInit", () => {
if (a0.getOptions().enableNative) {
(function setExpoUpdatesNativeContext() {
if (isExpo() && !isExpoGo()) {
const expoUpdatesContextCached2 = getExpoUpdatesContextCached2();
try {
NATIVE.setContext(c935_2, expoUpdatesContextCached2);
} catch ($e) {
debug.error("Error setting Expo updates context:", $e);
}
return void 0;
}
})();
}
});
},
processEvent: function processEvent(a0) {
if (isExpo()) {
if (isExpoGo()) {
const expoDevice = getExpoDevice();
const r12 = expoDevice ? {
name: expoDevice.deviceName,
simulator: !expoDevice?.isDevice,
model: expoDevice.modelName,
manufacturer: expoDevice.manufacturer,
memory_size: expoDevice.totalMemory
} : void 0;
if (r12) {
a0.contexts = a0.contexts || {};
a0.contexts.device = {
...r12,
...a0.contexts.device
};
}
const expoDevice2 = getExpoDevice();
const r43 = expoDevice2 ? {
build: expoDevice2.osBuildId,
version: expoDevice2.osVersion,
name: expoDevice2.osName
} : void 0;
if (r43) {
a0.contexts = a0.contexts || {};
a0.contexts.os = {
...r43,
...a0.contexts.os
};
}
}
a0.contexts = a0.contexts || {};
const contexts = a0.contexts;
const r65 = Object;
let r67 = expoUpdatesContext;
if (!r67) {
const expoUpdatesContext2 = getExpoUpdatesContext();
expoUpdatesContext = expoUpdatesContext2;
r67 = expoUpdatesContext2;
}
contexts[c935_2] = r65.assign({}, r67);
}
return a0;
}
};
};
export { getExpoUpdatesContext };