Skip to content

Commit f050980

Browse files
authored
Optional Frameworks (AIS-290) (#645)
* Siloed off Fabric calls. * Removed CoreTelephony. * Made SafariServices an optional podspec.
1 parent 4923167 commit f050980

File tree

8 files changed

+38
-20
lines changed

8 files changed

+38
-20
lines changed

Branch-SDK/Branch-SDK/BNCFabricAnswers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
@interface BNCFabricAnswers : NSObject
1212

13+
+ (NSDictionary*) branchConfigurationDictionary;
1314
+ (void)sendEventWithName:(NSString*)name andAttributes:(NSDictionary*)attributes;
14-
+ (NSDictionary *)prepareBranchDataForAnswers:(NSDictionary *)dictionary;
1515

1616
@end

Branch-SDK/Branch-SDK/BNCFabricAnswers.m

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
// Copyright © 2016 Branch Metrics. All rights reserved.
77
//
88

9+
#import "Branch.h"
910
#import "BNCFabricAnswers.h"
1011
#import "BNCPreferenceHelper.h"
1112
#import "../Fabric/Answers.h"
13+
#import "../Fabric/Fabric+FABKits.h"
1214

1315
@implementation BNCFabricAnswers
1416

@@ -51,4 +53,19 @@ + (NSDictionary *)prepareBranchDataForAnswers:(NSDictionary *)dictionary {
5153
return temp;
5254
}
5355

56+
+ (NSDictionary*) branchConfigurationDictionary {
57+
Class fabric = NSClassFromString(@"Fabric");
58+
if ([fabric respondsToSelector:@selector(configurationDictionaryForKitClass:)]) {
59+
60+
// The name of this key was specified in the account-creation API integration
61+
NSString * const BNC_BRANCH_FABRIC_APP_KEY_KEY = @"branch_key";
62+
63+
NSDictionary *configDictionary = [fabric configurationDictionaryForKitClass:[Branch class]];
64+
NSDictionary *dictionary = [configDictionary objectForKey:BNC_BRANCH_FABRIC_APP_KEY_KEY];
65+
66+
return dictionary;
67+
}
68+
return nil;
69+
}
70+
5471
@end

Branch-SDK/Branch-SDK/BNCPreferenceHelper.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#import "BNCConfig.h"
1212
#import "Branch.h"
1313
#import "BNCLog.h"
14-
#import "../Fabric/Fabric+FABKits.h"
14+
#import "BNCFabricAnswers.h"
1515

1616
static const NSTimeInterval DEFAULT_TIMEOUT = 5.5;
1717
static const NSTimeInterval DEFAULT_RETRY_INTERVAL = 0;
@@ -56,7 +56,6 @@ @interface BNCPreferenceHelper () {
5656
@property (strong, nonatomic) NSMutableDictionary *creditsDictionary;
5757
@property (strong, nonatomic) NSMutableDictionary *requestMetadataDictionary;
5858
@property (strong, nonatomic) NSMutableDictionary *instrumentationDictionary;
59-
@property (assign, nonatomic) BOOL isUsingLiveKey;
6059

6160
@end
6261

Branch-SDK/Branch-SDK/BNCStrongMatchHelper.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,10 @@ - (BOOL) willLoadViewControllerWithURL:(NSURL*)matchURL {
286286
// when it is.
287287

288288
Class SFSafariViewControllerClass = NSClassFromString(@"SFSafariViewController");
289-
if (!SFSafariViewControllerClass) return NO;
289+
if (!SFSafariViewControllerClass) {
290+
BNCLogWarning(@"cookieBasedMatching is enabled but SafariServices framework is not available.");
291+
return NO;
292+
}
290293

291294
Class BNCMatchViewControllerSubclass = NSClassFromString(@"BNCMatchViewController_Safari");
292295
if (!BNCMatchViewControllerSubclass) {

Branch-SDK/Branch-SDK/Branch.m

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@
3636
#import "BranchContentDiscoverer.h"
3737
#import "NSMutableDictionary+Branch.h"
3838
#import "BNCLog.h"
39-
40-
//Fabric
41-
#import "../Fabric/FABKitProtocol.h"
42-
#import "../Fabric/Fabric+FABKits.h"
39+
#import "BNCFabricAnswers.h"
40+
#import "../Fabric/FABKitProtocol.h" // Fabric
4341

4442
NSString * const BRANCH_FEATURE_TAG_SHARE = @"share";
4543
NSString * const BRANCH_FEATURE_TAG_REFERRAL = @"referral";
@@ -275,11 +273,7 @@ + (NSString*) branchKey {
275273
[[[NSBundle mainBundle] infoDictionary] objectForKey:BNC_BRANCH_FABRIC_APP_KEY_KEY];
276274

277275
if (!branchDictionary) {
278-
Class fabric = NSClassFromString(@"Fabric");
279-
if ([fabric respondsToSelector:@selector(configurationDictionaryForKitClass:)]) {
280-
NSDictionary *configDictionary = [fabric configurationDictionaryForKitClass:[Branch class]];
281-
branchDictionary = [configDictionary objectForKey:BNC_BRANCH_FABRIC_APP_KEY_KEY];
282-
}
276+
branchDictionary = [BNCFabricAnswers branchConfigurationDictionary];
283277
}
284278

285279
NSString *branchKey = nil;

Branch-TestBed/Branch-TestBed.xcodeproj/project.pbxproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
4665AF261B28B9BB00184037 /* BranchConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 4665AF251B28B9BB00184037 /* BranchConstants.m */; };
3030
4665AF281B28C1DE00184037 /* BranchLogoutRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4665AF271B28C1DE00184037 /* BranchLogoutRequestTests.m */; };
3131
466B584F1B17775900A69EDE /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67BBCF271A69E49A009C7DAE /* AdSupport.framework */; };
32-
466B58511B17776000A69EDE /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 466B58501B17776000A69EDE /* CoreTelephony.framework */; };
3332
466B58521B17776500A69EDE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 670016631940F51400A9E103 /* Foundation.framework */; };
3433
466B58531B17776A00A69EDE /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 670016671940F51400A9E103 /* UIKit.framework */; };
3534
466B58551B17779C00A69EDE /* Branch.m in Sources */ = {isa = PBXBuildFile; fileRef = 670016BE1946309100A9E103 /* Branch.m */; };
@@ -333,7 +332,6 @@
333332
files = (
334333
466B58531B17776A00A69EDE /* UIKit.framework in Frameworks */,
335334
466B58521B17776500A69EDE /* Foundation.framework in Frameworks */,
336-
466B58511B17776000A69EDE /* CoreTelephony.framework in Frameworks */,
337335
466B584F1B17775900A69EDE /* AdSupport.framework in Frameworks */,
338336
);
339337
runOnlyForDeploymentPostprocessing = 0;

