Skip to content

Commit 60cecae

Browse files
authored
Merge pull request #386 from BranchMetrics/clean-up
Clean up referral code, promo code and deprecated methods
2 parents 85e8fce + 644db4c commit 60cecae

30 files changed

+8
-1894
lines changed

Branch-SDK/Branch-SDK/BNCConfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#endif
2121

2222
#ifdef BNC_STAGE_ENV
23-
#define BNC_API_BASE_URL @"http://api.dev.branchmetrics.io"
23+
#define BNC_API_BASE_URL @"http://api.dev.branch.io"
2424
#endif
2525

2626
#define BNC_LINK_URL @"https://bnc.lt"

Branch-SDK/Branch-SDK/BNCError.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ FOUNDATION_EXPORT NSString * const BNCErrorDomain;
1313
enum {
1414
BNCInitError = 1000,
1515
BNCDuplicateResourceError,
16-
BNCInvalidPromoCodeError,
1716
BNCRedeemCreditsError,
1817
BNCBadRequestError,
1918
BNCServerProblemError,

Branch-SDK/Branch-SDK/BNCPreferenceHelper.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
@property (strong, nonatomic) NSString *userIdentity;
2929
@property (strong, nonatomic) NSString *sessionParams;
3030
@property (strong, nonatomic) NSString *installParams;
31-
@property (assign, nonatomic) BOOL explicitlyRequestedReferrable;
32-
@property (assign, nonatomic) BOOL isReferrable;
3331
@property (assign, nonatomic) BOOL isDebug;
3432
@property (assign, nonatomic) BOOL shouldWaitForInit;
3533
@property (assign, nonatomic) BOOL suppressWarningLogs;
@@ -59,11 +57,6 @@
5957
- (NSInteger)getCreditCount;
6058
- (NSInteger)getCreditCountForBucket:(NSString *)bucket;
6159

62-
- (void)setActionTotalCount:(NSString *)action withCount:(NSInteger)count;
63-
- (void)setActionUniqueCount:(NSString *)action withCount:(NSInteger)count;
64-
- (NSInteger)getActionTotalCount:(NSString *)action;
65-
- (NSInteger)getActionUniqueCount:(NSString *)action;
66-
6760
- (void)updateBranchViewCount:(NSString *)branchViewID;
6861
- (NSInteger)getBranchViewCount:(NSString *)branchViewID;
6962

Branch-SDK/Branch-SDK/BNCPreferenceHelper.m

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,12 @@
3333
NSString * const BRANCH_PREFS_KEY_SESSION_PARAMS = @"bnc_session_params";
3434
NSString * const BRANCH_PREFS_KEY_INSTALL_PARAMS = @"bnc_install_params";
3535
NSString * const BRANCH_PREFS_KEY_USER_URL = @"bnc_user_url";
36-
NSString * const BRANCH_PREFS_KEY_IS_REFERRABLE = @"bnc_is_referrable";
3736
NSString * const BRANCH_PREFS_KEY_BRANCH_UNIVERSAL_LINK_DOMAINS = @"branch_universal_link_domains";
3837
NSString * const BRANCH_REQUEST_KEY_EXTERNAL_INTENT_URI = @"external_intent_uri";
3938

4039
NSString * const BRANCH_PREFS_KEY_CREDITS = @"bnc_credits";
4140
NSString * const BRANCH_PREFS_KEY_CREDIT_BASE = @"bnc_credit_base_";
4241

43-
NSString * const BRANCH_PREFS_KEY_COUNTS = @"bnc_counts";
44-
NSString * const BRANCH_PREFS_KEY_TOTAL_BASE = @"bnc_total_base_";
45-
NSString * const BRANCH_PREFS_KEY_UNIQUE_BASE = @"bnc_unique_base_";
46-
4742
NSString * const BRANCH_PREFS_KEY_BRANCH_VIEW_USAGE_CNT = @"bnc_branch_view_usage_cnt_";
4843

4944
// The name of this key was specified in the account-creation API integration
@@ -52,7 +47,6 @@
5247
@interface BNCPreferenceHelper ()
5348

5449
@property (strong, nonatomic) NSMutableDictionary *persistenceDict;
55-
@property (strong, nonatomic) NSMutableDictionary *countsDictionary;
5650
@property (strong, nonatomic) NSMutableDictionary *creditsDictionary;
5751
@property (strong, nonatomic) NSMutableDictionary *requestMetadataDictionary;
5852
@property (strong, nonatomic) NSMutableDictionary *instrumentationDictionary;
@@ -77,7 +71,6 @@ @implementation BNCPreferenceHelper
7771
installParams = _installParams,
7872
universalLinkUrl = _universalLinkUrl,
7973
externalIntentURI = _externalIntentURI,
80-
isReferrable = _isReferrable,
8174
isDebug = _isDebug,
8275
shouldWaitForInit = _shouldWaitForInit,
8376
suppressWarningLogs = _suppressWarningLogs,
@@ -108,8 +101,6 @@ - (id)init {
108101

109102
_isDebug = NO;
110103
_suppressWarningLogs = NO;
111-
_explicitlyRequestedReferrable = NO;
112-
_isReferrable = [self readBoolFromDefaults:BRANCH_PREFS_KEY_IS_REFERRABLE];
113104
}
114105

115106
return self;
@@ -454,29 +445,8 @@ - (void)setCheckedFacebookAppLinks:(BOOL)checked {
454445
[self writeBoolToDefaults:BRANCH_PREFS_KEY_CHECKED_FACEBOOK_APP_LINKS value:checked];
455446
}
456447

457-
- (BOOL)isReferrable {
458-
BOOL hasIdentity = self.identityID != nil;
459-
460-
// If referrable is set, but they already have an identity, they should only
461-
// still be referrable if the dev has explicitly set always referrable.
462-
if (_isReferrable && hasIdentity) {
463-
return _explicitlyRequestedReferrable;
464-
}
465-
466-
// If not referrable, or no identity yet, whatever isReferrable has is fine to return.
467-
return _isReferrable;
468-
}
469-
470-
- (void)setIsReferrable:(BOOL)isReferrable {
471-
if (_isReferrable != isReferrable) {
472-
_isReferrable = isReferrable;
473-
[self writeBoolToDefaults:BRANCH_PREFS_KEY_IS_REFERRABLE value:isReferrable];
474-
}
475-
}
476-
477448
- (void)clearUserCreditsAndCounts {
478449
self.creditsDictionary = [[NSMutableDictionary alloc] init];
479-
self.countsDictionary = [[NSMutableDictionary alloc] init];
480450
}
481451

482452
- (id)getBranchUniversalLinkDomains {
@@ -578,38 +548,6 @@ - (void)clearUserCredits {
578548

579549
#pragma mark - Count Storage
580550

581-
- (NSMutableDictionary *)countsDictionary {
582-
if (!_countsDictionary) {
583-
_countsDictionary = [[self readObjectFromDefaults:BRANCH_PREFS_KEY_COUNTS] mutableCopy];
584-
585-
if (!_countsDictionary) {
586-
_countsDictionary = [[NSMutableDictionary alloc] init];
587-
}
588-
}
589-
590-
return _countsDictionary;
591-
}
592-
593-
- (void)setActionTotalCount:(NSString *)action withCount:(NSInteger)count {
594-
self.countsDictionary[[BRANCH_PREFS_KEY_TOTAL_BASE stringByAppendingString:action]] = @(count);
595-
596-
[self writeObjectToDefaults:BRANCH_PREFS_KEY_COUNTS value:self.countsDictionary];
597-
}
598-
599-
- (void)setActionUniqueCount:(NSString *)action withCount:(NSInteger)count {
600-
self.countsDictionary[[BRANCH_PREFS_KEY_UNIQUE_BASE stringByAppendingString:action]] = @(count);
601-
602-
[self writeObjectToDefaults:BRANCH_PREFS_KEY_COUNTS value:self.countsDictionary];
603-
}
604-
605-
- (NSInteger)getActionTotalCount:(NSString *)action {
606-
return [self.countsDictionary[[BRANCH_PREFS_KEY_TOTAL_BASE stringByAppendingString:action]] integerValue];
607-
}
608-
609-
- (NSInteger)getActionUniqueCount:(NSString *)action {
610-
return [self.countsDictionary[[BRANCH_PREFS_KEY_UNIQUE_BASE stringByAppendingString:action]] integerValue];
611-
}
612-
613551
- (void)updateBranchViewCount:(NSString *)branchViewID {
614552
NSInteger currentCount = [self getBranchViewCount:branchViewID] + 1;
615553
[self writeObjectToDefaults:[BRANCH_PREFS_KEY_BRANCH_VIEW_USAGE_CNT stringByAppendingString:branchViewID] value:@(currentCount)];

Branch-SDK/Branch-SDK/BNCServerInterface.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212

1313
typedef void (^BNCServerCallback)(BNCServerResponse *response, NSError *error);
1414

15-
static NSString *REQ_TAG_DEBUG_CONNECT = @"t_debug_connect";
16-
static NSString *REQ_TAG_DEBUG_LOG = @"t_debug_log";
17-
static NSString *REQ_TAG_DEBUG_SCREEN = @"t_debug_screen";
18-
static NSString *REQ_TAG_DEBUG_DISCONNECT = @"t_debug_disconnect";
19-
2015
@interface BNCServerInterface : NSObject
2116

2217
@property (strong, nonatomic) BNCPreferenceHelper *preferenceHelper;

0 commit comments

Comments
 (0)