Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Limit rewards outbound calls until rewards interaction #3410

Closed
kylehickinson opened this issue Mar 15, 2021 · 5 comments · Fixed by #3456
Closed

Limit rewards outbound calls until rewards interaction #3410

kylehickinson opened this issue Mar 15, 2021 · 5 comments · Fixed by #3456

Comments

@kylehickinson
Copy link
Collaborator

kylehickinson commented Mar 15, 2021

Desktop does this on client side by not creating the process unless they'd previously opted in, iOS will likely have to do something similar

Test Plan

Rewards/ads domains to look for:

grant.rewards.*.com
api.rewards.*.com
ads-serve.*.com
brave-user-model-installer-*.*.com

With a proxy app open & active (Charles, Proxyman, etc.):

  • Launch fresh install, verify no rewards/ads calls are called on launch
  • Open the rewards panel and verify some rewards calls happen
  • Enable Rewards and verify rest of ads calls happen and ads/rewards functions as normal
  • Kill app (force quit), relaunch and verify Rewards calls now happen at launch (because Rewards is enabled)
  • Disable rewards, Kill app (force quit), relaunch and verify calls do not happen at launch
  • Visit Settings > Brave Rewards (with Rewards still disabled) and verify some rewards calls happen (same calls that happen when visiting panel in step 2)
@kylehickinson kylehickinson added this to the 1.25 milestone Mar 15, 2021
kylehickinson added a commit that referenced this issue Mar 24, 2021
This moves the assumption that ledger will be initialized immediately on launch, every launch, to possibly being deferred until user interaction.

This change moves to match desktop's logic around ledger only being initialized on launch if a user has already enabled Rewards (in our case we check for ads enabled since we control that preference). If they have not, then no outbound calls or ledger initialization happen until after the user opens either the Rewards panel or enters the Rewards settings screen
@kylehickinson kylehickinson changed the title Limit rewards outbound calls until wallet creation Limit rewards outbound calls until rewards interaction Mar 24, 2021
kylehickinson added a commit that referenced this issue Apr 7, 2021
This moves the assumption that ledger will be initialized immediately on launch, every launch, to possibly being deferred until user interaction.

This change moves to match desktop's logic around ledger only being initialized on launch if a user has already enabled Rewards (in our case we check for ads enabled since we control that preference). If they have not, then no outbound calls or ledger initialization happen until after the user opens either the Rewards panel or enters the Rewards settings screen
kylehickinson added a commit that referenced this issue Apr 14, 2021
This moves the assumption that ledger will be initialized immediately on launch, every launch, to possibly being deferred until user interaction.

This change moves to match desktop's logic around ledger only being initialized on launch if a user has already enabled Rewards (in our case we check for ads enabled since we control that preference). If they have not, then no outbound calls or ledger initialization happen until after the user opens either the Rewards panel or enters the Rewards settings screen
kylehickinson added a commit that referenced this issue Apr 14, 2021
…#3456)

This moves the assumption that ledger will be initialized immediately on launch, every launch, to possibly being deferred until user interaction.

This change moves to match desktop's logic around ledger only being initialized on launch if a user has already enabled Rewards (in our case we check for ads enabled since we control that preference). If they have not, then no outbound calls or ledger initialization happen until after the user opens either the Rewards panel or enters the Rewards settings screen
@srirambv
Copy link
Contributor

QA Blocked on test plan

@kylehickinson
Copy link
Collaborator Author

@srirambv Test cases added, let me know if you need any additional info 🙂

@kjozwiak
Copy link
Member

kjozwiak commented Apr 27, 2021

  • Verification PASSED on iPhone 11 running iOS 14.4.2 using 1.25 (21.4.27.17) - PASSED
  • Verification PASSED on iPad Mini 4 running iOS 13.7 using 1.25 (21.4.27.17) - PASSED
  • Verification PASSED on iPad Air (3rd Gen) running iOS 14.4.2 using 1.25 (21.4.27.17) - PASSED

Test Cases as per #3410 (comment)

Launched Brave and ensured that none of the above reward API calls are occurring when launching Brave and rewards is disabled:

API calls when launching Brave for the first time

* https://adblock-data.s3.brave.com
* https://laptop-updates.brave.com

Ensured that tapping on the rewards panel contacts the following reward API calls:

API calls when tapping on the rewards panel for the first time

* https://grant.rewards.brave.com
* https://rewards.brave.com
* https://api.rewards.brave.com

Once rewards has been enabled, ensured that the following API endpoints are contacted:

API calls when enabling rewards for the first time

* https://ads-static.brave.com
* https://ads-serve.brave.com
* https://brave-user-model-installer-input.s3.brave.com

Closed/Quit Brave and relaunched while rewards was enabled and ensured that the following API endpoints are contacted:

API calls when rewards enabled and Brave is launched

* https://api.rewards.brave.com
* https://brave-user-model-installer-input.s3.brave.com
* https://ads-static.brave.com
* https://ads-serve.brave.com
* https://grant.rewards.brave.com

Ensured that none of the above reward API calls are made once rewards has been disabled and the browser restarted:

API calls when rewards has been disabled and Brave restarted

* https://adblock-data.s3.brave.com
* https://laptop-updates.brave.com

Ensured only the following API call is made when viewing the Brave Rewards under Settings while rewards is disabled:

Viewing Brave Rewards settings while rewards disabled

https://api.rewards.brave.com

@kjozwiak
Copy link
Member

We'll also do a general regression check when we run through the manual passes and ensure that rewards is still working as expected 👍

@kjozwiak
Copy link
Member

Changing from release-notes/exclude to release-notes/include as this was a big issue on desktop/android when it happened. Should definitely be mentioned.

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

Successfully merging a pull request may close this issue.

3 participants