Skip to content

Commit a41410c

Browse files
committed
refactor: update updateCart method to public in ReactIterableAPI and enhance Objective-C bridge for improved cart update functionality
1 parent f8ce6b6 commit a41410c

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

ios/RNIterableAPI/RNIterableAPI.mm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,12 @@ - (void)inAppConsume:(NSString *)messageId
204204
[_swiftAPI inAppConsume:messageId location:location source:source];
205205
}
206206

207+
- (void)updateCart:(NSArray *)items
208+
{
209+
NSLog(@"ReactNativeSdk updateCart");
210+
[_swiftAPI updateCart:items];
211+
}
212+
207213
@end
208214

209215

ios/RNIterableAPI/ReactIterableAPI.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ open class ReactIterableAPI: RCTEventEmitter {
200200
}
201201

202202
@objc(updateCart:)
203-
func updateCart(items: [[AnyHashable: Any]]) {
203+
public func updateCart(items: [[AnyHashable: Any]]) {
204204
ITBInfo()
205205
IterableAPI.updateCart(items: items.compactMap(CommerceItem.from(dict:)))
206206
}

src/api/NativeRNIterableAPI.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ export interface Spec extends TurboModule {
7979
): void;
8080
inAppConsume(messageId: string, location: number, source: number): void;
8181

82-
// // Commerce
83-
// updateCart(items: { [key: string]: string | number | boolean }[]): void;
82+
// Commerce
83+
updateCart(items: { [key: string]: string | number | boolean }[]): void;
8484
// trackPurchase(
8585
// total: number,
8686
// items: { [key: string]: string | number | boolean }[],

src/core/classes/Iterable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ export class Iterable {
447447
static updateCart(items: IterableCommerceItem[]) {
448448
Iterable?.logger?.log('updateCart');
449449

450-
RNIterableAPI.updateCart(items);
450+
api.updateCart(items);
451451
}
452452

453453
/**

0 commit comments

Comments
 (0)