@react-native-firebase/in-app-messaging 25.1.0 → 26.1.0

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/RNFBInAppMessaging.podspec +10 -7
  3. package/android/build.gradle +19 -0
  4. package/android/src/reactnative/java/io/invertase/firebase/fiam/{ReactNativeFirebaseFiamModule.java → NativeRNFBTurboFiam.java} +17 -18
  5. package/android/src/reactnative/java/io/invertase/firebase/fiam/ReactNativeFirebaseFiamPackage.java +1 -1
  6. package/android/src/reactnative/java/io/invertase/firebase/fiam/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboFiamSpec.java +79 -0
  7. package/android/src/reactnative/java/io/invertase/firebase/fiam/generated/jni/CMakeLists.txt +36 -0
  8. package/android/src/reactnative/java/io/invertase/firebase/fiam/generated/jni/RNFBInAppMessagingTurboModules-generated.cpp +50 -0
  9. package/android/src/reactnative/java/io/invertase/firebase/fiam/generated/jni/RNFBInAppMessagingTurboModules.h +31 -0
  10. package/android/src/reactnative/java/io/invertase/firebase/fiam/generated/jni/react/renderer/components/RNFBInAppMessagingTurboModules/RNFBInAppMessagingTurboModulesJSI-generated.cpp +47 -0
  11. package/android/src/reactnative/java/io/invertase/firebase/fiam/generated/jni/react/renderer/components/RNFBInAppMessagingTurboModules/RNFBInAppMessagingTurboModulesJSI.h +98 -0
  12. package/dist/module/index.js +113 -3
  13. package/dist/module/index.js.map +1 -1
  14. package/dist/module/version.js +1 -1
  15. package/dist/module/web/RNFBFiamModule.js +34 -0
  16. package/dist/module/web/RNFBFiamModule.js.map +1 -0
  17. package/dist/typescript/lib/index.d.ts +46 -4
  18. package/dist/typescript/lib/index.d.ts.map +1 -1
  19. package/dist/typescript/lib/types/internal.d.ts +1 -8
  20. package/dist/typescript/lib/types/internal.d.ts.map +1 -1
  21. package/dist/typescript/lib/version.d.ts +1 -1
  22. package/dist/typescript/lib/web/RNFBFiamModule.d.ts +4 -0
  23. package/dist/typescript/lib/web/RNFBFiamModule.d.ts.map +1 -0
  24. package/ios/RNFBFiam/RNFBFiamHelper.h +47 -0
  25. package/ios/RNFBFiam/RNFBFiamHelper.m +82 -0
  26. package/ios/RNFBFiam/RNFBFiamModule.h +2 -3
  27. package/ios/RNFBFiam/RNFBFiamModule.mm +75 -0
  28. package/ios/RNFBFiam.xcodeproj/project.pbxproj +8 -8
  29. package/ios/generated/RCTAppDependencyProvider.h +25 -0
  30. package/ios/generated/RCTAppDependencyProvider.mm +55 -0
  31. package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
  32. package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
  33. package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
  34. package/ios/generated/RCTThirdPartyComponentsProvider.mm +23 -0
  35. package/ios/generated/RNFBInAppMessagingTurboModules/RNFBInAppMessagingTurboModules-generated.mm +60 -0
  36. package/ios/generated/RNFBInAppMessagingTurboModules/RNFBInAppMessagingTurboModules.h +112 -0
  37. package/ios/generated/RNFBInAppMessagingTurboModulesJSI-generated.cpp +47 -0
  38. package/ios/generated/RNFBInAppMessagingTurboModulesJSI.h +98 -0
  39. package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
  40. package/lib/index.ts +141 -5
  41. package/lib/types/internal.ts +1 -16
  42. package/lib/version.ts +1 -1
  43. package/lib/web/RNFBFiamModule.ts +34 -0
  44. package/package.json +23 -5
  45. package/react-native.config.js +10 -0
  46. package/specs/NativeRNFBTurboFiam.ts +15 -0
  47. package/tsconfig.json +4 -0
  48. package/typedoc.json +1 -1
  49. package/dist/module/modular.js +0 -80
  50. package/dist/module/modular.js.map +0 -1
  51. package/dist/module/namespaced.js +0 -78
  52. package/dist/module/namespaced.js.map +0 -1
  53. package/dist/module/types/namespaced.js +0 -62
  54. package/dist/module/types/namespaced.js.map +0 -1
  55. package/dist/typescript/lib/modular.d.ts +0 -36
  56. package/dist/typescript/lib/modular.d.ts.map +0 -1
  57. package/dist/typescript/lib/namespaced.d.ts +0 -12
  58. package/dist/typescript/lib/namespaced.d.ts.map +0 -1
  59. package/dist/typescript/lib/types/namespaced.d.ts +0 -107
  60. package/dist/typescript/lib/types/namespaced.d.ts.map +0 -1
  61. package/ios/RNFBFiam/RNFBFiamModule.m +0 -71
  62. package/lib/modular.ts +0 -103
  63. package/lib/namespaced.ts +0 -117
  64. package/lib/types/namespaced.ts +0 -137
