|
@@ -13,6 +13,7 @@ import { NAVIGATION_PAGES } from '../../types';
|
|
import { useLoginMutation } from '@api/auth';
|
|
import { useLoginMutation } from '@api/auth';
|
|
import { fetchAndSaveStatistics } from 'src/database/statisticsService';
|
|
import { fetchAndSaveStatistics } from 'src/database/statisticsService';
|
|
import { useNetInfo } from '@react-native-community/netinfo';
|
|
import { useNetInfo } from '@react-native-community/netinfo';
|
|
|
|
+import { useNotification } from 'src/contexts/NotificationContext';
|
|
|
|
|
|
type Props = {
|
|
type Props = {
|
|
navigation: NavigationProp<any>;
|
|
navigation: NavigationProp<any>;
|
|
@@ -28,6 +29,7 @@ const LoginScreen: FC<Props> = ({ navigation }) => {
|
|
const isFirstLaunch = storage.get('isFirstLaunch', StoreType.BOOLEAN) ?? true;
|
|
const isFirstLaunch = storage.get('isFirstLaunch', StoreType.BOOLEAN) ?? true;
|
|
|
|
|
|
const { data, mutate: userLogin } = useLoginMutation();
|
|
const { data, mutate: userLogin } = useLoginMutation();
|
|
|
|
+ const { updateNotificationStatus } = useNotification();
|
|
|
|
|
|
const updateLocalData = async (token: string) => {
|
|
const updateLocalData = async (token: string) => {
|
|
await fetchAndSaveStatistics(token);
|
|
await fetchAndSaveStatistics(token);
|
|
@@ -41,6 +43,7 @@ const LoginScreen: FC<Props> = ({ navigation }) => {
|
|
storage.set('token', data.token);
|
|
storage.set('token', data.token);
|
|
storage.set('uid', data.uid.toString());
|
|
storage.set('uid', data.uid.toString());
|
|
storage.set('isFirstLaunch', false);
|
|
storage.set('isFirstLaunch', false);
|
|
|
|
+ updateNotificationStatus();
|
|
updateLocalData(data.token);
|
|
updateLocalData(data.token);
|
|
|
|
|
|
isFirstLaunch
|
|
isFirstLaunch
|