izivkov/CasioGShockSmartSync

Google Calendar events need alarm in order to show in the app.

izivkov opened this issue · 45 comments

Describe the bug
There is a bug in the Google Calendar selection. Currently, only events with set Alarms were selected. We should display all events beloging to the user, even if no alarm is set. Also, no events from other calendar should be shown, like hollidays.

To Reproduce
Steps to reproduce the behavior:

  1. Create an Event in Google calendar. Do not set alram (like 30 minutes before)
  2. Start the app and go to Calender

Expected behavior
This event should appear, but it does not. After editing the event and adding alarm, the event appears in the app.

Additional context
If we set an aram on the event from Google calenders, this event will appear.

@imBenjamin741
I have created a fix in branch "calendar-fixes". Do you mind checking the fix with your Google events and let me know if it works for you. I have tested it, and it works, but I like a second tester.

Thanks

@imBenjamin741 I have created a fix in branch "calendar-fixes". Do you mind checking the fix with your Google events and let me know if it works for you. I have tested it, and it works, but I like a second tester.

Thanks

I just tried it on my Samsung A52 with Android 13:

  • I tried the Play store app and did 2 tests. First, I created an event with no alarm. I launched the app and it didn't show up. Then I tried to add a reminder for the event and restarted the app. The event was now there. With the Play Store version I only saw 2 events plus the one created for testing.
  • I built the app from the calendar-fixes branch, installed it and started it. I now see all the events (over 20), so the patch worked great!

Let me know if I can do more tests.

Thanks,
Beniamino

@imBenjamin741 Perfect! Thanks for tering. Wow you have 20 events? Impressive. They are all your events, right? No holidays, etc.
Maybe next bug you can fix it.
Now I will merge and create a new release 12.2 for playstore and F-Droid. This release will include your preveously reported bug about the permissions.

Cheers,
Ivo

@imBenjamin741 Perfect! Thanks for tering. Wow you have 20 events? Impressive. They are all your events, right? No holidays, etc. Maybe next bug you can fix it. Now I will merge and create a new release 12.2 for playstore and F-Droid. This release will include your preveously reported bug about the permissions.

Cheers, Ivo

I have:

  • 3-4 events created by me;
  • my birthday and a friend's birthday;
  • other standard google calendar events (Italian or international holidays such as Easter, Christmas, New Year, etc.).

They all appear in the app, I don't know if this is the correct behaviour. Among other things, it shows me some events on which it says that the events are not compatible with the watch (are they past events?). Even in the previous version of the app an event had that warning.

Let me know,
Beniamino

No, this is not what we want. Holiday events, like Christmas, should not show up. They don't appear on either of my phones, Android 11 and 12. So, this could be something specific to your Samsung phone. I think Samsung have their own calendar. To be sure, can you try on another phone? I will look into it more. Thanks

I removed a university account which, I do not know why, had all its holidays 'duplicated'. I ran a new test and now only events created by me are displayed. The application works fine.
A nice feature, which I've read about in another issue, would be the background time sync. It'll be really useful. I would be happy to help you implement it if you like the idea.

Let me know,
Beniamino

OK, looks like the University has sent you holiday schedule to your personal (student account). So, they are personal events. They should appear as the color as your birthdays.
So, I think the app works fine. I will merge with main, but will not make a release yet, pending testing for a day or so.

We can start a new discussion abiut the app running in the backgrownd. There are a few issues with that. You cal take a look at this issue. Main main problem with this is the app becomes intrusive and uses more battery. But we can discuss.

We can start a new discussion abiut the app running in the backgrownd. There are a few issues with that. You cal take a look at this issue. Main main problem with this is the app becomes intrusive and uses more battery. But we can discuss.

Could the application only be started when the synchronisation takes place (00:30, 6:30, 12:30 and 18:30)? A few minutes earlier at most. That way the application runs very little time in the background and uses little battery and performance.
Anyway, if I have not been clear in the outcome of the calendar tests and you need any further verification I am always available. I apologise if I have caused any confusion.

Kind regards,
Beniamino

I think the Calendar is OK. I tested it with 3 phones and 3 accounts, and it seems fine. I merged it with main. Feel free to build from main and try with your phones, enabling and disabling alarms to see if it makes a difference. I am not creating a new releases for a couple of days yet.

About the background tasks, this is easely atchived by running one of these programs: Tasker or MacroDroid. One of the main complaint about the official app is that is "always in my face". If you keep it in the backgrownd, it must always show a notification, which is anoying. I'm not discoraging you from trying, but we have attemted this a few times and it has never worked well.

I think the Calendar is OK. I tested it with 3 phones and 3 accounts, and it seems fine. I merged it with main. Feel free to build from main and try with your phones, enabling and disabling alarms to see if it makes a difference. I am not creating a new releases for a couple of days yet.

Describe the bug
There is a really strange bug. I noticed that the first 5 events displayed in the calendar section are always enabled when you start the application. The problem is that if the events are incompatible with the clock, the toggle remains graphically in the off position even though the event is actually enabled, preventing you from enabling other events (the warning "Max 5 items already enabled. Please disable some first." will appear on the screen).
To get rid of the bug, you have to click on the incompatible event, even if the toggle is in the off position, and it will be disabled.
Another strange thing is that you can enable incompatible events.