@@ -0,0 +1,60 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleObjCpp
8
+ *
9
+ * We create an umbrella header (and corresponding implementation) here since
10
+ * Cxx compilation in BUCK has a limitation: source-code producing genrule()s
11
+ * must have a single output. More files => more genrule()s => slower builds.
12
+ */
13
+
14
+ #import "RNFBInAppMessagingTurboModules.h"
15
+
16
+
17
+ @implementation NativeRNFBTurboFiamSpecBase
18
+
19
+
20
+ - (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper
21
+ {
22
+ _eventEmitterCallback = std::move(eventEmitterCallbackWrapper->_eventEmitterCallback);
23
+ }
24
+ @end
25
+
26
+
27
+ namespace facebook::react {
28
+
29
+ static facebook::jsi::Value __hostFunction_NativeRNFBTurboFiamSpecJSI_setAutomaticDataCollectionEnabled(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
30
+ return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "setAutomaticDataCollectionEnabled", @selector(setAutomaticDataCollectionEnabled:resolve:reject:), args, count);
31
+ }
32
+
33
+ static facebook::jsi::Value __hostFunction_NativeRNFBTurboFiamSpecJSI_setMessagesDisplaySuppressed(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
34
+ return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "setMessagesDisplaySuppressed", @selector(setMessagesDisplaySuppressed:resolve:reject:), args, count);
35
+ }
36
+
37
+ static facebook::jsi::Value __hostFunction_NativeRNFBTurboFiamSpecJSI_triggerEvent(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
38
+ return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "triggerEvent", @selector(triggerEvent:resolve:reject:), args, count);
39
+ }
40
+
41
+ static facebook::jsi::Value __hostFunction_NativeRNFBTurboFiamSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
42
+ return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count);
43
+ }
44
+
45
+ NativeRNFBTurboFiamSpecJSI::NativeRNFBTurboFiamSpecJSI(const ObjCTurboModule::InitParams &params)
46
+ : ObjCTurboModule(params) {
47
+
48
+ methodMap_["setAutomaticDataCollectionEnabled"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboFiamSpecJSI_setAutomaticDataCollectionEnabled};
49
+
50
+
51
+ methodMap_["setMessagesDisplaySuppressed"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboFiamSpecJSI_setMessagesDisplaySuppressed};
52
+
53
+
54
+ methodMap_["triggerEvent"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboFiamSpecJSI_triggerEvent};
55
+
56
+
57
+ methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeRNFBTurboFiamSpecJSI_getConstants};
58
+
59
+ }
60
+ } // namespace facebook::react
@@ -0,0 +1,112 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleObjCpp
8
+ *
9
+ * We create an umbrella header (and corresponding implementation) here since
10
+ * Cxx compilation in BUCK has a limitation: source-code producing genrule()s
11
+ * must have a single output. More files => more genrule()s => slower builds.
12
+ */
13
+
14
+ #ifndef __cplusplus
15
+ #error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
16
+ #endif
17
+
18
+ // Avoid multiple includes of RNFBInAppMessagingTurboModules symbols
19
+ #ifndef RNFBInAppMessagingTurboModules_H
20
+ #define RNFBInAppMessagingTurboModules_H
21
+
22
+ #import <Foundation/Foundation.h>
23
+ #import <RCTRequired/RCTRequired.h>
24
+ #import <RCTTypeSafety/RCTConvertHelpers.h>
25
+ #import <RCTTypeSafety/RCTTypedModuleConstants.h>
26
+ #import <React/RCTBridgeModule.h>
27
+ #import <React/RCTCxxConvert.h>
28
+ #import <React/RCTManagedPointer.h>
29
+ #import <ReactCommon/RCTTurboModule.h>
30
+ #import <optional>
31
+ #import <vector>
32
+
33
+
34
+ NS_ASSUME_NONNULL_BEGIN
35
+ namespace JS {
36
+ namespace NativeRNFBTurboFiam {
37
+ struct Constants {
38
+
39
+ struct Builder {
40
+ // Backwards compat for RCTTypedModuleConstants
41
+ using ResultT = Constants;
42
+
43
+ struct Input {
44
+ RCTRequired<bool> isMessagesDisplaySuppressed;
45
+ RCTRequired<bool> isAutomaticDataCollectionEnabled;
46
+ };
47
+
48
+ /** Initialize with a set of values */
49
+ Builder(const Input i);
50
+ /** Initialize with an existing Constants */
51
+ Builder(Constants i);
52
+ /** Builds the object. Generally used only by the infrastructure. */
53
+ NSDictionary *buildUnsafeRawValue() const { return _factory(); };
54
+ private:
55
+ NSDictionary *(^_factory)(void);
56
+ };
57
+
58
+ static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; }
59
+ NSDictionary *unsafeRawValue() const { return _v; }
60
+ private:
61
+ Constants(NSDictionary *const v) : _v(v) {}
62
+ NSDictionary *_v;
63
+ };
64
+ }
65
+ }
66
+ @protocol NativeRNFBTurboFiamSpec <RCTBridgeModule, RCTTurboModule>
67
+
68
+ - (void)setAutomaticDataCollectionEnabled:(BOOL)enabled
69
+ resolve:(RCTPromiseResolveBlock)resolve
70
+ reject:(RCTPromiseRejectBlock)reject;
71
+ - (void)setMessagesDisplaySuppressed:(BOOL)enabled
72
+ resolve:(RCTPromiseResolveBlock)resolve
73
+ reject:(RCTPromiseRejectBlock)reject;
74
+ - (void)triggerEvent:(NSString *)eventId
75
+ resolve:(RCTPromiseResolveBlock)resolve
76
+ reject:(RCTPromiseRejectBlock)reject;
77
+ - (facebook::react::ModuleConstants<JS::NativeRNFBTurboFiam::Constants::Builder>)constantsToExport;
78
+ - (facebook::react::ModuleConstants<JS::NativeRNFBTurboFiam::Constants::Builder>)getConstants;
79
+
80
+ @end
81
+
82
+ @interface NativeRNFBTurboFiamSpecBase : NSObject {
83
+ @protected
84
+ facebook::react::EventEmitterCallback _eventEmitterCallback;
85
+ }
86
+ - (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper;
87
+
88
+
89
+ @end
90
+
91
+ namespace facebook::react {
92
+ /**
93
+ * ObjC++ class for module 'NativeRNFBTurboFiam'
94
+ */
95
+ class JSI_EXPORT NativeRNFBTurboFiamSpecJSI : public ObjCTurboModule {
96
+ public:
97
+ NativeRNFBTurboFiamSpecJSI(const ObjCTurboModule::InitParams &params);
98
+ };
99
+ } // namespace facebook::react
100
+ inline JS::NativeRNFBTurboFiam::Constants::Builder::Builder(const Input i) : _factory(^{
101
+ NSMutableDictionary *d = [NSMutableDictionary new];
102
+ auto isMessagesDisplaySuppressed = i.isMessagesDisplaySuppressed.get();
103
+ d[@"isMessagesDisplaySuppressed"] = @(isMessagesDisplaySuppressed);
104
+ auto isAutomaticDataCollectionEnabled = i.isAutomaticDataCollectionEnabled.get();
105
+ d[@"isAutomaticDataCollectionEnabled"] = @(isAutomaticDataCollectionEnabled);
106
+ return d;
107
+ }) {}
108
+ inline JS::NativeRNFBTurboFiam::Constants::Builder::Builder(Constants i) : _factory(^{
109
+ return i.unsafeRawValue();
110
+ }) {}
111
+ NS_ASSUME_NONNULL_END
112
+ #endif // RNFBInAppMessagingTurboModules_H
@@ -0,0 +1,47 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleCpp.js
8
+ */
9
+
10
+ #include "RNFBInAppMessagingTurboModulesJSI.h"
11
+
12
+ namespace facebook::react {
13
+
14
+ static jsi::Value __hostFunction_NativeRNFBTurboFiamCxxSpecJSI_getConstants(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
15
+ return static_cast<NativeRNFBTurboFiamCxxSpecJSI *>(&turboModule)->getConstants(
16
+ rt
17
+ );
18
+ }
19
+ static jsi::Value __hostFunction_NativeRNFBTurboFiamCxxSpecJSI_setAutomaticDataCollectionEnabled(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
20
+ return static_cast<NativeRNFBTurboFiamCxxSpecJSI *>(&turboModule)->setAutomaticDataCollectionEnabled(
21
+ rt,
22
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asBool()
23
+ );
24
+ }
25
+ static jsi::Value __hostFunction_NativeRNFBTurboFiamCxxSpecJSI_setMessagesDisplaySuppressed(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
26
+ return static_cast<NativeRNFBTurboFiamCxxSpecJSI *>(&turboModule)->setMessagesDisplaySuppressed(
27
+ rt,
28
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asBool()
29
+ );
30
+ }
31
+ static jsi::Value __hostFunction_NativeRNFBTurboFiamCxxSpecJSI_triggerEvent(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
32
+ return static_cast<NativeRNFBTurboFiamCxxSpecJSI *>(&turboModule)->triggerEvent(
33
+ rt,
34
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
35
+ );
36
+ }
37
+
38
+ NativeRNFBTurboFiamCxxSpecJSI::NativeRNFBTurboFiamCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
39
+ : TurboModule("NativeRNFBTurboFiam", jsInvoker) {
40
+ methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeRNFBTurboFiamCxxSpecJSI_getConstants};
41
+ methodMap_["setAutomaticDataCollectionEnabled"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboFiamCxxSpecJSI_setAutomaticDataCollectionEnabled};
42
+ methodMap_["setMessagesDisplaySuppressed"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboFiamCxxSpecJSI_setMessagesDisplaySuppressed};
43
+ methodMap_["triggerEvent"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboFiamCxxSpecJSI_triggerEvent};
44
+ }
45
+
46
+
47
+ } // namespace facebook::react
@@ -0,0 +1,98 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleH.js
8
+ */
9
+
10
+ #pragma once
11
+
12
+ #include <ReactCommon/TurboModule.h>
13
+ #include <react/bridging/Bridging.h>
14
+
15
+ namespace facebook::react {
16
+
17
+
18
+ class JSI_EXPORT NativeRNFBTurboFiamCxxSpecJSI : public TurboModule {
19
+ protected:
20
+ NativeRNFBTurboFiamCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
21
+
22
+ public:
23
+ virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
24
+ virtual jsi::Value setAutomaticDataCollectionEnabled(jsi::Runtime &rt, bool enabled) = 0;
25
+ virtual jsi::Value setMessagesDisplaySuppressed(jsi::Runtime &rt, bool enabled) = 0;
26
+ virtual jsi::Value triggerEvent(jsi::Runtime &rt, jsi::String eventId) = 0;
27
+
28
+ };
29
+
30
+ template <typename T>
31
+ class JSI_EXPORT NativeRNFBTurboFiamCxxSpec : public TurboModule {
32
+ public:
33
+ jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
34
+ return delegate_.create(rt, propName);
35
+ }
36
+
37
+ std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
38
+ return delegate_.getPropertyNames(runtime);
39
+ }
40
+
41
+ static constexpr std::string_view kModuleName = "NativeRNFBTurboFiam";
42
+
43
+ protected:
44
+ NativeRNFBTurboFiamCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
45
+ : TurboModule(std::string{NativeRNFBTurboFiamCxxSpec::kModuleName}, jsInvoker),
46
+ delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
47
+
48
+
49
+ private:
50
+ class Delegate : public NativeRNFBTurboFiamCxxSpecJSI {
51
+ public:
52
+ Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
53
+ NativeRNFBTurboFiamCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
54
+
55
+ }
56
+
57
+ jsi::Object getConstants(jsi::Runtime &rt) override {
58
+ static_assert(
59
+ bridging::getParameterCount(&T::getConstants) == 1,
60
+ "Expected getConstants(...) to have 1 parameters");
61
+
62
+ return bridging::callFromJs<jsi::Object>(
63
+ rt, &T::getConstants, jsInvoker_, instance_);
64
+ }
65
+ jsi::Value setAutomaticDataCollectionEnabled(jsi::Runtime &rt, bool enabled) override {
66
+ static_assert(
67
+ bridging::getParameterCount(&T::setAutomaticDataCollectionEnabled) == 2,
68
+ "Expected setAutomaticDataCollectionEnabled(...) to have 2 parameters");
69
+
70
+ return bridging::callFromJs<jsi::Value>(
71
+ rt, &T::setAutomaticDataCollectionEnabled, jsInvoker_, instance_, std::move(enabled));
72
+ }
73
+ jsi::Value setMessagesDisplaySuppressed(jsi::Runtime &rt, bool enabled) override {
74
+ static_assert(
75
+ bridging::getParameterCount(&T::setMessagesDisplaySuppressed) == 2,
76
+ "Expected setMessagesDisplaySuppressed(...) to have 2 parameters");
77
+
78
+ return bridging::callFromJs<jsi::Value>(
79
+ rt, &T::setMessagesDisplaySuppressed, jsInvoker_, instance_, std::move(enabled));
80
+ }
81
+ jsi::Value triggerEvent(jsi::Runtime &rt, jsi::String eventId) override {
82
+ static_assert(
83
+ bridging::getParameterCount(&T::triggerEvent) == 2,
84
+ "Expected triggerEvent(...) to have 2 parameters");
85
+
86
+ return bridging::callFromJs<jsi::Value>(
87
+ rt, &T::triggerEvent, jsInvoker_, instance_, std::move(eventId));
88
+ }
89
+
90
+ private:
91
+ friend class NativeRNFBTurboFiamCxxSpec;
92
+ T *instance_;
93
+ };
94
+
95
+ Delegate delegate_;
96
+ };
97
+
98
+ } // namespace facebook::react
@@ -0,0 +1,34 @@
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
+ version = "0.78.3"
7
+ source = { :git => 'https://github.com/facebook/react-native.git' }
8
+ if version == '1000.0.0'
9
+ # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
10
+ source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
11
+ else
12
+ source[:tag] = "v#{version}"
13
+ end
14
+
15
+ Pod::Spec.new do |s|
16
+ s.name = "ReactAppDependencyProvider"
17
+ s.version = version
18
+ s.summary = "The third party dependency provider for the app"
19
+ s.homepage = "https://reactnative.dev/"
20
+ s.documentation_url = "https://reactnative.dev/"
21
+ s.license = "MIT"
22
+ s.author = "Meta Platforms, Inc. and its affiliates"
23
+ s.platforms = min_supported_versions
24
+ s.source = source
25
+ s.source_files = "**/RCTAppDependencyProvider.{h,mm}"
26
+
27
+ # This guard prevent to install the dependencies when we run `pod install` in the old architecture.
28
+ s.pod_target_xcconfig = {
29
+ "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
30
+ "DEFINES_MODULE" => "YES"
31
+ }
32
+
33
+ s.dependency "ReactCodegen"
34
+ end
package/lib/index.ts CHANGED
@@ -15,11 +15,147 @@
15
15
  *
