Skip to content

Commit 8baabaf

Browse files
authored
Merge pull request #1105 from BranchMetrics/CORE-1768-rename-api-for-better-readability,-add-safety-check
CORE-1768 rename api for better readability, add safety check
2 parents 79260fd + cff33ff commit 8baabaf

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

Branch-SDK/BNCPreferenceHelper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ NSURL* /* _Nonnull */ BNCURLForBranchDirectory(void);
3737
@property (assign, nonatomic) BOOL checkedAppleSearchAdAttribution;
3838
@property (nonatomic, assign, readwrite) BOOL appleAttributionTokenChecked;
3939
@property (nonatomic, assign, readwrite) BOOL hasOptedInBefore;
40+
@property (nonatomic, assign, readwrite) BOOL hasCalledHandleATTAuthorizationStatus;
4041
@property (assign, nonatomic) NSInteger retryCount;
4142
@property (assign, nonatomic) NSTimeInterval retryInterval;
4243
@property (assign, nonatomic) NSTimeInterval timeout;

Branch-SDK/BNCPreferenceHelper.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,14 @@ - (BOOL)hasOptedInBefore {
400400
return [self readBoolFromDefaults:@"_hasOptedInBefore"];
401401
}
402402

403+
- (void)setHasCalledHandleATTAuthorizationStatus:(BOOL)hasCalledHandleATTAuthorizationStatus {
404+
[self writeBoolToDefaults:@"_hasCalledHandleATTAuthorizationStatus" value:hasCalledHandleATTAuthorizationStatus];
405+
}
406+
407+
- (BOOL)hasCalledHandleATTAuthorizationStatus {
408+
return [self readBoolFromDefaults:@"_hasCalledHandleATTAuthorizationStatus"];
409+
}
410+
403411
- (NSString*) lastSystemBuildVersion {
404412
if (!_lastSystemBuildVersion) {
405413
_lastSystemBuildVersion = [self readStringFromDefaults:@"_lastSystemBuildVersion"];

Branch-SDK/Branch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ typedef NS_ENUM(NSUInteger, BranchCreditHistoryOrder) {
692692
Otherwise the prompt will not display and the completion will be called with current status.
693693
This will inflate the number of OPT_IN and OPT_OUT events tracked by Branch.
694694
*/
695-
- (void)handleOptInStatus:(NSUInteger)status;
695+
- (void)handleATTAuthorizationStatus:(NSUInteger)status;
696696

697697
/**
698698
Set time window for SKAdNetwork callouts. By default, Branch limits calls to SKAdNetwork to within 24 hours after first install.

Branch-SDK/Branch.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,14 @@ - (void)setAppClipAppGroup:(NSString *)appGroup {
970970
[BNCAppGroupsData shared].appGroup = appGroup;
971971
}
972972

973-
- (void)handleOptInStatus:(NSUInteger)status {
973+
- (void)handleATTAuthorizationStatus:(NSUInteger)status {
974+
// limits impact if the client fails to check that status = notDetermined before calling
975+
if ([BNCPreferenceHelper preferenceHelper].hasCalledHandleATTAuthorizationStatus) {
976+
return;
977+
} else {
978+
[BNCPreferenceHelper preferenceHelper].hasCalledHandleATTAuthorizationStatus = YES;
979+
}
980+
974981
BranchEvent *event;
975982
switch (status) {
976983
case 2:

0 commit comments

Comments
 (0)