sync
This commit is contained in:
parent
4d911aee74
commit
0289ec4600
|
|
@ -93,6 +93,7 @@ android {
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0.0"
|
versionName "1.0.0"
|
||||||
|
multiDexEnabled true
|
||||||
}
|
}
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
debug {
|
debug {
|
||||||
|
|
|
||||||
98
android/app/google-services-og.json
Normal file
98
android/app/google-services-og.json
Normal file
|
|
@ -0,0 +1,98 @@
|
||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "652710461284",
|
||||||
|
"project_id": "sologin-55bbd",
|
||||||
|
"storage_bucket": "sologin-55bbd.firebasestorage.app"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:652710461284:android:b9b04765d34dbaf9f54471",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.anonymous.ecpay"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-eupnbcuuticf0naic09j0dbbrom3m7mq.apps.googleusercontent.com",
|
||||||
|
"client_type": 1,
|
||||||
|
"android_info": {
|
||||||
|
"package_name": "com.anonymous.ecpay",
|
||||||
|
"certificate_hash": "251cfa8fb4b43edc0d0ed8f774e4c00e32817bd1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-m7fknu3s5d2r90rk3jue6rr7980117mp.apps.googleusercontent.com",
|
||||||
|
"client_type": 1,
|
||||||
|
"android_info": {
|
||||||
|
"package_name": "com.anonymous.ecpay",
|
||||||
|
"certificate_hash": "812616c1cc22143026d04a568b60c416d3d87c42"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-7e2909o0bmsqqo17l4fhtkm33emh35vj.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyDyWHadwDE-CAtMbKfZ7Llq18zGMDPyRpY"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-7e2909o0bmsqqo17l4fhtkm33emh35vj.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-7c8o89arbs7aebma2gljgi8iq06f07k6.apps.googleusercontent.com",
|
||||||
|
"client_type": 2,
|
||||||
|
"ios_info": {
|
||||||
|
"bundle_id": "com.xperiencemhuntlauncher.mhuntla"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:652710461284:android:44b78de76f4d6f88f54471",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.xperience_mhunt_launcher.mhunt_launcher"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-7e2909o0bmsqqo17l4fhtkm33emh35vj.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyDyWHadwDE-CAtMbKfZ7Llq18zGMDPyRpY"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-7e2909o0bmsqqo17l4fhtkm33emh35vj.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-7c8o89arbs7aebma2gljgi8iq06f07k6.apps.googleusercontent.com",
|
||||||
|
"client_type": 2,
|
||||||
|
"ios_info": {
|
||||||
|
"bundle_id": "com.xperiencemhuntlauncher.mhuntla"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
||||||
98
android/app/google-services.json
Normal file
98
android/app/google-services.json
Normal file
|
|
@ -0,0 +1,98 @@
|
||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "652710461284",
|
||||||
|
"project_id": "sologin-55bbd",
|
||||||
|
"storage_bucket": "sologin-55bbd.firebasestorage.app"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:652710461284:android:b9b04765d34dbaf9f54471",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.anonymous.ecpay"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-eupnbcuuticf0naic09j0dbbrom3m7mq.apps.googleusercontent.com",
|
||||||
|
"client_type": 1,
|
||||||
|
"android_info": {
|
||||||
|
"package_name": "com.anonymous.ecpay",
|
||||||
|
"certificate_hash": "251cfa8fb4b43edc0d0ed8f774e4c00e32817bd1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-m7fknu3s5d2r90rk3jue6rr7980117mp.apps.googleusercontent.com",
|
||||||
|
"client_type": 1,
|
||||||
|
"android_info": {
|
||||||
|
"package_name": "com.anonymous.ecpay",
|
||||||
|
"certificate_hash": "812616c1cc22143026d04a568b60c416d3d87c42"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-7e2909o0bmsqqo17l4fhtkm33emh35vj.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyDyWHadwDE-CAtMbKfZ7Llq18zGMDPyRpY"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-7e2909o0bmsqqo17l4fhtkm33emh35vj.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-7c8o89arbs7aebma2gljgi8iq06f07k6.apps.googleusercontent.com",
|
||||||
|
"client_type": 2,
|
||||||
|
"ios_info": {
|
||||||
|
"bundle_id": "com.xperiencemhuntlauncher.mhuntla"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:652710461284:android:44b78de76f4d6f88f54471",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.xperience_mhunt_launcher.mhunt_launcher"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-7e2909o0bmsqqo17l4fhtkm33emh35vj.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyDyWHadwDE-CAtMbKfZ7Llq18zGMDPyRpY"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-7e2909o0bmsqqo17l4fhtkm33emh35vj.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-7c8o89arbs7aebma2gljgi8iq06f07k6.apps.googleusercontent.com",
|
||||||
|
"client_type": 2,
|
||||||
|
"ios_info": {
|
||||||
|
"bundle_id": "com.xperiencemhuntlauncher.mhuntla"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
<category android:name="android.intent.category.BROWSABLE"/>
|
<category android:name="android.intent.category.BROWSABLE"/>
|
||||||
<data android:scheme="myapp"/>
|
<data android:scheme="myapp"/>
|
||||||
<data android:scheme="com.anonymous.ecpay"/>
|
<data android:scheme="com.anonymous.ecpay"/>
|
||||||
|
<data android:scheme="exp+ecpay"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ buildscript {
|
||||||
classpath('com.android.tools.build:gradle')
|
classpath('com.android.tools.build:gradle')
|
||||||
classpath('com.facebook.react:react-native-gradle-plugin')
|
classpath('com.facebook.react:react-native-gradle-plugin')
|
||||||
classpath('org.jetbrains.kotlin:kotlin-gradle-plugin')
|
classpath('org.jetbrains.kotlin:kotlin-gradle-plugin')
|
||||||
|
classpath 'com.google.gms:google-services:4.4.2'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
98
android/google-services.json
Normal file
98
android/google-services.json
Normal file
|
|
@ -0,0 +1,98 @@
|
||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "652710461284",
|
||||||
|
"project_id": "sologin-55bbd",
|
||||||
|
"storage_bucket": "sologin-55bbd.firebasestorage.app"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:652710461284:android:b9b04765d34dbaf9f54471",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.anonymous.ecpay"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-eupnbcuuticf0naic09j0dbbrom3m7mq.apps.googleusercontent.com",
|
||||||
|
"client_type": 1,
|
||||||
|
"android_info": {
|
||||||
|
"package_name": "com.anonymous.ecpay",
|
||||||
|
"certificate_hash": "251cfa8fb4b43edc0d0ed8f774e4c00e32817bd1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-m7fknu3s5d2r90rk3jue6rr7980117mp.apps.googleusercontent.com",
|
||||||
|
"client_type": 1,
|
||||||
|
"android_info": {
|
||||||
|
"package_name": "com.anonymous.ecpay",
|
||||||
|
"certificate_hash": "812616c1cc22143026d04a568b60c416d3d87c42"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-7e2909o0bmsqqo17l4fhtkm33emh35vj.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyDyWHadwDE-CAtMbKfZ7Llq18zGMDPyRpY"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-7e2909o0bmsqqo17l4fhtkm33emh35vj.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-7c8o89arbs7aebma2gljgi8iq06f07k6.apps.googleusercontent.com",
|
||||||
|
"client_type": 2,
|
||||||
|
"ios_info": {
|
||||||
|
"bundle_id": "com.xperiencemhuntlauncher.mhuntla"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:652710461284:android:44b78de76f4d6f88f54471",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.xperience_mhunt_launcher.mhunt_launcher"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-7e2909o0bmsqqo17l4fhtkm33emh35vj.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyDyWHadwDE-CAtMbKfZ7Llq18zGMDPyRpY"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-7e2909o0bmsqqo17l4fhtkm33emh35vj.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_id": "652710461284-7c8o89arbs7aebma2gljgi8iq06f07k6.apps.googleusercontent.com",
|
||||||
|
"client_type": 2,
|
||||||
|
"ios_info": {
|
||||||
|
"bundle_id": "com.xperiencemhuntlauncher.mhuntla"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
||||||
|
|
@ -56,6 +56,6 @@ EX_DEV_CLIENT_NETWORK_INSPECTOR=true
|
||||||
expo.useLegacyPackaging=false
|
expo.useLegacyPackaging=false
|
||||||
|
|
||||||
|
|
||||||
#proxy
|
# proxy
|
||||||
systemProp.https.proxyHost=127.0.0.1
|
# systemProp.https.proxyHost=127.0.0.1
|
||||||
systemProp.https.proxyPort=10809
|
# systemProp.https.proxyPort=10809
|
||||||
8
app.json
8
app.json
|
|
@ -37,6 +37,14 @@
|
||||||
],
|
],
|
||||||
"experiments": {
|
"experiments": {
|
||||||
"typedRoutes": true
|
"typedRoutes": true
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"router": {
|
||||||
|
"origin": false
|
||||||
|
},
|
||||||
|
"eas": {
|
||||||
|
"projectId": "3d220a83-6e33-400a-980c-3cc5cfb24e56"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { Image, StyleSheet, Pressable, Platform } from 'react-native';
|
import { Image, StyleSheet, Pressable, Platform, View, Alert } from 'react-native';
|
||||||
import { useCameraPermissions } from 'expo-camera';
|
import { useCameraPermissions } from 'expo-camera';
|
||||||
import { Link } from 'expo-router';
|
import Link, { } from 'expo-router/link';
|
||||||
import { ethers } from 'ethers';
|
import { ethers } from 'ethers';
|
||||||
|
|
||||||
import ParallaxScrollView from '@/components/ParallaxScrollView';
|
import ParallaxScrollView from '@/components/ParallaxScrollView';
|
||||||
|
|
@ -10,18 +10,66 @@ import { ThemedView } from '@/components/ThemedView';
|
||||||
import { WalletConnectModal, useWalletConnectModal } from '@walletconnect/modal-react-native';
|
import { WalletConnectModal, useWalletConnectModal } from '@walletconnect/modal-react-native';
|
||||||
import { CHAIN_ID, CONTRACT_ADDRESS, projectId, providerMetadata } from './shared';
|
import { CHAIN_ID, CONTRACT_ADDRESS, projectId, providerMetadata } from './shared';
|
||||||
import { contractABI } from './ABI/transfer_contract';
|
import { contractABI } from './ABI/transfer_contract';
|
||||||
|
// import { GoogleSignin } from 'react-native-google-signin';
|
||||||
|
import { GoogleSignin, statusCodes, GoogleSigninButton, isErrorWithCode, User } from '@react-native-google-signin/google-signin';
|
||||||
|
import auth from '@react-native-firebase/auth';
|
||||||
|
|
||||||
|
|
||||||
export default function HomeScreen() {
|
export default function HomeScreen() {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [transferLoading, setTransferLoading] = useState(false);
|
const [transferLoading, setTransferLoading] = useState(false);
|
||||||
|
|
||||||
|
const [firebaseUser, setFirebaseUser] = useState<User | null>();
|
||||||
const [permission, requestPermission] = useCameraPermissions();
|
const [permission, requestPermission] = useCameraPermissions();
|
||||||
|
const [embeddedWallet, setEmbeddedWallet] = useState("");
|
||||||
const isPermissionGranted = Boolean(permission?.granted);
|
const isPermissionGranted = Boolean(permission?.granted);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const { open, isConnected, address, provider } = useWalletConnectModal();
|
const { open, isConnected, address, provider } = useWalletConnectModal();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setLoading(true);
|
||||||
|
|
||||||
|
GoogleSignin.configure({
|
||||||
|
webClientId: '652710461284-7e2909o0bmsqqo17l4fhtkm33emh35vj.apps.googleusercontent.com',
|
||||||
|
});
|
||||||
|
// Check if the user is already signed in
|
||||||
|
const checkSignInStatus = async () => {
|
||||||
|
try {
|
||||||
|
const userInfo = await GoogleSignin.signInSilently();
|
||||||
|
|
||||||
|
if (userInfo != null) {
|
||||||
|
console.log("Setting firebase user silently");
|
||||||
|
setFirebaseUser(userInfo.data);
|
||||||
|
console.log(firebaseUser);
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to check Google sign-in status:', error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
checkSignInStatus();
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
|
||||||
|
const fetchEmbeddedWallet = async () => {
|
||||||
|
if (firebaseUser == null) { console.log('firebase user is null'); return; }
|
||||||
|
const googleCredential = auth.GoogleAuthProvider.credential(firebaseUser.idToken);
|
||||||
|
const userCredential = await auth().signInWithCredential(googleCredential);
|
||||||
|
const tokenId = await userCredential.user.getIdToken();
|
||||||
|
console.log(`tokenId from firebase ${tokenId}`);
|
||||||
|
const register = await fetch(`http://vps.playpoolstudios.com:30017/signinWithGoogle?tokenId=${tokenId}`)
|
||||||
|
const registerJson = await register.json();
|
||||||
|
console.log(registerJson);
|
||||||
|
setEmbeddedWallet(registerJson['publicKey']);
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchEmbeddedWallet();
|
||||||
|
}, [firebaseUser])
|
||||||
|
|
||||||
const connectWallet = async () => {
|
const connectWallet = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
|
|
@ -62,10 +110,10 @@ export default function HomeScreen() {
|
||||||
|
|
||||||
const signer = ethersProvider.getSigner();
|
const signer = ethersProvider.getSigner();
|
||||||
|
|
||||||
|
|
||||||
const contract = new ethers.Contract(CONTRACT_ADDRESS, contractABI, signer);
|
const contract = new ethers.Contract(CONTRACT_ADDRESS, contractABI, signer);
|
||||||
|
|
||||||
const tx = await contract.transferETH('warlock',{
|
const tx = await contract.transferETH('warlock', {
|
||||||
value: ethers.utils.parseEther('0.002'), // Sending 0.003 ETH
|
value: ethers.utils.parseEther('0.002'), // Sending 0.003 ETH
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -79,6 +127,52 @@ export default function HomeScreen() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const _signIn = async () => {
|
||||||
|
try {
|
||||||
|
await GoogleSignin.hasPlayServices();
|
||||||
|
const { type, data } = await GoogleSignin.signIn();
|
||||||
|
if (type === 'success') {
|
||||||
|
console.log({ data });
|
||||||
|
setFirebaseUser(data);
|
||||||
|
} else {
|
||||||
|
// sign in was cancelled by user
|
||||||
|
setTimeout(() => {
|
||||||
|
Alert.alert('cancelled');
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
} catch (error: any) {
|
||||||
|
if (isErrorWithCode(error)) {
|
||||||
|
console.log('error', error.message);
|
||||||
|
switch (error.code) {
|
||||||
|
case statusCodes.IN_PROGRESS:
|
||||||
|
// operation (eg. sign in) already in progress
|
||||||
|
Alert.alert(
|
||||||
|
'in progress',
|
||||||
|
'operation (eg. sign in) already in progress',
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case statusCodes.PLAY_SERVICES_NOT_AVAILABLE:
|
||||||
|
// android only
|
||||||
|
Alert.alert('play services not available or outdated');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Alert.alert('Something went wrong: ', error.toString() + error.code);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alert(`an error that's not related to google sign in occurred`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleLogout = async () => {
|
||||||
|
try {
|
||||||
|
await GoogleSignin.signOut();
|
||||||
|
setFirebaseUser(null);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Logout failed:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ParallaxScrollView
|
<ParallaxScrollView
|
||||||
|
|
@ -95,11 +189,13 @@ export default function HomeScreen() {
|
||||||
</ThemedView>
|
</ThemedView>
|
||||||
|
|
||||||
{/* Connect Wallet Section */}
|
{/* Connect Wallet Section */}
|
||||||
<Pressable onPress={connectWallet} style={styles.button}>
|
{
|
||||||
<ThemedText style={styles.buttonText}>
|
firebaseUser == null ?
|
||||||
{loading ? 'Connecting...' : isConnected ? 'Disconnect Wallet' : 'Connect Wallet'}
|
(<Pressable onPress={connectWallet} style={styles.button}>
|
||||||
</ThemedText>
|
<ThemedText style={styles.buttonText}>
|
||||||
</Pressable>
|
{loading ? 'Connecting...' : isConnected ? 'Disconnect Wallet' : 'Connect Wallet'}
|
||||||
|
</ThemedText>
|
||||||
|
</Pressable>) : (<></>)}
|
||||||
|
|
||||||
{/* Display Wallet Address if Connected */}
|
{/* Display Wallet Address if Connected */}
|
||||||
{isConnected && (
|
{isConnected && (
|
||||||
|
|
@ -109,8 +205,37 @@ export default function HomeScreen() {
|
||||||
</ThemedView>
|
</ThemedView>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{
|
||||||
|
(firebaseUser == null && !isConnected) ?
|
||||||
|
(<GoogleSigninButton
|
||||||
|
size={GoogleSigninButton.Size.Standard}
|
||||||
|
color={GoogleSigninButton.Color.Dark}
|
||||||
|
onPress={_signIn}
|
||||||
|
accessibilityLabel={'sign in'}
|
||||||
|
/>)
|
||||||
|
:
|
||||||
|
|
||||||
|
(!isConnected) ?
|
||||||
|
(
|
||||||
|
<ThemedView>
|
||||||
|
<ThemedText>
|
||||||
|
Signed in as {firebaseUser?.user.email}
|
||||||
|
</ThemedText>
|
||||||
|
<ThemedText>
|
||||||
|
{embeddedWallet}
|
||||||
|
</ThemedText>
|
||||||
|
<Pressable onPress={handleLogout} style={styles.logoutButton}>
|
||||||
|
<ThemedText style={styles.buttonText}>Logout</ThemedText>
|
||||||
|
</Pressable>
|
||||||
|
|
||||||
|
</ThemedView>
|
||||||
|
)
|
||||||
|
:
|
||||||
|
(<></>)
|
||||||
|
}
|
||||||
|
|
||||||
{/* Link to Scanner */}
|
{/* Link to Scanner */}
|
||||||
{isPermissionGranted ? isConnected&& (
|
{isPermissionGranted ? (isConnected || firebaseUser != null) && (
|
||||||
<Link href="./scanner" asChild>
|
<Link href="./scanner" asChild>
|
||||||
<Pressable
|
<Pressable
|
||||||
style={({ pressed }) => [
|
style={({ pressed }) => [
|
||||||
|
|
@ -214,4 +339,10 @@ const styles = StyleSheet.create({
|
||||||
backgroundColor: "#444",
|
backgroundColor: "#444",
|
||||||
borderRadius: 8,
|
borderRadius: 8,
|
||||||
},
|
},
|
||||||
|
logoutButton: {
|
||||||
|
backgroundColor: '#d9534f',
|
||||||
|
padding: 12,
|
||||||
|
borderRadius: 8,
|
||||||
|
alignItems: 'center',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,6 @@ import { StatusBar } from 'expo-status-bar';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import 'react-native-reanimated';
|
import 'react-native-reanimated';
|
||||||
import "node-libs-expo/globals"
|
import "node-libs-expo/globals"
|
||||||
import "react-native-url-polyfill/auto"
|
|
||||||
import "react-native-get-random-values"
|
|
||||||
import { useColorScheme } from '@/hooks/useColorScheme';
|
import { useColorScheme } from '@/hooks/useColorScheme';
|
||||||
|
|
||||||
// Prevent the splash screen from auto-hiding before asset loading is complete.
|
// Prevent the splash screen from auto-hiding before asset loading is complete.
|
||||||
|
|
|
||||||
21
eas.json
Normal file
21
eas.json
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"cli": {
|
||||||
|
"version": ">= 14.2.0",
|
||||||
|
"appVersionSource": "remote"
|
||||||
|
},
|
||||||
|
"build": {
|
||||||
|
"development": {
|
||||||
|
"developmentClient": true,
|
||||||
|
"distribution": "internal"
|
||||||
|
},
|
||||||
|
"preview": {
|
||||||
|
"distribution": "internal"
|
||||||
|
},
|
||||||
|
"production": {
|
||||||
|
"autoIncrement": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"submit": {
|
||||||
|
"production": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
1074
package-lock.json
generated
1074
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
26
package.json
26
package.json
|
|
@ -16,21 +16,30 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@expo/vector-icons": "^14.0.2",
|
"@expo/vector-icons": "^14.0.2",
|
||||||
|
"@react-native-async-storage/async-storage": "1.23.1",
|
||||||
|
"@react-native-community/netinfo": "11.4.1",
|
||||||
|
"@react-native-firebase/app": "^21.6.1",
|
||||||
|
"@react-native-firebase/auth": "^21.6.1",
|
||||||
|
"@react-native-google-signin/google-signin": "^13.1.0",
|
||||||
"@react-navigation/bottom-tabs": "^7.0.0",
|
"@react-navigation/bottom-tabs": "^7.0.0",
|
||||||
"@react-navigation/native": "^7.0.0",
|
"@react-navigation/native": "^7.0.0",
|
||||||
"@shopify/react-native-skia": "1.5.0",
|
"@shopify/react-native-skia": "1.5.0",
|
||||||
"@walletconnect/modal-react-native": "^1.1.0",
|
"@walletconnect/modal-react-native": "^1.1.0",
|
||||||
|
"@walletconnect/react-native-compat": "^2.17.3",
|
||||||
"@walletconnect/web3-provider": "^1.8.0",
|
"@walletconnect/web3-provider": "^1.8.0",
|
||||||
"ethers": "5.2",
|
"ethers": "5.2",
|
||||||
"expo": "~52.0.18",
|
"expo": "~52.0.18",
|
||||||
|
"expo-auth-session": "~6.0.1",
|
||||||
"expo-blur": "~14.0.1",
|
"expo-blur": "~14.0.1",
|
||||||
"expo-camera": "~16.0.9",
|
"expo-camera": "~16.0.10",
|
||||||
"expo-constants": "~17.0.3",
|
"expo-constants": "~17.0.3",
|
||||||
"expo-crypto": "^14.0.1",
|
"expo-crypto": "^14.0.1",
|
||||||
|
"expo-dev-client": "~5.0.7",
|
||||||
|
"expo-firebase": "^0.0.0-alpha.0",
|
||||||
"expo-font": "~13.0.1",
|
"expo-font": "~13.0.1",
|
||||||
"expo-haptics": "~14.0.0",
|
"expo-haptics": "~14.0.0",
|
||||||
"expo-linking": "~7.0.3",
|
"expo-linking": "~7.0.3",
|
||||||
"expo-router": "4.0.11",
|
"expo-router": "~4.0.15",
|
||||||
"expo-splash-screen": "~0.29.18",
|
"expo-splash-screen": "~0.29.18",
|
||||||
"expo-status-bar": "~2.0.0",
|
"expo-status-bar": "~2.0.0",
|
||||||
"expo-symbols": "~0.2.0",
|
"expo-symbols": "~0.2.0",
|
||||||
|
|
@ -42,24 +51,25 @@
|
||||||
"react-native": "0.76.5",
|
"react-native": "0.76.5",
|
||||||
"react-native-compat": "^1.0.0",
|
"react-native-compat": "^1.0.0",
|
||||||
"react-native-gesture-handler": "~2.20.2",
|
"react-native-gesture-handler": "~2.20.2",
|
||||||
|
"react-native-get-random-values": "~1.11.0",
|
||||||
|
"react-native-modal": "^13.0.1",
|
||||||
"react-native-reanimated": "~3.16.1",
|
"react-native-reanimated": "~3.16.1",
|
||||||
"react-native-safe-area-context": "4.12.0",
|
"react-native-safe-area-context": "4.12.0",
|
||||||
"react-native-screens": "~4.1.0",
|
"react-native-screens": "~4.4.0",
|
||||||
|
"react-native-svg": "15.8.0",
|
||||||
"react-native-web": "~0.19.13",
|
"react-native-web": "~0.19.13",
|
||||||
"react-native-webview": "13.12.5",
|
"react-native-webview": "13.12.5"
|
||||||
"@react-native-async-storage/async-storage": "1.23.1",
|
|
||||||
"@react-native-community/netinfo": "11.4.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.25.2",
|
"@babel/core": "^7.25.2",
|
||||||
|
"@react-native-community/cli": "latest",
|
||||||
"@types/jest": "^29.5.12",
|
"@types/jest": "^29.5.12",
|
||||||
"@types/react": "~18.3.12",
|
"@types/react": "~18.3.12",
|
||||||
"@types/react-test-renderer": "^18.3.0",
|
"@types/react-test-renderer": "^18.3.0",
|
||||||
"jest": "^29.2.1",
|
"jest": "^29.2.1",
|
||||||
"jest-expo": "~52.0.2",
|
"jest-expo": "~52.0.2",
|
||||||
"react-test-renderer": "18.3.1",
|
"react-test-renderer": "18.3.1",
|
||||||
"typescript": "^5.3.3",
|
"typescript": "^5.3.3"
|
||||||
"@react-native-community/cli": "latest"
|
|
||||||
},
|
},
|
||||||
"private": true
|
"private": true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user