@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,43 @@
|
|
|
1
|
+
package com.hydralib.delegates
|
|
2
|
+
|
|
3
|
+
import android.os.Bundle
|
|
4
|
+
import androidx.annotation.RestrictTo
|
|
5
|
+
import androidx.appcompat.app.AppCompatActivity
|
|
6
|
+
import com.capillary.hydra.android.sdk.utils.Logger
|
|
7
|
+
import com.google.gson.Gson
|
|
8
|
+
import com.google.gson.reflect.TypeToken
|
|
9
|
+
import com.hydralib.eventemitter.HydraEventEmitter
|
|
10
|
+
import com.hydralib.eventemitter.HydraEventType
|
|
11
|
+
|
|
12
|
+
class NonHydraNotificationActivity : AppCompatActivity() {
|
|
13
|
+
|
|
14
|
+
companion object Companion {
|
|
15
|
+
private const val TAG = "NonHydraNotificationActivity"
|
|
16
|
+
|
|
17
|
+
@RestrictTo(RestrictTo.Scope.LIBRARY)
|
|
18
|
+
const val EXTRA_REMOTE_MESSAGE = "remote_message"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
22
|
+
super.onCreate(savedInstanceState)
|
|
23
|
+
|
|
24
|
+
Logger.d(TAG, "NonHydraNotificationActivity created")
|
|
25
|
+
|
|
26
|
+
// Extract notification data from intent
|
|
27
|
+
val remoteMessage = intent.getStringExtra(EXTRA_REMOTE_MESSAGE)
|
|
28
|
+
|
|
29
|
+
Logger.d(TAG, "Remote Message: $remoteMessage")
|
|
30
|
+
val gson = Gson()
|
|
31
|
+
val type = object : TypeToken<Map<String, Any>>() {}.type
|
|
32
|
+
val remoteMessageMap = gson.fromJson<Map<String, Any>>(remoteMessage, type)
|
|
33
|
+
|
|
34
|
+
// Emit event to React Native
|
|
35
|
+
HydraEventEmitter.sendEvent(
|
|
36
|
+
HydraEventType.ON_NON_HYDRA_NOTIFICATION_CLICKED,
|
|
37
|
+
remoteMessageMap
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
Logger.d(TAG, "Event emitted to React Native: ON_NON_HYDRA_NOTIFICATION_CLICKED")
|
|
41
|
+
finish()
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
package com.hydralib.eventemitter
|
|
2
|
+
|
|
3
|
+
import android.os.Handler
|
|
4
|
+
import android.os.Looper
|
|
5
|
+
import com.capillary.hydra.android.sdk.utils.Logger
|
|
6
|
+
import com.facebook.react.bridge.Arguments
|
|
7
|
+
import com.facebook.react.bridge.Promise
|
|
8
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
9
|
+
import com.facebook.react.bridge.ReadableMap
|
|
10
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// Callback interface for event completion
|
|
14
|
+
fun interface EventResponse {
|
|
15
|
+
fun onEventResponse(response: Any)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
private data class PendingEvent(
|
|
19
|
+
val body: Any?,
|
|
20
|
+
val callback: EventResponse?
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
object HydraEventEmitter {
|
|
24
|
+
private var emitter: RCTDeviceEventEmitter? = null
|
|
25
|
+
private val activeEventTypes: ArrayList<HydraEventType> = ArrayList()
|
|
26
|
+
private val pendingEvents = mutableMapOf<HydraEventType, MutableList<PendingEvent>>()
|
|
27
|
+
private val eventsWithPendingCallback: ArrayList<PendingEvent> = ArrayList()
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
fun initialize(reactContext: ReactApplicationContext) {
|
|
31
|
+
emitter = reactContext.getJSModule(RCTDeviceEventEmitter::class.java)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@Synchronized
|
|
35
|
+
fun sendEvent(eventType: HydraEventType, body: Any?, callback: EventResponse? = null) {
|
|
36
|
+
if (emitter == null) {
|
|
37
|
+
var pendingEventsForType: MutableList<PendingEvent>? = pendingEvents[eventType]
|
|
38
|
+
if (pendingEventsForType == null) {
|
|
39
|
+
pendingEventsForType = mutableListOf()
|
|
40
|
+
}
|
|
41
|
+
pendingEventsForType.add(PendingEvent(body, callback))
|
|
42
|
+
pendingEvents[eventType] = pendingEventsForType
|
|
43
|
+
|
|
44
|
+
Logger.d("HydraEventEmitter.sendEvent", "eventsList for type = ${pendingEvents[eventType]?.toList()}")
|
|
45
|
+
} else {
|
|
46
|
+
if (activeEventTypes.contains(eventType)) {
|
|
47
|
+
Logger.d(
|
|
48
|
+
"HydraEventEmitter.sendEvent",
|
|
49
|
+
"sending event for type = ${eventType.event}\n body = $body"
|
|
50
|
+
)
|
|
51
|
+
Logger.d("HydraEventEmitter.sendEvent", "java classname of body = ${body?.javaClass?.name}")
|
|
52
|
+
val processedBody = if (body is Map<*, *>) Arguments.makeNativeMap(
|
|
53
|
+
convertMapToMutable(body)
|
|
54
|
+
) else body
|
|
55
|
+
|
|
56
|
+
emitter?.emit(
|
|
57
|
+
eventType.event,
|
|
58
|
+
processedBody
|
|
59
|
+
)
|
|
60
|
+
if(callback != null) {
|
|
61
|
+
eventsWithPendingCallback.add(PendingEvent(body, callback))
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@Synchronized
|
|
68
|
+
private fun sendPendingEventOfType(eventType: HydraEventType) {
|
|
69
|
+
Logger.d(
|
|
70
|
+
"HydraEventEmitter.sendPendingEventOfType",
|
|
71
|
+
"sendPendingEventOfType called for eventType = ${eventType.event}"
|
|
72
|
+
)
|
|
73
|
+
pendingEvents[eventType]?.forEach {
|
|
74
|
+
sendEvent(eventType, it.body, it.callback)
|
|
75
|
+
}
|
|
76
|
+
pendingEvents.remove(eventType)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@Synchronized
|
|
80
|
+
fun addListener(eventName: String?) {
|
|
81
|
+
Logger.d(
|
|
82
|
+
"HydraEventEmitter.addListener",
|
|
83
|
+
"addListener called for eventName = $eventName"
|
|
84
|
+
)
|
|
85
|
+
val eventType = HydraEventType.from(eventName!!)
|
|
86
|
+
if (!activeEventTypes.contains(eventType!!)) {
|
|
87
|
+
Logger.d(
|
|
88
|
+
"HydraEventEmitter.addListener",
|
|
89
|
+
"adding event for eventName = $eventName"
|
|
90
|
+
)
|
|
91
|
+
activeEventTypes.add(eventType)
|
|
92
|
+
|
|
93
|
+
Logger.d(
|
|
94
|
+
"HydraEventEmitter.addListener",
|
|
95
|
+
"sending pending events for eventType = ${eventType.event}"
|
|
96
|
+
)
|
|
97
|
+
Handler(Looper.getMainLooper()).postDelayed({
|
|
98
|
+
sendPendingEventOfType(eventType)
|
|
99
|
+
}, 300)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@Synchronized
|
|
104
|
+
fun removeListener(eventName: String?) {
|
|
105
|
+
Logger.d(
|
|
106
|
+
"HydraEventEmitter.removeListener",
|
|
107
|
+
"removeListener called for eventName = $eventName"
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
if (activeEventTypes.contains(HydraEventType.from(eventName!!))) {
|
|
111
|
+
Logger.d(
|
|
112
|
+
"HydraEventEmitter.removeListener",
|
|
113
|
+
"removing event for eventName = $eventName"
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
activeEventTypes.remove(HydraEventType.from(eventName)!!)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
private fun convertMapToMutable(originalMap: Map<*, *>): Map<String, Any> {
|
|
121
|
+
val resultMap = mutableMapOf<String, Any>()
|
|
122
|
+
originalMap.forEach {
|
|
123
|
+
if (it.key is String && it.value != null) {
|
|
124
|
+
resultMap[it.key as String] = it.value!!
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return resultMap
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@Synchronized
|
|
131
|
+
fun onSelfHandledInAppResponse(
|
|
132
|
+
message: ReadableMap?,
|
|
133
|
+
handled: Boolean,
|
|
134
|
+
promise: Promise?
|
|
135
|
+
) {
|
|
136
|
+
Logger.d(
|
|
137
|
+
"HydraEventEmitter.onSelfHandledInAppResponse",
|
|
138
|
+
"message details - type = $message"
|
|
139
|
+
)
|
|
140
|
+
val scope = if (message?.getString("scope") is String) message.getString("scope") as String else "default"
|
|
141
|
+
for (event in eventsWithPendingCallback) {
|
|
142
|
+
if (event.body is Map<*, *> && (event.body as Map<*, *>)["scope"] == scope) {
|
|
143
|
+
event.callback!!.onEventResponse(handled)
|
|
144
|
+
break
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
promise?.resolve(true)
|
|
148
|
+
// sendEvent(HydraEventType.ON_HYDRA_IN_APP_MESSAGE, detailMap, callback)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
package com.hydralib.eventemitter
|
|
2
|
+
|
|
3
|
+
enum class HydraEventType(val event: String) {
|
|
4
|
+
ON_TOKEN_AVAILABLE("onTokenAvailable"),
|
|
5
|
+
ON_NON_HYDRA_NOTIFICATION_RECEIVED("onNonHydraNotificationReceived"),
|
|
6
|
+
ON_NON_HYDRA_NOTIFICATION_CLICKED("onNonHydraNotificationClicked"),
|
|
7
|
+
ON_HYDRA_NOTIFICATION_RECEIVED("onHydraNotificationReceived"),
|
|
8
|
+
ON_HYDRA_NOTIFICATION_CLICKED("onHydraNotificationClicked"),
|
|
9
|
+
ON_HYDRA_NOTIFICATION_SHOWN("onHydraNotificationShown"),
|
|
10
|
+
ON_HYDRA_NOTIFICATION_DISMISSED("onHydraNotificationDismissed"),
|
|
11
|
+
ON_NOTIFICATION_CENTER_DISMISSED("onNotificationCenterDismissed"),
|
|
12
|
+
ON_INBOX_UPDATED("onInboxUpdated"),
|
|
13
|
+
HANDLE_CUSTOM_ACTION("handleCustomAction"),
|
|
14
|
+
ON_HYDRA_SDK_INITIALIZATION_RESULT("onHydraSdkInitializationResult"),
|
|
15
|
+
ON_HYDRA_IN_APP_MESSAGE("onHydraInAppMessage"),
|
|
16
|
+
ON_CONFIG_FETCHED_CALLBACK("onConfigFetchedCallback"),
|
|
17
|
+
ON_LEGACY_FLOW_READY("onLegacyFlowReady"),
|
|
18
|
+
ON_VISITOR_SESSION_READY("onVisitorSessionReady"),
|
|
19
|
+
ON_USER_STATE_CHANGED("onUserStateChanged"),
|
|
20
|
+
ON_GAMIFICATION_VIEW_HEIGHT_CHANGED("onGamificationViewHeightChanged");
|
|
21
|
+
|
|
22
|
+
companion object {
|
|
23
|
+
fun from(eventName: String?): HydraEventType? = when (eventName) {
|
|
24
|
+
ON_TOKEN_AVAILABLE.event -> ON_TOKEN_AVAILABLE
|
|
25
|
+
ON_NON_HYDRA_NOTIFICATION_RECEIVED.event -> ON_NON_HYDRA_NOTIFICATION_RECEIVED
|
|
26
|
+
ON_NON_HYDRA_NOTIFICATION_CLICKED.event -> ON_NON_HYDRA_NOTIFICATION_CLICKED
|
|
27
|
+
ON_HYDRA_NOTIFICATION_RECEIVED.event -> ON_HYDRA_NOTIFICATION_RECEIVED
|
|
28
|
+
ON_HYDRA_NOTIFICATION_CLICKED.event -> ON_HYDRA_NOTIFICATION_CLICKED
|
|
29
|
+
ON_HYDRA_NOTIFICATION_SHOWN.event -> ON_HYDRA_NOTIFICATION_SHOWN
|
|
30
|
+
ON_HYDRA_NOTIFICATION_DISMISSED.event -> ON_HYDRA_NOTIFICATION_DISMISSED
|
|
31
|
+
ON_NOTIFICATION_CENTER_DISMISSED.event -> ON_NOTIFICATION_CENTER_DISMISSED
|
|
32
|
+
ON_INBOX_UPDATED.event -> ON_INBOX_UPDATED
|
|
33
|
+
HANDLE_CUSTOM_ACTION.event -> HANDLE_CUSTOM_ACTION
|
|
34
|
+
ON_HYDRA_SDK_INITIALIZATION_RESULT.event -> ON_HYDRA_SDK_INITIALIZATION_RESULT
|
|
35
|
+
ON_HYDRA_IN_APP_MESSAGE.event -> ON_HYDRA_IN_APP_MESSAGE
|
|
36
|
+
ON_CONFIG_FETCHED_CALLBACK.event -> ON_CONFIG_FETCHED_CALLBACK
|
|
37
|
+
ON_LEGACY_FLOW_READY.event -> ON_LEGACY_FLOW_READY
|
|
38
|
+
ON_VISITOR_SESSION_READY.event -> ON_VISITOR_SESSION_READY
|
|
39
|
+
ON_USER_STATE_CHANGED.event -> ON_USER_STATE_CHANGED
|
|
40
|
+
ON_GAMIFICATION_VIEW_HEIGHT_CHANGED.event -> ON_GAMIFICATION_VIEW_HEIGHT_CHANGED
|
|
41
|
+
else -> throw IllegalArgumentException()
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
package com.hydralib.gamification
|
|
2
|
+
|
|
3
|
+
import android.view.View
|
|
4
|
+
import com.capillary.hydra.gamification.model.ContentItem
|
|
5
|
+
import com.capillary.hydra.gamification.model.EntryPointData
|
|
6
|
+
import com.capillary.hydra.gamification.ui.GamificationUIManager
|
|
7
|
+
import com.capillary.hydra.gamification.ui.entrypoints.BannerView
|
|
8
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
9
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
10
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
11
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
12
|
+
import com.hydralib.eventemitter.HydraEventEmitter
|
|
13
|
+
import com.hydralib.eventemitter.HydraEventType
|
|
14
|
+
import com.hydralib.hydrasdk.HydraCore
|
|
15
|
+
|
|
16
|
+
@ReactModule(name = GamificationBannerViewManager.NAME)
|
|
17
|
+
class GamificationBannerViewManager : SimpleViewManager<BannerView>() {
|
|
18
|
+
|
|
19
|
+
override fun getName(): String = NAME
|
|
20
|
+
|
|
21
|
+
override fun createViewInstance(context: ThemedReactContext): BannerView =
|
|
22
|
+
BannerView(HydraCore.curReactActivity ?: context)
|
|
23
|
+
|
|
24
|
+
@ReactProp(name = "bannerId")
|
|
25
|
+
fun setBannerId(view: BannerView, bannerId: String?) {
|
|
26
|
+
if (bannerId.isNullOrEmpty()) return
|
|
27
|
+
val data = findEntryPointByBannerId(bannerId) ?: return
|
|
28
|
+
|
|
29
|
+
// Defer bind until Yoga has measured and laid out the view
|
|
30
|
+
if (view.width > 0 && view.height > 0) {
|
|
31
|
+
bindWithLayout(view, data, bannerId)
|
|
32
|
+
} else {
|
|
33
|
+
view.addOnLayoutChangeListener(object : View.OnLayoutChangeListener {
|
|
34
|
+
override fun onLayoutChange(
|
|
35
|
+
v: View, left: Int, top: Int, right: Int, bottom: Int,
|
|
36
|
+
oldLeft: Int, oldTop: Int, oldRight: Int, oldBottom: Int
|
|
37
|
+
) {
|
|
38
|
+
if (right - left > 0 && bottom - top > 0) {
|
|
39
|
+
view.removeOnLayoutChangeListener(this)
|
|
40
|
+
bindWithLayout(view, data, bannerId)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Wire callbacks, let BannerView calculate height from dashboard config,
|
|
49
|
+
* then force a measure/layout pass with the SDK-computed dimensions.
|
|
50
|
+
*
|
|
51
|
+
* Height strategy:
|
|
52
|
+
* - Set layoutParams.height = 0 so BannerView enters SDK-managed path
|
|
53
|
+
* and uses dashboard container.height (direct dp value)
|
|
54
|
+
* - After bind(), BannerView updates layoutParams.height to the computed value
|
|
55
|
+
* - We read that back, force measure/layout, and emit to RN
|
|
56
|
+
*/
|
|
57
|
+
private fun bindWithLayout(view: BannerView, data: EntryPointData, bannerId: String) {
|
|
58
|
+
val w = view.width
|
|
59
|
+
val activity = HydraCore.curReactActivity
|
|
60
|
+
|
|
61
|
+
// Set height to 0 so BannerView.bind() enters SDK-managed path
|
|
62
|
+
// and calculates height from dashboard container.height (dp)
|
|
63
|
+
view.layoutParams?.let { lp ->
|
|
64
|
+
lp.width = w
|
|
65
|
+
lp.height = 0
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Campaign banner lookup — resolves campaignId → CampaignBanner
|
|
69
|
+
// Required for DYNAMIC_MULTISTEP entry points
|
|
70
|
+
view.campaignBannerLookup = { campaignId ->
|
|
71
|
+
HydraCore.getFlowManager()?.getCampaignBanner(campaignId)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Notify server that the entry point was shown
|
|
75
|
+
view.onEntryPointLoad = { ep ->
|
|
76
|
+
HydraCore.getFlowManager()?.onEntryPointShown(ep.id, "BANNER")
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Handle click — delegates to GamificationUIManager for action routing
|
|
80
|
+
// (OPEN_DEEPLINK, OPEN_WALLET, OPEN_WEBLINK, campaign opening)
|
|
81
|
+
view.onEntryPointClick = { ep, contentItem ->
|
|
82
|
+
if (activity != null) {
|
|
83
|
+
HydraCore.getGamificationUIManager()?.handleEntryPointAction(activity, ep, contentItem)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
view.bind(data)
|
|
88
|
+
|
|
89
|
+
// After bind(), BannerView has computed the height from dashboard config
|
|
90
|
+
// and updated layoutParams.height. Read it back.
|
|
91
|
+
val sdkHeight = view.layoutParams?.height ?: 0
|
|
92
|
+
val finalHeight = if (sdkHeight > 0) sdkHeight else view.height
|
|
93
|
+
|
|
94
|
+
// Force measure/layout with SDK-computed dimensions — RN parent swallows
|
|
95
|
+
// requestLayout() so BannerView's internal views never get measured otherwise
|
|
96
|
+
view.measure(
|
|
97
|
+
View.MeasureSpec.makeMeasureSpec(w, View.MeasureSpec.EXACTLY),
|
|
98
|
+
View.MeasureSpec.makeMeasureSpec(finalHeight, View.MeasureSpec.EXACTLY)
|
|
99
|
+
)
|
|
100
|
+
view.layout(view.left, view.top, view.left + w, view.top + finalHeight)
|
|
101
|
+
|
|
102
|
+
// Emit the SDK-computed height to RN so JS side can update its style
|
|
103
|
+
if (finalHeight > 0) {
|
|
104
|
+
val heightDp = finalHeight / view.resources.displayMetrics.density
|
|
105
|
+
HydraEventEmitter.sendEvent(
|
|
106
|
+
HydraEventType.ON_GAMIFICATION_VIEW_HEIGHT_CHANGED,
|
|
107
|
+
mapOf("height" to heightDp, "entryPointId" to bannerId)
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
private fun findEntryPointByBannerId(bannerId: String): EntryPointData? {
|
|
113
|
+
val flowManager = HydraCore.getFlowManager() ?: return null
|
|
114
|
+
val entryPoints = flowManager.getFilteredEntryPoints(null)
|
|
115
|
+
return entryPoints.find { it.mobile?.container?.bannerId == bannerId }
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
companion object {
|
|
119
|
+
const val NAME = "GamificationBannerView"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
package com.hydralib.gamification
|
|
2
|
+
|
|
3
|
+
import android.view.View
|
|
4
|
+
import android.view.ViewTreeObserver
|
|
5
|
+
import com.capillary.hydra.gamification.model.EntryPointData
|
|
6
|
+
import com.capillary.hydra.gamification.ui.entrypoints.EmbedWebView
|
|
7
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
8
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
9
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
10
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
11
|
+
import com.hydralib.eventemitter.HydraEventEmitter
|
|
12
|
+
import com.hydralib.eventemitter.HydraEventType
|
|
13
|
+
import com.hydralib.hydrasdk.HydraCore
|
|
14
|
+
import kotlinx.coroutines.CoroutineScope
|
|
15
|
+
import kotlinx.coroutines.Dispatchers
|
|
16
|
+
import kotlinx.coroutines.launch
|
|
17
|
+
|
|
18
|
+
@ReactModule(name = GamificationEmbedViewManager.NAME)
|
|
19
|
+
class GamificationEmbedViewManager : SimpleViewManager<EmbedWebView>() {
|
|
20
|
+
|
|
21
|
+
// Tracks the active OnPreDrawListener per view so it can be removed on re-bind/drop
|
|
22
|
+
// instead of stacking a new listener on top on every setEmbedId call.
|
|
23
|
+
private val preDrawListeners = mutableMapOf<EmbedWebView, ViewTreeObserver.OnPreDrawListener>()
|
|
24
|
+
|
|
25
|
+
override fun getName(): String = NAME
|
|
26
|
+
|
|
27
|
+
override fun createViewInstance(context: ThemedReactContext): EmbedWebView =
|
|
28
|
+
EmbedWebView(HydraCore.curReactActivity ?: context)
|
|
29
|
+
|
|
30
|
+
@ReactProp(name = "embedId")
|
|
31
|
+
fun setEmbedId(view: EmbedWebView, embedId: String?) {
|
|
32
|
+
if (embedId.isNullOrEmpty()) return
|
|
33
|
+
// Guard: don't re-bind if already bound to this embedId. Without this, every RN
|
|
34
|
+
// re-render (triggered by the height-changed event) calls bindWithLayout again and
|
|
35
|
+
// accumulates an additional OnPreDrawListener, producing an infinite emit loop.
|
|
36
|
+
if (view.tag == embedId) return
|
|
37
|
+
val data = findEntryPointByEmbedId(embedId) ?: return
|
|
38
|
+
|
|
39
|
+
// Defer bind until Yoga has measured and laid out the view
|
|
40
|
+
if (view.width > 0 && view.height > 0) {
|
|
41
|
+
view.tag = embedId
|
|
42
|
+
bindWithLayout(view, data, embedId)
|
|
43
|
+
} else {
|
|
44
|
+
view.addOnLayoutChangeListener(object : View.OnLayoutChangeListener {
|
|
45
|
+
override fun onLayoutChange(
|
|
46
|
+
v: View, left: Int, top: Int, right: Int, bottom: Int,
|
|
47
|
+
oldLeft: Int, oldTop: Int, oldRight: Int, oldBottom: Int
|
|
48
|
+
) {
|
|
49
|
+
if (right - left > 0 && bottom - top > 0) {
|
|
50
|
+
view.removeOnLayoutChangeListener(this)
|
|
51
|
+
view.tag = embedId
|
|
52
|
+
bindWithLayout(view, data, embedId)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Sync layoutParams with Yoga's actual dimensions, wire callbacks, call bind(),
|
|
61
|
+
* then force a measure/layout pass on the children.
|
|
62
|
+
*/
|
|
63
|
+
private fun bindWithLayout(view: EmbedWebView, data: EntryPointData, embedId: String) {
|
|
64
|
+
val w = view.width
|
|
65
|
+
val h = view.height
|
|
66
|
+
val activity = HydraCore.curReactActivity ?: return
|
|
67
|
+
|
|
68
|
+
// Sync layoutParams with Yoga's actual pixel dimensions
|
|
69
|
+
// so SDK sees a positive height and takes host-controlled path
|
|
70
|
+
view.layoutParams?.let { lp ->
|
|
71
|
+
lp.width = w
|
|
72
|
+
lp.height = h
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Campaign URL lookup — resolves campaignId → campaign WebView URL
|
|
76
|
+
view.campaignUrlLookup = { campaignId ->
|
|
77
|
+
HydraCore.getFlowManager()?.getCampaignUrl(campaignId)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Resync after game played
|
|
81
|
+
view.onGamePlayed = {
|
|
82
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
83
|
+
HydraCore.getFlowManager()?.resync()
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Notify server that the entry point was shown
|
|
88
|
+
view.onEntryPointLoad = { ep ->
|
|
89
|
+
HydraCore.getFlowManager()?.onEntryPointShown(ep.id, "EMBEDDED")
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
view.bind(data, activity)
|
|
93
|
+
|
|
94
|
+
// Force measure/layout of children — RN parent swallows requestLayout()
|
|
95
|
+
// so EmbedWebView's internal WebView never gets measured otherwise
|
|
96
|
+
view.measure(
|
|
97
|
+
View.MeasureSpec.makeMeasureSpec(w, View.MeasureSpec.EXACTLY),
|
|
98
|
+
View.MeasureSpec.makeMeasureSpec(h, View.MeasureSpec.EXACTLY)
|
|
99
|
+
)
|
|
100
|
+
view.layout(view.left, view.top, view.right, view.bottom)
|
|
101
|
+
|
|
102
|
+
// Detect height changes from changeHeight() ValueAnimator.
|
|
103
|
+
// RN's Yoga parent swallows requestLayout(), so onLayoutChange never fires
|
|
104
|
+
// when layoutParams.height is updated by the animator. Instead, use
|
|
105
|
+
// OnPreDrawListener which fires before every draw — the animator drives
|
|
106
|
+
// draws on each frame, so we can detect layoutParams.height changes here.
|
|
107
|
+
// Remove any listener from a previous bind before adding a new one — setEmbedId's
|
|
108
|
+
// tag guard normally prevents re-binding, but this keeps the class correct on its own.
|
|
109
|
+
preDrawListeners.remove(view)?.let { view.viewTreeObserver.removeOnPreDrawListener(it) }
|
|
110
|
+
|
|
111
|
+
var lastEmittedHeight = h
|
|
112
|
+
val preDrawListener = object : ViewTreeObserver.OnPreDrawListener {
|
|
113
|
+
override fun onPreDraw(): Boolean {
|
|
114
|
+
val newHeight = view.layoutParams?.height ?: return true
|
|
115
|
+
if (newHeight > 0 && newHeight != lastEmittedHeight) {
|
|
116
|
+
lastEmittedHeight = newHeight
|
|
117
|
+
val heightDp = newHeight / view.resources.displayMetrics.density
|
|
118
|
+
HydraEventEmitter.sendEvent(
|
|
119
|
+
HydraEventType.ON_GAMIFICATION_VIEW_HEIGHT_CHANGED,
|
|
120
|
+
mapOf("height" to heightDp, "entryPointId" to embedId)
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
// Force re-measure/layout with new dimensions so WebView content
|
|
124
|
+
// doesn't clip — RN swallows requestLayout()
|
|
125
|
+
view.measure(
|
|
126
|
+
View.MeasureSpec.makeMeasureSpec(view.width, View.MeasureSpec.EXACTLY),
|
|
127
|
+
View.MeasureSpec.makeMeasureSpec(newHeight, View.MeasureSpec.EXACTLY)
|
|
128
|
+
)
|
|
129
|
+
view.layout(view.left, view.top, view.left + view.width, view.top + newHeight)
|
|
130
|
+
}
|
|
131
|
+
return true
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
view.viewTreeObserver.addOnPreDrawListener(preDrawListener)
|
|
135
|
+
preDrawListeners[view] = preDrawListener
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
private fun findEntryPointByEmbedId(embedId: String): EntryPointData? {
|
|
139
|
+
val flowManager = HydraCore.getFlowManager() ?: return null
|
|
140
|
+
val entryPoints = flowManager.getFilteredEntryPoints(null)
|
|
141
|
+
return entryPoints.find { it.mobile?.container?.bannerId == embedId }
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
override fun onDropViewInstance(view: EmbedWebView) {
|
|
145
|
+
preDrawListeners.remove(view)?.let { view.viewTreeObserver.removeOnPreDrawListener(it) }
|
|
146
|
+
view.destroy()
|
|
147
|
+
super.onDropViewInstance(view)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
companion object {
|
|
151
|
+
const val NAME = "GamificationEmbedView"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
package com.hydralib.gamification
|
|
2
|
+
|
|
3
|
+
import android.view.View
|
|
4
|
+
import com.capillary.hydra.gamification.model.LoyaltyUrl
|
|
5
|
+
import com.capillary.hydra.gamification.ui.entrypoints.LoyaltyEmbedView
|
|
6
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
7
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
8
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
9
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
10
|
+
import com.hydralib.hydrasdk.HydraCore
|
|
11
|
+
import kotlinx.coroutines.CoroutineScope
|
|
12
|
+
import kotlinx.coroutines.Dispatchers
|
|
13
|
+
import kotlinx.coroutines.launch
|
|
14
|
+
|
|
15
|
+
@ReactModule(name = GamificationLoyaltyViewManager.NAME)
|
|
16
|
+
class GamificationLoyaltyViewManager : SimpleViewManager<LoyaltyEmbedView>() {
|
|
17
|
+
|
|
18
|
+
override fun getName(): String = NAME
|
|
19
|
+
|
|
20
|
+
override fun createViewInstance(context: ThemedReactContext): LoyaltyEmbedView =
|
|
21
|
+
LoyaltyEmbedView(HydraCore.curReactActivity ?: context)
|
|
22
|
+
|
|
23
|
+
@ReactProp(name = "loyaltyId")
|
|
24
|
+
fun setLoyaltyId(view: LoyaltyEmbedView, loyaltyId: String?) {
|
|
25
|
+
if (loyaltyId.isNullOrEmpty()) return
|
|
26
|
+
val loyaltyUrl = findLoyaltyUrlById(loyaltyId) ?: return
|
|
27
|
+
|
|
28
|
+
// Defer bind until Yoga has measured and laid out the view
|
|
29
|
+
if (view.width > 0 && view.height > 0) {
|
|
30
|
+
bindWithLayout(view, loyaltyUrl)
|
|
31
|
+
} else {
|
|
32
|
+
view.addOnLayoutChangeListener(object : View.OnLayoutChangeListener {
|
|
33
|
+
override fun onLayoutChange(
|
|
34
|
+
v: View, left: Int, top: Int, right: Int, bottom: Int,
|
|
35
|
+
oldLeft: Int, oldTop: Int, oldRight: Int, oldBottom: Int
|
|
36
|
+
) {
|
|
37
|
+
if (right - left > 0 && bottom - top > 0) {
|
|
38
|
+
view.removeOnLayoutChangeListener(this)
|
|
39
|
+
bindWithLayout(view, loyaltyUrl)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Loyalty height strategy: fill whatever RN gives, content scrolls inside.
|
|
48
|
+
* Same as native Android (MATCH_PARENT × MATCH_PARENT).
|
|
49
|
+
* No dashboard config, no DIMENSIONS_UPDATE, no dynamic resizing.
|
|
50
|
+
*/
|
|
51
|
+
private fun bindWithLayout(view: LoyaltyEmbedView, loyaltyUrl: LoyaltyUrl) {
|
|
52
|
+
val w = view.width
|
|
53
|
+
val h = view.height
|
|
54
|
+
val activity = HydraCore.curReactActivity ?: return
|
|
55
|
+
val flowManager = HydraCore.getFlowManager() ?: return
|
|
56
|
+
|
|
57
|
+
// Sync layoutParams with Yoga's actual pixel dimensions
|
|
58
|
+
view.layoutParams?.let { lp ->
|
|
59
|
+
lp.width = w
|
|
60
|
+
lp.height = h
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Resync after game played
|
|
64
|
+
view.onGamePlayed = {
|
|
65
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
66
|
+
HydraCore.getFlowManager()?.resync()
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
val capToken = flowManager.getCapToken()
|
|
71
|
+
view.bind(loyaltyUrl.url, capToken, activity)
|
|
72
|
+
|
|
73
|
+
// Force measure/layout of children — RN parent swallows requestLayout()
|
|
74
|
+
// so LoyaltyEmbedView's internal WebView never gets measured otherwise
|
|
75
|
+
view.measure(
|
|
76
|
+
View.MeasureSpec.makeMeasureSpec(w, View.MeasureSpec.EXACTLY),
|
|
77
|
+
View.MeasureSpec.makeMeasureSpec(h, View.MeasureSpec.EXACTLY)
|
|
78
|
+
)
|
|
79
|
+
view.layout(view.left, view.top, view.right, view.bottom)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private fun findLoyaltyUrlById(loyaltyId: String): LoyaltyUrl? {
|
|
83
|
+
val flowManager = HydraCore.getFlowManager() ?: return null
|
|
84
|
+
return flowManager.getLoyaltyUrls().find { it.embedId == loyaltyId }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
override fun onDropViewInstance(view: LoyaltyEmbedView) {
|
|
88
|
+
view.destroy()
|
|
89
|
+
super.onDropViewInstance(view)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
companion object {
|
|
93
|
+
const val NAME = "GamificationLoyaltyView"
|
|
94
|
+
}
|
|
95
|
+
}
|