@capillarytech/react-native-hydra-lib 1.7.0-beta.1
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/CHANGELOG.md +252 -0
- package/DEPRECATION_POLICY.md +220 -0
- package/LICENSE +20 -0
- package/MIGRATION.md +361 -0
- package/README.md +491 -0
- package/RELEASE_NOTES.md +528 -0
- package/android/build.gradle +565 -0
- package/android/generated/java/com/hydralib/NativeHydraLibSpec.java +185 -0
- package/android/generated/jni/CMakeLists.txt +36 -0
- package/android/generated/jni/RNHydraLibSpec-generated.cpp +248 -0
- package/android/generated/jni/RNHydraLibSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNHydraLibSpec/ComponentDescriptors.cpp +24 -0
- package/android/generated/jni/react/renderer/components/RNHydraLibSpec/ComponentDescriptors.h +26 -0
- package/android/generated/jni/react/renderer/components/RNHydraLibSpec/EventEmitters.cpp +18 -0
- package/android/generated/jni/react/renderer/components/RNHydraLibSpec/EventEmitters.h +37 -0
- package/android/generated/jni/react/renderer/components/RNHydraLibSpec/Props.cpp +39 -0
- package/android/generated/jni/react/renderer/components/RNHydraLibSpec/Props.h +47 -0
- package/android/generated/jni/react/renderer/components/RNHydraLibSpec/RNHydraLibSpecJSI-generated.cpp +283 -0
- package/android/generated/jni/react/renderer/components/RNHydraLibSpec/RNHydraLibSpecJSI.h +395 -0
- package/android/generated/jni/react/renderer/components/RNHydraLibSpec/ShadowNodes.cpp +19 -0
- package/android/generated/jni/react/renderer/components/RNHydraLibSpec/ShadowNodes.h +54 -0
- package/android/generated/jni/react/renderer/components/RNHydraLibSpec/States.cpp +16 -0
- package/android/generated/jni/react/renderer/components/RNHydraLibSpec/States.h +53 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +11 -0
- package/android/src/main/AndroidManifestNew.xml +16 -0
- package/android/src/main/AndroidManifestNoFirebaseIcon.xml +5 -0
- package/android/src/main/java/com/hydralib/delegates/HydraActivityCallbacks.kt +90 -0
- package/android/src/main/java/com/hydralib/delegates/NonHydraNotificationActivity.kt +43 -0
- package/android/src/main/java/com/hydralib/eventemitter/HydraEventEmitter.kt +150 -0
- package/android/src/main/java/com/hydralib/eventemitter/HydraEventType.kt +44 -0
- package/android/src/main/java/com/hydralib/gamification/GamificationBannerViewManager.kt +121 -0
- package/android/src/main/java/com/hydralib/gamification/GamificationEmbedViewManager.kt +153 -0
- package/android/src/main/java/com/hydralib/gamification/GamificationLoyaltyViewManager.kt +95 -0
- package/android/src/main/java/com/hydralib/hydrasdk/HydraCore.kt +860 -0
- package/android/src/main/java/com/hydralib/hydrasdk/HydraExtenstions.kt +331 -0
- package/android/src/main/java/com/hydralib/hydrasdk/HydraInAppMessages.kt +136 -0
- package/android/src/main/java/com/hydralib/hydrasdk/HydraInbox.kt +70 -0
- package/android/src/main/java/com/hydralib/hydrasdk/HydraInboxUI.kt +54 -0
- package/android/src/main/java/com/hydralib/hydrasdk/HydraPushNotification.kt +299 -0
- package/android/src/main/java/com/hydralib/nativeapis/Hydra.kt +28 -0
- package/android/src/main/java/com/hydralib/nativeapis/HydraFirebaseRemoteConfigKeys.kt +76 -0
- package/android/src/main/java/com/hydralib/nativeapis/HydraInitializer.kt +130 -0
- package/android/src/main/java/com/hydralib/nativeapis/HydraNativeMessaging.kt +18 -0
- package/android/src/main/java/com/hydralib/nativeapis/HydraRemoteConfig.kt +59 -0
- package/android/src/main/java/com/hydralib/utils/RNHydraPreferencesManager.kt +154 -0
- package/android/src/main/java/com/hydralib/utils/ResourceUtil.kt +10 -0
- package/android/src/newarch/HydraLibModule.kt +218 -0
- package/android/src/oldarch/HydraLibModule.kt +258 -0
- package/android/src/rn72OrLess/HydraLibPackage.kt +43 -0
- package/android/src/rn73OrMore/HydraLibPackage.kt +53 -0
- package/ios/Delegates/HydraApplicationDelegate.swift +196 -0
- package/ios/Delegates/HydraFirebaseMessagingDelegate.swift +20 -0
- package/ios/Delegates/HydraUNUserNotificationCenterDelegate.swift +26 -0
- package/ios/EventEmitter/HydraEventEmitter.swift +98 -0
- package/ios/EventEmitter/HydraEventType.swift +28 -0
- package/ios/EventEmitter/HydraNativeEmitterBrigde.h +15 -0
- package/ios/EventEmitter/HydraNativeEmitterBrigde.mm +48 -0
- package/ios/GamificationViews/GamificationBannerViewComponentView.h +14 -0
- package/ios/GamificationViews/GamificationBannerViewComponentView.mm +125 -0
- package/ios/GamificationViews/GamificationEmbedViewComponentView.h +14 -0
- package/ios/GamificationViews/GamificationEmbedViewComponentView.mm +131 -0
- package/ios/GamificationViews/GamificationLoyaltyViewComponentView.h +14 -0
- package/ios/GamificationViews/GamificationLoyaltyViewComponentView.mm +120 -0
- package/ios/HydraLib.h +16 -0
- package/ios/HydraLib.mm +207 -0
- package/ios/HydraSDK/HydraInAppMessages.swift +93 -0
- package/ios/HydraSDK/HydraInbox.swift +97 -0
- package/ios/HydraSDK/HydraInboxUI.swift +105 -0
- package/ios/HydraSDK/HydraPushNotification.swift +476 -0
- package/ios/HydraSDK/HydraSDKCore.swift +707 -0
- package/ios/NativeAPIs/Hydra.h +34 -0
- package/ios/NativeAPIs/Hydra.mm +47 -0
- package/ios/NativeAPIs/HydraNativeFirebaseRemoteConfigKeys.h +23 -0
- package/ios/NativeAPIs/HydraNativeFirebaseRemoteConfigKeys.mm +80 -0
- package/ios/NativeAPIs/HydraNativeInitializer.h +16 -0
- package/ios/NativeAPIs/HydraNativeInitializer.mm +39 -0
- package/ios/NativeAPIs/HydraNativeMessaging.h +24 -0
- package/ios/NativeAPIs/HydraNativeMessaging.mm +53 -0
- package/ios/NativeAPIs/HydraNativeRemoteConfig.h +27 -0
- package/ios/NativeAPIs/HydraNativeRemoteConfig.mm +89 -0
- package/ios/Utils/HydraExtensions.swift +322 -0
- package/ios/Utils/HydraRNConstants.swift +13 -0
- package/ios/Utils/RNHydraLogger.swift +31 -0
- package/ios/generated/RNHydraLibSpec/ComponentDescriptors.cpp +24 -0
- package/ios/generated/RNHydraLibSpec/ComponentDescriptors.h +26 -0
- package/ios/generated/RNHydraLibSpec/EventEmitters.cpp +18 -0
- package/ios/generated/RNHydraLibSpec/EventEmitters.h +37 -0
- package/ios/generated/RNHydraLibSpec/Props.cpp +39 -0
- package/ios/generated/RNHydraLibSpec/Props.h +47 -0
- package/ios/generated/RNHydraLibSpec/RCTComponentViewHelpers.h +28 -0
- package/ios/generated/RNHydraLibSpec/RNHydraLibSpec-generated.mm +291 -0
- package/ios/generated/RNHydraLibSpec/RNHydraLibSpec.h +167 -0
- package/ios/generated/RNHydraLibSpec/ShadowNodes.cpp +19 -0
- package/ios/generated/RNHydraLibSpec/ShadowNodes.h +54 -0
- package/ios/generated/RNHydraLibSpec/States.cpp +16 -0
- package/ios/generated/RNHydraLibSpec/States.h +53 -0
- package/ios/generated/RNHydraLibSpecJSI-generated.cpp +283 -0
- package/ios/generated/RNHydraLibSpecJSI.h +395 -0
- package/lib/commonjs/GamificationBannerViewNativeComponent.js +10 -0
- package/lib/commonjs/GamificationBannerViewNativeComponent.js.map +1 -0
- package/lib/commonjs/GamificationEmbedViewNativeComponent.js +10 -0
- package/lib/commonjs/GamificationEmbedViewNativeComponent.js.map +1 -0
- package/lib/commonjs/GamificationLoyaltyViewNativeComponent.js +10 -0
- package/lib/commonjs/GamificationLoyaltyViewNativeComponent.js.map +1 -0
- package/lib/commonjs/NativeHydraLib.js +11 -0
- package/lib/commonjs/NativeHydraLib.js.map +1 -0
- package/lib/commonjs/components/GamificationBannerView.js +15 -0
- package/lib/commonjs/components/GamificationBannerView.js.map +1 -0
- package/lib/commonjs/components/GamificationEmbedView.js +15 -0
- package/lib/commonjs/components/GamificationEmbedView.js.map +1 -0
- package/lib/commonjs/components/GamificationLoyaltyView.js +15 -0
- package/lib/commonjs/components/GamificationLoyaltyView.js.map +1 -0
- package/lib/commonjs/hydra-apis/Hydra.js +43 -0
- package/lib/commonjs/hydra-apis/Hydra.js.map +1 -0
- package/lib/commonjs/hydra-apis/HydraCore.js +42 -0
- package/lib/commonjs/hydra-apis/HydraCore.js.map +1 -0
- package/lib/commonjs/hydra-apis/HydraInAppMessaging.js +24 -0
- package/lib/commonjs/hydra-apis/HydraInAppMessaging.js.map +1 -0
- package/lib/commonjs/hydra-apis/HydraInbox.js +29 -0
- package/lib/commonjs/hydra-apis/HydraInbox.js.map +1 -0
- package/lib/commonjs/hydra-apis/HydraInboxUI.js +18 -0
- package/lib/commonjs/hydra-apis/HydraInboxUI.js.map +1 -0
- package/lib/commonjs/hydra-apis/HydraNativeEventEmitter.js +133 -0
- package/lib/commonjs/hydra-apis/HydraNativeEventEmitter.js.map +1 -0
- package/lib/commonjs/hydra-apis/HydraPushNotification.js +21 -0
- package/lib/commonjs/hydra-apis/HydraPushNotification.js.map +1 -0
- package/lib/commonjs/index.js +230 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/models/HydraAccountConfig.js +41 -0
- package/lib/commonjs/models/HydraAccountConfig.js.map +1 -0
- package/lib/commonjs/models/HydraFirebaseRemoteConfigKeys.js +40 -0
- package/lib/commonjs/models/HydraFirebaseRemoteConfigKeys.js.map +1 -0
- package/lib/commonjs/models/HydraGeoConfig.js +24 -0
- package/lib/commonjs/models/HydraGeoConfig.js.map +1 -0
- package/lib/commonjs/models/HydraInAppMessage/HydraInAppButtonComponent.js +26 -0
- package/lib/commonjs/models/HydraInAppMessage/HydraInAppButtonComponent.js.map +1 -0
- package/lib/commonjs/models/HydraInAppMessage/HydraInAppComponentStyle.js +26 -0
- package/lib/commonjs/models/HydraInAppMessage/HydraInAppComponentStyle.js.map +1 -0
- package/lib/commonjs/models/HydraInAppMessage/HydraInAppFeedbackSelectionType.js +39 -0
- package/lib/commonjs/models/HydraInAppMessage/HydraInAppFeedbackSelectionType.js.map +1 -0
- package/lib/commonjs/models/HydraInAppMessage/HydraInAppMessage.js +60 -0
- package/lib/commonjs/models/HydraInAppMessage/HydraInAppMessage.js.map +1 -0
- package/lib/commonjs/models/HydraInAppMessage/HydraInAppTemplateType.js +66 -0
- package/lib/commonjs/models/HydraInAppMessage/HydraInAppTemplateType.js.map +1 -0
- package/lib/commonjs/models/HydraInAppMessage/HydraInAppTextComponent.js +21 -0
- package/lib/commonjs/models/HydraInAppMessage/HydraInAppTextComponent.js.map +1 -0
- package/lib/commonjs/models/HydraLogLevel.js +16 -0
- package/lib/commonjs/models/HydraLogLevel.js.map +1 -0
- package/lib/commonjs/models/HydraNativeEvent.js +27 -0
- package/lib/commonjs/models/HydraNativeEvent.js.map +1 -0
- package/lib/commonjs/models/HydraNotification/HydraNotification.js +70 -0
- package/lib/commonjs/models/HydraNotification/HydraNotification.js.map +1 -0
- package/lib/commonjs/models/HydraNotification/HydraNotificationBody.js +25 -0
- package/lib/commonjs/models/HydraNotification/HydraNotificationBody.js.map +1 -0
- package/lib/commonjs/models/HydraNotification/HydraNotificationCta.js +23 -0
- package/lib/commonjs/models/HydraNotification/HydraNotificationCta.js.map +1 -0
- package/lib/commonjs/models/HydraNotification/HydraNotificationCtaType.js +62 -0
- package/lib/commonjs/models/HydraNotification/HydraNotificationCtaType.js.map +1 -0
- package/lib/commonjs/models/HydraNotification/HydraNotificationExpandedDetails.js +25 -0
- package/lib/commonjs/models/HydraNotification/HydraNotificationExpandedDetails.js.map +1 -0
- package/lib/commonjs/models/HydraNotification/HydraNotificationGateway.js +13 -0
- package/lib/commonjs/models/HydraNotification/HydraNotificationGateway.js.map +1 -0
- package/lib/commonjs/models/HydraPushPreferences.js +20 -0
- package/lib/commonjs/models/HydraPushPreferences.js.map +1 -0
- package/lib/commonjs/models/HydraUserDetails.js +26 -0
- package/lib/commonjs/models/HydraUserDetails.js.map +1 -0
- package/lib/commonjs/models/HydraVisitorInfo.js +19 -0
- package/lib/commonjs/models/HydraVisitorInfo.js.map +1 -0
- package/lib/commonjs/models/NonHydraNotification.js +18 -0
- package/lib/commonjs/models/NonHydraNotification.js.map +1 -0
- package/lib/commonjs/models/UserState.js +41 -0
- package/lib/commonjs/models/UserState.js.map +1 -0
- package/lib/module/GamificationBannerViewNativeComponent.js +5 -0
- package/lib/module/GamificationBannerViewNativeComponent.js.map +1 -0
- package/lib/module/GamificationEmbedViewNativeComponent.js +5 -0
- package/lib/module/GamificationEmbedViewNativeComponent.js.map +1 -0
- package/lib/module/GamificationLoyaltyViewNativeComponent.js +5 -0
- package/lib/module/GamificationLoyaltyViewNativeComponent.js.map +1 -0
- package/lib/module/NativeHydraLib.js +7 -0
- package/lib/module/NativeHydraLib.js.map +1 -0
- package/lib/module/components/GamificationBannerView.js +10 -0
- package/lib/module/components/GamificationBannerView.js.map +1 -0
- package/lib/module/components/GamificationEmbedView.js +10 -0
- package/lib/module/components/GamificationEmbedView.js.map +1 -0
- package/lib/module/components/GamificationLoyaltyView.js +10 -0
- package/lib/module/components/GamificationLoyaltyView.js.map +1 -0
- package/lib/module/hydra-apis/Hydra.js +37 -0
- package/lib/module/hydra-apis/Hydra.js.map +1 -0
- package/lib/module/hydra-apis/HydraCore.js +36 -0
- package/lib/module/hydra-apis/HydraCore.js.map +1 -0
- package/lib/module/hydra-apis/HydraInAppMessaging.js +18 -0
- package/lib/module/hydra-apis/HydraInAppMessaging.js.map +1 -0
- package/lib/module/hydra-apis/HydraInbox.js +23 -0
- package/lib/module/hydra-apis/HydraInbox.js.map +1 -0
- package/lib/module/hydra-apis/HydraInboxUI.js +12 -0
- package/lib/module/hydra-apis/HydraInboxUI.js.map +1 -0
- package/lib/module/hydra-apis/HydraNativeEventEmitter.js +127 -0
- package/lib/module/hydra-apis/HydraNativeEventEmitter.js.map +1 -0
- package/lib/module/hydra-apis/HydraPushNotification.js +15 -0
- package/lib/module/hydra-apis/HydraPushNotification.js.map +1 -0
- package/lib/module/index.js +36 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/models/HydraAccountConfig.js +36 -0
- package/lib/module/models/HydraAccountConfig.js.map +1 -0
- package/lib/module/models/HydraFirebaseRemoteConfigKeys.js +35 -0
- package/lib/module/models/HydraFirebaseRemoteConfigKeys.js.map +1 -0
- package/lib/module/models/HydraGeoConfig.js +19 -0
- package/lib/module/models/HydraGeoConfig.js.map +1 -0
- package/lib/module/models/HydraInAppMessage/HydraInAppButtonComponent.js +21 -0
- package/lib/module/models/HydraInAppMessage/HydraInAppButtonComponent.js.map +1 -0
- package/lib/module/models/HydraInAppMessage/HydraInAppComponentStyle.js +21 -0
- package/lib/module/models/HydraInAppMessage/HydraInAppComponentStyle.js.map +1 -0
- package/lib/module/models/HydraInAppMessage/HydraInAppFeedbackSelectionType.js +35 -0
- package/lib/module/models/HydraInAppMessage/HydraInAppFeedbackSelectionType.js.map +1 -0
- package/lib/module/models/HydraInAppMessage/HydraInAppMessage.js +55 -0
- package/lib/module/models/HydraInAppMessage/HydraInAppMessage.js.map +1 -0
- package/lib/module/models/HydraInAppMessage/HydraInAppTemplateType.js +62 -0
- package/lib/module/models/HydraInAppMessage/HydraInAppTemplateType.js.map +1 -0
- package/lib/module/models/HydraInAppMessage/HydraInAppTextComponent.js +16 -0
- package/lib/module/models/HydraInAppMessage/HydraInAppTextComponent.js.map +1 -0
- package/lib/module/models/HydraLogLevel.js +12 -0
- package/lib/module/models/HydraLogLevel.js.map +1 -0
- package/lib/module/models/HydraNativeEvent.js +23 -0
- package/lib/module/models/HydraNativeEvent.js.map +1 -0
- package/lib/module/models/HydraNotification/HydraNotification.js +65 -0
- package/lib/module/models/HydraNotification/HydraNotification.js.map +1 -0
- package/lib/module/models/HydraNotification/HydraNotificationBody.js +20 -0
- package/lib/module/models/HydraNotification/HydraNotificationBody.js.map +1 -0
- package/lib/module/models/HydraNotification/HydraNotificationCta.js +18 -0
- package/lib/module/models/HydraNotification/HydraNotificationCta.js.map +1 -0
- package/lib/module/models/HydraNotification/HydraNotificationCtaType.js +58 -0
- package/lib/module/models/HydraNotification/HydraNotificationCtaType.js.map +1 -0
- package/lib/module/models/HydraNotification/HydraNotificationExpandedDetails.js +20 -0
- package/lib/module/models/HydraNotification/HydraNotificationExpandedDetails.js.map +1 -0
- package/lib/module/models/HydraNotification/HydraNotificationGateway.js +9 -0
- package/lib/module/models/HydraNotification/HydraNotificationGateway.js.map +1 -0
- package/lib/module/models/HydraPushPreferences.js +15 -0
- package/lib/module/models/HydraPushPreferences.js.map +1 -0
- package/lib/module/models/HydraUserDetails.js +21 -0
- package/lib/module/models/HydraUserDetails.js.map +1 -0
- package/lib/module/models/HydraVisitorInfo.js +14 -0
- package/lib/module/models/HydraVisitorInfo.js.map +1 -0
- package/lib/module/models/NonHydraNotification.js +13 -0
- package/lib/module/models/NonHydraNotification.js.map +1 -0
- package/lib/module/models/UserState.js +37 -0
- package/lib/module/models/UserState.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/GamificationBannerViewNativeComponent.d.ts +7 -0
- package/lib/typescript/commonjs/src/GamificationBannerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/GamificationEmbedViewNativeComponent.d.ts +7 -0
- package/lib/typescript/commonjs/src/GamificationEmbedViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/GamificationLoyaltyViewNativeComponent.d.ts +7 -0
- package/lib/typescript/commonjs/src/GamificationLoyaltyViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/NativeHydraLib.d.ts +46 -0
- package/lib/typescript/commonjs/src/NativeHydraLib.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/GamificationBannerView.d.ts +6 -0
- package/lib/typescript/commonjs/src/components/GamificationBannerView.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/GamificationEmbedView.d.ts +6 -0
- package/lib/typescript/commonjs/src/components/GamificationEmbedView.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/GamificationLoyaltyView.d.ts +6 -0
- package/lib/typescript/commonjs/src/components/GamificationLoyaltyView.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hydra-apis/Hydra.d.ts +15 -0
- package/lib/typescript/commonjs/src/hydra-apis/Hydra.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hydra-apis/HydraCore.d.ts +18 -0
- package/lib/typescript/commonjs/src/hydra-apis/HydraCore.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hydra-apis/HydraInAppMessaging.d.ts +8 -0
- package/lib/typescript/commonjs/src/hydra-apis/HydraInAppMessaging.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hydra-apis/HydraInbox.d.ts +9 -0
- package/lib/typescript/commonjs/src/hydra-apis/HydraInbox.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hydra-apis/HydraInboxUI.d.ts +5 -0
- package/lib/typescript/commonjs/src/hydra-apis/HydraInboxUI.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hydra-apis/HydraNativeEventEmitter.d.ts +35 -0
- package/lib/typescript/commonjs/src/hydra-apis/HydraNativeEventEmitter.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hydra-apis/HydraPushNotification.d.ts +6 -0
- package/lib/typescript/commonjs/src/hydra-apis/HydraPushNotification.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +37 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraAccountConfig.d.ts +14 -0
- package/lib/typescript/commonjs/src/models/HydraAccountConfig.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraFirebaseRemoteConfigKeys.d.ts +13 -0
- package/lib/typescript/commonjs/src/models/HydraFirebaseRemoteConfigKeys.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraGeoConfig.d.ts +14 -0
- package/lib/typescript/commonjs/src/models/HydraGeoConfig.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppButtonComponent.d.ts +16 -0
- package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppButtonComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppComponentStyle.d.ts +10 -0
- package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppComponentStyle.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppFeedbackSelectionType.d.ts +9 -0
- package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppFeedbackSelectionType.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppMessage.d.ts +29 -0
- package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppMessage.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppTemplateType.d.ts +15 -0
- package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppTemplateType.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppTextComponent.d.ts +11 -0
- package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppTextComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraLogLevel.d.ts +9 -0
- package/lib/typescript/commonjs/src/models/HydraLogLevel.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraNativeEvent.d.ts +20 -0
- package/lib/typescript/commonjs/src/models/HydraNativeEvent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotification.d.ts +32 -0
- package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotification.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationBody.d.ts +19 -0
- package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationBody.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationCta.d.ts +13 -0
- package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationCta.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationCtaType.d.ts +13 -0
- package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationCtaType.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationExpandedDetails.d.ts +19 -0
- package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationExpandedDetails.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationGateway.d.ts +6 -0
- package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationGateway.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraPushPreferences.d.ts +10 -0
- package/lib/typescript/commonjs/src/models/HydraPushPreferences.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraUserDetails.d.ts +16 -0
- package/lib/typescript/commonjs/src/models/HydraUserDetails.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/HydraVisitorInfo.d.ts +6 -0
- package/lib/typescript/commonjs/src/models/HydraVisitorInfo.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/NonHydraNotification.d.ts +9 -0
- package/lib/typescript/commonjs/src/models/NonHydraNotification.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/UserState.d.ts +11 -0
- package/lib/typescript/commonjs/src/models/UserState.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/GamificationBannerViewNativeComponent.d.ts +7 -0
- package/lib/typescript/module/src/GamificationBannerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/GamificationEmbedViewNativeComponent.d.ts +7 -0
- package/lib/typescript/module/src/GamificationEmbedViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/GamificationLoyaltyViewNativeComponent.d.ts +7 -0
- package/lib/typescript/module/src/GamificationLoyaltyViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/NativeHydraLib.d.ts +46 -0
- package/lib/typescript/module/src/NativeHydraLib.d.ts.map +1 -0
- package/lib/typescript/module/src/components/GamificationBannerView.d.ts +6 -0
- package/lib/typescript/module/src/components/GamificationBannerView.d.ts.map +1 -0
- package/lib/typescript/module/src/components/GamificationEmbedView.d.ts +6 -0
- package/lib/typescript/module/src/components/GamificationEmbedView.d.ts.map +1 -0
- package/lib/typescript/module/src/components/GamificationLoyaltyView.d.ts +6 -0
- package/lib/typescript/module/src/components/GamificationLoyaltyView.d.ts.map +1 -0
- package/lib/typescript/module/src/hydra-apis/Hydra.d.ts +15 -0
- package/lib/typescript/module/src/hydra-apis/Hydra.d.ts.map +1 -0
- package/lib/typescript/module/src/hydra-apis/HydraCore.d.ts +18 -0
- package/lib/typescript/module/src/hydra-apis/HydraCore.d.ts.map +1 -0
- package/lib/typescript/module/src/hydra-apis/HydraInAppMessaging.d.ts +8 -0
- package/lib/typescript/module/src/hydra-apis/HydraInAppMessaging.d.ts.map +1 -0
- package/lib/typescript/module/src/hydra-apis/HydraInbox.d.ts +9 -0
- package/lib/typescript/module/src/hydra-apis/HydraInbox.d.ts.map +1 -0
- package/lib/typescript/module/src/hydra-apis/HydraInboxUI.d.ts +5 -0
- package/lib/typescript/module/src/hydra-apis/HydraInboxUI.d.ts.map +1 -0
- package/lib/typescript/module/src/hydra-apis/HydraNativeEventEmitter.d.ts +35 -0
- package/lib/typescript/module/src/hydra-apis/HydraNativeEventEmitter.d.ts.map +1 -0
- package/lib/typescript/module/src/hydra-apis/HydraPushNotification.d.ts +6 -0
- package/lib/typescript/module/src/hydra-apis/HydraPushNotification.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +37 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraAccountConfig.d.ts +14 -0
- package/lib/typescript/module/src/models/HydraAccountConfig.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraFirebaseRemoteConfigKeys.d.ts +13 -0
- package/lib/typescript/module/src/models/HydraFirebaseRemoteConfigKeys.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraGeoConfig.d.ts +14 -0
- package/lib/typescript/module/src/models/HydraGeoConfig.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppButtonComponent.d.ts +16 -0
- package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppButtonComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppComponentStyle.d.ts +10 -0
- package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppComponentStyle.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppFeedbackSelectionType.d.ts +9 -0
- package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppFeedbackSelectionType.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppMessage.d.ts +29 -0
- package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppMessage.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppTemplateType.d.ts +15 -0
- package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppTemplateType.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppTextComponent.d.ts +11 -0
- package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppTextComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraLogLevel.d.ts +9 -0
- package/lib/typescript/module/src/models/HydraLogLevel.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraNativeEvent.d.ts +20 -0
- package/lib/typescript/module/src/models/HydraNativeEvent.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraNotification/HydraNotification.d.ts +32 -0
- package/lib/typescript/module/src/models/HydraNotification/HydraNotification.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraNotification/HydraNotificationBody.d.ts +19 -0
- package/lib/typescript/module/src/models/HydraNotification/HydraNotificationBody.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraNotification/HydraNotificationCta.d.ts +13 -0
- package/lib/typescript/module/src/models/HydraNotification/HydraNotificationCta.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraNotification/HydraNotificationCtaType.d.ts +13 -0
- package/lib/typescript/module/src/models/HydraNotification/HydraNotificationCtaType.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraNotification/HydraNotificationExpandedDetails.d.ts +19 -0
- package/lib/typescript/module/src/models/HydraNotification/HydraNotificationExpandedDetails.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraNotification/HydraNotificationGateway.d.ts +6 -0
- package/lib/typescript/module/src/models/HydraNotification/HydraNotificationGateway.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraPushPreferences.d.ts +10 -0
- package/lib/typescript/module/src/models/HydraPushPreferences.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraUserDetails.d.ts +16 -0
- package/lib/typescript/module/src/models/HydraUserDetails.d.ts.map +1 -0
- package/lib/typescript/module/src/models/HydraVisitorInfo.d.ts +6 -0
- package/lib/typescript/module/src/models/HydraVisitorInfo.d.ts.map +1 -0
- package/lib/typescript/module/src/models/NonHydraNotification.d.ts +9 -0
- package/lib/typescript/module/src/models/NonHydraNotification.d.ts.map +1 -0
- package/lib/typescript/module/src/models/UserState.d.ts +11 -0
- package/lib/typescript/module/src/models/UserState.d.ts.map +1 -0
- package/package.json +225 -0
- package/react-native-hydra-lib.podspec +256 -0
- package/react-native.config.js +33 -0
- package/sbom.spdx.json +544 -0
- package/scripts/HydraPods.rb +151 -0
- package/scripts/generate-sbom.js +367 -0
- package/scripts/hydra-podspecs/HydraCore.podspec +13 -0
- package/scripts/hydra-podspecs/HydraInAppMessage.podspec +15 -0
- package/scripts/hydra-podspecs/HydraInboxCore.podspec +15 -0
- package/scripts/hydra-podspecs/HydraInboxUI.podspec +15 -0
- package/scripts/hydra-podspecs/HydraPushNotification.podspec +14 -0
- package/scripts/hydra-podspecs/HydraPushNotificationServiceExtension.podspec +15 -0
- package/src/GamificationBannerViewNativeComponent.ts +10 -0
- package/src/GamificationEmbedViewNativeComponent.ts +10 -0
- package/src/GamificationLoyaltyViewNativeComponent.ts +10 -0
- package/src/NativeHydraLib.ts +81 -0
- package/src/components/GamificationBannerView.tsx +10 -0
- package/src/components/GamificationEmbedView.tsx +10 -0
- package/src/components/GamificationLoyaltyView.tsx +10 -0
- package/src/hydra-apis/Hydra.ts +52 -0
- package/src/hydra-apis/HydraCore.ts +76 -0
- package/src/hydra-apis/HydraInAppMessaging.ts +25 -0
- package/src/hydra-apis/HydraInbox.ts +33 -0
- package/src/hydra-apis/HydraInboxUI.ts +10 -0
- package/src/hydra-apis/HydraNativeEventEmitter.ts +216 -0
- package/src/hydra-apis/HydraPushNotification.ts +15 -0
- package/src/index.tsx +71 -0
- package/src/models/HydraAccountConfig.ts +45 -0
- package/src/models/HydraFirebaseRemoteConfigKeys.ts +43 -0
- package/src/models/HydraGeoConfig.ts +27 -0
- package/src/models/HydraInAppMessage/HydraInAppButtonComponent.ts +27 -0
- package/src/models/HydraInAppMessage/HydraInAppComponentStyle.ts +24 -0
- package/src/models/HydraInAppMessage/HydraInAppFeedbackSelectionType.ts +35 -0
- package/src/models/HydraInAppMessage/HydraInAppMessage.ts +89 -0
- package/src/models/HydraInAppMessage/HydraInAppTemplateType.ts +57 -0
- package/src/models/HydraInAppMessage/HydraInAppTextComponent.ts +18 -0
- package/src/models/HydraLogLevel.ts +8 -0
- package/src/models/HydraNativeEvent.ts +19 -0
- package/src/models/HydraNotification/HydraNotification.ts +97 -0
- package/src/models/HydraNotification/HydraNotificationBody.ts +23 -0
- package/src/models/HydraNotification/HydraNotificationCta.ts +20 -0
- package/src/models/HydraNotification/HydraNotificationCtaType.ts +59 -0
- package/src/models/HydraNotification/HydraNotificationExpandedDetails.ts +28 -0
- package/src/models/HydraNotification/HydraNotificationGateway.ts +5 -0
- package/src/models/HydraPushPreferences.ts +16 -0
- package/src/models/HydraUserDetails.ts +31 -0
- package/src/models/HydraVisitorInfo.ts +14 -0
- package/src/models/NonHydraNotification.ts +15 -0
- package/src/models/UserState.ts +33 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
|
+
|
|
3
|
+
#import "GamificationEmbedViewComponentView.h"
|
|
4
|
+
|
|
5
|
+
#import "../generated/RNHydraLibSpec/ComponentDescriptors.h"
|
|
6
|
+
#import "../generated/RNHydraLibSpec/EventEmitters.h"
|
|
7
|
+
#import "../generated/RNHydraLibSpec/Props.h"
|
|
8
|
+
#import "../generated/RNHydraLibSpec/RCTComponentViewHelpers.h"
|
|
9
|
+
#import "RCTFabricComponentsPlugins.h"
|
|
10
|
+
#import <React/RCTBridgeModule.h>
|
|
11
|
+
#import <React/RCTComponentViewFactory.h>
|
|
12
|
+
#import <UserNotifications/UserNotifications.h>
|
|
13
|
+
#if __has_include("react_native_hydra_lib-Swift.h")
|
|
14
|
+
#import "react_native_hydra_lib-Swift.h"
|
|
15
|
+
#elif __has_include(<react_native_hydra_lib/react_native_hydra_lib-Swift.h>)
|
|
16
|
+
#import <react_native_hydra_lib/react_native_hydra_lib-Swift.h>
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
using namespace facebook::react;
|
|
20
|
+
|
|
21
|
+
@interface GamificationEmbedViewComponentView () <RCTGamificationEmbedViewViewProtocol>
|
|
22
|
+
@end
|
|
23
|
+
|
|
24
|
+
@implementation GamificationEmbedViewComponentView {
|
|
25
|
+
NSString *_embedId;
|
|
26
|
+
BOOL _needsEmbedView;
|
|
27
|
+
BOOL _retryPending;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
+ (void)load {
|
|
31
|
+
[[RCTComponentViewFactory currentComponentViewFactory] registerComponentViewClass:self];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider {
|
|
35
|
+
return concreteComponentDescriptorProvider<GamificationEmbedViewComponentDescriptor>();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
- (instancetype)initWithFrame:(CGRect)frame {
|
|
39
|
+
if (self = [super initWithFrame:frame]) {
|
|
40
|
+
static const auto defaultProps = std::make_shared<const GamificationEmbedViewProps>();
|
|
41
|
+
_props = defaultProps;
|
|
42
|
+
|
|
43
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
44
|
+
selector:@selector(gamificationDataReloaded)
|
|
45
|
+
name:[[HydraSDKCore shared] getNotificationName]
|
|
46
|
+
object:nil];
|
|
47
|
+
}
|
|
48
|
+
return self;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
- (void)dealloc {
|
|
52
|
+
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
- (void)gamificationDataReloaded {
|
|
56
|
+
// Always dispatch to main: the SDK may post this from a background queue,
|
|
57
|
+
// and createGamificationEmbedView is a UIKit/MainActor call.
|
|
58
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
59
|
+
self->_needsEmbedView = YES;
|
|
60
|
+
[self attachEmbedViewIfPossible];
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
- (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps {
|
|
65
|
+
const auto &newProps = *std::static_pointer_cast<const GamificationEmbedViewProps>(props);
|
|
66
|
+
|
|
67
|
+
const auto defaultProps = GamificationEmbedViewProps();
|
|
68
|
+
const auto &prevProps = oldProps
|
|
69
|
+
? *std::static_pointer_cast<const GamificationEmbedViewProps>(oldProps)
|
|
70
|
+
: defaultProps;
|
|
71
|
+
|
|
72
|
+
BOOL embedIdChanged = prevProps.embedId != newProps.embedId;
|
|
73
|
+
|
|
74
|
+
if (self.contentView == nil || embedIdChanged) {
|
|
75
|
+
_embedId = [NSString stringWithUTF8String:newProps.embedId.c_str()];
|
|
76
|
+
_needsEmbedView = YES;
|
|
77
|
+
[self attachEmbedViewIfPossible];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
[super updateProps:props oldProps:oldProps];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
- (void)layoutSubviews {
|
|
84
|
+
[super layoutSubviews];
|
|
85
|
+
[self attachEmbedViewIfPossible];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
- (void)attachEmbedViewIfPossible {
|
|
89
|
+
if (!_needsEmbedView || _embedId.length == 0) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (CGRectIsEmpty(self.bounds)) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
NSLog(@"[GamificationEmbed] trying createGamificationEmbedView(embedId=%@)", _embedId);
|
|
97
|
+
UIView *embedView = [[HydraSDKCore shared] createGamificationEmbedViewWithEmbedId:_embedId];
|
|
98
|
+
if (embedView) {
|
|
99
|
+
NSLog(@"[GamificationEmbed] embed view created OK");
|
|
100
|
+
self.contentView = embedView;
|
|
101
|
+
_needsEmbedView = NO;
|
|
102
|
+
_retryPending = NO;
|
|
103
|
+
} else {
|
|
104
|
+
NSLog(@"[GamificationEmbed] SDK returned nil — scheduling long fallback");
|
|
105
|
+
// Don't retry aggressively: the SDK may have entry points loaded but
|
|
106
|
+
// reward/program data not yet ready. The HydraGamificationDataReloaded
|
|
107
|
+
// notification fires when everything is ready and will call us again.
|
|
108
|
+
// This 5-second fallback only fires if that notification is missed.
|
|
109
|
+
[self scheduleFallbackRetry];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
- (void)scheduleFallbackRetry {
|
|
114
|
+
if (_retryPending) return;
|
|
115
|
+
_retryPending = YES;
|
|
116
|
+
__weak __typeof__(self) weakSelf = self;
|
|
117
|
+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
118
|
+
__typeof__(self) strongSelf = weakSelf;
|
|
119
|
+
if (!strongSelf) return;
|
|
120
|
+
strongSelf->_retryPending = NO;
|
|
121
|
+
[strongSelf attachEmbedViewIfPossible];
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@end
|
|
126
|
+
|
|
127
|
+
Class<RCTComponentViewProtocol> GamificationEmbedViewCls(void) {
|
|
128
|
+
return GamificationEmbedViewComponentView.class;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
#endif
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
|
+
|
|
3
|
+
#import "GamificationLoyaltyViewComponentView.h"
|
|
4
|
+
|
|
5
|
+
#import "../generated/RNHydraLibSpec/ComponentDescriptors.h"
|
|
6
|
+
#import "../generated/RNHydraLibSpec/EventEmitters.h"
|
|
7
|
+
#import "../generated/RNHydraLibSpec/Props.h"
|
|
8
|
+
#import "../generated/RNHydraLibSpec/RCTComponentViewHelpers.h"
|
|
9
|
+
#import "RCTFabricComponentsPlugins.h"
|
|
10
|
+
#import <React/RCTBridgeModule.h>
|
|
11
|
+
#import <React/RCTComponentViewFactory.h>
|
|
12
|
+
#import <UserNotifications/UserNotifications.h>
|
|
13
|
+
#if __has_include("react_native_hydra_lib-Swift.h")
|
|
14
|
+
#import "react_native_hydra_lib-Swift.h"
|
|
15
|
+
#elif __has_include(<react_native_hydra_lib/react_native_hydra_lib-Swift.h>)
|
|
16
|
+
#import <react_native_hydra_lib/react_native_hydra_lib-Swift.h>
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
using namespace facebook::react;
|
|
20
|
+
|
|
21
|
+
@interface GamificationLoyaltyViewComponentView () <RCTGamificationLoyaltyViewViewProtocol>
|
|
22
|
+
@end
|
|
23
|
+
|
|
24
|
+
@implementation GamificationLoyaltyViewComponentView {
|
|
25
|
+
NSString *_loyaltyId;
|
|
26
|
+
BOOL _needsLoyaltyView;
|
|
27
|
+
BOOL _retryPending;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
+ (void)load {
|
|
31
|
+
[[RCTComponentViewFactory currentComponentViewFactory] registerComponentViewClass:self];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider {
|
|
35
|
+
return concreteComponentDescriptorProvider<GamificationLoyaltyViewComponentDescriptor>();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
- (instancetype)initWithFrame:(CGRect)frame {
|
|
39
|
+
if (self = [super initWithFrame:frame]) {
|
|
40
|
+
static const auto defaultProps = std::make_shared<const GamificationLoyaltyViewProps>();
|
|
41
|
+
_props = defaultProps;
|
|
42
|
+
|
|
43
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
44
|
+
selector:@selector(gamificationDataReloaded)
|
|
45
|
+
name:[[HydraSDKCore shared] getNotificationName]
|
|
46
|
+
object:nil];
|
|
47
|
+
}
|
|
48
|
+
return self;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
- (void)dealloc {
|
|
52
|
+
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
- (void)gamificationDataReloaded {
|
|
56
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
57
|
+
self->_needsLoyaltyView = YES;
|
|
58
|
+
[self attachLoyaltyViewIfPossible];
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
- (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps {
|
|
63
|
+
const auto &newProps = *std::static_pointer_cast<const GamificationLoyaltyViewProps>(props);
|
|
64
|
+
|
|
65
|
+
const auto defaultProps = GamificationLoyaltyViewProps();
|
|
66
|
+
const auto &prevProps = oldProps
|
|
67
|
+
? *std::static_pointer_cast<const GamificationLoyaltyViewProps>(oldProps)
|
|
68
|
+
: defaultProps;
|
|
69
|
+
|
|
70
|
+
if (self.contentView == nil || prevProps.loyaltyId != newProps.loyaltyId) {
|
|
71
|
+
_loyaltyId = [NSString stringWithUTF8String:newProps.loyaltyId.c_str()];
|
|
72
|
+
_needsLoyaltyView = YES;
|
|
73
|
+
[self attachLoyaltyViewIfPossible];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
[super updateProps:props oldProps:oldProps];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
- (void)layoutSubviews {
|
|
80
|
+
[super layoutSubviews];
|
|
81
|
+
[self attachLoyaltyViewIfPossible];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
- (void)attachLoyaltyViewIfPossible {
|
|
85
|
+
if (!_needsLoyaltyView || _loyaltyId.length == 0) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (CGRectIsEmpty(self.bounds)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
UIView *loyaltyView = [[HydraSDKCore shared] createGamificationLoyaltyViewWithLoyaltyId:_loyaltyId];
|
|
93
|
+
if (loyaltyView) {
|
|
94
|
+
self.contentView = loyaltyView;
|
|
95
|
+
_needsLoyaltyView = NO;
|
|
96
|
+
_retryPending = NO;
|
|
97
|
+
} else {
|
|
98
|
+
[self scheduleFallbackRetry];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
- (void)scheduleFallbackRetry {
|
|
103
|
+
if (_retryPending) return;
|
|
104
|
+
_retryPending = YES;
|
|
105
|
+
__weak __typeof__(self) weakSelf = self;
|
|
106
|
+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
107
|
+
__typeof__(self) strongSelf = weakSelf;
|
|
108
|
+
if (!strongSelf) return;
|
|
109
|
+
strongSelf->_retryPending = NO;
|
|
110
|
+
[strongSelf attachLoyaltyViewIfPossible];
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@end
|
|
115
|
+
|
|
116
|
+
Class<RCTComponentViewProtocol> GamificationLoyaltyViewCls(void) {
|
|
117
|
+
return GamificationLoyaltyViewComponentView.class;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
#endif
|
package/ios/HydraLib.h
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#import <React/RCTEventEmitter.h>
|
|
2
|
+
|
|
3
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
4
|
+
#ifdef RN_VERSION_BELOW_76
|
|
5
|
+
#import <RNHydraLibSpec/RNHydraLibSpec.h>
|
|
6
|
+
#else
|
|
7
|
+
#import "generated/RNHydraLibSpec/RNHydraLibSpec.h"
|
|
8
|
+
#endif
|
|
9
|
+
@interface HydraLib : RCTEventEmitter <NativeHydraLibSpec>
|
|
10
|
+
#else
|
|
11
|
+
#import <React/RCTBridgeModule.h>
|
|
12
|
+
|
|
13
|
+
@interface HydraLib : RCTEventEmitter <RCTBridgeModule>
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
@end
|
package/ios/HydraLib.mm
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
#import "HydraLib.h"
|
|
2
|
+
#import <UserNotifications/UserNotifications.h>
|
|
3
|
+
|
|
4
|
+
#if __has_include("react_native_hydra_lib-Swift.h")
|
|
5
|
+
#import "react_native_hydra_lib-Swift.h"
|
|
6
|
+
#elif __has_include(<react_native_hydra_lib/react_native_hydra_lib-Swift.h>)
|
|
7
|
+
#import <react_native_hydra_lib/react_native_hydra_lib-Swift.h>
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
#import "HydraNativeEmitterBrigde.h"
|
|
11
|
+
|
|
12
|
+
@implementation HydraLib
|
|
13
|
+
-(id) init{
|
|
14
|
+
self = [super init];
|
|
15
|
+
[[HydraNativeEmitterBrigde sharedInstance] setHydraLib:self];
|
|
16
|
+
return self;
|
|
17
|
+
}
|
|
18
|
+
+ (BOOL)requiresMainQueueSetup
|
|
19
|
+
{
|
|
20
|
+
return YES; // Return YES if your module needs to be initialized on the main thread
|
|
21
|
+
}
|
|
22
|
+
RCT_EXPORT_MODULE()
|
|
23
|
+
|
|
24
|
+
//===================== HydraCore functions =====================
|
|
25
|
+
RCT_EXPORT_METHOD(setHydraAccountConfig:(nonnull NSDictionary *)hydraAccountConfig resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject ){
|
|
26
|
+
[[HydraSDKCore shared] setHydraAccountConfig:hydraAccountConfig resolve:resolve reject:reject];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
RCT_EXPORT_METHOD(setFirebaseRemoteConfigKeys:(nonnull NSDictionary *)remoteConfigKeys resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject) {
|
|
30
|
+
[[HydraSDKCore shared] setFirebaseRemoteConfigKeys:remoteConfigKeys resolve:resolve reject:reject];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
RCT_EXPORT_METHOD(signIn:(NSDictionary *)userDetails
|
|
34
|
+
customData:(NSDictionary * _Nullable)customData
|
|
35
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
36
|
+
reject:(RCTPromiseRejectBlock)reject){
|
|
37
|
+
[[HydraSDKCore shared] signInUserDetails:userDetails customData:customData resolve:resolve reject:reject];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
RCT_EXPORT_METHOD(signOut:(NSString *)customerId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject){
|
|
41
|
+
[[HydraSDKCore shared] signOutWithCustomerId:customerId resolve:resolve reject:reject];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
RCT_EXPORT_METHOD(signUp:(NSDictionary *)userDetails customData:(NSDictionary * _Nullable)customData resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
45
|
+
[[HydraSDKCore shared] signUpWithUserDetails:userDetails customData:customData resolve:resolve reject:reject];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
RCT_EXPORT_METHOD(updateUser:(NSDictionary *)userDetails customData:(NSDictionary * _Nullable)customData subscriptions:(NSArray * _Nullable)subscriptions resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
49
|
+
[[HydraSDKCore shared] updateWithUserDetails:userDetails customData:customData subscriptions:subscriptions resolve:resolve reject:reject];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
RCT_EXPORT_METHOD(reportUserEvent:(NSString *)eventName attributes:(NSDictionary * _Nullable)attributes resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
53
|
+
[[HydraSDKCore shared] reportUserEventWithEventName:eventName attributes:attributes resolve:resolve reject:reject];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
RCT_EXPORT_METHOD(isSdkInitialized:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
57
|
+
[[HydraSDKCore shared] isSdkInitializedWithResolve:resolve reject:reject];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
RCT_EXPORT_METHOD(getCurrentUserState:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
61
|
+
[[HydraSDKCore shared] getCurrentUserStateWithResolve:resolve reject:reject];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
RCT_EXPORT_METHOD(getVisitorDetails:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
65
|
+
[[HydraSDKCore shared] getVisitorDetailsWithResolve:resolve reject:reject];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
RCT_EXPORT_METHOD(isVisitorFlowEnabled:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
69
|
+
[[HydraSDKCore shared] isVisitorFlowEnabledWithResolve:resolve reject:reject];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
RCT_EXPORT_METHOD(identify:(NSDictionary *)userDetails
|
|
73
|
+
customData:(NSDictionary * _Nullable)customData
|
|
74
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
75
|
+
reject:(RCTPromiseRejectBlock)reject){
|
|
76
|
+
[[HydraSDKCore shared] identifyWithUserDetails:userDetails customData:customData resolve:resolve reject:reject];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
RCT_EXPORT_METHOD(track:(NSString *)eventName attributes:(NSDictionary * _Nullable)attributes resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
80
|
+
[[HydraSDKCore shared] trackWithEventName:eventName attributes:attributes resolve:resolve reject:reject];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
RCT_EXPORT_METHOD(reset:(NSString *)customerId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject){
|
|
84
|
+
[[HydraSDKCore shared] resetWithCustomerId:customerId resolve:resolve reject:reject];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
RCT_EXPORT_METHOD(updateGeoConfig:(NSDictionary *)geoConfig resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
88
|
+
[[HydraSDKCore shared] updateWithGeoConfig:geoConfig resolve:resolve reject:reject];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
RCT_EXPORT_METHOD(updatePushPreferences:(NSString *)customerId preferences:(NSDictionary *)preferences resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
93
|
+
[[HydraSDKCore shared] updateWithPushPreferences:preferences resolve:resolve reject:reject];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
//===================== HydraPushNotification functions =====================
|
|
97
|
+
|
|
98
|
+
RCT_EXPORT_METHOD(openExternalUrl:(NSString *)url resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
99
|
+
[[HydraPushNotification shared] openExternalUrl:url resolve:resolve reject:reject];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
RCT_EXPORT_METHOD(getFCMToken:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
103
|
+
[[HydraPushNotification shared] getFCMToken:resolve reject:reject];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
RCT_EXPORT_METHOD(requestPermission:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
107
|
+
[[HydraPushNotification shared] requestPermission:resolve reject:reject];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
//===================== HydraInboxUI functions
|
|
111
|
+
|
|
112
|
+
RCT_EXPORT_METHOD(showNotificationCenter:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
113
|
+
[[HydraInboxUI shared] showNotificationCenter:resolve reject:reject];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
RCT_EXPORT_METHOD(hideNotificationCenterIfShowing:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
117
|
+
[[HydraInboxUI shared] hideNotificationCenterIfShowing:resolve reject:reject];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
//===================== HydraEventEmitter functions =====================
|
|
121
|
+
|
|
122
|
+
RCT_EXPORT_METHOD(addListener:(NSString *)eventName){
|
|
123
|
+
[super addListener:eventName];
|
|
124
|
+
[[HydraEventEmitter shared] addListenerWithEventName:eventName];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
RCT_EXPORT_METHOD(removeListener:(NSString *)eventName) {
|
|
128
|
+
[[HydraEventEmitter shared] removeListenerWithEventName:eventName];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
RCT_EXPORT_METHOD(removeListeners:(double)count){
|
|
132
|
+
[super removeListeners:count];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
- (NSArray<NSString *> *)supportedEvents {
|
|
136
|
+
return [[HydraNativeEmitterBrigde sharedInstance] supportedEvents];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
//===================== HydraInbox functions =====================
|
|
140
|
+
|
|
141
|
+
RCT_EXPORT_METHOD(deleteAllInboxMessages:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
142
|
+
[[HydraInbox shared] deleteAllInboxMessages:resolve reject:reject];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
RCT_EXPORT_METHOD(deleteInboxMessage:(NSDictionary *)inboxMessage resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
146
|
+
[[HydraInbox shared] deleteInboxMessage:inboxMessage resolve:resolve reject:reject];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
RCT_EXPORT_METHOD(getInboxMessages:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
150
|
+
[[HydraInbox shared] getInboxMessages:resolve reject:reject];
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
RCT_EXPORT_METHOD(getUnreadInboxMessagesCount:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
154
|
+
[[HydraInbox shared] getUnreadInboxMessagesCount:resolve reject:reject];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
RCT_EXPORT_METHOD(markInboxMessageAsRead:(NSDictionary *)inboxMessage resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
|
|
158
|
+
[[HydraInbox shared] markInboxMessageAsRead:inboxMessage resolve:resolve reject:reject];
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
RCT_EXPORT_METHOD(selfHandledInAppResponse:(nonnull NSDictionary *)message handled:(BOOL)handled resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject) {
|
|
162
|
+
[[HydraEventEmitter shared] onSelfHandledInAppResponseWithMessage:message handled:handled resolve: resolve reject: reject];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
RCT_EXPORT_METHOD(reportMessageClicked:(nonnull NSDictionary *)message resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject) {
|
|
166
|
+
[[HydraInAppMessages shared] reportMessageClicked:message resolve:resolve reject:reject];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
RCT_EXPORT_METHOD(reportMessageDismissed:(nonnull NSDictionary *)message resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject) {
|
|
171
|
+
[[HydraInAppMessages shared] reportMessageDismissed:message resolve:resolve reject:reject];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
RCT_EXPORT_METHOD(reportMessageFeedback:(nonnull NSDictionary *)message feedback:(nonnull NSString *)feedback feedbackOptions:(nonnull NSArray *)feedbackOptions resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject) {
|
|
176
|
+
[[HydraInAppMessages shared] reportMessageFeedback:message feedback:feedback feedbackOptions:feedbackOptions resolve:resolve reject:reject];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
RCT_EXPORT_METHOD(reportMessageRating:(nonnull NSDictionary *)message rating:(double)rating resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject) {
|
|
181
|
+
[[HydraInAppMessages shared] reportMessageRating:message rating:rating resolve:resolve reject:reject];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
- (void)gamificationScreenAppeared:(nonnull NSString *)screenName resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
|
|
185
|
+
[[HydraSDKCore shared] gamificationScreenAppeared:screenName resolve:resolve reject:reject];
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
- (void)gamificationScreenDisappeared:(nonnull NSString *)screenName resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
|
|
190
|
+
[[HydraSDKCore shared] gamificationScreenDisappeared:screenName resolve:resolve reject:reject];
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
- (void)setCapToken:(nonnull NSString *)token resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
|
|
194
|
+
[[HydraSDKCore shared] setCapToken:token resolve:resolve reject:reject];
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
200
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
201
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
202
|
+
{
|
|
203
|
+
return std::make_shared<facebook::react::NativeHydraLibSpecJSI>(params);
|
|
204
|
+
}
|
|
205
|
+
#endif
|
|
206
|
+
|
|
207
|
+
@end
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
//
|
|
2
|
+
// HydraInAppMessages.swift
|
|
3
|
+
// react-native-hydra-lib
|
|
4
|
+
//
|
|
5
|
+
// Created by Sandesh Kumar Jain on 01/01/25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import HydraCore
|
|
10
|
+
import HydraInAppMessage
|
|
11
|
+
import React
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@objc public final class HydraInAppMessages : NSObject, HydraSelfHandledInAppMessageDelegate{
|
|
15
|
+
|
|
16
|
+
@objc public static let shared = HydraInAppMessages()
|
|
17
|
+
|
|
18
|
+
private var inAppMessageCore : InAppMessagingCore? = nil
|
|
19
|
+
|
|
20
|
+
private override init(){
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
func initializeInAppMessagingCore(hydraConfig: HydraConfiguration, selfHandlingEnabled: Bool) throws{
|
|
25
|
+
let placeHolderImage: UIImage? = UIImage(named: "inAppPlaceholder")
|
|
26
|
+
if placeHolderImage == nil{
|
|
27
|
+
Logger.info("HydraLib: HydraInAppMessages.initializeInAppMessagingCore: inAppPlaceholder image for InAppMessaging not found in Images.xcassets, the image must be named \"inAppPlaceholder\"")
|
|
28
|
+
}
|
|
29
|
+
let inAppConfig = HydraInAppMessageConfiguration(
|
|
30
|
+
hydraConfig: hydraConfig,
|
|
31
|
+
notificationCore: HydraPushNotification.shared.notificationCore,
|
|
32
|
+
appStoreId: "",
|
|
33
|
+
placeholderImage: placeHolderImage,
|
|
34
|
+
isSelfHandledInAppMessageEnabled: selfHandlingEnabled,
|
|
35
|
+
shouldFallbackToSDKHandlingInAppMessage: true
|
|
36
|
+
)
|
|
37
|
+
inAppMessageCore = try InAppMessagingCore(with: inAppConfig, selfHandledInAppMessageDelegate: self, environment: .dev, applicationState: .active)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public func handleInAppMessage(_ message: HydraInAppMessage.HydraInAppMessagePayload) async -> Bool {
|
|
41
|
+
|
|
42
|
+
Logger.debug(
|
|
43
|
+
"HydraInAppMessages.handleInAppMessage message details - type = \(message.body.type.rawValue), title = \(message.body.title), message = \(message.body.message)"
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
return false
|
|
47
|
+
|
|
48
|
+
// return await withCheckedContinuation { continuation in
|
|
49
|
+
// let callback = EventResponseCallback { result in
|
|
50
|
+
// let handled = result as? Bool ?? false
|
|
51
|
+
// Logger.debug("HydraInAppMessages.handleInAppMessage continuation resume- handled: \(handled)")
|
|
52
|
+
// continuation.resume(returning: handled)
|
|
53
|
+
// }
|
|
54
|
+
//
|
|
55
|
+
// HydraEventEmitter.shared.sendEvent(
|
|
56
|
+
// HydraEventType.ON_HYDRA_IN_APP_MESSAGE.rawValue,
|
|
57
|
+
// body: message.toDict(),
|
|
58
|
+
// callback: callback
|
|
59
|
+
// )
|
|
60
|
+
// }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@objc public func reportMessageClicked(_ message: [String: Any]?, resolve : RCTPromiseResolveBlock?, reject : RCTPromiseRejectBlock?) -> Void{
|
|
64
|
+
if let payload = message?["nativeJsonPayload"] as? [String: Any]{
|
|
65
|
+
Logger.debug("HydraInAppMessages.reportMessageClicked payload = \(payload)")
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@objc public func reportMessageDismissed(_ message: [String: Any]?, resolve : RCTPromiseResolveBlock?, reject : RCTPromiseRejectBlock?) -> Void{
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@objc public func reportMessageRating(_ message: [String: Any]?, rating: Double, resolve : RCTPromiseResolveBlock?, reject : RCTPromiseRejectBlock?) -> Void{
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@objc public func reportMessageFeedback(_ message: [String: Any]?, feedback: String, feedbackOptions: [String], resolve : RCTPromiseResolveBlock?, reject : RCTPromiseRejectBlock?) -> Void{
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Concrete implementation of EventResponse protocol
|
|
83
|
+
private class EventResponseCallback: NSObject, EventResponse {
|
|
84
|
+
private let completion: (Any) -> Void
|
|
85
|
+
|
|
86
|
+
init(completion: @escaping (Any) -> Void) {
|
|
87
|
+
self.completion = completion
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
func onEventResponse(_ response: Any) {
|
|
91
|
+
completion(response)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
//
|
|
2
|
+
// HydraInbox.swift
|
|
3
|
+
// react-native-hydra-lib
|
|
4
|
+
//
|
|
5
|
+
// Created by Sandesh Kumar Jain on 01/01/25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import HydraCore
|
|
10
|
+
import HydraInboxCore
|
|
11
|
+
import React
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@objc public final class HydraInbox : NSObject{
|
|
15
|
+
|
|
16
|
+
@objc public static let shared = HydraInbox()
|
|
17
|
+
|
|
18
|
+
private(set) var inboxCore: InboxCore? = nil
|
|
19
|
+
|
|
20
|
+
private override init(){
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
func initializeInboxCore(hydraConfig: HydraConfiguration, maxNotificationCount: Int? = 200) throws{
|
|
25
|
+
let inboxConfig: InboxCoreConfiguration = InboxCoreConfiguration(hydraConfig: hydraConfig, maximumNotificationCount: maxNotificationCount)
|
|
26
|
+
inboxCore = try InboxCore(with: inboxConfig)
|
|
27
|
+
setHydraInboxUIDelegate()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
func setHydraInboxUIDelegate(){
|
|
31
|
+
inboxCore?.setHydraInboxUIDelegate(delegate: self)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@objc public func getInboxMessages(_ resolve : RCTPromiseResolveBlock?, reject : RCTPromiseRejectBlock? ){
|
|
35
|
+
self.inboxCore?.getNotifications(){
|
|
36
|
+
(rawNotifications) -> Void in
|
|
37
|
+
let notifications = rawNotifications.map{$0.toDict()}
|
|
38
|
+
resolve?(notifications)
|
|
39
|
+
Logger.debug("HydraInbox: getInboxMessages: notifications = \(String(describing: notifications))")
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
fileprivate func updateBadgeCount() {
|
|
45
|
+
self.inboxCore?.getUnreadNotificationCount() { count in
|
|
46
|
+
Hydra.updateBadgeCount(count: count)
|
|
47
|
+
Logger.debug("HydraInbox: updateBadgeCount: count = \(count)")
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@objc public func getUnreadInboxMessagesCount(_ resolve : RCTPromiseResolveBlock?, reject : RCTPromiseRejectBlock? ){
|
|
52
|
+
inboxCore?.getUnreadNotificationCount(){
|
|
53
|
+
(count) -> Void in
|
|
54
|
+
resolve?(count)
|
|
55
|
+
Logger.debug("HydraInbox: getUnreadInboxMessagesCount: count = \(count)")
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@objc public func deleteAllInboxMessages(_ resolve : RCTPromiseResolveBlock?, reject : RCTPromiseRejectBlock? ){
|
|
60
|
+
inboxCore?.handleDeleteAllNotifications(){
|
|
61
|
+
(isDeleted) -> Void in
|
|
62
|
+
if isDeleted {
|
|
63
|
+
self.updateBadgeCount()
|
|
64
|
+
}
|
|
65
|
+
resolve?(isDeleted)
|
|
66
|
+
Logger.debug("HydraInbox: deleteAllInboxMessages: deleted = \(isDeleted)")
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@objc public func deleteInboxMessage(_ inboxMessage: [String: Any] ,resolve : RCTPromiseResolveBlock?, reject : RCTPromiseRejectBlock? ){
|
|
71
|
+
let payload = HydraNotificationPayload.generate(from: inboxMessage)
|
|
72
|
+
inboxCore?.handleNotification(notification: payload, action: .delete){
|
|
73
|
+
(isDeleted) -> Void in
|
|
74
|
+
if isDeleted {
|
|
75
|
+
self.updateBadgeCount()
|
|
76
|
+
}
|
|
77
|
+
resolve?(isDeleted)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@objc public func markInboxMessageAsRead(_ inboxMessage: [String: Any] ,resolve : RCTPromiseResolveBlock?, reject : RCTPromiseRejectBlock? ){
|
|
82
|
+
let payload = HydraNotificationPayload.generate(from: inboxMessage)
|
|
83
|
+
inboxCore?.handleNotification(notification: payload, action: .read){
|
|
84
|
+
(isRead) -> Void in
|
|
85
|
+
if isRead {
|
|
86
|
+
self.updateBadgeCount()
|
|
87
|
+
}
|
|
88
|
+
resolve?(isRead)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
extension HydraInbox : HydraInboxUIProtocol{
|
|
94
|
+
public func refreshNotificationList() {
|
|
95
|
+
HydraEventEmitter.shared.sendEvent(HydraEventType.ON_INBOX_UPDATED.rawValue, body: "")
|
|
96
|
+
}
|
|
97
|
+
}
|