433 lines
21 KiB
TypeScript
433 lines
21 KiB
TypeScript
/* Metro module 4078; source: modules/links/native/BrowserManager.tsx; dependencies: [27, 629, 477, 4079, 676, 3853, 1360, 2] */
|
|
function _fun33440(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#33440, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:6, offset: 0x0102e8e1, size: 331 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const closure = getBrowserManagerIsChromeInstalled;
|
|
const closure2 = getBrowserManagerSelectedBrowser;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const value = require(27) /* metro dependency 27 */;
|
|
const env0_3 = value.AppState;
|
|
const env0_4 = value.NativeEventEmitter;
|
|
const NativeModules = value.NativeModules;
|
|
const env0_6 = NativeModules.BrowserManager;
|
|
const env0_7 = (require(629) /* metro dependency 629 */).create(_fun33444);
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/links/native/BrowserManager.tsx');
|
|
exports.useBrowserManagerIsChromeInstalled = useBrowserManagerIsChromeInstalled;
|
|
exports.getBrowserManagerIsChromeInstalled = closure;
|
|
exports.useBrowserManagerSupportsInAppBrowser = useBrowserManagerSupportsInAppBrowser;
|
|
exports.useBrowserManagerSelectedBrowser = useBrowserManagerSelectedBrowser;
|
|
exports.getBrowserManagerSelectedBrowser = closure2;
|
|
exports.useIsInAppBrowserOpen = useIsInAppBrowserOpen;
|
|
exports.getIsInAppBrowserOpen = getIsInAppBrowserOpen;
|
|
exports.subscribeToIsInAppBrowserOpen = subscribeToIsInAppBrowserOpen;
|
|
exports.browserManagerOpenUrl = browserManagerOpenUrl;
|
|
exports.browserManagerSelectBrowser = browserManagerSelectBrowser;
|
|
exports.browserManagerCloseBrowser = browserManagerCloseBrowser;
|
|
exports.openPlayStoreInlineInstall = openPlayStoreInlineInstall;
|
|
}
|
|
|
|
function removeInAppBrowserCloseSubscription() { // fn#33441, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:536, offset: 0x0102ea2c, size: 31 bytes, params: 1, frame: 11
|
|
const binding = env0_8;
|
|
if (binding != null) {
|
|
binding.remove();
|
|
}
|
|
}
|
|
|
|
function getBrowserManagerIsChromeInstalled() { // fn#33442, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:620, offset: 0x0102ea4b, size: 25 bytes, params: 1, frame: 9
|
|
const binding = env0_7;
|
|
const getState = binding.getState;
|
|
return Reflect.apply(getState, binding, []).isChromeInstalled;
|
|
}
|
|
|
|
function getBrowserManagerSelectedBrowser() { // fn#33443, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:704, offset: 0x0102ea64, size: 25 bytes, params: 1, frame: 9
|
|
const binding = env0_7;
|
|
const getState = binding.getState;
|
|
return Reflect.apply(getState, binding, []).selectedBrowser;
|
|
}
|
|
|
|
function _fun33444() { // fn#33444, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:197, offset: 0x0102ea7d, size: 268 bytes, params: 1, frame: 16
|
|
var isChromeInstalled;
|
|
var selectedBrowser;
|
|
var supportsInAppBrowser;
|
|
var defaultImport;
|
|
var defaultImport2;
|
|
const object2 = {};
|
|
var value;
|
|
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (platformUtilsModule.isAndroid()) {
|
|
defaultImport = importDefault(4079) /* metro dependency 4079: NativeBrowserManagerModule */;
|
|
isChromeInstalled = defaultImport.getConstants().isChromeInstalled;
|
|
} else {
|
|
isChromeInstalled = BrowserManager.isChromeInstalled;
|
|
}
|
|
object2.isChromeInstalled = isChromeInstalled;
|
|
const moduleValue2 = platformUtilsModule;
|
|
if (moduleValue2.isAndroid()) {
|
|
defaultImport2 = importDefault(4079) /* metro dependency 4079: NativeBrowserManagerModule */;
|
|
selectedBrowser = defaultImport2.getConstants().selectedBrowser;
|
|
} else {
|
|
selectedBrowser = BrowserManager.selectedBrowser;
|
|
}
|
|
object2.selectedBrowser = selectedBrowser;
|
|
const moduleValue3 = platformUtilsModule;
|
|
if (moduleValue3.isAndroid()) {
|
|
value = importDefault(4079) /* metro dependency 4079: NativeBrowserManagerModule */;
|
|
supportsInAppBrowser = value.getConstants().supportsInAppBrowser;
|
|
} else {
|
|
supportsInAppBrowser = BrowserManager.supportsInAppBrowser;
|
|
}
|
|
object2.supportsInAppBrowser = supportsInAppBrowser;
|
|
object2.isInAppBrowserOpen = false;
|
|
return object2;
|
|
}
|
|
|
|
function useBrowserManagerIsChromeInstalled() { // fn#33445, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:894, offset: 0x0102eb89, size: 23 bytes, params: 1, frame: 11
|
|
return env0_7(function(a0) {
|
|
return a0.isChromeInstalled;
|
|
});
|
|
}
|
|
|
|
function useBrowserManagerSupportsInAppBrowser() { // fn#33447, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:1088, offset: 0x0102ebab, size: 23 bytes, params: 1, frame: 11
|
|
return env0_7(function(a0) {
|
|
return a0.supportsInAppBrowser;
|
|
});
|
|
}
|
|
|
|
function useBrowserManagerSelectedBrowser() { // fn#33449, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:1211, offset: 0x0102ebcd, size: 23 bytes, params: 1, frame: 11
|
|
return env0_7(function(a0) {
|
|
return a0.selectedBrowser;
|
|
});
|
|
}
|
|
|
|
function useIsInAppBrowserOpen() { // fn#33451, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:1381, offset: 0x0102ebef, size: 23 bytes, params: 1, frame: 11
|
|
return env0_7(function(a0) {
|
|
return a0.isInAppBrowserOpen;
|
|
});
|
|
}
|
|
|
|
function getIsInAppBrowserOpen() { // fn#33453, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:1475, offset: 0x0102ec11, size: 25 bytes, params: 1, frame: 9
|
|
const binding = env0_7;
|
|
const getState = binding.getState;
|
|
return Reflect.apply(getState, binding, []).isInAppBrowserOpen;
|
|
}
|
|
|
|
function subscribeToIsInAppBrowserOpen(a0) { // fn#33454, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:1580, offset: 0x0102ec2a, size: 34 bytes, params: 2, frame: 11
|
|
const env0_0 = a0;
|
|
return env0_7.subscribe(_fun33455);
|
|
}
|
|
|
|
function browserManagerOpenUrl(a0) { // fn#33456, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:1768, offset: 0x0102ec81, size: 542 bytes, params: 2, frame: 17
|
|
var r1;
|
|
var IN_APP;
|
|
var moduleValue;
|
|
var binding;
|
|
var moduleValue2;
|
|
var moduleValue3;
|
|
let value = a1;
|
|
let r5 = value !== undefined ? value : getBrowserManagerSelectedBrowser();
|
|
const WebBrowserType = (require(676) /* metro dependency 676: ConstantsIOS */).WebBrowserType;
|
|
const SAFARI = WebBrowserType.SAFARI;
|
|
if (r5 === SAFARI) {
|
|
(importDefault(3853) /* metro dependency 3853: Linking */).performURLNavigation(a0);
|
|
return global.Promise.resolve();
|
|
}
|
|
const CHROME = WebBrowserType.CHROME;
|
|
if (r5 !== CHROME) {
|
|
IN_APP = WebBrowserType.IN_APP;
|
|
if (r5 !== IN_APP) {
|
|
if (WebBrowserType.IN_APP === r5) {
|
|
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (moduleValue3.isAndroid()) {
|
|
value = importDefault(4079) /* metro dependency 4079: NativeBrowserManagerModule */;
|
|
value = value.openInAppURL(a0);
|
|
r5 = value;
|
|
} else {
|
|
r5 = BrowserManager.openInAppURL(a0);
|
|
}
|
|
return r5.then(_fun33457);
|
|
}
|
|
if (WebBrowserType.CHROME === r5) {
|
|
moduleValue2 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (moduleValue2.isAndroid()) {
|
|
value = importDefault(4079) /* metro dependency 4079: NativeBrowserManagerModule */;
|
|
value = value.openInChromeURL(a0);
|
|
r1 = value;
|
|
} else {
|
|
r1 = BrowserManager.openInChromeURL(a0, true);
|
|
}
|
|
return r1;
|
|
}
|
|
value = require(1360) /* metro dependency 1360: GlobalUtils */;
|
|
return value.assertNever(r5);
|
|
}
|
|
moduleValue = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (moduleValue.isAndroid()) {
|
|
binding = env0_7;
|
|
if (binding.getState().supportsInAppBrowser) {
|
|
if (WebBrowserType.IN_APP === r5) {
|
|
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (moduleValue3.isAndroid()) {
|
|
value = importDefault(4079) /* metro dependency 4079: NativeBrowserManagerModule */;
|
|
value = value.openInAppURL(a0);
|
|
r5 = value;
|
|
} else {
|
|
r5 = BrowserManager.openInAppURL(a0);
|
|
}
|
|
return r5.then(_fun33457);
|
|
}
|
|
if (WebBrowserType.CHROME === r5) {
|
|
moduleValue2 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (moduleValue2.isAndroid()) {
|
|
value = importDefault(4079) /* metro dependency 4079: NativeBrowserManagerModule */;
|
|
value = value.openInChromeURL(a0);
|
|
r1 = value;
|
|
} else {
|
|
r1 = BrowserManager.openInChromeURL(a0, true);
|
|
}
|
|
return r1;
|
|
}
|
|
value = require(1360) /* metro dependency 1360: GlobalUtils */;
|
|
return value.assertNever(r5);
|
|
}
|
|
value = importDefault(3853) /* metro dependency 3853: Linking */;
|
|
value.performURLNavigation(a0);
|
|
return global.Promise.resolve();
|
|
}
|
|
IN_APP = WebBrowserType.IN_APP;
|
|
if (IN_APP === r5) {
|
|
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (moduleValue3.isAndroid()) {
|
|
value = importDefault(4079) /* metro dependency 4079: NativeBrowserManagerModule */;
|
|
value = value.openInAppURL(a0);
|
|
r5 = value;
|
|
} else {
|
|
r5 = BrowserManager.openInAppURL(a0);
|
|
}
|
|
return r5.then(_fun33457);
|
|
}
|
|
if (WebBrowserType.CHROME === r5) {
|
|
moduleValue2 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (moduleValue2.isAndroid()) {
|
|
value = importDefault(4079) /* metro dependency 4079: NativeBrowserManagerModule */;
|
|
value = value.openInChromeURL(a0);
|
|
r1 = value;
|
|
} else {
|
|
r1 = BrowserManager.openInChromeURL(a0, true);
|
|
}
|
|
return r1;
|
|
}
|
|
value = require(1360) /* metro dependency 1360: GlobalUtils */;
|
|
return value.assertNever(r5);
|
|
}
|
|
if (getBrowserManagerIsChromeInstalled()) {
|
|
IN_APP = WebBrowserType.IN_APP;
|
|
if (r5 !== IN_APP) {
|
|
if (WebBrowserType.IN_APP === r5) {
|
|
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (moduleValue3.isAndroid()) {
|
|
value = importDefault(4079) /* metro dependency 4079: NativeBrowserManagerModule */;
|
|
value = value.openInAppURL(a0);
|
|
r5 = value;
|
|
} else {
|
|
r5 = BrowserManager.openInAppURL(a0);
|
|
}
|
|
return r5.then(_fun33457);
|
|
}
|
|
if (WebBrowserType.CHROME === r5) {
|
|
moduleValue2 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (moduleValue2.isAndroid()) {
|
|
value = importDefault(4079) /* metro dependency 4079: NativeBrowserManagerModule */;
|
|
value = value.openInChromeURL(a0);
|
|
r1 = value;
|
|
} else {
|
|
r1 = BrowserManager.openInChromeURL(a0, true);
|
|
}
|
|
return r1;
|
|
}
|
|
value = require(1360) /* metro dependency 1360: GlobalUtils */;
|
|
return value.assertNever(r5);
|
|
}
|
|
moduleValue = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (moduleValue.isAndroid()) {
|
|
binding = env0_7;
|
|
if (binding.getState().supportsInAppBrowser) {
|
|
if (WebBrowserType.IN_APP === r5) {
|
|
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (moduleValue3.isAndroid()) {
|
|
value = importDefault(4079) /* metro dependency 4079: NativeBrowserManagerModule */;
|
|
value = value.openInAppURL(a0);
|
|
r5 = value;
|
|
} else {
|
|
r5 = BrowserManager.openInAppURL(a0);
|
|
}
|
|
return r5.then(_fun33457);
|
|
}
|
|
if (WebBrowserType.CHROME === r5) {
|
|
moduleValue2 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (moduleValue2.isAndroid()) {
|
|
value = importDefault(4079) /* metro dependency 4079: NativeBrowserManagerModule */;
|
|
value = value.openInChromeURL(a0);
|
|
r1 = value;
|
|
} else {
|
|
r1 = BrowserManager.openInChromeURL(a0, true);
|
|
}
|
|
return r1;
|
|
}
|
|
value = require(1360) /* metro dependency 1360: GlobalUtils */;
|
|
return value.assertNever(r5);
|
|
}
|
|
value = importDefault(3853) /* metro dependency 3853: Linking */;
|
|
value.performURLNavigation(a0);
|
|
return global.Promise.resolve();
|
|
}
|
|
IN_APP = WebBrowserType.IN_APP;
|
|
if (IN_APP === r5) {
|
|
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (moduleValue3.isAndroid()) {
|
|
value = importDefault(4079) /* metro dependency 4079: NativeBrowserManagerModule */;
|
|
value = value.openInAppURL(a0);
|
|
r5 = value;
|
|
} else {
|
|
r5 = BrowserManager.openInAppURL(a0);
|
|
}
|
|
return r5.then(_fun33457);
|
|
}
|
|
if (WebBrowserType.CHROME === r5) {
|
|
moduleValue2 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (moduleValue2.isAndroid()) {
|
|
value = importDefault(4079) /* metro dependency 4079: NativeBrowserManagerModule */;
|
|
value = value.openInChromeURL(a0);
|
|
r1 = value;
|
|
} else {
|
|
r1 = BrowserManager.openInChromeURL(a0, true);
|
|
}
|
|
return r1;
|
|
}
|
|
value = require(1360) /* metro dependency 1360: GlobalUtils */;
|
|
return value.assertNever(r5);
|
|
}
|
|
(importDefault(3853) /* metro dependency 3853: Linking */).performURLNavigation(a0);
|
|
const Promise = global.Promise;
|
|
return Promise.resolve();
|
|
}
|
|
|
|
function browserManagerSelectBrowser(a0) { // fn#33461, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:2892, offset: 0x0102eff2, size: 371 bytes, params: 2, frame: 16
|
|
const WebBrowserType = (require(676) /* metro dependency 676: ConstantsIOS */).WebBrowserType;
|
|
var defaultImport;
|
|
const BrowserType = (require(4079) /* metro dependency 4079: NativeBrowserManagerModule */).BrowserType;
|
|
var defaultImport2;
|
|
var defaultImport3;
|
|
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (platformUtilsModule.isAndroid()) {
|
|
if (WebBrowserType.SAFARI === a0) {
|
|
defaultImport3 = importDefault(4079) /* metro dependency 4079: NativeBrowserManagerModule */;
|
|
defaultImport3.selectBrowser(BrowserType.SAFARI);
|
|
} else if (WebBrowserType.IN_APP === a0) {
|
|
defaultImport2 = importDefault(4079) /* metro dependency 4079: NativeBrowserManagerModule */;
|
|
defaultImport2.selectBrowser(BrowserType.IN_APP);
|
|
} else if (WebBrowserType.CHROME === a0) {
|
|
defaultImport = importDefault(4079) /* metro dependency 4079: NativeBrowserManagerModule */;
|
|
defaultImport.selectBrowser(BrowserType.CHROME);
|
|
}
|
|
} else {
|
|
NativeModules.BrowserManager.selectBrowser(a0);
|
|
}
|
|
env0_7.setState({selectedBrowser: a0});
|
|
}
|
|
|
|
function browserManagerCloseBrowser() { // fn#33462, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:3333, offset: 0x0102f165, size: 86 bytes, params: 1, frame: 13
|
|
env0_7.setState({isInAppBrowserOpen: false});
|
|
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (!platformUtilsModule.isAndroid()) {
|
|
NativeModules.BrowserManager.closeBrowser();
|
|
}
|
|
}
|
|
|
|
function openPlayStoreInlineInstall(a0, a1, a2) { // fn#33463, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:3490, offset: 0x0102f1bb, size: 188 bytes, params: 4, frame: 19
|
|
var r0;
|
|
const env0_0 = a2;
|
|
const Date = global.Date;
|
|
const env0_1 = Date.now();
|
|
var value;
|
|
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (platformUtilsModule.isAndroid()) {
|
|
value = importDefault(4079) /* metro dependency 4079: NativeBrowserManagerModule */;
|
|
value = value.openPlayStoreInline(a0, a1, _fun33464);
|
|
r0 = value;
|
|
} else if (a1 == null) {
|
|
r0 = global.Promise.resolve(false);
|
|
} else {
|
|
if (a2 != null) {
|
|
BrowserManager.setOpenAppStoreDismissCallback(_fun33465);
|
|
}
|
|
r0 = BrowserManager.openAppStoreInline(a0, a1);
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function _fun33455(a0, a1) { // fn#33455, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:1642, offset: 0x0102ec4c, size: 53 bytes, params: 3, frame: 13
|
|
if (a0.isInAppBrowserOpen !== a1.isInAppBrowserOpen) {
|
|
env0_0(a0.isInAppBrowserOpen, a1.isInAppBrowserOpen);
|
|
}
|
|
}
|
|
|
|
function _fun33457(a0) { // fn#33457, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:2220, offset: 0x0102ee9f, size: 53 bytes, params: 2, frame: 12
|
|
var environment;
|
|
var value;
|
|
if (a0 !== false) {
|
|
value = environment.__proto__;
|
|
env1_7.setState({isInAppBrowserOpen: true});
|
|
subscribeToInAppBrowserClose();
|
|
}
|
|
}
|
|
|
|
function _fun33464() { // fn#33464, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:3610, offset: 0x0102f277, size: 53 bytes, params: 1, frame: 12
|
|
const Date = global.Date;
|
|
let value = Date.now();
|
|
value -= env0_1;
|
|
if (importDefault != null) {
|
|
importDefault(value);
|
|
}
|
|
}
|
|
|
|
function _fun33465() { // fn#33465, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:3723, offset: 0x0102f2ac, size: 41 bytes, params: 1, frame: 11
|
|
const Date = global.Date;
|
|
let value = Date.now();
|
|
value -= env0_1;
|
|
importDefault(value);
|
|
}
|
|
|
|
function subscribeToInAppBrowserClose() { // fn#33458, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:2269, offset: 0x0102eed4, size: 166 bytes, params: 1, frame: 16
|
|
var moduleValue2;
|
|
var value2;
|
|
var nativeEventEmitter;
|
|
removeInAppBrowserCloseSubscription();
|
|
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (platformUtilsModule.isIOS()) {
|
|
value2 = Object.create(NativeEventEmitter.prototype, {constructor: {value: NativeEventEmitter}});
|
|
nativeEventEmitter = new NativeEventEmitter(BrowserManager);
|
|
env2_8 = (nativeEventEmitter instanceof Object ? nativeEventEmitter : value2).addListener('safariViewControllerDidFinish',
|
|
|
|
_fun33459);
|
|
} else {
|
|
moduleValue2 = platformUtilsModule;
|
|
if (moduleValue2.isAndroid()) {
|
|
env2_8 = AppState.addEventListener('change', _fun33460);
|
|
}
|
|
}
|
|
}
|
|
|
|
function _fun33459() { // fn#33459, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:2431, offset: 0x0102ef7a, size: 39 bytes, params: 1, frame: 13
|
|
env3_7.setState({isInAppBrowserOpen: false});
|
|
removeInAppBrowserCloseSubscription();
|
|
}
|
|
|
|
function _fun33460(a0) { // fn#33460, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4236:2571, offset: 0x0102efa1, size: 81 bytes, params: 2, frame: 13
|
|
if (a0 === 'active' && env3_7.getState().isInAppBrowserOpen) {
|
|
value = environment.__proto__.__proto__.__proto__;
|
|
env3_7.setState({isInAppBrowserOpen: false});
|
|
removeInAppBrowserCloseSubscription();
|
|
}
|
|
}
|
|
|