Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable multiple-day allDay events on Android #324

Merged
merged 7 commits into from
Dec 23, 2021

Conversation

FCView
Copy link
Contributor

@FCView FCView commented Jul 31, 2021

Replaces my previous PR. Updated to current version and enables multiple-day allDay events on Android. Fix for #220 and also possible fix for #323 as this updates the Android allDay events to correctly be posted at midnight UTC instead of local timezone.

This still doesn't address the issue with local calendars vs synced calendars, as I mentioned in my comment here., but I'm not sure that is fixable within the scope of this project.

@hyouuu
Copy link

hyouuu commented Aug 28, 2021

Thanks @FCView wish this could be merged soon. Did you figure out any way to fix the issue you mentioned?

@FCView
Copy link
Contributor Author

FCView commented Sep 23, 2021

@hyouuu No, never did find a fix for that other issue. I think that is an issue with Android's Calendar Provider, or the way Android handles local Calendars. I restricted my application to only use synced calendars and haven't had time to go back and really dive deep.

@hyouuu
Copy link

hyouuu commented Sep 23, 2021

Thanks for the clarification!

@hyouuu
Copy link

hyouuu commented Oct 6, 2021

Hi @FCView encountered a bug while using your branch - if you create any all day events in Android system calendar and then retrieve it, the end date timestamp will be UTC 0:00 which means it will be incorrect in all other timezones

@FCView
Copy link
Contributor Author

FCView commented Oct 6, 2021

@hyouuu, allday events are stored in the Android system as midnight UTC to midnight UTC the following day (see documentation here). The timezone must be in UTC so there is no way to store a different timezone.

Also, storing it in a different timezone causes trouble if the user moves across timezones (as mine do regularly).

I suppose that it could be modified to return the dates in local timezones, but that is just an extra step that I think is best left to the developer based on their use-case.

I don't remember how the Calendar Provider returns the date, but see the example that I also updated in this branch that shows how to use/display these allday events after retreival:

_formatDateTime() in example/lib/presentation/event_item.dart

@hyouuu
Copy link

hyouuu commented Oct 7, 2021

Thanks so much! For some reason the start date was in local timezone - will double check what's going on there.

@thomassth thomassth added this to the 4.1 milestone Nov 9, 2021
@thomassth
Copy link
Contributor

The code seems to be working, but code should be changed in lib instead of example, otherwise everyone needs to copy the implementation on their own.

For example, the end date is fine in events list, but it's incorrect in the datails page because the lib code wasn't fixed.

Also, variables in calendar delegate was changed in between your commits so that need to be changed as well.

@thomassth thomassth removed this from the 4.1 milestone Dec 21, 2021
@thomassth thomassth added good first issue Good for newcomers help wanted This issue is open for someone to pick up and action enhancement New feature or request and removed enhancement New feature or request labels Dec 21, 2021
@FCView
Copy link
Contributor Author

FCView commented Dec 22, 2021

@thomassth updated with conflict fix and changed implementation to lib instead of example

# Conflicts:
#	android/src/main/kotlin/com/builttoroam/devicecalendar/CalendarDelegate.kt
#	example/lib/presentation/pages/calendar_add.dart
#	example/lib/presentation/pages/calendar_event.dart
#	lib/src/models/event.dart
Copy link
Contributor

@thomassth thomassth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on my device:

  • add and remove multi-day all day events
  • cross-checked results with other calendar apps

A proper integration test would be great but this is working as intended. @FCView great job!

@thomassth thomassth merged commit bfbc843 into builttoroam:develop Dec 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted This issue is open for someone to pick up and action
Projects
Development

Successfully merging this pull request may close these issues.

3 participants