diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.h b/native/cpp/CommonCpp/NativeModules/CommCoreModule.h --- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.h +++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.h @@ -61,9 +61,6 @@ jsi::Value setCurrentUserID(jsi::Runtime &rt, const jsi::String &userID) override; jsi::Value getCurrentUserID(jsi::Runtime &rt) override; - jsi::Value - setDeviceID(jsi::Runtime &rt, const jsi::String &deviceType) override; - jsi::Value getDeviceID(jsi::Runtime &rt) override; jsi::Value clearSensitiveData(jsi::Runtime &rt) override; public: diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp --- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp +++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp @@ -1,5 +1,4 @@ #include "CommCoreModule.h" -#include "../CryptoTools/DeviceID.h" #include "DatabaseManager.h" #include "GRPCStreamHostObject.h" #include "InternalModules/GlobalDBSingleton.h" @@ -996,50 +995,6 @@ }); } -jsi::Value -CommCoreModule::setDeviceID(jsi::Runtime &rt, const jsi::String &deviceType) { - std::string type = deviceType.utf8(rt); - std::string deviceID; - try { - deviceID = DeviceIDGenerator::generateDeviceID(type); - } catch (std::invalid_argument &e) { - throw jsi::JSError( - rt, - "setDeviceID: incorrect function argument. Must be one of: " - "KEYSERVER, WEB, MOBILE."); - } - GlobalDBSingleton::instance.scheduleOrRun([&rt, deviceID]() { - try { - DatabaseManager::getQueryExecutor().setDeviceID(deviceID); - } catch (const std::exception &e) { - throw jsi::JSError(rt, e.what()); - } - }); - return jsi::String::createFromUtf8(rt, deviceID); -} - -jsi::Value CommCoreModule::getDeviceID(jsi::Runtime &rt) { - return createPromiseAsJSIValue( - rt, [this](jsi::Runtime &innerRt, std::shared_ptr promise) { - GlobalDBSingleton::instance.scheduleOrRun([this, &innerRt, promise]() { - std::string error; - std::string result; - try { - result = DatabaseManager::getQueryExecutor().getDeviceID(); - } catch (const std::exception &e) { - error = e.what(); - } - this->jsInvoker_->invokeAsync([&innerRt, error, result, promise]() { - if (error.size()) { - promise->reject(error); - } else { - promise->resolve(jsi::String::createFromUtf8(innerRt, result)); - } - }); - }); - }); -} - jsi::Value CommCoreModule::clearSensitiveData(jsi::Runtime &rt) { return createPromiseAsJSIValue( rt, [this](jsi::Runtime &innerRt, std::shared_ptr promise) { diff --git a/native/cpp/CommonCpp/_generated/NativeModules.h b/native/cpp/CommonCpp/_generated/NativeModules.h --- a/native/cpp/CommonCpp/_generated/NativeModules.h +++ b/native/cpp/CommonCpp/_generated/NativeModules.h @@ -40,8 +40,6 @@ virtual jsi::Value clearNotifyToken(jsi::Runtime &rt) = 0; virtual jsi::Value setCurrentUserID(jsi::Runtime &rt, const jsi::String &userID) = 0; virtual jsi::Value getCurrentUserID(jsi::Runtime &rt) = 0; -virtual jsi::Value setDeviceID(jsi::Runtime &rt, const jsi::String &deviceType) = 0; -virtual jsi::Value getDeviceID(jsi::Runtime &rt) = 0; virtual jsi::Value clearSensitiveData(jsi::Runtime &rt) = 0; }; diff --git a/native/cpp/CommonCpp/_generated/NativeModules.cpp b/native/cpp/CommonCpp/_generated/NativeModules.cpp --- a/native/cpp/CommonCpp/_generated/NativeModules.cpp +++ b/native/cpp/CommonCpp/_generated/NativeModules.cpp @@ -80,12 +80,6 @@ static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getCurrentUserID(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->getCurrentUserID(rt); } -static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_setDeviceID(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { - return static_cast(&turboModule)->setDeviceID(rt, args[0].getString(rt)); -} -static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getDeviceID(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { - return static_cast(&turboModule)->getDeviceID(rt); -} static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_clearSensitiveData(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->clearSensitiveData(rt); } @@ -114,8 +108,6 @@ methodMap_["clearNotifyToken"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_clearNotifyToken}; methodMap_["setCurrentUserID"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_setCurrentUserID}; methodMap_["getCurrentUserID"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getCurrentUserID}; - methodMap_["setDeviceID"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_setDeviceID}; - methodMap_["getDeviceID"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getDeviceID}; methodMap_["clearSensitiveData"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_clearSensitiveData}; } diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js --- a/native/schema/CommCoreModuleSchema.js +++ b/native/schema/CommCoreModuleSchema.js @@ -50,8 +50,6 @@ +clearNotifyToken: () => Promise; +setCurrentUserID: (userID: string) => Promise; +getCurrentUserID: () => Promise; - +setDeviceID: (deviceType: string) => Promise; - +getDeviceID: () => Promise; +clearSensitiveData: () => Promise; }