Skip to content

Commit

Permalink
Update Request Field Names and Format
Browse files Browse the repository at this point in the history
Appended date in GMT format to branch_sdk_request_uuid in order to match it with Gateway format.
  • Loading branch information
NidhiDixit09 committed Oct 3, 2024
1 parent c114e12 commit c2082f9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
16 changes: 14 additions & 2 deletions Sources/BranchSDK/BNCServerRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ @implementation BNCServerRequest

- (id) init {
if ((self = [super init])) {
_requestUUID = [[NSUUID UUID ] UUIDString];
_requestCreationTimeStamp = BNCWireFormatFromDate([NSDate date]);
NSDate *timeStampDate = [NSDate date];
_requestUUID = [self generateRequestUUIDFromDate:timeStampDate];
_requestCreationTimeStamp = BNCWireFormatFromDate(timeStampDate);
}
return self;
}
Expand Down Expand Up @@ -52,4 +53,15 @@ + (BOOL)supportsSecureCoding {
return YES;
}

- (NSString *) generateRequestUUIDFromDate:(NSDate *) localDate {
NSString *uuid = [[NSUUID UUID ] UUIDString];

NSTimeZone *gmt = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateFormat = @"'-'yyyyMMddHH";
[dateFormatter setTimeZone:gmt];

return [uuid stringByAppendingString:[dateFormatter stringFromDate:localDate]];
}

@end
4 changes: 2 additions & 2 deletions Sources/BranchSDK/BranchConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,6 @@
NSString * const BRANCH_REQUEST_KEY_DMA_AD_PEROSALIZATION = @"dma_ad_personalization";
NSString * const BRANCH_REQUEST_KEY_DMA_AD_USER_DATA = @"dma_ad_user_data";

NSString * const BRANCH_REQUEST_KEY_REQUEST_UUID = @"request_uuid";
NSString * const BRANCH_REQUEST_KEY_REQUEST_CREATION_TIME_STAMP = @"request_creation_time_stamp";
NSString * const BRANCH_REQUEST_KEY_REQUEST_UUID = @"branch_sdk_request_uuid";
NSString * const BRANCH_REQUEST_KEY_REQUEST_CREATION_TIME_STAMP = @"branch_sdk_request_creation_time_stamp";

0 comments on commit c2082f9

Please sign in to comment.