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
F3341479: D12672.id43075.diff
Thu, Nov 21, 11:02 PM
F3340410: D12672.id43133.diff
Thu, Nov 21, 9:45 PM
F3337665: D12672.diff
Thu, Nov 21, 4:58 PM
Unknown Object (File)
Wed, Nov 20, 3:42 AM
Unknown Object (File)
Wed, Nov 20, 3:42 AM
Unknown Object (File)
Wed, Nov 20, 3:42 AM
Unknown Object (File)
Wed, Nov 20, 3:42 AM
Unknown Object (File)
Wed, Nov 20, 3:42 AM
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
Lint Not Applicable
Unit
Tests Not Applicable

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 ↗(On Diff #42292)

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

native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
1480 ↗(On Diff #42292)

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