From 63f23d8dc8bcf80b84b0976903dfb360785bec86 Mon Sep 17 00:00:00 2001 From: Yashasvi Bajpai <33063622+yashasvibajpai@users.noreply.github.com> Date: Wed, 30 Nov 2022 13:29:51 +0530 Subject: [PATCH] feat(destination): singular- add support for other apple os (#1611) * 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 --- __tests__/data/singular.json | 2 +- v0/destinations/singular/util.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/__tests__/data/singular.json b/__tests__/data/singular.json index dd7343a6c50..da56b780bf4 100644 --- a/__tests__/data/singular.json +++ b/__tests__/data/singular.json @@ -1330,7 +1330,7 @@ "content": "some content" }, "os": { - "name": "iOS", + "name": "ipados", "version": "9" }, "screen": { diff --git a/v0/destinations/singular/util.js b/v0/destinations/singular/util.js index 0623c3bf823..164af542c94 100644 --- a/v0/destinations/singular/util.js +++ b/v0/destinations/singular/util.js @@ -19,7 +19,7 @@ const { extractCustomFields, getValueFromMessage, isDefinedAndNotNull, - toUnixTimestamp + isAppleFamily } = require("../../util"); /* @@ -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");