react-native-zeroconf 0.17.3 → 0.17.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Package.swift ADDED
@@ -0,0 +1,35 @@
1
+ // swift-tools-version: 6.0
2
+ import PackageDescription
3
+
4
+ // Swift Package Manager support for React Native's SwiftPM autolinking
5
+ // (react-native >= 0.87). CocoaPods users are unaffected; see the podspec.
6
+ // The two React Native packages are resolved by the autolinker relative to
7
+ // build/generated/autolinking/libs/ReactNativeZeroconf in the app.
8
+ let package = Package(
9
+ name: "ReactNativeZeroconf",
10
+ platforms: [.iOS(.v15)],
11
+ products: [
12
+ .library(name: "ReactNativeZeroconf", targets: ["ReactNativeZeroconf"]),
13
+ ],
14
+ dependencies: [
15
+ .package(name: "ReactNative", path: "../../../../xcframeworks"),
16
+ .package(name: "React-GeneratedCode", path: "../../../ios"),
17
+ ],
18
+ targets: [
19
+ .target(
20
+ name: "ReactNativeZeroconf",
21
+ dependencies: [
22
+ .product(name: "ReactHeaders", package: "ReactNative"),
23
+ .product(name: "ReactNativeHeaders", package: "ReactNative"),
24
+ .product(name: "ReactNativeDependenciesHeaders", package: "ReactNative"),
25
+ .product(name: "ReactAppHeaders", package: "React-GeneratedCode"),
26
+ ],
27
+ path: "ios/RNZeroconf",
28
+ publicHeadersPath: ".",
29
+ linkerSettings: [
30
+ .linkedFramework("Foundation"),
31
+ .linkedFramework("Network"),
32
+ ]
33
+ ),
34
+ ]
35
+ )
package/README.md CHANGED
@@ -21,6 +21,8 @@ yarn add react-native-zeroconf
21
21
  cd ios && pod install
