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

Spanning all day events can't be saved properly in iOS #451

Closed
SuperKrallan opened this issue Oct 26, 2022 · 10 comments
Closed

Spanning all day events can't be saved properly in iOS #451

SuperKrallan opened this issue Oct 26, 2022 · 10 comments
Labels
bug Something isn't working

Comments

@SuperKrallan
Copy link

Saving an event with allDay = true and where end date are some days after start date works fine for android, but the same flutter code run on iOS results in change in the end date to the same as the start date.

in the file SwiftDeviceCalendarPlugin.swift line 818-820 you see this:

if (isAllDay) { ekEvent!.endDate = startDate }
else {
ekEvent!.endDate = endDate_

...and that if statement makes very little sense to me. If I remove the first part it works as it should...

To Reproduce
Save any "all day" event spanning more than one day will result in this error in iOS, but not on Android.

Expected behavior
Same as on android and in all other calendar apps I have seen, that the all day event is present on all days in the time span.

Device(s) tested

  • Device: iPhone SE (1st gen), iPhone 14 Emulator
  • OS: iOS 15.7
  • 4.2.0 Release

Flutter doctor
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, 3.4.0-34.1.pre, on macOS 12.6 21G115 darwin-arm64, locale sv-SE)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] Connected device (4 available)
[✓] HTTP Host Availability

• No issues found!

Additional context
Thanks for a great plug in!!

@SuperKrallan SuperKrallan added the bug Something isn't working label Oct 26, 2022
@IVLIVS-III
Copy link
Contributor

This should be fixed by #450.

In case I misunderstood something here, could you please elaborate where it goes wrong?

  • Is the event correctly saved to the calendar, but importing it again results in the issue? (this should be fixed by the PR above)
  • Or is such an event not even saved correctly to the calendar?

@SuperKrallan
Copy link
Author

Is the event correctly saved to the calendar, but importing it again results in the issue? (this should be fixed by the PR above)
Or is such an event not even saved correctly to the calendar?

It is the saving in iOS, saving in android is ok. Importing an all day event spanning multiple days works just fine.

It is in the file SwiftDeviceCalendarPlugin.swift where it seems to go wrong in the method...

private func createOrUpdateEvent(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) {

where the lines...

if (isAllDay) { ekEvent!.endDate = startDate }
else {
ekEvent!.endDate = endDate
_

are setting the end date to the start date.

@IVLIVS-III
Copy link
Contributor

Have you looked at the changes made in this PR?

I just double checked and as far as I can tell, exactly the lines you pointed out are changed. And pretty much in the way you suggested.

@SuperKrallan
Copy link
Author

Have you looked at the changes made in #450?

No, I did not go into the code, but I have done now, and I agree - it looks good! I am a total newbee when it comes to using github, I don't even know what a PR is... So please apologise if I confuse things or ask stupid questions.

Will this then come in the next release of device_calendar? Or can I get a beta (pre release = PR??) somewhere?

@IVLIVS-III
Copy link
Contributor

Ohh right, sry for using acronyms. PR stands for pull request, which is a collection of commits that some developer wants to merge into (i.e. add to) the main codebase.

This will most likely come in the next release of device_calendar. This release will most likely be preceded by an official pre-release published to pub.dev two weeks earlier.

You can also specify a specific Github repository in your pubspec.yaml file as dependency. That way you could use the changes starting now.
See the flutter docs on how this would be done.
You would probably want to use the develop branch from OleksandraFedotova. This is linked at the very top of #450.

If you have any trouble, just reply here and I can try to help.

@SuperKrallan
Copy link
Author

Ah, thanks. Great with the link on how to add specific repositories. Didn't know that. Thanks a lot!

@tovidd
Copy link

tovidd commented Nov 1, 2022

I faced version solving failed because depends on timezone ^0.9.0, when are you planning to update the version ?

@IVLIVS-III
Copy link
Contributor

@tovidd the version has already been updated on the develop branch (see #440).

#445 tracks the status of the new version to be released to pub.dev.

@IVLIVS-III
Copy link
Contributor

this should be fixed since version 4.3.0. @SuperKrallan could you test if the issue still exists on your side?

@IVLIVS-III IVLIVS-III added the more information required The issue requires more information before it can be actioned label Mar 11, 2023
@SuperKrallan
Copy link
Author

With the 4.3.0 (and the required timezone: ^0.9.0) it now works great! Tested on both iPhone simulator and my real iPhone. Thanks a lot! Much appreciated!

@IVLIVS-III IVLIVS-III removed the more information required The issue requires more information before it can be actioned label Mar 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants