fix/ 补充打个招呼网络错误状态
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { router } from 'expo-router';
|
||||
import React from 'react';
|
||||
import { Pressable, ScrollView, View } from 'react-native';
|
||||
import { Alert, Pressable, ScrollView, View } from 'react-native';
|
||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { CheckCheck, MessageCirclePlus, User } from 'lucide-react-native';
|
||||
@@ -8,6 +8,7 @@ import { CheckCheck, MessageCirclePlus, User } from 'lucide-react-native';
|
||||
import { Icon } from '@/components/ui/icon';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { Text } from '@/components/ui/text';
|
||||
import { NetworkError } from '@/core/api/types';
|
||||
import {
|
||||
useConversations,
|
||||
useCreateConversation,
|
||||
@@ -163,6 +164,15 @@ export default function ConversationsScreen() {
|
||||
onSuccess: (result) => {
|
||||
router.push(`/(main)/conversation/${result.id}`);
|
||||
},
|
||||
onError: (err) => {
|
||||
const msg =
|
||||
err instanceof NetworkError
|
||||
? t('createError')
|
||||
: err instanceof Error
|
||||
? err.message
|
||||
: t('createError');
|
||||
Alert.alert(t('chatTitle'), msg, [{ text: t('confirm') }]);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
{
|
||||
"createError": "Unable to create conversation. Please check your network and try again.",
|
||||
"confirm": "OK",
|
||||
"addMore": "More",
|
||||
"agentName": "Life Echo",
|
||||
"cancelRecording": "Cancel recording",
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
{
|
||||
"createError": "无法创建对话,请检查网络连接或稍后重试",
|
||||
"confirm": "知道了",
|
||||
"addMore": "更多功能",
|
||||
"agentName": "岁月知己",
|
||||
"cancelRecording": "取消录音发送",
|
||||
|
||||
Reference in New Issue
Block a user