-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add mintegral test cases * add NimbusMintegralKit dependency. * Remove Package.resolved from repository
- Loading branch information
1 parent
59ed94c
commit 0b251eb
Showing
17 changed files
with
452 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ Pods/ | |
# Swift Package Manager | ||
.build/ | ||
Packages/ | ||
Package.resolved | ||
|
||
# Secrets | ||
secrets.json | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
Application/Sources/Demand/Mintegral/Mintegral+Initialization.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// Mintegral+Initialization.swift | ||
// Nimbus | ||
// Created on 10/30/24 | ||
// Copyright © 2024 Nimbus Advertising Solutions Inc. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import NimbusKit | ||
import MTGSDK | ||
#if canImport(NimbusSDK) // CocoaPods | ||
import NimbusSDK | ||
#else // Swift Package Manager | ||
import NimbusMintegralKit | ||
#endif | ||
|
||
fileprivate var mintegralAppId = Bundle.main.infoDictionary?["Mintegral App ID"] as! String | ||
fileprivate var mintegralAppKey = Bundle.main.infoDictionary?["Mintegral App Key"] as! String | ||
|
||
extension UIApplicationDelegate { | ||
func setupMintegralDemand() { | ||
/// It's important to call initialize as soon as the app launches | ||
MTGSDK.sharedInstance().setAppID(mintegralAppId, apiKey: mintegralAppKey) | ||
Nimbus.shared.renderers[.mintegral] = NimbusMintegralAdRenderer() | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
Application/Sources/Demand/Mintegral/MintegralBannerViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// MintegralBannerViewController.swift | ||
// Nimbus | ||
// Created on 10/30/24 | ||
// Copyright © 2024 Nimbus Advertising Solutions Inc. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import NimbusKit | ||
#if canImport(NimbusSDK) // CocoaPods | ||
import NimbusSDK | ||
#elseif canImport(NimbusMintegralKit) // Swift Package Manager | ||
import NimbusMintegralKit | ||
#endif | ||
|
||
class MintegralBannerViewController: MintegralViewController { | ||
var adController: AdController? | ||
let adManager = NimbusAdManager() | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
adManager.delegate = self | ||
adManager.showAd( | ||
request: .forBannerAd(position: "banner").withMintegral(adUnitId: "1541918", placementId: nil), | ||
container: view, | ||
refreshInterval: 30, | ||
adPresentingViewController: self | ||
) | ||
} | ||
} | ||
|
||
extension MintegralBannerViewController: NimbusAdManagerDelegate { | ||
func didRenderAd(request: NimbusRequest, ad: NimbusAd, controller: AdController) { | ||
print("didRenderAd") | ||
adController = controller | ||
adController?.delegate = self | ||
nimbusAd = ad | ||
} | ||
|
||
func didCompleteNimbusRequest(request: NimbusRequest, ad: NimbusAd) { | ||
print("didCompleteNimbusRequest") | ||
} | ||
|
||
func didFailNimbusRequest(request: NimbusRequest, error: NimbusError) { | ||
print("didFailNimbusRequest: \(error.localizedDescription)") | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
Application/Sources/Demand/Mintegral/MintegralInterstitialViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// MintegralInterstitialViewController.swift | ||
// Nimbus | ||
// Created on 11/1/24 | ||
// Copyright © 2024 Nimbus Advertising Solutions Inc. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import NimbusKit | ||
#if canImport(NimbusSDK) // CocoaPods | ||
import NimbusSDK | ||
#elseif canImport(NimbusMintegralKit) // Swift Package Manager | ||
import NimbusMintegralKit | ||
#endif | ||
|
||
class MintegralInterstitialViewController: MintegralViewController { | ||
var adController: AdController? | ||
let adManager = NimbusAdManager() | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
adManager.delegate = self | ||
adManager.showBlockingAd( | ||
request: .forInterstitialAd(position: "interstitial").withMintegral(adUnitId: "1541952", placementId: nil), | ||
closeButtonDelay: 0, | ||
adPresentingViewController: self | ||
) | ||
} | ||
} | ||
|
||
extension MintegralInterstitialViewController: NimbusAdManagerDelegate { | ||
func didRenderAd(request: NimbusRequest, ad: NimbusAd, controller: AdController) { | ||
print("didRenderAd") | ||
adController = controller | ||
adController?.delegate = self | ||
nimbusAd = ad | ||
} | ||
|
||
func didCompleteNimbusRequest(request: NimbusRequest, ad: NimbusAd) { | ||
print("didCompleteNimbusRequest") | ||
} | ||
|
||
func didFailNimbusRequest(request: NimbusRequest, error: NimbusError) { | ||
print("didFailNimbusRequest: \(error.localizedDescription)") | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
Application/Sources/Demand/Mintegral/MintegralNativeViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// MintegralNativeViewController.swift | ||
// Nimbus | ||
// Created on 11/8/24 | ||
// Copyright © 2024 Nimbus Advertising Solutions Inc. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import NimbusKit | ||
import MTGSDK | ||
#if canImport(NimbusSDK) // CocoaPods | ||
import NimbusSDK | ||
#elseif canImport(NimbusMintegralKit) // Swift Package Manager | ||
import NimbusMintegralKit | ||
#endif | ||
|
||
class MintegralNativeViewController: MintegralViewController { | ||
var adController: AdController? | ||
let adManager = NimbusAdManager() | ||
|
||
let contentView = UIView() | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
if let renderer = Nimbus.shared.renderers[.mintegral] as? NimbusMintegralAdRenderer { | ||
renderer.adRendererDelegate = self | ||
} | ||
|
||
contentView.translatesAutoresizingMaskIntoConstraints = false | ||
|
||
view.addSubview(contentView) | ||
NSLayoutConstraint.activate([ | ||
contentView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor), | ||
contentView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor), | ||
contentView.topAnchor.constraint(equalTo: headerView.bottomAnchor), | ||
contentView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor), | ||
]) | ||
|
||
adManager.delegate = self | ||
adManager.showAd( | ||
request: NimbusRequest.forNativeAd(position: "native").withMintegral(adUnitId: "1541926"), | ||
container: contentView, | ||
adPresentingViewController: self | ||
) | ||
} | ||
} | ||
|
||
extension MintegralNativeViewController: NimbusAdManagerDelegate { | ||
func didRenderAd(request: NimbusRequest, ad: NimbusAd, controller: AdController) { | ||
print("didRenderAd") | ||
adController = controller | ||
adController?.delegate = self | ||
nimbusAd = ad | ||
} | ||
|
||
func didCompleteNimbusRequest(request: NimbusRequest, ad: NimbusAd) { | ||
print("didCompleteNimbusRequest") | ||
} | ||
|
||
func didFailNimbusRequest(request: NimbusRequest, error: NimbusError) { | ||
print("didFailNimbusRequest: \(error.localizedDescription)") | ||
} | ||
} | ||
|
||
extension MintegralNativeViewController: NimbusMintegralAdRendererDelegate { | ||
func nativeAdViewForRendering(container: UIView, campaign: MTGCampaign) -> any NimbusMintegralNativeAdViewType { | ||
MintegralNativeAdView(campaign: campaign) | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
Application/Sources/Demand/Mintegral/MintegralRewardedViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// MintegralRewardedViewController.swift | ||
// Nimbus | ||
// Created on 11/1/24 | ||
// Copyright © 2024 Nimbus Advertising Solutions Inc. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import NimbusKit | ||
#if canImport(NimbusSDK) // CocoaPods | ||
import NimbusSDK | ||
#elseif canImport(NimbusMintegralKit) // Swift Package Manager | ||
import NimbusMintegralKit | ||
#endif | ||
|
||
class MintegralRewardedViewController: MintegralViewController { | ||
var adController: AdController? | ||
let adManager = NimbusAdManager() | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
adManager.delegate = self | ||
adManager.showRewardedAd( | ||
request: .forRewardedVideo(position: "rewarded").withMintegral(adUnitId: "1541935"), | ||
adPresentingViewController: self | ||
) | ||
} | ||
} | ||
|
||
extension MintegralRewardedViewController: NimbusAdManagerDelegate { | ||
func didRenderAd(request: NimbusRequest, ad: NimbusAd, controller: AdController) { | ||
print("didRenderAd") | ||
adController = controller | ||
adController?.delegate = self | ||
nimbusAd = ad | ||
} | ||
|
||
func didCompleteNimbusRequest(request: NimbusRequest, ad: NimbusAd) { | ||
print("didCompleteNimbusRequest") | ||
} | ||
|
||
func didFailNimbusRequest(request: NimbusRequest, error: NimbusError) { | ||
print("didFailNimbusRequest: \(error.localizedDescription)") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.