From 54e0ce8fbe6da0fb01f4ed2295ac42cecb089672 Mon Sep 17 00:00:00 2001 From: mobile-ads-github Date: Mon, 12 Feb 2024 13:17:35 +0300 Subject: [PATCH] Release 6.4.0 --- .../README.md | 22 +- .../project.pbxproj | 8 +- .../AdapterTemplate/MediationAPI.swift | 14 +- .../AdapterTemplate/YandexAdapters.swift | 75 ++++-- .../project.pbxproj | 81 +++++- .../Accessibility/GDPRAccessibility.swift | 8 + .../Adfox/AdFoxBannerViewController.swift | 12 +- .../AdFoxInterstitialViewController.swift | 15 +- .../Adfox/AdFoxNativeViewController.swift | 10 + .../Base.lproj/Main.storyboard | 109 +++++++- .../Common/Native/NativeAdView.xib | 243 +++++++++--------- .../GDPR/GDPRDDialogViewController.swift | 12 + .../GDPR/GDPRViewController.swift | 6 + .../GDPR/SettingsViewController.swift | 6 +- .../MobileMediationBannerViewController.swift | 16 +- ...eMediationInterstitialViewController.swift | 18 +- .../MobileMediationNativeViewController.swift | 13 +- ...obileMediationRewardedViewController.swift | 18 +- .../Pages/AdFoxAdPage.swift | 32 +++ .../Pages/AdFoxPage.swift | 25 ++ .../Pages/GDPRDialogPage.swift | 35 +++ .../Pages/GDPRExamplePage.swift | 19 ++ .../Pages/GDPRSettingsPage.swift | 13 + .../Pages/MobileMediationAdPage.swift | 48 ++++ .../Pages/MobileMediationPage.swift | 32 +++ .../Pages/RootPage.swift | 22 +- .../Tests/AdFoxTest.swift | 40 +++ .../Tests/BaseTest.swift | 6 + .../Tests/GDPRTest.swift | 42 +++ .../Tests/MobileMediationBannerTest.swift | 56 ++++ .../MobileMediationInterstitialTest.swift | 64 +++++ .../Tests/MobileMediationNativeTest.swift | 28 ++ .../Tests/MobileMediationRewardedTest.swift | 64 +++++ Package.swift | 16 +- .../adapter/admob-mobileads/CHANGELOG.md | 6 + .../adapter/ironsource-mobileads/CHANGELOG.md | 8 + .../mediation/mobileads-adcolony/CHANGELOG.md | 6 + .../mediation/mobileads-applovin/CHANGELOG.md | 6 + .../mediation/mobileads-bigoads/CHANGELOG.md | 8 + .../mobileads-chartboost/CHANGELOG.md | 8 + .../mediation/mobileads-google/CHANGELOG.md | 6 + .../mediation/mobileads-inmobi/CHANGELOG.md | 6 + .../mobileads-ironsource/CHANGELOG.md | 8 + .../mobileads-mintegral/CHANGELOG.md | 8 + .../mediation/mobileads-mytarget/CHANGELOG.md | 8 + .../mediation/mobileads-startapp/CHANGELOG.md | 6 + .../mediation/mobileads-unityads/CHANGELOG.md | 6 + changelog/mobileads/CHANGELOG.md | 11 + 48 files changed, 1135 insertions(+), 194 deletions(-) create mode 100644 Examples/YandexMobileAdsExample/YandexMobileAdsExample/Accessibility/GDPRAccessibility.swift create mode 100644 Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/AdFoxAdPage.swift create mode 100644 Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/AdFoxPage.swift create mode 100644 Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/GDPRDialogPage.swift create mode 100644 Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/GDPRExamplePage.swift create mode 100644 Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/GDPRSettingsPage.swift create mode 100644 Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/MobileMediationAdPage.swift create mode 100644 Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/MobileMediationPage.swift create mode 100644 Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/AdFoxTest.swift create mode 100644 Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/GDPRTest.swift create mode 100644 Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/MobileMediationBannerTest.swift create mode 100644 Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/MobileMediationInterstitialTest.swift create mode 100644 Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/MobileMediationNativeTest.swift create mode 100644 Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/MobileMediationRewardedTest.swift diff --git a/Examples/ThirdPartyMediationAdapterTemplate/README.md b/Examples/ThirdPartyMediationAdapterTemplate/README.md index 2dc66cd..491ab96 100644 --- a/Examples/ThirdPartyMediationAdapterTemplate/README.md +++ b/Examples/ThirdPartyMediationAdapterTemplate/README.md @@ -31,12 +31,12 @@ See [also](https://yandex.ru/support2/mobile-ads/en/dev/ios/quick-start#app). Copy [YandexAdapters](./ThirdPartyMediationAdapterTemplate/AdapterTemplate/YandexAdapters.swift) file content and change stub API to your actual API. This way you will get a separate adapter class for each of the ad formats. If your API requires a single class for all formats, you can merge classes. -* Mediation parameters must be set for each request as shown in the [template](./ThirdPartyMediationAdapterTemplate/AdapterTemplate/YandexAdapters.swift#L40): +* Mediation parameters must be set for each request as shown in the [template](./ThirdPartyMediationAdapterTemplate/AdapterTemplate/YandexAdapters.swift#L82): * `"adapter_network_name"` represents your ad network name in lowercase. * `"adapter_version"` represents Yandex adapter version. Construct this version by adding one more number to the Yandex SDK version. For example, `6.3.0.0` if the Yandex SDK version is `6.3.0`. If you need to update an adapter without changing the Yandex SDK version, increment the fourth number like `6.3.0.1`. * `"adapter_network_sdk_version"` represents your ad network SDK version. -* `Interstitial`, `Rewarded`, `AppOpen` formats provide loader classes. A loader object can be [created](./ThirdPartyMediationAdapterTemplate/AdapterTemplate/YandexAdapters.swift#L139) once and can be reused. This speeds up loading and can be helpful to implement preloading logic, if your network supports it. +* `Interstitial`, `Rewarded`, `AppOpen` formats provide loader classes. A loader object can be [created](./ThirdPartyMediationAdapterTemplate/AdapterTemplate/YandexAdapters.swift#L165) once and can be reused. This speeds up loading and can be helpful to implement preloading logic, if your network supports it. ### 4. Test integration @@ -74,14 +74,20 @@ See also: [GDPR](https://ads.yandex.com/helpcenter/en/dev/ios/gdpr). ### S2S bidding integration -As shown in the [template](./ThirdPartyMediationAdapterTemplate/AdapterTemplate/YandexAdapters.swift#L25), the bidder token can be obtained as follows: +As shown in the [template](./ThirdPartyMediationAdapterTemplate/AdapterTemplate/YandexAdapters.swift#L42), the bidder token can be obtained as follows: ```swift -private static let bidderTokenLoader = YMABidderTokenLoader() - -Self.bidderTokenLoader.loadBidderToken() { token in - completion(token) +let bidderTokenLoader = YMABidderTokenLoader() +bidderTokenLoader.loadBidderToken(requestConfiguration: requestConfiguraton) { token in + completion(token) } ``` -You need to load a bidder token for each new ad request. +You need to load a bidder token for each new ad request. Token request can be created as follows (also shown in [template](./ThirdPartyMediationAdapterTemplate/AdapterTemplate/YandexAdapters.swift#L27)): + +```swift +let requestConfiguraton = YMABidderTokenRequestConfiguration(adType: adType) +if adType == .banner { + requestConfiguraton.bannerAdSize = bannerAdSize +} +``` diff --git a/Examples/ThirdPartyMediationAdapterTemplate/ThirdPartyMediationAdapterTemplate.xcodeproj/project.pbxproj b/Examples/ThirdPartyMediationAdapterTemplate/ThirdPartyMediationAdapterTemplate.xcodeproj/project.pbxproj index 66c4560..2397d3f 100644 --- a/Examples/ThirdPartyMediationAdapterTemplate/ThirdPartyMediationAdapterTemplate.xcodeproj/project.pbxproj +++ b/Examples/ThirdPartyMediationAdapterTemplate/ThirdPartyMediationAdapterTemplate.xcodeproj/project.pbxproj @@ -284,7 +284,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 6.3.0; + CURRENT_PROJECT_VERSION = 6.4.0; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -305,7 +305,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 17.0; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MARKETING_VERSION = 6.3.0; + MARKETING_VERSION = 6.4.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -349,7 +349,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 6.3.0; + CURRENT_PROJECT_VERSION = 6.4.0; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -364,7 +364,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 17.0; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MARKETING_VERSION = 6.3.0; + MARKETING_VERSION = 6.4.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; diff --git a/Examples/ThirdPartyMediationAdapterTemplate/ThirdPartyMediationAdapterTemplate/AdapterTemplate/MediationAPI.swift b/Examples/ThirdPartyMediationAdapterTemplate/ThirdPartyMediationAdapterTemplate/AdapterTemplate/MediationAPI.swift index 0a20dcc..7898744 100644 --- a/Examples/ThirdPartyMediationAdapterTemplate/ThirdPartyMediationAdapterTemplate/AdapterTemplate/MediationAPI.swift +++ b/Examples/ThirdPartyMediationAdapterTemplate/ThirdPartyMediationAdapterTemplate/AdapterTemplate/MediationAPI.swift @@ -21,6 +21,7 @@ struct AdData { /// This is a mock of the object that represents the scope of parameters for successful adapter configuration and ads request. /// You can pass these parameters as required by your network API, but they must be passed. /// - Parameters: +/// - adFormat: Requested ad format. Used if ad network supported in-app bidding integration with Yandex. /// - adapterVersion: Version of your adapter you are using for Yandex mediation. /// - adapterSdkVersion: Version of you ad network sdk. /// - adapterNetworkName: Yor ad network name. @@ -28,6 +29,7 @@ struct AdData { /// - locationTracking: Used for collecting location data if the user allowed the app to track the location. True - by default. /// - isTesting: Used for extended YandexSDK logging. Extended logging is disabled - by default. struct AdapterParameters { + let adFormat: MediationAdFormat let adapterVersion: String let adapterSdkVersion: String let adapterNetworkName: String @@ -36,7 +38,15 @@ struct AdapterParameters { let isTesting: Bool? } -///List of adUnits for checking inegration with Yandex. +/// This is a mock of the object that represents supported ad formats. +enum MediationAdFormat { + case banner(size: CGSize) + case interstitial + case rewarded + case appOpen +} + +/// List of adUnits for checking inegration with Yandex. enum DemoAdUnit: String { case demoBannerAdUinitId = "demo-banner-yandex" case demoInterstititalAdUinitId = "demo-interstitital-yandex" @@ -55,7 +65,7 @@ protocol MediationInitialization { /// This protocol describes methods for getting a bidding token in order to use it with in-app bidding integration with Yandex. protocol MediationBidding { - static func getBiddingToken(completion: @escaping (String?) -> Void) + static func getBiddingToken(parameters: AdapterParameters, completion: @escaping (String?) -> Void) } //MARK: - Banner API diff --git a/Examples/ThirdPartyMediationAdapterTemplate/ThirdPartyMediationAdapterTemplate/AdapterTemplate/YandexAdapters.swift b/Examples/ThirdPartyMediationAdapterTemplate/ThirdPartyMediationAdapterTemplate/AdapterTemplate/YandexAdapters.swift index e331ee5..bfe190d 100644 --- a/Examples/ThirdPartyMediationAdapterTemplate/ThirdPartyMediationAdapterTemplate/AdapterTemplate/YandexAdapters.swift +++ b/Examples/ThirdPartyMediationAdapterTemplate/ThirdPartyMediationAdapterTemplate/AdapterTemplate/YandexAdapters.swift @@ -19,37 +19,42 @@ private let mockPresentingError = AdapterError(errorDescription: "Ad Display Fai class YandexBaseAdapter: NSObject, MediationBidding, MediationInitialization { private static let bidderTokenLoader = YMABidderTokenLoader() - /// Get a bidding token in order to use it with in-app bidding integration with Yandex. + /// This method implements obtaining a bid token in order to use it with in-app bidding integration with Yandex. /// https://yastatic.net/s3/doc-binary/src/dev/mobile-ads/ru/jazzy/Classes/YMABidderTokenLoader.html - static func getBiddingToken(completion: @escaping (String?) -> Void) { - Self.bidderTokenLoader.loadBidderToken() { token in - completion(token) + static func getBiddingToken(parameters: AdapterParameters, completion: @escaping (String?) -> Void) { + + /// Configure all necessary parameters and create YMABidderTokenRequestConfiguration. + let requestConfiguraton: YMABidderTokenRequestConfiguration + switch parameters.adFormat { + case .banner(let size): + requestConfiguraton = YMABidderTokenRequestConfiguration(adType: .banner) + requestConfiguraton.bannerAdSize = YMABannerAdSize.fixedSize(withWidth: size.width, height: size.height) + case .interstitial: + requestConfiguraton = YMABidderTokenRequestConfiguration(adType: .interstitial) + case .rewarded: + requestConfiguraton = YMABidderTokenRequestConfiguration(adType: .rewarded) + case .appOpen: + requestConfiguraton = YMABidderTokenRequestConfiguration(adType: .appOpenAd) } - } - /// Successfully initializing the Yandex Mobile Ads SDK is an important condition for correctly integrating the library. - /// By default, SDK initialization happens automatically before ads load, but manual initialization will speed up how quickly the first ad loads - /// and therefore increase revenue from monetization. - /// https://yandex.ru/support2/mobile-ads/en/dev/ios/quick-start - static func initializeSDK() { - YMAMobileAds.initializeSDK() + requestConfiguraton.parameters = Self.makeConfigurationParameters(parameters) + Self.setupYandexSDK(with: parameters) + Self.bidderTokenLoader.loadBidderToken(requestConfiguration: requestConfiguraton) { token in + completion(token) + } } - /// Configure all necessary parameters and create YMAAdRequestConfiguration. - func makeAdRequestConfiguration(with adData: AdData, parameters: AdapterParameters) -> YMAAdRequestConfiguration { - let configParameters = [ + /// This method implements creation of general parameters that have to be presented in each request to the Yandex API. + private static func makeConfigurationParameters(_ parameters: AdapterParameters) -> [String: String] { + [ "adapter_network_name": parameters.adapterNetworkName, "adapter_version": parameters.adapterVersion, "adapter_network_sdk_version": parameters.adapterSdkVersion ] - let configuration = YMAMutableAdRequestConfiguration(adUnitID: adData.adUinitId) - - configuration.parameters = configParameters - - if let biddingData = adData.bidId { - configuration.biddingData = biddingData - } + } + /// This method implements setting up YMAMobileAds parameters, which must be current before each request to the Yandex API. + static func setupYandexSDK(with parameters: AdapterParameters) { if let userConsent = parameters.userConsent { YMAMobileAds.setUserConsent(userConsent) } @@ -61,6 +66,26 @@ class YandexBaseAdapter: NSObject, MediationBidding, MediationInitialization { if let isTesting = parameters.isTesting, isTesting { YMAMobileAds.enableLogging() } + } + + /// Successfully initializing the Yandex Mobile Ads SDK is an important condition for correctly integrating the library. + /// By default, SDK initialization happens automatically before ads load, but manual initialization will speed up how quickly the first ad loads + /// and therefore increase revenue from monetization. + /// https://yandex.ru/support2/mobile-ads/en/dev/ios/quick-start + static func initializeSDK() { + YMAMobileAds.initializeSDK() + } + + /// This method implements creation of YMAAdRequestConfiguration with all the necessary parameters. + func makeAdRequestConfiguration(with adData: AdData, parameters: AdapterParameters) -> YMAAdRequestConfiguration { + let configuration = YMAMutableAdRequestConfiguration(adUnitID: adData.adUinitId) + let configParameters = Self.makeConfigurationParameters(parameters) + + configuration.parameters = configParameters + + if let biddingData = adData.bidId { + configuration.biddingData = biddingData + } return configuration } @@ -80,7 +105,7 @@ final class YandexBannerAdapter: YandexBaseAdapter, MediationBanner { /// Creates an object of the YMABannerAdSize class with the specified maximum height and width of the banner. /// Also you coud use another sizes: https://yastatic.net/s3/doc-binary/src/dev/mobile-ads/ru/jazzy/Classes/YMABannerAdSize.html - let adSize = YMABannerAdSize.inlineSize(withWidth: size.width, maxHeight: size.height) + let adSize = YMABannerAdSize.fixedSize(withWidth: size.width, height: size.height) let adView = YMAAdView(adUnitID: adData.adUinitId, adSize: adSize) let requestConfiguration = makeAdRequestConfiguration(with: adData, parameters: parameters) @@ -89,6 +114,7 @@ final class YandexBannerAdapter: YandexBaseAdapter, MediationBanner { request.parameters = requestConfiguration.parameters adView.delegate = self + Self.setupYandexSDK(with: parameters) adView.loadAd(with: request) } @@ -126,7 +152,7 @@ extension YandexBannerAdapter: YMAAdViewDelegate { delegate?.didFailToLoadAdView(with: error) } - func adView(_ adView: YMAAdView, didTrackImpressionWith impressionData: YMAImpressionData?) { + func adView(_ adView: YMAAdView, didTrackImpression impressionData: YMAImpressionData?) { delegate?.didTrackImpression() } } @@ -148,6 +174,7 @@ final class YandexInterstitialAdapter: YandexBaseAdapter, MediationInterstitial parameters: AdapterParameters) { self.delegate = delegate let configuration = makeAdRequestConfiguration(with: adData, parameters: parameters) + Self.setupYandexSDK(with: parameters) loader.loadAd(with: configuration) } @@ -223,6 +250,7 @@ final class YandexRewardedAdapter: YandexBaseAdapter, MediationRewarded { parameters: AdapterParameters) { self.delegate = delegate let configuration = makeAdRequestConfiguration(with: adData, parameters: parameters) + Self.setupYandexSDK(with: parameters) loader.loadAd(with: configuration) } @@ -302,6 +330,7 @@ final class YandexAppOpenAdapter: YandexBaseAdapter, MediationAppOpen { parameters: AdapterParameters) { self.delegate = delegate let configuration = makeAdRequestConfiguration(with: adData, parameters: parameters) + Self.setupYandexSDK(with: parameters) loader.loadAd(with: configuration) } diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExample.xcodeproj/project.pbxproj b/Examples/YandexMobileAdsExample/YandexMobileAdsExample.xcodeproj/project.pbxproj index d48416b..8cfcf32 100644 --- a/Examples/YandexMobileAdsExample/YandexMobileAdsExample.xcodeproj/project.pbxproj +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExample.xcodeproj/project.pbxproj @@ -136,6 +136,22 @@ 7AA816A12B20C723006C9D91 /* YandexAppOpenAdTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AA816A02B20C723006C9D91 /* YandexAppOpenAdTest.swift */; }; 7AA816A32B20C733006C9D91 /* YandexAppOpenAdPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AA816A22B20C733006C9D91 /* YandexAppOpenAdPage.swift */; }; 7AA816A42B20D76E006C9D91 /* YandexNativeAccessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AA816972B20BF32006C9D91 /* YandexNativeAccessibility.swift */; }; + 7AE29EB92B3B1124004A3420 /* MobileMediationBannerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE29EB82B3B1124004A3420 /* MobileMediationBannerTest.swift */; }; + 7AE29EBB2B3B115D004A3420 /* MobileMediationAdPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE29EBA2B3B115D004A3420 /* MobileMediationAdPage.swift */; }; + 7AE29EBD2B3B1172004A3420 /* MobileMediationPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE29EBC2B3B1172004A3420 /* MobileMediationPage.swift */; }; + 7AE29EBF2B3B11B0004A3420 /* MobileMediationInterstitialTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE29EBE2B3B11B0004A3420 /* MobileMediationInterstitialTest.swift */; }; + 7AE29EC12B3B149B004A3420 /* MobileMediationRewardedTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE29EC02B3B149B004A3420 /* MobileMediationRewardedTest.swift */; }; + 7AE29EC32B3B1665004A3420 /* MobileMediationNativeTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE29EC22B3B1665004A3420 /* MobileMediationNativeTest.swift */; }; + 7AE29EC72B3DB071004A3420 /* AdFoxPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE29EC62B3DB071004A3420 /* AdFoxPage.swift */; }; + 7AE29EC92B3DB0AD004A3420 /* AdFoxAdPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE29EC82B3DB0AD004A3420 /* AdFoxAdPage.swift */; }; + 7AE29ECB2B3DB705004A3420 /* AdFoxTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE29ECA2B3DB705004A3420 /* AdFoxTest.swift */; }; + 7AE29ECD2B3DBD1A004A3420 /* GDPRTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE29ECC2B3DBD1A004A3420 /* GDPRTest.swift */; }; + 7AE29ECF2B3DBE63004A3420 /* GDPRAccessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE29ECE2B3DBE63004A3420 /* GDPRAccessibility.swift */; }; + 7AE29ED02B3DBEE7004A3420 /* GDPRAccessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE29ECE2B3DBE63004A3420 /* GDPRAccessibility.swift */; }; + 7AE29ED12B3DBEE7004A3420 /* GDPRAccessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE29ECE2B3DBE63004A3420 /* GDPRAccessibility.swift */; }; + 7AE29ED32B3DC307004A3420 /* GDPRDialogPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE29ED22B3DC307004A3420 /* GDPRDialogPage.swift */; }; + 7AE29ED52B3DC31F004A3420 /* GDPRSettingsPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE29ED42B3DC31F004A3420 /* GDPRSettingsPage.swift */; }; + 7AE29ED72B3DC332004A3420 /* GDPRExamplePage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE29ED62B3DC332004A3420 /* GDPRExamplePage.swift */; }; 7AF4B0B42B2774B2004974FD /* YandexInstreamListAccessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AF4B0B32B2774B2004974FD /* YandexInstreamListAccessibility.swift */; }; 7AF4B0B52B2774CC004974FD /* YandexInstreamListAccessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AF4B0B32B2774B2004974FD /* YandexInstreamListAccessibility.swift */; }; 7AF4B0B62B2774CD004974FD /* YandexInstreamListAccessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AF4B0B32B2774B2004974FD /* YandexInstreamListAccessibility.swift */; }; @@ -251,6 +267,20 @@ 7AA816A02B20C723006C9D91 /* YandexAppOpenAdTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YandexAppOpenAdTest.swift; sourceTree = ""; }; 7AA816A22B20C733006C9D91 /* YandexAppOpenAdPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YandexAppOpenAdPage.swift; sourceTree = ""; }; 7AC09FFE2B1DF5D200FF69F9 /* StateUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StateUtils.swift; sourceTree = ""; }; + 7AE29EB82B3B1124004A3420 /* MobileMediationBannerTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileMediationBannerTest.swift; sourceTree = ""; }; + 7AE29EBA2B3B115D004A3420 /* MobileMediationAdPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileMediationAdPage.swift; sourceTree = ""; }; + 7AE29EBC2B3B1172004A3420 /* MobileMediationPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileMediationPage.swift; sourceTree = ""; }; + 7AE29EBE2B3B11B0004A3420 /* MobileMediationInterstitialTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileMediationInterstitialTest.swift; sourceTree = ""; }; + 7AE29EC02B3B149B004A3420 /* MobileMediationRewardedTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileMediationRewardedTest.swift; sourceTree = ""; }; + 7AE29EC22B3B1665004A3420 /* MobileMediationNativeTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileMediationNativeTest.swift; sourceTree = ""; }; + 7AE29EC62B3DB071004A3420 /* AdFoxPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdFoxPage.swift; sourceTree = ""; }; + 7AE29EC82B3DB0AD004A3420 /* AdFoxAdPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdFoxAdPage.swift; sourceTree = ""; }; + 7AE29ECA2B3DB705004A3420 /* AdFoxTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdFoxTest.swift; sourceTree = ""; }; + 7AE29ECC2B3DBD1A004A3420 /* GDPRTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GDPRTest.swift; sourceTree = ""; }; + 7AE29ECE2B3DBE63004A3420 /* GDPRAccessibility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GDPRAccessibility.swift; sourceTree = ""; }; + 7AE29ED22B3DC307004A3420 /* GDPRDialogPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GDPRDialogPage.swift; sourceTree = ""; }; + 7AE29ED42B3DC31F004A3420 /* GDPRSettingsPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GDPRSettingsPage.swift; sourceTree = ""; }; + 7AE29ED62B3DC332004A3420 /* GDPRExamplePage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GDPRExamplePage.swift; sourceTree = ""; }; 7AF4B0B32B2774B2004974FD /* YandexInstreamListAccessibility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YandexInstreamListAccessibility.swift; sourceTree = ""; }; 7AF4B0B72B277503004974FD /* YandexInstreamListPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YandexInstreamListPage.swift; sourceTree = ""; }; 7AF4B0B92B278CF8004974FD /* YandexInstreamPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YandexInstreamPage.swift; sourceTree = ""; }; @@ -626,6 +656,7 @@ isa = PBXGroup; children = ( 7A851DDA2B1E2D8100D03655 /* CommonAccessibility.swift */, + 7AE29ECE2B3DBE63004A3420 /* GDPRAccessibility.swift */, 7A851DF82B1E313C00D03655 /* RootAccessibility.swift */, 7A851DEE2B1E2F5C00D03655 /* YandexAdsAccessibility.swift */, 7AA816972B20BF32006C9D91 /* YandexNativeAccessibility.swift */, @@ -642,9 +673,15 @@ 7A851DDD2B1E2DBB00D03655 /* BaseTest.swift */, 7A851DE92B1E2E3100D03655 /* YandexFullscreenTest.swift */, 7A851DE72B1E2E1A00D03655 /* YandexBannersTest.swift */, + 7AE29EBE2B3B11B0004A3420 /* MobileMediationInterstitialTest.swift */, + 7AE29EC02B3B149B004A3420 /* MobileMediationRewardedTest.swift */, + 7AE29EC22B3B1665004A3420 /* MobileMediationNativeTest.swift */, 7AA8169E2B20C260006C9D91 /* YandexNativeTest.swift */, 7AA816A02B20C723006C9D91 /* YandexAppOpenAdTest.swift */, 7AF4B0BB2B278D0D004974FD /* YandexInstreamTest.swift */, + 7AE29EB82B3B1124004A3420 /* MobileMediationBannerTest.swift */, + 7AE29ECC2B3DBD1A004A3420 /* GDPRTest.swift */, + 7AE29ECA2B3DB705004A3420 /* AdFoxTest.swift */, ); path = Tests; sourceTree = ""; @@ -653,15 +690,22 @@ isa = PBXGroup; children = ( 7A851DDF2B1E2DD500D03655 /* PageObject.swift */, + 7AE29EBC2B3B1172004A3420 /* MobileMediationPage.swift */, 7A851DF52B1E309100D03655 /* YandexFullscreenAdPage.swift */, 7A851DE12B1E2DE300D03655 /* RootPage.swift */, + 7AE29ED42B3DC31F004A3420 /* GDPRSettingsPage.swift */, 7A851DE32B1E2DF500D03655 /* YandexAdsPage.swift */, + 7AE29ED22B3DC307004A3420 /* GDPRDialogPage.swift */, + 7AE29ED62B3DC332004A3420 /* GDPRExamplePage.swift */, 7AA8169A2B20BFE7006C9D91 /* YandexNativePage.swift */, 7AF4B0B72B277503004974FD /* YandexInstreamListPage.swift */, 7AA8169C2B20C244006C9D91 /* YandexNativeAdPage.swift */, 7AA816A22B20C733006C9D91 /* YandexAppOpenAdPage.swift */, 7AF4B0B92B278CF8004974FD /* YandexInstreamPage.swift */, 7A851DE52B1E2E0600D03655 /* YandexBannerPage.swift */, + 7AE29EBA2B3B115D004A3420 /* MobileMediationAdPage.swift */, + 7AE29EC82B3DB0AD004A3420 /* AdFoxAdPage.swift */, + 7AE29EC62B3DB071004A3420 /* AdFoxPage.swift */, ); path = Pages; sourceTree = ""; @@ -895,6 +939,7 @@ 14033F6527201E2700A24D5E /* MobileMediationNativeViewController.swift in Sources */, 1499318B2722CD44005D2E87 /* AdFoxInterstitialViewController.swift in Sources */, 14033FB12720457800A24D5E /* ContentControlsController.swift in Sources */, + 7AE29ECF2B3DBE63004A3420 /* GDPRAccessibility.swift in Sources */, DE0C2CBE2A65760900A84D00 /* NativeTemplateViewController.swift in Sources */, 76DEC6852B0E18B10014B6B4 /* IronSourceBannerViewController.swift in Sources */, 7A527BC92B1E36490002B416 /* RootAccessibility.swift in Sources */, @@ -954,6 +999,7 @@ 64F70DC12B0B64D300A31CE8 /* InrollsPlaybackController.swift in Sources */, 64F70DC22B0B64D300A31CE8 /* InstreamInrollsViewController.swift in Sources */, 64F70DC32B0B64D300A31CE8 /* NavigationScreenDataSource.swift in Sources */, + 7AE29ED02B3DBEE7004A3420 /* GDPRAccessibility.swift in Sources */, 7AF4B0BF2B279167004974FD /* YandexInstreamAccessibility.swift in Sources */, 64F70DC52B0B64D300A31CE8 /* AppOpenAdControllerDelegate.swift in Sources */, 64F70DC62B0B64D300A31CE8 /* VideoAVPlayer.swift in Sources */, @@ -1009,12 +1055,22 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 7AE29ED52B3DC31F004A3420 /* GDPRSettingsPage.swift in Sources */, + 7AE29EC32B3B1665004A3420 /* MobileMediationNativeTest.swift in Sources */, 7A851DE42B1E2DF500D03655 /* YandexAdsPage.swift in Sources */, + 7AE29ECD2B3DBD1A004A3420 /* GDPRTest.swift in Sources */, 7AA8169F2B20C260006C9D91 /* YandexNativeTest.swift in Sources */, + 7AE29EB92B3B1124004A3420 /* MobileMediationBannerTest.swift in Sources */, 7A851DE22B1E2DE300D03655 /* RootPage.swift in Sources */, + 7AE29ECB2B3DB705004A3420 /* AdFoxTest.swift in Sources */, 7AA8169B2B20BFE7006C9D91 /* YandexNativePage.swift in Sources */, + 7AE29ED12B3DBEE7004A3420 /* GDPRAccessibility.swift in Sources */, + 7AE29EC92B3DB0AD004A3420 /* AdFoxAdPage.swift in Sources */, 7AF4B0BA2B278CF8004974FD /* YandexInstreamPage.swift in Sources */, + 7AE29ED72B3DC332004A3420 /* GDPRExamplePage.swift in Sources */, + 7AE29ED32B3DC307004A3420 /* GDPRDialogPage.swift in Sources */, 7AF4B0B82B277503004974FD /* YandexInstreamListPage.swift in Sources */, + 7AE29EBF2B3B11B0004A3420 /* MobileMediationInterstitialTest.swift in Sources */, 7AF4B0B62B2774CD004974FD /* YandexInstreamListAccessibility.swift in Sources */, 7AA816A32B20C733006C9D91 /* YandexAppOpenAdPage.swift in Sources */, 7AA816992B20BFB7006C9D91 /* YandexNativeAccessibility.swift in Sources */, @@ -1022,6 +1078,8 @@ 7AF4B0C02B279168004974FD /* YandexInstreamAccessibility.swift in Sources */, 7A527BC02B1E36480002B416 /* YandexAdsAccessibility.swift in Sources */, 7AF4B0BC2B278D0D004974FD /* YandexInstreamTest.swift in Sources */, + 7AE29EBB2B3B115D004A3420 /* MobileMediationAdPage.swift in Sources */, + 7AE29EC12B3B149B004A3420 /* MobileMediationRewardedTest.swift in Sources */, 7A851DE02B1E2DD500D03655 /* PageObject.swift in Sources */, 7A527BBE2B1E36480002B416 /* StateUtils.swift in Sources */, 7A851DF62B1E309100D03655 /* YandexFullscreenAdPage.swift in Sources */, @@ -1029,7 +1087,9 @@ 7AA816A12B20C723006C9D91 /* YandexAppOpenAdTest.swift in Sources */, 7A851DE82B1E2E1A00D03655 /* YandexBannersTest.swift in Sources */, 7A851DEA2B1E2E3100D03655 /* YandexFullscreenTest.swift in Sources */, + 7AE29EC72B3DB071004A3420 /* AdFoxPage.swift in Sources */, 7A851DDE2B1E2DBB00D03655 /* BaseTest.swift in Sources */, + 7AE29EBD2B3B1172004A3420 /* MobileMediationPage.swift in Sources */, 7A527BBF2B1E36480002B416 /* RootAccessibility.swift in Sources */, 7AA8169D2B20C244006C9D91 /* YandexNativeAdPage.swift in Sources */, ); @@ -1099,7 +1159,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 6.3.0; + CURRENT_PROJECT_VERSION = 6.4.0; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -1118,7 +1178,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 14.5; - MARKETING_VERSION = 6.3.0; + MARKETING_VERSION = 6.4.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -1162,7 +1222,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 6.3.0; + CURRENT_PROJECT_VERSION = 6.4.0; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -1175,7 +1235,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 14.5; - MARKETING_VERSION = 6.3.0; + MARKETING_VERSION = 6.4.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; @@ -1191,7 +1251,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = YandexMobileAdsExample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; @@ -1202,6 +1262,7 @@ OTHER_LDFLAGS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = ru.yandex.mobile.YandexMobileAdsExample; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; @@ -1217,7 +1278,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = YandexMobileAdsExample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; @@ -1228,6 +1289,7 @@ OTHER_LDFLAGS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = ru.yandex.mobile.YandexMobileAdsExample; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; @@ -1271,7 +1333,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 6.3.0; + CURRENT_PROJECT_VERSION = 6.4.0; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -1284,7 +1346,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 14.5; - MARKETING_VERSION = 6.3.0; + MARKETING_VERSION = 6.4.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; @@ -1300,7 +1362,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = YandexMobileAdsExample/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; @@ -1311,6 +1373,7 @@ OTHER_LDFLAGS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = ru.yandex.mobile.YandexMobileAdsExample; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/Accessibility/GDPRAccessibility.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/Accessibility/GDPRAccessibility.swift new file mode 100644 index 0000000..77fedb0 --- /dev/null +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/Accessibility/GDPRAccessibility.swift @@ -0,0 +1,8 @@ +enum GDPRAccessibility { + static let settingsButton = "gdpr_settings" + static let acceptButton = "gdpr_accept" + static let declineButton = "gdpr_decline" + static let aboutButton = "gdpr_about" + static let resetButton = "gdpr_reset" + static let userConsentSwitch = "gdpr_consent" +} diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/Adfox/AdFoxBannerViewController.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/Adfox/AdFoxBannerViewController.swift index c3cb23a..3034d95 100644 --- a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/Adfox/AdFoxBannerViewController.swift +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/Adfox/AdFoxBannerViewController.swift @@ -10,6 +10,9 @@ import YandexMobileAds class AdFoxBannerViewController: UIViewController { var adView: YMAAdView! + + @IBOutlet private var stateLabel: UILabel! + @IBOutlet private var loadButton: UIButton! override func viewDidLoad() { super.viewDidLoad() @@ -17,6 +20,9 @@ class AdFoxBannerViewController: UIViewController { // Replace demo R-M-243655-8 with actual Ad Unit ID self.adView = YMAAdView(adUnitID: "R-M-243655-8", adSize: adSize) self.adView.delegate = self + adView.accessibilityIdentifier = CommonAccessibility.bannerView + loadButton.accessibilityIdentifier = CommonAccessibility.loadButton + stateLabel.accessibilityIdentifier = CommonAccessibility.stateLabel } @IBAction func loadAd() { @@ -32,6 +38,8 @@ class AdFoxBannerViewController: UIViewController { request.parameters = parameters self.adView.loadAd(with: request) + + stateLabel.text = nil } } @@ -43,11 +51,13 @@ extension AdFoxBannerViewController: YMAAdViewDelegate { func adViewDidLoad(_ adView: YMAAdView) { self.adView.displayAtBottom(in: self.view) - print("Ad loaded") + print("Ad loaded") + stateLabel.text = StateUtils.loaded() } func adViewDidFailLoading(_ adView: YMAAdView, error: Error) { print("Ad failed loading. Error: \(error)") + stateLabel.text = StateUtils.loadError(error) } func adViewWillLeaveApplication(_ adView: YMAAdView) { diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/Adfox/AdFoxInterstitialViewController.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/Adfox/AdFoxInterstitialViewController.swift index 0c3d71b..63061fd 100644 --- a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/Adfox/AdFoxInterstitialViewController.swift +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/Adfox/AdFoxInterstitialViewController.swift @@ -12,7 +12,17 @@ class AdFoxInterstitialViewController: UIViewController { private let interstitialAdLoader = YMAInterstitialAdLoader() private var interstitialAd: YMAInterstitialAd? - @IBOutlet weak var showButton: UIButton! + @IBOutlet private var showButton: UIButton! + @IBOutlet private var stateLabel: UILabel! + @IBOutlet private var loadButton: UIButton! + + override func viewDidLoad() { + super.viewDidLoad() + + loadButton.accessibilityIdentifier = CommonAccessibility.loadButton + stateLabel.accessibilityIdentifier = CommonAccessibility.stateLabel + showButton.accessibilityIdentifier = CommonAccessibility.presentButton + } @IBAction func loadInterstitial() { self.showButton.isEnabled = false @@ -36,6 +46,7 @@ class AdFoxInterstitialViewController: UIViewController { @IBAction func presentInterstitial() { interstitialAd?.show(from: self) showButton.isEnabled = false + presentedViewController?.view.accessibilityIdentifier = CommonAccessibility.bannerView } private func makeMessageDescription(_ interstitial: YMAInterstitialAd) -> String { "Interstitial Ad with Unit ID: \(String(describing: interstitial.adInfo?.adUnitId))" @@ -49,12 +60,14 @@ extension AdFoxInterstitialViewController: YMAInterstitialAdLoaderDelegate { print("\(makeMessageDescription(interstitialAd)) loaded") self.interstitialAd = interstitialAd self.showButton.isEnabled = true + stateLabel.text = StateUtils.loaded() } func interstitialAdLoader(_ adLoader: YMAInterstitialAdLoader, didFailToLoadWithError error: YMAAdRequestError) { let id = error.adUnitId let error = error.error print("Loading failed for Ad with Unit ID: \(String(describing: id)). Error: \(String(describing: error))") + stateLabel.text = StateUtils.loadError(error) } } diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/Adfox/AdFoxNativeViewController.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/Adfox/AdFoxNativeViewController.swift index 3d6db56..8f3e89d 100644 --- a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/Adfox/AdFoxNativeViewController.swift +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/Adfox/AdFoxNativeViewController.swift @@ -9,6 +9,9 @@ import YandexMobileAds class AdFoxNativeViewController: UIViewController { private var adView: NativeAdView? + + @IBOutlet private var stateLabel: UILabel! + @IBOutlet private var loadButton: UIButton! var adLoader: YMANativeAdLoader! @@ -20,6 +23,10 @@ class AdFoxNativeViewController: UIViewController { adLoader = YMANativeAdLoader() adLoader.delegate = self + + adView?.accessibilityIdentifier = CommonAccessibility.bannerView + loadButton.accessibilityIdentifier = CommonAccessibility.loadButton + stateLabel.accessibilityIdentifier = CommonAccessibility.stateLabel } @IBAction func loadAd(_ sender: UIButton) { @@ -64,13 +71,16 @@ extension AdFoxNativeViewController: YMANativeAdLoaderDelegate { try ad.bind(with: adView) adView.configureAssetViews() addAdView() + stateLabel.text = StateUtils.loaded() } catch { print("Binding error: \(error)") + stateLabel.text = StateUtils.loadError(error) } } func nativeAdLoader(_ loader: YMANativeAdLoader, didFailLoadingWithError error: Error) { print("Native ad loading error: \(error)") + stateLabel.text = StateUtils.loadError(error) } } diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/Base.lproj/Main.storyboard b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/Base.lproj/Main.storyboard index 0b1aab5..ed2cba4 100644 --- a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/Base.lproj/Main.storyboard +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/Base.lproj/Main.storyboard @@ -1,9 +1,9 @@ - + - + @@ -236,6 +236,12 @@ + @@ -247,11 +253,14 @@ + + + @@ -260,8 +269,10 @@ + + @@ -295,32 +306,43 @@ - + + + + + + - + + - + @@ -365,16 +387,25 @@ + + + + @@ -383,8 +414,10 @@ + + @@ -895,14 +928,23 @@ + + + + @@ -910,7 +952,9 @@ + + @@ -968,6 +1012,8 @@ + + @@ -1006,21 +1052,32 @@ + + + + + + @@ -1051,17 +1108,30 @@ + + + + + + + + @@ -1091,17 +1161,30 @@ + + + + + + + + @@ -1112,18 +1195,18 @@ - + - - - + + - + - - + + - - + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/GDPR/GDPRDDialogViewController.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/GDPR/GDPRDDialogViewController.swift index 0305938..0b89333 100644 --- a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/GDPR/GDPRDDialogViewController.swift +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/GDPR/GDPRDDialogViewController.swift @@ -14,8 +14,20 @@ protocol GDPRDialogDelegate: NSObject { class GDPRDialogViewController: UIViewController { var gdprManager: GDPRUserConsentManager? + + @IBOutlet private var acceptButton: UIButton! + @IBOutlet private var declineButton: UIButton! + @IBOutlet private var aboutButton: UIButton! weak var delegate: GDPRDialogDelegate? + + override func viewDidLoad() { + super.viewDidLoad() + + acceptButton.accessibilityIdentifier = GDPRAccessibility.acceptButton + declineButton.accessibilityIdentifier = GDPRAccessibility.declineButton + aboutButton.accessibilityIdentifier = GDPRAccessibility.aboutButton + } @IBAction func about(_ sender: UIButton) { let url = URL(string: "https://yandex.com/legal/confidential/")! diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/GDPR/GDPRViewController.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/GDPR/GDPRViewController.swift index 2191314..0faf4c2 100644 --- a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/GDPR/GDPRViewController.swift +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/GDPR/GDPRViewController.swift @@ -15,6 +15,9 @@ class GDPRViewController: UIViewController { var adLoader: YMANativeAdLoader! var bannerView: YMANativeBannerView? var gdprManager: GDPRUserConsentManager + + @IBOutlet private var loadButton: UIButton! + @IBOutlet private var settingsButton: UIButton! required init?(coder: NSCoder) { gdprManager = GDPRUserConsentManager(userDefaults: UserDefaults.standard) @@ -26,6 +29,9 @@ class GDPRViewController: UIViewController { super.viewDidLoad() adLoader = YMANativeAdLoader() adLoader.delegate = self + + loadButton.accessibilityIdentifier = CommonAccessibility.loadButton + settingsButton.accessibilityIdentifier = GDPRAccessibility.settingsButton } @IBAction func loadAd(_ sender: Any) { diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/GDPR/SettingsViewController.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/GDPR/SettingsViewController.swift index 8db1999..2150999 100644 --- a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/GDPR/SettingsViewController.swift +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/GDPR/SettingsViewController.swift @@ -9,13 +9,17 @@ import UIKit import YandexMobileAds class SettingsViewController: UIViewController { - @IBOutlet weak var userConsentSwitch: UISwitch! + @IBOutlet private var userConsentSwitch: UISwitch! + @IBOutlet private var resetButton: UIButton! var gdprManager: GDPRUserConsentManager? override func viewDidLoad() { super.viewDidLoad() userConsentSwitch.isOn = gdprManager?.userConsent ?? false + + userConsentSwitch.accessibilityIdentifier = GDPRAccessibility.userConsentSwitch + resetButton.accessibilityIdentifier = GDPRAccessibility.resetButton } @IBAction func userConsentDidChange(_ sender: UISwitch) { diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/MobileMediation/MobileMediationBannerViewController.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/MobileMediation/MobileMediationBannerViewController.swift index de3764b..ea9e23c 100644 --- a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/MobileMediation/MobileMediationBannerViewController.swift +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/MobileMediation/MobileMediationBannerViewController.swift @@ -25,7 +25,7 @@ class MobileMediationBannerViewController: UIViewController { (adapter: "AdColony", adUnitID: adColonyAdUnitID), (adapter: "BigoAds", adUnitID: bigoAdsAdUnitID), (adapter: "Chartboost", adUnitID: chartboostAdUnitID), - (adapter: "Google", adUnitID: adMobAdUnitID), + (adapter: "AdMob", adUnitID: adMobAdUnitID), (adapter: "InMobi", adUnitID: inMobiAdsAdUnitID), (adapter: "Mintegral", adUnitID: mintegralAdUnitID), (adapter: "MyTarget", adUnitID: myTargetAdUnitID), @@ -35,8 +35,17 @@ class MobileMediationBannerViewController: UIViewController { ] @IBOutlet private var pickerView: UIPickerView! + @IBOutlet private var stateLabel: UILabel! + @IBOutlet private var loadButton: UIButton! private var adView: YMAAdView? + + override func viewDidLoad() { + super.viewDidLoad() + + stateLabel.accessibilityIdentifier = CommonAccessibility.stateLabel + loadButton.accessibilityIdentifier = CommonAccessibility.loadButton + } @IBAction func loadAd(_ sender: UIButton) { let adSize = YMABannerAdSize.inlineSize(withWidth: 320, maxHeight: 50) @@ -53,6 +62,9 @@ class MobileMediationBannerViewController: UIViewController { adView = YMAAdView(adUnitID: adUnitID, adSize: adSize) adView?.delegate = self adView?.loadAd() + adView?.accessibilityIdentifier = CommonAccessibility.bannerView + + stateLabel.text = nil } } @@ -62,10 +74,12 @@ extension MobileMediationBannerViewController: YMAAdViewDelegate { func adViewDidLoad(_ adView: YMAAdView) { print("ad loaded") adView.displayAtBottom(in: view) + stateLabel.text = StateUtils.loaded() } func adViewDidFailLoading(_ adView: YMAAdView, error: Error) { print("ad failed loading. Error: \(String(describing: error))") + stateLabel.text = StateUtils.loadError(error) } func adViewWillLeaveApplication(_ adView: YMAAdView) { diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/MobileMediation/MobileMediationInterstitialViewController.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/MobileMediation/MobileMediationInterstitialViewController.swift index 17169cc..c79fcb4 100644 --- a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/MobileMediation/MobileMediationInterstitialViewController.swift +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/MobileMediation/MobileMediationInterstitialViewController.swift @@ -27,7 +27,7 @@ class MobileMediationInterstitialViewController: UIViewController { (adapter: "AppLovin", adUnitID: appLovinAdUnitID), (adapter: "BigoAds", adUnitID: bigoAdsAdUnitID), (adapter: "Chartboost", adUnitID: chartboostAdUnitID), - (adapter: "Google", adUnitID: adMobAdUnitID), + (adapter: "AdMob", adUnitID: adMobAdUnitID), (adapter: "InMobi", adUnitID: inMobiAdUnitID), (adapter: "IronSource", adUnitID: ironSourceAdUnitID), (adapter: "Mintegral", adUnitID: mintegralAdUnitID), @@ -40,6 +40,18 @@ class MobileMediationInterstitialViewController: UIViewController { @IBOutlet private var showButton: UIButton! @IBOutlet private var pickerView: UIPickerView! + @IBOutlet private var stateLabel: UILabel! + @IBOutlet private var loadButton: UIButton! + + private var adView: YMAAdView? + + override func viewDidLoad() { + super.viewDidLoad() + + stateLabel.accessibilityIdentifier = CommonAccessibility.stateLabel + loadButton.accessibilityIdentifier = CommonAccessibility.loadButton + showButton.accessibilityIdentifier = CommonAccessibility.presentButton + } private var interstitialAd: YMAInterstitialAd? @@ -61,6 +73,8 @@ class MobileMediationInterstitialViewController: UIViewController { interstitialAdLoader.delegate = self interstitialAdLoader.loadAd(with: configuration) + + stateLabel.text = nil } @IBAction func presentAd(_ sender: UIButton) { @@ -81,12 +95,14 @@ extension MobileMediationInterstitialViewController: YMAInterstitialAdLoaderDele print("\(makeMessageDescription(interstitialAd)) loaded") self.interstitialAd = interstitialAd self.showButton.isEnabled = true + stateLabel.text = StateUtils.loaded() } func interstitialAdLoader(_ adLoader: YMAInterstitialAdLoader, didFailToLoadWithError error: YMAAdRequestError) { let id = error.adUnitId let error = error.error print("Loading failed for Ad with Unit ID: \(String(describing: id)). Error: \(String(describing: error))") + stateLabel.text = StateUtils.loadError(error) } } diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/MobileMediation/MobileMediationNativeViewController.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/MobileMediation/MobileMediationNativeViewController.swift index 4e6e917..951c2d0 100644 --- a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/MobileMediation/MobileMediationNativeViewController.swift +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/MobileMediation/MobileMediationNativeViewController.swift @@ -19,7 +19,9 @@ class MobileMediationNativeViewController: UIViewController { ] @IBOutlet private var pickerView: UIPickerView! - @IBOutlet weak var scrollView: UIScrollView! + @IBOutlet private var scrollView: UIScrollView! + @IBOutlet private var stateLabel: UILabel! + @IBOutlet private var loadButton: UIButton! private var adView: NativeAdView? private var adLoader: YMANativeAdLoader? @@ -31,6 +33,10 @@ class MobileMediationNativeViewController: UIViewController { adView?.isHidden = true adLoader = YMANativeAdLoader() adLoader?.delegate = self + adView?.accessibilityIdentifier = CommonAccessibility.bannerView + + stateLabel.accessibilityIdentifier = CommonAccessibility.stateLabel + loadButton.accessibilityIdentifier = CommonAccessibility.loadButton } @IBAction func load(_ sender: Any) { @@ -46,6 +52,8 @@ class MobileMediationNativeViewController: UIViewController { let adUnitID = adUnitIDs[selectedIndex].adUnitID let requestConfiguration = YMANativeAdRequestConfiguration(adUnitID: adUnitID) adLoader?.loadAd(with: requestConfiguration) + + stateLabel.text = nil } func addAdView() { @@ -76,13 +84,16 @@ extension MobileMediationNativeViewController: YMANativeAdLoaderDelegate { do { try ad.bind(with: adView) adView.configureAssetViews() + stateLabel.text = StateUtils.loaded() } catch { print("Binding error: \(error)") + stateLabel.text = StateUtils.loadError(error) } } func nativeAdLoader(_ loader: YMANativeAdLoader, didFailLoadingWithError error: Error) { print("Native ad loading error: \(error)") + stateLabel.text = StateUtils.loadError(error) } } diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/MobileMediation/MobileMediationRewardedViewController.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/MobileMediation/MobileMediationRewardedViewController.swift index 8555f9a..cb4a98e 100644 --- a/Examples/YandexMobileAdsExample/YandexMobileAdsExample/MobileMediation/MobileMediationRewardedViewController.swift +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExample/MobileMediation/MobileMediationRewardedViewController.swift @@ -27,7 +27,7 @@ class MobileMediationRewardedViewController: UIViewController { (adapter: "AppLovin", adUnitID: appLovinAdUnitID), (adapter: "BigoAds", adUnitID: bigoAdsAdUnitID), (adapter: "Chartboost", adUnitID: chartboostAdUnitID), - (adapter: "Google", adUnitID: adMobAdUnitID), + (adapter: "AdMob", adUnitID: adMobAdUnitID), (adapter: "InMobi", adUnitID: inMobiAdUnitID), (adapter: "IronSource", adUnitID: ironSourceAdUnitID), (adapter: "Mintegral", adUnitID: mintegralAdUnitID), @@ -38,11 +38,21 @@ class MobileMediationRewardedViewController: UIViewController { ] private let rewardedAdLoader = YMARewardedAdLoader() - @IBOutlet weak var showButton: UIButton! + @IBOutlet private var showButton: UIButton! @IBOutlet private var pickerView: UIPickerView! + @IBOutlet private var stateLabel: UILabel! + @IBOutlet private var loadButton: UIButton! private var rewardedAd: YMARewardedAd? + override func viewDidLoad() { + super.viewDidLoad() + + stateLabel.accessibilityIdentifier = CommonAccessibility.stateLabel + loadButton.accessibilityIdentifier = CommonAccessibility.loadButton + showButton.accessibilityIdentifier = CommonAccessibility.presentButton + } + @IBAction func loadAd() { self.showButton.isEnabled = false let selectedIndex = pickerView.selectedRow(inComponent: 0) @@ -61,6 +71,8 @@ class MobileMediationRewardedViewController: UIViewController { rewardedAdLoader.delegate = self rewardedAdLoader.loadAd(with: configuration) + + stateLabel.text = nil } @IBAction func presentAd() { @@ -81,12 +93,14 @@ extension MobileMediationRewardedViewController: YMARewardedAdLoaderDelegate { print("\(makeMessageDescription(rewardedAd)) loaded") self.rewardedAd = rewardedAd self.showButton.isEnabled = true + stateLabel.text = StateUtils.loaded() } func rewardedAdLoader(_ adLoader: YMARewardedAdLoader, didFailToLoadWithError error: YMAAdRequestError) { let id = error.adUnitId let error = error.error print("Loading failed for Ad with Unit ID: \(String(describing: id)). Error: \(String(describing: error))") + stateLabel.text = StateUtils.loadError(error) } } diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/AdFoxAdPage.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/AdFoxAdPage.swift new file mode 100644 index 0000000..c07657b --- /dev/null +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/AdFoxAdPage.swift @@ -0,0 +1,32 @@ +import XCTest + +struct AdFoxAdPage: PageObject { + var loadButton: XCUIElement { element(id: CommonAccessibility.loadButton, type: .button) } + var presentButton: XCUIElement { element(id: CommonAccessibility.presentButton, type: .button) } + var stateLabel: XCUIElement { element(id: CommonAccessibility.stateLabel, type: .staticText) } + var adView: XCUIElement { element(id: CommonAccessibility.bannerView, type: .other) } + + func tapLoadAd() { + step("Tap load ad") { + loadButton.tap() + } + } + + func tapPresentAd() { + step("Tap present ad") { + presentButton.tap() + } + } + + func assertAdDisplayed() { + step("Assert ad displayed") { + XCTAssertTrue(adView.waitForExistence(timeout: 5)) + } + } + + func tapAd() { + step("Tap ad") { + adView.tap() + } + } +} diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/AdFoxPage.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/AdFoxPage.swift new file mode 100644 index 0000000..d909fb3 --- /dev/null +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/AdFoxPage.swift @@ -0,0 +1,25 @@ +import XCTest + +struct AdFoxPage: PageObject { + var banner: XCUIElement { element(id: "Banner") } + var interstitial: XCUIElement { element(id: "Interstitial") } + var native: XCUIElement { element(id: "Native") } + + func openBanner() { + step("Open banner") { + banner.tap() + } + } + + func openInterstitial() { + step("Open interstitial") { + interstitial.tap() + } + } + + func openNative() { + step("Open native") { + native.tap() + } + } +} diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/GDPRDialogPage.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/GDPRDialogPage.swift new file mode 100644 index 0000000..b887672 --- /dev/null +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/GDPRDialogPage.swift @@ -0,0 +1,35 @@ +import XCTest + +struct GDPRDialogPage: PageObject { + var acceptButton: XCUIElement { element(id: GDPRAccessibility.acceptButton, type: .button) } + var declineButton: XCUIElement { element(id: GDPRAccessibility.declineButton, type: .button) } + var aboutButton: XCUIElement { element(id: GDPRAccessibility.aboutButton, type: .button) } + + func tapAbout() { + step("Tap about") { + aboutButton.tap() + } + } + + func tapAccept() { + step("Tap accept") { + acceptButton.tap() + } + } + + func tapDecline() { + step("Tap decline") { + declineButton.tap() + } + } +} + +extension XCUIElement { + var switchValue: Bool { + stringValue == "1" + } + + private var stringValue: String? { + value as? String + } +} diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/GDPRExamplePage.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/GDPRExamplePage.swift new file mode 100644 index 0000000..6e4ec97 --- /dev/null +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/GDPRExamplePage.swift @@ -0,0 +1,19 @@ +import XCTest + +struct GDPRExamplePage: PageObject { + var loadButton: XCUIElement { element(id: CommonAccessibility.loadButton, type: .button) } + var settingsButton: XCUIElement { element(id: GDPRAccessibility.settingsButton) } + + func tapLoadAd() { + step("Tap load ad") { + loadButton.tap() + } + } + + func tapSettings() { + step("Tap settings") { + settingsButton.tap() + } + } +} + diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/GDPRSettingsPage.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/GDPRSettingsPage.swift new file mode 100644 index 0000000..dc7c46a --- /dev/null +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/GDPRSettingsPage.swift @@ -0,0 +1,13 @@ +import XCTest + +struct GDPRSettingsPage: PageObject { + var consentSwitch: XCUIElement { element(id: GDPRAccessibility.userConsentSwitch, type: .switch) } + var resetButton: XCUIElement { element(id: GDPRAccessibility.resetButton, type: .button) } + + func tapReset() { + step("Tap reset") { + resetButton.tap() + } + } +} + diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/MobileMediationAdPage.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/MobileMediationAdPage.swift new file mode 100644 index 0000000..e71720a --- /dev/null +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/MobileMediationAdPage.swift @@ -0,0 +1,48 @@ +import XCTest + +enum Adapter: String { + case adColony = "AdColony" + case appLovin = "AppLovin" + case bigoAds = "BigoAds" + case chartboost = "Chartboost" + case adMob = "AdMob" + case inMobi = "InMobi" + case ironSource = "IronSource" + case mintegral = "Mintegral" + case myTarget = "MyTarget" + case startApp = "StartApp" + case unityAds = "UnityAds" + case yandex = "Yandex" +} + +struct MobileMediationAdPage: PageObject { + var loadButton: XCUIElement { element(id: CommonAccessibility.loadButton, type: .button) } + var presentButton: XCUIElement { element(id: CommonAccessibility.presentButton, type: .button) } + var stateLabel: XCUIElement { element(id: CommonAccessibility.stateLabel, type: .staticText) } + var picker: XCUIElement { app.pickerWheels.firstMatch } + var adView: XCUIElement { element(id: CommonAccessibility.bannerView, type: .other) } + + func tapLoadAd() { + step("Tap load ad") { + loadButton.tap() + } + } + + func tapPresentAd() { + step("Tap present ad") { + presentButton.tap() + } + } + + func selectAdapter(_ adapter: Adapter) { + step("Select adapter \(adapter.rawValue)") { + picker.adjust(toPickerWheelValue: adapter.rawValue) + } + } + + func assertAdDisplayed() { + step("Assert ad displayed") { + XCTAssertTrue(adView.waitForExistence(timeout: 5)) + } + } +} diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/MobileMediationPage.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/MobileMediationPage.swift new file mode 100644 index 0000000..5542f2c --- /dev/null +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/MobileMediationPage.swift @@ -0,0 +1,32 @@ +import XCTest + +struct MobileMediationPage: PageObject { + var banner: XCUIElement { element(id: "Banner") } + var interstitial: XCUIElement { element(id: "Interstitial") } + var rewarded: XCUIElement { element(id: "Rewarded") } + var native: XCUIElement { element(id: "Native") } + + func openBanner() { + step("Open banner") { + banner.tap() + } + } + + func openInterstitial() { + step("Open interstitial") { + interstitial.tap() + } + } + + func openRewarded() { + step("Open rewarded") { + rewarded.tap() + } + } + + func openNative() { + step("Open native") { + native.tap() + } + } +} diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/RootPage.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/RootPage.swift index 4ce8e56..12c7fc4 100644 --- a/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/RootPage.swift +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Pages/RootPage.swift @@ -2,16 +2,34 @@ import XCTest struct RootPage: PageObject { typealias Keys = RootAccessibility - + var yandex: XCUIElement { element(id: Keys.yandex, type: .cell) } var mobileMediation: XCUIElement { element(id: Keys.mobileMediation, type: .cell) } var thirdPartyMediation: XCUIElement { element(id: Keys.thirdPartyMediation, type: .cell) } var gdpr: XCUIElement { element(id: Keys.gdpr, type: .cell) } var adFox: XCUIElement { element(id: Keys.adFox, type: .cell) } - + func openYandex() { step("Open Yandex") { yandex.tap() } } + + func openMobileMediation() { + step("Open mobile mediation") { + mobileMediation.tap() + } + } + + func openAdFox() { + step("Open ad fox") { + adFox.tap() + } + } + + func openGDPR() { + step("Open GDPR") { + gdpr.tap() + } + } } diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/AdFoxTest.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/AdFoxTest.swift new file mode 100644 index 0000000..2b78712 --- /dev/null +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/AdFoxTest.swift @@ -0,0 +1,40 @@ +import XCTest + +final class AdFoxTest: BaseTest { + let adFoxPage = AdFoxPage() + let adPage = AdFoxAdPage() + + func testBanner() throws { + launchApp() + rootPage.openAdFox() + adFoxPage.openBanner() + adPage.tapLoadAd() + try assertAdLoaded(stateLabel: adPage.stateLabel) + adPage.assertAdDisplayed() + adPage.tapAd() + assertSafariOpened() + } + + func testNative() throws { + launchApp() + rootPage.openAdFox() + adFoxPage.openNative() + adPage.tapLoadAd() + try assertAdLoaded(stateLabel: adPage.stateLabel) + adPage.assertAdDisplayed() + adPage.tapAd() + assertSafariOpened() + } + + func testInterstitial() throws { + launchApp() + rootPage.openAdFox() + adFoxPage.openInterstitial() + adPage.tapLoadAd() + try assertAdLoaded(stateLabel: adPage.stateLabel) + adPage.tapPresentAd() + adPage.assertAdDisplayed() + adPage.tapAd() + assertSafariOpened() + } +} diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/BaseTest.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/BaseTest.swift index 22a4d82..aa667a6 100644 --- a/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/BaseTest.swift +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/BaseTest.swift @@ -30,6 +30,12 @@ class BaseTest: XCTestCase { } } + func goBack() { + step("Go to previous screen") { + app.navigationBars.element.buttons.firstMatch.tap() + } + } + func assertAdLoaded(stateLabel: XCUIElement) throws { try step("Check ad loaded") { let noAdsError = "Ad request completed successfully, but there are no ads available." diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/GDPRTest.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/GDPRTest.swift new file mode 100644 index 0000000..d126831 --- /dev/null +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/GDPRTest.swift @@ -0,0 +1,42 @@ +import XCTest + +final class GDPRTest: BaseTest { + let examplePage = GDPRExamplePage() + let settingsPage = GDPRSettingsPage() + let dialogPage = GDPRDialogPage() + + func testDecline() { + launchApp() + rootPage.openGDPR() + examplePage.tapSettings() + settingsPage.tapReset() + goBack() + examplePage.tapLoadAd() + dialogPage.tapAccept() + examplePage.tapSettings() + XCTAssertTrue(settingsPage.consentSwitch.switchValue, "Switch should be on") + } + + func testAccept() { + launchApp() + rootPage.openGDPR() + examplePage.tapSettings() + settingsPage.tapReset() + goBack() + examplePage.tapLoadAd() + dialogPage.tapDecline() + examplePage.tapSettings() + XCTAssertFalse(settingsPage.consentSwitch.switchValue, "Switch should be off") + } + + func testAbout() { + launchApp() + rootPage.openGDPR() + examplePage.tapSettings() + settingsPage.tapReset() + goBack() + examplePage.tapLoadAd() + dialogPage.tapAbout() + assertSafariOpened() + } +} diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/MobileMediationBannerTest.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/MobileMediationBannerTest.swift new file mode 100644 index 0000000..3f454f3 --- /dev/null +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/MobileMediationBannerTest.swift @@ -0,0 +1,56 @@ +import XCTest + +final class MobileMediationBannerTest: BaseTest { + let mobileMediationPage = MobileMediationPage() + let adPage = MobileMediationAdPage() + + func testAdColonyBanner() throws { + try test(adapter: .adColony) + } + + func testBigoAdsBanner() throws { + try test(adapter: .bigoAds) + } + + func testChartboostBanner() throws { + try test(adapter: .chartboost) + } + + func testAdMobBanner() throws { + try test(adapter: .adMob) + } + + func testInMobiBanner() throws { + try test(adapter: .inMobi) + } + +// func testMintegralBanner() throws { +// try test(adapter: .mintegral) +// } + + func testMyTargetBanner() throws { + try test(adapter: .myTarget) + } + + func testIronSourceBanner() throws { + try test(adapter: .ironSource) + } + + func testStartAppBanner() throws { + try test(adapter: .startApp) + } + + func testYandexBanner() throws { + try test(adapter: .yandex) + } + + private func test(adapter: Adapter) throws { + launchApp() + rootPage.openMobileMediation() + mobileMediationPage.openBanner() + adPage.selectAdapter(adapter) + adPage.tapLoadAd() + try assertAdLoaded(stateLabel: adPage.stateLabel) + adPage.assertAdDisplayed() + } +} diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/MobileMediationInterstitialTest.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/MobileMediationInterstitialTest.swift new file mode 100644 index 0000000..d6f2027 --- /dev/null +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/MobileMediationInterstitialTest.swift @@ -0,0 +1,64 @@ +import XCTest + +final class MobileMediationInterstitialTest: BaseTest { + let mobileMediationPage = MobileMediationPage() + let adPage = MobileMediationAdPage() + + func testAdColonyInterstitial() throws { + try test(adapter: .adColony) + } + + func testAppLovinInterstitial() throws { + try test(adapter: .appLovin) + } + + func testBigoAdsInterstitial() throws { + try test(adapter: .bigoAds) + } + + func testChartboostInterstitial() throws { + try test(adapter: .chartboost) + } + + func testAdMobInterstitial() throws { + try test(adapter: .adMob) + } + + func testInMobiInterstitial() throws { + try test(adapter: .inMobi) + } + + func testIronSourceInterstitial() throws { + try test(adapter: .ironSource) + } + +// func testMintegralInterstitial() throws { +// try test(adapter: .mintegral) +// } + + func testMyTargetInterstitial() throws { + try test(adapter: .myTarget) + } + + func testStartAppInterstitial() throws { + try test(adapter: .startApp) + } + + func testUnityAdsInterstitial() throws { + try test(adapter: .unityAds) + } + + func testYandexInterstitial() throws { + try test(adapter: .yandex) + } + + private func test(adapter: Adapter) throws { + launchApp() + rootPage.openMobileMediation() + mobileMediationPage.openInterstitial() + adPage.selectAdapter(adapter) + adPage.tapLoadAd() + try assertAdLoaded(stateLabel: adPage.stateLabel) + adPage.tapPresentAd() + } +} diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/MobileMediationNativeTest.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/MobileMediationNativeTest.swift new file mode 100644 index 0000000..d2d11ba --- /dev/null +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/MobileMediationNativeTest.swift @@ -0,0 +1,28 @@ +import XCTest + +final class MobileMediationNativeTest: BaseTest { + let mobileMediationPage = MobileMediationPage() + let adPage = MobileMediationAdPage() + + func testAdMobNative() throws { + try test(adapter: .adMob) + } + + func testMyTargetNative() throws { + try test(adapter: .myTarget) + } + + func testYandexNative() throws { + try test(adapter: .yandex) + } + + private func test(adapter: Adapter) throws { + launchApp() + rootPage.openMobileMediation() + mobileMediationPage.openNative() + adPage.selectAdapter(adapter) + adPage.tapLoadAd() + try assertAdLoaded(stateLabel: adPage.stateLabel) + adPage.assertAdDisplayed() + } +} diff --git a/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/MobileMediationRewardedTest.swift b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/MobileMediationRewardedTest.swift new file mode 100644 index 0000000..adde071 --- /dev/null +++ b/Examples/YandexMobileAdsExample/YandexMobileAdsExampleUITests/Tests/MobileMediationRewardedTest.swift @@ -0,0 +1,64 @@ +import XCTest + +final class MobileMediationRewardedTest: BaseTest { + let mobileMediationPage = MobileMediationPage() + let adPage = MobileMediationAdPage() + + func testAdColonyRewarded() throws { + try test(adapter: .adColony) + } + + func testAppLovinRewarded() throws { + try test(adapter: .appLovin) + } + + func testBigoAdsRewarded() throws { + try test(adapter: .bigoAds) + } + + func testChartboostRewarded() throws { + try test(adapter: .chartboost) + } + + func testAdMobRewarded() throws { + try test(adapter: .adMob) + } + + func testInMobiRewarded() throws { + try test(adapter: .inMobi) + } + + func testIronSourceRewarded() throws { + try test(adapter: .ironSource) + } + +// func testMintegralRewarded() throws { +// try test(adapter: .mintegral) +// } + + func testMyTargetRewarded() throws { + try test(adapter: .myTarget) + } + + func testStartAppRewarded() throws { + try test(adapter: .startApp) + } + + func testUnityAdsRewarded() throws { + try test(adapter: .unityAds) + } + + func testYandexRewarded() throws { + try test(adapter: .yandex) + } + + private func test(adapter: Adapter) throws { + launchApp() + rootPage.openMobileMediation() + mobileMediationPage.openRewarded() + adPage.selectAdapter(adapter) + adPage.tapLoadAd() + try assertAdLoaded(stateLabel: adPage.stateLabel) + adPage.tapPresentAd() + } +} diff --git a/Package.swift b/Package.swift index 5d78e0f..f4e956e 100644 --- a/Package.swift +++ b/Package.swift @@ -22,8 +22,8 @@ let package = Package( .target( name: "YandexMobileAdsTarget", dependencies: [ - .target(name: "YandexMobileAdsInstream"), .target(name: "YandexMobileAds"), + .target(name: "YandexMobileAdsInstream"), .product(name: "YandexMobileMetrica", package: "metrica-sdk-ios"), .product(name: "DivKit", package: "divkit-ios") ], @@ -51,14 +51,14 @@ let package = Package( ] ), .binaryTarget( - name: "YandexMobileAdsInstream", - url: "https://ads-mobile-sdk.s3.yandex.net/YandexMobileAdsInstream/0.23.0/spm/8f3d6985-1034-4fde-81fe-1ff741efac49.zip", - checksum: "cdd83f93b8fc537a57fa3e56d487ec1baac193e2813ada9c8cac88bc4257308a" + name: "YandexMobileAds", + url: "https://ads-mobile-sdk.s3.yandex.net/Yandex/YandexMobileAds/6.4.0/spm/0cc14722-7a6b-4613-b4b1-0de9ed941718.zip", + checksum: "2cadb363b9195b291a3cbc3860755e2cb75eee668dc388d093031192c7e79af2" ), .binaryTarget( - name: "YandexMobileAds", - url: "https://ads-mobile-sdk.s3.yandex.net/Yandex/YandexMobileAds/6.3.0/spm/24fbdc84-bc4d-48ad-b19d-0788adfaf3bf.zip", - checksum: "1c537dc6fed4324add4c3c64817bc4b12cda44c2ce75a94b64bdcc4c04f6d454" + name: "YandexMobileAdsInstream", + url: "https://ads-mobile-sdk.s3.yandex.net/YandexMobileAdsInstream/0.24.0/spm/07e52c3d-fa5f-4c17-86bc-39182bb494ff.zip", + checksum: "e508ff29789c9dc0d7587518cf04ee6271ac48d97a32d3bdae7d7d2bbf7df91c" ) ] -) +) \ No newline at end of file diff --git a/changelog/adapter/admob-mobileads/CHANGELOG.md b/changelog/adapter/admob-mobileads/CHANGELOG.md index e45ac67..5f2165c 100644 --- a/changelog/adapter/admob-mobileads/CHANGELOG.md +++ b/changelog/adapter/admob-mobileads/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## Version 6.4.0.0 + +### Updated + +* Added support for Yandex Mobile Ads SDK 6.4.0 + ## Version 6.3.0.0 ### Updated diff --git a/changelog/adapter/ironsource-mobileads/CHANGELOG.md b/changelog/adapter/ironsource-mobileads/CHANGELOG.md index 7618406..b0eba0a 100644 --- a/changelog/adapter/ironsource-mobileads/CHANGELOG.md +++ b/changelog/adapter/ironsource-mobileads/CHANGELOG.md @@ -6,6 +6,14 @@ All notable changes to this project will be documented in this file. ### Updated +* Added support for Yandex Mobile Ads SDK 6.4.0 +* Added support for IronSource SDK 7.7.0.0 +* Updated minimum supported IronSource SDK version to 7.7.0.0 + +## Version 6.3.0.0 + +### Updated + * Added support for Yandex Mobile Ads SDK 6.3.0 * Added support for IronSource SDK 7.6.0.0 * Updated minimum supported IronSource SDK version to 7.6.0.0 diff --git a/changelog/mediation/mobileads-adcolony/CHANGELOG.md b/changelog/mediation/mobileads-adcolony/CHANGELOG.md index 9c06144..eef0cb9 100644 --- a/changelog/mediation/mobileads-adcolony/CHANGELOG.md +++ b/changelog/mediation/mobileads-adcolony/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## Version 4.9.0.9 + +### Added + +* Updated minimum supported Yandex Mobile Ads SDK version to 6.4.0 + ## Version 4.9.0.8 ### Added diff --git a/changelog/mediation/mobileads-applovin/CHANGELOG.md b/changelog/mediation/mobileads-applovin/CHANGELOG.md index f3397d6..1501aff 100644 --- a/changelog/mediation/mobileads-applovin/CHANGELOG.md +++ b/changelog/mediation/mobileads-applovin/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## Version 12.1.0.1 + +### Added + +* Updated minimum supported Yandex Mobile Ads SDK version to 6.4.0 + ## Version 12.1.0.0 ### Added diff --git a/changelog/mediation/mobileads-bigoads/CHANGELOG.md b/changelog/mediation/mobileads-bigoads/CHANGELOG.md index 9e14d40..1db8062 100644 --- a/changelog/mediation/mobileads-bigoads/CHANGELOG.md +++ b/changelog/mediation/mobileads-bigoads/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. +## Version 4.2.0.0 + +### Added + +* Added support for BigoADS sdk version 4.2.0 +* Updated minimum supported BigoADS sdk version to 4.2.0 +* Updated minimum supported Yandex Mobile Ads SDK version to 6.4.0 + ## Version 4.0.4.2 ### Added diff --git a/changelog/mediation/mobileads-chartboost/CHANGELOG.md b/changelog/mediation/mobileads-chartboost/CHANGELOG.md index f70a89f..51d3596 100644 --- a/changelog/mediation/mobileads-chartboost/CHANGELOG.md +++ b/changelog/mediation/mobileads-chartboost/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. +## Version 9.6.0.0 + +### Added + +* Added support for Chartboost sdk version 9.6.0 +* Updated minimum supported Chartboost sdk version 9.6.0 +* Updated minimum supported Yandex Mobile Ads SDK version to 6.4.0 + ## Version 9.5.1.1 ### Added diff --git a/changelog/mediation/mobileads-google/CHANGELOG.md b/changelog/mediation/mobileads-google/CHANGELOG.md index a48baa0..079f88d 100644 --- a/changelog/mediation/mobileads-google/CHANGELOG.md +++ b/changelog/mediation/mobileads-google/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## Version 10.14.0.1 + +### Added + +* Updated minimum supported Yandex Mobile Ads SDK version to 6.4.0 + ## Version 10.14.0.0 ### Added diff --git a/changelog/mediation/mobileads-inmobi/CHANGELOG.md b/changelog/mediation/mobileads-inmobi/CHANGELOG.md index 01c5703..d74c1fc 100644 --- a/changelog/mediation/mobileads-inmobi/CHANGELOG.md +++ b/changelog/mediation/mobileads-inmobi/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## Version 10.5.5.5 + +### Added + +* Updated minimum supported Yandex Mobile Ads SDK version to 6.4.0 + ## Version 10.5.5.4 ### Added diff --git a/changelog/mediation/mobileads-ironsource/CHANGELOG.md b/changelog/mediation/mobileads-ironsource/CHANGELOG.md index 06e6ef7..9bee2bb 100644 --- a/changelog/mediation/mobileads-ironsource/CHANGELOG.md +++ b/changelog/mediation/mobileads-ironsource/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. +## Version 7.7.0.0 + +### Updated + +* Added support for IronSource SDK version 7.7.0.0 +* Updated minimum supported IronSource SDK version to 7.7.0.0 +* Updated minimum supported Yandex Mobile Ads SDK version to 6.4.0 + ## Version 7.6.0.0 ### Updated diff --git a/changelog/mediation/mobileads-mintegral/CHANGELOG.md b/changelog/mediation/mobileads-mintegral/CHANGELOG.md index 4d9c6b2..ce30263 100644 --- a/changelog/mediation/mobileads-mintegral/CHANGELOG.md +++ b/changelog/mediation/mobileads-mintegral/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. +## Version 7.5.6.0 + +### Updated + +* Added support for Mintegral SDK version 7.5.6 +* Updated minimum supported Mintegral SDK version to 7.5.6 +* Updated minimum supported Yandex Mobile Ads SDK version to 6.4.0 + ## Version 7.5.1.0 ### Updated diff --git a/changelog/mediation/mobileads-mytarget/CHANGELOG.md b/changelog/mediation/mobileads-mytarget/CHANGELOG.md index 4e3d358..9f0f315 100644 --- a/changelog/mediation/mobileads-mytarget/CHANGELOG.md +++ b/changelog/mediation/mobileads-mytarget/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. +## Version 5.20.1.0 + +### Updated + +* Added support for MyTarget SDK version 5.20.1 +* Updated minimum supported MyTarget SDK version to 5.20.1 +* Updated minimum supported Yandex Mobile Ads SDK version to 6.4.0 + ## Version 5.20.0.0 ### Updated diff --git a/changelog/mediation/mobileads-startapp/CHANGELOG.md b/changelog/mediation/mobileads-startapp/CHANGELOG.md index 43988eb..dbe8f77 100644 --- a/changelog/mediation/mobileads-startapp/CHANGELOG.md +++ b/changelog/mediation/mobileads-startapp/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## Version 4.10.2.1 + +### Updated + +* Updated minimum supported Yandex Mobile Ads SDK version to 6.4.0 + ## Version 4.10.2.0 ### Updated diff --git a/changelog/mediation/mobileads-unityads/CHANGELOG.md b/changelog/mediation/mobileads-unityads/CHANGELOG.md index 9ccf8d9..beebcdb 100644 --- a/changelog/mediation/mobileads-unityads/CHANGELOG.md +++ b/changelog/mediation/mobileads-unityads/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## Version 4.9.2.1 + +### Updated + +* Updated minimum supported Yandex Mobile Ads SDK version to 6.4.0 + ## Version 4.9.2.0 ### Updated diff --git a/changelog/mobileads/CHANGELOG.md b/changelog/mobileads/CHANGELOG.md index 9b35c17..b32c5b4 100644 --- a/changelog/mobileads/CHANGELOG.md +++ b/changelog/mobileads/CHANGELOG.md @@ -2,6 +2,17 @@ All notable changes to this project will be documented in this file. +## Version 6.4.0 + +### Added + +* New method `loadBidderTokenWithRequestConfiguration:completionHandler:` for generating an Open Bidding token +* Improvements and fixes + +### Deprecated + +* Deprecated `loadBidderTokenWithCompletionHandler:` method in `YMABidderTokenLoader` + ## Version 6.3.0 ### Added