Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JWT] Get In-App Messages from Server #1476

Open
wants to merge 6 commits into
base: identity_verification_app_startup
Choose a base branch
from

Conversation

nan-li
Copy link
Contributor

@nan-li nan-li commented Aug 30, 2024

Description

One Line Summary

Update fetch IAMs to use the new endpoint, support JWT, and include the alias.

Details

Motivation

Fetch IAMs

Scope

Fetch IAMs

Future Work

  • The user and subscription model's relationship should be improved. Should the subscription model own a reference to its identity model that owns it?
  • The retrying fetch IAMs can be improved and less hacky.

Testing

Unit testing

No changes

Manual testing

New install with JWT on and off, misc scenarios tested

  • Works under normal flows with connection.
  • With JWT on, receive a 401 from fetch IAM. Then update the jwt token, and see the fetch that is immediately retried.
  • With JWT off, login to a new user with network turned off, and start a new session. Fetch IAM is blocked by null onesignal ID. Turn data on and the user is created. The fetch IAM is immediately retried.

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
    • If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
  • 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.
    • Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
  • I have reviewed this PR myself, ensuring it meets each checklist item
    • WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.

This change is Reviewable

* The client already logs the error response from the server
* The executors don't need to re-log the same response, just adds clutter.
* The client only logged sent requests that contained a body, now also log GETs that do not have a body, such as fetching remote params or IAMs
Motivation:
* The OSMessagingController will be a `OSUserJwtConfigListener` and observe jwt
* Optional bool is not compatible with objective c
* All methods that trigger fetching IAM from server will no longer pass the push subscription ID.
* The method to fetch IAM will itself handle the requirements.
* To get IAMs from the server, the following requirements are necessary:
 - A subscription ID
 - An appropriate alias (depending on Identity Verification enabled) for the subscription
 - A valid JWT token for the user if Identity Verification is enabled
* OSMessagingController will observe user and jwt
@nan-li
Copy link
Contributor Author

nan-li commented Aug 30, 2024

swiftlint file too long

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant