From b61fc7d727d27232c22073bc2c7d55eef1d55766 Mon Sep 17 00:00:00 2001 From: Subhash Chandra Date: Thu, 26 Dec 2024 19:46:41 +0530 Subject: [PATCH 1/2] fix: added openPaymentPage in iOS plugin --- README.md | 6 +- example/ios/HyperSdkReactExample/Info.plist | 4 ++ .../ios/HyperSdkReactExampleTests/Info.plist | 4 ++ example/ios/Podfile.lock | 12 ++-- hyper-sdk-react.podspec | 2 +- ios/HyperSdkReact.mm | 55 ++++++++++++++----- 6 files changed, 60 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 78e5d1b..4a7f4ec 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ buildscript { ext { .... clientId = "" - hyperSDKVersion = "2.1.25" + hyperSDKVersion = "2.1.33" .... } .... @@ -55,7 +55,7 @@ pod install "devDependencies": { .... }, - "hyperSdkIOSVersion": "2.1.39" + "hyperSdkIOSVersion": "2.2.2" .... } ``` @@ -64,7 +64,7 @@ Note: This version is just for explanatory purposes and may change in future. Co #### **Dynamic Assets iOS** -Change the `hyperSdkIOSVersion` to `2.1.39` (This version is just for explanatory purposes and may change in future. Contact Juspay support team for the latest SDK version). +Change the `hyperSdkIOSVersion` to `2.2.2` (This version is just for explanatory purposes and may change in future. Contact Juspay support team for the latest SDK version). Add below post_install script in the Podfile diff --git a/example/ios/HyperSdkReactExample/Info.plist b/example/ios/HyperSdkReactExample/Info.plist index e98e5a4..dbd373a 100644 --- a/example/ios/HyperSdkReactExample/Info.plist +++ b/example/ios/HyperSdkReactExample/Info.plist @@ -50,6 +50,10 @@ ppe amazonpay cugext + kiwi + navipay + mobikwik + tatadigital LSRequiresIPhoneOS diff --git a/example/ios/HyperSdkReactExampleTests/Info.plist b/example/ios/HyperSdkReactExampleTests/Info.plist index 7da9c3f..8330747 100644 --- a/example/ios/HyperSdkReactExampleTests/Info.plist +++ b/example/ios/HyperSdkReactExampleTests/Info.plist @@ -48,6 +48,10 @@ ppe amazonpay cugext + kiwi + navipay + mobikwik + tatadigital diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 2df8a0d..242fcd2 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -74,10 +74,10 @@ PODS: - hermes-engine (0.72.15): - hermes-engine/Pre-built (= 0.72.15) - hermes-engine/Pre-built (0.72.15) - - hyper-sdk-react (3.0.39): - - HyperSDK (= 2.2.1.4) + - hyper-sdk-react (3.0.41): + - HyperSDK (= 2.2.2) - React-Core - - HyperSDK (2.2.1.4): + - HyperSDK (2.2.2): - JuspaySafeBrowser (= 0.1.84) - Salvator (= 1.0.6) - JuspaySafeBrowser (0.1.84) @@ -715,8 +715,8 @@ SPEC CHECKSUMS: fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b hermes-engine: 5b340c6a5affbf3aba22185be41563bbb2426654 - hyper-sdk-react: 600f3fe60c3010e5218ec28405796a5abaa02a49 - HyperSDK: 5ea42ab6795ea239d449d1803e72968521cce198 + hyper-sdk-react: 50ca138c0003e944a47e4f12f1f8a42566f4f640 + HyperSDK: 653f618de09696305b9b705555019ecbbacc10b0 JuspaySafeBrowser: caa2c1a54405f30210ba9d324cf79224e719134d libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c @@ -764,4 +764,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 9d75834eee1caf39c2287e0b86b419d59ce7fbd1 -COCOAPODS: 1.15.2 +COCOAPODS: 1.16.2 diff --git a/hyper-sdk-react.podspec b/hyper-sdk-react.podspec index 59bb55f..220980e 100644 --- a/hyper-sdk-react.podspec +++ b/hyper-sdk-react.podspec @@ -3,7 +3,7 @@ require "json" package = JSON.parse(File.read(File.join(__dir__, "package.json"))) folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' -hyper_sdk_version = "2.2.1.4" +hyper_sdk_version = "2.2.2" begin package_json_path = File.expand_path(File.join(__dir__, "../../package.json")) diff --git a/ios/HyperSdkReact.mm b/ios/HyperSdkReact.mm index 1c60657..f3b0424 100644 --- a/ios/HyperSdkReact.mm +++ b/ios/HyperSdkReact.mm @@ -33,7 +33,7 @@ -(void)didMoveToSuperview { if (self.trailing.isActive) { self.trailing.active = @NO; } - + //Checking superview just to be sure that it is not nil if(self.superview) { // Create contraints to replicate wrapcontent @@ -72,12 +72,12 @@ - (void) setHeight: (NSNumber*)height forTag: (NSString * _Nonnull)tag { // Update the latest value of the height holder for the given tag // This will be used to set the height of view if view is created at a later point [self.heightHolder setObject: height forKey:tag]; - + // Fetch previous height constraint so that it can be set to inactive NSLayoutConstraint *heightConstraint = [self.heightConstraintHolder objectForKey:tag]; // Fetch rootview to update set constraints if view is already created UIView *rootView = [self.rootHolder objectForKey:tag]; - + // Check if view is already present if (rootView && [rootView isKindOfClass: [UIView class]]) { // If present set earlier constraint to inactive @@ -98,7 +98,7 @@ - (void) setHeight: (NSNumber*)height forTag: (NSString * _Nonnull)tag { Use bridge to share the same JS VM */ - (UIView * _Nullable)merchantViewForViewType:(NSString * _Nonnull)viewType { - + // Create a SDKRootView so that we can attach width constraints once it is attached to it's parent RCTRootView *rrv = [SDKRootView alloc]; NSString *moduleName = @"JP_003"; @@ -111,23 +111,23 @@ - (UIView * _Nullable)merchantViewForViewType:(NSString * _Nonnull)viewType { } else if ([viewType isEqual:@"FOOTER_ATTACHED"] && [registeredComponents containsObject:@"JuspayFooterAttached"]) { moduleName = @"JuspayFooterAttached"; } - + // Save a reference of the react root view // This will be used to update height constraint if a newer value is sent by the merchant [self.rootHolder setObject:rrv forKey:moduleName]; - - + + rrv = [rrv initWithBridge: self.bridge moduleName:moduleName initialProperties:nil ]; - + // Remove background colour. Default colour white is getting applied to the merchant view rrv.backgroundColor = UIColor.clearColor ; - + // Remove height 0, width 0 constraints added by default. rrv.translatesAutoresizingMaskIntoConstraints = false; - + // If height is available set the height NSNumber *height = [self.heightHolder objectForKey:moduleName]; if (height && [height isKindOfClass:[NSNumber class]]) { @@ -193,7 +193,7 @@ -(void)stopObserving { if (jsonData && [jsonData isKindOfClass:[NSDictionary class]] && jsonData.allKeys.count>0) { [HyperServices preFetch:jsonData]; } else { - + } } @catch (NSException *exception) { //Parsing failure. @@ -213,7 +213,7 @@ -(void)stopObserving { @try { NSDictionary *jsonData = [HyperSdkReact stringToDictionary:data]; if (jsonData && [jsonData isKindOfClass:[NSDictionary class]] && jsonData.allKeys.count>0) { - + UIViewController *baseViewController = RCTPresentedViewController(); __weak HyperSdkReact *weakSelf = self; self.delegate = [[SdkDelegate alloc] initWithBridge:self.bridge]; @@ -267,6 +267,35 @@ -(void)stopObserving { } } +RCT_EXPORT_METHOD(openPaymentPage:(NSString *)data) { + if (data && data.length>0) { + @try { + NSDictionary *sdkPayload = [HyperSdkReact stringToDictionary:data]; + // Update baseViewController if it's nil or not in the view hierarchy. + if (sdkPayload && [sdkPayload isKindOfClass:[NSDictionary class]] && sdkPayload.allKeys.count>0) { + + id baseViewController = RCTPresentedViewController(); + + __weak HyperSdkReact *weakSelf = self; + self.delegate = [[SdkDelegate alloc] initWithBridge:self.bridge]; + [_hyperInstance setHyperDelegate: _delegate]; + [HyperCheckoutLite openPaymentPage:baseViewController payload:sdkPayload callback:^(NSDictionary * _Nullable data) { + [weakSelf sendEventWithName:@"HyperEvent" body:[[self class] dictionaryToString:data]]; + }]; + } else { +// Define proper error code and return proper error +// [self sendEventWithName:@"HyperEvent" body:[[self class] dictionaryToString:data]]; + } + } @catch (NSException *exception) { + // Define proper error code and return proper error + // [self sendEventWithName:@"HyperEvent" body:[[self class] dictionaryToString:data]]; + } + } else { + // Define proper error code and return proper error + // [self sendEventWithName:@"HyperEvent" body:[[self class] dictionaryToString:data]]; + } +} + RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(isNull) { return self.hyperInstance == NULL? @true : @false; } @@ -375,7 +404,7 @@ - (UIView *)view - (void)manuallyLayoutChildren:(UIView *)view { UIView *parent = view.superview; if (!parent) return; - + view.frame = parent.bounds; } From 9373d8a00b8c3977e6058eb027e42c9e72997987 Mon Sep 17 00:00:00 2001 From: Subhash Chandra Date: Fri, 27 Dec 2024 13:19:22 +0530 Subject: [PATCH 2/2] fix: updated android SDK version to 2.2.1 --- README.md | 2 +- android/build.gradle | 2 +- example/android/build.gradle | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4a7f4ec..6e31146 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ buildscript { ext { .... clientId = "" - hyperSDKVersion = "2.1.33" + hyperSDKVersion = "2.2.1" .... } .... diff --git a/android/build.gradle b/android/build.gradle index 8cb2e99..e1152bd 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -91,7 +91,7 @@ static def mostRecentVersion(List versions) { } static def getHyperSDKVersion(rootProject) { - def hyperSdkVersion = '2.1.33' + def hyperSdkVersion = '2.2.1' if (!rootProject.hasProperty('hyperSDKVersion')) { return hyperSdkVersion } diff --git a/example/android/build.gradle b/example/android/build.gradle index 0d77e4f..8c8ab62 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -12,7 +12,7 @@ buildscript { // Hyper SDK clientId = 'geddit' - hyperSDKVersion = "2.1.33" + hyperSDKVersion = "2.2.1" excludedMicroSDKs = [] } repositories {