-
Notifications
You must be signed in to change notification settings - Fork 0
Changes to support 4.45.0 version of Braintree. #22
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,7 +35,8 @@ + (instancetype)sharedInstance { | |
| - (instancetype)init | ||
| { | ||
| if (self = [super init]) { | ||
| self.dataCollector = [[BTDataCollector alloc] initWithAPIClient:self.braintreeClient]; | ||
| // Don't initialize dataCollector here - braintreeClient is nil at init time | ||
| // DataCollector will be initialized in setupWithClientToken after braintreeClient is ready | ||
| } | ||
| return self; | ||
| } | ||
|
|
@@ -50,11 +51,13 @@ - (instancetype)init | |
|
|
||
| self.braintreeClient = [[BTAPIClient alloc] initWithAuthorization:clientToken]; | ||
|
|
||
| if (self.braintreeClient == nil) { | ||
| callback(@[@(NO)]); | ||
| // Initialize DataCollector after braintreeClient is ready (required for 4.45.0+) | ||
| if (self.braintreeClient != nil) { | ||
| self.dataCollector = [[BTDataCollector alloc] initWithAPIClient:self.braintreeClient]; | ||
| callback(@[@(YES)]); | ||
| } | ||
| else { | ||
| callback(@[@(YES)]); | ||
| callback(@[@(NO)]); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -237,35 +240,31 @@ - (BTCard*)createCardWithParameters:(NSMutableDictionary*)parameters | |
| { | ||
| dispatch_async(dispatch_get_main_queue(), ^{ | ||
| NSError *error = nil; | ||
| NSString *deviceData = nil; | ||
| NSString *dataSelector = options[@"dataCollector"]; | ||
|
|
||
| //Initialize the data collector in V5 | ||
| self.dataCollector = [[BTDataCollector alloc] initWithAPIClient: self.braintreeClient]; | ||
| // Ensure dataCollector is initialized (should already be done in setupWithClientToken) | ||
| if (self.dataCollector == nil && self.braintreeClient != nil) { | ||
| self.dataCollector = [[BTDataCollector alloc] initWithAPIClient:self.braintreeClient]; | ||
| } | ||
|
|
||
| //Data collection methods | ||
| if ([dataSelector isEqualToString:@"card"] || [dataSelector isEqualToString:@"both"]) { | ||
| [self.dataCollector collectDeviceData:^(NSString * _Nonnull deviceData) { | ||
| deviceData = deviceData; | ||
| // collectDeviceData is async - callback is called in completion block | ||
| [self.dataCollector collectDeviceData:^(NSString * _Nonnull collectedData) { | ||
| callback(@[[NSNull null], collectedData]); | ||
| }]; | ||
| return; // Early return - callback is called in completion block | ||
|
Comment on lines
+252
to
+256
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: In the current Braintree iOS SDK,
Sources: Braintree-generated reference docs for Fix The completion block signature is incorrect. The Braintree iOS SDK's - (void)collectDeviceData:(void (^ _Nonnull)(NSString * _Nullable deviceData, NSError * _Nullable error))completion;The code only accepts one parameter Additionally, update the block to handle both the 🤖 Prompt for AI Agents |
||
| } else if ([dataSelector isEqualToString:@"paypal"] || [dataSelector isEqualToString:@"venmo"]) { | ||
| deviceData = [PPDataCollector collectPayPalDeviceData]; | ||
| NSString *deviceData = [PPDataCollector collectPayPalDeviceData]; | ||
| callback(@[[NSNull null], deviceData]); | ||
|
Comment on lines
257
to
+259
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: find . -type f \( -name "Podfile" -o -name "*.podspec" \) | head -20Repository: skillz/react-native-braintree-custom-ui Length of output: 65 🏁 Script executed: rg "PPDataCollector|Braintree" -g "*.m" -g "*.h" -g "Podfile" -g "*.podspec" --max-count=50Repository: skillz/react-native-braintree-custom-ui Length of output: 1213 🏁 Script executed: rg "import.*Braintree|#import.*Braintree" -g "*.m" -g "*.h" -A 2Repository: skillz/react-native-braintree-custom-ui Length of output: 617 🏁 Script executed: find . -name "Podfile" -o -name "*.podspec" | xargs cat 2>/dev/nullRepository: skillz/react-native-braintree-custom-ui Length of output: 65 🏁 Script executed: rg "pod.*Braintree" -A 2 -B 2Repository: skillz/react-native-braintree-custom-ui Length of output: 65 🏁 Script executed: ls -laRepository: skillz/react-native-braintree-custom-ui Length of output: 906 🏁 Script executed: git log --oneline --all -- ios/RCTBraintree/ | head -20Repository: skillz/react-native-braintree-custom-ui Length of output: 1237 🌐 Web query:
💡 Result:
v5 (has
|
||
| } else { | ||
| NSMutableDictionary* details = [NSMutableDictionary dictionary]; | ||
| [details setValue:@"Invalid data collector" forKey:NSLocalizedDescriptionKey]; | ||
| error = [NSError errorWithDomain:@"RCTBraintree" code:255 userInfo:details]; | ||
|
|
||
| SKZLog(@"Invalid data collector: %@. Use one of: `card`, `paypal`, or `both`", dataSelector); | ||
| callback(@[error.description, [NSNull null]]); | ||
| } | ||
|
|
||
| NSArray *args = @[]; | ||
| if (error == nil) { | ||
| args = @[[NSNull null], deviceData]; | ||
| } else { | ||
| args = @[error.description, [NSNull null]]; | ||
| } | ||
|
|
||
| callback(args); | ||
| }); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: skillz/react-native-braintree-custom-ui
Length of output: 294
React-native 0.61.5 does not exist on Maven Central and will cause build failures.
While the Braintree v4 modular artifacts (card, data-collector, paypal, venmo) at version 4.45.0 are correctly published and accessible,
react-native:0.61.5returns HTTP 404 and cannot be resolved. This is a blocking issue that will prevent the build from succeeding. Verify the correct available version for react-native or update to a version that exists on Maven Central.The
compileOnlyconfiguration is appropriate for a library module, but it won't help if the dependency cannot be resolved in the first place.🤖 Prompt for AI Agents