quarck / CalendarNotification

Android app extending calendar notifications with snooze button and notifications persistence
GNU General Public License v3.0
104 stars 39 forks source link

Notifications re-appear after dismissing #267

Open woj-tek opened 7 years ago

woj-tek commented 7 years ago

I have a couple of morning tasks. They show up correctly at about 6:00, 7:00 and so forth. I dismiss them when I'm done and... they re-appear around noon. at 12 I have a task that enables System-wide synchronisation (that's the only correlation I can think of). It started happening since about 1-2 weeks ago.

woj-tek commented 6 years ago

A little bit more information -- it looks like that for some reason after enabling synchronisation the notifications for all events to the moment of re-enabling synchronisation are being displayed, i.e. chain of events:

discoball78 commented 6 years ago

I also notice this behaviour. I cannot detect a specific pattern but generally a day later (or more) I will receive a repeat of a dismissed notification. Sometimes multiple times.

Running MIUI 9.0 Stable 9.0.5.0(NCFCNEI) Android 7.0 Kernel Ver 3.18.31-perf-g5b30ef0

DonEstefan commented 6 years ago

I have the same problem here.

In my case it seems to be caused by multiple devices accessing the same calendar.

It seems like CalendarNotification does not write any changes to the caldav-event when I dismiss the notification. So other devices accessing the same calendar (like my windows laptop) will not be aware that the notification has already been dismissed on android. So the other devices will also show you a notification for the same event. But after you dismiss the notification here, they will usually write the fact that the notification has been dismissed into the calendar-event. From now on all applications should know the notification for this event has already been dismissed and you should never see a notification for this event again. But this change seems to confuse CalendarNotification. I guess it just realizes the event has been changed - without understanding the intention of the change. So it notifies again to make sure you are aware something has been changed...

woj-tek commented 6 years ago

I'm syncing to google calendar and davdroid. Only events from google calendar seems to appear again. I'm also syncing same calendars on macOS (but not showing any notifications for that particular calendars/events). It was working OK and it started to misbehave recently again.

sphh commented 6 years ago

I can confirm this behaviour: I use DAVdroid to synchronize my calendar with the laptop. Everytime after DAVdroid synchronized the calendar, I see all dismissed notifications again.

david-53111 commented 6 years ago

Any ideas on how to solve this or are there alternatives? I would really like to be able to postpone or dismiss notifications and have it synced across devices. I'm also using DAVdroid. Slight difference to you guys: I just get two notifications within about 20 minutes for the same event without having even opened the first one. There are no duplicate events or calendars that might cause this.

CaviaPorcellus commented 6 years ago

I also have this issue. I wonder if it's an issue with DAVdroid in some way. When I used CalDAV-Sync with Calendar Notification I would never get duplicates.

DonEstefan commented 6 years ago

I just installed version 4.0.7 via play store. It says "fixed suppport for webdav calenders -- events should not re-appear now". Unfortunately the fix is not working for me :( I'm still seeing events re-appear...

jscottnc commented 5 years ago

I think I understand what is going on from my brief review of the code. Event alerts are loaded based on the calendar record state, in particular whether the record had been dismissed. The code does not check the event end time. I suspect that when the calendar is synced with an external source (Outlook.office365.com in my case) the dismissed flag is overwritten and the event is alerted on the next calendar scan (my WAG). If events that have already ended were ignored, this would go a long way to addressing my issue.

jscottnc commented 5 years ago

I have hacked in a check for instanceEndTime > System.currentTimeMillis() and skipped adding the event to the alert list if false. I modified Calendar provider::getAlertByTime and CalendarIntents::intentForAction. So far I get alerts I expect and none for expired events. I have seen old events in the notification but not had the notification triggered by old events. I can live with that.

DonEstefan commented 5 years ago

In my case the problem was gone for several months (since late 2018) - but it came back in one of the releases in the last weeks... I just realized that I'm still on Version 4.0.19-legacy. Seems like the I did not get any updates for a long time... I had to delete the app and reinstall via F-Droid.org to get the fixed version.

woj-tek commented 5 years ago

@jscottnc would you consider doing a PR with your fix? It does seem like the root cause and maybe @quarck would consider merging it?

jscottnc commented 5 years ago

Sounds like work (which I generally avoid). At the very least you will have to tell me what a PR is. John Scott jscottnc@yahoo.com "You can't be a real country unless you have a beer and an airline. It helps if you have some kind of football team and some nuclear weapons, but at the very least, you need a beer."  --F. Zappa

On Tuesday, September 3, 2019, 02:49:09 PM EDT, Wojtek <notifications@github.com> wrote:  

@jscottnc would you consider doing a PR with your fix? It does seem like the root cause and maybe @quarck would consider merging it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

woj-tek commented 5 years ago

PR - Pull Request.

In a nutshell:

jscottnc commented 5 years ago

Had to dust off the git skills. Fortunately I did not need anything fancy and could use the cookbook to get me through. Fork created. Changes synced. Pull Request generated. Release the hounds!

https://github.com/jscottnc/CalendarNotification

woj-tek commented 5 years ago

Thank you @jscottnc - now it's in the hands of @quarck

DonEstefan commented 4 years ago

Seems like the workaround from @jscottnc has been integrated in version 5.0.5 of the app. There is a new skip expired events option in the "Behavior" section of the settings. This should significantly reduce the problem. The option is disabled by default, because there are some implications you should be aware of. To my understanding this includes (but is not limited to):

However, for me this is still a lot better than before and I'd like to thank everyone involved. It is much appreciated!!!