Changeset View
Changeset View
Standalone View
Standalone View
native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
Show First 20 Lines • Show All 888 Lines • ▼ Show 20 Lines | return createPromiseAsJSIValue( | ||||
} | } | ||||
}); | }); | ||||
}; | }; | ||||
GlobalDBSingleton::instance.scheduleOrRunCancellable( | GlobalDBSingleton::instance.scheduleOrRunCancellable( | ||||
job, promise, this->jsInvoker_); | job, promise, this->jsInvoker_); | ||||
}); | }); | ||||
} | } | ||||
void CommCoreModule::processReportStoreOperationsSync( | |||||
jsi::Runtime &rt, | |||||
jsi::Array operations) { | |||||
std::vector<std::unique_ptr<ReportStoreOperationBase>> reportStoreOps; | |||||
try { | |||||
reportStoreOps = createReportStoreOperations(rt, operations); | |||||
} catch (const std::exception &e) { | |||||
throw jsi::JSError(rt, e.what()); | |||||
} | |||||
this->runSyncOrThrowJSError<void>(rt, [&reportStoreOps]() { | |||||
try { | |||||
DatabaseManager::getQueryExecutor().beginTransaction(); | |||||
for (const auto &operation : reportStoreOps) { | |||||
operation->execute(); | |||||
} | |||||
DatabaseManager::getQueryExecutor().commitTransaction(); | |||||
} catch (const std::exception &e) { | |||||
DatabaseManager::getQueryExecutor().rollbackTransaction(); | |||||
throw e; | |||||
} | |||||
}); | |||||
} | |||||
void CommCoreModule::terminate(jsi::Runtime &rt) { | void CommCoreModule::terminate(jsi::Runtime &rt) { | ||||
TerminateApp::terminate(); | TerminateApp::terminate(); | ||||
} | } | ||||
jsi::Value CommCoreModule::initializeCryptoAccount(jsi::Runtime &rt) { | jsi::Value CommCoreModule::initializeCryptoAccount(jsi::Runtime &rt) { | ||||
folly::Optional<std::string> storedSecretKey = | folly::Optional<std::string> storedSecretKey = | ||||
this->secureStore.get(this->secureStoreAccountDataKey); | this->secureStore.get(this->secureStoreAccountDataKey); | ||||
if (!storedSecretKey.hasValue()) { | if (!storedSecretKey.hasValue()) { | ||||
▲ Show 20 Lines • Show All 631 Lines • Show Last 20 Lines |