Skip to content

Commit 222f822

Browse files
author
Edward Smith
committed
Updated QA from test results.
1 parent 97d4d65 commit 222f822

File tree

15 files changed

+80
-36
lines changed

15 files changed

+80
-36
lines changed

Branch-SDK/Branch-SDK/BNCDeviceInfo.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ @implementation BNCDeviceInfo {
2727

2828
+ (BNCDeviceInfo *)getInstance {
2929
static BNCDeviceInfo *bnc_deviceInfo = 0;
30-
static dispatch_once_t onceToken;
30+
static dispatch_once_t onceToken = 0;
3131
dispatch_once(&onceToken, ^{
3232
bnc_deviceInfo = [[BNCDeviceInfo alloc] init];
3333
});

Branch-SDK/Branch-SDK/BNCError.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ typedef NS_ENUM(NSInteger, BNCErrorCode) {
3232
+ (NSError*_Nonnull) branchErrorWithCode:(BNCErrorCode)errorCode error:(NSError*_Nullable)error;
3333
+ (NSError*_Nonnull) branchErrorWithCode:(BNCErrorCode)errorCode localizedMessage:(NSString*_Nullable)message;
3434
@end
35+
36+
void BNCForceNSErrorCategoryToLoad(void) __attribute__((constructor));

Branch-SDK/Branch-SDK/BNCError.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
NSString * const BNCErrorDomain = @"io.branch.sdk.error";
1313

14-
void BNCForceNSErrorCategoryToLoad(void) __attribute__((constructor));
15-
void BNCForceNSErrorCategoryToLoad() {
14+
__attribute__((constructor)) void BNCForceNSErrorCategoryToLoad() {
1615
// Nothing here, but forces linker to load the category.
1716
}
1817

Branch-SDK/Branch-SDK/Branch.m

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#import "NSMutableDictionary+Branch.h"
4141
#import "BNCNetworkService.h"
4242
#import "BNCLog.h"
43+
#import "NSString+Branch.h"
4344
#import "BNCFabricAnswers.h"
4445
#import "../Fabric/FABKitProtocol.h" // Fabric
4546

@@ -77,7 +78,9 @@
7778

7879
void ForceCategoriesToLoad(void);
7980
void ForceCategoriesToLoad(void) {
80-
ForceNSMutableDictionaryToLoad();
81+
BNCForceNSErrorCategoryToLoad();
82+
BNCForceNSStringCategoryToLoad();
83+
BNCForceNSMutableDictionaryCategoryToLoad();
8184
}
8285

8386

@@ -125,15 +128,23 @@ + (void) load {
125128
[self openLog];
126129
}
127130

131+
static NSURL* bnc_logURL = nil;
132+
128133
+ (void) openLog {
129134
// Initialize the log
130-
BNCLogInitialize();
131-
BNCLogSetDisplayLevel(BNCLogLevelAll);
132-
NSURL *logURL = BNCURLForBranchDirectory();
133-
logURL = [logURL URLByAppendingPathComponent:@"Branch.log"];
134-
BNCLogSetOutputToURLByteWrap(logURL, 102400);
135-
BNCLogSetDisplayLevel(BNCLogLevelWarning);
136-
BNCLogDebug(@"Branch version %@ started at %@.", BNC_SDK_VERSION, [NSDate date]);
135+
@synchronized (self) {
136+
if (!bnc_logURL) {
137+
BNCLogInitialize();
138+
BNCLogSetDisplayLevel(BNCLogLevelAll);
139+
bnc_logURL = BNCURLForBranchDirectory();
140+
bnc_logURL = [bnc_logURL URLByAppendingPathComponent:@"Branch.log"];
141+
BNCLogSetOutputToURLByteWrap(bnc_logURL, 102400);
142+
BNCLogSetDisplayLevel(BNCLogLevelWarning);
143+
BNCLogDebug(@"Branch version %@ started at %@.", BNC_SDK_VERSION, [NSDate date]);
144+
} else {
145+
BNCLogSetOutputToURLByteWrap(bnc_logURL, 102400);
146+
}
147+
}
137148
}
138149

139150
+ (void) closeLog {
@@ -365,7 +376,8 @@ + (BOOL) enableFingerprintIDInCrashlyticsReports
365376

366377
- (void)setDebug {
367378
self.preferenceHelper.isDebug = YES;
368-
BNCLogSetDisplayLevel(BNCLogLevelDebug);
379+
if (BNCLogDisplayLevel() > BNCLogLevelDebug)
380+
BNCLogSetDisplayLevel(BNCLogLevelDebug);
369381
}
370382

371383
- (void)resetUserSession {
@@ -1652,6 +1664,8 @@ - (void) processRequest:(BNCServerRequest*)req
16521664
}
16531665
// On network problems, or Branch down, call the other callbacks and stop processing.
16541666
else {
1667+
BNCLogDebugSDK(@"Network error: failing queued requests.");
1668+
16551669
// First, gather all the requests to fail
16561670
NSMutableArray *requestsToFail = [[NSMutableArray alloc] init];
16571671
for (int i = 0; i < self.requestQueue.queueDepth; i++) {
@@ -1727,7 +1741,9 @@ - (void)processNextQueueItem {
17271741
#pragma mark - Session Initialization
17281742

17291743
- (void)initSessionIfNeededAndNotInProgress {
1730-
if (!self.isInitialized && !self.preferenceHelper.shouldWaitForInit && ![self.requestQueue containsInstallOrOpen]) {
1744+
if (!self.isInitialized &&
1745+
!self.preferenceHelper.shouldWaitForInit &&
1746+
![self.requestQueue containsInstallOrOpen]) {
17311747
[self initUserSessionAndCallCallback:NO];
17321748
}
17331749
}

Branch-SDK/Branch-SDK/BranchShareLink.m

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,18 +159,22 @@ - (void) presentActivityViewControllerFromViewController:(UIViewController*_Null
159159
shareViewController.title = self.title;
160160

161161
if ([shareViewController respondsToSelector:@selector(completionWithItemsHandler)]) {
162+
162163
shareViewController.completionWithItemsHandler =
163-
^ (NSString *activityType, BOOL completed, NSArray *returnedItems, NSError *activityError) {
164-
[self shareDidComplete:completed activityError:activityError];
165-
};
164+
^ (NSString *activityType, BOOL completed, NSArray *returnedItems, NSError *activityError) {
165+
[self shareDidComplete:completed activityError:activityError];
166+
};
167+
166168
} else {
169+
167170
#pragma clang diagnostic push
168171
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
169172
shareViewController.completionHandler =
170-
^ (UIActivityType activityType, BOOL completed) {
171-
[self shareDidComplete:completed activityError:nil];
172-
};
173+
^ (UIActivityType activityType, BOOL completed) {
174+
[self shareDidComplete:completed activityError:nil];
175+
};
173176
#pragma clang diagnostic pop
177+
174178
}
175179

176180
if (self.linkProperties.controlParams[BRANCH_LINK_DATA_KEY_EMAIL_SUBJECT]) {

Branch-SDK/Branch-SDK/NSMutableDictionary+Branch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#import <Foundation/Foundation.h>
1111

1212

13-
void ForceNSMutableDictionaryToLoad(void) __attribute__((constructor));
13+
void BNCForceNSMutableDictionaryCategoryToLoad(void) __attribute__((constructor));
1414

1515

1616
@interface NSMutableDictionary (Branch)

Branch-SDK/Branch-SDK/NSMutableDictionary+Branch.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ - (void) bnc_safeAddEntriesFromDictionary:(NSDictionary<id<NSCopying>,id> *)othe
3131
@end
3232

3333

34-
__attribute__((constructor)) void ForceNSMutableDictionaryToLoad(void) {
34+
__attribute__((constructor)) void BNCForceNSMutableDictionaryCategoryToLoad(void) {
3535
// Does nothing. But will force the linker to include this category.
3636
}

Branch-SDK/Branch-SDK/NSString+Branch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@
2828
- (NSString*_Nonnull) bnc_stringTruncatedAtNull;
2929

3030
@end
31+
32+
void BNCForceNSStringCategoryToLoad(void) __attribute__((constructor));

Branch-SDK/Branch-SDK/NSString+Branch.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
#import "NSString+Branch.h"
1717

1818

19-
void BNCForceNSStringCategoryToLoad(void) __attribute__((constructor));
20-
void BNCForceNSStringCategoryToLoad() {
19+
__attribute__((constructor)) void BNCForceNSStringCategoryToLoad() {
2120
// Nothing here, but forces linker to load the category.
2221
}
2322

Branch-TestBed-Xcode-7/Assets.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"size" : "20x20",
6+
"scale" : "2x"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"size" : "20x20",
11+
"scale" : "3x"
12+
},
313
{
414
"size" : "29x29",
515
"idiom" : "iphone",
@@ -54,6 +64,16 @@
5464
"filename" : "icon180x180.png",
5565
"scale" : "3x"
5666
},
67+
{
68+
"idiom" : "ipad",
69+
"size" : "20x20",
70+
"scale" : "1x"
71+
},
72+
{
73+
"idiom" : "ipad",
74+
"size" : "20x20",
75+
"scale" : "2x"
76+
},
5777
{
5878
"size" : "29x29",
5979
"idiom" : "ipad",

0 commit comments

Comments
 (0)