16
16
  */
17
17
 
18
- export type { InAppMessaging } from './types/in-app-messaging';
18
+ import { isBoolean, isString } from '@react-native-firebase/app/dist/module/common';
19
+ import {
20
+ FirebaseModule,
21
+ getOrCreateModularInstance,
22
+ } from '@react-native-firebase/app/dist/module/internal';
23
+ import type { ModuleConfig } from '@react-native-firebase/app/dist/module/internal';
24
+ import { setReactNativeModule } from '@react-native-firebase/app/dist/module/internal/nativeModule';
25
+ import './types/internal';
26
+ import type { FirebaseApp } from '@react-native-firebase/app';
27
+ import type { InAppMessaging } from './types/in-app-messaging';
28
+ import fallBackModule from './web/RNFBFiamModule';
29
+ import { version } from './version';
30
+
31
+ const nativeModuleName = 'NativeRNFBTurboFiam';
32
+
33
+ class FirebaseFiamModule extends FirebaseModule<typeof nativeModuleName> {
34
+ private _isMessagesDisplaySuppressed: boolean;
35
+ private _isAutomaticDataCollectionEnabled: boolean;
36
+
37
+ constructor(...args: ConstructorParameters<typeof FirebaseModule>) {
38
+ super(...args);
39
+ this._isMessagesDisplaySuppressed = this.native.isMessagesDisplaySuppressed;
40
+ this._isAutomaticDataCollectionEnabled = this.native.isAutomaticDataCollectionEnabled;
41
+ }
42
+
43
+ get isMessagesDisplaySuppressed(): boolean {
44
+ return this._isMessagesDisplaySuppressed;
45
+ }
46
+
47
+ get isAutomaticDataCollectionEnabled(): boolean {
48
+ return this._isAutomaticDataCollectionEnabled;
49
+ }
50
+
51
+ setMessagesDisplaySuppressed(enabled: boolean): Promise<null> {
52
+ if (!isBoolean(enabled)) {
53
+ throw new Error(
54
+ "getInAppMessaging().setMessagesDisplaySuppressed(*) 'enabled' must be a boolean.",
55
+ );
56
+ }
57
+
58
+ this._isMessagesDisplaySuppressed = enabled;
59
+ return this.native.setMessagesDisplaySuppressed(enabled);
60
+ }
19
61
 
20
- export type { FirebaseInAppMessagingTypes } from './types/namespaced';
62
+ setAutomaticDataCollectionEnabled(enabled: boolean): Promise<null> {
63
+ if (!isBoolean(enabled)) {
64
+ throw new Error(
65
+ "getInAppMessaging().setAutomaticDataCollectionEnabled(*) 'enabled' must be a boolean.",
66
+ );
67
+ }
21
68
 
22
- export * from './modular';
69
+ this._isAutomaticDataCollectionEnabled = enabled;
70
+ return this.native.setAutomaticDataCollectionEnabled(enabled);
71
+ }
72
+
73
+ triggerEvent(eventId: string): Promise<null> {
74
+ if (!isString(eventId)) {
75
+ throw new Error("getInAppMessaging().triggerEvent(*) 'eventId' must be a string.");
76
+ }
77
+ return this.native.triggerEvent(eventId);
78
+ }
79
+ }
80
+
81
+ const config: ModuleConfig = {
82
+ namespace: 'inAppMessaging',
83
+ nativeModuleName,
84
+ nativeEvents: false,
85
+ hasMultiAppSupport: false,
86
+ hasCustomUrlOrRegionSupport: false,
87
+ turboModule: true,
88
+ };
89
+
90
+ /**
91
+ * RN Firebase package version string exported from the modular entry point.
92
+ *
93
+ * The firebase-js-sdk does not ship a modular In-App Messaging entry point or `SDK_VERSION` export.
94
+ */
95
+ export const SDK_VERSION = version;
96
+
97
+ /**
98
+ * Returns the {@link InAppMessaging} instance for the default or given {@link FirebaseApp}.
99
+ *
100
+ * @param app - The Firebase `FirebaseApp` to use. When omitted, the default app is used.
101
+ * @returns The In-App Messaging service instance for that app.
102
+ */
103
+ export function getInAppMessaging(app?: FirebaseApp): InAppMessaging {
104
+ return getOrCreateModularInstance(FirebaseFiamModule, config, app) as unknown as InAppMessaging;
105
+ }
23
106
 
