Skip to content

Commit c16676f

Browse files
[release] 1.39.2
1 parent 6de2104 commit c16676f

File tree

16 files changed

+149
-46
lines changed

16 files changed

+149
-46
lines changed

Branch-SDK/BNCConfig.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
NSString * const BNC_API_BASE_URL = @"https://api2.branch.io";
1212
NSString * const BNC_API_VERSION = @"v1";
1313
NSString * const BNC_LINK_URL = @"https://bnc.lt";
14-
NSString * const BNC_SDK_VERSION = @"1.39.1";
14+
NSString * const BNC_SDK_VERSION = @"1.39.2";

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/BNCSystemObserver.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ + (NSString *)attOptedInStatus {
128128
return statusString;
129129
}
130130

131-
// on iOS 14+ this value is always NO
131+
// this value is deprecated on iOS 14+
132132
+ (BOOL)adTrackingSafe {
133133
#ifdef BRANCH_EXCLUDE_IDFA_CODE
134134
return NO;

Branch-SDK/Branch.h

Lines changed: 42 additions & 31 deletions
Large diffs are not rendered by default.

Branch-SDK/Branch.m

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#import "BNCSKAdNetwork.h"
4545
#import "BNCAppGroupsData.h"
4646
#import "BNCPartnerParameters.h"
47+
#import "BranchEvent.h"
4748

4849
#if !TARGET_OS_TV
4950
#import "BNCUserAgentCollector.h"
@@ -969,6 +970,32 @@ - (void)setAppClipAppGroup:(NSString *)appGroup {
969970
[BNCAppGroupsData shared].appGroup = appGroup;
970971
}
971972

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+
981+
BranchEvent *event;
982+
switch (status) {
983+
case 2:
984+
// denied
985+
event = [BranchEvent standardEvent:BranchStandardEventOptOut];
986+
break;
987+
case 3:
988+
// authorized
989+
event = [BranchEvent standardEvent:BranchStandardEventOptIn];
990+
break;
991+
default:
992+
break;
993+
}
994+
if (event) {
995+
[event logEvent];
996+
}
997+
}
998+
972999
- (void)setSKAdNetworkCalloutMaxTimeSinceInstall:(NSTimeInterval)maxTimeInterval {
9731000
[BNCSKAdNetwork sharedInstance].maxTimeSinceInstall = maxTimeInterval;
9741001
}

Branch-SDK/BranchEvent.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventUnlockAchievem
4545
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventInvite;
4646
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventLogin;
4747
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventReserve;
48+
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventOptIn;
49+
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventOptOut;
4850

4951
typedef NS_ENUM(NSInteger, BranchEventAdType) {
5052
BranchEventAdTypeNone,

Branch-SDK/BranchEvent.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
BranchStandardEvent BranchStandardEventInvite = @"INVITE";
4747
BranchStandardEvent BranchStandardEventLogin = @"LOGIN";
4848
BranchStandardEvent BranchStandardEventReserve = @"RESERVE";
49+
BranchStandardEvent BranchStandardEventOptIn = @"OPT_IN";
50+
BranchStandardEvent BranchStandardEventOptOut = @"OPT_OUT";
4951

5052
@implementation BranchEventRequest
5153

@@ -226,6 +228,8 @@ - (NSDictionary*) dictionary {
226228
BranchStandardEventStartTrial,
227229
BranchStandardEventClickAd,
228230
BranchStandardEventViewAd,
231+
BranchStandardEventOptOut,
232+
BranchStandardEventOptIn,
229233
];
230234
}
231235

Branch-TestBed/Branch-SDK-Tests/BranchEvent.Test.m

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,50 @@ - (void)testCustomViewAdEvent {
641641
XCTAssert([request.serverURL.absoluteString containsString:@"branch.io/v2/event/standard"]);
642642
}
643643

644+
- (void)testStandardOptInEvent {
645+
BranchEvent *event = [BranchEvent standardEvent:BranchStandardEventOptIn];
646+
647+
NSDictionary *eventDictionary = [event buildEventDictionary];
648+
XCTAssertNotNil(eventDictionary);
649+
XCTAssert([eventDictionary[@"name"] isEqualToString:@"OPT_IN"]);
650+
651+
BranchEventRequest *request = [event buildRequestWithEventDictionary:eventDictionary];
652+
XCTAssert([request.serverURL.absoluteString containsString:@"branch.io/v2/event/standard"]);
653+
}
654+
655+
- (void)testCustomOptInEvent {
656+
BranchEvent *event = [BranchEvent customEventWithName:@"OPT_IN"];
657+
658+
NSDictionary *eventDictionary = [event buildEventDictionary];
659+
XCTAssertNotNil(eventDictionary);
660+
XCTAssert([eventDictionary[@"name"] isEqualToString:@"OPT_IN"]);
661+
662+
BranchEventRequest *request = [event buildRequestWithEventDictionary:eventDictionary];
663+
XCTAssert([request.serverURL.absoluteString containsString:@"branch.io/v2/event/standard"]);
664+
}
665+
666+
- (void)testStandardOptOutEvent {
667+
BranchEvent *event = [BranchEvent standardEvent:BranchStandardEventOptOut];
668+
669+
NSDictionary *eventDictionary = [event buildEventDictionary];
670+
XCTAssertNotNil(eventDictionary);
671+
XCTAssert([eventDictionary[@"name"] isEqualToString:@"OPT_OUT"]);
672+
673+
BranchEventRequest *request = [event buildRequestWithEventDictionary:eventDictionary];
674+
XCTAssert([request.serverURL.absoluteString containsString:@"branch.io/v2/event/standard"]);
675+
}
676+
677+
- (void)testCustomOptOutEvent {
678+
BranchEvent *event = [BranchEvent customEventWithName:@"OPT_OUT"];
679+
680+
NSDictionary *eventDictionary = [event buildEventDictionary];
681+
XCTAssertNotNil(eventDictionary);
682+
XCTAssert([eventDictionary[@"name"] isEqualToString:@"OPT_OUT"]);
683+
684+
BranchEventRequest *request = [event buildRequestWithEventDictionary:eventDictionary];
685+
XCTAssert([request.serverURL.absoluteString containsString:@"branch.io/v2/event/standard"]);
686+
}
687+
644688
- (void)testJsonStringForAdTypeNone {
645689
BranchEvent *event = [BranchEvent standardEvent:BranchStandardEventViewAd];
646690
XCTAssertNil([event jsonStringForAdType:BranchEventAdTypeNone]);

Branch-TestBed/Framework-Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
<key>CFBundlePackageType</key>
1818
<string>FMWK</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.39.1</string>
20+
<string>1.39.2</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>1.39.1</string>
24+
<string>1.39.2</string>
2525
<key>LSRequiresIPhoneOS</key>
2626
<true/>
2727
<key>NSHumanReadableCopyright</key>

0 commit comments

Comments
 (0)