|
46 | 46 | #import "NSError+Branch.h" |
47 | 47 | #import "BNCLog.h" |
48 | 48 | #import "UIViewController+Branch.h" |
49 | | -#import <StoreKit/StoreKit.h> |
50 | 49 | #import "BNCReferringURLUtility.h" |
51 | 50 |
|
52 | 51 | #if !TARGET_OS_TV |
@@ -126,7 +125,7 @@ typedef NS_ENUM(NSInteger, BNCInitStatus) { |
126 | 125 | BNCInitStatusInitialized |
127 | 126 | }; |
128 | 127 |
|
129 | | -@interface Branch() <BranchDeepLinkingControllerCompletionDelegate, SKPaymentTransactionObserver> { |
| 128 | +@interface Branch() <BranchDeepLinkingControllerCompletionDelegate> { |
130 | 129 | NSInteger _networkCount; |
131 | 130 | BNCURLFilter *_userURLFilter; |
132 | 131 | } |
@@ -1677,10 +1676,6 @@ + (Branch *)getInstanceInternal:(NSString *)key { |
1677 | 1676 | cache:[[BNCLinkCache alloc] init] |
1678 | 1677 | preferenceHelper:preferenceHelper |
1679 | 1678 | key:key]; |
1680 | | - |
1681 | | - if ([BNCPreferenceHelper sharedInstance].logInAppPurchasesAsBranchEvents == YES) { |
1682 | | - [[SKPaymentQueue defaultQueue] addTransactionObserver:branch]; |
1683 | | - } |
1684 | 1679 | }); |
1685 | 1680 | return branch; |
1686 | 1681 | } |
@@ -2602,51 +2597,4 @@ + (void) clearAll { |
2602 | 2597 | [BNCPreferenceHelper clearAll]; |
2603 | 2598 | } |
2604 | 2599 |
|
2605 | | -#pragma mark - SKPaymentTransactionObserver Methods |
2606 | | -+ (void)setLogInAppPurchasesAsEventsEnabled:(BOOL)enabled { |
2607 | | - @synchronized(self) { |
2608 | | - if (enabled) { |
2609 | | - [BNCPreferenceHelper sharedInstance].logInAppPurchasesAsBranchEvents = YES; |
2610 | | - } else { |
2611 | | - [BNCPreferenceHelper sharedInstance].logInAppPurchasesAsBranchEvents = NO; |
2612 | | - } |
2613 | | - } |
2614 | | -} |
2615 | | - |
2616 | | -+ (BOOL)logInAppPurchasesBranchEventsEnabled { |
2617 | | - @synchronized(self) { |
2618 | | - return [BNCPreferenceHelper sharedInstance].logInAppPurchasesAsBranchEvents; |
2619 | | - } |
2620 | | -} |
2621 | | - |
2622 | | -//Logs incoming in-app purchases as events |
2623 | | -- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray<SKPaymentTransaction *> *)transactions { |
2624 | | - for (SKPaymentTransaction *transaction in transactions) { |
2625 | | - switch (transaction.transactionState) { |
2626 | | - case SKPaymentTransactionStatePurchased: { |
2627 | | - |
2628 | | - [[SKPaymentQueue defaultQueue] finishTransaction:(SKPaymentTransaction *)transaction]; |
2629 | | - |
2630 | | - if ([BNCPreferenceHelper sharedInstance].logInAppPurchasesAsBranchEvents == YES) { |
2631 | | - BNCLogDebug([NSString stringWithFormat:@"Automatically logging transaction as Branch event."]); |
2632 | | - |
2633 | | - BranchEvent *event = [BranchEvent standardEvent:BranchStandardEventPurchase]; |
2634 | | - [event logEventWithTransaction:transaction]; |
2635 | | - } |
2636 | | - break; |
2637 | | - } |
2638 | | - case SKPaymentTransactionStateFailed: { |
2639 | | - [[SKPaymentQueue defaultQueue] finishTransaction:(SKPaymentTransaction *)transaction]; |
2640 | | - break; |
2641 | | - } |
2642 | | - case SKPaymentTransactionStateRestored: { |
2643 | | - [[SKPaymentQueue defaultQueue] finishTransaction:(SKPaymentTransaction *)transaction]; |
2644 | | - break; |
2645 | | - } |
2646 | | - default: |
2647 | | - break; |
2648 | | - } |
2649 | | - } |
2650 | | -} |
2651 | | - |
2652 | 2600 | @end |
0 commit comments