From afe98181203b4e02a43ba497f4be64b744a5b1db Mon Sep 17 00:00:00 2001 From: Michal Sek Date: Wed, 4 Dec 2024 18:16:09 +0100 Subject: [PATCH] fix: linter --- .../common/cpp/core/AudioBuffer.h | 2 +- .../common/cpp/utils/JsiPromise.cpp | 3 ++- .../common/cpp/utils/JsiPromise.h | 17 ++++++++++------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/react-native-audio-api/common/cpp/core/AudioBuffer.h b/packages/react-native-audio-api/common/cpp/core/AudioBuffer.h index 44f6b087..f03dcbf8 100644 --- a/packages/react-native-audio-api/common/cpp/core/AudioBuffer.h +++ b/packages/react-native-audio-api/common/cpp/core/AudioBuffer.h @@ -12,7 +12,7 @@ class AudioBus; class AudioBuffer : public std::enable_shared_from_this { public: explicit AudioBuffer(int numberOfChannels, int length, int sampleRate); - AudioBuffer(AudioBus *bus); + explicit AudioBuffer(AudioBus *bus); [[nodiscard]] int getLength() const; [[nodiscard]] int getSampleRate() const; diff --git a/packages/react-native-audio-api/common/cpp/utils/JsiPromise.cpp b/packages/react-native-audio-api/common/cpp/utils/JsiPromise.cpp index fc968b4a..f9d5fcd2 100644 --- a/packages/react-native-audio-api/common/cpp/utils/JsiPromise.cpp +++ b/packages/react-native-audio-api/common/cpp/utils/JsiPromise.cpp @@ -37,6 +37,7 @@ jsi::Value PromiseVendor::createPromise(std::functioncall(runtime, *valueShared); }); }; + auto rejectWrapper = [reject, &runtime, callInvoker](const std::string& errorMessage) -> void { auto error = jsi::JSError(runtime, errorMessage); auto errorShared = std::make_shared(error); @@ -55,4 +56,4 @@ jsi::Value PromiseVendor::createPromise(std::function #include +#include +#include +#include namespace JsiPromise { using namespace facebook; class Promise { -public: + public: Promise(std::function resolve, std::function reject): _resolve(std::move(resolve)), _reject(std::move(reject)) {} -public: + bool isResolved; void resolve(jsi::Value&& value) { _resolve(std::forward(value)); @@ -19,21 +22,21 @@ class Promise { _reject(errorMessage); } -private: + private: std::function _resolve; std::function _reject; }; class PromiseVendor { -public: + public: PromiseVendor(jsi::Runtime* runtime, std::shared_ptr callInvoker): _runtime(runtime), _callInvoker(callInvoker) {} -public: + public: jsi::Value createPromise(std::function)> func); -private: + private: jsi::Runtime* _runtime; std::shared_ptr _callInvoker; }; -} +} // namespace JsiPromise