Skip to content

Commit 6de2104

Browse files
[release] 1.39.1
1 parent 9e9fd9a commit 6de2104

File tree

15 files changed

+62
-14
lines changed

15 files changed

+62
-14
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.0";
14+
NSString * const BNC_SDK_VERSION = @"1.39.1";

Branch-SDK/BNCDeviceInfo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
@property (nonatomic, copy, readwrite) NSString *advertiserId;
3636
@property (nonatomic, copy, readwrite) NSString *vendorId;
3737
@property (nonatomic, copy, readwrite) NSString *optedInStatus;
38+
@property (nonatomic, assign, readwrite) BOOL isFirstOptIn;
3839
@property (nonatomic, assign, readwrite) BOOL isAdTrackingEnabled;
3940
@property (nonatomic, assign, readwrite) BOOL unidentifiedDevice;
4041
- (NSString *)localIPAddress;

Branch-SDK/BNCDeviceInfo.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,14 @@ - (NSString *)userAgentString {
147147
// IDFA should never be cached
148148
- (void)checkAdvertisingIdentifier {
149149
self.optedInStatus = [BNCSystemObserver attOptedInStatus];
150+
151+
// indicate if this is first time we've seen the user opt in, this reduces work on the server
152+
if ([self.optedInStatus isEqualToString:@"authorized"] && ![BNCPreferenceHelper preferenceHelper].hasOptedInBefore) {
153+
self.isFirstOptIn = YES;
154+
} else {
155+
self.isFirstOptIn = NO;
156+
}
157+
150158
self.isAdTrackingEnabled = [BNCSystemObserver adTrackingSafe];
151159
self.advertiserId = [BNCSystemObserver getAdId];
152160
BOOL ignoreIdfa = [BNCPreferenceHelper preferenceHelper].isDebug;

Branch-SDK/BNCPreferenceHelper.h

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

Branch-SDK/BNCPreferenceHelper.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,14 @@ - (BOOL)appleAttributionTokenChecked {
392392
return [self readBoolFromDefaults:@"_appleAttributionTokenChecked"];
393393
}
394394

395+
- (void)setHasOptedInBefore:(BOOL)hasOptedInBefore {
396+
[self writeBoolToDefaults:@"_hasOptedInBefore" value:hasOptedInBefore];
397+
}
398+
399+
- (BOOL)hasOptedInBefore {
400+
return [self readBoolFromDefaults:@"_hasOptedInBefore"];
401+
}
402+
395403
- (NSString*) lastSystemBuildVersion {
396404
if (!_lastSystemBuildVersion) {
397405
_lastSystemBuildVersion = [self readStringFromDefaults:@"_lastSystemBuildVersion"];

Branch-SDK/BNCServerInterface.m

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#import "BNCLog.h"
1717
#import "Branch.h"
1818
#import "NSString+Branch.h"
19+
#import "BNCApplication.h"
1920

2021
@interface BNCServerInterface ()
2122
@property (strong) NSString *requestEndpoint;
@@ -528,6 +529,12 @@ - (void)updateDeviceInfoToMutableDictionary:(NSMutableDictionary *)dict {
528529
[self safeSetValue:[deviceInfo userAgentString] forKey:@"user_agent" onDict:dict];
529530

530531
[self safeSetValue:[deviceInfo optedInStatus] forKey:BRANCH_REQUEST_KEY_OPTED_IN_STATUS onDict:dict];
532+
533+
if ([self installDateIsRecent] && [deviceInfo isFirstOptIn]) {
534+
[self safeSetValue:@(deviceInfo.isFirstOptIn) forKey:BRANCH_REQUEST_KEY_FIRST_OPT_IN onDict:dict];
535+
[BNCPreferenceHelper preferenceHelper].hasOptedInBefore = YES;
536+
}
537+
531538
[self safeSetValue:@(deviceInfo.isAdTrackingEnabled) forKey:BRANCH_REQUEST_KEY_AD_TRACKING_ENABLED onDict:dict];
532539

533540
[self safeSetValue:deviceInfo.applicationVersion forKey:@"app_version" onDict:dict];
@@ -541,6 +548,20 @@ - (void)updateDeviceInfoToMutableDictionary:(NSMutableDictionary *)dict {
541548
}
542549
}
543550

551+
// we do not need to send first_opt_in, if the install is older than 30 days
552+
- (BOOL)installDateIsRecent {
553+
//NSTimeInterval maxTimeSinceInstall = 60.0;
554+
NSTimeInterval maxTimeSinceInstall = 3600.0 * 24.0 * 30;
555+
NSDate *now = [NSDate date];
556+
NSDate *maxDate = [[BNCApplication currentApplication].currentInstallDate dateByAddingTimeInterval:maxTimeSinceInstall];
557+
558+
if ([now compare:maxDate] == NSOrderedDescending) {
559+
return NO;
560+
} else {
561+
return YES;
562+
}
563+
}
564+
544565
- (NSMutableDictionary*)updateDeviceInfoToParams:(NSDictionary *)params {
545566
NSMutableDictionary *extendedParams=[[NSMutableDictionary alloc] init];
546567
[extendedParams addEntriesFromDictionary:params];

Branch-SDK/BranchConstants.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ extern NSString * const BRANCH_REQUEST_KEY_IS_HARDWARE_ID_REAL;
4646
extern NSString * const BRANCH_REQUEST_KEY_IOS_VENDOR_ID;
4747
extern NSString * const BRANCH_REQUEST_KEY_AD_TRACKING_ENABLED;
4848
extern NSString * const BRANCH_REQUEST_KEY_OPTED_IN_STATUS;
49+
extern NSString * const BRANCH_REQUEST_KEY_FIRST_OPT_IN;
4950
extern NSString * const BRANCH_REQUEST_KEY_DEBUG;
5051
extern NSString * const BRANCH_REQUEST_KEY_BUNDLE_ID;
5152
extern NSString * const BRANCH_REQUEST_KEY_TEAM_ID;

Branch-SDK/BranchConstants.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
NSString * const BRANCH_REQUEST_KEY_IOS_VENDOR_ID = @"ios_vendor_id";
4343
NSString * const BRANCH_REQUEST_KEY_AD_TRACKING_ENABLED = @"ad_tracking_enabled";
4444
NSString * const BRANCH_REQUEST_KEY_OPTED_IN_STATUS = @"opted_in_status";
45+
NSString * const BRANCH_REQUEST_KEY_FIRST_OPT_IN = @"first_opt_in";
4546
NSString * const BRANCH_REQUEST_KEY_DEBUG = @"debug";
4647
NSString * const BRANCH_REQUEST_KEY_BUNDLE_ID = @"ios_bundle_id";
4748
NSString * const BRANCH_REQUEST_KEY_TEAM_ID = @"ios_team_id";

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.0</string>
20+
<string>1.39.1</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>1.39.0</string>
24+
<string>1.39.1</string>
2525
<key>LSRequiresIPhoneOS</key>
2626
<true/>
2727
<key>NSHumanReadableCopyright</key>

Branch.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "Branch"
3-
s.version = "1.39.0"
3+
s.version = "1.39.1"
44
s.summary = "Create an HTTP URL for any piece of content in your app"
55
s.description = <<-DESC
66
- Want the highest possible conversions on your sharing feature?
@@ -32,5 +32,5 @@ Use the Branch SDK (branch.io) to create and power the links that point back to
3232
"Branch-SDK/BranchShareLink.{h,m}"
3333

3434
s.frameworks = 'CoreServices', 'SystemConfiguration'
35-
s.ios.frameworks = 'WebKit', 'iAd', 'CoreTelephony', 'AdServices'
35+
s.ios.frameworks = 'WebKit', 'iAd', 'CoreTelephony'
3636
end

0 commit comments

Comments
 (0)