From 693526a08b07a5cd2265d533e208cffe88383d39 Mon Sep 17 00:00:00 2001 From: Olena Stepaniuk Date: Tue, 18 Jun 2024 13:02:03 +0300 Subject: [PATCH] feat: add hwv to request --- PrebidMobile/PrebidMobileRendering/ORTB/PBMORTBDevice.m | 1 + .../RenderingTests/Tests/PBMORTBAbstractTest.swift | 6 +++--- .../ParameterBuilderTests/ParameterBuilderServiceTest.swift | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/PrebidMobile/PrebidMobileRendering/ORTB/PBMORTBDevice.m b/PrebidMobile/PrebidMobileRendering/ORTB/PBMORTBDevice.m index 0f492b83b..9de0719f3 100644 --- a/PrebidMobile/PrebidMobileRendering/ORTB/PBMORTBDevice.m +++ b/PrebidMobile/PrebidMobileRendering/ORTB/PBMORTBDevice.m @@ -57,6 +57,7 @@ - (nonnull PBMJsonDictionary *)toJsonDictionary { ret[@"connectiontype"] = self.connectiontype; ret[@"didsha1"] = self.didsha1; ret[@"didmd5"] = self.didmd5; + ret[@"hwv"] = self.hwv; if (self.ifa) { ret[@"ifa"] = self.ifa; diff --git a/PrebidMobileTests/RenderingTests/Tests/PBMORTBAbstractTest.swift b/PrebidMobileTests/RenderingTests/Tests/PBMORTBAbstractTest.swift index 5fa411be0..f6f4161f7 100644 --- a/PrebidMobileTests/RenderingTests/Tests/PBMORTBAbstractTest.swift +++ b/PrebidMobileTests/RenderingTests/Tests/PBMORTBAbstractTest.swift @@ -478,14 +478,14 @@ class PBMORTBAbstractTest : XCTestCase { let pbmORTBPDevice = initORTBDevice(ifa: "ifa") pbmORTBPDevice.ua = userAgent let userAgentEscaped = userAgent.replacingOccurrences(of: "/", with: "\\/") - codeAndDecode(abstract: pbmORTBPDevice, expectedString: "{\"carrier\":\"AT&T\",\"connectiontype\":6,\"devicetype\":1,\"didmd5\":\"didmd5\",\"didsha1\":\"didsha1\",\"geofetch\":1,\"h\":100,\"ifa\":\"ifa\",\"js\":1,\"language\":\"en\",\"lmt\":1,\"make\":\"Apple\",\"mccmnc\":\"310-680\",\"model\":\"iPhone\",\"os\":\"iOS\",\"osv\":\"11.1\",\"ppi\":100,\"pxratio\":1.5,\"ua\":\"\(userAgentEscaped)\",\"w\":200}") + codeAndDecode(abstract: pbmORTBPDevice, expectedString: "{\"carrier\":\"AT&T\",\"connectiontype\":6,\"devicetype\":1,\"didmd5\":\"didmd5\",\"didsha1\":\"didsha1\",\"geofetch\":1,\"h\":100,\"hwv\":\"X\",\"ifa\":\"ifa\",\"js\":1,\"language\":\"en\",\"lmt\":1,\"make\":\"Apple\",\"mccmnc\":\"310-680\",\"model\":\"iPhone\",\"os\":\"iOS\",\"osv\":\"11.1\",\"ppi\":100,\"pxratio\":1.5,\"ua\":\"\(userAgentEscaped)\",\"w\":200}") } func testDeviceWithoutIfaToJsonString() { let pbmORTBPDevice = initORTBDevice(ifa: nil) pbmORTBPDevice.ua = userAgent let userAgentEscaped = userAgent.replacingOccurrences(of: "/", with: "\\/") - codeAndDecode(abstract: pbmORTBPDevice, expectedString: "{\"carrier\":\"AT&T\",\"connectiontype\":6,\"devicetype\":1,\"didmd5\":\"didmd5\",\"didsha1\":\"didsha1\",\"dpidmd5\":\"dpidmd5\",\"dpidsha1\":\"dpidsha1\",\"geofetch\":1,\"h\":100,\"js\":1,\"language\":\"en\",\"lmt\":1,\"macmd5\":\"macmd5\",\"macsha1\":\"macsha1\",\"make\":\"Apple\",\"mccmnc\":\"310-680\",\"model\":\"iPhone\",\"os\":\"iOS\",\"osv\":\"11.1\",\"ppi\":100,\"pxratio\":1.5,\"ua\":\"\(userAgentEscaped)\",\"w\":200}") + codeAndDecode(abstract: pbmORTBPDevice, expectedString: "{\"carrier\":\"AT&T\",\"connectiontype\":6,\"devicetype\":1,\"didmd5\":\"didmd5\",\"didsha1\":\"didsha1\",\"dpidmd5\":\"dpidmd5\",\"dpidsha1\":\"dpidsha1\",\"geofetch\":1,\"h\":100,\"hwv\":\"X\",\"js\":1,\"language\":\"en\",\"lmt\":1,\"macmd5\":\"macmd5\",\"macsha1\":\"macsha1\",\"make\":\"Apple\",\"mccmnc\":\"310-680\",\"model\":\"iPhone\",\"os\":\"iOS\",\"osv\":\"11.1\",\"ppi\":100,\"pxratio\":1.5,\"ua\":\"\(userAgentEscaped)\",\"w\":200}") } func testDeviceWithExtAttsToJsonString() { @@ -495,7 +495,7 @@ class PBMORTBAbstractTest : XCTestCase { pbmORTBPDevice.extAtts.ifv = "ifv" let userAgentEscaped = userAgent.replacingOccurrences(of: "/", with: "\\/") - codeAndDecode(abstract: pbmORTBPDevice, expectedString: "{\"carrier\":\"AT&T\",\"connectiontype\":6,\"devicetype\":1,\"didmd5\":\"didmd5\",\"didsha1\":\"didsha1\",\"dpidmd5\":\"dpidmd5\",\"dpidsha1\":\"dpidsha1\",\"ext\":{\"atts\":3,\"ifv\":\"ifv\"},\"geofetch\":1,\"h\":100,\"js\":1,\"language\":\"en\",\"lmt\":1,\"macmd5\":\"macmd5\",\"macsha1\":\"macsha1\",\"make\":\"Apple\",\"mccmnc\":\"310-680\",\"model\":\"iPhone\",\"os\":\"iOS\",\"osv\":\"11.1\",\"ppi\":100,\"pxratio\":1.5,\"ua\":\"\(userAgentEscaped)\",\"w\":200}") + codeAndDecode(abstract: pbmORTBPDevice, expectedString: "{\"carrier\":\"AT&T\",\"connectiontype\":6,\"devicetype\":1,\"didmd5\":\"didmd5\",\"didsha1\":\"didsha1\",\"dpidmd5\":\"dpidmd5\",\"dpidsha1\":\"dpidsha1\",\"ext\":{\"atts\":3,\"ifv\":\"ifv\"},\"geofetch\":1,\"h\":100,\"hwv\":\"X\",\"js\":1,\"language\":\"en\",\"lmt\":1,\"macmd5\":\"macmd5\",\"macsha1\":\"macsha1\",\"make\":\"Apple\",\"mccmnc\":\"310-680\",\"model\":\"iPhone\",\"os\":\"iOS\",\"osv\":\"11.1\",\"ppi\":100,\"pxratio\":1.5,\"ua\":\"\(userAgentEscaped)\",\"w\":200}") } func testGeoToJsonString() { diff --git a/PrebidMobileTests/RenderingTests/Tests/ParameterBuilderTests/ParameterBuilderServiceTest.swift b/PrebidMobileTests/RenderingTests/Tests/ParameterBuilderTests/ParameterBuilderServiceTest.swift index 96f40bdf9..191453408 100644 --- a/PrebidMobileTests/RenderingTests/Tests/ParameterBuilderTests/ParameterBuilderServiceTest.swift +++ b/PrebidMobileTests/RenderingTests/Tests/ParameterBuilderTests/ParameterBuilderServiceTest.swift @@ -114,6 +114,7 @@ class ParameterBuilderServiceTest : XCTestCase { PBMAssertEq(bidRequest.device.h!.intValue, Int(mockDeviceAccessManager.screenSize().height)) PBMAssertEq(bidRequest.device.ifa, MockDeviceAccessManager.mockAdvertisingIdentifier) PBMAssertEq(bidRequest.device.lmt, 0) + PBMAssertEq(bidRequest.device.hwv, mockDeviceAccessManager.platformString) if #available(iOS 16, *) { @@ -154,7 +155,7 @@ class ParameterBuilderServiceTest : XCTestCase { } let expectedOrtb = """ - {\"app\":{\"bundle\":\"Mock.Bundle.Identifier\",\"keywords\":\"appKeyword1,appKeyword2\",\"name\":\"MockBundleDisplayName\",\"publisher\":{\"name\":\"Publisher\"},\"storeurl\":\"https:\\/\\/openx.com\"},\"device\":{\(carrier)\"connectiontype\":2,\(deviceExt)\"geo\":{\"lat\":34.149335,\"lon\":-118.1328249,\"type\":1},\"h\":200,\"ifa\":\"abc123\",\"language\":\"ml\",\"lmt\":0,\"make\":\"MockMake\",\(mccmnc)\"model\":\"MockModel\",\"os\":\"MockOS\",\"osv\":\"1.2.3\",\"w\":100},\"imp\":[{\"clickbrowser\":1,\"displaymanager\":\"prebid-mobile\",\"displaymanagerver\":\"MOCK_SDK_VERSION\",\"ext\":{\"dlp\":1},\"instl\":0,\"secure\":1}],\"regs\":{\"coppa\":1,\"ext\":{\"gdpr\":0}},\"user\":{\"buyeruid\":\"buyerUID\",\"customdata\":\"customDataString\",\"ext\":{\"consent\":\"consentstring\"},\"gender\":\"M\",\"id\":\"userID\",\"keywords\":\"keyword1,keyword2\"}} + {\"app\":{\"bundle\":\"Mock.Bundle.Identifier\",\"keywords\":\"appKeyword1,appKeyword2\",\"name\":\"MockBundleDisplayName\",\"publisher\":{\"name\":\"Publisher\"},\"storeurl\":\"https:\\/\\/openx.com\"},\"device\":{\(carrier)\"connectiontype\":2,\(deviceExt)\"geo\":{\"lat\":34.149335,\"lon\":-118.1328249,\"type\":1},\"h\":200,\"hwv\":\"iPhone1,1\",\"ifa\":\"abc123\",\"language\":\"ml\",\"lmt\":0,\"make\":\"MockMake\",\(mccmnc)\"model\":\"MockModel\",\"os\":\"MockOS\",\"osv\":\"1.2.3\",\"w\":100},\"imp\":[{\"clickbrowser\":1,\"displaymanager\":\"prebid-mobile\",\"displaymanagerver\":\"MOCK_SDK_VERSION\",\"ext\":{\"dlp\":1},\"instl\":0,\"secure\":1}],\"regs\":{\"coppa\":1,\"ext\":{\"gdpr\":0}},\"user\":{\"buyeruid\":\"buyerUID\",\"customdata\":\"customDataString\",\"ext\":{\"consent\":\"consentstring\"},\"gender\":\"M\",\"id\":\"userID\",\"keywords\":\"keyword1,keyword2\"}} """ PBMAssertEq(strORTB, expectedOrtb) }