Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Fix/14992 EOL - Remove notifications syncronously #5140

Conversation

30mar
Copy link
Contributor

@30mar 30mar commented Apr 3, 2023

Description

  • When we reach EOL and try to close the app we try to cancel notifications in an async method, this wont work properly as the app will be removed from memory before the async block is reached and the notifications are canceled
  • the solutions is to call UNUserNotificationCenter.current().removeAllPendingNotificationRequests() which will do the same but synchronously.
    The downside of reverting the previous code:
    We wont be able to stop notifications in the future if the EOL is not reached yet. e.g today is 3/4/2023 Eol is 4/4/2023 and we have a notification scheduled in 5/4/2023. this notification will not be canceled unless the user tries to open, close, of move the app to background DURING End of life.

a redundant call was removed from applicationDidEnterBackground() as we will cancel anyway in applicationWillResignActive() which has to be called before applicationDidEnterBackground, so need to cancel twice

Link to Jira

https://jira-ibs.wbs.net.sap/browse/EXPOSUREAPP-14992

@30mar 30mar added the bug Something isn't working label Apr 3, 2023
@30mar 30mar added this to the v3.2.0 milestone Apr 3, 2023
@30mar 30mar requested a review from a team April 3, 2023 11:55
Copy link
Contributor

@flxschmidt flxschmidt left a comment

Choose a reason for hiding this comment

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

For me that's completely fine, as discussed.

@flxschmidt flxschmidt changed the title 14992 remove notifications syncronously in EOL Fix/14992 EOL - Remove notifications syncronously Apr 3, 2023
@30mar 30mar merged commit 8fd2f7e into release/3.2.x Apr 3, 2023
@30mar 30mar deleted the fix/14992-deadman-notification-still-comes-when-EOL-is-already-reached branch April 3, 2023 15:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants