Changeset View
Changeset View
Standalone View
Standalone View
native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
#include "CommCoreModule.h" | #include "CommCoreModule.h" | ||||
#include "../CryptoTools/DeviceID.h" | #include "../CryptoTools/DeviceID.h" | ||||
#include "../Notifications/BackgroundDataStorage/NotificationsCryptoModule.h" | #include "../Notifications/BackgroundDataStorage/NotificationsCryptoModule.h" | ||||
#include "DatabaseManager.h" | #include "DatabaseManager.h" | ||||
#include "DraftStoreOperations.h" | #include "DraftStoreOperations.h" | ||||
#include "InternalModules/GlobalDBSingleton.h" | #include "InternalModules/GlobalDBSingleton.h" | ||||
#include "InternalModules/RustPromiseManager.h" | |||||
#include "MessageStoreOperations.h" | #include "MessageStoreOperations.h" | ||||
#include "TerminateApp.h" | #include "TerminateApp.h" | ||||
#include "ThreadStoreOperations.h" | #include "ThreadStoreOperations.h" | ||||
#include "lib.rs.h" | |||||
jon: Assuming that we will have one and only one rust project being exported to cxx, this should be… | |||||
#include <ReactCommon/TurboModuleUtils.h> | #include <ReactCommon/TurboModuleUtils.h> | ||||
#include <folly/dynamic.h> | #include <folly/dynamic.h> | ||||
#include <folly/json.h> | #include <folly/json.h> | ||||
#include <future> | #include <future> | ||||
namespace comm { | namespace comm { | ||||
▲ Show 20 Lines • Show All 1,143 Lines • ▼ Show 20 Lines | |||||
bool CommCoreModule::checkIfDatabaseNeedsDeletion(jsi::Runtime &rt) { | bool CommCoreModule::checkIfDatabaseNeedsDeletion(jsi::Runtime &rt) { | ||||
return DatabaseManager::checkIfDatabaseNeedsDeletion(); | return DatabaseManager::checkIfDatabaseNeedsDeletion(); | ||||
} | } | ||||
void CommCoreModule::reportDBOperationsFailure(jsi::Runtime &rt) { | void CommCoreModule::reportDBOperationsFailure(jsi::Runtime &rt) { | ||||
DatabaseManager::reportDBOperationsFailure(); | DatabaseManager::reportDBOperationsFailure(); | ||||
} | } | ||||
jsi::Value CommCoreModule::get42(jsi::Runtime &rt) { | |||||
return createPromiseAsJSIValue( | |||||
rt, [this](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) { | |||||
std::string error; | |||||
try { | |||||
auto currentID = RustPromiseManager::instance.addPromise( | |||||
promise, this->jsInvoker_, innerRt); | |||||
get_42(currentID); | |||||
} catch (const std::exception &e) { | |||||
error = e.what(); | |||||
}; | |||||
}); | |||||
} | |||||
} // namespace comm | } // namespace comm |
Assuming that we will have one and only one rust project being exported to cxx, this should be fine. Just want to make sure we won't have multiple of these in the future.