Page MenuHomePhabricator

Implement utility functions to check if we have content or notif session with device
ClosedPublic

Authored by marcin on Jul 4 2024, 9:30 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Sep 8, 3:03 PM
Unknown Object (File)
Sun, Sep 8, 3:02 PM
Unknown Object (File)
Sun, Sep 8, 3:02 PM
Unknown Object (File)
Sat, Sep 7, 1:46 PM
Unknown Object (File)
Sat, Sep 7, 1:44 PM
Unknown Object (File)
Sat, Sep 7, 1:44 PM
Unknown Object (File)
Thu, Sep 5, 5:15 PM
Unknown Object (File)
Thu, Sep 5, 2:28 PM
Subscribers

Details

Summary

This differential implements simple utility functions to check if we have session for both content and/or notifs with particular device.

Test Plan

Tested in D12673

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

marcin requested review of this revision.Jul 4 2024, 9:50 AM
tomek added inline comments.
native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
1477 ↗(On Diff #42042)

Is it guaranteed that this code never fails? Should we add some error handling?

web/shared-worker/worker/worker-crypto.js
756 ↗(On Diff #42042)

We should never place the await keyword deep inside the statement.

This revision is now accepted and ready to land.Jul 10 2024, 4:56 AM
native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
1477 ↗(On Diff #42042)

We should:

  1. Check for contentCryptoModule nullability.
  2. We can add try{} catch{}. Wouldn't hurt but those are only hash map operations.

Add error handling to CommCoreModule::isContentSessionInitialized

kamil added a subscriber: kamil.
kamil added inline comments.
native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
1480

do we need this check if we only care about content?

native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
1480

With or without the check for notifs this method will fail if someone forgets to call initializeCryptoAccount. On the other hand if someone calls initializeCryptoAccount it will ensure to initialize both accounts. Therefore removing this check would suggest that we allow the crypto state to be partially which is not true. If we get into state where content is initialized but notifs is not then it is a bug that has to be detected and fixed.

Add additional method to check for presence of notifications session for multiple devices with one db query