Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift5.2 update #257

Merged
merged 2 commits into from
Apr 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions ios/RazorpayCheckout.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
#import "RazorpayCheckout.h"
#import "RazorpayEventEmitter.h"

//#import <Razorpay/Razorpay.h>
#import <Razorpay/Razorpay-Swift.h>

typedef RazorpayCheckout Razorpay;

@interface RazorpayCheckout () <RazorpayPaymentCompletionProtocolWithData,
ExternalWalletSelectionProtocol>

Expand All @@ -29,9 +30,52 @@ @implementation RazorpayCheckout
andDelegateWithData:self];
[razorpay setExternalWalletSelectionDelegate:self];

[razorpay open:options];
NSMutableDictionary * tempOptions = [[NSMutableDictionary alloc] initWithDictionary:options];
// tempOptions[@"integration_version"] = [self findReactNativeVersion];
tempOptions[@"integration"] = @"react-native";
tempOptions[@"FRAMEWORK"] = @"react-native";
[razorpay open:tempOptions];
});
}

/*
- (NSString *)findReactNativeVersion {
static dispatch_once_t onceToken;
static NSString *BSGReactNativeVersion = nil;
dispatch_once(&onceToken, ^{
#ifdef RCT_REACT_NATIVE_VERSION
// for react-native versions prior 0.55
// see https://github.com/react-native-community/releases/blob/451f8e7fa53f80daec9c2381c7984bee73efa51d/CHANGELOG.md#ios-specific-additions
NSDictionary *versionMap = RCT_REACT_NATIVE_VERSION;
#else
NSDictionary *versionMap = RCTGetReactNativeVersion();
#endif
NSNumber *major = versionMap[@"major"];
NSNumber *minor = versionMap[@"minor"];
NSNumber *patch = versionMap[@"patch"];
NSString *prerelease = versionMap[@"prerelease"];
NSMutableString *versionString = [NSMutableString new];

if (![major isEqual:[NSNull null]]) {
[versionString appendString:[major stringValue]];
[versionString appendString:@"."];
}
if (![minor isEqual:[NSNull null]]) {
[versionString appendString:[minor stringValue]];
[versionString appendString:@"."];
}
if (![patch isEqual:[NSNull null]]) {
[versionString appendString:[patch stringValue]];
}
if (![prerelease isEqual:[NSNull null]]) {
[versionString appendString:@"-"];
[versionString appendString:prerelease];
}
BSGReactNativeVersion = [NSString stringWithString:versionString];
});
return BSGReactNativeVersion;
}
*/

- (void)onPaymentSuccess:(nonnull NSString *)payment_id
andData:(nullable NSDictionary *)response {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-razorpay",
"version": "2.1.32",
"version": "2.1.33",
"description": "React Native wrapper for Razorpay",
"main": "RazorpayCheckout.js",
"scripts": {
Expand Down