Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion app/containers/markdown/components/inline/Link.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useContext } from 'react';
import { Text } from 'react-native';
import { Alert, Text } from 'react-native';
import { Link as LinkProps } from '@rocket.chat/message-parser';
import Clipboard from '@react-native-clipboard/clipboard';

Expand All @@ -12,6 +12,7 @@ import EventEmitter from '../../../../lib/methods/helpers/events';
import { themes } from '../../../../lib/constants';
import MarkdownContext from '../../contexts/MarkdownContext';
import styles from '../../styles';
import { useAppSelector } from '../../../../lib/hooks';

interface ILinkProps {
value: LinkProps['value'];
Expand All @@ -20,14 +21,35 @@ interface ILinkProps {
const Link = ({ value }: ILinkProps) => {
const { theme } = useTheme();
const { onLinkPress } = useContext(MarkdownContext);
const { server } = useAppSelector(state => state.server);
const { src, label } = value;
const handlePress = () => {
if (!src.value) {
return;
}

if (src.value.startsWith(server)) {
handleLinkPress();
return;
}

Alert.alert(I18n.t('leaving_app', { app_name: 'Rocket.Chat' }), I18n.t('leaving_app_to_visit', { link: src.value }), [
{
text: I18n.t('Cancel'),
style: 'cancel'
},
{
text: I18n.t('Visit'),
onPress: () => handleLinkPress()
}
]);
};

const handleLinkPress = () => {
if (onLinkPress) {
return onLinkPress(src.value);
}

openLink(src.value, theme);
};

Expand Down
3 changes: 3 additions & 0 deletions app/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,8 @@
"leave": "leave",
"Leave_Team": "Leave team",
"Leave_the_current_channel": "Leave the current channel",
"leaving_app": "Leaving {{app_name}}",
"leaving_app_to_visit": "You are about to open an external link: {{link}}",
"leaving_room": "leaving room",
"Left_The_Room_Successfully": "Left the room successfully",
"Left_The_Team_Successfully": "Left the team successfully",
Expand Down Expand Up @@ -931,6 +933,7 @@
"video-conf-provider-not-configured-header": "Conference call not enabled",
"View_Original": "View original",
"View_Thread": "View thread",
"Visit": "Visit",
"Wait_activation_warning": "Before you can login, your account must be manually activated by an administrator.",
"Waiting_for_answer": "Waiting for answer",
"Waiting_for_network": "Waiting for network...",
Expand Down
3 changes: 3 additions & 0 deletions app/i18n/locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@
"leave": "sair",
"Leave_Team": "Sair do time",
"Leave_the_current_channel": "Sai do canal atual",
"leaving_app": "Saindo do {{app_name}}",
"leaving_app_to_visit": "Você está prestes a abrir um link externo: {{link}}",
"leaving_room": "saindo do canal",
"Left_The_Room_Successfully": "Saiu da sala com sucesso",
"Left_The_Team_Successfully": "Saiu do time com sucesso",
Expand Down Expand Up @@ -913,6 +915,7 @@
"video-conf-provider-not-configured-header": "Video conferência não ativada",
"View_Original": "Visualizar original",
"View_Thread": "Exibir thread",
"Visit": "Visitar",
"Wait_activation_warning": "Antes que você possa fazer o login, sua conta deve ser manualmente ativada por um administrador.",
"Waiting_for_answer": "Esperando por resposta",
"Waiting_for_network": "Aguardando rede...",
Expand Down
26 changes: 24 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1796,9 +1796,31 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- react-native-webview (11.26.1):
- react-native-webview (13.15.0):
- DoubleConversion
- glog
- hermes-engine
- MMKV (~> 1.3.9)
- RCT-Folly (= 2024.11.18.00)
- RCTRequired
- RCTTypeSafety
- React-Core
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-hermes
- React-ImageManager
- React-jsi
- React-NativeModulesApple
- React-RCTFabric
- React-renderercss
- React-rendererdebug
- React-utils
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- React-NativeModulesApple (0.79.4):
- glog
- hermes-engine
Expand Down Expand Up @@ -3102,7 +3124,7 @@ SPEC CHECKSUMS:
react-native-safe-area-context: 5928d84c879db2f9eb6969ca70e68f58623dbf25
react-native-simple-crypto: 932ea9243f76ff3d468ecf85868daf4fb35422e4
react-native-slider: 605e731593322c4bb2eb48d7d64e2e4dbf7cbd77
react-native-webview: e12647c3892d4ee161aee5b86458fa49ba1e1133
react-native-webview: e28f476ea60826ef0b1d7297244db1dfbec74acd
React-NativeModulesApple: 5b234860053d0dd11f3442f38b99688ff1c9733b
React-oscompat: 472a446c740e39ee39cd57cd7bfd32177c763a2b
React-perflogger: bbca3688c62f4f39e972d6e21969c95fe441fb6c
Expand Down
Loading