|
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 |
@@ -125,7 +124,7 @@ typedef NS_ENUM(NSInteger, BNCInitStatus) { |
125 | 124 | BNCInitStatusInitialized |
126 | 125 | }; |
127 | 126 |
|
128 | | -@interface Branch() <BranchDeepLinkingControllerCompletionDelegate, SKPaymentTransactionObserver> { |
| 127 | +@interface Branch() <BranchDeepLinkingControllerCompletionDelegate> { |
129 | 128 | NSInteger _networkCount; |
130 | 129 | BNCURLFilter *_userURLFilter; |
131 | 130 | } |
@@ -1641,10 +1640,6 @@ + (Branch *)getInstanceInternal:(NSString *)key { |
1641 | 1640 | cache:[[BNCLinkCache alloc] init] |
1642 | 1641 | preferenceHelper:preferenceHelper |
1643 | 1642 | key:key]; |
1644 | | - |
1645 | | - if ([BNCPreferenceHelper sharedInstance].logInAppPurchasesAsBranchEvents == YES) { |
1646 | | - [[SKPaymentQueue defaultQueue] addTransactionObserver:branch]; |
1647 | | - } |
1648 | 1643 | }); |
1649 | 1644 | return branch; |
1650 | 1645 | } |
@@ -2566,51 +2561,4 @@ + (void) clearAll { |
2566 | 2561 | [BNCPreferenceHelper clearAll]; |
2567 | 2562 | } |
2568 | 2563 |
|
2569 | | -#pragma mark - SKPaymentTransactionObserver Methods |
2570 | | -+ (void)setLogInAppPurchasesAsEventsEnabled:(BOOL)enabled { |
2571 | | - @synchronized(self) { |
2572 | | - if (enabled) { |
2573 | | - [BNCPreferenceHelper sharedInstance].logInAppPurchasesAsBranchEvents = YES; |
2574 | | - } else { |
2575 | | - [BNCPreferenceHelper sharedInstance].logInAppPurchasesAsBranchEvents = NO; |
2576 | | - } |
2577 | | - } |
2578 | | -} |
2579 | | - |
2580 | | -+ (BOOL)logInAppPurchasesBranchEventsEnabled { |
2581 | | - @synchronized(self) { |
2582 | | - return [BNCPreferenceHelper sharedInstance].logInAppPurchasesAsBranchEvents; |
2583 | | - } |
2584 | | -} |
2585 | | - |
2586 | | -//Logs incoming in-app purchases as events |
2587 | | -- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray<SKPaymentTransaction *> *)transactions { |
2588 | | - for (SKPaymentTransaction *transaction in transactions) { |
2589 | | - switch (transaction.transactionState) { |
2590 | | - case SKPaymentTransactionStatePurchased: { |
2591 | | - |
2592 | | - [[SKPaymentQueue defaultQueue] finishTransaction:(SKPaymentTransaction *)transaction]; |
2593 | | - |
2594 | | - if ([BNCPreferenceHelper sharedInstance].logInAppPurchasesAsBranchEvents == YES) { |
2595 | | - BNCLogDebug([NSString stringWithFormat:@"Automatically logging transaction as Branch event."]); |
2596 | | - |
2597 | | - BranchEvent *event = [BranchEvent standardEvent:BranchStandardEventPurchase]; |
2598 | | - [event logEventWithTransaction:transaction]; |
2599 | | - } |
2600 | | - break; |
2601 | | - } |
2602 | | - case SKPaymentTransactionStateFailed: { |
2603 | | - [[SKPaymentQueue defaultQueue] finishTransaction:(SKPaymentTransaction *)transaction]; |
2604 | | - break; |
2605 | | - } |
2606 | | - case SKPaymentTransactionStateRestored: { |
2607 | | - [[SKPaymentQueue defaultQueue] finishTransaction:(SKPaymentTransaction *)transaction]; |
2608 | | - break; |
2609 | | - } |
2610 | | - default: |
2611 | | - break; |
2612 | | - } |
2613 | | - } |
2614 | | -} |
2615 | | - |
2616 | 2564 | @end |
0 commit comments