Branch-TestBed/Branch-TestBed/AppDelegate.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ - (BOOL)application:(UIApplication *)application
2828
Branch *branch = [Branch getInstance];
2929

3030
// Comment / un-comment to toggle debugging:
31-
[branch setDebug];
31+
// [branch setDebug];
3232

3333
// For Apple Search Ads
3434
[branch delayInitToCheckForSearchAds];

Branch.podspec

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,25 @@ Use the Branch SDK (branch.io) to create and power the links that point back to
1616
s.license = 'Proprietary'
1717
s.author = { "Branch" => "[email protected]" }
1818
s.source = { :git => "https://github.com/BranchMetrics/iOS-Deferred-Deep-Linking-SDK.git", :tag => s.version.to_s }
19-
s.platform = :ios, '7.0'
20-
s.requires_arc = true
19+
s.platform = :ios, '7.0'
20+
s.requires_arc = true
2121

2222
s.subspec 'Core' do |core|
2323
core.source_files = "Branch-SDK/Branch-SDK/*.{h,m}", "Branch-SDK/Branch-SDK/Requests/*.{h,m}", "Branch-SDK/Fabric/*.h"
2424
core.private_header_files = "Branch-SDK/Fabric/*.h"
25-
core.frameworks = 'AdSupport', 'CoreTelephony', 'MobileCoreServices'
25+
core.frameworks = 'AdSupport', 'MobileCoreServices'
2626
end
2727

2828
s.subspec 'without-IDFA' do |idfa|
2929
idfa.source_files = "Branch-SDK/Branch-SDK/*.{h,m}", "Branch-SDK/Branch-SDK/Requests/*.{h,m}", "Branch-SDK/Fabric/*.h"
3030
idfa.private_header_files = "Branch-SDK/Fabric/*.h"
31-
idfa.frameworks = 'CoreTelephony', 'MobileCoreServices'
31+
idfa.frameworks = 'MobileCoreServices'
3232
end
33+
34+
s.subspec 'without-Safari' do |safari|
35+
core.source_files = "Branch-SDK/Branch-SDK/*.{h,m}", "Branch-SDK/Branch-SDK/Requests/*.{h,m}", "Branch-SDK/Fabric/*.h"
36+
core.private_header_files = "Branch-SDK/Fabric/*.h"
37+
core.frameworks = 'AdSupport', 'MobileCoreServices'
38+
end
39+
3340
end

0 commit comments

Comments
 (0)