Page MenuHomePhabricator

[keyserver/ web] Handle device_token on web
ClosedPublic

Authored by michal on Feb 21 2023, 4:17 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 21 2024, 1:47 PM
Unknown Object (File)
Feb 21 2024, 12:36 PM
Unknown Object (File)
Feb 21 2024, 12:36 PM
Unknown Object (File)
Feb 18 2024, 2:32 AM
Unknown Object (File)
Feb 18 2024, 2:23 AM
Unknown Object (File)
Feb 18 2024, 12:25 AM
Unknown Object (File)
Feb 17 2024, 11:21 PM
Unknown Object (File)
Feb 17 2024, 6:48 PM
Subscribers

Details

Summary

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

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

lib/utils/sanitization.js
303

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.Feb 21 2023, 6:58 AM
ashoat added inline comments.
web/redux/device-token.reducer.js
1
  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
web/redux/redux-setup.js
202

This could be in baseReducer I think

This revision now requires changes to proceed.Feb 21 2023, 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.
lib/types/redux-types.js
112 ↗(On Diff #23058)

Nice catch!

lib/utils/sanitization.js
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.Feb 27 2023, 1:03 AM