Files
2026-07-28 01:06:53 +03:00

225 lines
11 KiB
TypeScript

/* Metro module 9122; source: modules/channel/getChannelA11yLabel.tsx; dependencies: [1383, 3793, 1878, 661, 1244, 4805, 5107, 3995, 8375, 2] */
import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
import RelationshipStore from '../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as ChannelRecordModule from '../../records/ChannelRecord.tsx'; /* Metro dependency 1383 */
import * as UseChannelNameModule from './useChannelName.tsx'; /* Metro dependency 4805 */
function _fun71468(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#71468, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9307:6, offset: 0x01d212e4, size: 218 bytes, params: 8, frame: 20
const env0_0 = require;
const getStatusLabel2 = getStatusLabel;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/channel/getChannelA11yLabel.tsx');
exports.default = getChannelA11yLabel;
exports.getStatusLabel = getStatusLabel2;
exports.getChannelA11yHint = getChannelA11yHint;
function getStatusLabel(a0) { // fn#71469, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9307:190, offset: 0x01d213be, size: 254 bytes, params: 2, frame: 12
var moduleValue;
var moduleValue2;
var moduleValue3;
var moduleValue4;
const ONLINE = StatusTypes.ONLINE;
if (ONLINE === a0) {
moduleValue4 = require(3995) /* metro dependency 3995: UserUtils */;
return moduleValue4.humanizeStatus(StatusTypes.ONLINE);
}
const IDLE = StatusTypes.IDLE;
if (IDLE === a0) {
moduleValue3 = require(3995) /* metro dependency 3995: UserUtils */;
return moduleValue3.humanizeStatus(StatusTypes.IDLE);
}
const DND = StatusTypes.DND;
if (DND === a0) {
moduleValue2 = require(3995) /* metro dependency 3995: UserUtils */;
return moduleValue2.humanizeStatus(StatusTypes.DND);
}
const INVISIBLE = StatusTypes.INVISIBLE;
if (INVISIBLE === a0) {
moduleValue = require(3995) /* metro dependency 3995: UserUtils */;
return moduleValue.humanizeStatus(StatusTypes.INVISIBLE);
}
return '';
}
function getChannelA11yLabel({channel, unread, mentionCount, voiceStates, embeddedActivitiesCount, activityNames, isSubscriptionGated, needSubscriptionToAccess, isIncomingCall, isOngoingCall, voiceChannelStartTime}) { // fn#71470, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9307:540, offset: 0x01d214bc, size: 2314 bytes, params: 2, frame: 39
var r14;
var r2;
var r20;
var r0;
var r10;
const intl = (IndexNativeModule).intl;
const t = (IndexNativeModule).t;
var property;
var TPPk2T;
var formatToPlainString;
var bkpadO;
var object;
var push;
var userLimit;
var value10;
var JQtsGh;
var moduleValue2;
var formatActiveA11yTimestamp;
var Date;
var LmYuHT;
var object3;
var Bo4msg;
unread = !(unread === undefined) && unread;
mentionCount = mentionCount === undefined ? 0 : mentionCount;
isIncomingCall = !(isIncomingCall === undefined) && isIncomingCall;
isOngoingCall = !(isOngoingCall === undefined) && isOngoingCall;
const channelName = UseChannelNameModule.computeChannelName(channel, UserStore, RelationshipStore);
const r1 = (importDefault(5107) /* metro dependency 5107: isRoleRequired */)(channel) ? intl.string(t['4qvAtn']) : undefined;
const type = channel.type;
const DM = ChannelTypes.DM;
if (DM === type) {
r0 = mentionCount > 0 ? t.TO8LYt : unread ? t.F2MZsu : t.fYqXVY;
r10 = undefined;
r14 = r0;
} else if (ChannelTypes.GROUP_DM === type) {
r20 = mentionCount > 0 ? t.Lo0dCa : unread ? t['fxxUo/'] : t.lts3Ld;
formatToPlainString = intl.formatToPlainString;
object = {channelName: channelName, mentionCount: mentionCount};
object = [Reflect.apply(formatToPlainString, intl, [r20, object])];
formatToPlainString = intl.formatToPlainString;
object[1] = Reflect.apply(formatToPlainString, intl, [t.CxSA5N, {members: channel.recipients.length + 1}]);
r10 = object.join(', ');
r14 = undefined;
} else if (ChannelTypes.GUILD_STORE === type) {
Bo4msg = t.Bo4msg;
r10 = undefined;
r14 = Bo4msg;
} else if (ChannelTypes.GUILD_DIRECTORY === type) {
property = t['92EAF2'];
r10 = undefined;
r14 = property;
} else if (ChannelTypes.GUILD_ANNOUNCEMENT === type) {
r2 = mentionCount > 0 ? t.sDKIpm : unread ? t.VM7z8f : t.WJ3MPt;
r10 = undefined;
r14 = r2;
} else if (ChannelTypes.GUILD_VOICE === type) {
formatToPlainString = intl.formatToPlainString;
bkpadO = t.bkpadO;
object = {channelName: channelName};
object = [Reflect.apply(formatToPlainString, intl, [bkpadO, object])];
if (mentionCount > 0) {
object.push(intl.formatToPlainString(t['3l1GOx'], {mentionCount: mentionCount}));
}
if (unread) {
object.push(intl.string(t.x5zAGZ));
}
userLimit = channel.userLimit;
if (voiceStates != null) {
if (voiceStates.length > 0) {
value10 = voiceStates.length - 3;
object.push(voiceStates.slice(0, 3).map(_fun71471).join(', '));
if (value10 > 0) {
object.push(intl.formatToPlainString(t.sfgpgr, {overflow: value10}));
}
if (userLimit != null && userLimit > 0) {
object.push(intl.formatToPlainString(t['6qgTOF'], {userCount: voiceStates.length,
limit: userLimit}));
}
}
}
if (voiceChannelStartTime != null) {
push = object.push;
formatToPlainString = intl.formatToPlainString;
JQtsGh = t.JQtsGh;
moduleValue2 = require(8375) /* metro dependency 8375: utils */;
formatActiveA11yTimestamp = moduleValue2.formatActiveA11yTimestamp;
Date = global.Date;
Reflect.apply(push, object, [Reflect.apply(formatToPlainString, intl, [JQtsGh,
{duration: Reflect.apply(formatActiveA11yTimestamp, moduleValue2, [{start: voiceChannelStartTime},
Date.now()])}])]);
}
if (activityNames != null && activityNames.length > 0) {
push = object.push;
formatToPlainString = intl.formatToPlainString;
LmYuHT = t.LmYuHT;
object3 = {};
object3.activeActivities = activityNames.join(', ');
Reflect.apply(push, object, [Reflect.apply(formatToPlainString, intl, [LmYuHT, object3])]);
}
r10 = object.join(', ');
r14 = undefined;
} else if (ChannelTypes.GUILD_STAGE_VOICE === type) {
TPPk2T = t.TPPk2T;
r10 = undefined;
r14 = TPPk2T;
} else {
r14 = THREAD_CHANNEL_TYPES.has(channel.type) ? mentionCount > 0 ? t['ZL7+I6'] : unread ? t.YlVvmc : t['0nZpiF'] : mentionCount > 0 ? t.g8ONM0 : unread ? t.smf1CZ : t.s0JADj;
r10 = undefined;
}
if (r10 != null) {
r2 = [r10];
} else if (r14 != null) {
formatToPlainString = intl.formatToPlainString;
object = {channelName: channelName, mentionCount: mentionCount};
object = [Reflect.apply(formatToPlainString, intl, [r14, object])];
r2 = object;
} else {
r2 = [];
}
if (isIncomingCall) {
r2.push(intl.string(t['fk1/bX']));
} else if (isOngoingCall) {
r2.push(intl.string(t['NGg/fm']));
}
if (embeddedActivitiesCount != null && embeddedActivitiesCount > 0) {
r2.push(intl.formatToPlainString(t.O6PLYd, {activitiesCount: embeddedActivitiesCount}));
}
object = {isSubscriptionGated: isSubscriptionGated, needSubscriptionToAccess: needSubscriptionToAccess};
const r4 = object.isSubscriptionGated ? object.needSubscriptionToAccess ? intl.string(t['oj+HOs']) : intl.string(t.xI3TQQ) : undefined;
if (r4 != null) {
r2.push(r4);
}
if (r1 != null) {
r2.push(r1);
}
return r2.join(', ');
function _fun71471({nick, user}) { // fn#71471, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9307:1767, offset: 0x01d21dc6, size: 58 bytes, params: 2, frame: 13
var r0;
var value;
if (nick != null) {
r0 = nick;
} else {
value = environment.__proto__;
value = require(3995) /* metro dependency 3995: UserUtils */;
value = value.getName(user);
r0 = value;
}
return r0;
}
}
function getChannelA11yHint({channel, muted, userStatus, isFavorite}) { // fn#71472, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9307:3132, offset: 0x01d21e00, size: 284 bytes, params: 2, frame: 19
const intl = (IndexNativeModule).intl;
const t = (IndexNativeModule).t;
const items2 = [];
if (isFavorite) {
items2.push(intl.string(t.cCPjSK));
}
if (muted === true) {
items2.push(intl.string(t.C4zCMb));
return items2.join(', ');
}
const type = channel.type;
const DM = ChannelTypes.DM;
if (type === DM) {
if (userStatus != null) {
items2.push(getStatusLabel(userStatus));
}
}
return items2.length > 0 ? items2.join(', ') : undefined;
}
}
global.__d(_fun71468, 9122, [1383, 3793, 1878, 661, 1244, 4805, 5107, 3995, 8375,
2]) /* metro module 9122, dependencies: [1383, 3793, 1878, 661, 1244, 4805, 5107, 3995, 8375, 2] */;