Files
discord-decomp/sources/modules/app_launcher/hooks/useIsPrimaryEntryPointDisabled.tsx
2026-07-28 01:06:53 +03:00

108 lines
5.8 KiB
TypeScript

/* Metro module 11682; source: modules/app_launcher/hooks/useIsPrimaryEntryPointDisabled.tsx; dependencies: [4235, 3784, 482, 566, 9467, 11598, 8448, 8049, 477, 1244, 2] */
import PermissionStore from '../../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */
import ApplicationRecord from '../../../records/ApplicationRecord.tsx'; /* Metro dependency 4235 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../../external/discord_common/js/shared/Constants.tsx'; /* Metro dependency 482 */
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as UseActivityShelfItemModule from '../../activities/utils/useActivityShelfItem.tsx'; /* Metro dependency 11598 */
function _fun89536(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#89536, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11868:6, offset: 0x02012746, size: 156 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/app_launcher/hooks/useIsPrimaryEntryPointDisabled.tsx');
exports.default = useIsPrimaryEntryPointDisabled;
function useIsPrimaryEntryPointDisabled({context, application, activityAction}) { // fn#89537, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11868:244, offset: 0x020127e2, size: 786 bytes, params: 2, frame: 24
var r5;
var r7;
var r1;
var r2;
var moduleValue3;
var moduleValue4;
var defaultImport;
var moduleValue5;
var supported_platforms;
const intl = (IndexNativeModule).intl;
const t = (IndexNativeModule).t;
var value13;
var value14;
const value = undefined;
const channel = context.type !== 'channel' ? value : context.channel;
const value3 = (require(566) /* metro dependency 566: flux */).useStateFromStores([PermissionStore], function() {
var permissionStoreBinding = PermissionStore;
var USE_EMBEDDED_ACTIVITIES = Permissions.USE_EMBEDDED_ACTIVITIES;
return permissionStoreBinding.can(USE_EMBEDDED_ACTIVITIES, channel);
});
const value4 = (require(9467) /* metro dependency 9467: getEmbeddedActivityLaunchability */).useEmbeddedActivityLaunchability(channel == null ? value : channel.id);
const ActivityAction = (UseActivityShelfItemModule).ActivityAction;
let LEAVE = ActivityAction.LEAVE;
if (LEAVE === activityAction) {
r5 = false;
} else if (ActivityAction.START === activityAction) {
if (channel == null) {
r5 = false;
} else if (channel == null) {
moduleValue4 = require(8448) /* metro dependency 8448: ActivitiesInTextUtils */;
r5 = !moduleValue4.isActivitiesInTextEnabled(channel) && true;
} else if (channel.isGuildVoice()) {
r5 = !(value4 === (require(9467) /* metro dependency 9467: getEmbeddedActivityLaunchability */).EmbeddedActivityLaunchability.CAN_LAUNCH) && true;
} else {
moduleValue4 = require(8448) /* metro dependency 8448: ActivitiesInTextUtils */;
r5 = !moduleValue4.isActivitiesInTextEnabled(channel) && true;
}
} else if (ActivityAction.JOIN !== activityAction) {
r5 = false;
} else if (channel == null) {
moduleValue3 = require(8448) /* metro dependency 8448: ActivitiesInTextUtils */;
r5 = !moduleValue3.isActivitiesInTextEnabled(channel) && true;
} else if (channel.isGuildVoice()) {
r5 = !value3;
} else {
moduleValue3 = require(8448) /* metro dependency 8448: ActivitiesInTextUtils */;
r5 = !moduleValue3.isActivitiesInTextEnabled(channel) && true;
}
LEAVE = ActivityAction.LEAVE;
if (activityAction === LEAVE) {
r1 = value;
r2 = r5;
} else {
r7 = application instanceof ApplicationRecord ? application.embeddedActivityConfig : application.embedded_activity_config;
defaultImport = importDefault(8049) /* metro dependency 8049: getPlatform */;
moduleValue5 = require(477) /* metro dependency 477: PlatformUtils */;
if (r7 == null) {
if (channel != null && channel.isThread()) {
value13 = intl.string(t.ddSR3v);
value14 = true;
r1 = value13;
r2 = value14;
} else {
r1 = value;
r2 = r5;
}
} else {
supported_platforms = r7.supported_platforms;
if (supported_platforms.includes(defaultImport(moduleValue5.getOS()))) {
if (channel != null && channel.isThread()) {
value13 = intl.string(t.ddSR3v);
value14 = true;
r1 = value13;
r2 = value14;
} else {
r1 = value;
r2 = r5;
}
} else {
r1 = intl.string(t.z2YTgJ);
r2 = false;
}
}
}
r1 = r2 && r1 == null ? intl.string(t.f41E1g) : r1;
return {disabled: r2, reason: r1};
}
}
global.__d(_fun89536, 11682, [4235, 3784, 482, 566, 9467, 11598, 8448, 8049, 477, 1244,
2]) /* metro module 11682, dependencies: [4235, 3784, 482, 566, 9467, 11598, 8448, 8049, 477, 1244, 2] */;