OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native iOS app with OneSignal. https://onesignal.com
Other
496
stars
263
forks
source link
[JWT] Handle logout when Identity verification is on #1488
Handle logout when JWT is on by disabling the push subscription and still create an anonymous local user to prevent data updates.
Details
Motivation
When JWT is on, logout needs to be handled differently. This is a small PR, so logout is handled simply.
Scope
Logout will mostly be the same: an anonymous user is created locally but user creation will be blocked from sending to the server and this anonymous user's requests are dropped. Changing users in the SDK prevents mixing up data or making updates to the old user incorrectly.
Additionally, disable push sub when logout called with JWT on by using a local flag, which will send a subscription update request.
When login is next called, this flag will revert and the push subscription will maintain its original state.
Testing
Unit testing
❗️TODO
Manual testing
To fill out
Tested on iPhone 13 on iOS 17
Be logged in and push permission granted
Call logout and see the push subscription is disabled on server
Kill and re-open app to drive a new session
No IAM is fetched due to no viable alias
Log back into the same user and IAM is now fetched (driven by user change)
The login generates a user create request that sends the correct push subscription state from before disabling
Affected code checklist
[ ] Notifications
[ ] Display
[ ] Open
[ ] Push Processing
[ ] Confirm Deliveries
[ ] Outcomes
[ ] Sessions
[ ] In-App Messaging
[ ] REST API requests
[ ] Public API changes
Checklist
Overview
[ ] I have filled out all REQUIRED sections above
[ ] PR does one thing
[ ] Any Public API changes are explained in the PR details and conform to existing APIs
Testing
[ ] I have included test coverage for these changes, or explained why they are not needed
[ ] All automated tests pass, or I explained why that is not possible
[ ] I have personally tested this on my device, or explained why that is not possible
Final pass
[ ] Code is as readable as possible.
[ ] I have reviewed this PR myself, ensuring it meets each checklist item
Description
One Line Summary
Handle logout when JWT is on by disabling the push subscription and still create an anonymous local user to prevent data updates.
Details
Motivation
When JWT is on, logout needs to be handled differently. This is a small PR, so logout is handled simply.
Scope
Testing
Unit testing
❗️TODO
Manual testing
To fill out Tested on iPhone 13 on iOS 17
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is