소스 검색

更新依赖

victor.zhou 4 달 전
부모
커밋
a03206c5b3
6개의 변경된 파일281개의 추가작업 그리고 12개의 파일을 삭제
  1. 4 0
      ios/recipemuse.xcodeproj/project.pbxproj
  2. 1 1
      ios/recipemuse/Info.plist
  3. 2 0
      package.json
  4. 89 8
      pnpm-lock.yaml
  5. 184 2
      src/App.tsx
  6. 1 1
      src/screens/Startup/Startup.tsx

+ 4 - 0
ios/recipemuse.xcodeproj/project.pbxproj

@@ -10,6 +10,7 @@
 		13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
 		6A8B8815E2DB418E7A9ADB40 /* libPods-recipemuse.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 41F925D6E74036F703711B79 /* libPods-recipemuse.a */; };
 		81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
+		F0D1D2962EC42A620078A38E /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F0D1D2952EC42A620078A38E /* StoreKit.framework */; };
 		F571B3882BD7A3F80014213C /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = F571B3872BD7A3F80014213C /* PrivacyInfo.xcprivacy */; };
 		F5DC7AB12D9D8A92004DB744 /* AppDelegade.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5DC7AB02D9D8A92004DB744 /* AppDelegade.swift */; };
 /* End PBXBuildFile section */
@@ -35,6 +36,7 @@
 		81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = recipemuse/LaunchScreen.storyboard; sourceTree = "<group>"; };
 		ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
 		F0590DE12EB8AFB200070097 /* recipemuse.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = recipemuse.entitlements; path = recipemuse/recipemuse.entitlements; sourceTree = "<group>"; };
+		F0D1D2952EC42A620078A38E /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
 		F571B3872BD7A3F80014213C /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
 		F5DC7AB02D9D8A92004DB744 /* AppDelegade.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegade.swift; sourceTree = "<group>"; };
 		F5DC7AB22D9D8AA1004DB744 /* recipemuse-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "recipemuse-Bridging-Header.h"; sourceTree = "<group>"; };
@@ -53,6 +55,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				6A8B8815E2DB418E7A9ADB40 /* libPods-recipemuse.a in Frameworks */,
+				F0D1D2962EC42A620078A38E /* StoreKit.framework in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -76,6 +79,7 @@
 		2D16E6871FA4F8E400B85C8A /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				F0D1D2952EC42A620078A38E /* StoreKit.framework */,
 				ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
 				41F925D6E74036F703711B79 /* libPods-recipemuse.a */,
 			);

+ 1 - 1
ios/recipemuse/Info.plist

@@ -39,7 +39,7 @@
 	<string>LaunchScreen.storyboard</string>
 	<key>UIRequiredDeviceCapabilities</key>
 	<array>
-		<string>armv64</string>
+		<string>arm64</string>
 	</array>
 	<key>UISupportedInterfaceOrientations</key>
 	<array>

+ 2 - 0
package.json

@@ -31,7 +31,9 @@
     "react-native": "0.80.2",
     "react-native-device-info": "^14.1.1",
     "react-native-gesture-handler": "^2.27.2",
+    "react-native-iap": "^14.4.39",
     "react-native-mmkv": "^3.3.0",
+    "react-native-nitro-modules": "^0.31.5",
     "react-native-reanimated": "^4.1.3",
     "react-native-safe-area-context": "^5.5.2",
     "react-native-screens": "4.13.1",

+ 89 - 8
pnpm-lock.yaml

@@ -5,6 +5,12 @@ settings:
   excludeLinksFromLockfile: false
 
 dependencies:
+  '@invertase/react-native-apple-authentication':
+    specifier: ^2.4.1
+    version: 2.5.0
+  '@react-native-google-signin/google-signin':
+    specifier: ^16.0.0
+    version: 16.0.0(react-native@0.80.2)(react@19.1.0)
   '@react-native-masked-view/masked-view':
     specifier: ^0.3.2
     version: 0.3.2(react-native@0.80.2)(react@19.1.0)
@@ -38,15 +44,24 @@ dependencies:
   react-native:
     specifier: 0.80.2
     version: 0.80.2(@babel/core@7.28.5)(@react-native-community/cli@19.1.1)(@types/react@19.2.2)(react@19.1.0)
+  react-native-device-info:
+    specifier: ^14.1.1
+    version: 14.1.1(react-native@0.80.2)
   react-native-gesture-handler:
     specifier: ^2.27.2
     version: 2.29.0(react-native@0.80.2)(react@19.1.0)
