wordpress-mobile / wordpress-mobile/WordPress-iOS
Push Notifications Stack: Tech Debt
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 3.9k
- Forks
- 1.2k
- Avg merge
- 23h 51m
- Merged PRs (30d)
- 58
Description
Description:
We need to clean and modernize our Push Notifications Stack:
- Push Notifications have, mainly, two aspects: the API that runs when a Push arrives, and the API that runs when the user interacts with a System Alert
- Before iOS 10, all of it was handled by PushNotificationsManager
- Standard way to check if the user pressed on a Push Alert has always been
applicationState != .background - In iOS 10 AAPL introduced UNUserNotificationCenter
- We've built
InteractiveNotificationsManagerto encapsulate handling of Push Notifications with multiple interactions (Like / Approve / Etc) - In iOS 13 point (3) stopped being accurate, and has been the source of Issue #14349
Details:
Tech Debt has been increasing, and we've reached a point in which both PushNotificationsManager and InteractiveNotificationsManager call each other.
We must:
- Review all the things
- Drop
applicationStateusage - Definitely drop
@objc - Ideally speaking, have 3 classes to deal with the use cases we've got:
Push Registration: Registering / requesting permissionsPush Notification Received: The document arrived. Used by the AppDelegatePush Notification Pressed: User interaction was detected. Used by UNUserNotificationCenter
- (2) and (3) may need to run the same code in few specific scenarios such as "Push Auth Received" while the app was in foreground, or "Push Auth was pressed".
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the calls between PushNotificationsManager and InteractiveNotificationsManager, then inspect their AppDelegate and UNUserNotificationCenter entry points. Map registration, received, and pressed use cases before deciding how the three proposed responsibilities should be separated. Done means the circular calls, applicationState usage, and unnecessary @objc usage are removed while shared foreground/auth scenarios still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, swift
- Domain
- mobile
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100