Merge remote-tracking branch 'origin/master' into feature/adap-pc

This commit is contained in:
2026-03-16 19:27:05 +08:00
10 changed files with 679 additions and 79 deletions

View File

@@ -483,11 +483,20 @@ const renderLinkSegment = (
): React.ReactNode => {
const { onLinkPress, isMe } = props;
const handlePress = () => {
const handlePress = async () => {
if (onLinkPress) {
onLinkPress(data.url);
} else {
Linking.openURL(data.url).catch(() => {});
try {
const supported = await Linking.canOpenURL(data.url);
if (supported) {
await Linking.openURL(data.url);
} else {
console.warn('无法打开链接:', data.url);
}
} catch (error) {
console.warn('打开链接失败:', error);
}
}
};
@@ -511,7 +520,13 @@ const renderLinkSegment = (
</Text>
)}
<Text style={styles.linkUrl} numberOfLines={1}>
{new URL(data.url).hostname}
{(() => {
try {
return new URL(data.url).hostname;
} catch {
return data.url;
}
})()}
</Text>
</View>
</TouchableOpacity>