@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,299 @@
|
|
|
1
|
+
package com.hydralib.hydrasdk
|
|
2
|
+
|
|
3
|
+
import android.annotation.SuppressLint
|
|
4
|
+
import android.app.NotificationChannel
|
|
5
|
+
import android.app.NotificationManager
|
|
6
|
+
import android.app.PendingIntent
|
|
7
|
+
import android.content.Context
|
|
8
|
+
import android.content.Intent
|
|
9
|
+
import android.net.Uri
|
|
10
|
+
import android.os.Build
|
|
11
|
+
import com.hydralib.delegates.NonHydraNotificationActivity
|
|
12
|
+
import androidx.core.app.NotificationCompat
|
|
13
|
+
import com.capillary.hydra.android.sdk.utils.Logger
|
|
14
|
+
import com.capillary.hydra.firebase.HydraFirebaseAPI
|
|
15
|
+
import com.capillary.hydra.firebase.listener.NonHydraPushListener
|
|
16
|
+
import com.capillary.hydra.pushbase.HydraPushApi
|
|
17
|
+
import com.capillary.hydra.pushbase.listener.HydraPushNotificationListener
|
|
18
|
+
import com.capillary.hydra.pushbase.listener.NotificationPermissionListener
|
|
19
|
+
import com.capillary.hydra.pushbase.listener.TokenAvailableListener
|
|
20
|
+
import com.capillary.hydra.pushbase.notification.model.CTA
|
|
21
|
+
import com.capillary.hydra.pushbase.notification.model.NotificationPayload
|
|
22
|
+
import com.facebook.react.bridge.Promise
|
|
23
|
+
import com.google.firebase.messaging.RemoteMessage
|
|
24
|
+
import com.google.gson.Gson
|
|
25
|
+
import com.hydralib.delegates.NonHydraNotificationActivity.Companion.EXTRA_REMOTE_MESSAGE
|
|
26
|
+
import com.hydralib.eventemitter.HydraEventEmitter
|
|
27
|
+
import com.hydralib.eventemitter.HydraEventType
|
|
28
|
+
import com.hydralib.utils.getDrawableId
|
|
29
|
+
|
|
30
|
+
object HydraPushNotification {
|
|
31
|
+
private var fcmToken: String? = null
|
|
32
|
+
private var notificationChannelCreated = false
|
|
33
|
+
|
|
34
|
+
private fun asTokenListener() = TokenAvailableListener {
|
|
35
|
+
Logger.d(
|
|
36
|
+
"HydraPushNotification.TokenAvailableListener",
|
|
37
|
+
" fcmToken received in android = ${it.token}"
|
|
38
|
+
)
|
|
39
|
+
fcmToken = it.token
|
|
40
|
+
HydraEventEmitter.sendEvent(HydraEventType.ON_TOKEN_AVAILABLE, fcmToken)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private fun asNonHydraPushNotificationListener() = object : NonHydraPushListener {
|
|
44
|
+
override fun onPushReceived(remoteMessage: RemoteMessage) {
|
|
45
|
+
Logger.d(
|
|
46
|
+
"HydraPushNotification.NonHydraPushListener",
|
|
47
|
+
"Received Non Hydra Push, Details = $remoteMessage"
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
// Show notification in system tray
|
|
51
|
+
showNotificationInTray(remoteMessage)
|
|
52
|
+
|
|
53
|
+
HydraEventEmitter.sendEvent(
|
|
54
|
+
HydraEventType.ON_NON_HYDRA_NOTIFICATION_RECEIVED,
|
|
55
|
+
remoteMessage.toMap()
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private fun asHydraPushNotificationListener() = object : HydraPushNotificationListener {
|
|
61
|
+
override fun handleCustomAction(context: Context, payload: String) {
|
|
62
|
+
Logger.d(
|
|
63
|
+
"HydraPushNotification.HydraPushNotificationListener.handleCustomAction",
|
|
64
|
+
"Custom action, payload = $payload"
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
HydraEventEmitter.sendEvent(
|
|
68
|
+
HydraEventType.HANDLE_CUSTOM_ACTION,
|
|
69
|
+
payload
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
override fun onNotificationClick(
|
|
74
|
+
context: Context,
|
|
75
|
+
payload: NotificationPayload,
|
|
76
|
+
cta: CTA?
|
|
77
|
+
): Boolean {
|
|
78
|
+
Logger.d(
|
|
79
|
+
"HydraPushNotification.HydraPushNotificationListener.onNotificationClick",
|
|
80
|
+
"payload = $payload, cta=$cta"
|
|
81
|
+
)
|
|
82
|
+
val detailMap = mutableMapOf<String, Any>()
|
|
83
|
+
|
|
84
|
+
if (cta != null) {
|
|
85
|
+
detailMap["cta"] = cta.toMap()
|
|
86
|
+
}
|
|
87
|
+
detailMap["payload"] = payload.toMap()
|
|
88
|
+
|
|
89
|
+
HydraEventEmitter.sendEvent(
|
|
90
|
+
HydraEventType.ON_HYDRA_NOTIFICATION_CLICKED,
|
|
91
|
+
detailMap
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
return true
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
override fun onNotificationDismissed(context: Context, payload: NotificationPayload) {
|
|
98
|
+
Logger.d(
|
|
99
|
+
"HydraPushNotification.HydraPushNotificationListener.onNotificationDismissed",
|
|
100
|
+
"payload = $payload"
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
HydraEventEmitter.sendEvent(
|
|
104
|
+
HydraEventType.ON_HYDRA_NOTIFICATION_DISMISSED,
|
|
105
|
+
payload.toMap()
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
override fun onNotificationReceived(context: Context, payload: NotificationPayload) {
|
|
110
|
+
Logger.d(
|
|
111
|
+
"HydraPushNotification.HydraPushNotificationListener.onNotificationReceived",
|
|
112
|
+
"payload = $payload"
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
HydraEventEmitter.sendEvent(
|
|
116
|
+
HydraEventType.ON_HYDRA_NOTIFICATION_RECEIVED,
|
|
117
|
+
payload.toMap()
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
override fun onNotificationShown(context: Context, payload: NotificationPayload) {
|
|
122
|
+
Logger.d(
|
|
123
|
+
"HydraPushNotification.HydraPushNotificationListener.onNotificationShown",
|
|
124
|
+
"payload = $payload"
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
HydraEventEmitter.sendEvent(
|
|
128
|
+
HydraEventType.ON_HYDRA_NOTIFICATION_SHOWN,
|
|
129
|
+
payload.toMap()
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
fun registerListenersNotDependentOnAccountId() {
|
|
135
|
+
HydraFirebaseAPI.getInstance().addTokenListener(asTokenListener())
|
|
136
|
+
HydraFirebaseAPI.getInstance().addNonHydraPushListener(asNonHydraPushNotificationListener())
|
|
137
|
+
Logger.d("HydraPushNotification.registerListeners", "Listeners registered successfully")
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
fun registerHydraPushNotificationListener() {
|
|
141
|
+
HydraPushApi.getInstance().registerPushNotificationListener(asHydraPushNotificationListener())
|
|
142
|
+
Logger.d(
|
|
143
|
+
"HydraPushNotification.registerHydraPushNotificationListener",
|
|
144
|
+
"Listener registered successfully"
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
fun requestPermission(promise: Promise?) {
|
|
149
|
+
if (Build.VERSION.SDK_INT < 33) {
|
|
150
|
+
Logger.d(
|
|
151
|
+
"HydraPushNotification.requestPermission",
|
|
152
|
+
"SDK version less than 33, No need to ask for permission"
|
|
153
|
+
)
|
|
154
|
+
promise?.resolve(true)
|
|
155
|
+
return
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
var listener: NotificationPermissionListener? = null
|
|
159
|
+
listener = NotificationPermissionListener { isGranted ->
|
|
160
|
+
Logger.d(
|
|
161
|
+
"HydraPushNotification.requestPermission",
|
|
162
|
+
"Hydra push permission request result = $isGranted"
|
|
163
|
+
)
|
|
164
|
+
promise?.resolve(isGranted)
|
|
165
|
+
HydraPushApi.getInstance().removePermissionResponseListener(listener!!)
|
|
166
|
+
}
|
|
167
|
+
HydraPushApi.getInstance().addPermissionResponseListener(listener)
|
|
168
|
+
HydraPushApi.getInstance().requestPushPermission(HydraCore.appContext!!)
|
|
169
|
+
Logger.d("HydraPushNotification.requestPermission", "Hydra push permission requested")
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
fun openExternalUrl(url: String, promise: Promise?) {
|
|
173
|
+
val scheme = Uri.parse(url).scheme?.lowercase()
|
|
174
|
+
if (scheme != "http" && scheme != "https") {
|
|
175
|
+
Logger.e("HydraPushNotification.openExternalUrl", "Rejected non-http(s) URL scheme: $url")
|
|
176
|
+
promise?.reject("InvalidUrl", "Only http/https URLs are allowed")
|
|
177
|
+
return
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
val activity = HydraCore.curReactActivity
|
|
181
|
+
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
|
|
182
|
+
if (activity != null) {
|
|
183
|
+
activity.startActivity(intent)
|
|
184
|
+
} else {
|
|
185
|
+
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
186
|
+
HydraCore.appContext?.startActivity(intent)
|
|
187
|
+
}
|
|
188
|
+
promise?.resolve(null)
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
fun getFCMToken(promise: Promise?) {
|
|
192
|
+
if (fcmToken == null) {
|
|
193
|
+
Logger.d("HydraPushNotification.getFCMToken", "Token is not available, try later")
|
|
194
|
+
promise?.reject("TokenNotSet", "Token is not available, try later")
|
|
195
|
+
return
|
|
196
|
+
}
|
|
197
|
+
Logger.d("HydraPushNotification.getFCMToken", "Returning token = $fcmToken")
|
|
198
|
+
promise?.resolve(fcmToken)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
private fun createNotificationChannel(context: Context) {
|
|
202
|
+
if (notificationChannelCreated) return
|
|
203
|
+
|
|
204
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
205
|
+
val notificationManager =
|
|
206
|
+
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
|
207
|
+
val channelId = "non_hydra_notifications"
|
|
208
|
+
|
|
209
|
+
val channel = NotificationChannel(
|
|
210
|
+
channelId,
|
|
211
|
+
"Non-Hydra Notifications",
|
|
212
|
+
NotificationManager.IMPORTANCE_DEFAULT
|
|
213
|
+
).apply {
|
|
214
|
+
description = "Notifications from non-Hydra sources"
|
|
215
|
+
}
|
|
216
|
+
notificationManager.createNotificationChannel(channel)
|
|
217
|
+
notificationChannelCreated = true
|
|
218
|
+
Logger.d("HydraPushNotification.createNotificationChannel", "Notification channel created")
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
@SuppressLint("WrongConstant")
|
|
223
|
+
private fun showNotificationInTray(remoteMessage: RemoteMessage) {
|
|
224
|
+
// Add immediate logging to confirm method is called
|
|
225
|
+
Logger.i(
|
|
226
|
+
"HydraPushNotification",
|
|
227
|
+
"showNotificationInTray called - app state: ${if (HydraCore.appContext != null) "CONTEXT_AVAILABLE" else "CONTEXT_NULL"}"
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
val context = HydraCore.appContext ?: run {
|
|
231
|
+
Logger.e("HydraPushNotification", "HydraCore.appContext is null")
|
|
232
|
+
return
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
Logger.i("HydraPushNotification", "Context package name: ${context.packageName}")
|
|
236
|
+
Logger.i("HydraPushNotification", "Context class: ${context.javaClass.simpleName}")
|
|
237
|
+
|
|
238
|
+
// Create notification channel once
|
|
239
|
+
createNotificationChannel(context)
|
|
240
|
+
|
|
241
|
+
val notificationManager =
|
|
242
|
+
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
|
243
|
+
val channelId = "non_hydra_notifications"
|
|
244
|
+
val notificationId = System.currentTimeMillis().toInt()
|
|
245
|
+
|
|
246
|
+
// Extract notification data
|
|
247
|
+
val data = remoteMessage.data
|
|
248
|
+
val originalTitle = remoteMessage.notification?.title ?: data["title"] ?: "Notification"
|
|
249
|
+
val originalBody = remoteMessage.notification?.body ?: data["message"] ?: "New message received"
|
|
250
|
+
|
|
251
|
+
// Create intent for NotificationActivity to handle the notification click
|
|
252
|
+
val intent = Intent(context, NonHydraNotificationActivity::class.java).apply {
|
|
253
|
+
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
|
254
|
+
// Pass notification data to the activity
|
|
255
|
+
putExtra(EXTRA_REMOTE_MESSAGE, Gson().toJson(remoteMessage.toMap()))
|
|
256
|
+
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
val launchIntent =
|
|
260
|
+
context.packageManager.getLaunchIntentForPackage(context.packageName)?.apply {
|
|
261
|
+
addFlags(0x10200000)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
val intents = if (launchIntent != null) {
|
|
265
|
+
arrayOf(launchIntent, intent)
|
|
266
|
+
} else {
|
|
267
|
+
arrayOf(intent)
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
val intentFlag =
|
|
271
|
+
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
|
272
|
+
|
|
273
|
+
val pendingIntent = PendingIntent.getActivities(context, notificationId, intents, intentFlag)
|
|
274
|
+
|
|
275
|
+
// Get notification icon
|
|
276
|
+
val iconId = getDrawableId(context, "hydra_notification_small_icon", "drawable")
|
|
277
|
+
if (iconId == 0) {
|
|
278
|
+
Logger.e("HydraPushNotification", "No notification icon found, skipping notification")
|
|
279
|
+
return
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Build the notification
|
|
283
|
+
val notification = NotificationCompat.Builder(context, channelId)
|
|
284
|
+
.setContentTitle(originalTitle)
|
|
285
|
+
.setContentText(originalBody)
|
|
286
|
+
.setSmallIcon(iconId)
|
|
287
|
+
.setAutoCancel(true)
|
|
288
|
+
.setContentIntent(pendingIntent)
|
|
289
|
+
.build()
|
|
290
|
+
|
|
291
|
+
// Show the notification
|
|
292
|
+
notificationManager.notify(notificationId, notification)
|
|
293
|
+
|
|
294
|
+
Logger.i(
|
|
295
|
+
"HydraPushNotification",
|
|
296
|
+
"Notification shown in tray: title=$originalTitle, body=$originalBody, icon=$iconId"
|
|
297
|
+
)
|
|
298
|
+
}
|
|
299
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package com.hydralib.nativeapis
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
|
|
5
|
+
object Hydra {
|
|
6
|
+
/**
|
|
7
|
+
* Initialize the Hydra SDK.
|
|
8
|
+
*
|
|
9
|
+
* @param appContext The application context.
|
|
10
|
+
* @param firebaseRemoteConfigKeys Optional. Custom Firebase Remote Config key names.
|
|
11
|
+
* Pass null to use default keys.
|
|
12
|
+
* @param remoteConfig Optional. A pre-built HydraRemoteConfig object.
|
|
13
|
+
* When provided, Firebase Remote Config is bypassed entirely.
|
|
14
|
+
*/
|
|
15
|
+
@JvmStatic
|
|
16
|
+
@JvmOverloads
|
|
17
|
+
fun initialize(
|
|
18
|
+
appContext: Context,
|
|
19
|
+
firebaseRemoteConfigKeys: HydraFirebaseRemoteConfigKeys? = null,
|
|
20
|
+
remoteConfig: HydraRemoteConfig? = null
|
|
21
|
+
) {
|
|
22
|
+
when {
|
|
23
|
+
remoteConfig != null -> HydraInitializer.initialize(appContext, remoteConfig)
|
|
24
|
+
firebaseRemoteConfigKeys != null -> HydraInitializer.initializeUsingFirebaseRemoteConfig(appContext, firebaseRemoteConfigKeys)
|
|
25
|
+
else -> HydraInitializer.initializeUsingFirebaseRemoteConfig(appContext)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
package com.hydralib.nativeapis
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.RestrictTo
|
|
4
|
+
|
|
5
|
+
class HydraFirebaseRemoteConfigKeys(
|
|
6
|
+
@get:RestrictTo(RestrictTo.Scope.LIBRARY)
|
|
7
|
+
var keyForAccountId: String,
|
|
8
|
+
@get:RestrictTo(RestrictTo.Scope.LIBRARY)
|
|
9
|
+
var keyForBaseURL: String,
|
|
10
|
+
@get:RestrictTo(RestrictTo.Scope.LIBRARY)
|
|
11
|
+
var keyForSsl: String,
|
|
12
|
+
@get:RestrictTo(RestrictTo.Scope.LIBRARY)
|
|
13
|
+
var keyForRemoteDebugLevel: String,
|
|
14
|
+
@get:RestrictTo(RestrictTo.Scope.LIBRARY)
|
|
15
|
+
var keyForOrgId: String? = null,
|
|
16
|
+
@get:RestrictTo(RestrictTo.Scope.LIBRARY)
|
|
17
|
+
var keyForGamificationKey: String? = null,
|
|
18
|
+
@get:RestrictTo(RestrictTo.Scope.LIBRARY)
|
|
19
|
+
var keyForGamificationRegion: String? = null,
|
|
20
|
+
@get:RestrictTo(RestrictTo.Scope.LIBRARY)
|
|
21
|
+
var keyForGamificationBaseUrl: String? = null,
|
|
22
|
+
|
|
23
|
+
) {
|
|
24
|
+
|
|
25
|
+
data class Builder(
|
|
26
|
+
private var keyForAccountId: String? = null,
|
|
27
|
+
private var keyForBaseURL: String? = null,
|
|
28
|
+
private var keyForSsl: String? = null,
|
|
29
|
+
private var keyForRemoteDebugLevel: String? = null,
|
|
30
|
+
private var keyForOrgId: String? = null,
|
|
31
|
+
private var keyForGamificationKey: String? = null,
|
|
32
|
+
private var keyForGamificationRegion: String? = null,
|
|
33
|
+
private var keyForGamificationBaseUrl: String? = null,
|
|
34
|
+
) {
|
|
35
|
+
fun keyForBaseURL(keyForBaseURL: String) = apply { this.keyForBaseURL = keyForBaseURL }
|
|
36
|
+
fun keyForSsl(keyForSsl: String) = apply { this.keyForSsl = keyForSsl }
|
|
37
|
+
fun keyForRemoteDebugLevel(keyForRemoteDebugLevel: String) =
|
|
38
|
+
apply { this.keyForRemoteDebugLevel = keyForRemoteDebugLevel }
|
|
39
|
+
|
|
40
|
+
fun keyForAccountId(keyForAccountId: String) = apply { this.keyForAccountId = keyForAccountId }
|
|
41
|
+
fun keyForOrgId(keyForOrgId: String) = apply { this.keyForOrgId = keyForOrgId }
|
|
42
|
+
fun keyForGamificationKey(keyForGamificationKey: String) = apply { this.keyForGamificationKey = keyForGamificationKey }
|
|
43
|
+
fun keyForGamificationRegion(keyForGamificationRegion: String) = apply { this.keyForGamificationRegion = keyForGamificationRegion }
|
|
44
|
+
fun keyForGamificationBaseUrl(keyForGamificationBaseUrl: String) = apply { this.keyForGamificationBaseUrl = keyForGamificationBaseUrl }
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@Throws(IllegalArgumentException::class)
|
|
48
|
+
fun build(): HydraFirebaseRemoteConfigKeys {
|
|
49
|
+
if (keyForAccountId == null || keyForAccountId!!.isEmpty()) {
|
|
50
|
+
throw IllegalArgumentException("Key for Account id is required")
|
|
51
|
+
}
|
|
52
|
+
if (keyForBaseURL == null || keyForBaseURL!!.isEmpty()) {
|
|
53
|
+
throw IllegalArgumentException("Key forBase URL is required")
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (keyForSsl == null || keyForSsl!!.isEmpty()) {
|
|
57
|
+
throw IllegalArgumentException("Key for SSL is required")
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (keyForRemoteDebugLevel == null || keyForRemoteDebugLevel!!.isEmpty()) {
|
|
61
|
+
throw IllegalArgumentException("Key for Remote Debug Level is required")
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return HydraFirebaseRemoteConfigKeys(
|
|
65
|
+
keyForAccountId!!,
|
|
66
|
+
keyForBaseURL!!,
|
|
67
|
+
keyForSsl!!,
|
|
68
|
+
keyForRemoteDebugLevel!!,
|
|
69
|
+
keyForOrgId,
|
|
70
|
+
keyForGamificationKey,
|
|
71
|
+
keyForGamificationRegion,
|
|
72
|
+
keyForGamificationBaseUrl
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
package com.hydralib.nativeapis
|
|
2
|
+
|
|
3
|
+
import android.annotation.SuppressLint
|
|
4
|
+
import android.app.Application
|
|
5
|
+
import android.content.Context
|
|
6
|
+
import android.util.Log
|
|
7
|
+
import com.capillary.hydra.android.sdk.HydraAPI
|
|
8
|
+
import com.capillary.hydra.android.sdk.utils.LogType
|
|
9
|
+
import com.google.firebase.ktx.Firebase
|
|
10
|
+
import com.google.firebase.remoteconfig.FirebaseRemoteConfig
|
|
11
|
+
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings
|
|
12
|
+
import com.google.firebase.remoteconfig.ktx.remoteConfig
|
|
13
|
+
import com.hydralib.delegates.HydraActivityCallbacks
|
|
14
|
+
import com.hydralib.hydrasdk.HydraCore
|
|
15
|
+
import com.hydralib.utils.RNHydraPreferencesManager
|
|
16
|
+
|
|
17
|
+
object HydraInitializer {
|
|
18
|
+
@JvmStatic
|
|
19
|
+
fun initialize(appContext: Context, remoteConfig: HydraRemoteConfig) {
|
|
20
|
+
HydraAPI.initializeConsoleLogger(LogType.DEBUG)
|
|
21
|
+
(appContext as Application).registerActivityLifecycleCallbacks(HydraActivityCallbacks)
|
|
22
|
+
|
|
23
|
+
val isInitialized = initializeUsingPersistedData(appContext)
|
|
24
|
+
|
|
25
|
+
if (!isInitialized) {
|
|
26
|
+
Log.d("HydraInitializer.initialize", "initializing Hydra with passed remote config")
|
|
27
|
+
HydraCore.initHydra(appContext, remoteConfig)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Call this as early as possible in your app lifecycle (e.g., Application.onCreate)
|
|
33
|
+
*/
|
|
34
|
+
@SuppressLint("MissingPermission")
|
|
35
|
+
@JvmStatic
|
|
36
|
+
fun initializeUsingFirebaseRemoteConfig(
|
|
37
|
+
appContext: Context,
|
|
38
|
+
hydraFirebaseRemoteConfigKeys: HydraFirebaseRemoteConfigKeys = HydraFirebaseRemoteConfigKeys(
|
|
39
|
+
"hydra_account_id",
|
|
40
|
+
"hydra_base_url",
|
|
41
|
+
"hydra_ssl_public_key",
|
|
42
|
+
"hydra_remote_log_level",
|
|
43
|
+
"hydra_org_id",
|
|
44
|
+
"hydra_gamification_key",
|
|
45
|
+
"hydra_gamification_region",
|
|
46
|
+
"hydra_gamification_base_url"
|
|
47
|
+
)
|
|
48
|
+
) {
|
|
49
|
+
HydraAPI.initializeConsoleLogger(LogType.DEBUG)
|
|
50
|
+
(appContext as Application).registerActivityLifecycleCallbacks(HydraActivityCallbacks)
|
|
51
|
+
|
|
52
|
+
// Set appContext immediately before any async operations to prevent race conditions
|
|
53
|
+
HydraCore.setAppContext(appContext)
|
|
54
|
+
|
|
55
|
+
val isInitialized = initializeUsingPersistedData(appContext)
|
|
56
|
+
|
|
57
|
+
if (!isInitialized) {
|
|
58
|
+
Log.d("HydraInitializer", "initializing Hydra with passed Firebase Remote Config keys")
|
|
59
|
+
initializeFirebaseUsingKeys(appContext, hydraFirebaseRemoteConfigKeys)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private fun initializeUsingPersistedData(
|
|
64
|
+
appContext: Context
|
|
65
|
+
): Boolean {
|
|
66
|
+
val persistedRemoteConfig = RNHydraPreferencesManager.getHydraRemoteConfig(appContext)
|
|
67
|
+
if (persistedRemoteConfig != null) {
|
|
68
|
+
Log.d("HydraInitializer", "Using persisted remote config")
|
|
69
|
+
HydraCore.initHydra(appContext, persistedRemoteConfig)
|
|
70
|
+
return true
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
val persistedFirebaseRemoteConfigKeys =
|
|
74
|
+
RNHydraPreferencesManager.getHydraFirebaseRemoteConfigKeys(appContext)
|
|
75
|
+
if (persistedFirebaseRemoteConfigKeys != null) {
|
|
76
|
+
Log.d("HydraInitializer", "Using persisted firebase remote config keys")
|
|
77
|
+
initializeFirebaseUsingKeys(appContext, persistedFirebaseRemoteConfigKeys)
|
|
78
|
+
return true
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return false
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
private fun initializeFirebaseUsingKeys(
|
|
85
|
+
appContext: Context,
|
|
86
|
+
remoteConfigKeysToUse: HydraFirebaseRemoteConfigKeys
|
|
87
|
+
) {
|
|
88
|
+
val firebaseRemoteConfig: FirebaseRemoteConfig = Firebase.remoteConfig
|
|
89
|
+
|
|
90
|
+
firebaseRemoteConfig.setConfigSettingsAsync(
|
|
91
|
+
FirebaseRemoteConfigSettings.Builder()
|
|
92
|
+
.setMinimumFetchIntervalInSeconds(0)
|
|
93
|
+
.build()
|
|
94
|
+
).addOnCompleteListener {
|
|
95
|
+
fetchAndInitializeRemoteConfig(appContext, remoteConfigKeysToUse)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private fun fetchAndInitializeRemoteConfig(
|
|
100
|
+
appContext: Context,
|
|
101
|
+
hydraFirebaseRemoteConfigKeys: HydraFirebaseRemoteConfigKeys
|
|
102
|
+
) {
|
|
103
|
+
Log.d("HydraInitializer", "Starting fetch and activate remote config")
|
|
104
|
+
val firebaseRemoteConfig: FirebaseRemoteConfig = Firebase.remoteConfig
|
|
105
|
+
firebaseRemoteConfig.fetchAndActivate()
|
|
106
|
+
.addOnCompleteListener { task ->
|
|
107
|
+
if (task.isSuccessful) {
|
|
108
|
+
HydraCore.firebaseRemoteConfigActivated = true
|
|
109
|
+
Log.d("HydraInitializer", "Successfully fetched and activated remote config")
|
|
110
|
+
val hydraRemoteConfig: HydraRemoteConfig? =
|
|
111
|
+
HydraCore.processFirebaseRemoteConfig(hydraFirebaseRemoteConfigKeys)
|
|
112
|
+
if (hydraRemoteConfig != null) {
|
|
113
|
+
Log.d("HydraInitializer", "Using remote config")
|
|
114
|
+
HydraCore.initHydra(appContext, hydraRemoteConfig)
|
|
115
|
+
} else {
|
|
116
|
+
val errorMessage = "Failed to process remote config"
|
|
117
|
+
Log.e("HydraInitializer", errorMessage)
|
|
118
|
+
HydraCore.sendHydraInitializationResultEvent(false, errorMessage)
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
val errorMessage =
|
|
122
|
+
"Failed to fetch and activate remote config: ${task.exception?.message}"
|
|
123
|
+
Log.e("HydraInitializer", errorMessage, task.exception)
|
|
124
|
+
HydraCore.sendHydraInitializationResultEvent(false, errorMessage)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
package com.hydralib.nativeapis
|
|
2
|
+
|
|
3
|
+
import com.capillary.hydra.firebase.HydraFirebaseAPI
|
|
4
|
+
import com.capillary.hydra.pushbase.HydraPushApi
|
|
5
|
+
import com.google.firebase.messaging.RemoteMessage
|
|
6
|
+
import com.hydralib.hydrasdk.HydraCore
|
|
7
|
+
|
|
8
|
+
object HydraNativeMessaging {
|
|
9
|
+
fun onNewToken(token:String){
|
|
10
|
+
HydraFirebaseAPI.getInstance().passPushToken(HydraCore.appContext!!, token)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
fun onMessageReceived(remoteMessage : RemoteMessage){
|
|
14
|
+
if(HydraPushApi.getInstance().isFromHydraPlatform(remoteMessage.data)){
|
|
15
|
+
HydraFirebaseAPI.getInstance().passPushPayload(HydraCore.appContext!!, remoteMessage.data)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
package com.hydralib.nativeapis
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.RestrictTo
|
|
4
|
+
|
|
5
|
+
class HydraRemoteConfig(
|
|
6
|
+
@get:RestrictTo(RestrictTo.Scope.LIBRARY)
|
|
7
|
+
var accountId: String,
|
|
8
|
+
@get:RestrictTo(RestrictTo.Scope.LIBRARY)
|
|
9
|
+
var baseURL: String,
|
|
10
|
+
@get:RestrictTo(RestrictTo.Scope.LIBRARY)
|
|
11
|
+
var sslPublicKey: String,
|
|
12
|
+
@get:RestrictTo(RestrictTo.Scope.LIBRARY)
|
|
13
|
+
var remoteDebugLevel: Int,
|
|
14
|
+
@get:RestrictTo(RestrictTo.Scope.LIBRARY)
|
|
15
|
+
var orgId: String? = null,
|
|
16
|
+
@get:RestrictTo(RestrictTo.Scope.LIBRARY)
|
|
17
|
+
var gamificationKey: String? = null,
|
|
18
|
+
@get:RestrictTo(RestrictTo.Scope.LIBRARY)
|
|
19
|
+
var gamificationRegion: String? = null,
|
|
20
|
+
@get:RestrictTo(RestrictTo.Scope.LIBRARY)
|
|
21
|
+
var gamificationBaseUrl: String? = null,
|
|
22
|
+
|
|
23
|
+
) {
|
|
24
|
+
|
|
25
|
+
data class Builder(
|
|
26
|
+
private var accountId: String? = null,
|
|
27
|
+
private var baseURL: String? = null,
|
|
28
|
+
private var sslPublicKey: String? = null,
|
|
29
|
+
private var remoteDebugLevel: Int? = 0,
|
|
30
|
+
private var orgId: String? = null,
|
|
31
|
+
private var gamificationKey: String? = null,
|
|
32
|
+
private var gamificationRegion: String? = null,
|
|
33
|
+
private var gamificationBaseUrl: String? = null,
|
|
34
|
+
) {
|
|
35
|
+
fun baseURL(baseURL: String) = apply { this.baseURL = baseURL }
|
|
36
|
+
fun sslPublicKey(sslPublicKey: String) = apply { this.sslPublicKey = sslPublicKey }
|
|
37
|
+
fun remoteDebugLevel(remoteDebugLevel: Int) = apply { this.remoteDebugLevel = remoteDebugLevel }
|
|
38
|
+
fun accountId(accountId: String) = apply { this.accountId = accountId }
|
|
39
|
+
fun orgId(orgId: String) = apply { this.orgId = orgId }
|
|
40
|
+
fun gamificationKey(gamificationKey: String) = apply { this.gamificationKey = gamificationKey }
|
|
41
|
+
fun gamificationRegion(gamificationRegion: String) = apply { this.gamificationRegion = gamificationRegion }
|
|
42
|
+
fun gamificationBaseUrl(gamificationBaseUrl: String) = apply { this.gamificationBaseUrl = gamificationBaseUrl }
|
|
43
|
+
|
|
44
|
+
@Throws(IllegalArgumentException::class)
|
|
45
|
+
fun build(): HydraRemoteConfig {
|
|
46
|
+
if (accountId == null || accountId!!.isEmpty()) {
|
|
47
|
+
throw IllegalArgumentException("Account id is required")
|
|
48
|
+
}
|
|
49
|
+
if (baseURL == null || baseURL!!.isEmpty()) {
|
|
50
|
+
throw IllegalArgumentException("Base URL is required")
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (sslPublicKey == null || sslPublicKey!!.isEmpty()) {
|
|
54
|
+
throw IllegalArgumentException("SSL Public Key is required")
|
|
55
|
+
}
|
|
56
|
+
return HydraRemoteConfig(accountId!!, baseURL!!, sslPublicKey!!, remoteDebugLevel!!, orgId, gamificationKey, gamificationRegion, gamificationBaseUrl)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|