HomePhabricator
Diffusion Comm 18ec3182704c

[native] add versionSupported method to CommRustModule

Description

[native] add versionSupported method to CommRustModule

Summary:
This method calls the identity service's ping RPC and parses the response to determine if the client code version is supported. This method will be used in a React component to tell users to upgrade unsupported clients.

Depends on D9812

Test Plan:

diff --git a/native/data/sqlite-data-handler.js b/native/data/sqlite-data-handler.js
index 50bbaa8b8..aa9f16d34 100644
--- a/native/data/sqlite-data-handler.js
+++ b/native/data/sqlite-data-handler.js
@@ -22,7 +22,7 @@ import { getMessageForException } from 'lib/utils/errors.js';
 import { ashoatKeyserverID } from 'lib/utils/validation-utils.js';

 import { filesystemMediaCache } from '../media/media-cache.js';
-import { commCoreModule } from '../native-modules.js';
+import { commCoreModule, commRustModule } from '../native-modules.js';
 import { setStoreLoadedActionType } from '../redux/action-types.js';
 import { useSelector } from '../redux/redux-utils.js';
 import { StaffContext } from '../staff/staff-context.js';
@@ -32,6 +32,9 @@ import { isTaskCancelledError } from '../utils/error-handling.js';
 import { useStaffCanSee } from '../utils/staff-utils.js';

 async function clearSensitiveData() {
+  const versionSupported = await commRustModule.versionSupported();
+  Alert.alert('version supported: ' + versionSupported);
+
   await commCoreModule.clearSensitiveData();
   try {
     await filesystemMediaCache.clearCache();
  1. got back true in the alert
  2. hardcoded ping RPC to return a version unsupported error and got back false in the alert

Reviewers: bartek, kamil, michal

Reviewed By: bartek

Subscribers: ashoat, tomek, wyilio

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

Details

Provenance
varunAuthored on Nov 9 2023, 2:44 PM
Reviewer
bartek
Differential Revision
D9813: [native] add versionSupported method to CommRustModule
Parents
rCOMM81924c6ebe69: [shared] introduce ping client method in grpc_clients crate
Branches
Unknown
Tags
Unknown