To Reproduce
Steps to reproduce the behavior:

  • Have at least 5 events, one of which is incompatible with the watch;
  • The first 5 events are automatically enabled;
  • You could see the toggle enabled only on the compatible events;
  • If you try to enable another even you will get the above-mentioned warning even though you could only see less than 5 events enabled.

Additional context
The first thing that could be done would be to not enable the first 5 events. After that I will disable the option to enable incompatible events and I would make sure that incompatible events are always disabled at runtime to avoid bugs.

I hope I was clear. Kind regards,
Beniamino

Edit: I need to open another issue thread?

About the background tasks, this is easely atchived by running one of these programs: Tasker or MacroDroid. One of the main complaint about the official app is that is "always in my face". If you keep it in the backgrownd, it must always show a notification, which is anoying. I'm not discoraging you from trying, but we have attemted this a few times and it has never worked well.

I will try those solutions and I will let you know how it goes. Thanks

No, we can stay on this thread.

Firslty, can you described the events that are incompatible? Are these complex events?

Ok, you can give it a try to see how it goes.
Remeber that sometime events are sent to the watch in the backgrownd, like from an Action or when Automaic time update takes place. Only enabled events are sent in that case, so we would like to have the first 5 events enabled, usually.
I think this bug sometime happens even with normal, compatible events. If you have more than 5 events, amd 5 a pre-selected, sometime unselecting one event and then selecting it again displays this error. I have not address this issue, bacuase it is not consistant.

Can you create another branch, and I think you need to create a pull request, right?

Firslty, can you described the events that are incompatible? Are these complex events?

I honestly don't know, only my birthday and the holidays on my university account are marked as incompatible events. They seem like normal events in the Google Calendar app. Maybe they could be hidden so that the bug doesn't happen. As far as I understand the code knows which events are compatible and which are not.

Remeber that sometime events are sent to the watch in the backgrownd, like from an Action or when Automaic time update takes place. Only enabled events are sent in that case, so we would like to have the first 5 events enabled, usually.

Ok now I understand why the first five events are enabled.

Can you create another branch, and I think you need to create a pull request, right?

Are you talking about a branch to implement the background sync or to fix the bug I just reported?

For this bug, if you can work on it. The background task I'm not sure we like to do. You can open a Issie for it, and we will look it later.

Ok, I will work on it, I hope I can fix it. I can't create directly a branch, I need to fork the repo and the create a pull request when the code is ready.

I will let you know,
Beniamino

Maybe while you are at it, try to understand why your events are marked as "incompatible". I think this is a good start. Usually event is incompatible if it has some coplex rules, which cannot be imlemented in the Casio watch, like "Every second Thuesday of the Month". This is beyond the capabilities of the watch. So, it would be good to find out why your simple events are marked 'incompatible".

Thanks again for your effort.

Maybe while you are at it, try to understand why your events are marked as "incompatible". I think this is a good start. Usually event is incompatible if it has some coplex rules, which cannot be imlemented in the Casio watch, like "Every second Thuesday of the Month". This is beyond the capabilities of the watch. So, it would be good to find out why your simple events are marked 'incompatible".

Thanks again for your effort.

I've identified one of the two types of incompatible events: it turns out that both the RRule library and the RRuleValues.kt code only check if the UNTIL property of the RRule is formatted as DateTime, overlooking the possibility of it being a simple Date. Google Calendar, for instance, saves UNTIL as a Date, leading to the app marking such events as incompatible. I've addressed this issue in my fork of the project. Additionally, I've forked the RRule library to implement the necessary fix and seamlessly integrated it with the CasioGShockSmartSync project. Let me know what you think of these changes. Now I need to take care of the other type of incompatible event.

Beniamino

Edit: I've done some testing of course. To reproduce the issue it's necessary to create an event that repeats until a certain date. I've got one already, plus I made another that repeats yearly until some future date.
Before the fix, both events were marked as incompatible. Now, they're recognized, and the app displays the correct date, along with information on until when the event repeats.
Everything is on the calendar-fix branch of my fork.

Thanks Beniamino,

I will look at your changes soon because I'm working on another feature request, but I have a couple of preliminary comments:

  1. I think we should not make any forks into other projects. The reason is, we are not sure if they will actually merge our changes, and also I would not be confident that I know better about their project than they do. Most likely, what I think is a bug, there may be a legitimate reason for doing it. I am just not familiar with their project. If they don't merge it for whatever reason, we end up supporting our dead branch forever. So in these cases, if we are really stuck with a buggy library, it is better to find another library that works. I think, for now, let us not try to modify their code.

  2. I may have missed something when I wrote this code, but I went through the Google Calendar events with a pretty fine comb. I think the issue might be that the Casio watch really does not support some event types. I would go through the Casio manual again to make sure these events are really supported.

  3. I will look into this further when I get some time.

So, I created a custom event, starting Feb 21 and ending Apr 20, repeating weekly on Wednessday:

and it appears like this in the app:

