Skip to content

Commit

Permalink
Release 5.9.1 (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
mobile-ads-github authored Jul 24, 2023
1 parent 350d1c4 commit 8729caa
Show file tree
Hide file tree
Showing 13 changed files with 622 additions and 172 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
46C354A2282560FE00832C7C /* IronSourceManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46C3549F282560FE00832C7C /* IronSourceManager.swift */; };
70011FE6B068EC271A1051CB /* libPods-YandexMobileAdsExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A35F1D3A95F5CC1C05B0ED57 /* libPods-YandexMobileAdsExample.a */; };
B394AC8627A868DB00D92CD9 /* AdPlayerErrorConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = B394AC8527A868DB00D92CD9 /* AdPlayerErrorConverter.swift */; };
DE0C2CBE2A65760900A84D00 /* NativeTemplateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0C2CBD2A65760900A84D00 /* NativeTemplateViewController.swift */; };
DE0C2CC02A66245700A84D00 /* NativeCustomViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0C2CBF2A66245700A84D00 /* NativeCustomViewController.swift */; };
DE0C2CC22A671FF500A84D00 /* NativeCustomAdView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0C2CC12A671FF500A84D00 /* NativeCustomAdView.swift */; };
DEC81ADA2A53A89B008FE935 /* YandexAdsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC81AD92A53A89B008FE935 /* YandexAdsViewController.swift */; };
DEC81ADC2A53B9E7008FE935 /* String+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC81ADB2A53B9E7008FE935 /* String+Extensions.swift */; };
DEC81ADE2A53BE28008FE935 /* InstreamListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC81ADD2A53BE28008FE935 /* InstreamListViewController.swift */; };
Expand Down Expand Up @@ -132,6 +135,9 @@
9722EABB876EC1FBC865DDBE /* Pods-YandexMobileAdsExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YandexMobileAdsExample.release.xcconfig"; path = "Target Support Files/Pods-YandexMobileAdsExample/Pods-YandexMobileAdsExample.release.xcconfig"; sourceTree = "<group>"; };
A35F1D3A95F5CC1C05B0ED57 /* libPods-YandexMobileAdsExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-YandexMobileAdsExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
B394AC8527A868DB00D92CD9 /* AdPlayerErrorConverter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdPlayerErrorConverter.swift; sourceTree = "<group>"; };
DE0C2CBD2A65760900A84D00 /* NativeTemplateViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NativeTemplateViewController.swift; sourceTree = "<group>"; };
DE0C2CBF2A66245700A84D00 /* NativeCustomViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NativeCustomViewController.swift; sourceTree = "<group>"; };
DE0C2CC12A671FF500A84D00 /* NativeCustomAdView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NativeCustomAdView.swift; sourceTree = "<group>"; };
DEC81AD92A53A89B008FE935 /* YandexAdsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YandexAdsViewController.swift; sourceTree = "<group>"; };
DEC81ADB2A53B9E7008FE935 /* String+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extensions.swift"; sourceTree = "<group>"; };
DEC81ADD2A53BE28008FE935 /* InstreamListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstreamListViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -371,6 +377,9 @@
147B0BCE27200D14005F4062 /* CustomNativeViewController.swift */,
DEC81AE12A53C840008FE935 /* NativeViewController.swift */,
14033FC32720598D00A24D5E /* TemplateNativeViewController.swift */,
DE0C2CBD2A65760900A84D00 /* NativeTemplateViewController.swift */,
DE0C2CBF2A66245700A84D00 /* NativeCustomViewController.swift */,
DE0C2CC12A671FF500A84D00 /* NativeCustomAdView.swift */,
);
path = Native;
sourceTree = "<group>";
Expand Down Expand Up @@ -592,11 +601,13 @@
14033F5E27201B8A00A24D5E /* MobileMediationInterstitialViewController.swift in Sources */,
14033FB52720457800A24D5E /* ReusablePlayer.swift in Sources */,
DEC81ADA2A53A89B008FE935 /* YandexAdsViewController.swift in Sources */,
DE0C2CC02A66245700A84D00 /* NativeCustomViewController.swift in Sources */,
147B0BD827200FCE005F4062 /* RewardedViewController.swift in Sources */,
DEC81AEE2A55ADEC008FE935 /* InterstitialAdViewController.swift in Sources */,
14033F6527201E2700A24D5E /* MobileMediationNativeViewController.swift in Sources */,
1499318B2722CD44005D2E87 /* AdFoxInterstitialViewController.swift in Sources */,
14033FB12720457800A24D5E /* ContentControlsController.swift in Sources */,
DE0C2CBE2A65760900A84D00 /* NativeTemplateViewController.swift in Sources */,
14033FBD2720457800A24D5E /* ViewVisibilityValidator.swift in Sources */,
DEC81AE62A54D5A3008FE935 /* StickyBannerViewController.swift in Sources */,
14033FB02720457800A24D5E /* InstreamContent.swift in Sources */,
Expand Down Expand Up @@ -627,6 +638,7 @@
1474FC212721A4E500276688 /* GDPRDDialogViewController.swift in Sources */,
147B0BD227200D14005F4062 /* CustomNativeViewController.swift in Sources */,
14033FBE2720457800A24D5E /* InstreamAdBinderToastDelegate.swift in Sources */,
DE0C2CC22A671FF500A84D00 /* NativeCustomAdView.swift in Sources */,
147B0BCF27200D14005F4062 /* StarRatingView.swift in Sources */,
147B0BD527200E75005F4062 /* BannerViewController.swift in Sources */,
14033FB82720457800A24D5E /* ContentPlayer.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,63 +8,54 @@
import YandexMobileAds

final class InlineBannerViewController: UIViewController {
private var adView: YMAAdView?
private var loadButton: UIButton?

override func viewDidLayoutSubviews() {
setupUI()
}

override func viewDidAppear(_ animated: Bool) {
createAdView()
setupAdView()
}

// MARK: - Ad

private func createAdView() {
private lazy var adView: YMAAdView = {
let adSize = YMAAdSize.inlineSize(withWidth: 320, maxHeight: 320)
// Replace demo demo-banner-yandex with actual Ad Unit ID
adView = YMAAdView(adUnitID: "demo-banner-yandex", adSize: adSize)
adView?.delegate = self
}

private func setupAdView() {
guard let adView, let loadButton else { return }
let adView = YMAAdView(adUnitID: "demo-banner-yandex", adSize: adSize)
adView.delegate = self
adView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(adView)
return adView
}()

NSLayoutConstraint.activate([
adView.topAnchor.constraint(equalTo: loadButton.layoutMarginsGuide.bottomAnchor, constant: 100),
adView.centerXAnchor.constraint(equalTo: view.layoutMarginsGuide.centerXAnchor),
])
private lazy var loadButton: UIButton = {
let button = UIButton(
configuration: .tinted(),
primaryAction: UIAction(title: "Load ad") { [weak self] _ in
self?.adView.loadAd()
}
)
button.translatesAutoresizingMaskIntoConstraints = false
button.setTitle("Load ad", for: .normal)
return button
}()

override func viewDidLoad() {
super.viewDidLoad()
setupUI()
addSubviews()
setupConstraints()
}

// MARK: - UI

private func setupUI() {
view.backgroundColor = .white
title = "Inline Banner"

setupLoadButton()
}

private func setupLoadButton() {
let button = UIButton(
configuration: .tinted(),
primaryAction: UIAction(title: "Load ad") { [weak self] _ in
self?.adView?.loadAd()
}
)
button.translatesAutoresizingMaskIntoConstraints = false
button.setTitle("Load ad", for: .normal)
view.addSubview(button)
private func addSubviews() {
view.addSubview(adView)
view.addSubview(loadButton)
}

private func setupConstraints() {
NSLayoutConstraint.activate([
button.topAnchor.constraint(equalTo: view.layoutMarginsGuide.topAnchor, constant: 100),
button.centerXAnchor.constraint(equalTo: view.layoutMarginsGuide.centerXAnchor),
adView.topAnchor.constraint(equalTo: loadButton.bottomAnchor, constant: 100),
adView.centerXAnchor.constraint(equalTo: view.centerXAnchor),

loadButton.topAnchor.constraint(equalTo: view.topAnchor, constant: 100),
loadButton.centerXAnchor.constraint(equalTo: view.centerXAnchor)
])
loadButton = button
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,52 @@
import YandexMobileAds

final class StickyBannerViewController: UIViewController {
private var adView: YMAAdView?

override func viewDidLayoutSubviews() {
setupUI()
}

override func viewDidAppear(_ animated: Bool) {
createAdView()
}

// MARK: - Ad

private func createAdView() {
private lazy var adView: YMAAdView = {
let width = view.safeAreaLayoutGuide.layoutFrame.width
let adSize = YMAAdSize.stickySize(withContainerWidth: width)
// Replace demo demo-banner-yandex with actual Ad Unit ID
adView = YMAAdView(adUnitID: "demo-banner-yandex", adSize: adSize)
adView?.delegate = self
adView?.displayAtBottom(in: view)
let adView = YMAAdView(adUnitID: "demo-banner-yandex", adSize: adSize)
adView.delegate = self
return adView
}()

private lazy var loadButton: UIButton = {
let button = UIButton(
configuration: .tinted(),
primaryAction: UIAction(title: "Load ad") { [weak self] _ in
self?.adView.loadAd()
}
)
button.translatesAutoresizingMaskIntoConstraints = false
button.setTitle("Load ad", for: .normal)
return button
}()

override func viewDidLoad() {
super.viewDidLoad()
setupUI()
addSubviews()
setupConstraints()
}

// MARK: - UI

private func setupUI() {
view.backgroundColor = .white
title = "Sticky Banner"

setupLoadButton()
}

private func setupLoadButton() {
let button = UIButton(
configuration: .tinted(),
primaryAction: UIAction(title: "Load ad") { [weak self] _ in
self?.adView?.loadAd()
}
)
button.translatesAutoresizingMaskIntoConstraints = false
button.setTitle("Load ad", for: .normal)
view.addSubview(button)
private func addSubviews() {
adView.displayAtBottom(in: view)
view.addSubview(loadButton)
}

private func setupConstraints() {
NSLayoutConstraint.activate([
button.topAnchor.constraint(equalTo: view.layoutMarginsGuide.topAnchor, constant: 100),
button.centerXAnchor.constraint(equalTo: view.layoutMarginsGuide.centerXAnchor),
loadButton.topAnchor.constraint(equalTo: view.topAnchor, constant: 100),
loadButton.centerXAnchor.constraint(equalTo: view.centerXAnchor),
])
}

}

extension StickyBannerViewController: YMAAdViewDelegate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,77 +8,73 @@
import YandexMobileAds

final class InterstitialAdViewController: UIViewController {
private var interstitialAd: YMAInterstitialAd?
private var presentButton: UIButton?

override func viewDidLayoutSubviews() {
setupUI()
}

override func viewDidAppear(_ animated: Bool) {
createRewardedAd()
}

// MARK: - Ad

private func createRewardedAd() {
private lazy var interstitialAd: YMAInterstitialAd = {
// Replace demo-interstitial-yandex with actual Ad Unit ID
interstitialAd = YMAInterstitialAd(adUnitID: "demo-interstitial-yandex")
interstitialAd?.delegate = self
}

// MARK: - UI
let ad = YMAInterstitialAd(adUnitID: "demo-interstitial-yandex")
ad.delegate = self
return ad
}()

private func setupUI() {
view.backgroundColor = .white
title = "Interstitial Ad"

setupLoadButton()
setupPresentButton()
}

private func setupLoadButton() {
private lazy var presentButton: UIButton = {
let button = UIButton(
configuration: .tinted(),
primaryAction: UIAction(title: "Load ad") { [weak self] _ in
self?.interstitialAd?.load()
primaryAction: UIAction(title: "Present ad") { [weak self] _ in
guard let self else { return }
self.interstitialAd.present(from: self)
}
)
button.translatesAutoresizingMaskIntoConstraints = false
button.setTitle("Load ad", for: .normal)
view.addSubview(button)

NSLayoutConstraint.activate([
button.topAnchor.constraint(equalTo: view.layoutMarginsGuide.topAnchor, constant: 100),
button.trailingAnchor.constraint(equalTo: view.layoutMarginsGuide.centerXAnchor, constant: -20)
])
}
button.setTitle("Present ad", for: .normal)
button.isEnabled = false
return button
}()

private func setupPresentButton() {
private lazy var loadButton: UIButton = {
let button = UIButton(
configuration: .tinted(),
primaryAction: UIAction(title: "Present ad") { [weak self] _ in
guard let self else { return }
self.interstitialAd?.present(from: self)
primaryAction: UIAction(title: "Load ad") { [weak self] _ in
self?.interstitialAd.load()
}
)
button.translatesAutoresizingMaskIntoConstraints = false
button.setTitle("Present ad", for: .normal)
button.isEnabled = false
view.addSubview(button)
button.setTitle("Load ad", for: .normal)
return button
}()

override func viewDidLoad() {
super.viewDidLoad()
setupUI()
addSubviews()
setupConstraints()
}

// MARK: - UI

private func setupUI() {
view.backgroundColor = .white
title = "Interstitial Ad"
}

private func addSubviews() {
view.addSubview(loadButton)
view.addSubview(presentButton)
}

private func setupConstraints() {
NSLayoutConstraint.activate([
button.topAnchor.constraint(equalTo: view.layoutMarginsGuide.topAnchor, constant: 100),
button.leadingAnchor.constraint(equalTo: view.layoutMarginsGuide.centerXAnchor, constant: 20)
loadButton.topAnchor.constraint(equalTo: view.topAnchor, constant: 100),
loadButton.trailingAnchor.constraint(equalTo: view.centerXAnchor, constant: -20),

presentButton.topAnchor.constraint(equalTo: view.topAnchor, constant: 100),
presentButton.leadingAnchor.constraint(equalTo: view.centerXAnchor, constant: 20)
])
presentButton = button
}
}

extension InterstitialAdViewController: YMAInterstitialAdDelegate {
func interstitialAdDidLoad(_ interstitialAd: YMAInterstitialAd) {
print(#function)
presentButton?.isEnabled = true
presentButton.isEnabled = true
}

func interstitialAdDidFail(toLoad interstitialAd: YMAInterstitialAd, error: Error) {
Expand Down
Loading

0 comments on commit 8729caa

Please sign in to comment.