227 lines
13 KiB
TypeScript
227 lines
13 KiB
TypeScript
/* Metro module 10704; source: modules/activities/native/EmbeddedActivityView.tsx; dependencies: [57, 31, 27, 1378, 4237, 4238, 33, 4501, 10703, 1478, 694, 10705, 10706, 10701, 566, 10708, 8092, 10709, 10716, 2] */
|
|
function _fun82249(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#82249, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10890:6, offset: 0x01ef097a, size: 396 bytes, params: 8, frame: 23
|
|
const env0_0 = require;
|
|
const closure = useBaseActivityView;
|
|
const closure2 = ActivityViewLoadingIndicator;
|
|
const closure3 = BaseActivityView;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(57) /* metro dependency 57 */;
|
|
let value = importAll(31) /* metro dependency 31 */;
|
|
const value2 = require(27) /* metro dependency 27 */;
|
|
const env0_5 = value2.ActivityIndicator;
|
|
const env0_6 = value2.View;
|
|
const embeddedActivitiesStore = importDefault(1378) /* metro dependency 1378: EmbeddedActivitiesStore */;
|
|
const constantsModule = require(4237) /* metro dependency 4237: Constants */;
|
|
const env0_8 = constantsModule.ActivityLayoutMode;
|
|
const env0_9 = constantsModule.ActivityScreenOrientation;
|
|
const env0_10 = (require(4238) /* metro dependency 4238: ApplicationConstants */).OBEY_SILENT_HARDWARE_SWITCH_APP_IDS;
|
|
const value4 = require(33) /* metro dependency 33 */;
|
|
const env0_11 = value4.jsx;
|
|
const env0_12 = value4.Fragment;
|
|
const env0_13 = value4.jsxs;
|
|
const env0_14 = (require(4501) /* metro dependency 4501: createStyles */).createStyles({loadingContainer: {'flex': 1,
|
|
'justifyContent': 'center'}});
|
|
value = value.memo(EmbeddedActivityViewInner);
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/activities/native/EmbeddedActivityView.tsx');
|
|
exports.default = value;
|
|
exports.useBaseActivityView = closure;
|
|
exports.ActivityViewLoadingIndicator = closure2;
|
|
exports.BaseActivityView = closure3;
|
|
exports.EmbeddedActivityView = value;
|
|
}
|
|
|
|
function useBaseActivityView({orientationLockState, showLoadingIndicator, setShowLoadingStateForLockingOrientation, application, setOrientationLockState}) { // fn#82250, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10890:392, offset: 0x01ef0b06, size: 460 bytes, params: 2, frame: 27
|
|
const env0_3 = application;
|
|
const env0_4 = setOrientationLockState;
|
|
let value = undefined;
|
|
const [property, property2] = env0_3(env0_4.useState(false), 2);
|
|
const defaultOrientationLockState = (require(10703) /* metro dependency 10703: getDefaultOrientationLockState */).getDefaultOrientationLockState(application);
|
|
const id = application == null ? value : application.id;
|
|
const [property3, env0_8] = env0_3(env0_4.useState(false), 2);
|
|
value = (importDefault(1478) /* metro dependency 1478: useWindowDimensionsNative */)();
|
|
value = value.width > value.height;
|
|
env0_4.useLayoutEffect(_fun82251, [value]);
|
|
env0_4.useLayoutEffect(_fun82252, [id]);
|
|
env0_4.useLayoutEffect(_fun82253, [defaultOrientationLockState, application, orientationLockState, value, property3,
|
|
setShowLoadingStateForLockingOrientation, setOrientationLockState]);
|
|
env0_4.useLayoutEffect(_fun82254, [orientationLockState, value, setShowLoadingStateForLockingOrientation]);
|
|
env0_4.useLayoutEffect(_fun82255, [showLoadingIndicator, property]);
|
|
return {isResetting: property, setIsResetting: property2, isLandscape: value};
|
|
}
|
|
|
|
function ActivityViewLoadingIndicator() { // fn#82256, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10890:1168, offset: 0x01ef0e0c, size: 69 bytes, params: 1, frame: 17
|
|
const styles = useStyles();
|
|
return (
|
|
<View style={styles.loadingContainer}>
|
|
<ActivityIndicator size="large" />
|
|
</View>
|
|
);
|
|
}
|
|
|
|
function BaseActivityView(a0) { // fn#82257, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10890:1286, offset: 0x01ef0e51, size: 133 bytes, params: 2, frame: 19
|
|
var r0;
|
|
var value;
|
|
var jsxRuntimeEnv0_12Binding;
|
|
if (a0.showLoadingIndicator) {
|
|
r0 = <ActivityViewLoadingIndicator />;
|
|
} else {
|
|
value = null;
|
|
if (a0.isResetting) {
|
|
r0 = value;
|
|
} else {
|
|
jsxRuntimeEnv0_12Binding = jsxRuntimeEnv0_12;
|
|
value = importDefault(10706) /* metro dependency 10706: WakeLock */;
|
|
value = ((Component) => <Component wakeLockKey={a0.wakeLockKey} />)(value);
|
|
value = <>{value}{a0.children}</>;
|
|
r0 = value;
|
|
}
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function EmbeddedActivityViewInner({channel, layoutMode, portraitSafeAreasConfig, landscapeSafeAreasConfig}) { // fn#82258, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10890:1490, offset: 0x01ef0ed6, size: 1004 bytes, params: 2, frame: 32
|
|
var object2;
|
|
var r7;
|
|
var r14;
|
|
var r0;
|
|
var location;
|
|
var EmbeddedActivityWebView;
|
|
let value = undefined;
|
|
let env0_3 = value;
|
|
const currentEmbeddedActivity2 = EmbeddedActivitiesStore.getCurrentEmbeddedActivity();
|
|
const value4 = (importDefault(10701) /* metro dependency 10701: useCurrentEmbeddedApplication */)();
|
|
const value5 = (require(566) /* metro dependency 566: flux */).useStateFromStores([EmbeddedActivitiesStore],
|
|
_fun82259, [value4]);
|
|
const [property, property2] = env0_3(env0_4.useState(true), 2);
|
|
object2 = {currentEmbeddedActivity: currentEmbeddedActivity2, channel: channel};
|
|
const currentEmbeddedActivity = object2.currentEmbeddedActivity;
|
|
const channel2 = object2.channel;
|
|
if (currentEmbeddedActivity == null) {
|
|
r14 = {instance_id: ''};
|
|
} else {
|
|
object2 = {};
|
|
object2.instance_id = currentEmbeddedActivity.compositeInstanceId ?? currentEmbeddedActivity.launchId;
|
|
location = currentEmbeddedActivity.location;
|
|
object2.location_id = location == null ? value : location.id;
|
|
object2.launch_id = currentEmbeddedActivity.launchId;
|
|
if (currentEmbeddedActivity.proxyTicket != null) {
|
|
object2.discord_proxy_ticket = currentEmbeddedActivity.proxyTicket;
|
|
}
|
|
r7 = channel2 != null && channel2.id != null;
|
|
r7 = r7 && channel2.id !== '';
|
|
if (r7) {
|
|
object2.channel_id = channel2.id;
|
|
}
|
|
r7 = (channel2 == null ? value : channel2.guild_id) != null && (channel2 == null ? value : channel2.guild_id) !== '';
|
|
if (r7) {
|
|
object2.guild_id = channel2 == null ? value : channel2.guild_id;
|
|
r14 = object2;
|
|
} else {
|
|
r14 = object2;
|
|
}
|
|
}
|
|
(importDefault(10708) /* metro dependency 10708: useDispatchOpenActivity */)({connectedEmbeddedActivity: currentEmbeddedActivity2});
|
|
env0_4.useLayoutEffect(_fun82260, [layoutMode, currentEmbeddedActivity2]);
|
|
const value14 = env0_4.useCallback(_fun82261, [value4, currentEmbeddedActivity2]);
|
|
const id = value4 == null ? value : value4.id;
|
|
let r6 = currentEmbeddedActivity2 == null || (currentEmbeddedActivity2 == null ? value : currentEmbeddedActivity2.launchId) == null;
|
|
r6 = !r6 ? property : r6;
|
|
r6 = !r6 ? id == null : r6;
|
|
r6 = !r6 ? value4 == null : r6;
|
|
object2 = {orientationLockState: value5, showLoadingIndicator: r6,
|
|
setShowLoadingStateForLockingOrientation: property2, application: value4};
|
|
object2.setOrientationLockState = (require(10703) /* metro dependency 10703: getDefaultOrientationLockState */).setOrientationLockState;
|
|
const value19 = useBaseActivityView(object2);
|
|
const isResetting = value19.isResetting;
|
|
env0_3 = value19.setIsResetting;
|
|
if (currentEmbeddedActivity2 == null) {
|
|
r0 = null;
|
|
} else if (id == null) {
|
|
r0 = null;
|
|
} else {
|
|
object2 = {wakeLockKey: 'EmbeddedActivities', showLoadingIndicator: r6, isResetting: isResetting};
|
|
EmbeddedActivityWebView = importDefault(10709) /* metro dependency 10709: EmbeddedActivityWebView */;
|
|
value = <BaseActivityView {...object2}><EmbeddedActivityWebView onActivityCrash={function() {
|
|
setIsResetting(true);
|
|
global.setTimeout(_fun82263, 0);
|
|
}} applicationId={id} channelId={channel == null ? value : channel.id} guildId={channel == null ? value : channel.guild_id} activityUrl={currentEmbeddedActivity2.url} currentEmbeddedActivity={currentEmbeddedActivity2} activitySessionId={currentEmbeddedActivity2 == null ? value : currentEmbeddedActivity2.compositeInstanceId} queryParams={r14} onLoadError={value14} allowPopups={(require(10716) /* metro dependency 10716: allowPopups */).allowPopups(value4)} referrerPolicy="origin" isPipOrGridMode={layoutMode === ActivityLayoutMode.PIP || layoutMode === ActivityLayoutMode.GRID} webViewKey={(require(8092) /* metro dependency 8092: EmbeddedActivitiesNativeManager */).EMBEDDED_ACTIVITY_WEB_VIEW_KEY} safeAreasConfig={value19.isLandscape ? landscapeSafeAreasConfig : portraitSafeAreasConfig} ignoreSilentHardwareSwitch={!OBEY_SILENT_HARDWARE_SWITCH_APP_IDS.has(id)} /></BaseActivityView>;
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function _fun82251() { // fn#82251, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10890:760, offset: 0x01ef0cd2, size: 82 bytes, params: 1, frame: 14
|
|
const binding = env0_9;
|
|
let value = environment.__proto__;
|
|
const r4 = binding ? ActivityScreenOrientation.LANDSCAPE : ActivityScreenOrientation.PORTRAIT;
|
|
value = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
value.dispatch({type: 'ACTIVITY_SCREEN_ORIENTATION_UPDATE', screenOrientation: r4});
|
|
}
|
|
|
|
function _fun82252() { // fn#82252, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10890:905, offset: 0x01ef0d24, size: 18 bytes, params: 1, frame: 11
|
|
env0_8(false);
|
|
}
|
|
|
|
function _fun82253() { // fn#82253, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10890:942, offset: 0x01ef0d36, size: 122 bytes, params: 1, frame: 14
|
|
var value2;
|
|
if (env0_7) {
|
|
setShowLoadingStateForLockingOrientation(false);
|
|
} else if (orientationLockState != null) {
|
|
setShowLoadingStateForLockingOrientation(false);
|
|
} else {
|
|
value2 = environment.__proto__;
|
|
if ((importDefault(10705) /* metro dependency 10705: doesOrientationMatchLockState */)(env0_9, env0_6)) {
|
|
setShowLoadingStateForLockingOrientation(false);
|
|
} else {
|
|
setShowLoadingStateForLockingOrientation(true);
|
|
}
|
|
}
|
|
if (application != null) {
|
|
setOrientationLockState(application, orientationLockState);
|
|
}
|
|
}
|
|
|
|
function _fun82254() { // fn#82254, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10890:1039, offset: 0x01ef0db0, size: 58 bytes, params: 1, frame: 14
|
|
const value = environment.__proto__;
|
|
if ((importDefault(10705) /* metro dependency 10705: doesOrientationMatchLockState */)(env0_9,
|
|
orientationLockState)) {
|
|
setShowLoadingStateForLockingOrientation(false);
|
|
}
|
|
}
|
|
|
|
function _fun82255() { // fn#82255, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10890:1095, offset: 0x01ef0dea, size: 34 bytes, params: 1, frame: 11
|
|
if (!(showLoadingIndicator || env0_5)) {
|
|
env0_8(true);
|
|
}
|
|
}
|
|
|
|
function _fun82259() { // fn#82259, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10890:1689, offset: 0x01ef12c2, size: 47 bytes, params: 1, frame: 12
|
|
return env0_2 != null ? EmbeddedActivitiesStore.getOrientationLockStateForApp(env0_2.id) : undefined;
|
|
}
|
|
|
|
function _fun82260() { // fn#82260, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10890:2358, offset: 0x01ef12f1, size: 84 bytes, params: 1, frame: 13
|
|
var value2;
|
|
if (env0_1 != null) {
|
|
value2 = environment.__proto__;
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'ACTIVITY_LAYOUT_MODE_UPDATE',
|
|
layoutMode: layoutMode, applicationId: env0_1.applicationId});
|
|
}
|
|
}
|
|
|
|
function _fun82261() { // fn#82261, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10890:2501, offset: 0x01ef1345, size: 97 bytes, params: 1, frame: 16
|
|
let value = environment.__proto__;
|
|
value = undefined;
|
|
(importDefault(8092) /* metro dependency 8092: EmbeddedActivitiesNativeManager */).leaveActivity({location: env0_1 == null ? value : env0_1.location,
|
|
applicationId: env0_2 == null ? value : env0_2.id});
|
|
return value;
|
|
}
|
|
|
|
function EmbeddedActivityViewInnerOnActivityCrash() { // fn#82262, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10890:3089, owner: EmbeddedActivityViewInner.onActivityCrash, offset: 0x01ef13a6, size: 43 bytes, params: 1, frame: 13
|
|
setIsResetting(true);
|
|
global.setTimeout(function() {
|
|
return setIsResetting(false);
|
|
}, 0);
|
|
}
|
|
|