mirror of
https://github.com/urosran/cally.git
synced 2025-07-15 09:45:20 +00:00
Update fetching google calendar, fix babel config
This commit is contained in:
@ -3,12 +3,6 @@ module.exports = function (api) {
|
|||||||
return {
|
return {
|
||||||
presets: [
|
presets: [
|
||||||
'babel-preset-expo',
|
'babel-preset-expo',
|
||||||
],
|
]
|
||||||
plugins: [
|
|
||||||
'babel-plugin-module-resolver', {
|
|
||||||
alias: {
|
|
||||||
'react-native-vector-icons': '@expo/vector-icons',
|
|
||||||
},
|
|
||||||
}]
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -8,46 +8,41 @@ export async function fetchGoogleCalendarEvents(token, email, familyId, startDat
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
const googleEvents = [];
|
const googleEvents = [];
|
||||||
|
|
||||||
data.items?.forEach((item) => {
|
data.items?.forEach((item) => {
|
||||||
let isAllDay = false;
|
let isAllDay = false;
|
||||||
const start = item.start;
|
let startDateTime, endDateTime;
|
||||||
let startDateTime;
|
|
||||||
if (start !== undefined) {
|
if (item.start) {
|
||||||
if (start.dateTime) {
|
if (item.start.dateTime) {
|
||||||
const stringDate = start.dateTime;
|
startDateTime = new Date(item.start.dateTime);
|
||||||
startDateTime = new Date(stringDate);
|
} else if (item.start.date) {
|
||||||
} else {
|
startDateTime = new Date(item.start.date);
|
||||||
const stringDate = start.date;
|
|
||||||
startDateTime = new Date(stringDate);
|
|
||||||
isAllDay = true;
|
isAllDay = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const end = item.end;
|
if (item.end) {
|
||||||
let endDateTime;
|
if (item.end.dateTime) {
|
||||||
if (end !== undefined) {
|
endDateTime = new Date(item.end.dateTime);
|
||||||
if (end.dateTime) {
|
} else if (item.end.date) {
|
||||||
const stringDate = end.dateTime;
|
endDateTime = new Date(item.end.date);
|
||||||
endDateTime = new Date(stringDate);
|
isAllDay = true;
|
||||||
} else {
|
|
||||||
const stringDate = end.date;
|
|
||||||
endDateTime = new Date(stringDate);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
||||||
familyId,
|
familyId,
|
||||||
email
|
email,
|
||||||
};
|
};
|
||||||
|
|
||||||
googleEvents.push(googleEvent);
|
googleEvents.push(googleEvent);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -148,6 +148,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>
|
||||||
|
Reference in New Issue
Block a user