Page MenuHomePhabricator

[keyserver/ web] Handle device_token on web

Authored by michal on Tue, Feb 21, 4:17 AM.
Referenced Files
Unknown Object (File)
Mon, Mar 13, 1:48 AM
Unknown Object (File)
Thu, Mar 9, 8:59 AM
Unknown Object (File)
Sat, Mar 4, 4:34 AM
Unknown Object (File)
Sat, Mar 4, 1:51 AM
Unknown Object (File)
Tue, Feb 28, 6:34 PM
Unknown Object (File)
Wed, Feb 22, 2:11 PM
Unknown Object (File)
Wed, Feb 22, 9:57 AM
Unknown Object (File)
Wed, Feb 22, 9:57 AM



We need to store device_token on web so we can save push service endpoints and auth info. This diff make deviceToken a proper field in web redux and enables the web app to set it's device token on keyserver. I've removed isDeviceType checks in places where previously we skipped handling deviceToken for the web platform.

Test Plan

Tested with the next diffs in stack that set the device_token:

  • check that the device_token is correctly set in the database and in the redux on web
  • check that after logging out the device_token is assigned to an anonymous cookie
  • check that after another user logs in they get the device's device_token

Diff Detail

rCOMM Comm
Lint Not Applicable
Tests Not Applicable

Event Timeline

303 ↗(On Diff #22825)

This is changed for flow because no WebAppState also contains a deviceToken so we don't know if it's NativeAppState or WebAppState

inka added 1 blocking reviewer(s): tomek.
ashoat requested changes to this revision.Tue, Feb 21, 6:58 AM
ashoat added inline comments.
1 ↗(On Diff #22825)
  1. Seems like this code can be shared between native and web. Can you add a new diff before this one that extracts the existing logic from native to lib?
  2. '.reducer.js doesn't seem to match existing conventions
202 ↗(On Diff #22825)

This could be in baseReducer I think

This revision now requires changes to proceed.Tue, Feb 21, 6:58 AM

Moved the code for the device token reducer to lib in a previous diff. Moved the device token to BaseAppState and reduce it in the baseReducer.

ashoat added inline comments.
112 ↗(On Diff #23058)

Nice catch!

303 ↗(On Diff #23058)

We don't need this alias anymore. Can you delete this line?

This revision is now accepted and ready to land.Mon, Feb 27, 1:03 AM