From 3bc5075cb72a9855d50c23dae6a8e44584e13e29 Mon Sep 17 00:00:00 2001 From: Olena Stepaniuk Date: Mon, 24 Jun 2024 20:29:48 +0300 Subject: [PATCH 1/5] feat: support GMA SDK 11.6.0 --- .../Sources/PrebidAdMobMediationBaseAdapter.swift | 2 +- .../Sources/GAMUtils.swift | 2 +- Podfile.lock | 12 ++++++------ .../PrebidGAMVersionChecker.swift | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobMediationBaseAdapter.swift b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobMediationBaseAdapter.swift index dbaf987ea..1da332a11 100644 --- a/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobMediationBaseAdapter.swift +++ b/EventHandlers/PrebidMobileAdMobAdapters/Sources/PrebidAdMobMediationBaseAdapter.swift @@ -41,7 +41,7 @@ public class PrebidAdMobMediationBaseAdapter: NSObject, GADMediationAdapter { // Added for tests static func latestTestedGMAVersion() -> GADVersionNumber { - return GADVersionNumber(majorVersion: 11, minorVersion: 5, patchVersion: 0) + return GADVersionNumber(majorVersion: 11, minorVersion: 6, patchVersion: 0) } required public override init() { diff --git a/EventHandlers/PrebidMobileGAMEventHandlers/Sources/GAMUtils.swift b/EventHandlers/PrebidMobileGAMEventHandlers/Sources/GAMUtils.swift index 747fd252a..189e28681 100644 --- a/EventHandlers/PrebidMobileGAMEventHandlers/Sources/GAMUtils.swift +++ b/EventHandlers/PrebidMobileGAMEventHandlers/Sources/GAMUtils.swift @@ -59,7 +59,7 @@ public class GAMUtils: NSObject { // Added for tests static func latestTestedGMAVersion() -> GADVersionNumber { - return GADVersionNumber(majorVersion: 11, minorVersion: 5, patchVersion: 0) + return GADVersionNumber(majorVersion: 11, minorVersion: 6, patchVersion: 0) } // MARK: Private Methods diff --git a/Podfile.lock b/Podfile.lock index f9f749f6e..f649a9589 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,10 +1,10 @@ PODS: - Alamofire (4.9.1) - AppLovinSDK (12.5.0) - - Eureka (5.4.0) - - Google-Mobile-Ads-SDK (11.5.0): + - Eureka (5.5.0) + - Google-Mobile-Ads-SDK (11.6.0): - GoogleUserMessagingPlatform (>= 1.1) - - GoogleAds-IMA-iOS-SDK (3.22.1) + - GoogleAds-IMA-iOS-SDK (3.23.0) - GoogleUserMessagingPlatform (2.4.0) - RxSwift (6.7.1) - SVProgressHUD (2.3.1): @@ -34,9 +34,9 @@ SPEC REPOS: SPEC CHECKSUMS: Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18 AppLovinSDK: 626d2aea57ae1bf9280d2012e8e20c521c58ce28 - Eureka: fadaa9fa3d6e402d3c60f78f24edf3d7bafc9c29 - Google-Mobile-Ads-SDK: 7db2098033ad3bfcd72a11e7503b49700a93029e - GoogleAds-IMA-iOS-SDK: 160c3616b8371b58016e30aaf441e71d6d9e8f7d + Eureka: 1c18c7fcd8f772cc2ca42d6be36292dffa77eecb + Google-Mobile-Ads-SDK: 28339250757645a9bab066ebbe667fa48d2c9bd7 + GoogleAds-IMA-iOS-SDK: ee2a68ed7a1a17c7bb81bdb1b81590b35a3fc8f3 GoogleUserMessagingPlatform: f131fa7978d2ba88d7426702b057c2cc318e6595 RxSwift: b9a93a26031785159e11abd40d1a55bcb8057e52 SVProgressHUD: 4837c74bdfe2e51e8821c397825996a8d7de6e22 diff --git a/PrebidMobile/ConfigurationAndTargeting/PrebidGAMVersionChecker.swift b/PrebidMobile/ConfigurationAndTargeting/PrebidGAMVersionChecker.swift index 6d833453f..ca61da7d5 100644 --- a/PrebidMobile/ConfigurationAndTargeting/PrebidGAMVersionChecker.swift +++ b/PrebidMobile/ConfigurationAndTargeting/PrebidGAMVersionChecker.swift @@ -18,7 +18,7 @@ import Foundation class PrebidGAMVersionChecker { var latestTestedGMAVersion: (Int, Int, Int) { - (11, 5, 0) + (11, 6, 0) } var currentGMAVersion: (Int, Int, Int)? From 1c0849a318d38e07124030c91d32bfd761b2d147 Mon Sep 17 00:00:00 2001 From: Olena Stepaniuk Date: Tue, 25 Jun 2024 10:07:56 +0300 Subject: [PATCH 2/5] feat: update ci settings and scripts --- .circleci/config.yml | 12 ++++++++---- scripts/testPrebidDemo.sh | 2 +- scripts/testPrebidMobile.sh | 8 ++++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 099ec2ed9..a39e467b4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,8 @@ version: 2.1 jobs: build: macos: - xcode: 14.1.0 + xcode: 15.4.0 + resource_class: macos.m1.large.gen1 steps: - checkout - run: @@ -12,7 +13,8 @@ jobs: unit-test: macos: - xcode: 14.1.0 + xcode: 15.4.0 + resource_class: macos.m1.large.gen1 steps: - checkout - run: @@ -21,7 +23,8 @@ jobs: run-swift-demo-integration-tests: macos: - xcode: 14.1.0 + xcode: 15.4.0 + resource_class: macos.m1.large.gen1 steps: - checkout - run: @@ -30,7 +33,8 @@ jobs: run-swift-demo-ui-tests: macos: - xcode: 14.1.0 + xcode: 15.4.0 + resource_class: macos.m1.large.gen1 steps: - checkout - run: diff --git a/scripts/testPrebidDemo.sh b/scripts/testPrebidDemo.sh index 8b9f9c253..d1fe8efee 100755 --- a/scripts/testPrebidDemo.sh +++ b/scripts/testPrebidDemo.sh @@ -25,7 +25,7 @@ else SCHEME="PrebidDemoTests" TEST="Integration" fi -xcodebuild test -workspace PrebidMobile.xcworkspace -scheme $SCHEME -test-iterations 2 -retry-tests-on-failure -destination 'platform=iOS Simulator,name=iPhone 14 Pro,OS=latest' | xcpretty -f `xcpretty-travis-formatter` --color --test +xcodebuild test -workspace PrebidMobile.xcworkspace -scheme $SCHEME -test-iterations 2 -retry-tests-on-failure -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=latest' | xcpretty -f `xcpretty-travis-formatter` --color --test if [[ ${PIPESTATUS[0]} == 0 ]]; then echo "✅ ${TEST} Tests Passed" diff --git a/scripts/testPrebidMobile.sh b/scripts/testPrebidMobile.sh index 86550a3a2..3e79d12d4 100755 --- a/scripts/testPrebidMobile.sh +++ b/scripts/testPrebidMobile.sh @@ -54,7 +54,7 @@ echo -e "\n${GREEN}Running PrebidMobile unit tests${NC} \n" xcodebuild test \ -workspace PrebidMobile.xcworkspace \ -scheme "PrebidMobileTests" \ - -destination 'platform=iOS Simulator,name=iPhone 14 Pro,OS=latest' | xcpretty --color --test + -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=latest' | xcpretty --color --test if [[ ${PIPESTATUS[0]} == 0 ]]; then echo "✅ PrebidMobile Unit Tests Passed" @@ -67,7 +67,7 @@ echo -e "\n${GREEN}Running PrebidMobileGAMEventHandlers unit tests${NC} \n" xcodebuild test \ -workspace PrebidMobile.xcworkspace \ -scheme "PrebidMobileGAMEventHandlersTests" \ - -destination 'platform=iOS Simulator,name=iPhone 14 Pro,OS=latest' | xcpretty --color --test + -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=latest' | xcpretty --color --test if [[ ${PIPESTATUS[0]} == 0 ]]; then echo "✅ PrebidMobileGAMEventHandlers Unit Tests Passed" @@ -77,7 +77,7 @@ else fi echo -e "\n${GREEN}Running PrebidMobileAdMobAdapters unit tests${NC} \n" -xcodebuild test -workspace PrebidMobile.xcworkspace -scheme "PrebidMobileAdMobAdaptersTests" -destination 'platform=iOS Simulator,name=iPhone 14 Pro,OS=latest' | xcpretty -f `xcpretty-travis-formatter` --color --test +xcodebuild test -workspace PrebidMobile.xcworkspace -scheme "PrebidMobileAdMobAdaptersTests" -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=latest' | xcpretty -f `xcpretty-travis-formatter` --color --test if [[ ${PIPESTATUS[0]} == 0 ]]; then echo "✅ PrebidMobileAdMobAdapters Unit Tests Passed" @@ -87,7 +87,7 @@ else fi echo -e "\n${GREEN}Running PrebidMobileMAXAdapters unit tests${NC} \n" -xcodebuild test -workspace PrebidMobile.xcworkspace -scheme "PrebidMobileMAXAdaptersTests" -destination 'platform=iOS Simulator,name=iPhone 14 Pro,OS=latest' | xcpretty -f `xcpretty-travis-formatter` --color --test +xcodebuild test -workspace PrebidMobile.xcworkspace -scheme "PrebidMobileMAXAdaptersTests" -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=latest' | xcpretty -f `xcpretty-travis-formatter` --color --test if [[ ${PIPESTATUS[0]} == 0 ]]; then echo "✅ PrebidMobileMAXAdapters Unit Tests Passed" From 8c8063df5d24427bfb73df6248a076b0fa997d36 Mon Sep 17 00:00:00 2001 From: Olena Stepaniuk Date: Wed, 3 Jul 2024 08:56:06 +0300 Subject: [PATCH 3/5] fix: sdk unit tests --- PrebidMobile.xcodeproj/project.pbxproj | 12 +++++++ PrebidMobile/Host.swift | 2 +- .../AdTypes/AdView/PBMMRAIDController.m | 7 ++-- .../NSURL+PBMExtensions.h | 26 +++++++++++++++ .../NSURL+PBMExtensions.m | 32 +++++++++++++++++++ .../Networking/PrebidServerConnection.swift | 2 +- .../Utilities/PBMDeepLinkPlus.m | 3 +- .../Utilities/PBMDeviceAccessManager.m | 6 +++- PrebidMobile/Utils/URL+Extensions.swift | 31 ++++++++++++++++++ 9 files changed, 114 insertions(+), 7 deletions(-) create mode 100644 PrebidMobile/PrebidMobileRendering/ExtensionsAndWrappers/NSURL+PBMExtensions.h create mode 100644 PrebidMobile/PrebidMobileRendering/ExtensionsAndWrappers/NSURL+PBMExtensions.m create mode 100644 PrebidMobile/Utils/URL+Extensions.swift diff --git a/PrebidMobile.xcodeproj/project.pbxproj b/PrebidMobile.xcodeproj/project.pbxproj index dc8ac5ae8..c859a4954 100644 --- a/PrebidMobile.xcodeproj/project.pbxproj +++ b/PrebidMobile.xcodeproj/project.pbxproj @@ -115,6 +115,9 @@ 53CE09012AD673020018CB75 /* sample_ortb_native_with_win_event.json in Resources */ = {isa = PBXBuildFile; fileRef = 53CE09002AD673020018CB75 /* sample_ortb_native_with_win_event.json */; }; 53CE09032AD67ECE0018CB75 /* MockPBMBidRequester.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53CE09022AD67ECE0018CB75 /* MockPBMBidRequester.swift */; }; 53CF5B3729DC690600613E84 /* VideoAdUnit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53CF5B3629DC690600613E84 /* VideoAdUnit.swift */; }; + 53D3C3882C2BEE1E0074D99B /* URL+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53D3C3872C2BEE1E0074D99B /* URL+Extensions.swift */; }; + 53D3C38D2C2BEF9B0074D99B /* NSURL+PBMExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 53D3C38C2C2BEF9B0074D99B /* NSURL+PBMExtensions.m */; }; + 53D3C38E2C2BEF9B0074D99B /* NSURL+PBMExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 53D3C38B2C2BEF9B0074D99B /* NSURL+PBMExtensions.h */; }; 53D934FF282CE62E0092E243 /* AgeUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53D934FE282CE62E0092E243 /* AgeUtils.swift */; }; 53D93505282CEA900092E243 /* DateFormatService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53D93504282CEA900092E243 /* DateFormatService.swift */; }; 53E3910E27FCD60800DBA2F7 /* VideoParameters.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53E3910D27FCD60800DBA2F7 /* VideoParameters.swift */; }; @@ -963,6 +966,9 @@ 53CE09002AD673020018CB75 /* sample_ortb_native_with_win_event.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = sample_ortb_native_with_win_event.json; sourceTree = ""; }; 53CE09022AD67ECE0018CB75 /* MockPBMBidRequester.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockPBMBidRequester.swift; sourceTree = ""; }; 53CF5B3629DC690600613E84 /* VideoAdUnit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoAdUnit.swift; sourceTree = ""; }; + 53D3C3872C2BEE1E0074D99B /* URL+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+Extensions.swift"; sourceTree = ""; }; + 53D3C38B2C2BEF9B0074D99B /* NSURL+PBMExtensions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSURL+PBMExtensions.h"; sourceTree = ""; }; + 53D3C38C2C2BEF9B0074D99B /* NSURL+PBMExtensions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSURL+PBMExtensions.m"; sourceTree = ""; }; 53D934FE282CE62E0092E243 /* AgeUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgeUtils.swift; sourceTree = ""; }; 53D93504282CEA900092E243 /* DateFormatService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateFormatService.swift; sourceTree = ""; }; 53E3910D27FCD60800DBA2F7 /* VideoParameters.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoParameters.swift; sourceTree = ""; }; @@ -1861,6 +1867,7 @@ 34C9CD5E2850CE6300FB5451 /* OMSDKVersionProvider.m */, 53F35F6E292BAE9B001C1183 /* UserDefaults+Extensions.swift */, 53842BBB29E565030069A4B7 /* NSString+Extensions.swift */, + 53D3C3872C2BEE1E0074D99B /* URL+Extensions.swift */, ); path = Utils; sourceTree = ""; @@ -1955,6 +1962,8 @@ 5BC3765E271F1CFD00444D5E /* UIWindow+PBMExtensions.h */, 5BC3766F271F1CFD00444D5E /* UIWindow+PBMExtensions.m */, 53C925012990FB30009E6F94 /* String+Extensions.swift */, + 53D3C38B2C2BEF9B0074D99B /* NSURL+PBMExtensions.h */, + 53D3C38C2C2BEF9B0074D99B /* NSURL+PBMExtensions.m */, ); path = ExtensionsAndWrappers; sourceTree = ""; @@ -3360,6 +3369,7 @@ 5BC37A66271F1D0000444D5E /* PBMORTBBidExtSkadn.h in Headers */, 5BC37AD7271F1D0100444D5E /* PBMUserConsentParameterBuilder.h in Headers */, 5BC37964271F1D0000444D5E /* PBMVastResponse.h in Headers */, + 53D3C38E2C2BEF9B0074D99B /* NSURL+PBMExtensions.h in Headers */, 5BC379CC271F1D0000444D5E /* PBMAdLoadManagerVAST.h in Headers */, 5BC37985271F1D0000444D5E /* PBMMRAIDController.h in Headers */, 5BC3790F271F1CFF00444D5E /* PBMDeviceAccessManager.h in Headers */, @@ -3963,6 +3973,7 @@ 9236A650272FEC5A00ABBEF4 /* ImpressionTask.swift in Sources */, 5BC37A97271F1D0000444D5E /* InterstitialEventHandlerProtocol.swift in Sources */, 5BC379F3271F1D0000444D5E /* PBMExternalLinkHandler.m in Sources */, + 53D3C38D2C2BEF9B0074D99B /* NSURL+PBMExtensions.m in Sources */, 5BC379AD271F1D0000444D5E /* PBMTransaction.m in Sources */, 53269D55282E6D0F0098550D /* ServerEvent.swift in Sources */, 5BC37A5E271F1D0000444D5E /* PBMORTBBidResponseExt.m in Sources */, @@ -4190,6 +4201,7 @@ 5BC37961271F1D0000444D5E /* PBMVastAdsBuilder.m in Sources */, 5BC37A91271F1D0000444D5E /* InterstitialEventLoadingDelegate.swift in Sources */, 530382F2283197E100B2B111 /* PrebidServerResponse.swift in Sources */, + 53D3C3882C2BEE1E0074D99B /* URL+Extensions.swift in Sources */, 5BC3792F271F1D0000444D5E /* PBMDeviceAccessManager.m in Sources */, 5BC37A6E271F1D0000444D5E /* PBMORTBBidResponse.m in Sources */, 5BC37ACE271F1D0100444D5E /* PBMGeoLocationParameterBuilder.m in Sources */, diff --git a/PrebidMobile/Host.swift b/PrebidMobile/Host.swift index ca0dc8223..06fb571bc 100644 --- a/PrebidMobile/Host.swift +++ b/PrebidMobile/Host.swift @@ -57,7 +57,7 @@ public class Host: NSObject { */ @objc public func setCustomHostURL(_ urlString: String?) throws { - guard let url = URL(string: urlString!) else { + guard let url = URL.urlWithoutEncoding(from: urlString) else { throw ErrorCode.prebidServerURLInvalid(urlString ?? "") } customHostURL = url diff --git a/PrebidMobile/PrebidMobileRendering/AdTypes/AdView/PBMMRAIDController.m b/PrebidMobile/PrebidMobileRendering/AdTypes/AdView/PBMMRAIDController.m index e941e5c64..32f827d3b 100644 --- a/PrebidMobile/PrebidMobileRendering/AdTypes/AdView/PBMMRAIDController.m +++ b/PrebidMobile/PrebidMobileRendering/AdTypes/AdView/PBMMRAIDController.m @@ -20,6 +20,7 @@ #import "NSException+PBMExtensions.h" #import "NSString+PBMExtensions.h" #import "UIView+PBMExtensions.h" +#import "NSURL+PBMExtensions.h" #import "PBMAbstractCreative.h" #import "PBMCreativeModel.h" @@ -277,7 +278,7 @@ - (void)handleMRAIDCommandOpen:(PBMMRAIDCommand *)command { @throw [NSException pbmException:@"No arguments to MRAID.open()"]; } - NSURL *url = [NSURL URLWithString:strURL]; + NSURL *url = [NSURL PBMURLWithoutEncodingFromString:strURL]; if (!url) { @throw [NSException pbmException:[NSString stringWithFormat:@"Could not create URL from string: %@", strURL]]; } @@ -323,7 +324,7 @@ - (void)handleMRAIDCommandExpand:(PBMMRAIDCommand *)command originURL:(NSURL *)u NSString *strExpandURL = [[command.arguments firstObject] stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet]; if (strExpandURL && ![strExpandURL isEqualToString:@""]) { //Epanding to a URL - NSURL *expandURL = [NSURL URLWithString:strExpandURL]; + NSURL *expandURL = [NSURL PBMURLWithoutEncodingFromString:strExpandURL]; if (!expandURL) { PBMLogError(@"Could not create expand url to: %@", strExpandURL); return; @@ -532,7 +533,7 @@ - (void)handleMRAIDCommandPlayVideo:(PBMMRAIDCommand *)command { @throw [NSException pbmException:@"Insufficient arguments for MRAIDAction.playVideo"]; } - NSURL *url = [NSURL URLWithString:strURL]; + NSURL *url = [NSURL PBMURLWithoutEncodingFromString:strURL]; if (!url) { NSString *message = [NSString stringWithFormat:@"MRAID attempted to load an invalid URL: %@", strURL]; @throw [NSException pbmException:message]; diff --git a/PrebidMobile/PrebidMobileRendering/ExtensionsAndWrappers/NSURL+PBMExtensions.h b/PrebidMobile/PrebidMobileRendering/ExtensionsAndWrappers/NSURL+PBMExtensions.h new file mode 100644 index 000000000..ace33cb9c --- /dev/null +++ b/PrebidMobile/PrebidMobileRendering/ExtensionsAndWrappers/NSURL+PBMExtensions.h @@ -0,0 +1,26 @@ +/*   Copyright 2018-2024 Prebid.org, Inc. + +  Licensed under the Apache License, Version 2.0 (the "License"); +  you may not use this file except in compliance with the License. +  You may obtain a copy of the License at + +  http://www.apache.org/licenses/LICENSE-2.0 + +  Unless required by applicable law or agreed to in writing, software +  distributed under the License is distributed on an "AS IS" BASIS, +  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +  See the License for the specific language governing permissions and +  limitations under the License. +  */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface NSURL (PBMExtensions) + ++ (NSURL *)PBMURLWithoutEncodingFromString:(NSString *)str; + +@end + +NS_ASSUME_NONNULL_END diff --git a/PrebidMobile/PrebidMobileRendering/ExtensionsAndWrappers/NSURL+PBMExtensions.m b/PrebidMobile/PrebidMobileRendering/ExtensionsAndWrappers/NSURL+PBMExtensions.m new file mode 100644 index 000000000..ad2f97ae2 --- /dev/null +++ b/PrebidMobile/PrebidMobileRendering/ExtensionsAndWrappers/NSURL+PBMExtensions.m @@ -0,0 +1,32 @@ +/*   Copyright 2018-2024 Prebid.org, Inc. + +  Licensed under the Apache License, Version 2.0 (the "License"); +  you may not use this file except in compliance with the License. +  You may obtain a copy of the License at + +  http://www.apache.org/licenses/LICENSE-2.0 + +  Unless required by applicable law or agreed to in writing, software +  distributed under the License is distributed on an "AS IS" BASIS, +  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +  See the License for the specific language governing permissions and +  limitations under the License. +  */ + +#import "NSURL+PBMExtensions.h" + +@implementation NSURL (PBMExtensions) + ++ (NSURL *)PBMURLWithoutEncodingFromString:(NSString *)str { + if (!str) { + return nil; + } + + if (@available(iOS 17.0, *)) { + return [NSURL URLWithString:str encodingInvalidCharacters:NO]; + } else { + return [NSURL URLWithString:str]; + } +} + +@end diff --git a/PrebidMobile/PrebidMobileRendering/Networking/PrebidServerConnection.swift b/PrebidMobile/PrebidMobileRendering/Networking/PrebidServerConnection.swift index e2f1278fb..1507f6c83 100644 --- a/PrebidMobile/PrebidMobileRendering/Networking/PrebidServerConnection.swift +++ b/PrebidMobile/PrebidMobileRendering/Networking/PrebidServerConnection.swift @@ -232,7 +232,7 @@ public class PrebidServerConnection: NSObject, PrebidServerConnectionProtocol, U return nil } - guard let url = URL(string: strUrl) else { + guard let url = URL.urlWithoutEncoding(from: strUrl) else { Log.error("URL creation failed for string: \(strUrl)") return nil } diff --git a/PrebidMobile/PrebidMobileRendering/Utilities/PBMDeepLinkPlus.m b/PrebidMobile/PrebidMobileRendering/Utilities/PBMDeepLinkPlus.m index 2912252fe..a9a291ad5 100644 --- a/PrebidMobile/PrebidMobileRendering/Utilities/PBMDeepLinkPlus.m +++ b/PrebidMobile/PrebidMobileRendering/Utilities/PBMDeepLinkPlus.m @@ -14,6 +14,7 @@  */ #import "PBMDeepLinkPlus.h" +#import "NSURL+PBMExtensions.h" @interface PBMDeepLinkPlus() @@ -48,7 +49,7 @@ - (BOOL)parseURL:(NSURL * _Nonnull)url { for (NSURLQueryItem *queryItem in queryItems) { NSString *key = queryItem.name; - NSURL *valueURL = [NSURL URLWithString:queryItem.value]; + NSURL *valueURL = [NSURL PBMURLWithoutEncodingFromString:queryItem.value]; if (valueURL != nil) { if ([key isEqualToString:@"primaryUrl"]) { if (self.primaryURL == nil) { diff --git a/PrebidMobile/PrebidMobileRendering/Utilities/PBMDeviceAccessManager.m b/PrebidMobile/PrebidMobileRendering/Utilities/PBMDeviceAccessManager.m index 345a06280..ae22c778a 100644 --- a/PrebidMobile/PrebidMobileRendering/Utilities/PBMDeviceAccessManager.m +++ b/PrebidMobile/PrebidMobileRendering/Utilities/PBMDeviceAccessManager.m @@ -92,7 +92,11 @@ - (nullable NSString *)platformString { } - (nullable NSString *)userLangaugeCode { - return [self.locale objectForKey:NSLocaleLanguageCode]; + NSString * languageCode = [self.locale objectForKey:NSLocaleLanguageCode]; + if (languageCode.length == 0) { + return nil; + } + return languageCode; } #pragma mark - IDFA diff --git a/PrebidMobile/Utils/URL+Extensions.swift b/PrebidMobile/Utils/URL+Extensions.swift new file mode 100644 index 000000000..1914c67a3 --- /dev/null +++ b/PrebidMobile/Utils/URL+Extensions.swift @@ -0,0 +1,31 @@ +/*   Copyright 2018-2024 Prebid.org, Inc. + +  Licensed under the Apache License, Version 2.0 (the "License"); +  you may not use this file except in compliance with the License. +  You may obtain a copy of the License at + +  http://www.apache.org/licenses/LICENSE-2.0 + +  Unless required by applicable law or agreed to in writing, software +  distributed under the License is distributed on an "AS IS" BASIS, +  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +  See the License for the specific language governing permissions and +  limitations under the License. +  */ + +import Foundation + +extension URL { + + static func urlWithoutEncoding(from str: String?) -> URL? { + guard let str = str else { + return nil + } + + if #available(iOS 17.0, *) { + return URL(string: str, encodingInvalidCharacters: false) + } + + return URL(string: str) + } +} From 7c16d46e210bab6d04543bde4a8209fa5a0f3632 Mon Sep 17 00:00:00 2001 From: Olena Stepaniuk Date: Wed, 3 Jul 2024 09:43:40 +0300 Subject: [PATCH 4/5] feat: update scripts/testPrebidMobile.sh --- scripts/testPrebidMobile.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/testPrebidMobile.sh b/scripts/testPrebidMobile.sh index 3e79d12d4..e20c8e954 100755 --- a/scripts/testPrebidMobile.sh +++ b/scripts/testPrebidMobile.sh @@ -53,6 +53,7 @@ fi echo -e "\n${GREEN}Running PrebidMobile unit tests${NC} \n" xcodebuild test \ -workspace PrebidMobile.xcworkspace \ + -retry-tests-on-failure \ -scheme "PrebidMobileTests" \ -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=latest' | xcpretty --color --test From 21a330f730fec184f64494fe241388e78a7ddd32 Mon Sep 17 00:00:00 2001 From: Olena Stepaniuk Date: Wed, 3 Jul 2024 09:59:38 +0300 Subject: [PATCH 5/5] feat: update settings --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a39e467b4..4f7a19ed3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ jobs: build: macos: xcode: 15.4.0 - resource_class: macos.m1.large.gen1 + resource_class: macos.m1.medium.gen1 steps: - checkout - run: @@ -14,7 +14,7 @@ jobs: unit-test: macos: xcode: 15.4.0 - resource_class: macos.m1.large.gen1 + resource_class: macos.m1.medium.gen1 steps: - checkout - run: @@ -24,7 +24,7 @@ jobs: run-swift-demo-integration-tests: macos: xcode: 15.4.0 - resource_class: macos.m1.large.gen1 + resource_class: macos.m1.medium.gen1 steps: - checkout - run: @@ -34,7 +34,7 @@ jobs: run-swift-demo-ui-tests: macos: xcode: 15.4.0 - resource_class: macos.m1.large.gen1 + resource_class: macos.m1.medium.gen1 steps: - checkout - run: