283 lines
17 KiB
TypeScript
283 lines
17 KiB
TypeScript
/* Metro module 15097; source: modules/threads/native/components/ThreadBrowserRowSubtext.tsx; dependencies: [31, 27, 4502, 1945, 1878, 6898, 661, 482, 33, 4501, 697, 566, 7169, 6630, 6593, 4573, 1244, 3995, 6902, 4634, 21, 1305, 8349, 8206, 4020, 2] */
|
|
import SnowflakeUtils from '../../../../utils/SnowflakeUtils.tsx'; /* Metro dependency 21 */
|
|
import Native from '../../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
|
|
import UserStore from '../../../../stores/UserStore.tsx'; /* Metro dependency 1878 */
|
|
import GuildMemberStore from '../../../../stores/GuildMemberStore.tsx'; /* Metro dependency 1945 */
|
|
import AccessibilityStore from '../../../a11y/AccessibilityStore.tsx'; /* Metro dependency 4502 */
|
|
import UseMessageAuthor from '../../../messages/useMessageAuthor.tsx'; /* Metro dependency 4634 */
|
|
import UseHasEnhancedRoleColors from '../../../premium/powerups/hooks/useHasEnhancedRoleColors.tsx'; /* Metro dependency 6630 */
|
|
import ThreadMessageStore from '../../ThreadMessageStore.tsx'; /* Metro dependency 6898 */
|
|
import RenderMessageMarkup from '../../../messages/renderMessageMarkup.tsx'; /* Metro dependency 8349 */
|
|
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactNativeModule from '../../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
|
|
import * as ReactModule from '../../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as JsxRuntimeModule from '../../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
|
|
import * as ConstantsModule from '../../../../external/discord_common/js/shared/Constants.tsx'; /* Metro dependency 482 */
|
|
import * as ConstantsModule2 from '../../../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as IndexNativeModule from '../../../../intl/index.native.tsx'; /* Metro dependency 1244 */
|
|
import * as NativeModule from '../../../../design/void/native.tsx'; /* Metro dependency 1305 */
|
|
import * as FabricUtilsModule from '../../../../utils/native/FabricUtils.tsx'; /* Metro dependency 4020 */
|
|
import * as CreateStylesModule from '../../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
|
|
import * as TextModule from '../../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
|
|
import * as SubscribeGuildMembersModule from '../../../../lib/guild/subscribeGuildMembers.tsx'; /* Metro dependency 6902 */
|
|
import * as ThreadUtilsModule from '../../ThreadUtils.tsx'; /* Metro dependency 7169 */
|
|
import * as EnhancedRoleColorUtilsModule from '../../../premium/enhanced_role_colors/native/EnhancedRoleColorUtils.tsx'; /* Metro dependency 8206 */
|
|
|
|
function _fun114222(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#114222, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15294:6, offset: 0x02418455, size: 543 bytes, params: 8, frame: 23
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const MessageTypes = (ConstantsModule2).MessageTypes;
|
|
const Fonts = (ConstantsModule).Fonts;
|
|
const CHANNEL_NAME_CHANGE = MessageTypes.CHANNEL_NAME_CHANGE;
|
|
object = [CHANNEL_NAME_CHANGE];
|
|
const THREAD_STARTER_MESSAGE = MessageTypes.THREAD_STARTER_MESSAGE;
|
|
object[1] = THREAD_STARTER_MESSAGE;
|
|
const createStyles = CreateStylesModule.createStyles;
|
|
object = {};
|
|
object.row = {flexDirection: 'row'};
|
|
object.subtextContent = {'lineHeight': 18, 'flexShrink': 1};
|
|
object.timestamp = {lineHeight: 18};
|
|
const object3 = {'fontSize': 14, 'lineHeight': 18};
|
|
const PRIMARY_SEMIBOLD = Fonts.PRIMARY_SEMIBOLD;
|
|
object3.fontFamily = PRIMARY_SEMIBOLD;
|
|
const TEXT_SUBTLE = (Native).colors.TEXT_SUBTLE;
|
|
object3.color = TEXT_SUBTLE;
|
|
object.username = object3;
|
|
const BACKGROUND_MOD_STRONG = (Native).colors.BACKGROUND_MOD_STRONG;
|
|
object.dividerDot = {'width': 4, 'height': 4, 'marginHorizontal': 4, 'borderRadius': 2, 'backgroundColor': null,
|
|
'alignSelf': 'center', backgroundColor: BACKGROUND_MOD_STRONG};
|
|
const env0_13 = Reflect.apply(createStyles, CreateStylesModule, [object]);
|
|
const env0_14 = ReactModule.memo(_fun114231);
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/threads/native/components/ThreadBrowserRowSubtext.tsx');
|
|
exports.ThreadSubtext = ThreadSubtext;
|
|
function MessageContent({thread, message}) { // fn#114223, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15294:1751, offset: 0x02418674, size: 511 bytes, params: 2, frame: 23
|
|
const styles = useStyles();
|
|
(SubscribeGuildMembersModule).useSubscribeGuildMembers({[thread.guild_id]: [message.author.id]},
|
|
'ThreadBrowserRowSubtext');
|
|
const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], function() {
|
|
return UserStore.getUser(message.author.id) ?? message.author;
|
|
});
|
|
const env0_1 = (require(566) /* metro dependency 566: flux */).useStateFromStores([AccessibilityStore], function() {
|
|
return AccessibilityStore.roleStyle;
|
|
});
|
|
const value3 = (UseMessageAuthor)(message);
|
|
const env0_2 = value3.nick;
|
|
const env0_3 = value3.colorString;
|
|
const env0_4 = value3.colorStrings;
|
|
const defaultImport = SnowflakeUtils;
|
|
const value4 = defaultImport.extractTimestamp(message.id);
|
|
const timestampString = (ThreadUtilsModule).getTimestampString(value4);
|
|
const timestampAccessibilityLabel = (ThreadUtilsModule).getTimestampAccessibilityLabel(value4);
|
|
const env0_5 = (UseHasEnhancedRoleColors)(thread.guild_id,
|
|
value2.id);
|
|
const Text = (TextModule).Text;
|
|
const intl = (IndexNativeModule).intl;
|
|
const format = intl.format;
|
|
const M79KAH = (IndexNativeModule).t.M79KAH;
|
|
return (
|
|
<SubstringRow
|
|
user={value2}
|
|
timestamp={timestampString}
|
|
accessibilityLabel={timestampAccessibilityLabel}
|
|
>
|
|
<Text
|
|
lineClamp={1}
|
|
ellipsizeMode="tail"
|
|
lineBreakMode="tail"
|
|
style={styles.subtextContent}
|
|
variant="text-sm/medium"
|
|
color="text-default"
|
|
>
|
|
{Reflect.apply(format, intl, [M79KAH, {usernameHook: usernameHook_114226,
|
|
messageTextHook: messageTextHook}])}
|
|
</Text>
|
|
</SubstringRow>
|
|
);
|
|
function MessageContentUsernameHook(a0, a1) { // fn#114226, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15294:2524, owner: MessageContent.usernameHook, offset: 0x024188a9, size: 134 bytes, params: 3, frame: 18
|
|
const value = environment.__proto__;
|
|
const nickBinding = nick;
|
|
const value2 = null;
|
|
return (
|
|
<Username_114229
|
|
nickname={value2 != nickBinding ? nick : ''}
|
|
usernameColor={roleStyle !== 'username' ? value2 : colorString}
|
|
roleColor={colorString}
|
|
roleColors={env0_5 ? colorStrings : value2}
|
|
shouldShowRoleDot={roleStyle === 'dot' && value2 != colorString}
|
|
key={a1}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function messageTextHook(a0, a1) { // fn#114227, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15294:2690, owner: MessageContent.messageTextHook, offset: 0x0241892f, size: 101 bytes, params: 3, frame: 17
|
|
const value = environment.__proto__;
|
|
const LegacyText = (NativeModule).LegacyText;
|
|
return (
|
|
<LegacyText key={a1}>
|
|
{(RenderMessageMarkup)(message, {'formatInline': true,
|
|
'allowGameMentions': true}).content}
|
|
</LegacyText>
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
function SubstringRow({user, children, timestamp, accessibilityLabel}) { // fn#114228, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15294:2798, offset: 0x02418994, size: 334 bytes, params: 2, frame: 23
|
|
const styles = useStyles();
|
|
return (
|
|
user == null
|
|
? (
|
|
<View style={styles.row}>
|
|
{((Text) => <Text style={styles.timestamp} accessibilityLabel={accessibilityLabel} variant="text-sm/medium" color="text-muted">{' ' + timestamp}</Text>)((require(4573) /* metro dependency 4573: Text */).Text)}
|
|
</View>
|
|
)
|
|
: (
|
|
<View style={styles.row}>
|
|
{children}
|
|
<View style={styles.dividerDot} />
|
|
{((Text) => <Text style={styles.timestamp} accessibilityLabel={accessibilityLabel} variant="text-sm/medium" color="text-muted">{'' + timestamp}</Text>)((require(4573) /* metro dependency 4573: Text */).Text)}
|
|
</View>
|
|
)
|
|
);
|
|
}
|
|
|
|
function Username_114229({nickname, usernameColor, roleColor, roleColors, shouldShowRoleDot}) { // fn#114229, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15294:3220, offset: 0x02418ae2, size: 330 bytes, params: 2, frame: 25
|
|
const styles = useStyles();
|
|
const value3 = env0_3.useMemo(function() {
|
|
return usernameColor != null ? [styles.username, {color: usernameColor}] : styles.username;
|
|
}, [usernameColor, styles]);
|
|
const value4 = (EnhancedRoleColorUtilsModule).useProcessColorStringsArray(roleColors);
|
|
const r12 = !shouldShowRoleDot && value4.length > 1;
|
|
const jsxRuntimeEnv0_11Binding = jsxRuntimeEnv0_11;
|
|
const r6 = shouldShowRoleDot && ((RoleDot) => <RoleDot color={roleColor} colors={roleColors} size="small" />)((require(1305) /* metro dependency 1305: native */).RoleDot);
|
|
const Text = (TextModule).Text;
|
|
return (
|
|
<>
|
|
{r6}
|
|
<Text
|
|
variant="text-sm/semibold"
|
|
color="mobile-text-heading-primary"
|
|
experimental_useNativeText={!FabricUtilsModule.isFabric()}
|
|
gradientColors={r12 ? value4 : undefined}
|
|
style={value3}
|
|
>
|
|
{nickname}
|
|
</Text>
|
|
</>
|
|
);
|
|
}
|
|
|
|
function _fun114231({thread, timestamp, accessibilityLabel}) { // fn#114231, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15294:665, offset: 0x02418c6a, size: 549 bytes, params: 2, frame: 24
|
|
const styles = useStyles();
|
|
const user = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], function() {
|
|
return UserStore.getUser(thread.ownerId);
|
|
});
|
|
const member = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildMemberStore], function() {
|
|
var guildMemberStoreBinding = GuildMemberStore;
|
|
var threadBinding = thread;
|
|
return guildMemberStoreBinding.getMember(threadBinding.guild_id, threadBinding.ownerId);
|
|
});
|
|
const env0_3 = (require(566) /* metro dependency 566: flux */).useStateFromStores([AccessibilityStore], function() {
|
|
return AccessibilityStore.roleStyle;
|
|
});
|
|
const env0_4 = member?.colorString ?? null;
|
|
const env0_5 = member?.colorStrings ?? null;
|
|
const env0_6 = (importDefault(6630) /* metro dependency 6630: useHasEnhancedRoleColors */)(thread.guild_id,
|
|
user?.id);
|
|
const env0_7 = env0_3.useRef(thread);
|
|
env0_3.useEffect(_fun114235);
|
|
env0_3.useEffect(_fun114236, [member, user]);
|
|
const Text = (TextModule).Text;
|
|
const intl = (IndexNativeModule).intl;
|
|
return (
|
|
<SubstringRow
|
|
user={user}
|
|
timestamp={timestamp}
|
|
accessibilityLabel={accessibilityLabel}
|
|
>
|
|
<Text
|
|
lineClamp={1}
|
|
ellipsizeMode="tail"
|
|
lineBreakMode="tail"
|
|
style={styles.subtextContent}
|
|
accessibilityLabel={accessibilityLabel}
|
|
variant="text-sm/medium"
|
|
color="text-default"
|
|
>
|
|
{intl.format((IndexNativeModule).t.imPXd5,
|
|
{usernameHook: usernameHook_114237})}
|
|
</Text>
|
|
</SubstringRow>
|
|
);
|
|
function _fun114235() { // fn#114235, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15294:1097, offset: 0x01df3c25, size: 21 bytes, params: 1, frame: 2
|
|
env0_7.current = thread;
|
|
}
|
|
|
|
function _fun114236() { // fn#114236, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15294:1130, offset: 0x02418ed7, size: 90 bytes, params: 1, frame: 14
|
|
var current;
|
|
var value;
|
|
if (user == null) {
|
|
current = env0_7.current;
|
|
value = environment.__proto__;
|
|
value = importDefault(6593) /* metro dependency 6593: GuildActionCreators */;
|
|
value.requestMembersById(current.guild_id, [current.ownerId]);
|
|
} else if (member == null) {
|
|
current = env0_7.current;
|
|
value = environment.__proto__;
|
|
value = importDefault(6593) /* metro dependency 6593: GuildActionCreators */;
|
|
value.requestMembersById(current.guild_id, [current.ownerId]);
|
|
}
|
|
}
|
|
|
|
function usernameHook_114237(a0, a1) { // fn#114237, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15294:1509, offset: 0x02418f31, size: 191 bytes, params: 3, frame: 20
|
|
var r7;
|
|
let value = environment.__proto__;
|
|
const memberBinding = member;
|
|
const value3 = null;
|
|
const nick = value3 == memberBinding ? undefined : member.nick;
|
|
if (value3 != nick) {
|
|
r7 = nick;
|
|
} else {
|
|
value = importDefault(3995) /* metro dependency 3995: UserUtils */;
|
|
value = value.getName(user);
|
|
r7 = value;
|
|
}
|
|
return (
|
|
<Username_114229
|
|
nickname={value3 != r7 ? r7 : ''}
|
|
usernameColor={roleStyle !== 'username' ? value3 : env0_4}
|
|
roleColor={env0_4}
|
|
roleColors={env0_6 ? env0_5 : value3}
|
|
shouldShowRoleDot={roleStyle === 'dot' && value3 != env0_4}
|
|
key={a1}
|
|
/>
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
function ThreadSubtext({thread}) { // fn#114238, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15294:3816, offset: 0x02418ff0, size: 255 bytes, params: 2, frame: 21
|
|
const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStores([ThreadMessageStore], function() {
|
|
return ThreadMessageStore.getMostRecentMessage(id);
|
|
}, [thread.id]);
|
|
const value3 = (require(7169) /* metro dependency 7169: ThreadUtils */).useLastMessageTimestamp(thread);
|
|
if (value2 == null) {
|
|
return ((Component) => <Component thread={thread} timestamp={(require(7169) /* metro dependency 7169: ThreadUtils */).getTimestampString(value3)} accessibilityLabel={(require(7169) /* metro dependency 7169: ThreadUtils */).getTimestampAccessibilityLabel(value3)} />)(env0_14);
|
|
}
|
|
const binding = env0_12;
|
|
if (binding.includes(value2.type)) {
|
|
return ((Component) => <Component thread={thread} timestamp={(require(7169) /* metro dependency 7169: ThreadUtils */).getTimestampString(value3)} accessibilityLabel={(require(7169) /* metro dependency 7169: ThreadUtils */).getTimestampAccessibilityLabel(value3)} />)(env0_14);
|
|
}
|
|
if (thread.isArchivedThread()) {
|
|
return ((Component) => <Component thread={thread} timestamp={(require(7169) /* metro dependency 7169: ThreadUtils */).getTimestampString(value3)} accessibilityLabel={(require(7169) /* metro dependency 7169: ThreadUtils */).getTimestampAccessibilityLabel(value3)} />)(env0_14);
|
|
}
|
|
return <MessageContent thread={thread} message={value2} />;
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun114222, 15097, [31, 27, 4502, 1945, 1878, 6898, 661, 482, 33, 4501, 697, 566, 7169, 6630, 6593, 4573,
|
|
1244, 3995, 6902, 4634, 21, 1305, 8349, 8206, 4020,
|
|
2]) /* metro module 15097, dependencies: [31, 27, 4502, 1945, 1878, 6898, 661, 482, 33, 4501, 697, 566, 7169, 6630, 6593, 4573, 1244, 3995, 6902, 4634, 21, 1305, 8349, 8206, 4020, 2] */;
|