From 6b35cefbdc4e462a6fcb1c708b37b5b2aa67a18c Mon Sep 17 00:00:00 2001 From: Junhui Chen Date: Wed, 6 Aug 2025 14:20:39 +0800 Subject: [PATCH] feat: eas update --- app.json | 6 ++- app/(tabs)/ask.tsx | 119 +++++++++++++++++++++++-------------------- app/(tabs)/index.tsx | 2 +- eas.json | 9 ++-- package-lock.json | 60 ++++++++++++++++++++++ package.json | 4 +- 6 files changed, 138 insertions(+), 62 deletions(-) diff --git a/app.json b/app.json index 3d3bfb3..bf0246d 100644 --- a/app.json +++ b/app.json @@ -46,7 +46,7 @@ "plugins": [ "expo-router", "expo-secure-store", - [ + [ "expo-background-task", { "minimumInterval": 15 @@ -90,6 +90,10 @@ "eas": { "projectId": "04721dd4-6b15-495a-b9ec-98187c613172" } + }, + "runtimeVersion": "1.0.0.2", + "updates": { + "url": "https://u.expo.dev/04721dd4-6b15-495a-b9ec-98187c613172" } } } diff --git a/app/(tabs)/ask.tsx b/app/(tabs)/ask.tsx index 68d42d9..98b75af 100644 --- a/app/(tabs)/ask.tsx +++ b/app/(tabs)/ask.tsx @@ -6,11 +6,10 @@ import { ThemedText } from "@/components/ThemedText"; import { fetchApi } from "@/lib/server-api-util"; import { getWebSocketErrorMessage, webSocketManager, WsMessage } from "@/lib/websocket-util"; import { Assistant, Message } from "@/types/ask"; -import { router, useFocusEffect, useLocalSearchParams } from "expo-router"; +import { useFocusEffect, useLocalSearchParams, useRouter } from "expo-router"; import { useCallback, useEffect, useRef, useState } from 'react'; import { useTranslation } from "react-i18next"; import { - Animated, FlatList, Keyboard, KeyboardAvoidingView, @@ -21,10 +20,11 @@ import { View } from 'react-native'; import { Gesture, GestureDetector } from "react-native-gesture-handler"; -import { runOnJS } from 'react-native-reanimated'; +import Animated, { runOnJS, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated'; import { useSafeAreaInsets } from "react-native-safe-area-context"; export default function AskScreen() { + const router = useRouter(); const insets = useSafeAreaInsets(); const chatListRef = useRef(null); @@ -32,8 +32,8 @@ export default function AskScreen() { const [conversationId, setConversationId] = useState(null); const [userMessages, setUserMessages] = useState([]); const [selectedImages, setSelectedImages] = useState([]); - const fadeAnim = useRef(new Animated.Value(1)).current; - const fadeAnimChat = useRef(new Animated.Value(0)).current; + const fadeAnim = useSharedValue(1); + const fadeAnimChat = useSharedValue(0); const { t } = useTranslation(); const { sessionId, newSession } = useLocalSearchParams<{ @@ -184,6 +184,27 @@ export default function AskScreen() { }, []) ); + // 创建动画样式 + const welcomeStyle = useAnimatedStyle(() => { + return { + opacity: fadeAnim.value, + pointerEvents: isHello ? 'auto' : 'none', + }; + }); + + const chatStyle = useAnimatedStyle(() => { + return { + opacity: fadeAnimChat.value, + pointerEvents: isHello ? 'none' : 'auto', + }; + }); + + // 触发动画 + useEffect(() => { + fadeAnim.value = withTiming(isHello ? 1 : 0, { duration: 300 }); + fadeAnimChat.value = withTiming(isHello ? 0 : 1, { duration: 300 }); + }, [isHello]); + useEffect(() => { if (sessionId) { setConversationId(sessionId); @@ -198,41 +219,41 @@ export default function AskScreen() { } }, [sessionId, newSession]); - useEffect(() => { - if (isHello) { - Animated.parallel([ - Animated.timing(fadeAnim, { - toValue: 1, - duration: 300, - useNativeDriver: true, - }), - Animated.timing(fadeAnimChat, { - toValue: 0, - duration: 300, - useNativeDriver: true, - }) - ]).start(); - } else { - Animated.parallel([ - Animated.timing(fadeAnim, { - toValue: 0, - duration: 300, - useNativeDriver: true, - }), - Animated.timing(fadeAnimChat, { - toValue: 1, - duration: 300, - useNativeDriver: true, - }) - ]).start(() => { - setTimeout(() => { - if (!isHello) { - scrollToEnd(false); - } - }, 50); - }); - } - }, [isHello, fadeAnim, fadeAnimChat]); + // useEffect(() => { + // if (isHello) { + // Animated.parallel([ + // Animated.timing(fadeAnim, { + // toValue: 1, + // duration: 300, + // useNativeDriver: true, + // }), + // Animated.timing(fadeAnimChat, { + // toValue: 0, + // duration: 300, + // useNativeDriver: true, + // }) + // ]).start(); + // } else { + // Animated.parallel([ + // Animated.timing(fadeAnim, { + // toValue: 0, + // duration: 300, + // useNativeDriver: true, + // }), + // Animated.timing(fadeAnimChat, { + // toValue: 1, + // duration: 300, + // useNativeDriver: true, + // }) + // ]).start(() => { + // setTimeout(() => { + // if (!isHello) { + // scrollToEnd(false); + // } + // }, 50); + // }); + // } + // }, [isHello, fadeAnim, fadeAnimChat]); useEffect(() => { if (!isHello) { @@ -280,28 +301,14 @@ export default function AskScreen() { {/* 欢迎页面 */} {/* 聊天页面 */} { setIsLoading(true); checkAuthStatus(router, () => { - router.replace('/ask') + router.replace('/memo-list') // TODO FIXME }, false).then(() => { setIsLoading(false); }).catch(() => { diff --git a/eas.json b/eas.json index 37bb4bc..c5d75c9 100644 --- a/eas.json +++ b/eas.json @@ -6,13 +6,16 @@ "build": { "development": { "developmentClient": true, - "distribution": "internal" + "distribution": "internal", + "channel": "development" }, "preview": { - "distribution": "internal" + "distribution": "internal", + "channel": "preview" }, "production": { - "autoIncrement": true + "autoIncrement": true, + "channel": "release" } }, "submit": { diff --git a/package-lock.json b/package-lock.json index 50da0cb..0e7689c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,6 +34,7 @@ "expo-iap": "^2.7.5", "expo-image-manipulator": "~13.1.7", "expo-image-picker": "~16.1.4", + "expo-insights": "~0.9.3", "expo-linear-gradient": "~14.1.5", "expo-linking": "~7.1.7", "expo-localization": "^16.1.5", @@ -48,6 +49,7 @@ "expo-symbols": "~0.4.5", "expo-system-ui": "~5.0.9", "expo-task-manager": "^13.1.6", + "expo-updates": "~0.28.17", "expo-video": "~2.2.2", "expo-video-thumbnails": "~9.1.3", "expo-web-browser": "~14.2.0", @@ -9062,6 +9064,12 @@ "node": "*" } }, + "node_modules/expo-eas-client": { + "version": "0.14.4", + "resolved": "https://registry.npmmirror.com/expo-eas-client/-/expo-eas-client-0.14.4.tgz", + "integrity": "sha512-TSL1BbBFIuXchJmPgbPnB7cGpOOuSGJcQ/L7gij/+zPjExwvKm5ckA5dlSulwoFhH8zQt4vb7bfISPSAWQVWBw==", + "license": "MIT" + }, "node_modules/expo-file-system": { "version": "18.1.11", "resolved": "https://registry.npmjs.org/expo-file-system/-/expo-file-system-18.1.11.tgz", @@ -9138,6 +9146,18 @@ "expo": "*" } }, + "node_modules/expo-insights": { + "version": "0.9.3", + "resolved": "https://registry.npmmirror.com/expo-insights/-/expo-insights-0.9.3.tgz", + "integrity": "sha512-ictylDUdERHPXUM4suEYLJGGvlSOB7btDSA0FtlZeVWWOcyTWQlSF5t1Wj3lCCljzjMm/pIj8k9hp8CXCl0gsg==", + "license": "MIT", + "dependencies": { + "expo-eas-client": "~0.14.3" + }, + "peerDependencies": { + "expo": "*" + } + }, "node_modules/expo-json-utils": { "version": "0.15.0", "resolved": "https://registry.npmjs.org/expo-json-utils/-/expo-json-utils-0.15.0.tgz", @@ -9374,6 +9394,12 @@ "react-native": "*" } }, + "node_modules/expo-structured-headers": { + "version": "4.1.0", + "resolved": "https://registry.npmmirror.com/expo-structured-headers/-/expo-structured-headers-4.1.0.tgz", + "integrity": "sha512-2X+aUNzC/qaw7/WyUhrVHNDB0uQ5rE12XA2H/rJXaAiYQSuOeU90ladaN0IJYV9I2XlhYrjXLktLXWbO7zgbag==", + "license": "MIT" + }, "node_modules/expo-symbols": { "version": "0.4.5", "resolved": "https://registry.npmjs.org/expo-symbols/-/expo-symbols-0.4.5.tgz", @@ -9420,6 +9446,34 @@ "react-native": "*" } }, + "node_modules/expo-updates": { + "version": "0.28.17", + "resolved": "https://registry.npmmirror.com/expo-updates/-/expo-updates-0.28.17.tgz", + "integrity": "sha512-OiKDrKk6EoBRP9AoK7/4tyj9lVtHw2IfaETIFeUCHMgx5xjgKGX/jjSwqhk8N9BJgLDIy0oD0Sb0MaEbSBb3lg==", + "license": "MIT", + "dependencies": { + "@expo/code-signing-certificates": "0.0.5", + "@expo/config": "~11.0.13", + "@expo/config-plugins": "~10.1.2", + "@expo/spawn-async": "^1.7.2", + "arg": "4.1.0", + "chalk": "^4.1.2", + "expo-eas-client": "~0.14.4", + "expo-manifests": "~0.16.6", + "expo-structured-headers": "~4.1.0", + "expo-updates-interface": "~1.1.0", + "glob": "^10.4.2", + "ignore": "^5.3.1", + "resolve-from": "^5.0.0" + }, + "bin": { + "expo-updates": "bin/cli.js" + }, + "peerDependencies": { + "expo": "*", + "react": "*" + } + }, "node_modules/expo-updates-interface": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/expo-updates-interface/-/expo-updates-interface-1.1.0.tgz", @@ -9429,6 +9483,12 @@ "expo": "*" } }, + "node_modules/expo-updates/node_modules/arg": { + "version": "4.1.0", + "resolved": "https://registry.npmmirror.com/arg/-/arg-4.1.0.tgz", + "integrity": "sha512-ZWc51jO3qegGkVh8Hwpv636EkbesNV5ZNQPCtRa+0qytRYPEs9IYT9qITY9buezqUH5uqyzlWLcufrzU2rffdg==", + "license": "MIT" + }, "node_modules/expo-video": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/expo-video/-/expo-video-2.2.2.tgz", diff --git a/package.json b/package.json index e9dd680..5930159 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,9 @@ "react-native-web": "~0.20.0", "react-native-webview": "13.13.5", "react-redux": "^9.2.0", - "worklet": "^1.0.3" + "worklet": "^1.0.3", + "expo-insights": "~0.9.3", + "expo-updates": "~0.28.17" }, "devDependencies": { "@babel/core": "^7.25.2",