24
- export * from './namespaced';
25
- export { default } from './namespaced';
107
+ /**
108
+ * Determines whether messages are suppressed or not.
109
+ */
110
+ export function isMessagesDisplaySuppressed(inAppMessaging: InAppMessaging): boolean {
111
+ return inAppMessaging.isMessagesDisplaySuppressed;
112
+ }
113
+
114
+ /**
115
+ * Enable or disable suppression of Firebase In App Messaging messages.
116
+ *
117
+ * When enabled, no in app messages will be rendered until either you disable suppression, or the app
118
+ * restarts. This state is not persisted between app restarts.
119
+ */
120
+ export function setMessagesDisplaySuppressed(
121
+ inAppMessaging: InAppMessaging,
122
+ enabled: boolean,
123
+ ): Promise<null> {
124
+ return inAppMessaging.setMessagesDisplaySuppressed(enabled);
125
+ }
126
+
127
+ /**
128
+ * Determines whether automatic data collection is enabled or not.
129
+ */
130
+ export function isAutomaticDataCollectionEnabled(inAppMessaging: InAppMessaging): boolean {
131
+ return inAppMessaging.isAutomaticDataCollectionEnabled;
132
+ }
133
+
134
+ /**
135
+ * Enable or disable automatic data collection for Firebase In-App Messaging.
136
+ *
137
+ * When enabled, generates a registration token on app startup if there is no valid one and
138
+ * generates a new token when it is deleted (which prevents `deleteInstanceId()` from stopping the
139
+ * periodic sending of data).
140
+ *
141
+ * This setting is persisted across app restarts and overrides the setting specified in your
142
+ * manifest/plist file.
143
+ */
144
+ export function setAutomaticDataCollectionEnabled(
145
+ inAppMessaging: InAppMessaging,
146
+ enabled: boolean,
147
+ ): Promise<null> {
148
+ return inAppMessaging.setAutomaticDataCollectionEnabled(enabled);
149
+ }
150
+
151
+ /**
152
+ * Trigger in-app messages programmatically.
153
+ */
154
+ export function triggerEvent(inAppMessaging: InAppMessaging, eventId: string): Promise<null> {
155
+ return inAppMessaging.triggerEvent(eventId);
156
+ }
157
+
158
+ // Register the interop module for non-native platforms.
159
+ setReactNativeModule(nativeModuleName, fallBackModule as unknown as Record<string, unknown>);
160
+
161
+ export type { InAppMessaging } from './types/in-app-messaging';
@@ -17,9 +17,6 @@
17
17
 
