| 3240 | } |
| 3241 | |
| 3242 | jsi::Value CommCoreModule::markPrekeysAsPublished(jsi::Runtime &rt) { |
| 3243 | return createPromiseAsJSIValue( |
| 3244 | rt, [=](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) { |
| 3245 | taskType job = [=, &innerRt]() { |
| 3246 | std::string error; |
| 3247 | |
| 3248 | if (this->contentCryptoModule == nullptr || |
| 3249 | !NotificationsCryptoModule::isNotificationsAccountInitialized()) { |
| 3250 | this->jsInvoker_->invokeAsync([=, &innerRt]() { |
| 3251 | promise->reject("user has not been initialized"); |
| 3252 | }); |
| 3253 | return; |
| 3254 | } |
| 3255 | |
| 3256 | std::optional< |
| 3257 | std::pair<std::shared_ptr<crypto::CryptoModule>, std::string>> |
| 3258 | notifsCryptoModuleWithPicklingKey; |
| 3259 | try { |
| 3260 | notifsCryptoModuleWithPicklingKey = |
| 3261 | NotificationsCryptoModule::fetchNotificationsAccount(); |
| 3262 | this->contentCryptoModule->markPrekeyAsPublished(); |
| 3263 | notifsCryptoModuleWithPicklingKey.value() |
| 3264 | .first->markPrekeyAsPublished(); |
| 3265 | this->persistCryptoModules(true, notifsCryptoModuleWithPicklingKey); |
| 3266 | } catch (std::exception &e) { |
| 3267 | error = e.what(); |
| 3268 | } |
| 3269 | |
| 3270 | this->jsInvoker_->invokeAsync([=]() { |
| 3271 | if (error.size()) { |
| 3272 | promise->reject(error); |
| 3273 | return; |
| 3274 | } |
| 3275 | promise->resolve(jsi::Value::undefined()); |
| 3276 | }); |
| 3277 | }; |
| 3278 | |
| 3279 | this->cryptoThread->scheduleTask(job); |
| 3280 | }); |
| 3281 | } |
| 3282 | |
| 3283 | jsi::Value |
| 3284 | CommCoreModule::getRelatedMessages(jsi::Runtime &rt, jsi::String messageID) { |
nothing calls this directly
no test coverage detected