@@ -119,7 +119,9 @@ @interface Branch() <BranchDeepLinkingControllerCompletionDelegate> {
119119}
120120
121121// This isolation queue protects branch initialization and ensures things are processed in order.
122- @property (nonatomic , strong , readwrite ) dispatch_queue_t isolationQueue;
122+ @property (nonatomic , strong ) dispatch_queue_t isolationQueue;
123+ // Delayed initialization block to be used when other tasks are required to complete before initializing
124+ @property (nonatomic , strong ) dispatch_block_t delayedInitBlock;
123125
124126@property (strong , nonatomic ) BNCServerInterface *serverInterface;
125127@property (strong , nonatomic ) BNCServerRequestQueue *requestQueue;
@@ -917,6 +919,27 @@ - (void)checkAppleSearchAdsAttribution {
917919 });
918920}
919921
922+ #pragma mark - Delayed initialization
923+
924+ - (void ) dispatchInit : (dispatch_block_t ) initBlock After : (int )waitTime {
925+ self.delayedInitBlock = initBlock;
926+ dispatch_time_t time = dispatch_time (DISPATCH_TIME_NOW, (int64_t )(waitTime * NSEC_PER_SEC));
927+ dispatch_after (time, dispatch_get_main_queue (), self.delayedInitBlock );
928+ }
929+
930+ - (void )cancelDelayedInitialization {
931+ // does not affect execution of the block object that is already in progress,
932+ // but it does prevent future invocation of the same block
933+ dispatch_block_cancel (self.delayedInitBlock );
934+ NSLog (@" BranchSDK: cancelDelayedInitialization %@ " , @" success" );
935+ }
936+
937+ - (void )invokeDelayedInitialization {
938+ self.delayedInitBlock ();
939+ [self cancelDelayedInitialization ];
940+ NSLog (@" BranchSDK: invokeDelayedInitialization %@ " , @" success" );
941+ }
942+
920943#pragma mark - Facebook App Link Check
921944
922945- (void )registerFacebookDeepLinkingClass : (id )FBSDKAppLinkUtility {
@@ -1775,12 +1798,12 @@ - (void)registerViewWithParams:(NSDictionary *)params andCallback:(callbackWithP
17751798#pragma mark - Application State Change methods
17761799
17771800- (void )applicationDidBecomeActive {
1778- if (!Branch.trackingDisabled ) {
1779- if ((self.initializationStatus != BNCInitStatusInitialized) &&
1780- ![self .requestQueue containsInstallOrOpen ]) {
1781- [self initUserSessionAndCallCallback: YES ];
1782- }
1783- }
1801+ // if (!Branch.trackingDisabled) {
1802+ // if ((self.initializationStatus != BNCInitStatusInitialized) &&
1803+ // ![self.requestQueue containsInstallOrOpen]) {
1804+ // [self initUserSessionAndCallCallback:YES];
1805+ // }
1806+ // }
17841807}
17851808
17861809- (void )applicationWillResignActive {
0 commit comments