Am I doing something wrong? Can you try on a differnt phone?

So, I created a custom event, starting Feb 21 and ending Apr 20, repeating weekly. It apperas in the app

and it appears like this in the app:

image

Try to create an event which repeats every year instead of every week. That was the test that I've done.

OK, repeat every year on Feb 21 to April-21, 2026, I got this:

image

I left the title the same.

Are you usung Google calender or another one?

OK, repeat every year on Feb 21 to April-21, 2026, I got this:

image

I left the title the same.

I can show you that on my phone the error occurs... I don't why the issue is not replicable...

This is the event (sorry for the Italian language but it should be understandable)
Screenshot_20240216_192434_Calendar.jpg

This is the app Screenshot_20240216_192502_Casio G-Shock Smart Sync.jpg

Are you usung Google calender or another one?

I'm using Google Calendar

With the patched app the event shows up just fine.

OK, I'll try to reproduce it. Is that created with a custom event?
I'm not saying you are doing something wrong, I just want tu understand the reason for the patch.
I'll get back to you tlater

OK, I'll try to reproduce it. Is that created with a custom event?
I'm not saying you are doing something wrong, I just want tu understand the reason for the patch.
I'll get back to you tlater

The event is created with the "plus" button in bottom right corner. I select the option "event" and after that I fill the page as I showed you in the previous image.

With the patched app the event shows up like that Screenshot_20240216_200031_Casio G-Shock Smart Sync.jpg

The Google Calendar app in this case set the UNTIL property to 20260316 instead of 20260316T000000Z and this cause an error in the application. 🤷‍♂️

Ok, I have been creating the events on the desktop, not on the phone. I
think the phone app does it a bit different, and I will test when I get a
chance.

Is there anyway to go around the problem on this app, instead of working
their lib? I really don't like the idea of having a custom version of their library

Yes, of course. We need to add the last part to the UNTIL property (T000000Z) if missing and the problem is fixed. I created a custom version of the library because the iCalendar documentation (RFC 5545) says that the UNTIL property could be in both of the formats. So why create a workaround when the library does not meet the standards? We could improve it for this and other projects. In any case the fix is ​​very easy.

@imBenjamin741

Beniamino, if your patch is working, feel free to create a Pull Request, so we can merge it.

Ivo

@imBenjamin741

Beniamino, if your patch is working, feel free to create a Pull Request, so we can merge it.

Ivo

The patch works but uses the modified library. Today I was busy and I didn't have a chance to modify the code to create the workaround I was telling you about. As soon as I have time I'll fix it and make the pull request.

Thanks,
Beniamino

For some reason, I cannot reproduce the problem with the incompatible event. I tried creating one from my Android phone and it still worked for me.

Could you add me to your test event, so I can test with your event.

Thanks

For some reason, I cannot reproduce the problem with the incompatible event. I tried creating one from my Android phone and it still worked for me.

Could you add me to your test event, so I can test with your event.

Thanks

Sorry for the late reply, I've been very busy with university lately... I should have invited you to the event. See if you can replicate the error and let me know.

Thank you,
Beniamino

Initial information:

  • I have Android 14, crDroid, without Google Apps,
  • I don't use Google Calendar, I have a calendar built into the system: org.lineageos.etar

After updating from v12.1 to v12.2, the application stopped seeing my events from this calendar. Displays an empty list on the calendar tab.
In the earlier version, the app correctly saw my events and allowed me to send them to the watch.

Of course, I don't expect this to work for me because I don't use Google Calendar. I just want to let you know that this option previously worked correctly with my calendar, but with the new version it no longer works.

I have cyclical calendars (monthly and yearly) with an alarm.

@tomasz-c, Thanks for reporting this. I think I know what happened. Before this update, we could only see events that had alarms. This is not quite right because you may have an event that is not set by yourself, like an airline schedule set by the airline. In that case, they will not set an alarm for this event, and the event will not appear in the app. I changed that so all events in your personal calendar will appear. By personal calendar, I guess this means your account on the phone. This will eliminate other calendars, like holidays, which are in your "Holiday" calendar. This is not an issue if you are running Google Calendar, but I am not sure about other calendars.

So, what is the correct course of action? I can make a fix so that it will display events which are in your calendar and events which have alarms. This should handle most cases.

@tomasz-c and @imBenjamin741, what do you think?

Ivo

Yes, I like this idea. As you say, it would handle most cases.
Alternatively, maybe there is a way to set my calendar to be visible to the application like Google Calendar.

For example this application https://f-droid.org/packages/org.sufficientlysecure.ical/
shows my calendar as local and offline. Maybe some specific calendar name is required to be included?
Thank you for your interest in the topic even though I am not a Google customer :)

Screenshot_Calendar Import-Export

@tomasz-c This app looks promissing, and I will take a look at it in detail when I get a chance. In the meantime, I have updated "main" branch with my quick fix, and pushed it to GitHib. You can build the app and try it if you like. I'm trying to finish the BLE updates, and will create a new relase, hopefully in the next few days.

@izivkov I built the app with the latest changes. I confirm that I can see my calendar entries again and can sync them.
Thank you for these commits.

Fixed