@@ -152,6 +152,8 @@ + (void) openLog {
152152 BNCLogSetOutputToURLByteWrap (bnc_logURL, 102400 );
153153 #else
154154 BNCLogSetOutputFunction (NULL );
155+ if (bnc_logURL)
156+ [[NSFileManager defaultManager ] removeItemAtURL: bnc_logURL error: nil ];
155157 #endif
156158 BNCLogSetDisplayLevel (BNCLogLevelWarning); // Default
157159
@@ -219,7 +221,7 @@ - (id)initWithInterface:(BNCServerInterface *)interface
219221 _requestQueue = queue;
220222 _linkCache = cache;
221223 _preferenceHelper = preferenceHelper;
222-
224+
223225 _contentDiscoveryManager = [[BNCContentDiscoveryManager alloc ] init ];
224226 _isInitialized = NO ;
225227 _shouldCallSessionInitCallback = YES ;
@@ -745,25 +747,25 @@ - (BOOL)handleUniversalDeepLink:(NSURL*)url fromSelf:(BOOL)isFromSelf {
745747
746748- (BOOL )continueUserActivity : (NSUserActivity *)userActivity {
747749 BNCLogDebugSDK (@" continueUserActivity:" );
748-
750+
749751 // Check to see if a browser activity needs to be handled
750752 if ([userActivity.activityType isEqualToString: NSUserActivityTypeBrowsingWeb ]) {
751-
753+
752754 // If we're already in-progress cancel the last open and do this one.
753755 BOOL isNewSession = NO ;
754756 if (![self removeInstallOrOpen ]) {
755757 isNewSession = YES ;
756758 }
757-
759+
758760 return [self handleUniversalDeepLink: userActivity.webpageURL fromSelf: isNewSession];
759761 }
760-
762+
761763 // Check to see if a spotlight activity needs to be handled
762764 NSString *spotlightIdentifier =
763765 [self .contentDiscoveryManager spotlightIdentifierFromActivity: userActivity];
764766 NSURL *webURL = userActivity.webpageURL ;
765-
766-
767+
768+
767769 if ([self isBranchLink: userActivity.userInfo[CSSearchableItemActivityIdentifier]]) {
768770 return [self handleDeepLinkWithNewSession: [NSURL URLWithString: userActivity.userInfo[CSSearchableItemActivityIdentifier]]];
769771 }
@@ -782,7 +784,7 @@ - (BOOL)continueUserActivity:(NSUserActivity *)userActivity {
782784 }
783785 self.preferenceHelper .shouldWaitForInit = NO ;
784786 [self initUserSessionAndCallCallback: YES ];
785-
787+
786788 return spotlightIdentifier != nil ;
787789}
788790
@@ -799,7 +801,7 @@ - (BOOL)isBranchLink: (NSString*)urlString {
799801 }
800802 }
801803 }
802-
804+
803805 NSString *userActivityURL = urlString;
804806 NSArray *branchDomains = [NSArray arrayWithObjects: @" bnc.lt" , @" app.link" , @" test-app.link" , nil ];
805807 for (NSString * domain in branchDomains) {
@@ -822,7 +824,7 @@ - (void)handlePushNotification:(NSDictionary *)userInfo {
822824
823825 // If app is active, then close out the session and start a new one.
824826 // Else the URL will be handled by `applicationDidBecomeActive`.
825-
827+
826828 Class UIApplicationClass = NSClassFromString (@" UIApplication" );
827829 if ([[UIApplicationClass sharedApplication ] applicationState ] == UIApplicationStateActive) {
828830 NSURL *url = [NSURL URLWithString: urlStr];
@@ -1440,7 +1442,7 @@ - (void)indexOnSpotlightWithBranchUniversalObject:(BranchUniversalObject*)univer
14401442 linkProperties : (BranchLinkProperties*)linkProperties
14411443 completion : (void (^) (BranchUniversalObject *universalObject, NSString * url,NSError *error))completion {
14421444 BNCSpotlightService *spotlightService = [[BNCSpotlightService alloc ] init ];
1443-
1445+
14441446 if (!universalObject) {
14451447 NSError * error = [NSError branchErrorWithCode: BNCInitError localizedMessage: @" Branch Universal Object is nil" ];
14461448 completion (universalObject,nil ,error);
@@ -1464,7 +1466,7 @@ - (void)indexOnSpotlightWithBranchUniversalObject:(BranchUniversalObject*)univer
14641466- (void )indexOnSpotlightUsingSearchableItems : (NSArray <BranchUniversalObject*>* )universalObjects
14651467 completion : (void (^) (NSArray <BranchUniversalObject*>* universalObjects,
14661468 NSError * error))completion {
1467-
1469+
14681470 BNCSpotlightService *spotlight = [[BNCSpotlightService alloc ] init ];
14691471 [spotlight indexPrivatelyWithBranchUniversalObjects: universalObjects
14701472 completion: ^(NSArray <BranchUniversalObject *> * _Nullable universalObjects,
@@ -1477,7 +1479,7 @@ - (void)indexOnSpotlightUsingSearchableItems:(NSArray<BranchUniversalObject*>* )
14771479- (void )removeSearchableItemWithBranchUniversalObject : (BranchUniversalObject *)universalObject
14781480 callback : (void (^_Nullable)(NSError * _Nullable error))completion {
14791481 BNCSpotlightService *spotlight = [[BNCSpotlightService alloc ] init ];
1480-
1482+
14811483 NSString *dynamicUrl = [universalObject getLongUrlWithChannel: nil
14821484 andTags: nil
14831485 andFeature: BNCSpotlightFeature
@@ -1504,7 +1506,7 @@ - (void)removeSearchableItemsWithBranchUniversalObjects:(NSArray<BranchUniversal
15041506 andStage: nil andAlias: nil ];
15051507 [identifiers addObject: dynamicUrl];
15061508 }
1507-
1509+
15081510 [spotlight removeSearchableItemsWithIdentifiers: identifiers
15091511 callback: ^(NSError * error) {
15101512 if (completion)
@@ -1949,7 +1951,7 @@ - (void) clearNetworkQueue {
19491951 dispatch_semaphore_wait (self.processing_sema , DISPATCH_TIME_FOREVER);
19501952 self.networkCount = 0 ;
19511953 [[BNCServerRequestQueue getInstance ] clearQueue ];
1952- dispatch_semaphore_signal (self.processing_sema );
1954+ dispatch_semaphore_signal (self.processing_sema );
19531955}
19541956
19551957#pragma mark - Session Initialization
@@ -2218,7 +2220,7 @@ - (void) sendOpenNotificationWithLinkParameters:(NSDictionary*)linkParameters
22182220 }
22192221 if ([self .delegate respondsToSelector: @selector (branch:didStartSessionWithURL:branchLink: )])
22202222 [self .delegate branch: self didStartSessionWithURL: originalURL branchLink: branchLink];
2221-
2223+
22222224 }
22232225
22242226 NSMutableDictionary *userInfo = [NSMutableDictionary new ];
0 commit comments