Skip to content

Commit

Permalink
Added property for Differentiating between archived and non-archived…
Browse files Browse the repository at this point in the history
… requests
  • Loading branch information
NidhiDixit09 committed Aug 1, 2024
1 parent c77e520 commit 19305dc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions Sources/BranchSDK/BNCServerRequestQueue.m
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ - (BranchOpenRequest *)findExistingInstallOrOpen {
BNCServerRequest *request = [self.queue objectAtIndex:i];

// Install subclasses open, so only need to check open
if ([request isKindOfClass:[BranchOpenRequest class]]) {
// Request should not be the one added from archived queue
if ([request isKindOfClass:[BranchOpenRequest class]] && !((BranchOpenRequest *)request).isFromArchivedQueue) {
return (BranchOpenRequest *)request;
}
}
Expand Down Expand Up @@ -279,6 +280,11 @@ - (void)retrieve {
NSData *data = [NSData dataWithContentsOfURL:self.class.URLForQueueFile options:0 error:&error];
if (!error && data) {
NSMutableArray *decodedQueue = [self unarchiveQueueFromData:data];
for (id request in decodedQueue) {
if ([request isKindOfClass:[BranchOpenRequest class]] || [request isKindOfClass:[BranchInstallRequest class]]) {
((BranchOpenRequest *)request).isFromArchivedQueue = YES;
}
}
self.queue = decodedQueue;
}
}
Expand Down Expand Up @@ -386,7 +392,7 @@ + (instancetype)getInstance {
static dispatch_once_t onceToken = 0;
dispatch_once(&onceToken, ^ {
sharedQueue = [[BNCServerRequestQueue alloc] init];
//[sharedQueue retrieve];
[sharedQueue retrieve];
[[BranchLogger shared] logVerbose:[NSString stringWithFormat:@"Retrieved from storage: %@.", sharedQueue] error:nil];
});
return sharedQueue;
Expand Down
1 change: 1 addition & 0 deletions Sources/BranchSDK/BranchOpenRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ - (id)initWithCallback:(callbackWithStatus)callback isInstall:(BOOL)isInstall {
if ((self = [super init])) {
_callback = callback;
_isInstall = isInstall;
_isFromArchivedQueue = NO;
}

return self;
Expand Down
2 changes: 1 addition & 1 deletion Sources/BranchSDK/Private/BranchOpenRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

// URL that triggered this install or open event
@property (nonatomic, copy, readwrite) NSString *urlString;

@property (assign, nonatomic) BOOL isFromArchivedQueue;
@property (nonatomic, copy) callbackWithStatus callback;

+ (void) waitForOpenResponseLock;
Expand Down

0 comments on commit 19305dc

Please sign in to comment.