Skip to content

Commit

Permalink
Don't process archived Open Requests once an Open Request with link u…
Browse files Browse the repository at this point in the history
…rl get successful.
  • Loading branch information
NidhiDixit09 committed Aug 2, 2024
1 parent 19305dc commit ce36bbe
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions Sources/BranchSDK/BNCServerRequestQueue.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ - (instancetype)init {

self.queue = [NSMutableArray<BNCServerRequest *> new];
self.asyncQueue = dispatch_queue_create("io.branch.persist_queue", DISPATCH_QUEUE_SERIAL);
self.processArchivedOpens = YES;
return self;
}

Expand Down
9 changes: 9 additions & 0 deletions Sources/BranchSDK/Branch.m
Original file line number Diff line number Diff line change
Expand Up @@ -1885,6 +1885,15 @@ - (void)processNextQueueItem {
return;
}
}

if ( !(((BNCServerRequestQueue*)[BNCServerRequestQueue getInstance]).processArchivedOpens)
&& [req isKindOfClass:[BranchOpenRequest class]]
&& ((BranchOpenRequest *)req).isFromArchivedQueue){
[self.requestQueue remove:req];
self.networkCount = 0;
[self processNextQueueItem];
return;
}

dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(queue, ^ {
Expand Down
4 changes: 4 additions & 0 deletions Sources/BranchSDK/BranchOpenRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ - (void)processResponse:(BNCServerResponse *)response error:(NSError *)error {
}
}
}

if (referringURL.length > 0) {
((BNCServerRequestQueue *)[BNCServerRequestQueue getInstance]).processArchivedOpens = NO;
}

// Clear link identifiers so they don't get reused on the next open
preferenceHelper.linkClickIdentifier = nil;
Expand Down
2 changes: 2 additions & 0 deletions Sources/BranchSDK/Public/BNCServerRequestQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

@interface BNCServerRequestQueue : NSObject

@property (assign, nonatomic) BOOL processArchivedOpens;

- (void)enqueue:(BNCServerRequest *)request;
- (BNCServerRequest *)dequeue;
- (BNCServerRequest *)peek;
Expand Down

0 comments on commit ce36bbe

Please sign in to comment.