Skip to content

Commit

Permalink
Merge pull request #11 from BranchMetrics/staging
Browse files Browse the repository at this point in the history
SDK-979 prep 1.2.2 release
  • Loading branch information
echo-branch authored May 7, 2020
2 parents 60322df + 4d9664c commit 6e8de77
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 22 deletions.
6 changes: 3 additions & 3 deletions Branch.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
MARKETING_VERSION = 1.2.1;
MARKETING_VERSION = 1.2.2;
PRODUCT_BUNDLE_IDENTIFIER = io.branch.sdk.mac;
PROVISIONING_PROFILE_SPECIFIER = "";
};
Expand All @@ -1196,7 +1196,7 @@
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
MARKETING_VERSION = 1.2.1;
MARKETING_VERSION = 1.2.2;
PRODUCT_BUNDLE_IDENTIFIER = io.branch.sdk.mac;
PROVISIONING_PROFILE_SPECIFIER = "";
};
Expand Down Expand Up @@ -1300,7 +1300,7 @@
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
MARKETING_VERSION = 1.2.1;
MARKETING_VERSION = 1.2.2;
PRODUCT_BUNDLE_IDENTIFIER = io.branch.sdk.mac;
PROVISIONING_PROFILE_SPECIFIER = "";
};
Expand Down
12 changes: 11 additions & 1 deletion Branch/BNCDevice.m
Original file line number Diff line number Diff line change
Expand Up @@ -287,18 +287,28 @@ - (NSString *)vendorID {
#endif

- (NSString *)hardwareID {
// INTENG-8458 server only wants hardware id and hardware id type for idfa and idfv.
NSString *s = nil;
s = [self advertisingID];
if (s) {
_hardwareIDType = @"idfa";
return s;
}

s = [self vendorID];
if (s) {
_hardwareIDType = @"vendor_id";
return s;
}

s = [self netAddress];
if (s) {
_hardwareIDType = @"mac_address";
return s;
}

s = [[NSUUID UUID] UUIDString];
_hardwareIDType = @"random";

return s;
}

Expand Down
45 changes: 33 additions & 12 deletions Branch/BNCNetworkInformation.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ @implementation BNCNetworkInformation
+ (NSString*) etherString:(struct sockaddr_dl*)sdl {
if (sdl->sdl_alen) {
u_char *cp = (u_char *)LLADDR(sdl);
return [NSString stringWithFormat:@"%x:%x:%x:%x:%x:%x",
return [NSString stringWithFormat:@"%02x:%02x:%02x:%02x:%02x:%02x",
cp[0], cp[1], cp[2], cp[3], cp[4], cp[5]];
}
return @"";
Expand Down Expand Up @@ -198,22 +198,13 @@ + (NSString*) etherString:(struct sockaddr_dl*)sdl {
return currentInterfaces;
}

// returns first local network interface
+ (BNCNetworkInformation*) local {
uint8_t const kLocalAddress[] = { 0xfe, 0x80 };
NSArray*areaEntries = [self areaEntries];
NSArray*localEntries = [self currentInterfaces];
for (BNCNetworkInformation*le in localEntries) {
for (BNCNetworkInformation*ae in areaEntries) {
if (ae.inetAddress && le.inetAddress && [ae.inetAddress isEqualToData:le.inetAddress]) {
le.address = ae.address;
le.displayAddress = ae.displayAddress;
return le;
} else
if (ae.inetAddress.length == 16 &&
le.inetAddress.length == 16 &&
memcmp([ae.inetAddress bytes], kLocalAddress, 2) == 0 &&
memcmp([le.inetAddress bytes], kLocalAddress, 2) == 0 &&
memcmp([le.inetAddress bytes] + 8, [ae.inetAddress bytes] + 8, 8) == 0) {
if (![self isTouchBarInterface:ae] && [self canMergeLocalEntry:le withAreaEntry:ae]) {
le.address = ae.address;
le.displayAddress = ae.displayAddress;
return le;
Expand All @@ -223,6 +214,36 @@ + (BNCNetworkInformation*) local {
return nil;
}

// Ignore the Touchbar iBridge interface on the MacBook Pro
+ (BOOL)isTouchBarInterface:(BNCNetworkInformation *)ae {
NSString *touchBarMacAddress = @"ac:de:48:00:11:22";
if ([touchBarMacAddress isEqualToString:ae.displayAddress]) {
return YES;
}
return NO;
}

// Check if we can merge the entries
+ (BOOL)canMergeLocalEntry:(BNCNetworkInformation *)le withAreaEntry:(BNCNetworkInformation *)ae {

// fairly certain this IP address check never works
if (ae.inetAddress && le.inetAddress && [ae.inetAddress isEqualToData:le.inetAddress]) {
return YES;
}

// This IP address compare works
uint8_t const kLocalAddress[] = { 0xfe, 0x80 };
if (ae.inetAddress.length == 16 &&
le.inetAddress.length == 16 &&
memcmp([ae.inetAddress bytes], kLocalAddress, 2) == 0 &&
memcmp([le.inetAddress bytes], kLocalAddress, 2) == 0 &&
memcmp([le.inetAddress bytes] + 8, [ae.inetAddress bytes] + 8, 8) == 0) {
return YES;
}

return NO;
}

- (NSString*) description {
return [NSString stringWithFormat:@"<%@ %p %@ %@ %@>",
NSStringFromClass(self.class),
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Branch Mac SDK Change Log

## v1.2.2 - May 7, 2020
* Fix fallback when idfa is not available

## v1.2.1 - December 13, 2019
* Fix crash when idfa is not available

Expand Down
Binary file modified Frameworks/macOS/Branch.framework/Versions/A/Branch
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>18G1012</string>
<string>19E287</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand All @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>1.2.2</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
Expand All @@ -27,17 +27,17 @@
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>11C29</string>
<string>11E503a</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>19B90</string>
<string>19E258</string>
<key>DTSDKName</key>
<string>macosx10.15</string>
<key>DTXcode</key>
<string>1130</string>
<string>1141</string>
<key>DTXcodeBuild</key>
<string>11C29</string>
<string>11E503a</string>
<key>LSMinimumSystemVersion</key>
<string>10.10</string>
<key>NSHumanReadableCopyright</key>
Expand Down
Binary file modified Frameworks/tvOS/Branch.framework/Branch
Binary file not shown.
Binary file modified Frameworks/tvOS/Branch.framework/Info.plist
Binary file not shown.

0 comments on commit 6e8de77

Please sign in to comment.