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
F3193563: D12672.id42778.diff
Fri, Nov 8, 11:05 PM
Unknown Object (File)
Fri, Nov 8, 12:24 PM
Unknown Object (File)
Fri, Nov 8, 12:24 PM
Unknown Object (File)
Fri, Nov 8, 5:59 AM
Unknown Object (File)
Sat, Oct 26, 7:17 AM
Unknown Object (File)
Sat, Oct 26, 6:41 AM
Unknown Object (File)
Sat, Oct 26, 6:06 AM
Unknown Object (File)
Sat, Oct 26, 12:35 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
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 ↗(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