Flipper module skeleton

Summary: Refactor and introduce the Flipper module skeleton. No implementations yet.

Reviewed By: passy

Differential Revision: D36760620

fbshipit-source-id: 5e3f1b5abef6177f27d2c4c8e0fa8ec370364900
This commit is contained in:
Lorenzo Blasa
2022-07-14 09:57:25 -07:00
committed by Facebook GitHub Bot
parent 7977a41fba
commit 7d936c1ff8
4 changed files with 63 additions and 3 deletions

View File

@@ -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 <folly/dynamic.h>
#include <folly/json.h>
#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<void(std::string)>&& 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

View File

@@ -153,7 +153,7 @@
<ClInclude Include="ReactPackageProvider.h">
<DependentUpon>ReactPackageProvider.idl</DependentUpon>
</ClInclude>
<ClInclude Include="ReactNativeModule.h" />
<ClInclude Include="FlipperModule.h" />
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>

View File

@@ -21,7 +21,7 @@
<ItemGroup>
<ClInclude Include="pch.h" />
<ClInclude Include="ReactPackageProvider.h" />
<ClInclude Include="ReactNativeModule.h" />
<ClInclude Include="FlipperModule.h" />
<ClInclude Include="..\..\..\..\xplat\Flipper\CertificateUtils.h" />
<ClInclude Include="..\..\..\..\xplat\Flipper\ConnectionContextStore.h" />
<ClInclude Include="..\..\..\..\xplat\Flipper\FireAndForgetBasedFlipperResponder.h" />

View File

@@ -11,7 +11,7 @@
#include "ReactPackageProvider.g.cpp"
#endif
#include "ReactNativeModule.h"
#include "FlipperModule.h"
using namespace winrt::Microsoft::ReactNative;