web-monetization-projects icon indicating copy to clipboard operation
web-monetization-projects copied to clipboard

After logging in, reactivated tabs should stream immediately without refresh

Open sublimator opened this issue 2 years ago • 1 comments

See here: https://linear.app/coil/issue/COIL-1503/coil-extension-hangs-at-setting-up-payment

sublimator avatar Mar 24 '22 06:03 sublimator

Scenario 1:

  1. The user goes to a monetized site and is not logged in. Icon state= unavailable
  2. The user clicks on the browser action icon and is taken to coil.com
  3. The user logs in
  4. The user switches back to the site from step 1

Expectation: the site immediately starts streaming

Scenario 2:

  1. The user is logged in as test user A
  2. The user goes to a monetized site
  3. The user logs out
  4. The user logs in as test user B
  5. The user navigates back to the monetized site from step 2

Expectation: the site immediately starts streaming

Note that on logout, a lot of state is deleted in the background page, so we really need to either:

  1. Not delete the relevant state Stream currently has a token, though with the DI now, it should be easy to inject the AuthService and get the token lazily rather than upon Stream construction as is currently the case

    One would need to create the Stream during startWebMonetization so it can be "resumed" upon tab reactivation (after logging in)

  2. Force the content script to send the startWebMonetization again If so, should it create new requestId[s] ? If there's a good argument for that, then option 2 is the only way to go

sublimator avatar Mar 24 '22 07:03 sublimator