Files
discord-decomp/sources/utils/web/ProtocolUtils.tsx
T
2026-07-27 16:20:00 +03:00

123 lines
4.9 KiB
TypeScript

/* Metro module 9465; source: utils/web/ProtocolUtils.tsx; dependencies: [4222, 2] */
function _fun73598(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#73598, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9651:6, offset: 0x01d72ba8, size: 307 bytes, params: 8, frame: 24
var object2;
var r3;
let closure = launchFirefox;
const closure2 = function(a0, a1) {
var env0_0 = a1;
var closure = _fun73606;
var env0_2 = closure;
var env0_1 = false;
global.window.addEventListener('blur', closure);
global.location.href = a0;
global.setTimeout(_fun73607, 1000);
};
const closure3 = function(a0, a1) {
a1(false);
};
const closure4 = function(a0, a1) {
var env0_0 = a1;
global.location.href = a0;
global.process.nextTick(_fun73610);
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
object2 = {};
const value = undefined;
let os = (importDefault(4222) /* metro dependency 4222 */).os;
if ((os == null ? value : os.family) === 'Android') {
r3 = closure4;
} else {
os = (importDefault(4222) /* metro dependency 4222 */).os;
r3 = (os == null ? value : os.family) === 'iOS' ? closure4 : (importDefault(4222) /* metro dependency 4222 */).layout === 'Gecko' ? closure : (importDefault(4222) /* metro dependency 4222 */).ua == null ? closure2 : (importDefault(4222) /* metro dependency 4222 */).ua.indexOf('Valve Steam GameOverlay') !== -1 ? closure3 : closure2;
}
object2.launch = r3;
(require(2) /* metro dependency 2 */).fileFinishedImporting('utils/web/ProtocolUtils.tsx');
exports.default = object2;
return value;
}
function launchFirefox(a0, a1) { // fn#73599, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9651:44, offset: 0x01d72cdb, size: 308 bytes, params: 3, frame: 19
var location;
var process;
var document;
var body;
var contentWindow;
var value2;
var closure;
var error;
var name;
const env0_0 = a1;
let value = a0.startsWith('discord:');
if (value) {
document = global.document;
body = document.body;
if (body == null) {
return global.process.nextTick(function() {
return require(false);
});
}
document = global.document;
value = document.createElement('iframe');
body.appendChild(value);
try {
contentWindow = value.contentWindow;
value2 = contentWindow == null;
if (!value2) {
contentWindow = value.contentWindow;
location = contentWindow.location;
location.href = a0;
}
process = global.process;
closure = _fun73602;
process.nextTick(closure);
} catch (error) {
name = error.name;
if (name === 'NS_ERROR_UNKNOWN_PROTOCOL') {
process = global.process;
process.nextTick(_fun73603);
}
}
global.window.setTimeout(_fun73604, 1000);
return undefined;
}
global.location.href = a0;
return global.process.nextTick(function() {
return require(true);
});
}
function launchChrome(a0, a1) { // fn#73605, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9651:558, offset: 0x01d72e64, size: 94 bytes, params: 3, frame: 15
const env0_0 = a1;
global.window.addEventListener('blur', function() {
env0_1 = true;
});
global.location.href = a0;
global.setTimeout(_fun73607, 1000);
}
function launchMobile(a0, a1) { // fn#73609, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9651:787, offset: 0x01d72f0d, size: 54 bytes, params: 3, frame: 12
const env0_0 = a1;
global.location.href = a0;
global.process.nextTick(function() {
return require(true);
});
}
function _fun73604() { // fn#73604, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9651:465, offset: 0x01d72e21, size: 67 bytes, params: 1, frame: 14
const value2 = null;
const value3 = undefined;
const parentElement = value2 == env0_2 ? value3 : env0_2.parentElement;
if (value2 !== (value2 != parentElement ? parentElement : value2)) {
body.removeChild(env0_2);
}
return value3;
}
function _fun73607() { // fn#73607, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9651:692, offset: 0x01d72ecf, size: 48 bytes, params: 1, frame: 14
const window = global.window;
window.removeEventListener('blur', handleBlur);
require(env0_1);
}