@juspay-tech/react-native-hyperswitch 0.2.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/HyperswitchSdkReactNative.podspec +31 -0
- package/android/build.gradle +119 -0
- package/android/gradle.properties +5 -0
- package/android/hyperswitch_autolinking.gradle +378 -0
- package/android/proguard-rules.pro +72 -0
- package/android/src/main/AndroidManifest.xml +25 -0
- package/android/src/main/assets/hyperswitch.bundle +1677 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/HyperswitchSdkReactNativePackage.kt +36 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/activity/RedirectActivity.kt +39 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/internal/DefaultReactHost.kt +314 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/internal/DefaultReactNativeHost.kt +131 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/internal/ReactDelegate.kt +423 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/internal/ReactFragment.kt +335 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/modules/HyperswitchSdkNativeModule.kt +143 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/modules/HyperswitchSdkReactNativeModule.kt +92 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/provider/HyperProvider.kt +269 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/views/GooglePayButtonView.kt +60 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/views/GooglePayButtonViewManager.kt +76 -0
- package/android/src/main/java/io/hyperswitch/hyperota/HyperOtaLogger.kt +122 -0
- package/android/src/main/java/io/hyperswitch/logs/CrashHandler.kt +29 -0
- package/android/src/main/java/io/hyperswitch/logs/Debouncer.kt +20 -0
- package/android/src/main/java/io/hyperswitch/logs/HyperLogManager.kt +113 -0
- package/android/src/main/java/io/hyperswitch/logs/LogData.kt +159 -0
- package/android/src/main/java/io/hyperswitch/logs/LogFileManager.kt +60 -0
- package/android/src/main/java/io/hyperswitch/networking/HyperNetworking.kt +73 -0
- package/android/src/main/java/io/hyperswitch/react/Utils.kt +23 -0
- package/android/src/main/res/values/attrs.xml +6 -0
- package/android/src/main/res/values/strings.xml +5 -0
- package/android/src/main/res/values/theme.xml +16 -0
- package/ios/Modules/HyperswitchModule.swift +61 -0
- package/ios/Modules/HyperswitchNativeModule.swift +113 -0
- package/ios/Modules/HyperswitchSdkNative.h +5 -0
- package/ios/Modules/HyperswitchSdkNative.mm +98 -0
- package/ios/Modules/HyperswitchSdkReactNative.h +5 -0
- package/ios/Modules/HyperswitchSdkReactNative.mm +53 -0
- package/ios/Views/ApplePayView.h +14 -0
- package/ios/Views/ApplePayView.mm +89 -0
- package/ios/hyperswitchSDK/Core/ApplePay/ApplePayHandler.swift +249 -0
- package/ios/hyperswitchSDK/Core/ApplePay/ApplePayViewManager.m +18 -0
- package/ios/hyperswitchSDK/Core/ApplePay/ApplePayViewManager.swift +123 -0
- package/ios/hyperswitchSDK/Core/HyperPaymentSheet/PaymentSheetView+SwiftUI.swift +49 -0
- package/ios/hyperswitchSDK/Core/HyperPaymentSheet/PaymentSheetView+UIKit.swift +49 -0
- package/ios/hyperswitchSDK/Core/HyperPaymentSheet/PaymentSheetView.swift +80 -0
- package/ios/hyperswitchSDK/Core/HyperSession/PaymentSession+UIKit.swift +176 -0
- package/ios/hyperswitchSDK/Core/HyperSession/PaymentSessionTypes.swift +121 -0
- package/ios/hyperswitchSDK/Core/Models/LogPayload.swift +53 -0
- package/ios/hyperswitchSDK/Core/NativeLogger/Debouncer.swift +37 -0
- package/ios/hyperswitchSDK/Core/NativeLogger/LogBuilder.swift +91 -0
- package/ios/hyperswitchSDK/Core/NativeLogger/LogFileManager.swift +75 -0
- package/ios/hyperswitchSDK/Core/NativeLogger/LogManager.swift +113 -0
- package/ios/hyperswitchSDK/Core/NativeModule/HyperHeadless.m +16 -0
- package/ios/hyperswitchSDK/Core/NativeModule/HyperHeadless.swift +74 -0
- package/ios/hyperswitchSDK/Core/NativeModule/HyperModule.m +28 -0
- package/ios/hyperswitchSDK/Core/NativeModule/HyperModule.swift +168 -0
- package/ios/hyperswitchSDK/Core/NativeModule/OTAServices.swift +113 -0
- package/ios/hyperswitchSDK/Core/NativeModule/RNHeadlessManager.swift +45 -0
- package/ios/hyperswitchSDK/Core/NativeModule/RNResponseHandler.swift +12 -0
- package/ios/hyperswitchSDK/Core/NativeModule/RNViewManager.swift +90 -0
- package/ios/hyperswitchSDK/Core/NativeModule/hyper-Bridging-Header.h +9 -0
- package/ios/hyperswitchSDK/Core/Resources/HyperOTA.plist +20 -0
- package/ios/hyperswitchSDK/Core/Resources/hyperswitch.bundle +1673 -0
- package/ios/hyperswitchSDK/Shared/APIClient.swift +21 -0
- package/ios/hyperswitchSDK/Shared/DictionaryConverter.swift +104 -0
- package/ios/hyperswitchSDK/Shared/Environment.swift +24 -0
- package/ios/hyperswitchSDK/Shared/Extensions.swift +31 -0
- package/ios/hyperswitchSDK/Shared/Helper.swift +16 -0
- package/ios/hyperswitchSDK/Shared/HyperNetworking.swift +137 -0
- package/ios/hyperswitchSDK/Shared/HyperParams.swift +44 -0
- package/ios/hyperswitchSDK/Shared/HyperUIViewController.swift +25 -0
- package/ios/hyperswitchSDK/Shared/PaymentSession.swift +43 -0
- package/ios/hyperswitchSDK/Shared/PaymentSheet.swift +30 -0
- package/ios/hyperswitchSDK/Shared/PaymentSheetAppearance.swift +264 -0
- package/ios/hyperswitchSDK/Shared/PaymentSheetConfiguration.swift +494 -0
- package/ios/hyperswitchSDK/Shared/SwiftUIManager.swift +28 -0
- package/ios/hyperswitchSDK/Shared/Version.swift +12 -0
- package/lib/bs/JuspayTechReactNativeHyperswitch.cmi +0 -0
- package/lib/bs/JuspayTechReactNativeHyperswitch.cmj +0 -0
- package/lib/bs/JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/JuspayTechReactNativeHyperswitch.mlmap +5 -0
- package/lib/bs/build.ninja +29 -0
- package/lib/bs/install.ninja +25 -0
- package/lib/bs/src/context/HyperProvider-JuspayTechReactNativeHyperswitch.cmi +0 -0
- package/lib/bs/src/context/HyperProvider-JuspayTechReactNativeHyperswitch.cmj +0 -0
- package/lib/bs/src/context/HyperProvider-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/context/HyperProvider.ast +0 -0
- package/lib/bs/src/context/HyperProvider.d +1 -0
- package/lib/bs/src/hooks/useHyper-JuspayTechReactNativeHyperswitch.cmi +0 -0
- package/lib/bs/src/hooks/useHyper-JuspayTechReactNativeHyperswitch.cmj +0 -0
- package/lib/bs/src/hooks/useHyper-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/hooks/useHyper.ast +0 -0
- package/lib/bs/src/hooks/useHyper.d +1 -0
- package/lib/bs/src/modules/NativeHyperswitchSdk-JuspayTechReactNativeHyperswitch.cmi +0 -0
- package/lib/bs/src/modules/NativeHyperswitchSdk-JuspayTechReactNativeHyperswitch.cmj +0 -0
- package/lib/bs/src/modules/NativeHyperswitchSdk-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/modules/NativeHyperswitchSdk.ast +0 -0
- package/lib/bs/src/modules/NativeHyperswitchSdk.d +1 -0
- package/lib/bs/src/types/PaymentSheetConfiguration-JuspayTechReactNativeHyperswitch.cmi +0 -0
- package/lib/bs/src/types/PaymentSheetConfiguration-JuspayTechReactNativeHyperswitch.cmj +0 -0
- package/lib/bs/src/types/PaymentSheetConfiguration-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/types/PaymentSheetConfiguration.ast +0 -0
- package/lib/bs/src/types/PaymentSheetConfiguration.d +1 -0
- package/lib/commonjs/context/HyperProvider.gen.js +16 -0
- package/lib/commonjs/context/HyperProvider.gen.js.map +1 -0
- package/lib/commonjs/context/HyperProvider.res +78 -0
- package/lib/commonjs/context/HyperProvider.res.js +98 -0
- package/lib/commonjs/context/HyperProvider.res.js.map +1 -0
- package/lib/commonjs/hooks/useHyper.gen.js +15 -0
- package/lib/commonjs/hooks/useHyper.gen.js.map +1 -0
- package/lib/commonjs/hooks/useHyper.res +142 -0
- package/lib/commonjs/hooks/useHyper.res.js +152 -0
- package/lib/commonjs/hooks/useHyper.res.js.map +1 -0
- package/lib/commonjs/index.js +26 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/modules/NativeHyperswitchSdk.gen.js +6 -0
- package/lib/commonjs/modules/NativeHyperswitchSdk.gen.js.map +1 -0
- package/lib/commonjs/modules/NativeHyperswitchSdk.res +55 -0
- package/lib/commonjs/modules/NativeHyperswitchSdk.res.js +14 -0
- package/lib/commonjs/modules/NativeHyperswitchSdk.res.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/shims/Js.shim.js +2 -0
- package/lib/commonjs/shims/Js.shim.js.map +1 -0
- package/lib/commonjs/specs/ApplePayButtonNativeComponent.ts +11 -0
- package/lib/commonjs/specs/GooglePayButtonNativeComponent.android.js +10 -0
- package/lib/commonjs/specs/GooglePayButtonNativeComponent.android.js.map +1 -0
- package/lib/commonjs/specs/HyperswitchSdkReactNativeViewNativeComponent.ts +10 -0
- package/lib/commonjs/specs/NativeHyperswitchSdkNative.js +9 -0
- package/lib/commonjs/specs/NativeHyperswitchSdkNative.js.map +1 -0
- package/lib/commonjs/specs/NativeHyperswitchSdkReactNative.js +9 -0
- package/lib/commonjs/specs/NativeHyperswitchSdkReactNative.js.map +1 -0
- package/lib/commonjs/types/PaymentSheetConfiguration.gen.js +2 -0
- package/lib/commonjs/types/PaymentSheetConfiguration.gen.js.map +1 -0
- package/lib/commonjs/types/PaymentSheetConfiguration.res +215 -0
- package/lib/commonjs/types/PaymentSheetConfiguration.res.js +4 -0
- package/lib/commonjs/types/PaymentSheetConfiguration.res.js.map +1 -0
- package/lib/module/context/HyperProvider.gen.js +11 -0
- package/lib/module/context/HyperProvider.gen.js.map +1 -0
- package/lib/module/context/HyperProvider.res +78 -0
- package/lib/module/context/HyperProvider.res.js +91 -0
- package/lib/module/context/HyperProvider.res.js.map +1 -0
- package/lib/module/hooks/useHyper.gen.js +10 -0
- package/lib/module/hooks/useHyper.gen.js.map +1 -0
- package/lib/module/hooks/useHyper.res +142 -0
- package/lib/module/hooks/useHyper.res.js +142 -0
- package/lib/module/hooks/useHyper.res.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/modules/NativeHyperswitchSdk.gen.js +4 -0
- package/lib/module/modules/NativeHyperswitchSdk.gen.js.map +1 -0
- package/lib/module/modules/NativeHyperswitchSdk.res +55 -0
- package/lib/module/modules/NativeHyperswitchSdk.res.js +9 -0
- package/lib/module/modules/NativeHyperswitchSdk.res.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/shims/Js.shim.js +2 -0
- package/lib/module/shims/Js.shim.js.map +1 -0
- package/lib/module/specs/ApplePayButtonNativeComponent.ts +11 -0
- package/lib/module/specs/GooglePayButtonNativeComponent.android.js +5 -0
- package/lib/module/specs/GooglePayButtonNativeComponent.android.js.map +1 -0
- package/lib/module/specs/HyperswitchSdkReactNativeViewNativeComponent.ts +10 -0
- package/lib/module/specs/NativeHyperswitchSdkNative.js +5 -0
- package/lib/module/specs/NativeHyperswitchSdkNative.js.map +1 -0
- package/lib/module/specs/NativeHyperswitchSdkReactNative.js +5 -0
- package/lib/module/specs/NativeHyperswitchSdkReactNative.js.map +1 -0
- package/lib/module/types/PaymentSheetConfiguration.gen.js +2 -0
- package/lib/module/types/PaymentSheetConfiguration.gen.js.map +1 -0
- package/lib/module/types/PaymentSheetConfiguration.res +215 -0
- package/lib/module/types/PaymentSheetConfiguration.res.js +4 -0
- package/lib/module/types/PaymentSheetConfiguration.res.js.map +1 -0
- package/lib/typescript/commonjs/babel.config.d.ts +10 -0
- package/lib/typescript/commonjs/babel.config.d.ts.map +1 -0
- package/lib/typescript/commonjs/eslint.config.d.mts +3 -0
- package/lib/typescript/commonjs/eslint.config.d.mts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/scripts/bootstrap.d.ts +2 -0
- package/lib/typescript/commonjs/scripts/bootstrap.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/context/HyperProvider.gen.d.ts +17 -0
- package/lib/typescript/commonjs/src/context/HyperProvider.gen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/context/HyperProvider.res.d.ts +20 -0
- package/lib/typescript/commonjs/src/context/HyperProvider.res.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hooks/useHyper.gen.d.ts +10 -0
- package/lib/typescript/commonjs/src/hooks/useHyper.gen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hooks/useHyper.res.d.ts +95 -0
- package/lib/typescript/commonjs/src/hooks/useHyper.res.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +4 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/NativeHyperswitchSdk.gen.d.ts +24 -0
- package/lib/typescript/commonjs/src/modules/NativeHyperswitchSdk.gen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/NativeHyperswitchSdk.res.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/NativeHyperswitchSdk.res.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/shims/Js.shim.d.ts +4 -0
- package/lib/typescript/commonjs/src/shims/Js.shim.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/specs/ApplePayButtonNativeComponent.d.ts +10 -0
- package/lib/typescript/commonjs/src/specs/ApplePayButtonNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/specs/GooglePayButtonNativeComponent.android.d.ts +11 -0
- package/lib/typescript/commonjs/src/specs/GooglePayButtonNativeComponent.android.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/specs/HyperswitchSdkReactNativeViewNativeComponent.d.ts +1 -0
- package/lib/typescript/commonjs/src/specs/HyperswitchSdkReactNativeViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/specs/NativeHyperswitchSdkNative.d.ts +17 -0
- package/lib/typescript/commonjs/src/specs/NativeHyperswitchSdkNative.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/specs/NativeHyperswitchSdkReactNative.d.ts +9 -0
- package/lib/typescript/commonjs/src/specs/NativeHyperswitchSdkReactNative.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/PaymentSheetConfiguration.gen.d.ts +149 -0
- package/lib/typescript/commonjs/src/types/PaymentSheetConfiguration.gen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/PaymentSheetConfiguration.res.d.ts +1 -0
- package/lib/typescript/commonjs/src/types/PaymentSheetConfiguration.res.d.ts.map +1 -0
- package/lib/typescript/module/babel.config.d.ts +10 -0
- package/lib/typescript/module/babel.config.d.ts.map +1 -0
- package/lib/typescript/module/eslint.config.d.mts +3 -0
- package/lib/typescript/module/eslint.config.d.mts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/scripts/bootstrap.d.ts +2 -0
- package/lib/typescript/module/scripts/bootstrap.d.ts.map +1 -0
- package/lib/typescript/module/src/context/HyperProvider.gen.d.ts +17 -0
- package/lib/typescript/module/src/context/HyperProvider.gen.d.ts.map +1 -0
- package/lib/typescript/module/src/context/HyperProvider.res.d.ts +20 -0
- package/lib/typescript/module/src/context/HyperProvider.res.d.ts.map +1 -0
- package/lib/typescript/module/src/hooks/useHyper.gen.d.ts +10 -0
- package/lib/typescript/module/src/hooks/useHyper.gen.d.ts.map +1 -0
- package/lib/typescript/module/src/hooks/useHyper.res.d.ts +95 -0
- package/lib/typescript/module/src/hooks/useHyper.res.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +4 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/NativeHyperswitchSdk.gen.d.ts +24 -0
- package/lib/typescript/module/src/modules/NativeHyperswitchSdk.gen.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/NativeHyperswitchSdk.res.d.ts +2 -0
- package/lib/typescript/module/src/modules/NativeHyperswitchSdk.res.d.ts.map +1 -0
- package/lib/typescript/module/src/shims/Js.shim.d.ts +4 -0
- package/lib/typescript/module/src/shims/Js.shim.d.ts.map +1 -0
- package/lib/typescript/module/src/specs/ApplePayButtonNativeComponent.d.ts +10 -0
- package/lib/typescript/module/src/specs/ApplePayButtonNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/specs/GooglePayButtonNativeComponent.android.d.ts +11 -0
- package/lib/typescript/module/src/specs/GooglePayButtonNativeComponent.android.d.ts.map +1 -0
- package/lib/typescript/module/src/specs/HyperswitchSdkReactNativeViewNativeComponent.d.ts +1 -0
- package/lib/typescript/module/src/specs/HyperswitchSdkReactNativeViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/specs/NativeHyperswitchSdkNative.d.ts +17 -0
- package/lib/typescript/module/src/specs/NativeHyperswitchSdkNative.d.ts.map +1 -0
- package/lib/typescript/module/src/specs/NativeHyperswitchSdkReactNative.d.ts +9 -0
- package/lib/typescript/module/src/specs/NativeHyperswitchSdkReactNative.d.ts.map +1 -0
- package/lib/typescript/module/src/types/PaymentSheetConfiguration.gen.d.ts +149 -0
- package/lib/typescript/module/src/types/PaymentSheetConfiguration.gen.d.ts.map +1 -0
- package/lib/typescript/module/src/types/PaymentSheetConfiguration.res.d.ts +1 -0
- package/lib/typescript/module/src/types/PaymentSheetConfiguration.res.d.ts.map +1 -0
- package/package.json +196 -0
- package/src/context/HyperProvider.gen.tsx +26 -0
- package/src/context/HyperProvider.res +78 -0
- package/src/context/HyperProvider.res.js +112 -0
- package/src/hooks/useHyper.gen.tsx +18 -0
- package/src/hooks/useHyper.res +142 -0
- package/src/hooks/useHyper.res.js +157 -0
- package/src/index.tsx +13 -0
- package/src/modules/NativeHyperswitchSdk.gen.tsx +25 -0
- package/src/modules/NativeHyperswitchSdk.res +55 -0
- package/src/modules/NativeHyperswitchSdk.res.js +10 -0
- package/src/shims/Js.shim.ts +5 -0
- package/src/specs/ApplePayButtonNativeComponent.ts +11 -0
- package/src/specs/GooglePayButtonNativeComponent.android.ts +12 -0
- package/src/specs/HyperswitchSdkReactNativeViewNativeComponent.ts +10 -0
- package/src/specs/NativeHyperswitchSdkNative.ts +33 -0
- package/src/specs/NativeHyperswitchSdkReactNative.ts +17 -0
- package/src/types/PaymentSheetConfiguration.gen.tsx +202 -0
- package/src/types/PaymentSheetConfiguration.res +215 -0
- package/src/types/PaymentSheetConfiguration.res.js +2 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "HyperswitchSdkReactNative"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
14
|
+
s.source = { :git => "https://github.com/juspay/@juspay-tech/react-native-hyperswitch.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
|
|
17
|
+
s.private_header_files = "ios/**/*.h"
|
|
18
|
+
s.resources = ["ios/hyperswitchSDK/Core/Resources/*"]
|
|
19
|
+
|
|
20
|
+
s.dependency 'HyperOTA', '0.0.8'
|
|
21
|
+
|
|
22
|
+
s.pod_target_xcconfig = {
|
|
23
|
+
'DEFINES_MODULE' => 'YES',
|
|
24
|
+
'OTHER_SWIFT_FLAGS' => "-enable-experimental-feature AccessLevelOnImport"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
s.dependency 'ReactAppDependencyProvider'
|
|
28
|
+
add_dependency(s, "React-RCTAppDelegate")
|
|
29
|
+
|
|
30
|
+
install_modules_dependencies(s)
|
|
31
|
+
end
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.getExtOrDefault = {name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['HyperswitchSdkReactNative_' + name]
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
repositories {
|
|
7
|
+
mavenLocal()
|
|
8
|
+
google()
|
|
9
|
+
mavenCentral()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
dependencies {
|
|
13
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
14
|
+
// noinspection DifferentKotlinGradleVersion
|
|
15
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
apply plugin: "com.android.library"
|
|
21
|
+
apply plugin: "kotlin-android"
|
|
22
|
+
|
|
23
|
+
apply plugin: "com.facebook.react"
|
|
24
|
+
|
|
25
|
+
def getExtOrIntegerDefault(name) {
|
|
26
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["HyperswitchSdkReactNative_" + name]).toInteger()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
def isNewArchitectureEnabled() {
|
|
30
|
+
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
android {
|
|
34
|
+
namespace "com.hyperswitchsdkreactnative"
|
|
35
|
+
|
|
36
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
37
|
+
|
|
38
|
+
defaultConfig {
|
|
39
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
40
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
41
|
+
versionCode 1
|
|
42
|
+
versionName "1.0"
|
|
43
|
+
buildConfigField "String", "VERSION_NAME", "\"${version}\""
|
|
44
|
+
buildConfigField "boolean", "IS_HERMES_ENABLED", hermesEnabled
|
|
45
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", newArchEnabled
|
|
46
|
+
}
|
|
47
|
+
buildFeatures {
|
|
48
|
+
buildConfig true
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
buildTypes {
|
|
52
|
+
release {
|
|
53
|
+
minifyEnabled false
|
|
54
|
+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
55
|
+
}
|
|
56
|
+
debug {
|
|
57
|
+
debuggable true
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
lintOptions {
|
|
62
|
+
disable "GradleCompatible"
|
|
63
|
+
abortOnError false
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
compileOptions {
|
|
67
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
68
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
kotlinOptions {
|
|
72
|
+
jvmTarget = '17'
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
sourceSets {
|
|
76
|
+
main {
|
|
77
|
+
java.srcDirs += [
|
|
78
|
+
"generated/java",
|
|
79
|
+
"generated/jni",
|
|
80
|
+
"build/generated/source/packagelist"
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
packagingOptions {
|
|
86
|
+
pickFirst '**/libc++_shared.so'
|
|
87
|
+
pickFirst '**/libfbjni.so'
|
|
88
|
+
pickFirst '**/libreactnativejni.so'
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
rootProject.allprojects {
|
|
92
|
+
repositories {
|
|
93
|
+
mavenCentral()
|
|
94
|
+
google()
|
|
95
|
+
maven { url "https://maven.juspay.in/hyper-sdk/" }
|
|
96
|
+
mavenLocal()
|
|
97
|
+
maven {
|
|
98
|
+
url("/Users/shivam.shashank/Documents/repositories/hyperswitch-client-core/android/maven")
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
104
|
+
|
|
105
|
+
apply from: "./hyperswitch_autolinking.gradle"
|
|
106
|
+
applyHyperswitchAutolinking(project)
|
|
107
|
+
|
|
108
|
+
dependencies {
|
|
109
|
+
implementation "com.facebook.react:react-android"
|
|
110
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
111
|
+
implementation "com.google.android.gms:play-services-wallet:19.4.0"
|
|
112
|
+
implementation 'androidx.activity:activity-ktx:1.10.1'
|
|
113
|
+
implementation("org.greenrobot:eventbus")
|
|
114
|
+
implementation "in.juspay:hyperotareact:0.0.1-xota.10"
|
|
115
|
+
implementation "io.hyperswitch:hyperswitch-sdk-android-common:1.0.0"
|
|
116
|
+
// implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.7'
|
|
117
|
+
// implementation 'androidx.lifecycle:lifecycle-common-java8:2.8.7'
|
|
118
|
+
// implementation 'androidx.fragment:fragment-ktx:1.8.5'
|
|
119
|
+
}
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import groovy.json.JsonSlurper
|
|
2
|
+
import groovy.text.SimpleTemplateEngine
|
|
3
|
+
|
|
4
|
+
def generatedClassName = "HyperPackageList"
|
|
5
|
+
def generatedFilePackage = "com.facebook.react"
|
|
6
|
+
|
|
7
|
+
def generatedFileContentsTemplate = """
|
|
8
|
+
package $generatedFilePackage;
|
|
9
|
+
|
|
10
|
+
import android.app.Application;
|
|
11
|
+
import android.content.Context;
|
|
12
|
+
import android.content.res.Resources;
|
|
13
|
+
|
|
14
|
+
import com.facebook.react.ReactPackage;
|
|
15
|
+
import com.facebook.react.shell.MainPackageConfig;
|
|
16
|
+
import com.facebook.react.shell.MainReactPackage;
|
|
17
|
+
import java.util.Arrays;
|
|
18
|
+
import java.util.ArrayList;
|
|
19
|
+
|
|
20
|
+
{{ packageImports }}
|
|
21
|
+
|
|
22
|
+
public class $generatedClassName {
|
|
23
|
+
private Application application;
|
|
24
|
+
private ReactNativeHost reactNativeHost;
|
|
25
|
+
private MainPackageConfig mConfig;
|
|
26
|
+
|
|
27
|
+
public $generatedClassName(ReactNativeHost reactNativeHost) {
|
|
28
|
+
this(reactNativeHost, null);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public $generatedClassName(Application application) {
|
|
32
|
+
this(application, null);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public $generatedClassName(ReactNativeHost reactNativeHost, MainPackageConfig config) {
|
|
36
|
+
this.reactNativeHost = reactNativeHost;
|
|
37
|
+
mConfig = config;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public $generatedClassName(Application application, MainPackageConfig config) {
|
|
41
|
+
this.reactNativeHost = null;
|
|
42
|
+
this.application = application;
|
|
43
|
+
mConfig = config;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private ReactNativeHost getReactNativeHost() {
|
|
47
|
+
return this.reactNativeHost;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private Resources getResources() {
|
|
51
|
+
return this.getApplication().getResources();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private Application getApplication() {
|
|
55
|
+
if (this.reactNativeHost == null) return this.application;
|
|
56
|
+
return this.reactNativeHost.getApplication();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private Context getApplicationContext() {
|
|
60
|
+
return this.getApplication().getApplicationContext();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public ArrayList<ReactPackage> getPackages() {
|
|
64
|
+
return new ArrayList<>(Arrays.<ReactPackage>asList(
|
|
65
|
+
new MainReactPackage(mConfig){{ packageClassInstances }}
|
|
66
|
+
));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
class HyperswitchAutolinking {
|
|
72
|
+
private Logger logger
|
|
73
|
+
private String packageName
|
|
74
|
+
private File root
|
|
75
|
+
private Project rootProject
|
|
76
|
+
private ArrayList<HashMap<String, String>> reactNativeModules
|
|
77
|
+
private HashMap<String, ArrayList> reactNativeModulesBuildVariants
|
|
78
|
+
private static String LOG_PREFIX = ":HyperswitchSDK:"
|
|
79
|
+
|
|
80
|
+
HyperswitchAutolinking(Logger logger, File root, Project rootProject) {
|
|
81
|
+
this.logger = logger
|
|
82
|
+
this.root = root
|
|
83
|
+
this.rootProject = rootProject
|
|
84
|
+
this.packageName = "com.hyperswitchsdkreactnative"
|
|
85
|
+
|
|
86
|
+
def (nativeModules, reactNativeModulesBuildVariants) = this.loadAutolinkingData()
|
|
87
|
+
this.reactNativeModules = nativeModules
|
|
88
|
+
this.reactNativeModulesBuildVariants = reactNativeModulesBuildVariants
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Load autolinking data with primary/fallback strategy
|
|
93
|
+
* Primary: autolinking.json from rootProject build directory
|
|
94
|
+
* Fallback: React Native CLI (for RN < 0.76)
|
|
95
|
+
*/
|
|
96
|
+
private ArrayList loadAutolinkingData() {
|
|
97
|
+
try {
|
|
98
|
+
return loadFromAutolinkingJson()
|
|
99
|
+
} catch (Exception e) {
|
|
100
|
+
this.logger.warn("${LOG_PREFIX}Failed to load autolinking.json: ${e.message}")
|
|
101
|
+
this.logger.info("${LOG_PREFIX}Falling back to React Native CLI approach")
|
|
102
|
+
return loadFromReactNativeCli()
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Primary: Load from autolinking.json (RN >= 0.76)
|
|
108
|
+
*/
|
|
109
|
+
private ArrayList loadFromAutolinkingJson() {
|
|
110
|
+
def autolinkingFile = new File(rootProject.layout.buildDirectory.get().asFile, "generated/autolinking/autolinking.json")
|
|
111
|
+
|
|
112
|
+
if (!autolinkingFile.exists()) {
|
|
113
|
+
throw new FileNotFoundException("autolinking.json not found at: ${autolinkingFile.absolutePath}")
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
this.logger.info("${LOG_PREFIX}Reading autolinking configuration from: ${autolinkingFile.absolutePath}")
|
|
117
|
+
|
|
118
|
+
def json = new JsonSlurper().parse(autolinkingFile)
|
|
119
|
+
def dependencies = json["dependencies"]
|
|
120
|
+
|
|
121
|
+
if (!dependencies) {
|
|
122
|
+
throw new IllegalStateException("No dependencies found in autolinking.json")
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
ArrayList<HashMap<String, String>> reactNativeModules = new ArrayList<HashMap<String, String>>()
|
|
126
|
+
HashMap<String, ArrayList> reactNativeModulesBuildVariants = new HashMap<String, ArrayList>()
|
|
127
|
+
|
|
128
|
+
dependencies.each { name, value ->
|
|
129
|
+
def platformsConfig = value["platforms"]
|
|
130
|
+
def androidConfig = platformsConfig["android"]
|
|
131
|
+
|
|
132
|
+
if (androidConfig != null && androidConfig["sourceDir"] != null && !androidConfig["isPureCxxDependency"]) {
|
|
133
|
+
this.logger.info("${LOG_PREFIX}Adding native module '${name}' from autolinking.json")
|
|
134
|
+
|
|
135
|
+
HashMap reactNativeModuleConfig = new HashMap<String, String>()
|
|
136
|
+
def nameCleansed = name.replaceAll('[~*!\'()]+', '_').replaceAll('^@([\\w-.]+)/', '$1_')
|
|
137
|
+
|
|
138
|
+
reactNativeModuleConfig.put("name", name)
|
|
139
|
+
reactNativeModuleConfig.put("nameCleansed", nameCleansed)
|
|
140
|
+
reactNativeModuleConfig.put("androidSourceDir", androidConfig["sourceDir"])
|
|
141
|
+
reactNativeModuleConfig.put("packageInstance", androidConfig["packageInstance"])
|
|
142
|
+
reactNativeModuleConfig.put("packageImportPath", androidConfig["packageImportPath"])
|
|
143
|
+
reactNativeModuleConfig.put("libraryName", androidConfig["libraryName"])
|
|
144
|
+
reactNativeModuleConfig.put("componentDescriptors", androidConfig["componentDescriptors"])
|
|
145
|
+
|
|
146
|
+
if (androidConfig["buildTypes"] && !androidConfig["buildTypes"].isEmpty()) {
|
|
147
|
+
reactNativeModulesBuildVariants.put(nameCleansed, androidConfig["buildTypes"])
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (androidConfig.containsKey("dependencyConfiguration")) {
|
|
151
|
+
reactNativeModuleConfig.put("dependencyConfiguration", androidConfig["dependencyConfiguration"])
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
reactNativeModules.add(reactNativeModuleConfig)
|
|
155
|
+
} else {
|
|
156
|
+
this.logger.debug("${LOG_PREFIX}Skipping native module '${name}' (no Android config or pure C++)")
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
this.logger.info("${LOG_PREFIX}Loaded ${reactNativeModules.size()} modules from autolinking.json")
|
|
161
|
+
return [reactNativeModules, reactNativeModulesBuildVariants]
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Fallback: Load from React Native CLI (RN < 0.76)
|
|
166
|
+
*/
|
|
167
|
+
private ArrayList loadFromReactNativeCli() {
|
|
168
|
+
this.logger.info("${LOG_PREFIX}Using React Native CLI fallback")
|
|
169
|
+
|
|
170
|
+
ArrayList<HashMap<String, String>> reactNativeModules = new ArrayList<HashMap<String, String>>()
|
|
171
|
+
HashMap<String, ArrayList> reactNativeModulesBuildVariants = new HashMap<String, ArrayList>()
|
|
172
|
+
|
|
173
|
+
try {
|
|
174
|
+
def cliResolveScript = "try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}"
|
|
175
|
+
String[] nodeCommand = ["node", "-e", cliResolveScript]
|
|
176
|
+
def cliPath = this.getCommandOutput(nodeCommand, this.root)
|
|
177
|
+
|
|
178
|
+
String[] reactNativeConfigCommand = ["node", cliPath, "config"]
|
|
179
|
+
def reactNativeConfigOutput = this.getCommandOutput(reactNativeConfigCommand, this.root)
|
|
180
|
+
|
|
181
|
+
def json = new JsonSlurper().parseText(reactNativeConfigOutput)
|
|
182
|
+
def dependencies = json["dependencies"]
|
|
183
|
+
def project = json["project"]["android"]
|
|
184
|
+
|
|
185
|
+
if (project == null) {
|
|
186
|
+
throw new Exception("React Native CLI failed to determine Android project configuration")
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
def engine = new SimpleTemplateEngine()
|
|
190
|
+
|
|
191
|
+
dependencies.each { name, value ->
|
|
192
|
+
def platformsConfig = value["platforms"]
|
|
193
|
+
def androidConfig = platformsConfig["android"]
|
|
194
|
+
|
|
195
|
+
if (androidConfig != null && androidConfig["sourceDir"] != null) {
|
|
196
|
+
this.logger.info("${LOG_PREFIX}Adding native module '${name}' from CLI")
|
|
197
|
+
|
|
198
|
+
HashMap reactNativeModuleConfig = new HashMap<String, String>()
|
|
199
|
+
def nameCleansed = name.replaceAll('[~*!\'()]+', '_').replaceAll('^@([\\w-.]+)/', '$1_')
|
|
200
|
+
|
|
201
|
+
reactNativeModuleConfig.put("name", name)
|
|
202
|
+
reactNativeModuleConfig.put("nameCleansed", nameCleansed)
|
|
203
|
+
reactNativeModuleConfig.put("androidSourceDir", androidConfig["sourceDir"])
|
|
204
|
+
reactNativeModuleConfig.put("packageInstance", androidConfig["packageInstance"])
|
|
205
|
+
reactNativeModuleConfig.put("packageImportPath", androidConfig["packageImportPath"])
|
|
206
|
+
reactNativeModuleConfig.put("libraryName", androidConfig["libraryName"])
|
|
207
|
+
reactNativeModuleConfig.put("componentDescriptors", androidConfig["componentDescriptors"])
|
|
208
|
+
|
|
209
|
+
if (androidConfig["buildTypes"] && !androidConfig["buildTypes"].isEmpty()) {
|
|
210
|
+
reactNativeModulesBuildVariants.put(nameCleansed, androidConfig["buildTypes"])
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (androidConfig.containsKey("dependencyConfiguration")) {
|
|
214
|
+
reactNativeModuleConfig.put("dependencyConfiguration", androidConfig["dependencyConfiguration"])
|
|
215
|
+
} else if (project.containsKey("dependencyConfiguration")) {
|
|
216
|
+
def bindings = ["dependencyName": nameCleansed]
|
|
217
|
+
def template = engine.createTemplate(project["dependencyConfiguration"]).make(bindings)
|
|
218
|
+
reactNativeModuleConfig.put("dependencyConfiguration", template.toString())
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
reactNativeModules.add(reactNativeModuleConfig)
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
this.logger.info("${LOG_PREFIX}Loaded ${reactNativeModules.size()} modules from React Native CLI")
|
|
226
|
+
return [reactNativeModules, reactNativeModulesBuildVariants]
|
|
227
|
+
|
|
228
|
+
} catch (Exception e) {
|
|
229
|
+
this.logger.error("${LOG_PREFIX}React Native CLI fallback failed: ${e.message}")
|
|
230
|
+
throw new Exception("Both autolinking.json and React Native CLI failed. Please ensure React Native is properly configured.")
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Add dynamic dependencies to the project
|
|
236
|
+
*/
|
|
237
|
+
void addReactNativeModuleDependencies(Project project) {
|
|
238
|
+
this.logger.info("${LOG_PREFIX}Adding ${reactNativeModules.size()} dynamic dependencies")
|
|
239
|
+
|
|
240
|
+
reactNativeModules.forEach { reactNativeModule ->
|
|
241
|
+
def nameCleansed = reactNativeModule["nameCleansed"]
|
|
242
|
+
def dependencyConfiguration = reactNativeModule["dependencyConfiguration"]
|
|
243
|
+
|
|
244
|
+
project.dependencies {
|
|
245
|
+
if (reactNativeModulesBuildVariants.containsKey(nameCleansed)) {
|
|
246
|
+
reactNativeModulesBuildVariants
|
|
247
|
+
.get(nameCleansed)
|
|
248
|
+
.forEach { buildVariant ->
|
|
249
|
+
if (dependencyConfiguration != null) {
|
|
250
|
+
add("${buildVariant}${dependencyConfiguration}", project.project(":${nameCleansed}"))
|
|
251
|
+
} else {
|
|
252
|
+
add("${buildVariant}Implementation", project.project(":${nameCleansed}"))
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
} else {
|
|
256
|
+
if(nameCleansed != "juspay-tech_react-native-hyperswitch") {
|
|
257
|
+
if (dependencyConfiguration != null) {
|
|
258
|
+
add("${dependencyConfiguration}", project.project(":${nameCleansed}"))
|
|
259
|
+
} else {
|
|
260
|
+
implementation project.project(":${nameCleansed}")
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
this.logger.debug("${LOG_PREFIX}Added dependency: ${nameCleansed}")
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Generate PackageList.java file
|
|
272
|
+
*/
|
|
273
|
+
void generatePackagesFile(File outputDir, String generatedFileName, String generatedFileContentsTemplate) {
|
|
274
|
+
ArrayList<HashMap<String, String>> packages = this.reactNativeModules
|
|
275
|
+
String packageName = this.packageName
|
|
276
|
+
String packageImports = ""
|
|
277
|
+
String packageClassInstances = ""
|
|
278
|
+
|
|
279
|
+
if (packages.size() > 0) {
|
|
280
|
+
def interpolateDynamicValues = { input ->
|
|
281
|
+
input.replaceAll(~/([^.\w])(BuildConfig|R)([^\w])/) { wholeString, prefix, className, suffix ->
|
|
282
|
+
"${prefix}${packageName}.${className}${suffix}"
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
packageImports = packages.collect {
|
|
287
|
+
"// ${it.name}\n${interpolateDynamicValues(it.packageImportPath)}"
|
|
288
|
+
}.join('\n')
|
|
289
|
+
|
|
290
|
+
packageClassInstances = ",\n " + packages.collect {
|
|
291
|
+
interpolateDynamicValues(it.packageInstance)
|
|
292
|
+
}.join(",\n ")
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
String generatedFileContents = generatedFileContentsTemplate
|
|
296
|
+
.replace("{{ packageImports }}", packageImports)
|
|
297
|
+
.replace("{{ packageClassInstances }}", packageClassInstances)
|
|
298
|
+
|
|
299
|
+
outputDir.mkdirs()
|
|
300
|
+
final FileTreeBuilder treeBuilder = new FileTreeBuilder(outputDir)
|
|
301
|
+
treeBuilder.file(generatedFileName).newWriter().withWriter { w ->
|
|
302
|
+
w << generatedFileContents
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
this.logger.info("${LOG_PREFIX}Generated PackageList.java with ${packages.size()} packages")
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Execute command and return output
|
|
310
|
+
*/
|
|
311
|
+
private String getCommandOutput(String[] command, File directory) {
|
|
312
|
+
try {
|
|
313
|
+
def cmdProcess = Runtime.getRuntime().exec(command, null, directory)
|
|
314
|
+
def bufferedReader = new BufferedReader(new InputStreamReader(cmdProcess.getInputStream()))
|
|
315
|
+
def readBuffer = new StringBuffer()
|
|
316
|
+
def buff = ""
|
|
317
|
+
|
|
318
|
+
while ((buff = bufferedReader.readLine()) != null) {
|
|
319
|
+
readBuffer.append(buff)
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
def output = readBuffer.toString()
|
|
323
|
+
if (!output) {
|
|
324
|
+
def bufferedErrorReader = new BufferedReader(new InputStreamReader(cmdProcess.getErrorStream()))
|
|
325
|
+
def readErrorBuffer = new StringBuffer()
|
|
326
|
+
def errBuff = ""
|
|
327
|
+
|
|
328
|
+
while ((errBuff = bufferedErrorReader.readLine()) != null) {
|
|
329
|
+
readErrorBuffer.append(errBuff)
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
throw new Exception("Command failed: ${readErrorBuffer.toString()}")
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return output
|
|
336
|
+
} catch (Exception exception) {
|
|
337
|
+
this.logger.error("${LOG_PREFIX}Command execution failed: ${exception.message}")
|
|
338
|
+
throw exception
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
def projectRoot = rootProject.projectDir
|
|
344
|
+
def hyperswitchAutolinking = new HyperswitchAutolinking(logger, projectRoot, rootProject)
|
|
345
|
+
|
|
346
|
+
ext.applyHyperswitchAutolinking = { Project project ->
|
|
347
|
+
// Add dynamic dependencies
|
|
348
|
+
hyperswitchAutolinking.addReactNativeModuleDependencies(project)
|
|
349
|
+
|
|
350
|
+
// Setup generation paths
|
|
351
|
+
def generatedSrcDir = new File(project.layout.buildDirectory.get().asFile, "generated/source/packagelist")
|
|
352
|
+
def generatedCodeDir = new File(generatedSrcDir, generatedFilePackage.replace('.', '/'))
|
|
353
|
+
|
|
354
|
+
// Create the generation task
|
|
355
|
+
project.tasks.register('generatePackageList') {
|
|
356
|
+
group = "hyperswitch"
|
|
357
|
+
description = "Generates PackageList.java for Hyperswitch SDK"
|
|
358
|
+
|
|
359
|
+
outputs.dir(generatedCodeDir)
|
|
360
|
+
outputs.upToDateWhen { false }
|
|
361
|
+
|
|
362
|
+
doLast {
|
|
363
|
+
hyperswitchAutolinking.generatePackagesFile(generatedCodeDir, "${generatedClassName}.java", generatedFileContentsTemplate)
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
project.preBuild.dependsOn project.generatePackageList
|
|
368
|
+
|
|
369
|
+
project.android {
|
|
370
|
+
sourceSets {
|
|
371
|
+
main {
|
|
372
|
+
java {
|
|
373
|
+
srcDirs += generatedSrcDir
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Hyperswitch SDK ProGuard Rules
|
|
2
|
+
|
|
3
|
+
# Keep public classes and methods that are part of the SDK API
|
|
4
|
+
-keep public class com.hyperswitchsdkreactnative.** {
|
|
5
|
+
public *;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
# Keep React Native module classes
|
|
9
|
+
-keep class com.hyperswitchsdkreactnative.modules.** { *; }
|
|
10
|
+
-keep class com.hyperswitchsdkreactnative.provider.** { *; }
|
|
11
|
+
-keep class com.hyperswitchsdkreactnative.gpay.** { *; }
|
|
12
|
+
-keep class com.hyperswitchsdkreactnative.utils.** { *; }
|
|
13
|
+
|
|
14
|
+
# Keep annotation classes
|
|
15
|
+
-keepattributes *Annotation*
|
|
16
|
+
-keepattributes RuntimeVisibleAnnotations
|
|
17
|
+
-keepattributes RuntimeInvisibleAnnotations
|
|
18
|
+
|
|
19
|
+
# Keep Kotlin metadata
|
|
20
|
+
-keep class kotlin.Metadata { *; }
|
|
21
|
+
-keep class kotlin.jvm.internal.Intrinsics { *; }
|
|
22
|
+
|
|
23
|
+
# Keep React Native classes
|
|
24
|
+
-keep class com.facebook.react.** { *; }
|
|
25
|
+
-keep class com.facebook.react.bridge.** { *; }
|
|
26
|
+
-keep class com.facebook.react.uimanager.** { *; }
|
|
27
|
+
|
|
28
|
+
# Keep Google Pay classes
|
|
29
|
+
-keep class com.google.android.gms.wallet.** { *; }
|
|
30
|
+
-keep class com.google.android.gms.common.api.** { *; }
|
|
31
|
+
|
|
32
|
+
# Keep AndroidX classes that are commonly used
|
|
33
|
+
-keep class androidx.lifecycle.** { *; }
|
|
34
|
+
-keep class androidx.fragment.** { *; }
|
|
35
|
+
-keep class androidx.activity.** { *; }
|
|
36
|
+
|
|
37
|
+
# Keep enum classes
|
|
38
|
+
-keepclassmembers enum * {
|
|
39
|
+
public static **[] values();
|
|
40
|
+
public static ** valueOf(java.lang.String);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
# Keep serializable classes
|
|
44
|
+
-keepnames class * implements java.io.Serializable
|
|
45
|
+
-keepclassmembers class * implements java.io.Serializable {
|
|
46
|
+
static final long serialVersionUID;
|
|
47
|
+
private static final java.io.ObjectStreamField[] serialPersistentFields;
|
|
48
|
+
!static !transient <fields>;
|
|
49
|
+
!private <methods>;
|
|
50
|
+
private void writeObject(java.io.ObjectOutputStream);
|
|
51
|
+
private void readObject(java.io.ObjectInputStream);
|
|
52
|
+
java.lang.Object writeReplace();
|
|
53
|
+
java.lang.Object readResolve();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
# Keep callback methods
|
|
57
|
+
-keepclassmembers class * {
|
|
58
|
+
@android.webkit.JavascriptInterface <methods>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
# Keep promise-related classes
|
|
62
|
+
-keep class com.facebook.react.bridge.Promise { *; }
|
|
63
|
+
-keep class com.facebook.react.bridge.WritableMap { *; }
|
|
64
|
+
-keep class com.facebook.react.bridge.ReadableMap { *; }
|
|
65
|
+
|
|
66
|
+
# Optimization settings
|
|
67
|
+
-optimizationpasses 5
|
|
68
|
+
-dontusemixedcaseclassnames
|
|
69
|
+
-dontskipnonpubliclibraryclasses
|
|
70
|
+
-dontpreverify
|
|
71
|
+
-verbose
|
|
72
|
+
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<manifest xmlns:tools="http://schemas.android.com/tools"
|
|
2
|
+
xmlns:android="http://schemas.android.com/apk/res/android">
|
|
3
|
+
<application android:enableOnBackInvokedCallback="true"
|
|
4
|
+
tools:targetApi="33">
|
|
5
|
+
<meta-data android:name="com.google.android.gms.wallet.api.enabled" android:value="true" />
|
|
6
|
+
<activity android:enableOnBackInvokedCallback="true"
|
|
7
|
+
tools:targetApi="33" android:name="com.hyperswitchsdkreactnative.gpay.GooglePayActivity" android:exported="false">
|
|
8
|
+
</activity>
|
|
9
|
+
<activity
|
|
10
|
+
android:name=".activity.RedirectActivity"
|
|
11
|
+
android:exported="true"
|
|
12
|
+
android:launchMode="singleTask"
|
|
13
|
+
>
|
|
14
|
+
<intent-filter android:autoVerify="true">
|
|
15
|
+
<action android:name="android.intent.action.VIEW" />
|
|
16
|
+
|
|
17
|
+
<category android:name="android.intent.category.DEFAULT" />
|
|
18
|
+
<category android:name="android.intent.category.BROWSABLE" />
|
|
19
|
+
|
|
20
|
+
<data android:scheme="${applicationId}.hyperswitch" />
|
|
21
|
+
<data android:host="" tools:ignore="AppLinkUrlError" />
|
|
22
|
+
</intent-filter>
|
|
23
|
+
</activity>
|
|
24
|
+
</application>
|
|
25
|
+
</manifest>
|