Skip to content

Commit

Permalink
feat(destination): singular- add support for other apple os (#1611)
Browse files Browse the repository at this point in the history
* feat(destination): singular- add support for other apple os

* feat(destination): singular- address comments

* feat(destination): singular- address comment

* feat(destination): singular- add tolowercase for platform
  • Loading branch information
yashasvibajpai authored Nov 30, 2022
1 parent 0673c2f commit 63f23d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion __tests__/data/singular.json
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,7 @@
"content": "some content"
},
"os": {
"name": "iOS",
"name": "ipados",
"version": "9"
},
"screen": {
Expand Down
7 changes: 6 additions & 1 deletion v0/destinations/singular/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const {
extractCustomFields,
getValueFromMessage,
isDefinedAndNotNull,
toUnixTimestamp
isAppleFamily
} = require("../../util");

/*
Expand Down Expand Up @@ -108,6 +108,11 @@ const platformWisePayloadGenerator = (message, isSessionEvent) => {
if (!platform) {
throw new CustomError("[Singular] :: Platform name is missing", 400);
}
// checking if the os is one of ios, ipados, watchos, tvos
if (typeof platform === "string" && isAppleFamily(platform.toLowerCase())) {
message.context.os.name = "iOS";
platform = "iOS";
}
platform = platform.toLowerCase();
if (!SUPPORTED_PLATFORM[platform]) {
throw new CustomError("[Singular] :: Platform is not supported");
Expand Down

0 comments on commit 63f23d8

Please sign in to comment.