diff --git a/apps/wallet/ios/Podfile.lock b/apps/wallet/ios/Podfile.lock index f72248a06..65a5843d8 100644 --- a/apps/wallet/ios/Podfile.lock +++ b/apps/wallet/ios/Podfile.lock @@ -564,6 +564,8 @@ PODS: - React-logger (= 0.71.14) - React-perflogger (= 0.71.14) - RecaptchaInterop (100.0.0) + - RNAppleAuthentication (2.3.0): + - React-Core - RNCClipboard (1.13.2): - React-Core - RNCustomAuthSdk (4.0.1): @@ -686,6 +688,7 @@ DEPENDENCIES: - React-RCTVibration (from `../../../node_modules/react-native/Libraries/Vibration`) - React-runtimeexecutor (from `../../../node_modules/react-native/ReactCommon/runtimeexecutor`) - ReactCommon/turbomodule/core (from `../../../node_modules/react-native/ReactCommon`) + - "RNAppleAuthentication (from `../../../node_modules/@invertase/react-native-apple-authentication`)" - "RNCClipboard (from `../../../node_modules/@react-native-clipboard/clipboard`)" - "RNCustomAuthSdk (from `../../../node_modules/@toruslabs/customauth-react-native-sdk`)" - RNDeviceInfo (from `../../../node_modules/react-native-device-info`) @@ -836,6 +839,8 @@ EXTERNAL SOURCES: :path: "../../../node_modules/react-native/ReactCommon/runtimeexecutor" ReactCommon: :path: "../../../node_modules/react-native/ReactCommon" + RNAppleAuthentication: + :path: "../../../node_modules/@invertase/react-native-apple-authentication" RNCClipboard: :path: "../../../node_modules/@react-native-clipboard/clipboard" RNCustomAuthSdk: @@ -957,6 +962,7 @@ SPEC CHECKSUMS: React-runtimeexecutor: ffe826b7b1cfbc32a35ed5b64d5886c0ff75f501 ReactCommon: 6f0ee30fda78283c31310e585f7236748e13330d RecaptchaInterop: 7d1a4a01a6b2cb1610a47ef3f85f0c411434cb21 + RNAppleAuthentication: e99eaf3c4c01ad8ecb6125dd6f0cfd98871685b5 RNCClipboard: 60fed4b71560d7bfe40e9d35dea9762b024da86d RNCustomAuthSdk: e1db0c850b41deaf38fdc8fe5433b3287db29c55 RNDeviceInfo: db5c64a060e66e5db3102d041ebe3ef307a85120 diff --git a/apps/wallet/package.json b/apps/wallet/package.json index af7495bda..6c841b446 100644 --- a/apps/wallet/package.json +++ b/apps/wallet/package.json @@ -23,6 +23,7 @@ "@craftzdog/pouchdb-collate-react-native": "^7.3.0", "@craftzdog/react-native-buffer": "^6.0.5", "@dreson4/react-native-quick-bip39": "0.0.5", + "@invertase/react-native-apple-authentication": "^2.3.0", "@metacraft/cli-web3-polyfills": "^0.0.7", "@metaplex-foundation/js": "^0.19.4", "@mysten/sui.js": "0.34.0", @@ -75,6 +76,7 @@ "pouchdb-mapreduce": "^8.0.1", "pouchdb-replication": "^8.0.1", "react": "^18.2.0", + "react-apple-signin-auth": "^1.1.0", "react-dom": "^18.2.0", "react-native": "0.71.14", "react-native-biometrics": "^3.0.1", diff --git a/apps/wallet/src/screens/Authentication/Login/SignInInner.tsx b/apps/wallet/src/screens/Authentication/Login/SignInInner.tsx index 398eb7d8b..1096034ef 100644 --- a/apps/wallet/src/screens/Authentication/Login/SignInInner.tsx +++ b/apps/wallet/src/screens/Authentication/Login/SignInInner.tsx @@ -1,25 +1,45 @@ import type { FC } from 'react'; +import { Fragment } from 'react'; import { ActivityIndicator, StyleSheet } from 'react-native'; +import { appleAuthAndroid } from '@invertase/react-native-apple-authentication'; +import { runtime } from '@walless/core'; import { Button, Text, View } from '@walless/gui'; -import { Google } from '@walless/icons'; +import { Apple, Google } from '@walless/icons'; interface Props { onGoogleSignIn?: () => void; + onAppleSignIn?: () => void; loading?: boolean; onGetInvitationCode?: () => void; } -const SignInInner: FC = ({ onGoogleSignIn, loading }) => { +const SignInInner: FC = ({ onGoogleSignIn, onAppleSignIn, loading }) => { + const isAppleSignInSupported = runtime.isIOS || appleAuthAndroid.isSupported; + return ( {loading ? ( ) : ( - + + + + {isAppleSignInSupported && ( + + )} + )} @@ -50,10 +70,10 @@ const styles = StyleSheet.create({ }, commandContainer: { justifyContent: 'center', + gap: 24, }, signInButton: { flexDirection: 'row', - backgroundColor: '#0694D3', gap: 8, }, buttonText: { @@ -61,6 +81,12 @@ const styles = StyleSheet.create({ fontWeight: '500', color: 'white', }, + appleButton: { + backgroundColor: 'white', + }, + appleButtonText: { + color: 'black', + }, advancedModeContainer: { gap: 24, }, diff --git a/apps/wallet/src/screens/Authentication/Login/SignInInner.web.tsx b/apps/wallet/src/screens/Authentication/Login/SignInInner.web.tsx new file mode 100644 index 000000000..a283704ff --- /dev/null +++ b/apps/wallet/src/screens/Authentication/Login/SignInInner.web.tsx @@ -0,0 +1,140 @@ +import type { FC } from 'react'; +import { Fragment } from 'react'; +import AppleSignin from 'react-apple-signin-auth'; +import { ActivityIndicator, StyleSheet } from 'react-native'; +import { logger } from '@walless/core'; +import { Button, Text, View } from '@walless/gui'; +import { Apple, Google } from '@walless/icons'; + +interface Props { + onGoogleSignIn?: () => void; + onAppleSignIn?: () => void; + loading?: boolean; + onGetInvitationCode?: () => void; +} + +const SignInInner: FC = ({ onGoogleSignIn, loading }) => { + return ( + + + {loading ? ( + + ) : ( + + + + { + // Response + // { + // "authorization": { + // "state": "[STATE]", + // "code": "[CODE]", + // "id_token": "[ID_TOKEN]" + // }, + // "user": { + // "email": "[EMAIL]", + // "name": { + // "firstName": "[FIRST_NAME]", + // "lastName": "[LAST_NAME]" + // } + // } + // } + + console.log('--> apple sign-in on web', response); + }} + onError={(e) => logger.error(e)} + uiType="light" + render={({ onClick }) => ( + + )} + /> + + )} + + + + + + Advanced mode + + + +