22
22
  ```
23
23
 
24
+ > **1.0 release candidate:** one C++ native module on every platform, for React Native 0.82 and later (New Architecture, Expo SDK 55 and later). Try it with `npm install react-native-zeroconf@next`, see [what changes from 0.17](https://zeroconf.balthazar.dev/Migrating-to-1.0). The documentation covers 0.17, which stays the default and keeps getting bug fixes.
25
+
24
26
  On iOS, declare the service types you use in `NSBonjourServices`, see [Permissions and Setup](https://zeroconf.balthazar.dev/Permissions-and-Setup). Expo works with development builds, see [Installation with Expo](https://zeroconf.balthazar.dev/Installation-Expo).
25
27
 
26
28
  ## Usage
@@ -0,0 +1,96 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJavaSpec.js
9
+ *
10
+ * @nolint
11
+ */
12
+
13
+ package com.balthazargronon.RCTZeroconf;
14
+
15
+ import com.facebook.proguard.annotations.DoNotStrip;
16
+ import com.facebook.react.bridge.Promise;
17
+ import com.facebook.react.bridge.ReactApplicationContext;
18
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
19
+ import com.facebook.react.bridge.ReactMethod;
20
+ import com.facebook.react.bridge.ReadableArray;
21
+ import com.facebook.react.bridge.ReadableMap;
22
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
23
+ import javax.annotation.Nonnull;
24
+
25
+ public abstract class NativeZeroconfSpec extends ReactContextBaseJavaModule implements TurboModule {
26
+ public static final String NAME = "Zeroconf";
27
+
28
+ public NativeZeroconfSpec(ReactApplicationContext reactContext) {
29
+ super(reactContext);
30
+ }
31
+
32
+ @Override
33
+ public @Nonnull String getName() {
34
+ return NAME;
35
+ }
36
+
37
+ protected final void emitOnStart(ReadableMap value) {
38
+ mEventEmitterCallback.invoke("onStart", value);
39
+ }
40
+
41
+ protected final void emitOnStop(ReadableMap value) {
42
+ mEventEmitterCallback.invoke("onStop", value);
43
+ }
44
+
45
+ protected final void emitOnFound(ReadableMap value) {
46
+ mEventEmitterCallback.invoke("onFound", value);
47
+ }
48
+
49
+ protected final void emitOnRemove(ReadableMap value) {
50
+ mEventEmitterCallback.invoke("onRemove", value);
51
+ }
52
+
53
+ protected final void emitOnResolved(ReadableMap value) {
54
+ mEventEmitterCallback.invoke("onResolved", value);
55
+ }
56
+
57
+ protected final void emitOnError(ReadableMap value) {
58
+ mEventEmitterCallback.invoke("onError", value);
59
+ }
60
+
61
+ protected final void emitOnPublished(ReadableMap value) {
62
+ mEventEmitterCallback.invoke("onPublished", value);
63
+ }
64
+
65
+ protected final void emitOnUnpublished(ReadableMap value) {
66
+ mEventEmitterCallback.invoke("onUnpublished", value);
67
+ }
68
+
69
+ @ReactMethod
70
+ @DoNotStrip
71
+ public abstract void scan(String scanId, String type, String protocol, String domain, String implType, ReadableMap options);
72
+
73
+ @ReactMethod
74
+ @DoNotStrip
75
+ public abstract void stop(String scanId, String implType);
76
+
77
+ @ReactMethod
78
+ @DoNotStrip
79
+ public abstract void registerService(String type, String protocol, String domain, String name, double port, ReadableArray txt, String implType, ReadableMap options, Promise promise);
80
+
81
+ @ReactMethod
82
+ @DoNotStrip
83
+ public abstract void updateService(String name, ReadableArray txt, String implType, Promise promise);
84
+
85
+ @ReactMethod
86
+ @DoNotStrip
87
+ public abstract void unregisterService(String name, String implType, Promise promise);
88
+
89
+ @ReactMethod
90
+ @DoNotStrip
91
+ public abstract void resolveService(String name, String type, String protocol, String domain, String implType, ReadableMap options, Promise promise);
92
+
93
+ @ReactMethod
94
+ @DoNotStrip
95
+ public abstract void checkLocalNetworkAccess(String type, double timeout, Promise promise);
96
+ }
@@ -0,0 +1,28 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ cmake_minimum_required(VERSION 3.13)
7
+ set(CMAKE_VERBOSE_MAKEFILE on)
8
+
9
+ file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNZeroconfSpec/*.cpp)
10
+
11
+ add_library(
12
+ react_codegen_RNZeroconfSpec
13
+ OBJECT
14
+ ${react_codegen_SRCS}
15
+ )
16
+
17
+ target_include_directories(react_codegen_RNZeroconfSpec PUBLIC . react/renderer/components/RNZeroconfSpec)
18
+
19
+ target_link_libraries(
20
+ react_codegen_RNZeroconfSpec
21
+ fbjni
22
+ jsi
23
+ # We need to link different libraries based on whether we are building rncore or not, that's necessary
24
+ # because we want to break a circular dependency between react_codegen_rncore and reactnative
25
+ reactnative
26
+ )
27
+
28
+ target_compile_reactnative_options(react_codegen_RNZeroconfSpec PRIVATE)
@@ -0,0 +1,77 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniCpp.js
9
+ */
10
+
11
+ #include "RNZeroconfSpec.h"
12
+
13
+ namespace facebook::react {
14
+
15
+ static facebook::jsi::Value __hostFunction_NativeZeroconfSpecJSI_scan(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
16
+ static jmethodID cachedMethodId = nullptr;
17
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "scan", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/bridge/ReadableMap;)V", args, count, cachedMethodId);
18
+ }
19
+
20
+ static facebook::jsi::Value __hostFunction_NativeZeroconfSpecJSI_stop(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
21
+ static jmethodID cachedMethodId = nullptr;
22
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "stop", "(Ljava/lang/String;Ljava/lang/String;)V", args, count, cachedMethodId);
23
+ }
24
+
25
+ static facebook::jsi::Value __hostFunction_NativeZeroconfSpecJSI_registerService(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
26
+ static jmethodID cachedMethodId = nullptr;
27
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "registerService", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;DLcom/facebook/react/bridge/ReadableArray;Ljava/lang/String;Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
28
+ }
29
+
30
+ static facebook::jsi::Value __hostFunction_NativeZeroconfSpecJSI_updateService(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
31
+ static jmethodID cachedMethodId = nullptr;
32
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "updateService", "(Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
33
+ }
34
+
35
+ static facebook::jsi::Value __hostFunction_NativeZeroconfSpecJSI_unregisterService(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
36
+ static jmethodID cachedMethodId = nullptr;
37
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "unregisterService", "(Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
38
+ }
39
+
40
+ static facebook::jsi::Value __hostFunction_NativeZeroconfSpecJSI_resolveService(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
41
+ static jmethodID cachedMethodId = nullptr;
42
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "resolveService", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
43
+ }
44
+
45
+ static facebook::jsi::Value __hostFunction_NativeZeroconfSpecJSI_checkLocalNetworkAccess(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
46
+ static jmethodID cachedMethodId = nullptr;
47
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "checkLocalNetworkAccess", "(Ljava/lang/String;DLcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
48
+ }
49
+
50
+ NativeZeroconfSpecJSI::NativeZeroconfSpecJSI(const JavaTurboModule::InitParams &params)
51
+ : JavaTurboModule(params) {
52
+ methodMap_["scan"] = MethodMetadata {6, __hostFunction_NativeZeroconfSpecJSI_scan};
53
+ methodMap_["stop"] = MethodMetadata {2, __hostFunction_NativeZeroconfSpecJSI_stop};
54
+ methodMap_["registerService"] = MethodMetadata {8, __hostFunction_NativeZeroconfSpecJSI_registerService};
55
+ methodMap_["updateService"] = MethodMetadata {3, __hostFunction_NativeZeroconfSpecJSI_updateService};
56
+ methodMap_["unregisterService"] = MethodMetadata {2, __hostFunction_NativeZeroconfSpecJSI_unregisterService};
57
+ methodMap_["resolveService"] = MethodMetadata {6, __hostFunction_NativeZeroconfSpecJSI_resolveService};
58
+ methodMap_["checkLocalNetworkAccess"] = MethodMetadata {2, __hostFunction_NativeZeroconfSpecJSI_checkLocalNetworkAccess};
59
+ eventEmitterMap_["onStart"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
60
+ eventEmitterMap_["onStop"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
61
+ eventEmitterMap_["onFound"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
62
+ eventEmitterMap_["onRemove"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
63
+ eventEmitterMap_["onResolved"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
64
+ eventEmitterMap_["onError"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
65
+ eventEmitterMap_["onPublished"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
66
+ eventEmitterMap_["onUnpublished"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
67
+ configureEventEmitterCallback();
68
+ }
69
+
70
+ std::shared_ptr<TurboModule> RNZeroconfSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
71
+ if (moduleName == "Zeroconf") {
72
+ return std::make_shared<NativeZeroconfSpecJSI>(params);
73
+ }
74
+ return nullptr;
75
+ }
76
+
77
+ } // namespace facebook::react
@@ -0,0 +1,31 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <ReactCommon/JavaTurboModule.h>
14
+ #include <ReactCommon/TurboModule.h>
15
+ #include <jsi/jsi.h>
16
+
17
+ namespace facebook::react {
18
+
19
+ /**
20
+ * JNI C++ class for module 'NativeZeroconf'
21
+ */
22
+ class JSI_EXPORT NativeZeroconfSpecJSI : public JavaTurboModule {
23
+ public:
24
+ NativeZeroconfSpecJSI(const JavaTurboModule::InitParams &params);
25
+ };
26
+
27
+
28
+ JSI_EXPORT
29
+ std::shared_ptr<TurboModule> RNZeroconfSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
30
+
31
+ } // namespace facebook::react