HomePhabricator
Diffusion Comm 0481dc169f90

[native] Emit a token and user ID after setting the values

Description

[native] Emit a token and user ID after setting the values

Summary:
The emitter currently isn't fed with new values. The new values could be provided in multiple ways: from JS, from C++ CommRustModule, or from Rust.

The C++ layer exposes an API that allows setting the token, but we need to make sure that emitter is also aware about this change. Currently, the only place that consumes the events will be AccessTokenHandler, which then updates Redux, but directly updating Redux when calling CommRustModule won't be maintainable - there could be more emitter consumers in the future.

We can also consider calling emitter directly from Rust, but it also has some maintainability cost because the JS logic can decide how to handle the result.

So overall, this solution makes data flow simple and achieves what is needed. There are some other options, but introducing them should also result in removing setCommServicesAuthMetadata from JS.

Test Plan: Tested in combination with the next diff. Call commCoreModule.setCommServicesAuthMetadata and check if the token in Redux is updated. Add a timeout with a call to commCoreModule.setCommServicesAuthMetadata and check if it results in the token being updated.

Reviewers: varun, marcin, kamil, bartek

Reviewed By: bartek

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D10866

Details

Provenance
tomekAuthored on Jan 29 2024, 5:39 AM
Reviewer
bartek
Differential Revision
D10866: [native] Emit a token and user ID after setting the values
Parents
rCOMM5b7df280c482: [lib] Refactor logout in thread activity reducer
Branches
Unknown
Tags
Unknown