TheAlmightyBob / Calendars

Cross-platform calendar API plugin for Xamarin and Windows
MIT License
101 stars 23 forks source link

Additional common fields #3

Open TheAlmightyBob opened 9 years ago

TheAlmightyBob commented 9 years ago

Anything else?

nielscup commented 8 years ago

Yes, I would like some sort of tag property that I can set, and the user cannot change (easily). This way I can easily filter all events that were created by my app in order to update or delete them.

TheAlmightyBob commented 8 years ago

Interesting idea. I'd have to look into what support exists on each of the platforms for this (mainly due to the "user cannot change (easily)" part..). I had assumed that apps would just create their own calendars for this purpose...

If this was built-in to the API instead (e.g. a parameter to specify that you only want your events), would that seem reasonable? I'm just thinking that the different platforms might offer different ways to achieve that scenario (which may work/perform better than just post-filtering the returned events according to a custom property).

Two quick notes:

  1. This should actually be a new issue. This issue was specifically about just exposing the additional simple fields that are already visible on the native calendars.
  2. I'm a bit in-transition right now and won't be able to get to this very soon (project has not been abandoned though).
nielscup commented 8 years ago

Maybe creating a new calendar would also be a possibility, I hadn't thought of that option yet. The reason I need this feature is because I need to build functionality to export a duty roster, which I need to be able to update. I was planning to start with that functionality tomorrow, so I will have a look myself. If I make any changes I will commit them, thanks!

nielscup commented 8 years ago

I tried the option to create a calendar but on iOS the GetCalendars does not retrieve the newly created calendar. Also the Testapp Calendars_CreateCalendar_IsFoundByGetCalendar fails. Is this a known issue, or is it just my device?

TheAlmightyBob commented 8 years ago

I created a new issue for your original request, to try to keep this issue from filling up with comments that aren't directly related to it.

Please feel free to create a new issue for the error you are seeing as well.

It is definitely not a known issue (otherwise there would be an issue here for it!).

CreateCalendar is not throwing an exception? Does the Calendar it returns have ExternalID populated?

TheAlmightyBob commented 8 years ago

Niels, I'm betting that you encountered issue #10 . A fix is in the works.

nielscup commented 8 years ago

Ah Thanks, for the notification! Actually I didn’t encounter this issue because I have only tested with google calendar so far. Otherwise I would have raised an issue, or try to fix it myself ;-)

cce32 commented 6 years ago

I am also looking for a way to add some metadata to an event I create so later the app can determine if said event already exists in which case allow edit/delete else do the add.

Based on the Calendars_AddOrUpdateEvent_NonexistentEventCreatesNew() unit test I thought maybe I could supply the CalendarEvent.ExternalID and then use it to get the event but ExternalID seems to be the OS generated value in my experiments (numeric in Android, GUID in iOS).

Thanks for this plugin!

TheAlmightyBob commented 6 years ago

@cce32 Correct, ExternalID is OS-generated. This has actually come up a few times in recent months as a point of confusion, so probably need to reevaluate making that a readonly property at some point. (or maybe if I'd called it "PlatformID" instead of "ExternalID" that would have helped :-P )

Generally, the recommended approach is to store the IDs of events you create in your app (sqlite, settings, text file, whatever) rather than try to tag the events as being "owned" by your app. For the most part, if your app can put custom data into an event property, the user can also view/edit that data (there are occasional platform-specific exceptions but this is a cross-platform library). This issue in particular is about identifying simple fields that exist on every platform but are not yet being exposed by this library, and I'm not aware of any such field that would serve your purpose.

Thanks for using this plugin. :)

cce32 commented 6 years ago

@TheAlmightyBob thank you for the response.

I plan to create a lookup and store it on the device per your guidance.

I agree removing the public setter for ExternalID would clarify the intent.