+  react-native-iap:
+    specifier: ^14.4.39
+    version: 14.4.39(react-native-nitro-modules@0.31.5)(react-native@0.80.2)(react@19.1.0)
   react-native-mmkv:
     specifier: ^3.3.0
     version: 3.3.3(react-native@0.80.2)(react@19.1.0)
+  react-native-nitro-modules:
+    specifier: ^0.31.5
+    version: 0.31.5(react-native@0.80.2)(react@19.1.0)
   react-native-reanimated:
-    specifier: ^4.0.1
-    version: 4.1.3(@babel/core@7.28.5)(react-native-worklets@0.4.2)(react-native@0.80.2)(react@19.1.0)
+    specifier: ^4.1.3
+    version: 4.1.3(@babel/core@7.28.5)(react-native-worklets@0.5.2)(react-native@0.80.2)(react@19.1.0)
   react-native-safe-area-context:
     specifier: ^5.5.2
     version: 5.6.2(react-native@0.80.2)(react@19.1.0)
@@ -56,9 +71,12 @@ dependencies:
   react-native-svg:
     specifier: ^15.12.1
     version: 15.14.0(react-native@0.80.2)(react@19.1.0)
+  react-native-webview:
+    specifier: ^13.16.0
+    version: 13.16.0(react-native@0.80.2)(react@19.1.0)
   react-native-worklets:
-    specifier: ^0.4.1
-    version: 0.4.2(@babel/core@7.28.5)(react-native@0.80.2)(react@19.1.0)
+    specifier: ^0.5.2
+    version: 0.5.2(@babel/core@7.28.5)(react-native@0.80.2)(react@19.1.0)
   zod:
     specifier: ^4.0.14
     version: 4.1.12
@@ -1665,6 +1683,11 @@ packages:
     engines: {node: '>=18.18'}
     dev: true
 
+  /@invertase/react-native-apple-authentication@2.5.0:
+    resolution: {integrity: sha512-PL5tUd1WCw365L2fWlkB4HXy7QjZHCU9o6qi8osMvftBIlynSpi76YStJCeJcwU6aYXB09+iV/V5g+8lwafNwQ==}
+    engines: {node: '>=14'}
+    dev: false
+
   /@isaacs/ttlcache@1.4.1:
     resolution: {integrity: sha512-RQgQ4uQ+pLbqXfOmieB91ejmLwvSgv9nLx6sT6sD83s7umBypgg+OIBOBbEUiJXrfpnp9j0mRhYYdzp9uqq3lA==}
     engines: {node: '>=12'}
@@ -2133,6 +2156,20 @@ packages:
       - typescript
       - utf-8-validate
 
+  /@react-native-google-signin/google-signin@16.0.0(react-native@0.80.2)(react@19.1.0):
+    resolution: {integrity: sha512-jVuzPo8odREekFc0b4RK3YsqCvedtLIM2P6NSszFr9cYyhKrUNikffPapL6LmkL9qkb8K6pDeb5CXg4qALOc0g==}
+    peerDependencies:
+      expo: '>=52.0.40'
+      react: '*'
+      react-native: '*'
+    peerDependenciesMeta:
+      expo:
+        optional: true
+    dependencies:
+      react: 19.1.0
+      react-native: 0.80.2(@babel/core@7.28.5)(@react-native-community/cli@19.1.1)(@types/react@19.2.2)(react@19.1.0)
+    dev: false
+
   /@react-native-masked-view/masked-view@0.3.2(react-native@0.80.2)(react@19.1.0):
     resolution: {integrity: sha512-XwuQoW7/GEgWRMovOQtX3A4PrXhyaZm0lVUiY8qJDvdngjLms9Cpdck6SmGAUNqQwcj2EadHC1HwL0bEyoa/SQ==}
     peerDependencies:
@@ -7245,6 +7282,14 @@ packages:
   /react-is@19.2.0:
     resolution: {integrity: sha512-x3Ax3kNSMIIkyVYhWPyO09bu0uttcAIoecO/um/rKGQ4EltYWVYtyiGkS/3xMynrbVQdS69Jhlv8FXUEZehlzA==}
 
