mirror of
https://github.com/urosran/cally.git
synced 2025-07-16 10:06:15 +00:00
Syncing logic improvements... Notification logic refactor (stop spamming notifications on sync)
This commit is contained in:
@ -94,7 +94,7 @@ const CalendarSettingsPage = (props: {
|
||||
newUserData: {googleToken: accessToken, googleMail: googleMail},
|
||||
});
|
||||
|
||||
await fetchAndSaveGoogleEvents(accessToken, googleMail)
|
||||
await fetchAndSaveGoogleEvents({token: accessToken, email: googleMail})
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error during Google sign-in:", error);
|
||||
@ -207,12 +207,12 @@ const CalendarSettingsPage = (props: {
|
||||
if (appleToken) {
|
||||
console.log("Apple ID token received. Fetch user info if needed...");
|
||||
|
||||
// Example: Store user token and email
|
||||
await updateUserData({
|
||||
newUserData: {appleToken, appleMail},
|
||||
});
|
||||
|
||||
console.log("User data updated with Apple ID token.");
|
||||
await fetchAndSaveAppleEvents({token: appleToken, email: appleMail!});
|
||||
} else {
|
||||
console.warn("Apple authentication was not successful or email was hidden.");
|
||||
}
|
||||
@ -252,7 +252,7 @@ const CalendarSettingsPage = (props: {
|
||||
[]
|
||||
);
|
||||
|
||||
const handleChangeFirstDayOfWeek = () => {
|
||||
const handleChangeFirstDayOfWeek = (firstDayOfWeek: string) => {
|
||||
setFirstDayOfWeek(firstDayOfWeek === "Sundays" ? "Mondays" : "Sundays");
|
||||
debouncedUpdateFirstDayOfWeek(firstDayOfWeek === "Sundays" ? "Mondays" : "Sundays");
|
||||
}
|
||||
@ -436,12 +436,18 @@ const CalendarSettingsPage = (props: {
|
||||
<View style={{marginTop: 20}}>
|
||||
{!!profileData?.googleMail && (
|
||||
<TouchableOpacity
|
||||
onPress={() => fetchAndSaveGoogleEvents(undefined, undefined)}
|
||||
onPress={() => fetchAndSaveGoogleEvents({
|
||||
token: profileData?.googleToken!,
|
||||
email: profileData?.googleMail!
|
||||
})}
|
||||
>
|
||||
<View row paddingR-20 center>
|
||||
<Button
|
||||
disabled={isSyncingGoogle}
|
||||
onPress={() => fetchAndSaveGoogleEvents(undefined, undefined)}
|
||||
onPress={() => fetchAndSaveGoogleEvents({
|
||||
token: profileData?.googleToken!,
|
||||
email: profileData?.googleMail!
|
||||
})}
|
||||
label={`Sync ${profileData?.googleMail}`}
|
||||
labelStyle={styles.addCalLbl}
|
||||
labelProps={{numberOfLines: 3}}
|
||||
@ -466,11 +472,18 @@ const CalendarSettingsPage = (props: {
|
||||
|
||||
|
||||
{!!profileData?.appleMail && (
|
||||
<TouchableOpacity>
|
||||
<TouchableOpacity
|
||||
onPress={() => fetchAndSaveAppleEvents({
|
||||
email: profileData?.appleMail!,
|
||||
token: profileData?.appleToken!
|
||||
})}>
|
||||
<View row paddingR-20 center>
|
||||
<Button
|
||||
disabled={isSyncingApple}
|
||||
onPress={() => fetchAndSaveAppleEvents(undefined, undefined)}
|
||||
onPress={() => fetchAndSaveAppleEvents({
|
||||
email: profileData?.appleMail!,
|
||||
token: profileData?.appleToken!
|
||||
})}
|
||||
label={`Sync ${profileData?.appleMail}`}
|
||||
labelStyle={styles.addCalLbl}
|
||||
labelProps={{numberOfLines: 3}}
|
||||
@ -494,12 +507,18 @@ const CalendarSettingsPage = (props: {
|
||||
|
||||
{!!profileData?.outlookMail && (
|
||||
<TouchableOpacity
|
||||
onPress={() => fetchAndSaveOutlookEvents(undefined, undefined)}
|
||||
onPress={() => fetchAndSaveOutlookEvents({
|
||||
token: profileData?.microsoftToken!,
|
||||
email: profileData?.outlookMail!
|
||||
})}
|
||||
>
|
||||
<View row paddingR-20 center>
|
||||
<Button
|
||||
disabled={isSyncingOutlook}
|
||||
onPress={() => fetchAndSaveOutlookEvents(undefined, undefined)}
|
||||
onPress={() => fetchAndSaveOutlookEvents({
|
||||
token: profileData?.microsoftToken!,
|
||||
email: profileData?.outlookMail!
|
||||
})}
|
||||
label={`Sync ${profileData?.outlookMail}`}
|
||||
labelStyle={styles.addCalLbl}
|
||||
labelProps={{numberOfLines: 3}}
|
||||
|
Reference in New Issue
Block a user