Merge branch 'dev'

# Conflicts:
#	ios/cally/Info.plist
This commit is contained in:
Milan Paunovic
2024-10-21 10:05:05 +02:00
21 changed files with 638 additions and 355 deletions

View File

@ -1,5 +1,4 @@
export async function fetchGoogleCalendarEvents(token, email, familyId, startDate, endDate) { export async function fetchGoogleCalendarEvents(token, email, familyId, startDate, endDate) {
console.log(token);
const response = await fetch( const response = await fetch(
`https://www.googleapis.com/calendar/v3/calendars/primary/events?single_events=true&time_min=${startDate}&time_max=${endDate}`, `https://www.googleapis.com/calendar/v3/calendars/primary/events?single_events=true&time_min=${startDate}&time_max=${endDate}`,
{ {
@ -10,7 +9,6 @@ export async function fetchGoogleCalendarEvents(token, email, familyId, startDat
); );
const data = await response.json(); const data = await response.json();
console.log(data);
const googleEvents = []; const googleEvents = [];
data.items?.forEach((item) => { data.items?.forEach((item) => {
let isAllDay = false; let isAllDay = false;
@ -41,7 +39,7 @@ export async function fetchGoogleCalendarEvents(token, email, familyId, startDat
const googleEvent = { const googleEvent = {
id: item.id, id: item.id,
title: item.summary, title: item.summary ?? "",
startDate: startDateTime, startDate: startDateTime,
endDate: endDateTime, endDate: endDateTime,
allDay: isAllDay, allDay: isAllDay,

View File

@ -421,7 +421,7 @@ export const ManuallyAddEventModal = () => {
</View> </View>
<View marginL-35> <View marginL-35>
<AssigneesDisplay setSlectedAttendees={setSelectedAttendees} <AssigneesDisplay setSelectedAttendees={setSelectedAttendees}
selectedAttendees={selectedAttendees}/> selectedAttendees={selectedAttendees}/>
</View> </View>

View File

@ -90,8 +90,11 @@ const CalendarSettingsPage = (props: {
const userInfo = await userInfoResponse.json(); const userInfo = await userInfoResponse.json();
const googleMail = userInfo.email; const googleMail = userInfo.email;
let googleAccounts = profileData?.googleAccounts;
const updatedGoogleAccounts = googleAccounts ? {...googleAccounts, [googleMail]: accessToken} : {[googleMail]: accessToken};
await updateUserData({ await updateUserData({
newUserData: {googleToken: accessToken, googleMail: googleMail}, newUserData: {googleAccounts: updatedGoogleAccounts},
}); });
await fetchAndSaveGoogleEvents({token: accessToken, email: googleMail}) await fetchAndSaveGoogleEvents({token: accessToken, email: googleMail})
@ -171,9 +174,12 @@ const CalendarSettingsPage = (props: {
} else { } else {
const outlookMail = userInfo.mail || userInfo.userPrincipalName; const outlookMail = userInfo.mail || userInfo.userPrincipalName;
let microsoftAccounts = profileData?.microsoftAccounts;
const updatedMicrosoftAccounts = microsoftAccounts ? {...microsoftAccounts, [outlookMail]: tokenData.access_token} : {[outlookMail]: tokenData.access_token};
// Update user data with Microsoft token and email // Update user data with Microsoft token and email
await updateUserData({ await updateUserData({
newUserData: {microsoftToken: tokenData.access_token, outlookMail: outlookMail}, newUserData: {microsoftAccounts: updatedMicrosoftAccounts},
}); });
await fetchAndSaveOutlookEvents(tokenData.access_token, outlookMail) await fetchAndSaveOutlookEvents(tokenData.access_token, outlookMail)
@ -263,21 +269,61 @@ const CalendarSettingsPage = (props: {
debouncedUpdateUserData(color); debouncedUpdateUserData(color);
}; };
const clearToken = async (provider: "google" | "outlook" | "apple") => { const clearToken = async (provider: "google" | "outlook" | "apple", email: string) => {
const newUserData: Partial<UserProfile> = {}; const newUserData: Partial<UserProfile> = {};
if (provider === "google") { if (provider === "google") {
newUserData.googleToken = null; let googleAccounts = profileData?.googleAccounts;
newUserData.googleMail = null; if (googleAccounts) {
googleAccounts[email] = null;
newUserData.googleAccounts = googleAccounts;
}
} else if (provider === "outlook") { } else if (provider === "outlook") {
newUserData.microsoftToken = null; let microsoftAccounts = profileData?.microsoftAccounts;
newUserData.outlookMail = null; if (microsoftAccounts) {
microsoftAccounts[email] = null;
newUserData.microsoftAccounts = microsoftAccounts;
}
} else if (provider === "apple") { } else if (provider === "apple") {
newUserData.appleToken = null; let appleAccounts = profileData?.appleAccounts;
newUserData.appleMail = null; if (appleAccounts) {
appleAccounts[email] = null;
newUserData.appleAccounts = appleAccounts;
}
} }
await updateUserData({newUserData}); await updateUserData({newUserData});
}; };
let isConnectedToGoogle = false;
if (profileData?.googleAccounts) {
Object.values(profileData?.googleAccounts).forEach((item) => {
if (item !== null) {
isConnectedToGoogle = true;
return;
}
});
}
let isConnectedToMicrosoft = false;
const microsoftAccounts = profileData?.microsoftAccounts;
if (microsoftAccounts) {
Object.values(profileData?.microsoftAccounts).forEach((item) => {
if (item !== null) {
isConnectedToMicrosoft = true;
return;
}
});
}
let isConnectedToApple = false;
if (profileData?.appleAccounts) {
Object.values(profileData?.appleAccounts).forEach((item) => {
if (item !== null) {
isConnectedToApple = true;
return;
}
});
}
return ( return (
<ScrollView> <ScrollView>
<View marginH-30 marginB-30> <View marginH-30 marginB-30>
@ -378,8 +424,8 @@ const CalendarSettingsPage = (props: {
</Text> </Text>
<Button <Button
onPress={() => !profileData?.googleToken ? promptAsync() : clearToken("google")} onPress={() => promptAsync()}
label={profileData?.googleToken ? `Disconnect ${profileData.googleMail}` : "Connect Google"} label={"Connect Google"}
labelStyle={styles.addCalLbl} labelStyle={styles.addCalLbl}
labelProps={{ labelProps={{
numberOfLines: 2 numberOfLines: 2
@ -393,9 +439,30 @@ const CalendarSettingsPage = (props: {
color="black" color="black"
text70BL text70BL
/> />
{profileData?.googleAccounts ? Object.keys(profileData?.googleAccounts)?.map((googleMail) => {
const googleToken = profileData?.googleAccounts?.[googleMail];
return googleToken && <Button
key={googleMail}
onPress={() => clearToken("google", googleMail)}
label={`Disconnect ${googleMail}`}
labelStyle={styles.addCalLbl}
labelProps={{
numberOfLines: 2
}}
iconSource={() => (
<View marginR-15>
<GoogleIcon/>
</View>
)}
style={styles.addCalBtn}
color="black"
text70BL
/>
}) : null}
<Button <Button
onPress={() => !profileData?.appleToken ? handleAppleSignIn() : clearToken("google")} onPress={() => handleAppleSignIn()}
label={profileData?.appleToken ? `Disconnect ${profileData.appleMail}` : "Connect Apple"} label={"Connect Apple"}
labelStyle={styles.addCalLbl} labelStyle={styles.addCalLbl}
labelProps={{ labelProps={{
numberOfLines: 2 numberOfLines: 2
@ -409,9 +476,30 @@ const CalendarSettingsPage = (props: {
color="black" color="black"
text70BL text70BL
/> />
{profileData?.appleAccounts ? Object.keys(profileData?.appleAccounts)?.map((appleEmail) => {
const appleToken = profileData?.appleAccounts?.[appleEmail];
return appleToken && <Button
key={appleEmail}
onPress={() => clearToken("apple", appleEmail)}
label={`Disconnect ${appleEmail}`}
labelStyle={styles.addCalLbl}
labelProps={{
numberOfLines: 2
}}
iconSource={() => (
<View marginR-15>
<AppleIcon/>
</View>
)}
style={styles.addCalBtn}
color="black"
text70BL
/>
}) : null}
<Button <Button
onPress={() => !profileData?.microsoftToken ? handleMicrosoftSignIn() : clearToken("outlook")} onPress={() => handleMicrosoftSignIn()}
label={profileData?.microsoftToken ? `Disconnect ${profileData.outlookMail}` : "Connect Outlook"} label={"Connect Outlook"}
labelStyle={styles.addCalLbl} labelStyle={styles.addCalLbl}
labelProps={{ labelProps={{
numberOfLines: 2 numberOfLines: 2
@ -425,8 +513,28 @@ const CalendarSettingsPage = (props: {
color="black" color="black"
text70BL text70BL
/> />
{profileData?.microsoftAccounts ? Object.keys(profileData?.microsoftAccounts)?.map((microsoftEmail) => {
const microsoftToken = profileData?.microsoftAccounts?.[microsoftEmail];
return microsoftToken && <Button
key={microsoftEmail}
onPress={() => clearToken("outlook", microsoftEmail)}
label={`Disconnect ${microsoftEmail}`}
labelStyle={styles.addCalLbl}
labelProps={{
numberOfLines: 2
}}
iconSource={() => (
<View marginR-15>
<OutlookIcon/>
</View>
)}
style={styles.addCalBtn}
color="black"
text70BL
/>
}) : null}
{(profileData?.googleMail || profileData?.outlookMail || profileData?.appleMail) && ( {(isConnectedToGoogle || isConnectedToMicrosoft || isConnectedToApple) && (
<> <>
<Text style={styles.subTitle} marginT-30 marginB-20> <Text style={styles.subTitle} marginT-30 marginB-20>
Connected Calendars Connected Calendars
@ -434,111 +542,113 @@ const CalendarSettingsPage = (props: {
<View style={styles.noPaddingCard}> <View style={styles.noPaddingCard}>
<View style={{marginTop: 20}}> <View style={{marginTop: 20}}>
{!!profileData?.googleMail && ( {profileData?.googleAccounts && Object.keys(profileData?.googleAccounts)?.map((googleEmail) => {
<TouchableOpacity const googleToken = profileData?.googleAccounts?.[googleEmail];
onPress={() => fetchAndSaveGoogleEvents({ return googleToken && (
token: profileData?.googleToken!, <TouchableOpacity
email: profileData?.googleMail! onPress={() => fetchAndSaveGoogleEvents({token: googleToken, email: googleEmail})}
})} >
> <View row paddingR-20 center>
<View row paddingR-20 center> <Button
<Button disabled={isSyncingGoogle}
disabled={isSyncingGoogle} onPress={() => fetchAndSaveGoogleEvents({token: googleToken, email: googleEmail})}
onPress={() => fetchAndSaveGoogleEvents({ label={`Sync ${googleEmail}`}
token: profileData?.googleToken!, labelStyle={styles.addCalLbl}
email: profileData?.googleMail! labelProps={{numberOfLines: 3}}
})} iconSource={() => (
label={`Sync ${profileData?.googleMail}`} <View marginR-15>
labelStyle={styles.addCalLbl} <GoogleIcon/>
labelProps={{numberOfLines: 3}} </View>
iconSource={() => ( )}
<View marginR-15> style={styles.addCalBtn}
<GoogleIcon/> color="black"
</View> text70BL
/>
{isSyncingGoogle ? (
<ActivityIndicator/>
) : (
<Ionicons name={"refresh"} size={20} color={"#000000"}/>
)} )}
style={styles.addCalBtn} </View>
color="black" </TouchableOpacity>
text70BL )
/> })}
{isSyncingGoogle ? ( {profileData?.appleAccounts && Object.keys(profileData?.appleAccounts)?.map((appleEmail) => {
<ActivityIndicator/> const appleToken = profileData?.appleAccounts?.[appleEmail];
) : ( return appleToken && (
<Ionicons name={"refresh"} size={20} color={"#000000"}/> <TouchableOpacity
)} onPress={() => fetchAndSaveAppleEvents({
</View> email: appleEmail,
</TouchableOpacity> token: appleToken
)} })}>
<View row paddingR-20 center>
<Button
{!!profileData?.appleMail && ( disabled={isSyncingApple}
<TouchableOpacity onPress={() => fetchAndSaveAppleEvents({
onPress={() => fetchAndSaveAppleEvents({ email: appleEmail,
email: profileData?.appleMail!, token: appleToken
token: profileData?.appleToken! })}
})}> label={`Sync ${appleEmail}`}
<View row paddingR-20 center> labelStyle={styles.addCalLbl}
<Button labelProps={{numberOfLines: 3}}
disabled={isSyncingApple} iconSource={() => (
onPress={() => fetchAndSaveAppleEvents({ <View marginR-15>
email: profileData?.appleMail!, <AppleIcon/>
token: profileData?.appleToken! </View>
})} )}
label={`Sync ${profileData?.appleMail}`} style={styles.addCalBtn}
labelStyle={styles.addCalLbl} color="black"
labelProps={{numberOfLines: 3}} text70BL
iconSource={() => ( />
<View marginR-15> {isSyncingApple ? (
<AppleIcon/> <ActivityIndicator/>
</View> ) : (
<Ionicons name={"refresh"} size={20} color={"#000000"}/>
)} )}
style={styles.addCalBtn} </View>
color="black" </TouchableOpacity>
text70BL )
/> })}
{isSyncingApple ? (
<ActivityIndicator/>
) : (
<Ionicons name={"refresh"} size={20} color={"#000000"}/>
)}
</View>
</TouchableOpacity>
)}
{!!profileData?.outlookMail && ( {profileData?.microsoftAccounts && Object.keys(profileData?.microsoftAccounts)?.map((microsoftEmail) => {
<TouchableOpacity const microsoftToken = profileData?.microsoftAccounts?.[microsoftEmail];
onPress={() => fetchAndSaveOutlookEvents({ return microsoftToken && (
token: profileData?.microsoftToken!, <TouchableOpacity
email: profileData?.outlookMail! onPress={() => fetchAndSaveOutlookEvents({
})} token: microsoftToken,
> email: microsoftEmail
<View row paddingR-20 center> })}
<Button >
disabled={isSyncingOutlook} <View row paddingR-20 center>
onPress={() => fetchAndSaveOutlookEvents({ <Button
token: profileData?.microsoftToken!, disabled={isSyncingOutlook}
email: profileData?.outlookMail! onPress={() => fetchAndSaveOutlookEvents({
})} token: microsoftToken,
label={`Sync ${profileData?.outlookMail}`} email: microsoftEmail
labelStyle={styles.addCalLbl} })}
labelProps={{numberOfLines: 3}} label={`Sync ${microsoftEmail}`}
iconSource={() => ( labelStyle={styles.addCalLbl}
<View marginR-15> labelProps={{numberOfLines: 3}}
<OutlookIcon/> iconSource={() => (
</View> <View marginR-15>
<OutlookIcon/>
</View>
)}
style={styles.addCalBtn}
color="black"
text70BL
/>
{isSyncingOutlook ? (
<ActivityIndicator/>
) : (
<Ionicons name={"refresh"} size={20} color={"#000000"}/>
)} )}
style={styles.addCalBtn} </View>
color="black" </TouchableOpacity>
text70BL )
/> })}
{isSyncingOutlook ? (
<ActivityIndicator/>
) : (
<Ionicons name={"refresh"} size={20} color={"#000000"}/>
)}
</View>
</TouchableOpacity>
)}
</View> </View>
</View> </View>
</> </>

View File

@ -174,7 +174,7 @@ const MyGroup = () => {
padding-10 padding-10
> >
<Avatar <Avatar
source={{uri: "https://via.placeholder.com/60"}} source={{uri: member?.pfp ?? undefined}}
size={40} size={40}
backgroundColor={Colors.grey60} backgroundColor={Colors.grey60}
/> />
@ -213,7 +213,7 @@ const MyGroup = () => {
padding-10 padding-10
> >
<Avatar <Avatar
source={{uri: "https://via.placeholder.com/60"}} source={{uri: member?.pfp ?? undefined}}
size={40} size={40}
backgroundColor={Colors.grey60} backgroundColor={Colors.grey60}
/> />

View File

@ -1,30 +1,34 @@
import {Colors, Picker, Text, TextField, View} from "react-native-ui-lib";
import React, {useEffect, useRef, useState} from "react"; import React, {useEffect, useRef, useState} from "react";
import {ImageBackground, StyleSheet} from "react-native"; import {StyleSheet, TouchableOpacity} from "react-native";
import {ScrollView} from "react-native-gesture-handler"; import {ScrollView} from "react-native-gesture-handler";
import * as ImagePicker from "expo-image-picker";
import {Colors, Image, Picker, Text, TextField, View} from "react-native-ui-lib";
import Ionicons from "@expo/vector-icons/Ionicons";
import * as tz from "tzdata";
import * as Localization from "expo-localization";
import debounce from "debounce";
import {useAuthContext} from "@/contexts/AuthContext"; import {useAuthContext} from "@/contexts/AuthContext";
import {useUpdateUserData} from "@/hooks/firebase/useUpdateUserData"; import {useUpdateUserData} from "@/hooks/firebase/useUpdateUserData";
import Ionicons from "@expo/vector-icons/Ionicons"; import {useChangeProfilePicture} from "@/hooks/firebase/useChangeProfilePicture";
import * as tz from 'tzdata';
import * as Localization from 'expo-localization';
import debounce from "debounce";
const MyProfile = () => { const MyProfile = () => {
const {user, profileData} = useAuthContext(); const {user, profileData} = useAuthContext();
const [timeZone, setTimeZone] = useState<string>(
const [timeZone, setTimeZone] = useState<string>(profileData?.timeZone! ?? Localization.getCalendars()[0].timeZone); profileData?.timeZone! ?? Localization.getCalendars()[0].timeZone
);
const [lastName, setLastName] = useState<string>(profileData?.lastName || ""); const [lastName, setLastName] = useState<string>(profileData?.lastName || "");
const [firstName, setFirstName] = useState<string>( const [firstName, setFirstName] = useState<string>(
profileData?.firstName || "" profileData?.firstName || ""
); );
const [profileImage, setProfileImage] = useState<string | ImagePicker.ImagePickerAsset | null>(profileData?.pfp || null);
const {mutateAsync: updateUserData} = useUpdateUserData(); const {mutateAsync: updateUserData} = useUpdateUserData();
const {mutateAsync: changeProfilePicture} = useChangeProfilePicture();
const isFirstRender = useRef(true); const isFirstRender = useRef(true);
const handleUpdateUserData = async () => { const handleUpdateUserData = async () => {
await updateUserData({newUserData: {firstName, lastName, timeZone}}); await updateUserData({newUserData: {firstName, lastName, timeZone}});
} };
const debouncedUserDataUpdate = debounce(handleUpdateUserData, 500); const debouncedUserDataUpdate = debounce(handleUpdateUserData, 500);
@ -34,22 +38,68 @@ const MyProfile = () => {
return; return;
} }
debouncedUserDataUpdate(); debouncedUserDataUpdate();
}, [timeZone, lastName, firstName]); }, [timeZone, lastName, firstName, profileImage]);
useEffect(() => {
if (profileData) {
setFirstName(profileData.firstName || "");
setLastName(profileData.lastName || "");
// setProfileImage(profileData.pfp || null);
setTimeZone(profileData.timeZone || Localization.getCalendars()[0].timeZone!);
}
}, [profileData]);
const pickImage = async () => {
const permissionResult = await ImagePicker.requestMediaLibraryPermissionsAsync();
if (!permissionResult.granted) {
alert("Permission to access camera roll is required!");
return;
}
const result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.Images,
allowsEditing: true,
aspect: [1, 1],
quality: 1,
});
if (!result.canceled) {
setProfileImage(result.assets[0].uri);
changeProfilePicture(result.assets[0])
}
};
const handleClearImage = async () => {
await updateUserData({newUserData: {pfp: null}});
setProfileImage(null)
}
const pfpUri = profileImage && typeof profileImage === 'object' && 'uri' in profileImage ? profileImage.uri : profileImage;
return ( return (
<ScrollView style={{paddingBottom: 100, flex: 1}}> <ScrollView style={{paddingBottom: 100, flex: 1}}>
<View style={styles.card}> <View style={styles.card}>
<Text style={styles.subTit}>Your Profile</Text> <Text style={styles.subTit}>Your Profile</Text>
<View row spread paddingH-15 centerV marginV-15> <View row spread paddingH-15 centerV marginV-15>
<ImageBackground <TouchableOpacity onPress={pickImage}>
style={styles.pfp} <Image
source={require("../../../../assets/images/profile-picture.png")} key={pfpUri}
/> style={styles.pfp}
source={pfpUri ? {uri: pfpUri} : null}
/>
</TouchableOpacity>
<Text style={styles.photoSet} color="#50be0c"> <TouchableOpacity onPress={pickImage}>
Change Photo <Text style={styles.photoSet} color="#50be0c" onPress={pickImage}>
</Text> {profileData?.pfp ? "Change" : "Add"} Photo
<Text style={styles.photoSet}>Remove Photo</Text> </Text>
</TouchableOpacity>
{profileData?.pfp && (
<TouchableOpacity onPress={handleClearImage}>
<Text style={styles.photoSet}>Remove Photo</Text>
</TouchableOpacity>
)}
</View> </View>
<View paddingH-15> <View paddingH-15>
<Text text80 marginT-10 marginB-7 style={styles.label}> <Text text80 marginT-10 marginB-7 style={styles.label}>
@ -94,24 +144,27 @@ const MyProfile = () => {
<Text style={styles.jakarta12}>Time Zone</Text> <Text style={styles.jakarta12}>Time Zone</Text>
<View style={styles.viewPicker}> <View style={styles.viewPicker}>
<Picker <Picker
// editable={!isLoading}
value={timeZone} value={timeZone}
onChange={(item) => { onChange={(item) => setTimeZone(item as string)}
setTimeZone(item as string)
}}
showSearch showSearch
floatingPlaceholder floatingPlaceholder
style={styles.inViewPicker} style={styles.inViewPicker}
trailingAccessory={ trailingAccessory={
<View style={{ <View
justifyContent: "center", style={{
alignItems: "center", justifyContent: "center",
height: "100%", alignItems: "center",
marginTop: -38, height: "100%",
paddingRight: 15 marginTop: -38,
}}> paddingRight: 15,
<Ionicons name={"chevron-down"} style={{alignSelf: "center"}} size={20} }}
color={"#000000"}/> >
<Ionicons
name={"chevron-down"}
style={{alignSelf: "center"}}
size={20}
color={"#000000"}
/>
</View> </View>
} }
> >
@ -123,9 +176,11 @@ const MyProfile = () => {
); );
}; };
const timeZoneItems = Object.keys(tz.zones).sort().map((zone) => ( const timeZoneItems = Object.keys(tz.zones)
<Picker.Item key={zone} label={zone.replace("/", " / ").replace("_", " ")} value={zone}/> .sort()
)); .map((zone) => (
<Picker.Item key={zone} label={zone.replace("/", " / ").replace("_", " ")} value={zone}/>
));
const styles = StyleSheet.create({ const styles = StyleSheet.create({
card: { card: {
@ -139,7 +194,7 @@ const styles = StyleSheet.create({
pfp: { pfp: {
aspectRatio: 1, aspectRatio: 1,
width: 65.54, width: 65.54,
backgroundColor: "green", backgroundColor: "gray",
borderRadius: 20, borderRadius: 20,
}, },
txtBox: { txtBox: {
@ -150,7 +205,7 @@ const styles = StyleSheet.create({
padding: 15, padding: 15,
height: 45, height: 45,
fontFamily: "PlusJakartaSans_500Medium", fontFamily: "PlusJakartaSans_500Medium",
fontSize: 13 fontSize: 13,
}, },
subTit: { subTit: {
fontFamily: "Manrope_500Medium", fontFamily: "Manrope_500Medium",
@ -159,11 +214,11 @@ const styles = StyleSheet.create({
label: { label: {
fontFamily: "PlusJakartaSans_500Medium", fontFamily: "PlusJakartaSans_500Medium",
fontSize: 12, fontSize: 12,
color: "#a1a1a1" color: "#a1a1a1",
}, },
photoSet: { photoSet: {
fontFamily: "PlusJakartaSans_500Medium", fontFamily: "PlusJakartaSans_500Medium",
fontSize: 13.07 fontSize: 13.07,
}, },
jakarta12: { jakarta12: {
paddingVertical: 10, paddingVertical: 10,
@ -171,18 +226,6 @@ const styles = StyleSheet.create({
fontSize: 12, fontSize: 12,
color: "#a1a1a1", color: "#a1a1a1",
}, },
picker: {
borderRadius: 50,
paddingVertical: 12,
paddingHorizontal: 16,
backgroundColor: Colors.grey80,
marginBottom: 16,
borderColor: Colors.grey50,
borderWidth: 1,
marginTop: -20,
height: 40,
zIndex: 10,
},
viewPicker: { viewPicker: {
borderRadius: 50, borderRadius: 50,
backgroundColor: Colors.grey80, backgroundColor: Colors.grey80,

View File

@ -1,64 +1,56 @@
import { StyleSheet } from "react-native"; import {StyleSheet} from "react-native";
import React, { useState } from "react"; import React, {useState} from "react";
import { Button, ButtonSize, Text, View } from "react-native-ui-lib"; import {Button, ButtonSize, Text, View} from "react-native-ui-lib";
import { AntDesign } from "@expo/vector-icons"; import {AntDesign} from "@expo/vector-icons";
import LinearGradient from "react-native-linear-gradient"; import LinearGradient from "react-native-linear-gradient";
import AddChoreDialog from "./AddChoreDialog"; import AddChoreDialog from "./AddChoreDialog";
const AddChore = () => { const AddChore = () => {
const [isVisible, setIsVisible] = useState<boolean>(false);
const [isVisible, setIsVisible] = useState<boolean>(false); return (
<LinearGradient
return ( colors={["#f9f8f700", "#f9f8f7", "#f9f8f700"]}
<LinearGradient locations={[0, 0.5, 1]}
colors={["transparent", "#f9f8f7"]} style={styles.gradient}
locations={[0, 0.5]}
style={styles.gradient}
>
<View style={styles.buttonContainer}>
<Button
marginH-25
size={ButtonSize.large}
style={styles.button}
onPress={() => setIsVisible(!isVisible)}
> >
<AntDesign name="plus" size={24} color="white" /> <View style={styles.buttonContainer}>
<Text white text60R marginL-10> <Button
Add To Do marginH-25
</Text> size={ButtonSize.large}
</Button> style={styles.button}
</View> onPress={() => setIsVisible(!isVisible)}
<AddChoreDialog isVisible={isVisible} setIsVisible={setIsVisible} /> >
</LinearGradient> <AntDesign name="plus" size={24} color="white"/>
); <Text white text60R marginL-10>
Create new to do
</Text>
</Button>
</View>
<AddChoreDialog isVisible={isVisible} setIsVisible={setIsVisible}/>
</LinearGradient>
);
}; };
export default AddChore; export default AddChore;
const styles = StyleSheet.create({ const styles = StyleSheet.create({
divider: { height: 1, backgroundColor: "#e4e4e4", marginVertical: 15 }, gradient: {
gradient: { height: 150,
height: "25%", position: "absolute",
position: "absolute", bottom: 0,
bottom: 0, width: "100%",
width: "100%", justifyContent: "center",
}, alignItems: "center",
buttonContainer: { },
position: "absolute", buttonContainer: {
bottom: 25, width: "100%",
width: "100%", alignItems: "center",
}, },
button: { button: {
backgroundColor: "rgb(253, 23, 117)", backgroundColor: "rgb(253, 23, 117)",
paddingVertical: 20, paddingVertical: 15,
}, paddingHorizontal: 30,
topBtn: { borderRadius: 30,
backgroundColor: "white", },
color: "#05a8b6",
},
rotateSwitch: {
marginLeft: 35,
marginBottom: 10,
marginTop: 25,
},
}); });

View File

@ -1,4 +1,4 @@
import { View, Text, Button, Switch } from "react-native-ui-lib"; import {View, Text, Button, Switch, PickerModes} from "react-native-ui-lib";
import React, { useRef, useState } from "react"; import React, { useRef, useState } from "react";
import PointsSlider from "@/components/shared/PointsSlider"; import PointsSlider from "@/components/shared/PointsSlider";
import { repeatOptions, useToDosContext } from "@/contexts/ToDosContext"; import { repeatOptions, useToDosContext } from "@/contexts/ToDosContext";
@ -15,6 +15,7 @@ import { Dimensions, StyleSheet } from "react-native";
import DropModalIcon from "@/assets/svgs/DropModalIcon"; import DropModalIcon from "@/assets/svgs/DropModalIcon";
import { IToDo } from "@/hooks/firebase/types/todoData"; import { IToDo } from "@/hooks/firebase/types/todoData";
import AssigneesDisplay from "@/components/shared/AssigneesDisplay"; import AssigneesDisplay from "@/components/shared/AssigneesDisplay";
import {useGetFamilyMembers} from "@/hooks/firebase/useGetFamilyMembers";
interface IAddChoreDialog { interface IAddChoreDialog {
isVisible: boolean; isVisible: boolean;
@ -29,6 +30,7 @@ const defaultTodo = {
date: new Date(), date: new Date(),
rotate: false, rotate: false,
repeatType: "Every week", repeatType: "Every week",
assignees: []
}; };
const AddChoreDialog = (addChoreDialogProps: IAddChoreDialog) => { const AddChoreDialog = (addChoreDialogProps: IAddChoreDialog) => {
@ -36,12 +38,15 @@ const AddChoreDialog = (addChoreDialogProps: IAddChoreDialog) => {
const [todo, setTodo] = useState<IToDo>( const [todo, setTodo] = useState<IToDo>(
addChoreDialogProps.selectedTodo ?? defaultTodo addChoreDialogProps.selectedTodo ?? defaultTodo
); );
const [selectedAssignees, setSelectedAssignees] = useState<string[]>(addChoreDialogProps?.selectedTodo?.assignees ?? []);
const { width, height } = Dimensions.get("screen"); const { width, height } = Dimensions.get("screen");
const [points, setPoints] = useState<number>(todo.points); const [points, setPoints] = useState<number>(todo.points);
const {data: members} = useGetFamilyMembers();
const handleClose = () => { const handleClose = () => {
setTodo(defaultTodo); setTodo(defaultTodo);
setSelectedAssignees([]);
addChoreDialogProps.setIsVisible(false); addChoreDialogProps.setIsVisible(false);
}; };
@ -95,12 +100,13 @@ const AddChoreDialog = (addChoreDialogProps: IAddChoreDialog) => {
onPress={() => { onPress={() => {
try { try {
if (addChoreDialogProps.selectedTodo) { if (addChoreDialogProps.selectedTodo) {
updateToDo({ ...todo, points: points }); updateToDo({ ...todo, points: points, assignees: selectedAssignees });
} else { } else {
addToDo({ addToDo({
...todo, ...todo,
done: false, done: false,
points: points, points: points,
assignees: selectedAssignees
}); });
} }
handleClose(); handleClose();
@ -182,25 +188,46 @@ const AddChoreDialog = (addChoreDialogProps: IAddChoreDialog) => {
<Text text70R marginL-10> <Text text70R marginL-10>
Assignees Assignees
</Text> </Text>
<Button <View flex-1/>
size={ButtonSize.small} <Picker
paddingH-8 marginL-8
iconSource={() => ( value={selectedAssignees}
<Ionicons name="add-outline" size={20} color="#ea156c" /> onChange={(value) => {
)} setSelectedAssignees([...selectedAssignees, ...value]);
style={{ }}
marginLeft: "auto", style={{ marginVertical: 5 }}
borderRadius: 8, mode={PickerModes.MULTI}
backgroundColor: "#ffe8f1", renderInput={() =>
borderColor: "#ea156c", <Button
borderWidth: 1, size={ButtonSize.small}
}} paddingH-8
color="#ea156c" iconSource={() => (
label="Assign" <Ionicons name="add-outline" size={20} color="#ea156c"/>
/> )}
style={{
marginLeft: "auto",
borderRadius: 8,
backgroundColor: "#ffe8f1",
borderColor: "#ea156c",
borderWidth: 1,
}}
color="#ea156c"
label="Assign"
labelStyle={{fontFamily: "Manrope_600SemiBold", fontSize: 14}}
/>
}
>
{members?.map((member) => (
<Picker.Item
key={member.uid}
label={member?.firstName + " " + member?.lastName}
value={member?.uid!}
/>
))}
</Picker>
</View> </View>
<View row marginL-27 marginT-0> <View row marginL-27 marginT-0>
<AssigneesDisplay /> <AssigneesDisplay selectedAttendees={selectedAssignees} setSelectedAttendees={setSelectedAssignees}/>
</View> </View>
<View row centerV style={styles.rotateSwitch}> <View row centerV style={styles.rotateSwitch}>
<Text text80>Take Turns</Text> <Text text80>Take Turns</Text>

View File

@ -17,7 +17,7 @@ import AddChoreDialog from "@/components/pages/todos/AddChoreDialog";
const ToDoItem = (props: { item: IToDo; isSettings?: boolean }) => { const ToDoItem = (props: { item: IToDo; isSettings?: boolean }) => {
const { updateToDo } = useToDosContext(); const { updateToDo } = useToDosContext();
const [editing, setEditing] = useState<boolean>(false); const [visible, setVisible] = useState<boolean>(false);
const [points, setPoints] = useState(props.item.points); const [points, setPoints] = useState(props.item.points);
const [pointsModalVisible, setPointsModalVisible] = useState<boolean>(false); const [pointsModalVisible, setPointsModalVisible] = useState<boolean>(false);
@ -42,7 +42,7 @@ const ToDoItem = (props: { item: IToDo; isSettings?: boolean }) => {
opacity: props.item.done ? 0.3 : 1, opacity: props.item.done ? 0.3 : 1,
}} }}
> >
<AddChoreDialog isVisible={editing} setIsVisible={setEditing} selectedTodo={props.item}/> {visible && <AddChoreDialog isVisible={visible} setIsVisible={setVisible} selectedTodo={props.item}/>}
<View paddingB-8 row spread> <View paddingB-8 row spread>
<Text <Text
text70 text70
@ -52,7 +52,7 @@ const ToDoItem = (props: { item: IToDo; isSettings?: boolean }) => {
fontSize: 15, fontSize: 15,
}} }}
onPress={() => { onPress={() => {
setEditing(true); setVisible(true);
}} }}
> >
{props.item.title} {props.item.title}

View File

@ -1,79 +1,83 @@
import { View, Text, Button, ButtonSize } from "react-native-ui-lib"; import {Button, Text, View} from "react-native-ui-lib";
import React, { useState } from "react"; import React, {useState} from "react";
import HeaderTemplate from "@/components/shared/HeaderTemplate"; import HeaderTemplate from "@/components/shared/HeaderTemplate";
import AddChore from "./AddChore"; import AddChore from "./AddChore";
import ProgressCard from "./ProgressCard"; import ProgressCard from "./ProgressCard";
import ToDosList from "./ToDosList"; import ToDosList from "./ToDosList";
import { Dimensions, ScrollView } from "react-native"; import {Dimensions, ScrollView, StyleSheet} from "react-native";
import { StyleSheet } from "react-native"; import {TouchableOpacity} from "react-native-gesture-handler";
import { TouchableOpacity } from "react-native-gesture-handler"; import {ProfileType, useAuthContext} from "@/contexts/AuthContext";
import { ProfileType, useAuthContext } from "@/contexts/AuthContext";
import FamilyChoresProgress from "./family-chores/FamilyChoresProgress"; import FamilyChoresProgress from "./family-chores/FamilyChoresProgress";
import UserChoresProgress from "./user-chores/UserChoresProgress"; import UserChoresProgress from "./user-chores/UserChoresProgress";
const ToDosPage = () => { const ToDosPage = () => {
const [pageIndex, setPageIndex] = useState<number>(0); const [pageIndex, setPageIndex] = useState<number>(0);
const { profileData } = useAuthContext(); const {profileData} = useAuthContext();
const { width, height } = Dimensions.get("screen"); const {width, height} = Dimensions.get("screen");
const pageLink = ( const pageLink = (
<TouchableOpacity onPress={() => setPageIndex(1)}> <TouchableOpacity onPress={() => setPageIndex(1)}>
<Text color="#ea156d" style={{ fontSize: 14 }}> <Text color="#ea156d" style={{fontSize: 14}}>
View family progress View family progress
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
); );
return ( return (
<View paddingH-25 backgroundColor="#f9f8f7" height={"100%"} width={width}> <>
{pageIndex == 0 && ( <View paddingH-25 backgroundColor="#f9f8f7" height={"100%"} width={width}>
<View> {pageIndex == 0 && (
<ScrollView <View>
showsVerticalScrollIndicator={false} <ScrollView
showsHorizontalScrollIndicator={false} showsVerticalScrollIndicator={false}
> showsHorizontalScrollIndicator={false}
<View>
<HeaderTemplate
message="Here are your To Do's"
isWelcome={true}
link={profileData?.userType == ProfileType.PARENT && pageLink}
/>
{profileData?.userType == ProfileType.CHILD && (
<View marginB-25>
<ProgressCard
children={
<Button
backgroundColor="transparent"
onPress={() => setPageIndex(2)}
>
<Text
style={{
textDecorationLine: "underline",
color: "#05a8b6",
}}
> >
View your full progress report here <View>
</Text> <HeaderTemplate
</Button> message="Here are your To Do's"
} isWelcome={true}
/> link={profileData?.userType == ProfileType.PARENT && pageLink}
</View> />
)} {profileData?.userType == ProfileType.CHILD && (
<ToDosList /> <View marginB-25>
<ProgressCard
children={
<Button
backgroundColor="transparent"
onPress={() => setPageIndex(2)}
>
<Text
style={{
textDecorationLine: "underline",
color: "#05a8b6",
}}
>
View your full progress report here
</Text>
</Button>
}
/>
</View>
)}
<ToDosList/>
</View>
</ScrollView>
</View>
)}
{pageIndex == 1 && <FamilyChoresProgress setPageIndex={setPageIndex}/>}
{pageIndex == 2 && <UserChoresProgress setPageIndex={setPageIndex}/>}
</View> </View>
</ScrollView> {
{profileData?.userType == ProfileType.PARENT && <AddChore />} profileData?.userType == ProfileType.PARENT && <AddChore/>
</View> }
)} </>
{pageIndex == 1 && <FamilyChoresProgress setPageIndex={setPageIndex} />} )
{pageIndex == 2 && <UserChoresProgress setPageIndex={setPageIndex} />} ;
</View>
);
}; };
const styles = StyleSheet.create({ const styles = StyleSheet.create({
linkBtn: { linkBtn: {
backgroundColor: "transparent", backgroundColor: "transparent",
padding: 0, padding: 0,
}, },
}); });
export default ToDosPage; export default ToDosPage;

View File

@ -1,23 +1,23 @@
import React from "react"; import React from "react";
import {ImageBackground, StyleSheet} from "react-native"; import {StyleSheet} from "react-native";
import {Text, TouchableOpacity, View} from "react-native-ui-lib"; import {Image, Text, TouchableOpacity, View} from "react-native-ui-lib";
import RemoveAssigneeBtn from "./RemoveAssigneeBtn"; import RemoveAssigneeBtn from "./RemoveAssigneeBtn";
import {useGetFamilyMembers} from "@/hooks/firebase/useGetFamilyMembers"; import {useGetFamilyMembers} from "@/hooks/firebase/useGetFamilyMembers";
const AssigneesDisplay = ({selectedAttendees, setSlectedAttendees}: { const AssigneesDisplay = ({selectedAttendees, setSelectedAttendees}: {
selectedAttendees: string[], selectedAttendees: string[],
setSlectedAttendees: (value: React.SetStateAction<string[]>) => void setSelectedAttendees: (value: React.SetStateAction<string[]>) => void
}) => { }) => {
const {data: members} = useGetFamilyMembers(true); const {data: members} = useGetFamilyMembers(true);
const selectedMembers = members?.filter((x) => selectedAttendees.includes(x?.uid!)); const selectedMembers = members?.filter((x) => selectedAttendees?.includes(x?.uid!));
const getInitials = (firstName: string, lastName: string) => { const getInitials = (firstName: string, lastName: string) => {
return `${firstName.charAt(0)}${lastName.charAt(0)}`; return `${firstName.charAt(0)}${lastName.charAt(0)}`;
}; };
const removeAttendee = (uid: string) => { const removeAttendee = (uid: string) => {
setSlectedAttendees((prev) => prev.filter((x) => x !== uid)); setSelectedAttendees((prev) => prev.filter((x) => x !== uid));
} }
return ( return (
@ -26,7 +26,7 @@ const AssigneesDisplay = ({selectedAttendees, setSlectedAttendees}: {
<TouchableOpacity key={member.uid} style={styles.assigneeWrapper} <TouchableOpacity key={member.uid} style={styles.assigneeWrapper}
onPress={() => removeAttendee(member.uid!)}> onPress={() => removeAttendee(member.uid!)}>
{member?.pfp ? ( {member?.pfp ? (
<ImageBackground <Image
source={{uri: member?.pfp}} source={{uri: member?.pfp}}
style={styles.image} style={styles.image}
children={<RemoveAssigneeBtn/>} children={<RemoveAssigneeBtn/>}
@ -42,7 +42,7 @@ const AssigneesDisplay = ({selectedAttendees, setSlectedAttendees}: {
</TouchableOpacity> </TouchableOpacity>
))} ))}
{selectedAttendees.length === 0 && <Text>No attendees added</Text>} {selectedAttendees?.length === 0 && <Text>No attendees added</Text>}
</View> </View>
); );
}; };

View File

@ -188,31 +188,47 @@ exports.refreshTokens = functions.pubsub.schedule('every 12 hours').onRun(async
profilesSnapshot.forEach(async (profileDoc) => { profilesSnapshot.forEach(async (profileDoc) => {
const profileData = profileDoc.data(); const profileData = profileDoc.data();
if (profileData.googleToken) { if (profileData.googleAccounts) {
try { try {
const refreshedGoogleToken = await refreshGoogleToken(profileData.googleToken); for (const googleEmail of Object.keys(profileData?.googleAccounts)) {
await profileDoc.ref.update({googleToken: refreshedGoogleToken}); const googleToken = profileData?.googleAccounts?.[googleEmail];
console.log(`Google token updated for user ${profileDoc.id}`); if (googleToken) {
const refreshedGoogleToken = await refreshGoogleToken(googleToken);
const updatedGoogleAccounts = {...profileData.googleAccounts, [googleEmail]: refreshedGoogleToken};
await profileDoc.ref.update({googleAccounts: updatedGoogleAccounts});
console.log(`Google token updated for user ${profileDoc.id}`);
}
}
} catch (error) { } catch (error) {
console.error(`Error refreshing Google token for user ${profileDoc.id}:`, error.message); console.error(`Error refreshing Google token for user ${profileDoc.id}:`, error.message);
} }
} }
if (profileData.microsoftToken) { if (profileData.microsoftAccounts) {
try { try {
const refreshedMicrosoftToken = await refreshMicrosoftToken(profileData.microsoftToken); for (const microsoftEmail of Object.keys(profileData?.microsoftAccounts)) {
await profileDoc.ref.update({microsoftToken: refreshedMicrosoftToken}); const microsoftToken = profileData?.microsoftAccounts?.[microsoftEmail];
console.log(`Microsoft token updated for user ${profileDoc.id}`); if (microsoftToken) {
const refreshedMicrosoftToken = await refreshMicrosoftToken(microsoftToken);
const updatedMicrosoftAccounts = {...profileData.microsoftAccounts, [microsoftEmail]: refreshedMicrosoftToken};
await profileDoc.ref.update({microsoftAccounts: updatedMicrosoftAccounts});
console.log(`Microsoft token updated for user ${profileDoc.id}`);
}
}
} catch (error) { } catch (error) {
console.error(`Error refreshing Microsoft token for user ${profileDoc.id}:`, error.message); console.error(`Error refreshing Microsoft token for user ${profileDoc.id}:`, error.message);
} }
} }
if (profileData.appleToken) { if (profileData.appleAccounts) {
try { try {
const refreshedAppleToken = await refreshAppleToken(profileData.appleToken); for (const appleEmail of Object.keys(profileData?.appleAccounts)) {
await profileDoc.ref.update({appleToken: refreshedAppleToken}); const appleToken = profileData?.appleAccounts?.[appleEmail];
console.log(`Apple token updated for user ${profileDoc.id}`); const refreshedAppleToken = await refreshAppleToken(appleToken);
const updatedAppleAccounts = {...profileData.appleAccounts, [appleEmail]: refreshedAppleToken};
await profileDoc.ref.update({appleAccunts: updatedAppleAccounts});
console.log(`Apple token updated for user ${profileDoc.id}`);
}
} catch (error) { } catch (error) {
console.error(`Error refreshing Apple token for user ${profileDoc.id}:`, error.message); console.error(`Error refreshing Apple token for user ${profileDoc.id}:`, error.message);
} }

View File

@ -17,16 +17,13 @@ export interface UserProfile {
password: string; password: string;
familyId?: string; familyId?: string;
uid?: string; uid?: string;
pfp?: string; pfp?: string | null;
googleToken?: string | null;
microsoftToken?: string | null;
appleToken?: string | null;
eventColor?: string | null; eventColor?: string | null;
googleMail?: string | null;
outlookMail?: string | null;
appleMail?: string | null;
timeZone?: string | null; timeZone?: string | null;
firstDayOfWeek?: string | null; firstDayOfWeek?: string | null;
googleAccounts?: Object;
microsoftAccounts?: Object;
appleAccounts?: Object;
} }
export interface ParentProfile extends UserProfile { export interface ParentProfile extends UserProfile {

View File

@ -7,5 +7,6 @@ export interface IToDo {
rotate: boolean; rotate: boolean;
repeatType: string; repeatType: string;
creatorId?: string, creatorId?: string,
familyId?: string familyId?: string,
assignees?: string[]; // Optional list of assignees
} }

View File

@ -0,0 +1,57 @@
import { useMutation, useQueryClient } from "react-query";
import firestore from "@react-native-firebase/firestore";
import storage from "@react-native-firebase/storage";
import { useAuthContext } from "@/contexts/AuthContext";
import * as ImagePicker from "expo-image-picker";
import { Platform } from "react-native";
export const useChangeProfilePicture = () => {
const queryClient = useQueryClient();
const { user, refreshProfileData } = useAuthContext();
return useMutation({
mutationKey: ["changeProfilePicture"],
mutationFn: async (profilePicture: ImagePicker.ImagePickerAsset) => {
if (!profilePicture?.uri) {
throw new Error("No image selected");
}
let imageUri = profilePicture.uri;
console.log("Selected image URI:", imageUri);
if (Platform.OS === 'ios' && !imageUri.startsWith('file://')) {
imageUri = `file://${imageUri}`;
console.log("Updated image URI for iOS:", imageUri);
}
const fileName = `profilePictures/${new Date().getTime()}_profile.jpg`;
console.log("Firebase Storage file path:", fileName);
try {
const reference = storage().ref(fileName);
console.log('Uploading image to Firebase Storage...');
await reference.putFile(imageUri);
console.log('Image uploaded successfully!');
const downloadURL = await reference.getDownloadURL();
console.log("Download URL:", downloadURL);
await firestore()
.collection("Profiles")
.doc(user?.uid)
.update({ pfp: downloadURL });
} catch (e) {
console.error("Error uploading profile picture:", e.message);
throw e;
}
},
onSuccess: () => {
// Invalidate queries to refresh profile data
queryClient.invalidateQueries("Profiles");
refreshProfileData();
},
});
};

View File

@ -15,10 +15,24 @@ export const useGetFamilyMembers = (excludeSelf?: boolean) => {
.get(); .get();
if (excludeSelf) { if (excludeSelf) {
return snapshot.docs.map((doc) => doc.data()).filter((doc) => doc.id !== user?.uid) as UserProfile[]; return snapshot.docs.map((doc) => {
let documentData = doc.data();
return {
...documentData,
uid: doc.id
}
}).filter((doc) => doc.id !== user?.uid) as UserProfile[];
} }
return snapshot.docs.map((doc) => doc.data()) as UserProfile[]; return snapshot.docs.map((doc) => {
let documentData = doc.data();
return {
...documentData,
uid: doc.id
}
}) as UserProfile[];
} }
}) })
} }

View File

@ -1,6 +1,8 @@
import { useQuery } from "react-query"; import { useQuery } from "react-query";
import firestore from "@react-native-firebase/firestore"; import firestore from "@react-native-firebase/firestore";
import { useAuthContext } from "@/contexts/AuthContext"; import { useAuthContext } from "@/contexts/AuthContext";
import {UserProfile} from "@/hooks/firebase/types/profileTypes";
import {IToDo} from "@/hooks/firebase/types/todoData";
export const useGetTodos = () => { export const useGetTodos = () => {
const { user, profileData } = useAuthContext(); const { user, profileData } = useAuthContext();
@ -17,16 +19,11 @@ export const useGetTodos = () => {
const data = doc.data(); const data = doc.data();
return { return {
...data,
id: doc.id, id: doc.id,
title: data.title,
done: data.done,
date: data.date ? new Date(data.date.seconds * 1000) : null, date: data.date ? new Date(data.date.seconds * 1000) : null,
points: data.points,
rotate: data.points,
repeatType: data.repeatType,
creatorId: data.creatorId
}; };
}); }) as IToDo[];
} }
}) })
}; };

View File

@ -14,12 +14,12 @@ export const useFetchAndSaveGoogleEvents = () => {
const timeMin = new Date(new Date().setFullYear(new Date().getFullYear() - 1)); const timeMin = new Date(new Date().setFullYear(new Date().getFullYear() - 1));
const timeMax = new Date(new Date().setFullYear(new Date().getFullYear() + 5)); const timeMax = new Date(new Date().setFullYear(new Date().getFullYear() + 5));
console.log("Token: ", token ?? profileData?.googleToken); console.log("Token: ", token);
try { try {
const response = await fetchGoogleCalendarEvents( const response = await fetchGoogleCalendarEvents(
token ?? profileData?.googleToken, token,
email ?? profileData?.googleMail, email,
profileData?.familyId, profileData?.familyId,
timeMin.toISOString().slice(0, -5) + "Z", timeMin.toISOString().slice(0, -5) + "Z",
timeMax.toISOString().slice(0, -5) + "Z" timeMax.toISOString().slice(0, -5) + "Z"

View File

@ -1311,6 +1311,9 @@ PODS:
- Firebase/Functions (10.29.0): - Firebase/Functions (10.29.0):
- Firebase/CoreOnly - Firebase/CoreOnly
- FirebaseFunctions (~> 10.29.0) - FirebaseFunctions (~> 10.29.0)
- Firebase/Storage (10.29.0):
- Firebase/CoreOnly
- FirebaseStorage (~> 10.29.0)
- FirebaseAppCheckInterop (10.29.0) - FirebaseAppCheckInterop (10.29.0)
- FirebaseAuth (10.29.0): - FirebaseAuth (10.29.0):
- FirebaseAppCheckInterop (~> 10.17) - FirebaseAppCheckInterop (~> 10.17)
@ -1382,6 +1385,13 @@ PODS:
- nanopb (< 2.30911.0, >= 2.30908.0) - nanopb (< 2.30911.0, >= 2.30908.0)
- PromisesSwift (~> 2.1) - PromisesSwift (~> 2.1)
- FirebaseSharedSwift (10.29.0) - FirebaseSharedSwift (10.29.0)
- FirebaseStorage (10.29.0):
- FirebaseAppCheckInterop (~> 10.0)
- FirebaseAuthInterop (~> 10.25)
- FirebaseCore (~> 10.0)
- FirebaseCoreExtension (~> 10.0)
- GoogleUtilities/Environment (~> 7.12)
- GTMSessionFetcher/Core (< 4.0, >= 2.1)
- fmt (9.1.0) - fmt (9.1.0)
- glog (0.3.5) - glog (0.3.5)
- GoogleDataTransport (9.4.1): - GoogleDataTransport (9.4.1):
@ -2719,6 +2729,10 @@ PODS:
- Firebase/Functions (= 10.29.0) - Firebase/Functions (= 10.29.0)
- React-Core - React-Core
- RNFBApp - RNFBApp
- RNFBStorage (21.0.0):
- Firebase/Storage (= 10.29.0)
- React-Core
- RNFBApp
- RNGestureHandler (2.16.2): - RNGestureHandler (2.16.2):
- DoubleConversion - DoubleConversion
- glog - glog
@ -2897,6 +2911,7 @@ DEPENDENCIES:
- "RNFBCrashlytics (from `../node_modules/@react-native-firebase/crashlytics`)" - "RNFBCrashlytics (from `../node_modules/@react-native-firebase/crashlytics`)"
- "RNFBFirestore (from `../node_modules/@react-native-firebase/firestore`)" - "RNFBFirestore (from `../node_modules/@react-native-firebase/firestore`)"
- "RNFBFunctions (from `../node_modules/@react-native-firebase/functions`)" - "RNFBFunctions (from `../node_modules/@react-native-firebase/functions`)"
- "RNFBStorage (from `../node_modules/@react-native-firebase/storage`)"
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`) - RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNReanimated (from `../node_modules/react-native-reanimated`) - RNReanimated (from `../node_modules/react-native-reanimated`)
- RNScreens (from `../node_modules/react-native-screens`) - RNScreens (from `../node_modules/react-native-screens`)
@ -2924,6 +2939,7 @@ SPEC REPOS:
- FirebaseRemoteConfigInterop - FirebaseRemoteConfigInterop
- FirebaseSessions - FirebaseSessions
- FirebaseSharedSwift - FirebaseSharedSwift
- FirebaseStorage
- GoogleDataTransport - GoogleDataTransport
- GoogleUtilities - GoogleUtilities
- "gRPC-C++" - "gRPC-C++"
@ -3138,6 +3154,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/@react-native-firebase/firestore" :path: "../node_modules/@react-native-firebase/firestore"
RNFBFunctions: RNFBFunctions:
:path: "../node_modules/@react-native-firebase/functions" :path: "../node_modules/@react-native-firebase/functions"
RNFBStorage:
:path: "../node_modules/@react-native-firebase/storage"
RNGestureHandler: RNGestureHandler:
:path: "../node_modules/react-native-gesture-handler" :path: "../node_modules/react-native-gesture-handler"
RNReanimated: RNReanimated:
@ -3210,6 +3228,7 @@ SPEC CHECKSUMS:
FirebaseRemoteConfigInterop: 6efda51fb5e2f15b16585197e26eaa09574e8a4d FirebaseRemoteConfigInterop: 6efda51fb5e2f15b16585197e26eaa09574e8a4d
FirebaseSessions: dbd14adac65ce996228652c1fc3a3f576bdf3ecc FirebaseSessions: dbd14adac65ce996228652c1fc3a3f576bdf3ecc
FirebaseSharedSwift: 20530f495084b8d840f78a100d8c5ee613375f6e FirebaseSharedSwift: 20530f495084b8d840f78a100d8c5ee613375f6e
FirebaseStorage: 436c30aa46f2177ba152f268fe4452118b8a4856
fmt: 4c2741a687cc09f0634a2e2c72a838b99f1ff120 fmt: 4c2741a687cc09f0634a2e2c72a838b99f1ff120
glog: fdfdfe5479092de0c4bdbebedd9056951f092c4f glog: fdfdfe5479092de0c4bdbebedd9056951f092c4f
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
@ -3283,6 +3302,7 @@ SPEC CHECKSUMS:
RNFBCrashlytics: f465771d96a2eaf9f6104b30abb002cfe78fc0be RNFBCrashlytics: f465771d96a2eaf9f6104b30abb002cfe78fc0be
RNFBFirestore: e47cdde04ea3d9e73e58e037e1aa1d0b1141c316 RNFBFirestore: e47cdde04ea3d9e73e58e037e1aa1d0b1141c316
RNFBFunctions: 738cc9e2177d060d29b5d143ef2f9ed0eda4bb1f RNFBFunctions: 738cc9e2177d060d29b5d143ef2f9ed0eda4bb1f
RNFBStorage: 2dab66f3fcc51de3acd838c72c0ff081e61a0960
RNGestureHandler: 20a4307fd21cbff339abfcfa68192f3f0a6a518b RNGestureHandler: 20a4307fd21cbff339abfcfa68192f3f0a6a518b
RNReanimated: d51431fd3597a8f8320319dce8e42cee82a5445f RNReanimated: d51431fd3597a8f8320319dce8e42cee82a5445f
RNScreens: 30249f9331c3b00ae7cb7922e11f58b3ed369c07 RNScreens: 30249f9331c3b00ae7cb7922e11f58b3ed369c07

View File

@ -47,7 +47,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>38</string> <string>34</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>NSAppTransportSecurity</key> <key>NSAppTransportSecurity</key>
@ -113,6 +113,7 @@
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string> <string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string> <string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string> <string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
</array> </array>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
<string>SplashScreen</string> <string>SplashScreen</string>

View File

@ -38,6 +38,7 @@
"@react-native-firebase/crashlytics": "^20.3.0", "@react-native-firebase/crashlytics": "^20.3.0",
"@react-native-firebase/firestore": "^20.4.0", "@react-native-firebase/firestore": "^20.4.0",
"@react-native-firebase/functions": "^20.4.0", "@react-native-firebase/functions": "^20.4.0",
"@react-native-firebase/storage": "^21.0.0",
"@react-navigation/drawer": "^6.7.2", "@react-navigation/drawer": "^6.7.2",
"@react-navigation/native": "^6.0.2", "@react-navigation/native": "^6.0.2",
"date-fns": "^3.6.0", "date-fns": "^3.6.0",

View File

@ -2432,6 +2432,11 @@
resolved "https://registry.npmjs.org/@react-native-firebase/functions/-/functions-20.4.0.tgz" resolved "https://registry.npmjs.org/@react-native-firebase/functions/-/functions-20.4.0.tgz"
integrity sha512-g4kAWZboTE9cTdT7KT6k1haHDmEBA36bPCvrh2MJ2RACo2JxotB2MIOEPZ5U/cT94eIAlgI5YtxQQGQfC+VcBQ== integrity sha512-g4kAWZboTE9cTdT7KT6k1haHDmEBA36bPCvrh2MJ2RACo2JxotB2MIOEPZ5U/cT94eIAlgI5YtxQQGQfC+VcBQ==
"@react-native-firebase/storage@^21.0.0":
version "21.0.0"
resolved "https://registry.yarnpkg.com/@react-native-firebase/storage/-/storage-21.0.0.tgz#0905fd67c74629d947f176bfb988d7cc4d85e244"
integrity sha512-meft5Pu0nI7zxhpnP49ko9Uw8GaIy9hXGJfa/fCFrpf2vA9OXdTr3CvgloH/b9DpbkwQGcGTshRqltuttXI67w==
"@react-native/assets-registry@0.74.85": "@react-native/assets-registry@0.74.85":
version "0.74.85" version "0.74.85"
resolved "https://registry.npmjs.org/@react-native/assets-registry/-/assets-registry-0.74.85.tgz" resolved "https://registry.npmjs.org/@react-native/assets-registry/-/assets-registry-0.74.85.tgz"
@ -8987,7 +8992,7 @@ react-native-linear-gradient@^2.8.3:
react-native-onboarding-swiper@^1.3.0: react-native-onboarding-swiper@^1.3.0:
version "1.3.0" version "1.3.0"
resolved "https://registry.npmjs.org/react-native-onboarding-swiper/-/react-native-onboarding-swiper-1.3.0.tgz" resolved "https://registry.yarnpkg.com/react-native-onboarding-swiper/-/react-native-onboarding-swiper-1.3.0.tgz#a97f945f03a036845242b3e1f319c6fdb262bc2b"
integrity sha512-2ZPMrZrJFgR5dmVWIj60x/vTBWrm0BZPuc2w7Cz2Sq/8ChypCi3oL8F7GYMrzky1fmknCS6Z0WPphfZVpnLUnQ== integrity sha512-2ZPMrZrJFgR5dmVWIj60x/vTBWrm0BZPuc2w7Cz2Sq/8ChypCi3oL8F7GYMrzky1fmknCS6Z0WPphfZVpnLUnQ==
dependencies: dependencies:
tinycolor2 "^1.4.1" tinycolor2 "^1.4.1"