Skip to content

Commit 1f4a55c

Browse files
committed
Removed validation and auto-logging code
1 parent 8a06e0e commit 1f4a55c

File tree

8 files changed

+11
-96
lines changed

8 files changed

+11
-96
lines changed

Branch-TestBed/Branch-TestBed/AppDelegate.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ - (BOOL)application:(UIApplication *)application
6161

6262
[self setLogFile:@"OpenNInstall"];
6363
// [branch setIdentity:@"Bobby Branch"];
64-
65-
[Branch setLogInAppPurchasesAsEventsEnabled:true];
66-
64+
6765
[branch initSessionWithLaunchOptions:launchOptions
6866
andRegisterDeepLinkHandlerUsingBranchUniversalObject:
6967
^ (BranchUniversalObject * _Nullable universalObject, BranchLinkProperties * _Nullable linkProperties, NSError * _Nullable error) {

BranchSDK/BNCAppleReceipt.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ NS_ASSUME_NONNULL_BEGIN
2121
// this is only available on builds from Apple
2222
- (nullable NSString *)installReceipt;
2323
- (BOOL)isTestFlight;
24-
+ (BOOL)isReceiptValid;
2524

2625
@end
2726

BranchSDK/BNCAppleReceipt.m

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,4 @@ - (BOOL)isTestFlight {
6363
return self.isSandboxReceipt;
6464
}
6565

66-
+ (BOOL)isReceiptValid {
67-
NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
68-
NSData *receiptData = [NSData dataWithContentsOfURL:receiptURL];
69-
70-
if (receiptData == nil) {
71-
return false;
72-
} else {
73-
return true;
74-
}
75-
}
76-
7766
@end

BranchSDK/BNCPreferenceHelper.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ NSURL* /* _Nonnull */ BNCURLForBranchDirectory(void);
8080
@property (assign, nonatomic) NSInteger highestConversionValueSent;
8181
@property (strong, nonatomic) NSDate *firstAppLaunchTime;
8282
@property (assign, nonatomic) BOOL invokeRegisterApp;
83-
@property (assign, nonatomic) BOOL logInAppPurchasesAsBranchEvents;
8483

8584
- (void) clearTrackingInformation;
8685

BranchSDK/BNCPreferenceHelper.m

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ @implementation BNCPreferenceHelper
110110
skanCurrentWindow = _skanCurrentWindow,
111111
firstAppLaunchTime = _firstAppLaunchTime,
112112
highestConversionValueSent = _highestConversionValueSent,
113-
logInAppPurchasesAsBranchEvents = _logInAppPurchasesAsBranchEvents,
114113
referringURLQueryParameters = _referringURLQueryParameters,
115114
anonID = _anonID;
116115

@@ -824,16 +823,6 @@ - (void) setInvokeRegisterApp:(BOOL)invoke {
824823
}
825824
}
826825

827-
- (BOOL) logInAppPurchasesAsBranchEvents {
828-
_logInAppPurchasesAsBranchEvents = [self readBoolFromDefaults:BRANCH_PREFS_KEY_LOG_IAP_AS_EVENTS];
829-
return _logInAppPurchasesAsBranchEvents;
830-
}
831-
832-
- (void) setLogInAppPurchasesAsBranchEvents:(BOOL)logInAppPurchasesAsBranchEvents {
833-
_logInAppPurchasesAsBranchEvents = logInAppPurchasesAsBranchEvents;
834-
[self writeBoolToDefaults:BRANCH_PREFS_KEY_LOG_IAP_AS_EVENTS value:logInAppPurchasesAsBranchEvents];
835-
}
836-
837826
- (void) clearTrackingInformation {
838827
@synchronized(self) {
839828
/*

BranchSDK/Branch.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,9 +1878,6 @@ typedef NS_ENUM(NSUInteger, BranchCreditHistoryOrder) {
18781878
- (void)passPasteItemProviders:(NSArray<NSItemProvider *> *)itemProviders API_AVAILABLE(ios(16));
18791879
#endif
18801880

1881-
+ (void)setLogInAppPurchasesAsEventsEnabled:(BOOL)enabled;
1882-
+ (BOOL)logInAppPurchasesBranchEventsEnabled;
1883-
18841881
@end
18851882

18861883
NS_ASSUME_NONNULL_END

BranchSDK/Branch.m

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
#import "NSError+Branch.h"
4747
#import "BNCLog.h"
4848
#import "UIViewController+Branch.h"
49-
#import <StoreKit/StoreKit.h>
5049
#import "BNCReferringURLUtility.h"
5150

5251
#if !TARGET_OS_TV
@@ -126,7 +125,7 @@ typedef NS_ENUM(NSInteger, BNCInitStatus) {
126125
BNCInitStatusInitialized
127126
};
128127

129-
@interface Branch() <BranchDeepLinkingControllerCompletionDelegate, SKPaymentTransactionObserver> {
128+
@interface Branch() <BranchDeepLinkingControllerCompletionDelegate> {
130129
NSInteger _networkCount;
131130
BNCURLFilter *_userURLFilter;
132131
}
@@ -1677,10 +1676,6 @@ + (Branch *)getInstanceInternal:(NSString *)key {
16771676
cache:[[BNCLinkCache alloc] init]
16781677
preferenceHelper:preferenceHelper
16791678
key:key];
1680-
1681-
if ([BNCPreferenceHelper sharedInstance].logInAppPurchasesAsBranchEvents == YES) {
1682-
[[SKPaymentQueue defaultQueue] addTransactionObserver:branch];
1683-
}
16841679
});
16851680
return branch;
16861681
}
@@ -2602,51 +2597,4 @@ + (void) clearAll {
26022597
[BNCPreferenceHelper clearAll];
26032598
}
26042599

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-
26522600
@end

BranchSDK/BranchEvent.m

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -373,19 +373,15 @@ - (NSString*_Nonnull) description {
373373
#pragma mark - IAP Methods
374374

375375
- (void) logEventWithTransaction:(SKPaymentTransaction *)transaction {
376-
if ([BNCAppleReceipt isReceiptValid]) {
377-
self.transactionID = transaction.transactionIdentifier;
378-
[[BNCEventUtils shared] storeEvent:self];
379-
380-
NSString *productId = transaction.payment.productIdentifier;
381-
SKProductsRequest *productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:productId]];
382-
383-
_request = productsRequest;
384-
productsRequest.delegate = self;
385-
[productsRequest start];
386-
} else {
387-
BNCLogDebug(@"Invalid receipt. Branch Event was not logged.");
388-
}
376+
self.transactionID = transaction.transactionIdentifier;
377+
[[BNCEventUtils shared] storeEvent:self];
378+
379+
NSString *productId = transaction.payment.productIdentifier;
380+
SKProductsRequest *productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:productId]];
381+
382+
_request = productsRequest;
383+
productsRequest.delegate = self;
384+
[productsRequest start];
389385
}
390386

391387
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {

0 commit comments

Comments
 (0)