Page MenuHomePhabricator

D9556.id32436.diff
No OneTemporary

D9556.id32436.diff

diff --git a/native/cpp/CommonCpp/CryptoTools/DeviceID.h b/native/cpp/CommonCpp/CryptoTools/DeviceID.h
deleted file mode 100644
--- a/native/cpp/CommonCpp/CryptoTools/DeviceID.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#pragma once
-
-#include "lib.rs.h"
-#include <string>
-#include <unordered_map>
-
-namespace comm {
-
-class DeviceIDGenerator {
- static const std::unordered_map<std::string, DeviceType> DEVICE_TYPE_MAP;
-
-public:
- static std::string generateDeviceID(std::string deviceType);
-};
-
-} // namespace comm
diff --git a/native/cpp/CommonCpp/CryptoTools/DeviceID.cpp b/native/cpp/CommonCpp/CryptoTools/DeviceID.cpp
deleted file mode 100644
--- a/native/cpp/CommonCpp/CryptoTools/DeviceID.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#include "DeviceID.h"
-
-namespace comm {
-
-const std::unordered_map<std::string, DeviceType>
- DeviceIDGenerator::DEVICE_TYPE_MAP = {
- {"KEYSERVER", DeviceType::KEYSERVER},
- {"WEB", DeviceType::WEB},
- {"MOBILE", DeviceType::MOBILE}};
-
-std::string DeviceIDGenerator::generateDeviceID(std::string deviceType) {
- auto type = DeviceIDGenerator::DEVICE_TYPE_MAP.find(deviceType);
- if (type == DeviceIDGenerator::DEVICE_TYPE_MAP.end()) {
- throw std::invalid_argument{
- "generateDeviceID: incorrect function argument. Must be one of: "
- "KEYSERVER, WEB, MOBILE."};
- }
- rust::String deviceID = generate_device_id(type->second);
- return std::string(deviceID.c_str());
-}
-
-} // namespace comm
diff --git a/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h b/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h
--- a/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h
+++ b/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h
@@ -72,8 +72,6 @@
virtual void clearNotifyToken() const = 0;
virtual void setCurrentUserID(std::string userID) const = 0;
virtual std::string getCurrentUserID() const = 0;
- virtual void setDeviceID(std::string deviceID) const = 0;
- virtual std::string getDeviceID() const = 0;
virtual void setMetadata(std::string entry_name, std::string data) const = 0;
virtual void clearMetadata(std::string entry_name) const = 0;
virtual std::string getMetadata(std::string entry_name) const = 0;
diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h
--- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h
+++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h
@@ -76,8 +76,6 @@
void clearNotifyToken() const override;
void setCurrentUserID(std::string userID) const override;
std::string getCurrentUserID() const override;
- void setDeviceID(std::string deviceID) const override;
- std::string getDeviceID() const override;
void setMetadata(std::string entry_name, std::string data) const override;
void clearMetadata(std::string entry_name) const override;
std::string getMetadata(std::string entry_name) const override;
diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
--- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
+++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
@@ -1299,14 +1299,6 @@
return this->getMetadata("current_user_id");
}
-void SQLiteQueryExecutor::setDeviceID(std::string deviceID) const {
- this->setMetadata("device_id", deviceID);
-};
-
-std::string SQLiteQueryExecutor::getDeviceID() const {
- return this->getMetadata("device_id");
-};
-
void SQLiteQueryExecutor::setMetadata(std::string entry_name, std::string data)
const {
Metadata entry{
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
@@ -83,9 +83,6 @@
virtual jsi::Value
setCurrentUserID(jsi::Runtime &rt, jsi::String userID) override;
virtual jsi::Value getCurrentUserID(jsi::Runtime &rt) override;
- virtual jsi::Value
- setDeviceID(jsi::Runtime &rt, jsi::String deviceType) override;
- virtual jsi::Value getDeviceID(jsi::Runtime &rt) override;
virtual jsi::Value clearSensitiveData(jsi::Runtime &rt) override;
virtual bool checkIfDatabaseNeedsDeletion(jsi::Runtime &rt) override;
virtual void reportDBOperationsFailure(jsi::Runtime &rt) override;
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 "../Notifications/BackgroundDataStorage/NotificationsCryptoModule.h"
#include "BaseDataStore.h"
#include "DatabaseManager.h"
@@ -791,72 +790,6 @@
});
}
-jsi::Value
-CommCoreModule::setDeviceID(jsi::Runtime &rt, jsi::String deviceType) {
- std::string type = deviceType.utf8(rt);
- std::string deviceID;
- std::string deviceIDGenerationError;
-
- try {
- deviceID = DeviceIDGenerator::generateDeviceID(type);
- } catch (std::invalid_argument &e) {
- deviceIDGenerationError =
- "setDeviceID: incorrect function argument. Must be one of: KEYSERVER, "
- "WEB, MOBILE.";
- }
-
- return createPromiseAsJSIValue(
- rt, [=](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
- taskType job = [this,
- &innerRt,
- promise,
- deviceIDGenerationError,
- deviceID]() {
- std::string error = deviceIDGenerationError;
- if (!error.size()) {
- try {
- DatabaseManager::getQueryExecutor().setDeviceID(deviceID);
- } catch (const std::exception &e) {
- error = e.what();
- }
- }
- this->jsInvoker_->invokeAsync([&innerRt, promise, error, deviceID]() {
- if (error.size()) {
- promise->reject(error);
- } else {
- promise->resolve(jsi::String::createFromUtf8(innerRt, deviceID));
- }
- });
- };
- GlobalDBSingleton::instance.scheduleOrRunCancellable(
- job, promise, this->jsInvoker_);
- });
-}
-
-jsi::Value CommCoreModule::getDeviceID(jsi::Runtime &rt) {
- return createPromiseAsJSIValue(
- rt, [this](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
- taskType job = [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));
- }
- });
- };
- GlobalDBSingleton::instance.scheduleOrRunCancellable(
- job, promise, this->jsInvoker_);
- });
-}
-
jsi::Value CommCoreModule::clearSensitiveData(jsi::Runtime &rt) {
return createPromiseAsJSIValue(
rt, [this](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
diff --git a/native/cpp/CommonCpp/_generated/commJSI-generated.cpp b/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
--- a/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
+++ b/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
@@ -97,12 +97,6 @@
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getCurrentUserID(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->getCurrentUserID(rt);
}
-static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_setDeviceID(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
- return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->setDeviceID(rt, args[0].asString(rt));
-}
-static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getDeviceID(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
- return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->getDeviceID(rt);
-}
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_clearSensitiveData(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->clearSensitiveData(rt);
}
@@ -161,8 +155,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};
methodMap_["checkIfDatabaseNeedsDeletion"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_checkIfDatabaseNeedsDeletion};
methodMap_["reportDBOperationsFailure"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_reportDBOperationsFailure};
diff --git a/native/cpp/CommonCpp/_generated/commJSI.h b/native/cpp/CommonCpp/_generated/commJSI.h
--- a/native/cpp/CommonCpp/_generated/commJSI.h
+++ b/native/cpp/CommonCpp/_generated/commJSI.h
@@ -47,8 +47,6 @@
virtual jsi::Value clearNotifyToken(jsi::Runtime &rt) = 0;
virtual jsi::Value setCurrentUserID(jsi::Runtime &rt, jsi::String userID) = 0;
virtual jsi::Value getCurrentUserID(jsi::Runtime &rt) = 0;
- virtual jsi::Value setDeviceID(jsi::Runtime &rt, jsi::String deviceType) = 0;
- virtual jsi::Value getDeviceID(jsi::Runtime &rt) = 0;
virtual jsi::Value clearSensitiveData(jsi::Runtime &rt) = 0;
virtual bool checkIfDatabaseNeedsDeletion(jsi::Runtime &rt) = 0;
virtual void reportDBOperationsFailure(jsi::Runtime &rt) = 0;
@@ -295,22 +293,6 @@
return bridging::callFromJs<jsi::Value>(
rt, &T::getCurrentUserID, jsInvoker_, instance_);
}
- jsi::Value setDeviceID(jsi::Runtime &rt, jsi::String deviceType) override {
- static_assert(
- bridging::getParameterCount(&T::setDeviceID) == 2,
- "Expected setDeviceID(...) to have 2 parameters");
-
- return bridging::callFromJs<jsi::Value>(
- rt, &T::setDeviceID, jsInvoker_, instance_, std::move(deviceType));
- }
- jsi::Value getDeviceID(jsi::Runtime &rt) override {
- static_assert(
- bridging::getParameterCount(&T::getDeviceID) == 1,
- "Expected getDeviceID(...) to have 1 parameters");
-
- return bridging::callFromJs<jsi::Value>(
- rt, &T::getDeviceID, jsInvoker_, instance_);
- }
jsi::Value clearSensitiveData(jsi::Runtime &rt) override {
static_assert(
bridging::getParameterCount(&T::clearSensitiveData) == 1,
diff --git a/native/data/sqlite-data-handler.js b/native/data/sqlite-data-handler.js
--- a/native/data/sqlite-data-handler.js
+++ b/native/data/sqlite-data-handler.js
@@ -112,10 +112,6 @@
if (currentLoggedInUserID) {
await commCoreModule.setCurrentUserID(currentLoggedInUserID);
}
- const databaseDeviceID = await commCoreModule.getDeviceID();
- if (!databaseDeviceID) {
- await commCoreModule.setDeviceID('MOBILE');
- }
} catch (e) {
if (isTaskCancelledError(e)) {
return;
diff --git a/native/ios/Comm.xcodeproj/project.pbxproj b/native/ios/Comm.xcodeproj/project.pbxproj
--- a/native/ios/Comm.xcodeproj/project.pbxproj
+++ b/native/ios/Comm.xcodeproj/project.pbxproj
@@ -26,7 +26,6 @@
724995D527B4103A00323FCE /* NotificationService.mm in Sources */ = {isa = PBXBuildFile; fileRef = 724995D427B4103A00323FCE /* NotificationService.mm */; };
724995D927B4103A00323FCE /* NotificationService.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 724995D127B4103A00323FCE /* NotificationService.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
724995FB27BA9E8D00323FCE /* UserNotifications.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 724995FA27BA9E8C00323FCE /* UserNotifications.framework */; };
- 75291F0428F9A0D400F4C80E /* DeviceID.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75291F0328F9A0AE00F4C80E /* DeviceID.cpp */; };
7F0C6E31291C4468002AA2D9 /* ExpoModulesProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EEB3E70587B0ADAD05237B0 /* ExpoModulesProvider.swift */; };
7F761E602201141E001B6FB7 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7F761E292201141E001B6FB7 /* JavaScriptCore.framework */; };
7F788C2C248AA2140098F071 /* SplashScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7F788C2B248AA2130098F071 /* SplashScreen.storyboard */; };
@@ -1049,7 +1048,6 @@
CB7EF17E295C674300B17035 /* CommIOSNotifications.mm in Sources */,
CB7EF180295C674300B17035 /* CommIOSNotificationsBridgeQueue.mm in Sources */,
7F0C6E31291C4468002AA2D9 /* ExpoModulesProvider.swift in Sources */,
- 75291F0428F9A0D400F4C80E /* DeviceID.cpp in Sources */,
8EF775682A74032C0046A385 /* CommRustModule.cpp in Sources */,
8E43C32C291E5B4A009378F5 /* TerminateApp.mm in Sources */,
8BC9568529FC49B00060AE4A /* JSIRust.cpp in Sources */,
diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js
--- a/native/schema/CommCoreModuleSchema.js
+++ b/native/schema/CommCoreModuleSchema.js
@@ -91,8 +91,6 @@
+clearNotifyToken: () => Promise<void>;
+setCurrentUserID: (userID: string) => Promise<void>;
+getCurrentUserID: () => Promise<string>;
- +setDeviceID: (deviceType: string) => Promise<string>;
- +getDeviceID: () => Promise<string>;
+clearSensitiveData: () => Promise<void>;
+checkIfDatabaseNeedsDeletion: () => boolean;
+reportDBOperationsFailure: () => void;
diff --git a/web/database/_generated/comm_query_executor.wasm b/web/database/_generated/comm_query_executor.wasm
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001

File Metadata

Mime Type
text/plain
Expires
Fri, Sep 20, 10:45 AM (19 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2133077
Default Alt Text
D9556.id32436.diff (14 KB)

Event Timeline