306 lines
15 KiB
TypeScript
306 lines
15 KiB
TypeScript
/* Metro module 8769; source: modules/markup/native/MarkupReactCommandRule.tsx; dependencies: [31, 1379, 1483, 5066, 6625, 33, 5068, 4008, 4080, 1583, 4496, 1244, 1305, 8770, 3856, 6797, 3829, 8772, 6802, 8774, 4573, 4015, 8776, 8778, 2] */
|
|
function _fun68600(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#68600, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8954:6, offset: 0x01c55991, size: 268 bytes, params: 8, frame: 21
|
|
const env0_0 = require;
|
|
const closure = handleTapCommandMention;
|
|
const closure2 = handleLongPressCommandMention;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importAll(31) /* metro dependency 31 */;
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const appLauncherNativeConstantsModule = require(1483) /* metro dependency 1483: AppLauncherNativeConstants */;
|
|
const env0_5 = appLauncherNativeConstantsModule.AppLauncherRouteName;
|
|
const env0_6 = appLauncherNativeConstantsModule.useAppLauncherNavigation;
|
|
const env0_7 = (require(5066) /* metro dependency 5066: ApplicationCommandConstants */).SUB_COMMAND_KEY_SEPARATOR;
|
|
const env0_8 = (require(6625) /* metro dependency 6625: ChannelAutocompleteConstants */).COMMAND_SENTINEL;
|
|
const env0_9 = (require(33) /* metro dependency 33 */).jsxs;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/markup/native/MarkupReactCommandRule.tsx');
|
|
exports.default = MarkupReactCommandRule;
|
|
exports.handleTapCommandMention = closure;
|
|
exports.handleLongPressCommandMention = closure2;
|
|
}
|
|
|
|
function handleTapCommandMention({appLauncherNavigator, channelId, currentText, onSetCommand, onOpenCustomKeyboard, commandId, commandName}) { // fn#68601, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8954:260, offset: 0x01c55a9d, size: 797 bytes, params: 2, frame: 27
|
|
var r6;
|
|
var length;
|
|
var r1;
|
|
var defaultImport;
|
|
var show;
|
|
var object3;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
var includes;
|
|
var value4;
|
|
var split;
|
|
var value5;
|
|
var slice;
|
|
var value6;
|
|
var join;
|
|
var value7;
|
|
var moduleValue;
|
|
var getRootNavigationRef;
|
|
var value8;
|
|
var getState;
|
|
var value9;
|
|
var routes;
|
|
var value10;
|
|
var value11;
|
|
var goBack;
|
|
var value12;
|
|
var defaultImport2;
|
|
var hideActionSheet;
|
|
var setTimeout;
|
|
var navigate;
|
|
var object4;
|
|
var env0_2;
|
|
const channel = ChannelStore.getChannel(channelId);
|
|
if (channel != null) {
|
|
reducibleJoin2: while (true) {
|
|
if (channel.guild_id != null) {
|
|
includes = commandName.includes;
|
|
reducibleJoin7: while (true) {
|
|
if (Reflect.apply(includes, commandName, [' '])) {
|
|
value4 = commandId + SUB_COMMAND_KEY_SEPARATOR;
|
|
split = commandName.split;
|
|
value5 = Reflect.apply(split, commandName, [' ']);
|
|
slice = value5.slice;
|
|
value6 = Reflect.apply(slice, value5, [1]);
|
|
join = value6.join;
|
|
value7 = value4 + Reflect.apply(join, value6, [SUB_COMMAND_KEY_SEPARATOR]);
|
|
r6 = value7;
|
|
break reducibleJoin7;
|
|
}
|
|
r6 = commandId;
|
|
break reducibleJoin7;
|
|
}
|
|
env0_2 = r6;
|
|
if (appLauncherNavigator != null) {
|
|
reducibleJoin9: while (true) {
|
|
if (channel != null) {
|
|
navigate = appLauncherNavigator.navigate;
|
|
object3 = {};
|
|
object3.name = AppLauncherRouteName.COMMAND_VIEW;
|
|
object4 = {};
|
|
object4.analyticsLocation = (require(5068) /* metro dependency 5068: ApplicationCommandTypes */).ApplicationCommandTriggerLocations.MENTION;
|
|
object4.preSelectedCommand = {commandId: r6};
|
|
object4.context = {type: 'channel', channel: channel};
|
|
object3.params = object4;
|
|
Reflect.apply(navigate, appLauncherNavigator, [object3]);
|
|
return undefined;
|
|
}
|
|
break reducibleJoin9;
|
|
}
|
|
}
|
|
moduleValue = require(4008) /* metro dependency 4008: RootNavigationRefNative */;
|
|
getRootNavigationRef = moduleValue.getRootNavigationRef;
|
|
value8 = Reflect.apply(getRootNavigationRef, moduleValue, []);
|
|
reducibleJoin20: while (true) {
|
|
if (value8 == null) {
|
|
break reducibleJoin20;
|
|
}
|
|
getState = value8.getState;
|
|
value9 = Reflect.apply(getState, value8, []);
|
|
reducibleJoin13: while (true) {
|
|
if (value9 == null) {
|
|
length = undefined;
|
|
break reducibleJoin13;
|
|
}
|
|
routes = value9.routes;
|
|
if (routes == null) {
|
|
length = undefined;
|
|
break reducibleJoin13;
|
|
}
|
|
length = routes.length;
|
|
break reducibleJoin13;
|
|
}
|
|
if (!(length > 1)) {
|
|
break reducibleJoin20;
|
|
}
|
|
getState = value8.getState;
|
|
value10 = Reflect.apply(getState, value8, []);
|
|
reducibleJoin17: while (true) {
|
|
if (value10 == null) {
|
|
length = undefined;
|
|
break reducibleJoin17;
|
|
}
|
|
routes = value10.routes;
|
|
if (routes == null) {
|
|
length = undefined;
|
|
break reducibleJoin17;
|
|
}
|
|
length = routes.length;
|
|
break reducibleJoin17;
|
|
}
|
|
value11 = 0;
|
|
r1 = length ?? value11;
|
|
if (!(r1 > 1)) {
|
|
break reducibleJoin20;
|
|
}
|
|
reducibleLoop19: while (true) {
|
|
goBack = value8.goBack;
|
|
Reflect.apply(goBack, value8, []);
|
|
value12 = typeof r1 === 'bigint' ? r1 - 1n : +r1 - 1;
|
|
if (value12 > 1) {
|
|
r1 = value12;
|
|
continue reducibleLoop19;
|
|
}
|
|
break reducibleJoin20;
|
|
}
|
|
}
|
|
defaultImport2 = importDefault(4080) /* metro dependency 4080: ActionSheetActionCreators */;
|
|
hideActionSheet = defaultImport2.hideActionSheet;
|
|
Reflect.apply(hideActionSheet, defaultImport2, []);
|
|
setTimeout = global.setTimeout;
|
|
setTimeout(_fun68602, 0);
|
|
return undefined;
|
|
}
|
|
break reducibleJoin2;
|
|
}
|
|
}
|
|
if (currentText === '') {
|
|
onSetCommand();
|
|
} else {
|
|
defaultImport = importDefault(4496) /* metro dependency 4496: AlertActionCreators */;
|
|
show = defaultImport.show;
|
|
object3 = {};
|
|
object3.title = intl.string(t.pe26Cj);
|
|
object3.confirmText = intl.string(t.VkKicb);
|
|
object3.onConfirm = function() {
|
|
return onSetCommand();
|
|
};
|
|
object3.cancelText = intl.string(t['ETE/oC']);
|
|
object3.confirmColor = (require(1305) /* metro dependency 1305: native */).ButtonColors.BRAND;
|
|
object3.body = intl.string(t['+awCIy']);
|
|
Reflect.apply(show, defaultImport, [object3]);
|
|
}
|
|
}
|
|
|
|
function handleLongPressCommandMention(a0, a1) { // fn#68604, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8954:1484, offset: 0x01c55e35, size: 310 bytes, params: 3, frame: 19
|
|
var push;
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
let object2 = {};
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const string = intl.string;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
object2.label = Reflect.apply(string, intl, [t['42H+Nb']]);
|
|
const SlashBoxIcon = (require(8770) /* metro dependency 8770: SlashBoxIcon */).SlashBoxIcon;
|
|
object2.IconComponent = SlashBoxIcon;
|
|
object2.onPress = onPress_68605;
|
|
const items2 = [object2];
|
|
const DeveloperMode = (require(3829) /* metro dependency 3829: UserSettings */).DeveloperMode;
|
|
const getSetting = DeveloperMode.getSetting;
|
|
if (Reflect.apply(getSetting, DeveloperMode, [])) {
|
|
push = items2.push;
|
|
object2 = {};
|
|
object2.label = intl.string(t.oJ1Muw);
|
|
object2.IconComponent = (require(8772) /* metro dependency 8772: IdIcon */).IdIcon;
|
|
object2.onPress = onPress_68606;
|
|
Reflect.apply(push, items2, [object2]);
|
|
}
|
|
(require(6802) /* metro dependency 6802: showSimpleActionSheet */).showSimpleActionSheet({'key': 'LongPressCommandMention',
|
|
'options': null, 'hasIcons': true, options: items2});
|
|
}
|
|
|
|
function MarkupReactCommandRule({node, output, state, style}) { // fn#68607, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8954:2049, offset: 0x01c5600c, size: 210 bytes, params: 2, frame: 22
|
|
const binding = env0_3;
|
|
const useContext = binding.useContext;
|
|
const AppLauncherContext = (require(8774) /* metro dependency 8774: AppLauncherContext */).AppLauncherContext;
|
|
const result = Reflect.apply(useContext, binding, [AppLauncherContext]) != null;
|
|
const env0_2 = useAppLauncherNavigation();
|
|
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
|
|
const object2 = {style: style, variant: 'text-md/bold', onPress: onPress_68608, onLongPress: function() {
|
|
var handleLongPressCommandMentionBinding = handleLongPressCommandMention;
|
|
var nodeBinding = node;
|
|
handleLongPressCommandMentionBinding(nodeBinding.commandName, nodeBinding.commandId);
|
|
}};
|
|
let value = require(8778) /* metro dependency 8778: MarkupRulesUtils */;
|
|
value = value.smartOutput(node, output, state);
|
|
return (
|
|
<Text {...object2}>
|
|
{'/'}
|
|
{value}
|
|
</Text>
|
|
);
|
|
}
|
|
|
|
function _fun68602() { // fn#68602, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8954:995, offset: 0x01c55dba, size: 123 bytes, params: 1, frame: 16
|
|
const onOpenCustomKeyboardBinding = onOpenCustomKeyboard;
|
|
const object3 = {};
|
|
const KeyboardTypes = (require(1583) /* metro dependency 1583: KeyboardTypes */).KeyboardTypes;
|
|
const APP_LAUNCHER = KeyboardTypes.APP_LAUNCHER;
|
|
object3.type = APP_LAUNCHER;
|
|
const object4 = {};
|
|
const COMMAND_VIEW = AppLauncherRouteName.COMMAND_VIEW;
|
|
object4.initialRouteName = COMMAND_VIEW;
|
|
const ApplicationCommandTriggerLocations = (require(5068) /* metro dependency 5068: ApplicationCommandTypes */).ApplicationCommandTriggerLocations;
|
|
const MENTION = ApplicationCommandTriggerLocations.MENTION;
|
|
object4.analyticsLocation = MENTION;
|
|
object4.preSelectedCommand = {commandId: env0_2};
|
|
object3.context = object4;
|
|
return onOpenCustomKeyboardBinding(object3);
|
|
}
|
|
|
|
function handleLongPressCommandMentionOnPress() { // fn#68605, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8954:1621, owner: handleLongPressCommandMention.onPress, offset: 0x01c55f6b, size: 94 bytes, params: 1, frame: 16
|
|
(require(3856) /* metro dependency 3856: ToastUtils */).presentCommandCopied();
|
|
const clipboardUtilsNativeModule = require(6797) /* metro dependency 6797: ClipboardUtilsNative */;
|
|
clipboardUtilsNativeModule.copy('' + COMMAND_SENTINEL + env0_0);
|
|
}
|
|
|
|
function handleLongPressCommandMentionOnPress_68606() { // fn#68606, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8954:1813, owner: handleLongPressCommandMention.onPress, offset: 0x01c55fc9, size: 67 bytes, params: 1, frame: 13
|
|
const value = environment.__proto__;
|
|
(require(3856) /* metro dependency 3856: ToastUtils */).presentIdCopied();
|
|
(require(6797) /* metro dependency 6797: ClipboardUtilsNative */).copy(require);
|
|
}
|
|
|
|
function MarkupReactCommandRuleOnPress() { // fn#68608, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8954:2239, owner: MarkupReactCommandRule.onPress, offset: 0x01c560de, size: 174 bytes, params: 1, frame: 16
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
const value2 = undefined;
|
|
const bestActiveInput = (require(4015) /* metro dependency 4015: ChatInputUtils */).getBestActiveInput();
|
|
const handleTapCommandMentionBinding = handleTapCommandMention;
|
|
const object2 = {};
|
|
object2.appLauncherNavigator = result ? env0_2 : value2;
|
|
const nodeBinding = node;
|
|
object2.channelId = nodeBinding.channelId;
|
|
object2.commandId = nodeBinding.commandId;
|
|
object2.commandName = nodeBinding.commandName;
|
|
object2.currentText = (bestActiveInput == null ? value2 : bestActiveInput.getText()) ?? '';
|
|
object2.onOpenCustomKeyboard = onOpenCustomKeyboard;
|
|
object2.onSetCommand = onSetCommand;
|
|
handleTapCommandMentionBinding(object2);
|
|
return value2;
|
|
}
|
|
|
|
function onPressOnSetCommand_68610() { // fn#68610, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8954:2539, owner: MarkupReactCommandRule.onPress.onSetCommand, offset: 0x01c5618c, size: 181 bytes, params: 1, frame: 18
|
|
var r2;
|
|
var r5;
|
|
var applicationCommandManager;
|
|
var setPartialCommand;
|
|
var value7;
|
|
var nodeBinding;
|
|
const value2 = undefined;
|
|
(importDefault(8776) /* metro dependency 8776: navigateToLastChannel */)();
|
|
(importDefault(4080) /* metro dependency 4080: ActionSheetActionCreators */).hideActionSheet();
|
|
if (env0_0 != null) {
|
|
env0_0.openSystemKeyboard();
|
|
}
|
|
const value4 = env0_0 == null;
|
|
if (value4) {
|
|
r2 = value4;
|
|
r5 = value2;
|
|
} else {
|
|
applicationCommandManager = env0_0.getApplicationCommandManager();
|
|
r2 = applicationCommandManager == null;
|
|
r5 = applicationCommandManager;
|
|
}
|
|
if (!r2) {
|
|
setPartialCommand = r5.setPartialCommand;
|
|
value7 = environment.__proto__;
|
|
nodeBinding = node;
|
|
Reflect.apply(setPartialCommand, r5, [nodeBinding.commandId, nodeBinding.commandName,
|
|
(require(5068) /* metro dependency 5068: ApplicationCommandTypes */).ApplicationCommandTriggerLocations.MENTION]);
|
|
}
|
|
return value2;
|
|
}
|
|
|