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

Adding some color to the events #243

Merged
merged 4 commits into from
Dec 14, 2021
Merged

Conversation

leog
Copy link
Contributor

@leog leog commented Dec 13, 2021

I needed to differentiate between my original events and my imported events through this marvelous script so I looked up that the colorId was available and unused so I added it. Hopefully this is also a nice-to-have for other people which is why I wanted to contribute it 👍

Copy link
Owner

@derekantrican derekantrican left a comment

Choose a reason for hiding this comment

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

Let me know your thoughts on my comments. I think it's a good feature, but want to avoid making things more confusing.

Some other options (besides my comments):

  • Just specify one color as its own setting that would apply to all synced calendars (but wouldn't give you the "per calendar" customization)
  • In colorIds.gs the user could specify the "icsUrl-to-color" mapping there which would in effect make this an advanced feature (so its not confusing in Code.gs and we can direct them there if they ask about it). I think I like this option the most. Maybe an advancedSettings.gs or something

colorIds.gs Outdated Show resolved Hide resolved
Code.gs Outdated Show resolved Hide resolved
Code.gs Outdated Show resolved Hide resolved
@leog
Copy link
Contributor Author

leog commented Dec 13, 2021

Is it simplified enough for you @derekantrican and @jonas0b1011001? I really didn't want to go the unique-color-per-instance way as at least for myself, I need to know which event comes from what calendar. Let me know if you think I need to dig deeper on abstracting the code even more. From my point of view, it is simple enough to get the point without compromising functionality, but it is your call of course 😄

Code.gs Outdated
["icsUrl1", "targetCalendar1"],
["icsUrl2", "targetCalendar2"],
["icsUrl2", "targetCalendar2", "11"],
Copy link
Owner

Choose a reason for hiding this comment

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

I think this is the final request from me - let's remove the "11" in the example array. There's already an example in the comment above and I think that is good enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done 🙂

@derekantrican derekantrican merged commit baa9d26 into derekantrican:master Dec 14, 2021
pull bot referenced this pull request in smockle-archive/GAS-ICS-Sync Dec 14, 2021
* Supporting event colors

* Going for the initial examples

* Simplifying code

* Removing color from array example
@jonas0b1011001
Copy link
Collaborator

This needs to validate colorId at some point - latest in createEvent().
Right now the code is basically broken if no color is specified in the url array as the API will not accept an event with colorId = null.

@derekantrican
Copy link
Owner

the API will not accept an event with colorId = null.

I was wondering about that. Figured it was fine, but guess not. @leog can you verify and, if needed, create another PR to do something like colorId = color ?? "default" or whatever?

@jonas0b1011001
Copy link
Collaborator

the API will not accept an event with colorId = null

Forget that part, it actually does accept null. However i still think it would be smart to validate the colorId.

@leog
Copy link
Contributor Author

leog commented Dec 21, 2021

Sorry, I just caught your comments post-merge. The value if no colorId is added is actually undefined, which seems to work well with the API. And I'm open to add color id validations, but I think it will overcomplicate things a bit with no real benefit other than making sure people selects a valid and desired color, which we just made it totally optional to begin with 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants