remove app
This commit is contained in:
parent
21bdce0e1d
commit
4ef53e9378
5 changed files with 35 additions and 55 deletions
11
app.json
11
app.json
|
|
@ -34,16 +34,7 @@
|
|||
"plugins": [
|
||||
"expo-router",
|
||||
"expo-font",
|
||||
"expo-web-browser",
|
||||
"@react-native-firebase/app",
|
||||
[
|
||||
"expo-build-properties",
|
||||
{
|
||||
"ios": {
|
||||
"useFrameworks": "static"
|
||||
}
|
||||
}
|
||||
]
|
||||
"expo-web-browser"
|
||||
],
|
||||
"experiments": {
|
||||
"typedRoutes": true
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import messaging from '@react-native-firebase/messaging';
|
||||
import * as Notifications from 'expo-notifications';
|
||||
import { router } from 'expo-router';
|
||||
import { createUserWithEmailAndPassword, updateProfile } from 'firebase/auth';
|
||||
import { auth } from '@/contexts/firebase';
|
||||
|
|
@ -52,7 +52,35 @@ export default function Register() {
|
|||
await updateProfile(userCredential.user, {
|
||||
displayName: `${values.firstName} ${values.lastName}`
|
||||
});
|
||||
const token = await messaging().getToken();
|
||||
// Request permissions and get push token (native FCM if possible, else Expo token)
|
||||
let token = null;
|
||||
let tokenType = null;
|
||||
const { status: existingStatus } = await Notifications.getPermissionsAsync();
|
||||
let finalStatus = existingStatus;
|
||||
if (existingStatus !== 'granted') {
|
||||
const { status } = await Notifications.requestPermissionsAsync();
|
||||
finalStatus = status;
|
||||
}
|
||||
if (finalStatus === 'granted') {
|
||||
try {
|
||||
// Try to get native FCM token (works in dev/prod builds, not Expo Go)
|
||||
const deviceToken = await Notifications.getDevicePushTokenAsync({ provider: 'fcm' });
|
||||
if (deviceToken?.data) {
|
||||
token = deviceToken.data;
|
||||
tokenType = 'fcm';
|
||||
} else {
|
||||
// Fallback to Expo push token
|
||||
const expoToken = await Notifications.getExpoPushTokenAsync();
|
||||
token = expoToken.data;
|
||||
tokenType = 'expo';
|
||||
}
|
||||
} catch (e) {
|
||||
// Fallback to Expo push token if native fails
|
||||
const expoToken = await Notifications.getExpoPushTokenAsync();
|
||||
token = expoToken.data;
|
||||
tokenType = 'expo';
|
||||
}
|
||||
}
|
||||
|
||||
await postgresServices.createUser({
|
||||
firstName: values.firstName,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
import { initializeApp } from 'firebase/app';
|
||||
import { initializeAuth, getReactNativePersistence } from 'firebase/auth';
|
||||
import ReactNativeAsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import { getAuth } from 'firebase/auth';
|
||||
|
||||
const firebaseConfig = {
|
||||
apiKey: process.env.EXPO_PUBLIC_FIREBASE_API_KEY,
|
||||
|
|
@ -12,9 +12,8 @@ const firebaseConfig = {
|
|||
appId: process.env.EXPO_PUBLIC_FIREBASE_APP_ID,
|
||||
};
|
||||
|
||||
|
||||
const app = initializeApp(firebaseConfig);
|
||||
const auth = initializeAuth(app, {
|
||||
persistence: getReactNativePersistence(ReactNativeAsyncStorage)
|
||||
});
|
||||
const auth = getAuth(app);
|
||||
|
||||
export { auth };
|
||||
|
|
|
|||
36
package-lock.json
generated
36
package-lock.json
generated
|
|
@ -12,8 +12,6 @@
|
|||
"@emotion/unitless": "^0.10.0",
|
||||
"@expo/vector-icons": "^14.0.2",
|
||||
"@react-native-async-storage/async-storage": "^1.24.0",
|
||||
"@react-native-firebase/app": "^23.1.1",
|
||||
"@react-native-firebase/messaging": "^23.1.1",
|
||||
"@react-native-picker/picker": "^2.11.1",
|
||||
"@react-navigation/native": "^7.1.17",
|
||||
"expo": "^53.0.20",
|
||||
|
|
@ -3118,40 +3116,6 @@
|
|||
"react-native": "^0.0.0-0 || >=0.60 <1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@react-native-firebase/app": {
|
||||
"version": "23.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@react-native-firebase/app/-/app-23.1.1.tgz",
|
||||
"integrity": "sha512-w6fSGukDPzHiDbF3d8g1MYrlcoHtAn0pezUDYcmhZjDMldPBb5yxDi8/tj96K+0AecY6nCbOh5VgwY0bEd3iOQ==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"firebase": "12.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"expo": ">=47.0.0",
|
||||
"react": "*",
|
||||
"react-native": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"expo": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@react-native-firebase/messaging": {
|
||||
"version": "23.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@react-native-firebase/messaging/-/messaging-23.1.1.tgz",
|
||||
"integrity": "sha512-P6jH3jGGXIDn+EuCognMWkegqR/cDmEAMXHLV+XgodCSMoMODBfswJWmKYoX/7xkjBsptOXUKI6uwo3S+H5z1Q==",
|
||||
"license": "Apache-2.0",
|
||||
"peerDependencies": {
|
||||
"@react-native-firebase/app": "23.1.1",
|
||||
"expo": ">=47.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"expo": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@react-native-picker/picker": {
|
||||
"version": "2.11.1",
|
||||
"resolved": "https://registry.npmjs.org/@react-native-picker/picker/-/picker-2.11.1.tgz",
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@
|
|||
"@emotion/unitless": "^0.10.0",
|
||||
"@expo/vector-icons": "^14.0.2",
|
||||
"@react-native-async-storage/async-storage": "^1.24.0",
|
||||
"@react-native-firebase/app": "^23.1.1",
|
||||
"@react-native-firebase/messaging": "^23.1.1",
|
||||
"@react-native-picker/picker": "^2.11.1",
|
||||
"@react-navigation/native": "^7.1.17",
|
||||
"expo": "^53.0.20",
|
||||
|
|
|
|||
Loading…
Reference in a new issue