18
18
  import type { InAppMessaging } from './in-app-messaging';
19
19
 
20
- /** Optional final argument passed by modular API wrappers (MODULAR_DEPRECATION_ARG). */
21
- export type InAppMessagingModularDeprecationArg = string;
22
-
23
20
  /**
24
21
  * Wrapped native module contract for `RNFBFiamModule`.
25
22
  */
@@ -33,22 +30,10 @@ export interface RNFBFiamModule {
33
30
 
34
31
  declare module '@react-native-firebase/app/dist/module/internal/NativeModules' {
35
32
  interface ReactNativeFirebaseNativeModules {
36
- RNFBFiamModule: RNFBFiamModule;
33
+ NativeRNFBTurboFiam: RNFBFiamModule;
37
34
  }
38
35
  }
39
36
 
40
37
  export interface InAppMessagingInternal extends InAppMessaging {
41
38
  readonly native: RNFBFiamModule;
42
39
  }
43
-
44
- export type InAppMessagingWithDeprecationArg = InAppMessagingInternal & {
45
- setMessagesDisplaySuppressed(
46
- enabled: boolean,
47
- _depArg: InAppMessagingModularDeprecationArg,
48
- ): Promise<null>;
49
- setAutomaticDataCollectionEnabled(
50
- enabled: boolean,
51
- _depArg: InAppMessagingModularDeprecationArg,
52
- ): Promise<null>;
53
- triggerEvent(eventId: string, _depArg: InAppMessagingModularDeprecationArg): Promise<null>;
54
- };
package/lib/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '25.1.0';
2
+ export const version = '26.1.0';
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Copyright (c) 2016-present Invertase Limited & Contributors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this library except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ */
17
+
18
+ import type { RNFBFiamModule } from '../types/internal';
19
+
20
+ const RNFBFiamModuleWeb: RNFBFiamModule = {
21
+ isMessagesDisplaySuppressed: false,
22
+ isAutomaticDataCollectionEnabled: false,
23
+ setMessagesDisplaySuppressed() {
24
+ return Promise.resolve(null);
25
+ },
26
+ setAutomaticDataCollectionEnabled() {
27
+ return Promise.resolve(null);
28
+ },
29
+ triggerEvent() {
30
+ return Promise.resolve(null);
31
+ },
32
+ };
33
+
34
+ export default RNFBFiamModuleWeb;
package/package.json CHANGED
@@ -1,15 +1,32 @@
1
1
  {
2
2
  "name": "@react-native-firebase/in-app-messaging",
3
- "version": "25.1.0",
3
+ "version": "26.1.0",
4
4
  "author": "Invertase <oss@invertase.io> (http://invertase.io)",
5
5
  "description": "React Native Firebase - Firebase In-App Messaging helps you engage your app's active users by sending them targeted, contextual messages that encourage them to use key app features. React Native Firebase provides support for both native Android & iOS integration with a simple JavaScript API.",
6
6
  "main": "./dist/module/index.js",
7
7
  "types": "./dist/typescript/lib/index.d.ts",
8
+ "codegenConfig": {
9
+ "name": "RNFBInAppMessagingTurboModules",
10
+ "type": "modules",
11
+ "jsSrcsDir": "specs",
12
+ "includesGeneratedCode": true,
13
+ "android": {
14
+ "javaPackageName": "io.invertase.firebase.fiam"
15
+ },
16
+ "ios": {
17
+ "modulesProvider": {
18
+ "NativeRNFBTurboFiam": "RNFBFiamModule"
19
+ }
20
+ }
21
+ },
8
22
  "scripts": {
9
23
  "build": "genversion --esm --semi lib/version.ts",
10
24
  "build:clean": "rimraf android/build && rimraf ios/build",
11
25
  "compile": "bob build",
12
- "prepare": "yarn run build && yarn compile"
26
+ "prepare": "yarn run build && yarn compile",
27
+ "codegen": "yarn android:codegen && yarn ios:codegen",
28
+ "android:codegen": "npx @react-native-community/cli codegen --platform android --outputPath=./android/src/reactnative/java/io/invertase/firebase/fiam/generated",
29
+ "ios:codegen": "npx @react-native-community/cli codegen --platform ios --outputPath=./ios/generated"
13
30
  },
14
31
  "repository": {
15
32
  "type": "git",
@@ -28,14 +45,15 @@
28
45
  "inAppMessaging"
29
46
  ],
30
47
  "peerDependencies": {
31
- "@react-native-firebase/analytics": "25.1.0",
32
- "@react-native-firebase/app": "25.1.0"
48
+ "@react-native-firebase/analytics": "26.1.0",
49
+ "@react-native-firebase/app": "26.1.0"
33
50
  },
34
51
  "publishConfig": {
35
52
  "access": "public",
36
53
  "provenance": true
37
54
  },
38
55
  "devDependencies": {
56
+ "@react-native-firebase/app": "26.1.0",
39
57
  "react-native-builder-bob": "^0.41.0"
40
58
  },
41
59
  "exports": {
@@ -68,5 +86,5 @@
68
86
  "node_modules/",
69
87
  "dist/"
70
88
  ],
71
- "gitHead": "e0a565d8a73a9b103d140ffacfb8876b30d8bdc5"
89
+ "gitHead": "59d053eca14ab8aa80e5ac76887014925c67e52b"
72
90
  }
@@ -0,0 +1,10 @@
1
+ module.exports = {
2
+ dependency: {
3
+ platforms: {
4
+ android: {
5
+ cmakeListsPath:
6
+ './src/reactnative/java/io/invertase/firebase/fiam/generated/jni/CMakeLists.txt',
7
+ },
8
+ },
9
+ },
10
+ };
@@ -0,0 +1,15 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { TurboModuleRegistry } from 'react-native';
3
+
4
+ export interface Spec extends TurboModule {
5
+ getConstants(): {
6
+ isMessagesDisplaySuppressed: boolean;
7
+ isAutomaticDataCollectionEnabled: boolean;
8
+ };
9
+
10
+ setAutomaticDataCollectionEnabled(enabled: boolean): Promise<void>;
11
+ setMessagesDisplaySuppressed(enabled: boolean): Promise<void>;
12
+ triggerEvent(eventId: string): Promise<void>;
13
+ }
14
+
15
+ export default TurboModuleRegistry.getEnforcing<Spec>('NativeRNFBTurboFiam');