builttoroam / device_calendar

A cross platform plugin for modifying calendars on the user's device
https://pub.dev/packages/device_calendar
BSD 3-Clause "New" or "Revised" License
259 stars 258 forks source link

macOS support #471

Open IVLIVS-III opened 1 year ago

IVLIVS-III commented 1 year ago

This PR adds macOS as a supported platform.

Closes #409.

As discussed on #466 we want to have a unified codebase for both iOS and macOS. In this PR is heavily based on #466 but makes the changes necessary for a shared swift source.

The example app runs now both on iOS and macOS, with full feature support on both platforms.

IVLIVS-III commented 1 year ago

@thomassth Do you mind looking at this if you have some spare time?

Should this be a 4.4.0 release or bundled in the big 5.0?

thomassth commented 1 year ago

I wasn't able to get any calendar details when running example app in MacOS

IVLIVS-III commented 1 year ago

I wasn't able to get any calendar details when running example app in MacOS

What do you mean by calendar details? Events in that calendar, calendar name, calendar color, readonly/read/write state of the calendar, or something different?

Edit: Did you make sure, that calendar access was enabled in AppSandbox in the example app (macOS) in XCode?

thomassth commented 1 year ago

What do you mean by calendar details? Events in that calendar, calendar name, calendar color, readonly/read/write state of the calendar, or something different?

Edit: Did you make sure, that calendar access was enabled in AppSandbox in the example app (macOS) in XCode?

The example app isn't showing any calendar at all (the first page), and there was no details for me to click into

And the calendar access was on, but I've not seen any permission popup when the app opens (usual behavior on Android)

fyi I'm testing on M1 air, but I thought that should only increase compatibility with iOS code, not causing more problems :(

IVLIVS-III commented 1 year ago

The example app isn't showing any calendar at all (the first page), and there was no details for me to click into

hmm, interesting… it worked on my machine :( even being able to create new events, that then showed up in the native Apple calendar app and edit events created by the native calendar app.

fyi I'm testing on M1 air, but I thought that should only increase compatibility with iOS code, not causing more problems :(

I tested on an Intel MacBook Pro running macOS Ventura (macOS 13)

thomassth commented 1 year ago

I guess in this state we can slap a beta/Intel only label and ship it

IVLIVS-III commented 1 year ago

I guess in this state we can slap a beta/Intel only label and ship it

Attached a screen recording of how it looks on my machine…

https://user-images.githubusercontent.com/48645716/219791191-242a3ed6-8541-4adc-a710-ffa2e594dd55.mov

kingvhit commented 1 year ago

I think the reason that @thomassth doesn't see any popup request calendar permission in his side caused by bug on Xcode.

Just try my ideas

gaetschwartz commented 1 year ago

Experienced the same issue as well, not sure if it's XCode's fault or something else ? https://github.com/flutter/flutter/issues/122796

brandonguigo commented 3 months ago

Hey @IVLIVS-III @thomassth,

I would like to use device_calendar on macOS, including Apple Silicon. Any hope to revive this PR ? :)

IVLIVS-III commented 3 months ago

@brandonguigo I created this PR some time ago. At this point in time, multiple conflicts with the base have emerged and I have no capacity to update this right now. That‘s why I marked it as draft. This PR is not in a review-ready state right now. Feel free to fork the feat/macos-support branch of my fork and continue this PR if you like.

lukemmtt commented 2 months ago

Regarding the bug discussed here earlier (i.e. permissions not working right for macOS builds launched from VSCode or Android Studio), I've gathered some likely-relevant discussions for reference:

For what it's worth, my workflow for debugging anything involving Calendar or Reminders macOS permissions right now is:

  1. Launch debug or release build from Android Studio. Permissions will not work at this stage, and any attempt to read permission will return PermissionStatus at the OS level.
  2. Ensure the launcher icon is saved in the dock, then close the app & reopen it by clicking on icon in dock
  3. Permissions work as expected.

Additionally, I haven't filed a PR or even reviewed his code much, but my colleague recently created his own macOS-support fork of device_calendar here for our purposes. Sharing for reference.