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 @@ -70,7 +70,7 @@ virtual void commitTransaction() const = 0; virtual void rollbackTransaction() const = 0; virtual std::vector getOlmPersistSessionsData() const = 0; - virtual folly::Optional getOlmPersistAccountData() const = 0; + virtual std::optional getOlmPersistAccountData() const = 0; virtual void storeOlmPersistData(crypto::Persist persist) const = 0; virtual void setNotifyToken(std::string token) const = 0; virtual void clearNotifyToken() 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 @@ -67,7 +67,7 @@ void commitTransaction() const override; void rollbackTransaction() const override; std::vector getOlmPersistSessionsData() const override; - folly::Optional getOlmPersistAccountData() const override; + std::optional getOlmPersistAccountData() const override; void storeOlmPersistData(crypto::Persist persist) const override; void setNotifyToken(std::string token) const override; void clearNotifyToken() 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 @@ -1176,7 +1176,7 @@ return SQLiteQueryExecutor::getStorage().get_all(); } -folly::Optional +std::optional SQLiteQueryExecutor::getOlmPersistAccountData() const { std::vector result = SQLiteQueryExecutor::getStorage().get_all(); @@ -1187,8 +1187,8 @@ "Multiple records found for the olm_persist_account table"); } return (result.size() == 0) - ? folly::none - : folly::Optional(result[0].account_data); + ? std::nullopt + : std::optional(result[0].account_data); } void SQLiteQueryExecutor::storeOlmPersistData(crypto::Persist persist) const { 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 @@ -938,9 +938,9 @@ crypto::Persist persist; std::string error; try { - folly::Optional accountData = + std::optional accountData = DatabaseManager::getQueryExecutor().getOlmPersistAccountData(); - if (accountData.hasValue()) { + if (accountData.has_value()) { persist.account = crypto::OlmBuffer(accountData->begin(), accountData->end()); // handle sessions data