79 lines
2.2 KiB
TypeScript
79 lines
2.2 KiB
TypeScript
// Metro module 9546 (f9547).
|
|
import { triggerHapticFeedback, HapticFeedbackTypes } from "../../haptics/HapticUtils.native";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { presentLinkCopied } from "../../toast/native/ToastUtils";
|
|
import { copy } from "../../../utils/ClipboardUtils.native";
|
|
import Linking from "../../../lib/native/Linking";
|
|
import { showShareActionSheet } from "../../action_sheet/native/showShareActionSheet";
|
|
import handleContentLinking from "./handleContentLinking";
|
|
import { showSimpleActionSheet } from "../../action_sheet/native/showSimpleActionSheet";
|
|
export default function showLongPressURLActionSheet({ urlString, guildId, channelId, messageId, disableHapticFeedback = false }) {
|
|
if (!disableHapticFeedback) {
|
|
triggerHapticFeedback(HapticFeedbackTypes.IMPACT_LIGHT);
|
|
}
|
|
const r29 = [];
|
|
const r32 = urlString.match(/^(tel|sms|mailto):([^?;]+)/);
|
|
let c17283_4 = r32;
|
|
if (r32 != null) {
|
|
r29.push({
|
|
label: intl.string(r32[1] === "mailto" ? t.ZYLVKo : t["3zozoR"]),
|
|
onPress: () => {
|
|
presentLinkCopied();
|
|
copy(c17283_4[2]);
|
|
}
|
|
});
|
|
if (r32[1] === "tel") {
|
|
r29.push({
|
|
label: intl.string(t["+wbjMW"]),
|
|
onPress: () => {
|
|
Linking.openURL(urlString.replace("tel:", "sms:"));
|
|
}
|
|
});
|
|
}
|
|
}
|
|
const options = [{
|
|
label: intl.string(t.wuRE8M),
|
|
onPress: () => {
|
|
Linking.openURL(urlString);
|
|
}
|
|
}, {
|
|
label: intl.string(t.WqhZss),
|
|
onPress: () => {
|
|
presentLinkCopied();
|
|
copy(urlString);
|
|
}
|
|
}, ...r29, {
|
|
label: intl.string(t.Ej3B3Y),
|
|
onPress: () => {
|
|
showShareActionSheet({
|
|
url: urlString
|
|
}, "Share Link");
|
|
}
|
|
}];
|
|
if (channelId != null) {
|
|
options.unshift({
|
|
label: intl.string(t.aW2YlJ),
|
|
onPress: () => {
|
|
handleContentLinking({
|
|
guildId,
|
|
channelId,
|
|
messageId,
|
|
navigationSettings: {
|
|
navigationReplace: true,
|
|
safe: true
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
showSimpleActionSheet({
|
|
key: "LongPressUrl",
|
|
header: {
|
|
title: intl.string(t["5oIOLX"]),
|
|
subtitle: urlString
|
|
},
|
|
options,
|
|
hasIcons: false
|
|
});
|
|
};
|