Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added a non-functional floating action button for exporting google calendar trying to work with a stream of university events * experimented with iterating through a stream of events * started to create a Google Calendar Event * added ending date for an event and a sample list of strings for recurrence * Obtaining Client ID credentials for Google Calendar API * Managed to export non-recurrent events Recurrent events seem to output the error "Invalid recurrence rule" Based on: https://medium.com/flutter-community/flutter-use-google-calendar-api-adding-the-events-to-calendar-3d8fcb008493 Additional resources used: https://developers.google.com/calendar/concepts/events-calendars https://developers.google.com/calendar/recurringevents https://tools.ietf.org/html/rfc5545#section-3.8.5 * Added some TODOs for my future commits * Sending all events in the same client instance instead of opening one for each event * Temporary(?) fix - removed the time in the "until" field of events' rrule * implemented custom getter for correct recurrence rule this new rrule should take into account the holidays when dealing with even/odd events * testing the addition of a new secondary calendar in GCal for timetable events * managed to add events to a custom GCal calendar * Cleaned up the code Avoided "cascading then-s" which could make the code unavoidable, in my opinion. Now there is an awaited function call for insertion of a new calendar, after which the adding of events is processed. * added missing parenthesis * trailing comma * Implemented update The current method is probably not final, and can be described as a workaround. Every time the user exports his events to Google Calendar (GCal) they are added in a separate secondary calendar with the summary "ACS UPB Mobile". Re-exporting the calendar to GCal works by deleting the previous "ACS UPB Mobile" named entry and reinserting the new version. * Added default value for rrule calculation return * Added different colors for each event Google Calendar requires a color id (from 1 to 11) for an event color. Currently I am just using the id from the type of the event (there are less than 11 types of events, hence each type will be associated to a different color). However, you will probably see different colors between, for example, a Lecture in the ACS UPB Mobile calendar and its Google Calendar export. I might need to think about a solution to this. * Added a TODO regarding GCal notifications * Reformat * Organized GCal code Moved Google Calendar color details to google_apis.dart. Created getter which assigns an event type to a Google Calendar color (which has a color ID and a name). This is done manually, with regards to how event type colors are assigned in the ACS UPB Mobile Timetable. * Fixed bug which prevented GCal imported events from being edited. Organized code My guess is that the aforementioned bug was caused by RRule inconsistencies. According to RFC5545 (https://tools.ietf.org/html/rfc5545) [BYWEEKNO] MUST NOT be used when the FREQ rule must not be used when the FREQ part is set to anything other than YEARLY.', so I replaed 'Daily' with 'Yearly'. On my test events, things seem to work well, but I will further investigate this. * Organized GCal code Renamed eventInstance to uniEvent to avoid confusion with objects of UniEventInstance class type. Added TODO related to event descriptions, added onError for callback exceptions; Made client AutoRefreshing thinking that this might allow refresh tokens. Yet, the user still has to re-accept permissions in an external browser tab (forced webview is not allowed, according to my attempts), so remembering user's consent might not be possible. * Added default case for Google API Client ID * Added flutter_inappwebview, since default url_launcher webview doesn't work with OAuth * Replaced some colors, so they could contrast more. * Added widget to exportToGoogleCalendar function * Renamed field (possibly required by a package update) * Added flutter_web_browser package Used for asking user for Google Calendar permission in a webview. This way they can easily close it and go back to the app (without tapping back multiple times or switching apps from chrome). * Replaced previous Google Calendar access prompt with new one; changed print messages * Modified rrule, see google/googleapis.dart#223 (comment) * Moved Google Calendar functions to a separate extension * Moved TODOs * Replaced cascade invocations, clarified code, removed unnecessary comments * Removed unnecessary imports * Replaced normal FAB with an empty one for anonymous users * Stopped adding widget as parameter to function * Renamed variable for clarification * Removed duplicate code * Refactoring; changed scope of variables from private to public * Properly replaced the frequency for rruleBasedOnCalendar getter * Removed todo * Commented reminder implementation, will get back to it some other time * camelCase * Added convenience method for converting Period to Duration Also reformatted and removed unnecessary imports. * Commented on some todos * Added todo related to rrule based on calendar string * Explained functionality of clientViaUserConsent function and parameters * Removed whitespace * Replaced string list add with string list declaration * toString and replaceAll are now done in the same operation * Removed comments * Removed prints in prompt function, made return value Future<void> instead of void (it is async!) * Export to GCal is now done in settings instead of FAB * Renamed hex ids for compliance with lower camelCase requirements These are not currently used, but I decided to include them for a future PR, related to choosing a closest event color from this list. * just a question mark :D * Added issue related to this TODO #175 * Added issue related to that TODO #176 * TODO converted to project TODO converted to project TODO already mentioned in issue [issue](#168) Removed irrelevant comments and TODOs * Removed unnecessary hex codes * Update lib/resources/google_apis.dart Co-authored-by: Ioana Alexandru <[email protected]> * Removed unnecessary extension * Update lib/pages/timetable/service/google_calendar_services.dart Co-authored-by: Ioana Alexandru <[email protected]> * Code cleanup * Code cleanup * Specific version for package * Removed accidentally inserted preferences title * Removed pronouns in localization files * Replaced constant with value taken from the generated localization files * Replaced S.of(context) with S.current * Ensured visibility of editing permissions widget * Removed pronouns for Romanian * Update lib/pages/timetable/service/google_calendar_services.dart Co-authored-by: Ioana Alexandru <[email protected]> * Removed old prompt function * Turned then callback in await function * Reverted old pubspec.yaml formatting * Explicitly specified package versions in pubspec.yaml * Replaced default Platform selecting implementation * Made some widgets invisible when on Flutter Web * Made some widgets invisible when on Flutter Web Made widget display toast when user is not logged in * Reformat * String for error in inserting GCal events in RO and EN * Wrapped all operations in a single try catch, with an AppToast in catch block * pubspec.yaml reformat * Child widget after visible property * Reformat * Preparing for release * enabled property for GCal widget is different now * enabled property * Update lib/l10n/intl_en.arb Co-authored-by: Ioana Alexandru <[email protected]> * dot after error * ctrl alt l * Accidentally deleted '}' in l10n.dart * Enabled property * Removed enabled property so that corresponding toasts are displayed Co-authored-by: Ioana Alexandru <[email protected]>
- Loading branch information