@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,53 @@
|
|
|
1
|
+
package com.hydralib
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.TurboReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
7
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
8
|
+
import com.facebook.react.uimanager.ViewManager
|
|
9
|
+
import com.hydralib.gamification.GamificationBannerViewManager
|
|
10
|
+
import com.hydralib.gamification.GamificationEmbedViewManager
|
|
11
|
+
import com.hydralib.gamification.GamificationLoyaltyViewManager
|
|
12
|
+
import java.util.HashMap
|
|
13
|
+
|
|
14
|
+
class HydraLibPackage : TurboReactPackage() {
|
|
15
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
16
|
+
return if (name == HydraLibModule.NAME) {
|
|
17
|
+
HydraLibModule(reactContext)
|
|
18
|
+
} else {
|
|
19
|
+
null
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
override fun createViewManagers(
|
|
24
|
+
reactContext: ReactApplicationContext
|
|
25
|
+
): List<ViewManager<*, *>> = listOf(
|
|
26
|
+
GamificationBannerViewManager(),
|
|
27
|
+
GamificationEmbedViewManager(),
|
|
28
|
+
GamificationLoyaltyViewManager(),
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
32
|
+
return ReactModuleInfoProvider {
|
|
33
|
+
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
|
|
34
|
+
val isTurboModule: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
|
35
|
+
val name = HydraLibModule.NAME
|
|
36
|
+
val className = HydraLibModule.NAME
|
|
37
|
+
val canOverrideExistingModule = false
|
|
38
|
+
val needsEagerInit = false
|
|
39
|
+
val isCxxModule= false
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
moduleInfos[HydraLibModule.NAME] = ReactModuleInfo(
|
|
43
|
+
name,
|
|
44
|
+
className,
|
|
45
|
+
canOverrideExistingModule,
|
|
46
|
+
needsEagerInit,
|
|
47
|
+
isCxxModule,
|
|
48
|
+
isTurboModule // isTurboModule
|
|
49
|
+
)
|
|
50
|
+
moduleInfos
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
//
|
|
2
|
+
// HydraApplicationDelegate.swift
|
|
3
|
+
// react-native-hydra-lib
|
|
4
|
+
//
|
|
5
|
+
// Created by Sandesh Kumar Jain on 01/01/25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import FirebaseCore
|
|
10
|
+
import FirebaseMessaging
|
|
11
|
+
import FirebaseRemoteConfig
|
|
12
|
+
#if HYDRA_USE_SPM
|
|
13
|
+
// GoogleUtilities has no single SPM product matching the CocoaPods umbrella
|
|
14
|
+
// module - only granular GUL* products exist. The GULAppDelegateSwizzler
|
|
15
|
+
// product wraps a target literally named "GoogleUtilities-AppDelegateSwizzler"
|
|
16
|
+
// (see GoogleUtilities/Package.swift) - Swift mangles the hyphen to an
|
|
17
|
+
// underscore for the actual importable module name, which differs from the
|
|
18
|
+
// product name used for linking.
|
|
19
|
+
import GoogleUtilities_AppDelegateSwizzler
|
|
20
|
+
#else
|
|
21
|
+
import GoogleUtilities
|
|
22
|
+
#endif
|
|
23
|
+
import React
|
|
24
|
+
import HydraCore
|
|
25
|
+
|
|
26
|
+
@objc public final class HydraApplicationDelegate: NSObject, UIApplicationDelegate{
|
|
27
|
+
@objc public static let shared = HydraApplicationDelegate()
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
private override init() {
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
fileprivate func setupNavigationController(_ application: UIApplication) {
|
|
35
|
+
//Create and set NavigationController as rootController, will be required to show NotificationCenter
|
|
36
|
+
let storyboard = UIStoryboard(name: Bundle.main.infoDictionary?["UILaunchStoryboardName"] as? String ?? "LaunchScreen", bundle: nil)
|
|
37
|
+
let viewController = storyboard.instantiateInitialViewController()
|
|
38
|
+
let navigationController = UINavigationController(rootViewController: viewController!)
|
|
39
|
+
let rootController = application.delegate!.window!!.rootViewController!
|
|
40
|
+
|
|
41
|
+
application.delegate?.window??.rootViewController = navigationController
|
|
42
|
+
navigationController.setViewControllers([rootController], animated: true)
|
|
43
|
+
navigationController.delegate = self
|
|
44
|
+
HydraInboxUI.shared.setNavigationController(navController: navigationController)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
fileprivate func setupAppDelegateProxy() {
|
|
48
|
+
var appDelegateProxyEnabled = true
|
|
49
|
+
if let hydraProxyEnabledPlistValue = Bundle.main.infoDictionary?["HydraAppDelegateProxyEnabled"], hydraProxyEnabledPlistValue is Bool{
|
|
50
|
+
appDelegateProxyEnabled = hydraProxyEnabledPlistValue as! Bool
|
|
51
|
+
}
|
|
52
|
+
if appDelegateProxyEnabled{
|
|
53
|
+
if HydraSDKCore.isPushNotificationEnabled(){
|
|
54
|
+
if FirebaseApp.app() == nil{
|
|
55
|
+
FirebaseApp.configure()
|
|
56
|
+
}
|
|
57
|
+
Messaging.messaging().delegate = HydraFirebaseMessagingDelegate.shared
|
|
58
|
+
}
|
|
59
|
+
UNUserNotificationCenter.current().delegate = HydraUNUserNotificationCenterDelegate.shared
|
|
60
|
+
|
|
61
|
+
GULAppDelegateSwizzler.proxyOriginalDelegate()
|
|
62
|
+
GULAppDelegateSwizzler.proxyOriginalDelegateIncludingAPNSMethods()
|
|
63
|
+
GULAppDelegateSwizzler.registerAppDelegateInterceptor(self)
|
|
64
|
+
}
|
|
65
|
+
Logger.info("HydraApplicationDelegate: setupAppDelegateProxy: appDelegateProxyEnabled = \(appDelegateProxyEnabled)")
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@objc public func initApplication(
|
|
69
|
+
_ application: UIApplication,
|
|
70
|
+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?,
|
|
71
|
+
hydraRemoteConfig : HydraNativeRemoteConfig
|
|
72
|
+
){
|
|
73
|
+
//SetUp NavigationController
|
|
74
|
+
setupNavigationController(application)
|
|
75
|
+
|
|
76
|
+
//Use AppDelegate swizzling to get the callbacks inside the library
|
|
77
|
+
setupAppDelegateProxy()
|
|
78
|
+
|
|
79
|
+
application.registerForRemoteNotifications()
|
|
80
|
+
|
|
81
|
+
Task{
|
|
82
|
+
let isInitialized = await initializeUsingPersistedData()
|
|
83
|
+
if !isInitialized{
|
|
84
|
+
Logger.debug("HydraApplicationDelegate: application: didFinishLaunchingWithOptions: initiliazing hydra using passed remote config")
|
|
85
|
+
HydraSDKCore.shared.initializeHydra(hydraRemoteConfig)
|
|
86
|
+
}
|
|
87
|
+
if HydraSDKCore.shared.hydra != nil {
|
|
88
|
+
HydraPushNotification.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
|
|
89
|
+
Logger.info("HydraApplicationDelegate: application: didFinishLaunchingWithOptions: hydraRemoteConfig")
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@objc public func initApplicationWithFirebaseRemoteConfig(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) {
|
|
95
|
+
initApplicationWithFirebaseRemoteConfigKeys(application, didFinishLaunchingWithOptions: launchOptions, firebaseRemoteConfigKeys: HydraNativeFirebaseRemoteConfigKeys(keyForAccountId: "hydra_account_id", keyForBaseUrl: "hydra_base_url", keyForSsl: "hydra_ssl_public_key", keyForRemoteLogLevel: "hydra_remote_log_level", keyForOrgId: "hydra_org_id", keyForGamificationKey: "hydra_gamification_key", keyForGamificationRegion: "hydra_gamification_region", keyForGamificationBaseUrl: "hydra_gamification_base_url"))
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@objc public func initApplicationWithFirebaseRemoteConfigKeys(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?, firebaseRemoteConfigKeys : HydraNativeFirebaseRemoteConfigKeys) {
|
|
99
|
+
//SetUp NavigationController
|
|
100
|
+
setupNavigationController(application)
|
|
101
|
+
|
|
102
|
+
//Use AppDelegate swizzling to get the callbacks inside the library
|
|
103
|
+
setupAppDelegateProxy()
|
|
104
|
+
|
|
105
|
+
application.registerForRemoteNotifications()
|
|
106
|
+
|
|
107
|
+
Task {
|
|
108
|
+
let isInitialized = await initializeUsingPersistedData()
|
|
109
|
+
if !isInitialized {
|
|
110
|
+
Logger.debug("HydraApplicationDelegate: application: didFinishLaunchingWithOptions: remoteConfig: using passed firebase remote config keys")
|
|
111
|
+
await fetchAndActivateRemoteConfigAndInitializeHydra(firebaseRemoteConfigKeys: firebaseRemoteConfigKeys)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if HydraSDKCore.shared.hydra != nil {
|
|
115
|
+
HydraPushNotification.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
|
|
116
|
+
Logger.info("HydraApplicationDelegate: application: didFinishLaunchingWithOptions: remoteConfig: Completed")
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
func loadPresistedHydraRemoteConfig() -> HydraNativeRemoteConfig? {
|
|
122
|
+
let configDict = Hydra.getSharedUserDefaults()?.dictionary(forKey: HydraRNConstants.hydraRemoreConfig)
|
|
123
|
+
if let configDict = configDict{
|
|
124
|
+
return HydraNativeRemoteConfig.fromDictionary(configDict)
|
|
125
|
+
}else{
|
|
126
|
+
return nil
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
func loadPersistedFirebaseRemoteConfigKeys() -> HydraNativeFirebaseRemoteConfigKeys? {
|
|
131
|
+
let configDict = Hydra.getSharedUserDefaults()?.dictionary(forKey: HydraRNConstants.hydraFirebaseRemoteConfigKeys)
|
|
132
|
+
if let configDict = configDict{
|
|
133
|
+
return HydraNativeFirebaseRemoteConfigKeys.fromDictionary(configDict)
|
|
134
|
+
}else{
|
|
135
|
+
return nil
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
private func initializeUsingPersistedData() async -> Bool{
|
|
140
|
+
if let persistedHydraRemoteConfig = loadPresistedHydraRemoteConfig() {
|
|
141
|
+
Logger.debug("HydraApplicationDelegate: initializeUsingPersistedData: Found persisted config, initializing Hydra")
|
|
142
|
+
HydraSDKCore.shared.initializeHydra(persistedHydraRemoteConfig)
|
|
143
|
+
return true
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if let persistedFirebaseRemoteConfigKeys = loadPersistedFirebaseRemoteConfigKeys() {
|
|
147
|
+
Logger.debug("HydraApplicationDelegate: initializeUsingPersistedData: Found persisted firebase config keys, fetching and activating remote config")
|
|
148
|
+
await fetchAndActivateRemoteConfigAndInitializeHydra(firebaseRemoteConfigKeys: persistedFirebaseRemoteConfigKeys)
|
|
149
|
+
return true
|
|
150
|
+
}
|
|
151
|
+
return false
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
private func fetchAndActivateRemoteConfigAndInitializeHydra(firebaseRemoteConfigKeys: HydraNativeFirebaseRemoteConfigKeys)
|
|
155
|
+
async {
|
|
156
|
+
let remoteConfig = RemoteConfig.remoteConfig()
|
|
157
|
+
remoteConfig.configSettings.minimumFetchInterval = 0
|
|
158
|
+
|
|
159
|
+
do {
|
|
160
|
+
try await remoteConfig.fetchAndActivate()
|
|
161
|
+
let hydraRemoteConfig = HydraSDKCore.shared.processFirebaseRemoteConfig(firebaseRemoteConfigKeys)
|
|
162
|
+
|
|
163
|
+
if let hydraRemoteConfig = hydraRemoteConfig {
|
|
164
|
+
HydraSDKCore.shared.initializeHydra(hydraRemoteConfig)
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
Logger.error("HydraApplicationDelegate: fetchAndActivateRemoteConfigAndInitializeHydra accountId or baseUrl or sslPublicKey doesnot have valid values")
|
|
168
|
+
HydraSDKCore.shared.sendHydraSdkInitializationResultEvent(false, "accountId or baseUrl or sslPublicKey doesnot have valid values")
|
|
169
|
+
}
|
|
170
|
+
} catch {
|
|
171
|
+
let errorMessage = "Failed to fetch remote config error = \(error)"
|
|
172
|
+
Logger.error("HydraApplicationDelegate: fetchAndActivateRemoteConfigAndInitializeHydra: \(errorMessage)")
|
|
173
|
+
HydraSDKCore.shared.sendHydraSdkInitializationResultEvent(false, errorMessage)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
public func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
|
|
180
|
+
HydraPushNotification.shared.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
public func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: any Error) {
|
|
184
|
+
HydraPushNotification.shared.application(application, didFailToRegisterForRemoteNotificationsWithError: error)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
public func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
|
|
188
|
+
HydraPushNotification.shared.application(application, didReceiveRemoteNotification: userInfo, fetchCompletionHandler: completionHandler)
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
extension HydraApplicationDelegate: UINavigationControllerDelegate{
|
|
193
|
+
public func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
|
|
194
|
+
HydraInboxUI.shared.navigationControllerViewWillChange(viewController)
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// FirebaseMessagingDelegate.swift
|
|
3
|
+
// react-native-hydra-lib
|
|
4
|
+
//
|
|
5
|
+
// Created by Sandesh Kumar Jain on 24/12/24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import FirebaseMessaging
|
|
10
|
+
final class HydraFirebaseMessagingDelegate : NSObject, MessagingDelegate{
|
|
11
|
+
public static let shared = HydraFirebaseMessagingDelegate()
|
|
12
|
+
|
|
13
|
+
private override init() {
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public func messaging(_ messaging: Messaging, didReceiveRegistrationToken token: String?) {
|
|
18
|
+
HydraPushNotification.shared.messaging(messaging, didReceiveRegistrationToken: token)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// HydraUNUserNotificationCenterDelegate.swift
|
|
3
|
+
// react-native-hydra-lib
|
|
4
|
+
//
|
|
5
|
+
// Created by Sandesh Kumar Jain on 24/12/24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import FirebaseMessaging
|
|
10
|
+
|
|
11
|
+
final class HydraUNUserNotificationCenterDelegate : NSObject, UNUserNotificationCenterDelegate{
|
|
12
|
+
|
|
13
|
+
public static let shared = HydraUNUserNotificationCenterDelegate()
|
|
14
|
+
|
|
15
|
+
private override init() {
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void){
|
|
20
|
+
HydraPushNotification.shared.userNotificationCenter(center, willPresent: notification, withCompletionHandler: completionHandler)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void){
|
|
24
|
+
HydraPushNotification.shared.userNotificationCenter(center, didReceive: response, withCompletionHandler: completionHandler)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
//
|
|
2
|
+
// HydraEventEmitter.swift
|
|
3
|
+
// react-native-hydra-lib
|
|
4
|
+
//
|
|
5
|
+
// Created by Sandesh Kumar Jain on 06/01/25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import HydraCore
|
|
10
|
+
import React
|
|
11
|
+
|
|
12
|
+
// Callback protocol for event completion
|
|
13
|
+
@objc public protocol EventResponse {
|
|
14
|
+
func onEventResponse(_ response: Any)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Struct to hold pending event data
|
|
18
|
+
private struct PendingEvent {
|
|
19
|
+
let body: Any?
|
|
20
|
+
let callback: EventResponse?
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@objc public final class HydraEventEmitter : NSObject{
|
|
24
|
+
|
|
25
|
+
private var activeEventTypes : [String] = []
|
|
26
|
+
private var emitterInitialized : Bool = false
|
|
27
|
+
private var pendingEvents : [String : [PendingEvent]] = [:]
|
|
28
|
+
private var eventsWithPendingCallback: [PendingEvent] = []
|
|
29
|
+
@objc public static let shared = HydraEventEmitter()
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
private override init(){
|
|
33
|
+
super.init()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@objc public func setEmitterInitialized(){
|
|
37
|
+
emitterInitialized = true
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@objc public func sendEvent(_ eventType: String, body: Any?, callback: EventResponse? = nil){
|
|
41
|
+
if emitterInitialized && activeEventTypes.contains(eventType) {
|
|
42
|
+
Logger.info("HydraEventEmitter: sendEvent: eventType = \(eventType), body = \(body ?? "")")
|
|
43
|
+
HydraNativeEmitterBrigde.sharedInstance().sendEvent(withName: eventType, body: body)
|
|
44
|
+
|
|
45
|
+
// Store callback if provided
|
|
46
|
+
if let callback = callback {
|
|
47
|
+
eventsWithPendingCallback.append(PendingEvent(body: body, callback: callback))
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
// Queue event — either emitter not yet initialized, or listener not yet registered
|
|
51
|
+
var pendingEventsForType = pendingEvents[eventType] ?? []
|
|
52
|
+
pendingEventsForType.append(PendingEvent(body: body, callback: callback))
|
|
53
|
+
pendingEvents[eventType] = pendingEventsForType
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@objc public func supportedEvents() -> [String]{
|
|
58
|
+
HydraEventType.allCases.map { $0.rawValue }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private func sendPendingEventsOfType(_ eventType : String){
|
|
62
|
+
pendingEvents[eventType]?.forEach{ pendingEvent in
|
|
63
|
+
sendEvent(eventType, body: pendingEvent.body, callback: pendingEvent.callback)
|
|
64
|
+
}
|
|
65
|
+
pendingEvents[eventType] = nil
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@objc public func addListener(eventName : String) {
|
|
69
|
+
if !activeEventTypes.contains(eventName){
|
|
70
|
+
Logger.debug("HydraEventEmitter: addListener: adding event = \(eventName)")
|
|
71
|
+
activeEventTypes.append(eventName)
|
|
72
|
+
sendPendingEventsOfType(eventName)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@objc public func removeListener(eventName : String) {
|
|
77
|
+
if activeEventTypes.contains(eventName) {
|
|
78
|
+
Logger.debug("HydraEventEmitter: removeListener: removing event = \(eventName)")
|
|
79
|
+
activeEventTypes.removeAll(where: {$0 == eventName})
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@objc public func onSelfHandledInAppResponse(message: [String: Any]?, handled: Bool, resolve : RCTPromiseResolveBlock?, reject : RCTPromiseRejectBlock?) -> Void{
|
|
84
|
+
Logger.info("HydraEventEmitter: onSelfHandledInAppResponse: message details - type = \(message?["templateType"] ?? ""), title = \(message?["title"] ?? ""), message = \(message?["message"] ?? "")")
|
|
85
|
+
|
|
86
|
+
let scope = message?["scope"] as? String ?? "default"
|
|
87
|
+
|
|
88
|
+
// Find and execute callback for matching scope
|
|
89
|
+
for (index, event) in eventsWithPendingCallback.enumerated() {
|
|
90
|
+
if let eventBody = event.body as? [String: Any], eventBody["scope"] as? String == scope {
|
|
91
|
+
event.callback?.onEventResponse(handled)
|
|
92
|
+
eventsWithPendingCallback.remove(at: index)
|
|
93
|
+
break
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
resolve?(true)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//
|
|
2
|
+
// HydraEventType.swift
|
|
3
|
+
// react-native-hydra-lib
|
|
4
|
+
//
|
|
5
|
+
// Created by Sandesh Kumar Jain on 06/01/25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
enum HydraEventType : String, CaseIterable{
|
|
11
|
+
case ON_TOKEN_AVAILABLE = "onTokenAvailable"
|
|
12
|
+
case ON_NON_HYDRA_NOTIFICATION_RECEIVED = "onNonHydraNotificationReceived"
|
|
13
|
+
case ON_NON_HYDRA_NOTIFICATION_CLICKED = "onNonHydraNotificationClicked"
|
|
14
|
+
case ON_HYDRA_NOTIFICATION_RECEIVED = "onHydraNotificationReceived"
|
|
15
|
+
case ON_HYDRA_NOTIFICATION_CLICKED = "onHydraNotificationClicked"
|
|
16
|
+
case ON_HYDRA_NOTIFICATION_SHOWN = "onHydraNotificationShown"
|
|
17
|
+
case ON_HYDRA_NOTIFICATION_DISMISSED = "onHydraNotificationDismissed"
|
|
18
|
+
case ON_INBOX_UPDATED = "onInboxUpdated"
|
|
19
|
+
case ON_NOTIFICATION_CENTER_DISMISSED = "onNotificationCenterDismissed"
|
|
20
|
+
case ON_NOTIFICATION_CENTER_SHOWN = "onNotificationCenterShown"
|
|
21
|
+
case ON_HYDRA_SDK_INITIALIZATION_RESULT = "onHydraSdkInitializationResult"
|
|
22
|
+
case ON_HYDRA_IN_APP_MESSAGE = "onHydraInAppMessage"
|
|
23
|
+
case ON_CONFIG_FETCHED_CALLBACK = "onConfigFetchedCallback"
|
|
24
|
+
case ON_LEGACY_FLOW_READY = "onLegacyFlowReady"
|
|
25
|
+
case ON_VISITOR_SESSION_READY = "onVisitorSessionReady"
|
|
26
|
+
case ON_USER_STATE_CHANGED = "onUserStateChanged"
|
|
27
|
+
case ON_GAMIFICATION_VIEW_HEIGHT_CHANGED = "onGamificationViewHeightChanged"
|
|
28
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//
|
|
2
|
+
// HydraNativeEmitterBrigde.h
|
|
3
|
+
// react-native-hydra-lib
|
|
4
|
+
//
|
|
5
|
+
// Created by Sandesh Kumar Jain on 06/01/25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
|
|
10
|
+
@interface HydraNativeEmitterBrigde : NSObject
|
|
11
|
+
+ (instancetype)sharedInstance;
|
|
12
|
+
-(void)setHydraLib:(id)hydraLibIns;
|
|
13
|
+
- (NSArray<NSString *> *)supportedEvents;
|
|
14
|
+
- (void)sendEventWithName:(NSString *)eventName body:(id)body;
|
|
15
|
+
@end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//
|
|
2
|
+
// HydraNativeEmitterBrigde.m
|
|
3
|
+
// react-native-hydra-lib
|
|
4
|
+
//
|
|
5
|
+
// Created by Sandesh Kumar Jain on 06/01/25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import "HydraNativeEmitterBrigde.h"
|
|
9
|
+
#import <React/RCTBridgeModule.h>
|
|
10
|
+
#import <UserNotifications/UserNotifications.h>
|
|
11
|
+
|
|
12
|
+
#if __has_include("react_native_hydra_lib-Swift.h")
|
|
13
|
+
#import "react_native_hydra_lib-Swift.h"
|
|
14
|
+
#elif __has_include(<react_native_hydra_lib/react_native_hydra_lib-Swift.h>)
|
|
15
|
+
#import <react_native_hydra_lib/react_native_hydra_lib-Swift.h>
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
#import "HydraLib.h"
|
|
19
|
+
|
|
20
|
+
@implementation HydraNativeEmitterBrigde
|
|
21
|
+
|
|
22
|
+
HydraLib* hydraLib;
|
|
23
|
+
|
|
24
|
+
+ (instancetype)sharedInstance {
|
|
25
|
+
static HydraNativeEmitterBrigde *shared = nil;
|
|
26
|
+
static dispatch_once_t onceToken;
|
|
27
|
+
dispatch_once(&onceToken, ^{
|
|
28
|
+
shared = [[self alloc] init];
|
|
29
|
+
});
|
|
30
|
+
return shared;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
-(void)setHydraLib:(id)hydraLibIns{
|
|
34
|
+
if(hydraLibIns != nil){
|
|
35
|
+
NSAssert([hydraLibIns isKindOfClass:[HydraLib class]], @"hydraLibIns %@ is not kind of class %@", hydraLibIns, NSStringFromClass([HydraLib class]));
|
|
36
|
+
}
|
|
37
|
+
hydraLib = hydraLibIns;
|
|
38
|
+
[[HydraEventEmitter shared] setEmitterInitialized];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
- (void)sendEventWithName:(NSString *)eventName body:(id)body;{
|
|
42
|
+
[hydraLib sendEventWithName:eventName body:body];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
- (NSArray<NSString *> *)supportedEvents {
|
|
46
|
+
return [[HydraEventEmitter shared] supportedEvents];
|
|
47
|
+
}
|
|
48
|
+
@end
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
|
+
|
|
3
|
+
#import "GamificationBannerViewComponentView.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 GamificationBannerViewComponentView () <RCTGamificationBannerViewViewProtocol>
|
|
22
|
+
@end
|
|
23
|
+
|
|
24
|
+
@implementation GamificationBannerViewComponentView {
|
|
25
|
+
NSString *_bannerId;
|
|
26
|
+
BOOL _needsBannerView;
|
|
27
|
+
BOOL _retryPending;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
+ (void)load {
|
|
31
|
+
[[RCTComponentViewFactory currentComponentViewFactory] registerComponentViewClass:self];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider {
|
|
35
|
+
return concreteComponentDescriptorProvider<GamificationBannerViewComponentDescriptor>();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
- (instancetype)initWithFrame:(CGRect)frame {
|
|
39
|
+
if (self = [super initWithFrame:frame]) {
|
|
40
|
+
static const auto defaultProps = std::make_shared<const GamificationBannerViewProps>();
|
|
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->_needsBannerView = YES;
|
|
58
|
+
[self attachBannerViewIfPossible];
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
- (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps {
|
|
63
|
+
const auto &newProps = *std::static_pointer_cast<const GamificationBannerViewProps>(props);
|
|
64
|
+
|
|
65
|
+
const auto defaultProps = GamificationBannerViewProps();
|
|
66
|
+
const auto &prevProps = oldProps
|
|
67
|
+
? *std::static_pointer_cast<const GamificationBannerViewProps>(oldProps)
|
|
68
|
+
: defaultProps;
|
|
69
|
+
|
|
70
|
+
BOOL bannerIdChanged = prevProps.bannerId != newProps.bannerId;
|
|
71
|
+
|
|
72
|
+
if (self.contentView == nil || bannerIdChanged) {
|
|
73
|
+
_bannerId = [NSString stringWithUTF8String:newProps.bannerId.c_str()];
|
|
74
|
+
_needsBannerView = YES;
|
|
75
|
+
[self attachBannerViewIfPossible];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
[super updateProps:props oldProps:oldProps];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
- (void)layoutSubviews {
|
|
82
|
+
[super layoutSubviews];
|
|
83
|
+
[self attachBannerViewIfPossible];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
- (void)attachBannerViewIfPossible {
|
|
87
|
+
if (!_needsBannerView || _bannerId.length == 0) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (CGRectIsEmpty(self.bounds)) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
NSLog(@"[GamificationBanner] trying createGamificationBannerView(bannerId=%@)", _bannerId);
|
|
95
|
+
UIView *bannerView = [[HydraSDKCore shared] createGamificationBannerViewWithBannerId:_bannerId];
|
|
96
|
+
if (bannerView) {
|
|
97
|
+
NSLog(@"[GamificationBanner] banner view created OK");
|
|
98
|
+
self.contentView = bannerView;
|
|
99
|
+
_needsBannerView = NO;
|
|
100
|
+
_retryPending = NO;
|
|
101
|
+
} else {
|
|
102
|
+
NSLog(@"[GamificationBanner] SDK returned nil — scheduling long fallback");
|
|
103
|
+
[self scheduleFallbackRetry];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
- (void)scheduleFallbackRetry {
|
|
108
|
+
if (_retryPending) return;
|
|
109
|
+
_retryPending = YES;
|
|
110
|
+
__weak __typeof__(self) weakSelf = self;
|
|
111
|
+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
112
|
+
__typeof__(self) strongSelf = weakSelf;
|
|
113
|
+
if (!strongSelf) return;
|
|
114
|
+
strongSelf->_retryPending = NO;
|
|
115
|
+
[strongSelf attachBannerViewIfPossible];
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@end
|
|
120
|
+
|
|
121
|
+
Class<RCTComponentViewProtocol> GamificationBannerViewCls(void) {
|
|
122
|
+
return GamificationBannerViewComponentView.class;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
#endif
|