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

fix(push): Prevent Unintended OptOuts #2587

Merged
merged 4 commits into from
Sep 15, 2023
Merged

Conversation

tylerjroach
Copy link
Member

@tylerjroach tylerjroach commented Sep 15, 2023

  • PR title and description conform to Pull Request guidelines.

Issue #, if available:

Description of changes:

Issue #1
During Amplify's configuration, a call is made to the FirebaseMessaging sdk to grab the token. However, this call is asynchronous (FirebaseMessaging.getInstance().token.addOnCompleteListener) and if a Amplify.Notifications.Push.identifyUser() call is made before the token is returned, it will not locate the token and send OptOut = NONE.

Issue #2
Amplify Push Notifications and Amplify Analytics are appearing to conflict with one another. Each library updates the same endpoint/profile. Each time an analytics endpoint is sent (or even configured), it will send an endpoint update without the token and push channel type. This results in OptOut = All getting set. I was able to observe this by creating a sample app with 2 buttons. The first button called Amplify.Notifications.Push.identifyUser(). The second button called Amplify.Analytics.identifyUser(). When the push button was clicked, the profile was updated with OptOut = NONE. When the analytics button was clicked, OptOut = ALL becomes set.

How did you test these changes?
(Please add a line here how the changes were tested)

Documentation update required?

  • No
  • Yes (Please include a PR link for the documentation update)

General Checklist

  • Added Unit Tests
  • Added Integration Tests
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@tylerjroach tylerjroach requested a review from a team as a code owner September 15, 2023 16:53
@tylerjroach tylerjroach enabled auto-merge (squash) September 15, 2023 17:25
@codecov-commenter
Copy link

Codecov Report

Merging #2587 (55139df) into main (fdba2d9) will decrease coverage by 0.08%.
The diff coverage is 21.05%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##             main    #2587      +/-   ##
==========================================
- Coverage   41.25%   41.18%   -0.08%     
==========================================
  Files         885      885              
  Lines       28246    28254       +8     
  Branches     3994     3995       +1     
==========================================
- Hits        11654    11636      -18     
- Misses      15311    15338      +27     
+ Partials     1281     1280       -1     

@tylerjroach tylerjroach merged commit 10d8914 into main Sep 15, 2023
3 checks passed
@tylerjroach tylerjroach deleted the tjroach/opt-out-issue-fix branch September 15, 2023 18:25
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.

4 participants