+  /react-native-device-info@14.1.1(react-native@0.80.2):
+    resolution: {integrity: sha512-lXFpe6DJmzbQXNLWxlMHP2xuTU5gwrKAvI8dCAZuERhW9eOXSubOQIesk9lIBnsi9pI19GMrcpJEvs4ARPRYmw==}
+    peerDependencies:
+      react-native: '*'
+    dependencies:
+      react-native: 0.80.2(@babel/core@7.28.5)(@react-native-community/cli@19.1.1)(@types/react@19.2.2)(react@19.1.0)
+    dev: false
+
   /react-native-gesture-handler@2.29.0(react-native@0.80.2)(react@19.1.0):
     resolution: {integrity: sha512-nxikN5b2ebSTPqqhIlTHQJqIHTu0Y5GAhST3w3/G1pm9BlqHVFcLFPZfIaT4A3TVKjQDcKElij1hhHKpAVUcOQ==}
     peerDependencies:
@@ -7258,6 +7303,18 @@ packages:
       react-native: 0.80.2(@babel/core@7.28.5)(@react-native-community/cli@19.1.1)(@types/react@19.2.2)(react@19.1.0)
     dev: false
 
+  /react-native-iap@14.4.39(react-native-nitro-modules@0.31.5)(react-native@0.80.2)(react@19.1.0):
+    resolution: {integrity: sha512-A1C4ev3G1N+lqNIPxIPZfWORGTxs+FKgEImQgc5ybvdXaeIrW/YcYoKltROtdOKZ9viFvqh6MDibP+e5gzIlFA==}
+    peerDependencies:
+      react: '*'
+      react-native: '*'
+      react-native-nitro-modules: ^0.31.1
+    dependencies:
+      react: 19.1.0
+      react-native: 0.80.2(@babel/core@7.28.5)(@react-native-community/cli@19.1.1)(@types/react@19.2.2)(react@19.1.0)
+      react-native-nitro-modules: 0.31.5(react-native@0.80.2)(react@19.1.0)
+    dev: false
+
   /react-native-is-edge-to-edge@1.2.1(react-native@0.80.2)(react@19.1.0):
     resolution: {integrity: sha512-FLbPWl/MyYQWz+KwqOZsSyj2JmLKglHatd3xLZWskXOpRaio4LfEDEz8E/A6uD8QoTHW6Aobw1jbEwK7KMgR7Q==}
     peerDependencies:
@@ -7277,7 +7334,18 @@ packages:
       react: 19.1.0
       react-native: 0.80.2(@babel/core@7.28.5)(@react-native-community/cli@19.1.1)(@types/react@19.2.2)(react@19.1.0)
 
-  /react-native-reanimated@4.1.3(@babel/core@7.28.5)(react-native-worklets@0.4.2)(react-native@0.80.2)(react@19.1.0):
+  /react-native-nitro-modules@0.31.5(react-native@0.80.2)(react@19.1.0):
+    resolution: {integrity: sha512-h/IbVsK5IH7JkvseihAoz/o5dy6CafvGo7j4jTvAa+gnxZWFtXQZg8EDvu0en88LFAumKd/pcF20dzxMiNOmug==}
+    requiresBuild: true
+    peerDependencies:
+      react: '*'
+      react-native: '*'
+    dependencies:
+      react: 19.1.0
+      react-native: 0.80.2(@babel/core@7.28.5)(@react-native-community/cli@19.1.1)(@types/react@19.2.2)(react@19.1.0)
+    dev: false
+
+  /react-native-reanimated@4.1.3(@babel/core@7.28.5)(react-native-worklets@0.5.2)(react-native@0.80.2)(react@19.1.0):
     resolution: {integrity: sha512-GP8wsi1u3nqvC1fMab/m8gfFwFyldawElCcUSBJQgfrXeLmsPPUOpDw44lbLeCpcwUuLa05WTVePdTEwCLTUZg==}
     peerDependencies:
       '@babel/core': ^7.0.0-0
@@ -7289,7 +7357,7 @@ packages:
       react: 19.1.0
       react-native: 0.80.2(@babel/core@7.28.5)(@react-native-community/cli@19.1.1)(@types/react@19.2.2)(react@19.1.0)
       react-native-is-edge-to-edge: 1.2.1(react-native@0.80.2)(react@19.1.0)
-      react-native-worklets: 0.4.2(@babel/core@7.28.5)(react-native@0.80.2)(react@19.1.0)
+      react-native-worklets: 0.5.2(@babel/core@7.28.5)(react-native@0.80.2)(react@19.1.0)
       semver: 7.7.2
     dev: false
 
@@ -7345,8 +7413,20 @@ packages:
       react-native: 0.80.2(@babel/core@7.28.5)(@react-native-community/cli@19.1.1)(@types/react@19.2.2)(react@19.1.0)
       warn-once: 0.1.1
 
-  /react-native-worklets@0.4.2(@babel/core@7.28.5)(react-native@0.80.2)(react@19.1.0):
-    resolution: {integrity: sha512-02IMmU2rOL6vrF7uA6cLAeN4haXOMTBh7opmVYQbjYG8mNAb0cnhmkvkdQupmpFjBpWZRJnBGYJJa471a/9IPg==}
+  /react-native-webview@13.16.0(react-native@0.80.2)(react@19.1.0):
+    resolution: {integrity: sha512-Nh13xKZWW35C0dbOskD7OX01nQQavOzHbCw9XoZmar4eXCo7AvrYJ0jlUfRVVIJzqINxHlpECYLdmAdFsl9xDA==}
+    peerDependencies:
+      react: '*'
+      react-native: '*'
+    dependencies:
+      escape-string-regexp: 4.0.0
+      invariant: 2.2.4
+      react: 19.1.0
+      react-native: 0.80.2(@babel/core@7.28.5)(@react-native-community/cli@19.1.1)(@types/react@19.2.2)(react@19.1.0)
+    dev: false
+
+  /react-native-worklets@0.5.2(@babel/core@7.28.5)(react-native@0.80.2)(react@19.1.0):
+    resolution: {integrity: sha512-lCzmuIPAK/UaOJYEPgYpVqrsxby1I54f7PyyZUMEO04nwc00CDrCvv9lCTY1daLHYTF8lS3f9zlzErfVsIKqkA==}
     peerDependencies:
       '@babel/core': ^7.0.0-0
       react: '*'
@@ -7365,6 +7445,7 @@ packages:
       convert-source-map: 2.0.0
       react: 19.1.0
       react-native: 0.80.2(@babel/core@7.28.5)(@react-native-community/cli@19.1.1)(@types/react@19.2.2)(react@19.1.0)
+      semver: 7.7.2
     transitivePeerDependencies:
       - supports-color
     dev: false

+ 184 - 2
src/App.tsx

@@ -1,16 +1,32 @@
 import 'react-native-gesture-handler';
 
 import React, { createContext, useContext, useRef, useState } from 'react';
-import { Platform, StyleSheet, View } from 'react-native';
+import { Platform, StyleSheet, View, Alert } from 'react-native';
 import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
 import { GestureHandlerRootView } from 'react-native-gesture-handler';
 import { MMKV } from 'react-native-mmkv';
 import { WebView } from 'react-native-webview';
 
+import { GoogleSignin } from '@react-native-google-signin/google-signin';
+import { appleAuth } from '@invertase/react-native-apple-authentication';
+import DeviceInfo from 'react-native-device-info';
+import { AUTH_CONFIG } from '@/config/auth';
+
+
 import ApplicationNavigator from '@/navigation/Application';
 import { ThemeProvider } from '@/theme';
 import '@/translations';
 
+import * as RNIap from 'react-native-iap';
+
+const itemSubs = ['com.recipemuse.vip.monthly']; // 你的订阅ID
+
+
+// 在 DEFAULT_URL 常量下方添加以下常量
+const MESSAGE_PREFIX = 'NATIVE_LOGIN_';
+const LOGIN_SUCCESS = `${MESSAGE_PREFIX}SUCCESS`;
+const LOGIN_REQUEST = `${MESSAGE_PREFIX}REQUEST`;
+
 export const queryClient = new QueryClient({
   defaultOptions: {
     mutations: {
@@ -42,7 +58,9 @@ export const useWebViewContext = () => {
 };
 
 // 配置常量
-const DEFAULT_URL = 'http://localhost:5173';
+// const DEFAULT_URL = 'http://localhost:5173';
+
+const DEFAULT_URL = 'http://10.13.51.57:5173';
 
 // WebView用户代理
 const USER_AGENT = Platform.select({
@@ -54,6 +72,158 @@ function App() {
   const webViewRef = useRef<WebView>(null);
   const [showWebView, setShowWebView] = useState(false);
 
+
+
+  /**
+   * 发送消息到 WebView
+   */
+  const sendMessageToWebView = (webViewRef: React.RefObject<WebView>, message: any) => {
+    if (webViewRef.current) {
+      const messageString = typeof message === 'string' ? message : JSON.stringify(message);
+      // 使用更可靠的通信方式
+      webViewRef.current.postMessage(messageString);
+    }
+  };
+
+  /**
+   * 处理来自 WebView 的消息
+   */
+  const handleWebViewMessage = (
+    event: any,
+    webViewRef: React.RefObject<WebView>,
+  ) => {
+    try {
+      const data = event.nativeEvent.data;
+      // 检查是否为登录请求
+      if (data === LOGIN_REQUEST) {
+        // 延迟执行登录以确保 WebView 已完全显示
+        handleLogin()
+            .then(() => {
+              // 登录成功后发送成功消息到 WebView
+              sendMessageToWebView(webViewRef, {
+                type: LOGIN_SUCCESS,
+                status: 'success',
+                message: '登录成功'
+              });
+            })
+            .catch((error) => {
+              // 登录失败时发送失败消息到 WebView
+              sendMessageToWebView(webViewRef, {
+                type: `${MESSAGE_PREFIX}ERROR`,
+                status: 'error',
+                message: error.message || '登录失败'
+              });
+            })
+      }
+    } catch (error) {
+      console.error('处理 WebView 消息时出错:', error);
+    }
+  };
+
+  const handleLogin = async () => {
+    try {
+      const deviceId = await DeviceInfo.getUniqueId();
+      console.log('设备ID:', deviceId);
+
+
+      let reqData = null
+      if (Platform.OS === 'ios') {
+        // iOS使用Apple登录
+        reqData = await handleAppleLogin();
+      } else {
+        // Android使用Google登录
+        reqData = await handleGoogleLogin();
+      }
+      
+      console.log('reqData 请求参数',reqData)
+    } catch (error) {
+      console.error('登录失败:', error);
+      Alert.alert('登录失败', '请稍后重试');
+    }
+  };
+
+
+  const handleAppleLogin = async () => {
+    try {
+      // 执行Apple登录请求
+      const appleAuthRequestResponse = await appleAuth.performRequest({
+        requestedOperation: appleAuth.Operation.LOGIN,
+        requestedScopes: [appleAuth.Scope.EMAIL, appleAuth.Scope.FULL_NAME],
+      });
+
+      // 获取凭证状态
+      const credentialState = await appleAuth.getCredentialStateForUser(
+        appleAuthRequestResponse.user,
+      );
+
+      if (credentialState === appleAuth.State.AUTHORIZED) {
+        console.log('Apple登录成功:', appleAuthRequestResponse);
+        // Alert.alert('登录成功', `欢迎 ${appleAuthRequestResponse.fullName?.givenName || '用户'}`);
+        sendMessageToWebView(webViewRef, {
+          type: 'LOGIN_SUCCESS_IOS',
+          status: 'success',
+          message: '登录成功',
+          data: appleAuthRequestResponse
+        })
+        // return appleAuthRequestResponse
+        // appleAuthRequestResponse : { 
+        //   user: '001746.b066d194b82f46eaac8f3f26b9a915fc.0901',
+        //   realUserStatus: 2,
+        //   authorizedScopes: [],
+        //   identityToken: 'eyJraWQiOiJIdlZJNkVzWlhKIiwiYWxnIjoiUlMyNTYifQ.eyJpc3MiOiJodHRwczovL2FwcGxlaWQuYXBwbGUuY29tIiwiYXVkIjoiY29tLmlwZWFraW5nLnJlY2lwZW11c2UiLCJleHAiOjE3NjIzMzMyNzcsImlhdCI6MTc2MjI0Njg3Nywic3ViIjoiMDAxNzQ2LmIwNjZkMTk0YjgyZjQ2ZWFhYzhmM2YyNmI5YTkxNWZjLjA5MDEiLCJub25jZSI6IjYyYTliNmQzMWI4M2EyMjdhYzA3MjI2ZDZiMmQxYTc1MTRhZTRiZjZjMjhlMjJjMmU4OTkwNTkzYTVkYzE5N2MiLCJjX2hhc2giOiIyZ0hUN1M1NHBWUExfeW52aHVrRGF3IiwiZW1haWwiOiIyNzYyMDM4NzZAcXEuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsImF1dGhfdGltZSI6MTc2MjI0Njg3Nywibm9uY2Vfc3VwcG9ydGVkIjp0cnVlLCJyZWFsX3VzZXJfc3RhdHVzIjoyfQ.Tt2X4fBYYY5xMKSDZW8DoLsmDFzVw4AaTkMVdvruKgEOlYnBmW5MJAgCIz8iqMSFwq1008YOcpcdnAAd1J43J9HdDV-Rpg_ryEP76ph0MiynbWPPPMexz3ndxe4_ZS3s7BZdweWJuwJ9x6SqoFl01tEqs8jGEaJ13Z3byYZgsbzQxtqLzof4W1RcjLGrgj_xagjqimbex3PAgD7bIh2SUBJbhNjIK_RcNPNLQTQ4EGFwNmfG22sFUFqY5W6ipyZvk6gXGegXgnTYZpeAS1bc8UL4KBz4T4zRQMkN3uJezPD6A_IfJKSkHmwsXgPYfLNhScuO2wSBc4Q-UvuS_Y3nhg',
+        //   authorizationCode: 'c9da4feae2b0248bea11861ca60088eb1.0.rrxuw.hLfeCQRQVY12lVyUyHIbtw',
+        //   fullName:  { 
+        //      namePrefix: null,
+        //      givenName: '凯',
+        //      nameSuffix: null,
+        //      middleName: null,
+        //      familyName: '周',
+        //      nickname: null 
+        //    },
+        //   email: '276203876@qq.com',
+        //   state: null,
+        //   nonce: '202K2RJL4_8SJmIS9AThnL6PGbMGzAz8'
+        //  }
+
+      }
+    } catch (error) {
+      console.error('Apple登录失败:', error);
+      throw error;
+    }
+  };
+
+  const handleGoogleLogin = async () => {
+    try {
+      // 配置Google登录
+      await GoogleSignin.configure({
+        webClientId: AUTH_CONFIG.GOOGLE.WEB_CLIENT_ID,
+        offlineAccess: true,
+      });
+
+      // 检查是否已登录
+      await GoogleSignin.hasPlayServices();
+      
+      // 执行登录
+      const userInfo = await GoogleSignin.signIn();
+      console.log('Google登录成功:', userInfo);
+      Alert.alert('登录成功', `欢迎 ${userInfo.data?.user.name || '用户'}`);  
+      // return userInfo
+      sendMessageToWebView(webViewRef, {
+        type: 'LOGIN_SUCCESS_ANDROID',
+        status: 'success',
+        message: '登录成功',
+        data: userInfo
+      })
+    } catch (error) {
+      console.error('Google登录失败:', error);
+      throw error;
+    }
+  };
+
+  const handleInAppPurchase = async () => {
+
+  };
+
   return (
     <GestureHandlerRootView style={styles.container}>
       <QueryClientProvider client={queryClient}>
@@ -66,6 +236,7 @@ function App() {
               <View style={[
                 styles.webViewContainer,
                 showWebView ? styles.webViewVisible : styles.webViewHidden,
+                __DEV__ && showWebView ? styles.webViewDebug : null // 开发模式下添加调试样式
               ]}>
                 <WebView
                   ref={webViewRef}
@@ -77,6 +248,9 @@ function App() {
                   startInLoadingState={true}
                   scalesPageToFit={true}
                   allowsBackForwardNavigationGestures={Platform.OS === 'ios'}
+                  onMessage={(event) => handleWebViewMessage(event, webViewRef)}
+                  onError={(error) => console.error('WebView 错误:', error)}
+                  onHttpError={(error) => console.error('WebView HTTP 错误:', error)}
                 />
               </View>
             </View>
@@ -109,6 +283,14 @@ const styles = StyleSheet.create({
   webView: {
     flex: 1,
   },
+  // 添加一个新的样式用于调试模式
+  webViewDebug: {
+    top: 20,    // 留出顶部空间
+    left: 10,   // 留出左侧空间
+    right: 10,  // 留出右侧空间
+    bottom: 20, // 留出底部空间
+    borderRadius: 10, // 添加圆角以便识别
+  },
 });
 
 export default App;

+ 1 - 1
src/screens/Startup/Startup.tsx

@@ -26,7 +26,7 @@ function Startup({ navigation }: RootScreenProps<Paths.Startup>) {
     if (isSuccess) {
       navigation.reset({
         index: 0,
-        routes: [{ name: Paths.Login }],
+        routes: [{ name: Paths.Home }],
       });
     }
   }, [isSuccess, navigation]);