Apple calendar sync, timezone, first day of week additions

This commit is contained in:
Milan Paunovic
2024-10-19 22:56:55 +02:00
parent 00b6225a1c
commit 3653400a92
25 changed files with 1154 additions and 689 deletions
+2
View File
@@ -24,6 +24,8 @@ export interface UserProfile {
googleMail?: string | null;
outlookMail?: string | null;
appleMail?: string | null;
timeZone?: string | null;
firstDayOfWeek?: string | null;
}
export interface ParentProfile extends UserProfile {
+3 -1
View File
@@ -6,7 +6,7 @@ import {useAtomValue} from "jotai";
import {isFamilyViewAtom} from "@/components/pages/calendar/atoms";
export const useGetEvents = () => {
const { user, profileData } = useAuthContext();
const {user, profileData} = useAuthContext();
const isFamilyView = useAtomValue(isFamilyViewAtom)
return useQuery({
@@ -43,5 +43,7 @@ export const useGetEvents = () => {
};
}));
},
staleTime: Infinity,
cacheTime: Infinity
});
};
+2
View File
@@ -3,6 +3,7 @@ import auth from "@react-native-firebase/auth";
import { ProfileType } from "@/contexts/AuthContext";
import { useSetUserData } from "./useSetUserData";
import {uuidv4} from "@firebase/util";
import * as Localization from "expo-localization";
export const useSignUp = () => {
const { mutateAsync: setUserData } = useSetUserData();
@@ -30,6 +31,7 @@ export const useSignUp = () => {
firstName: firstName,
lastName: lastName,
familyId: uuidv4(),
timeZone: Localization.getCalendars()[0].timeZone,
},
customUser: res.user,
});
+6 -6
View File
@@ -1,11 +1,11 @@
import firestore from "@react-native-firebase/firestore";
import { FirebaseAuthTypes } from "@react-native-firebase/auth";
import { useMutation, useQueryClient } from "react-query";
import { useAuthContext } from "@/contexts/AuthContext";
import { UserProfile } from "@/hooks/firebase/types/profileTypes";
import {FirebaseAuthTypes} from "@react-native-firebase/auth";
import {useMutation, useQueryClient} from "react-query";
import {useAuthContext} from "@/contexts/AuthContext";
import {UserProfile} from "@/hooks/firebase/types/profileTypes";
export const useUpdateUserData = () => {
const { user: currentUser, refreshProfileData } = useAuthContext();
const {user: currentUser, refreshProfileData} = useAuthContext();
const queryClient = useQueryClient();
return useMutation({
@@ -17,7 +17,7 @@ export const useUpdateUserData = () => {
newUserData: Partial<UserProfile>;
customUser?: FirebaseAuthTypes.User;
}) => {
console.log("Mutation function called with data:", { newUserData, customUser });
console.log("Mutation function called with data:", {newUserData, customUser});
const user = currentUser ?? customUser;