delete firebase
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import { getApp } from '@react-native-firebase/app';
|
||||
import { getMessaging, getToken } from '@react-native-firebase/messaging';
|
||||
// import { getApp } from '@react-native-firebase/app';
|
||||
// import { getMessaging, getToken } from '@react-native-firebase/messaging';
|
||||
import { useNavigation } from '@react-navigation/native';
|
||||
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
@@ -20,7 +20,6 @@ import {
|
||||
TouchableOpacity,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import DeviceInfo from 'react-native-device-info';
|
||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
import Logo from 'screens/../../assets/bootsplash/logo_512.png';
|
||||
import { useModalStore } from 'screens/auth/registeration/lib/modalStore';
|
||||
@@ -50,34 +49,35 @@ const Confirm = ({
|
||||
const [errorConfirm, setErrorConfirm] = useState<string | null>(null);
|
||||
const inputRefs = useRef<Array<TextInput | null>>([]);
|
||||
const { phoneNumber } = useUserStore(state => state);
|
||||
const [firebaseToken, setFirebseToken] = useState<{
|
||||
fcmToken: string;
|
||||
deviceId: string;
|
||||
deviceName: string;
|
||||
} | null>();
|
||||
// const [firebaseToken, setFirebseToken] = useState<{
|
||||
// fcmToken: string;
|
||||
// deviceId: string;
|
||||
// deviceName: string;
|
||||
// } | null>();
|
||||
|
||||
const app = getApp();
|
||||
const messaging = getMessaging(app);
|
||||
// const app = getApp();
|
||||
// const messaging = getMessaging(app);
|
||||
|
||||
const getDeviceData = async () => {
|
||||
try {
|
||||
const fcmToken = await getToken(messaging);
|
||||
return {
|
||||
fcmToken,
|
||||
deviceId: await DeviceInfo.getUniqueId(),
|
||||
deviceName: await DeviceInfo.getDeviceName(),
|
||||
};
|
||||
} catch (e) {
|
||||
console.log('Xato:', e);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
// const getDeviceData = async () => {
|
||||
// try {
|
||||
// const fcmToken = await getToken(messaging);
|
||||
// return {
|
||||
// fcmToken,
|
||||
// deviceId: await DeviceInfo.getUniqueId(),
|
||||
// deviceName: await DeviceInfo.getDeviceName(),
|
||||
// };
|
||||
// } catch (e) {
|
||||
// console.log('Xato:', e);
|
||||
// return null;
|
||||
// }
|
||||
// };
|
||||
|
||||
// useEffect(() => {
|
||||
// getDeviceData().then(data => {
|
||||
// setFirebseToken(data);
|
||||
// });
|
||||
// }, []);
|
||||
|
||||
useEffect(() => {
|
||||
getDeviceData().then(data => {
|
||||
setFirebseToken(data);
|
||||
});
|
||||
}, []);
|
||||
const { mutate, isPending } = useMutation({
|
||||
mutationFn: (payload: otpPayload) => authApi.verifyOtp(payload),
|
||||
onSuccess: async res => {
|
||||
@@ -149,16 +149,15 @@ const Confirm = ({
|
||||
|
||||
const handleVerifyCode = () => {
|
||||
const enteredCode = code.join('');
|
||||
if (firebaseToken) {
|
||||
mutate({
|
||||
phoneNumber,
|
||||
otp: enteredCode,
|
||||
otpType: 'REGISTRATION',
|
||||
deviceId: firebaseToken.deviceId,
|
||||
deviceName: firebaseToken.deviceName,
|
||||
fcmToken: firebaseToken.fcmToken,
|
||||
});
|
||||
}
|
||||
|
||||
mutate({
|
||||
phoneNumber,
|
||||
otp: enteredCode,
|
||||
otpType: 'REGISTRATION',
|
||||
deviceId: '',
|
||||
deviceName: '',
|
||||
fcmToken: '',
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user