Skip to content

Commit

Permalink
JSON encoder: normalize deviceToken hex string
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardopereira committed Feb 22, 2017
1 parent 6a5b42f commit 4ab1d74
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Source/ARTJsonLikeEncoder.m
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,11 @@ - (NSDictionary *)devicePushDetailsToDictionary:(ARTDevicePushDetails *)devicePu
dictionary[@"transportType"] = devicePushDetails.transportType;

if (devicePushDetails.deviceToken) {
// HEX string, i.e.: <12ce7dda 8032c423 8f8bd40f 3484e5bb f4698da5 8b7fdf8d 5c55e0a2 XXXXXXXX>
// Normalizing token by removing symbols and spaces, i.e.: 12ce7dda8032c4238f8bd40f3484e5bbf4698da58b7fdf8d5c55e0a2XXXXXXXX
NSString *token = [[[devicePushDetails.deviceToken description] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]] stringByReplacingOccurrencesOfString:@" " withString:@""];
dictionary[@"metadata"] = @{
@"deviceToken": [devicePushDetails.deviceToken description], // HEX string
@"deviceToken": token,
};
}

Expand Down

0 comments on commit 4ab1d74

Please sign in to comment.