From 7d936c1ff8b2cf9fc0a75e8e052bef6eb7ee8402 Mon Sep 17 00:00:00 2001 From: Lorenzo Blasa Date: Thu, 14 Jul 2022 09:57:25 -0700 Subject: [PATCH] Flipper module skeleton Summary: Refactor and introduce the Flipper module skeleton. No implementations yet. Reviewed By: passy Differential Revision: D36760620 fbshipit-source-id: 5e3f1b5abef6177f27d2c4c8e0fa8ec370364900 --- .../ReactNativeFlipper/FlipperModule.h | 60 +++++++++++++++++++ .../ReactNativeFlipper.vcxproj | 2 +- .../ReactNativeFlipper.vcxproj.filters | 2 +- .../ReactPackageProvider.cpp | 2 +- 4 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 react-native/react-native-flipper/windows/ReactNativeFlipper/FlipperModule.h diff --git a/react-native/react-native-flipper/windows/ReactNativeFlipper/FlipperModule.h b/react-native/react-native-flipper/windows/ReactNativeFlipper/FlipperModule.h new file mode 100644 index 000000000..ee54fe56d --- /dev/null +++ b/react-native/react-native-flipper/windows/ReactNativeFlipper/FlipperModule.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include +#include +#include "JSValue.h" +#include "NativeModules.h" + +using namespace winrt::Microsoft::ReactNative; + +namespace winrt::ReactNativeFlipper { + +REACT_MODULE(FlipperModule, L"Flipper") +struct FlipperModule { + REACT_INIT(Initialize) + void Initialize(ReactContext const& reactContext) noexcept { + m_reactContext = reactContext; + + // Initialise flipper, etc. + } + + REACT_METHOD(registerPlugin) + void registerPlugin( + std::string pluginId, + bool inBackground, + std::function&& callback) noexcept {} + + REACT_METHOD(send) + void + send(std::string pluginId, std::string method, std::string data) noexcept {} + + REACT_METHOD(reportErrorWithMetadata) + void reportErrorWithMetadata( + std::string pluginId, + std::string reason, + std::string stacktrace) noexcept {} + + REACT_METHOD(reportError) + void reportError(std::string pluginId, std::string error) noexcept {} + + REACT_METHOD(subscribe) + void subscribe(std::string pluginId, std::string method) noexcept {} + + REACT_METHOD(respondSuccess) + void respondSuccess(std::string responderId, std::string data) noexcept {} + + REACT_METHOD(respondError) + void respondError(std::string responderId, std::string data) noexcept {} + + private: + ReactContext m_reactContext{nullptr}; +}; + +} // namespace winrt::ReactNativeFlipper diff --git a/react-native/react-native-flipper/windows/ReactNativeFlipper/ReactNativeFlipper.vcxproj b/react-native/react-native-flipper/windows/ReactNativeFlipper/ReactNativeFlipper.vcxproj index 9c8e8f7b2..78a2f26e5 100644 --- a/react-native/react-native-flipper/windows/ReactNativeFlipper/ReactNativeFlipper.vcxproj +++ b/react-native/react-native-flipper/windows/ReactNativeFlipper/ReactNativeFlipper.vcxproj @@ -153,7 +153,7 @@ ReactPackageProvider.idl - + diff --git a/react-native/react-native-flipper/windows/ReactNativeFlipper/ReactNativeFlipper.vcxproj.filters b/react-native/react-native-flipper/windows/ReactNativeFlipper/ReactNativeFlipper.vcxproj.filters index e65d768e7..80588979f 100644 --- a/react-native/react-native-flipper/windows/ReactNativeFlipper/ReactNativeFlipper.vcxproj.filters +++ b/react-native/react-native-flipper/windows/ReactNativeFlipper/ReactNativeFlipper.vcxproj.filters @@ -21,7 +21,7 @@ - + diff --git a/react-native/react-native-flipper/windows/ReactNativeFlipper/ReactPackageProvider.cpp b/react-native/react-native-flipper/windows/ReactNativeFlipper/ReactPackageProvider.cpp index d4f078ee3..efb81a130 100644 --- a/react-native/react-native-flipper/windows/ReactNativeFlipper/ReactPackageProvider.cpp +++ b/react-native/react-native-flipper/windows/ReactNativeFlipper/ReactPackageProvider.cpp @@ -11,7 +11,7 @@ #include "ReactPackageProvider.g.cpp" #endif -#include "ReactNativeModule.h" +#include "FlipperModule.h" using namespace winrt::Microsoft::ReactNative;