Skip to content

Commit

Permalink
Merge pull request #9 from ParticleMedia/huanzhiNB/addFaceBookTestAd
Browse files Browse the repository at this point in the history
display fb native&interstitial test ad
  • Loading branch information
huanzhiNB authored Oct 24, 2024
2 parents 7c7c196 + a7ca3b1 commit 12ff024
Show file tree
Hide file tree
Showing 154 changed files with 14,646 additions and 1,056 deletions.
6 changes: 3 additions & 3 deletions MSPDemoApp/MSPDemoApp/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import GoogleAdapter
import NovaAdapter
import AppTrackingTransparency

//import FacebookAdapter
import FacebookAdapter


@main
Expand All @@ -22,8 +22,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
MSP.shared.setGoogleManager(googleManager: GoogleManager())
MSP.shared.bidLoaderProvider.googleQueryInfoFetcher = GoogleQueryInfoFetcherHelper()

//MSP.shared.setMetaManager(metaManager: FacebookManager())
//MSP.shared.bidLoaderProvider.facebookBidTokenProvider = FacebookBidTokenProviderHelper()
MSP.shared.setMetaManager(metaManager: FacebookManager())
MSP.shared.bidLoaderProvider.facebookBidTokenProvider = FacebookBidTokenProviderHelper()

MSP.shared.initMSP(initParams: mspInitParameters, sdkInitListener: nil)
window = UIWindow(frame: UIScreen.main.bounds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public enum AdType: String {
case googleInterstitial
case novaInterstitial
case facebookNative
case facebookInterstitial
}

class DemoAdViewController: UIViewController {
Expand All @@ -37,7 +38,9 @@ class DemoAdViewController: UIViewController {
case .novaInterstitial:
return "demo-ios-launch-fullscreen"
case .facebookNative:
return "msp-ios-foryou-large-native-debug_fb"
return "demo-ios-foryou-large"
case .facebookInterstitial:
return "demo-ios-launch-fullscreen"
}
}()

Expand All @@ -48,7 +51,7 @@ class DemoAdViewController: UIViewController {

case .googleNative, .novaNative, .facebookNative:
return .native
case .googleInterstitial, .novaInterstitial:
case .googleInterstitial, .novaInterstitial, .facebookInterstitial:
return .interstitial
}
}()
Expand All @@ -75,9 +78,9 @@ class DemoAdViewController: UIViewController {
testParams["test"] = "{\"ad_network\":\"msp_nova\",\"test_ad\":true}"
} else if adType == .prebidBanner {
testParams["test"] = "{\"ad_network\":\"pubmatic\",\"test_ad\":true}"
} else if adType == .googleBanner || adType == .googleInterstitial {
} else if adType == .googleBanner || adType == .googleInterstitial || adType == .googleNative {
testParams["test"] = "{\"ad_network\":\"msp_google\",\"test_ad\":true}"
} else if adType == .facebookNative {
} else if adType == .facebookNative || adType == .facebookInterstitial {
testParams["test"] = "{\"ad_network\":\"msp_fb\",\"test_ad\":true}"
}

Expand Down Expand Up @@ -137,10 +140,8 @@ extension DemoAdViewController: AdListener {
//self.nativeAdView?.callToActionButton?.isHidden = true
nativeAdView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
nativeAdView.leadingAnchor.constraint(lessThanOrEqualTo: self.view.leadingAnchor, constant: 100),
nativeAdView.trailingAnchor.constraint(lessThanOrEqualTo: self.view.trailingAnchor),
nativeAdView.topAnchor.constraint(lessThanOrEqualTo: self.view.topAnchor, constant: 100),
nativeAdView.bottomAnchor.constraint(lessThanOrEqualTo: self.view.bottomAnchor),
nativeAdView.centerXAnchor.constraint(equalTo: self.view.centerXAnchor),
nativeAdView.topAnchor.constraint(lessThanOrEqualTo: self.view.topAnchor, constant: 200),
nativeAdView.widthAnchor.constraint(equalToConstant: 300.0)
])
}
Expand Down
25 changes: 16 additions & 9 deletions MSPDemoApp/MSPDemoApp/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,53 +18,60 @@ class ViewController: UIViewController {
button1.addAction(UIAction { [weak self] _ in
self?.openDemoAdPage(adType: .prebidBanner)
}, for: .touchUpInside)
button1.frame = CGRect(x: 100, y: 200, width: 200, height: 50)
button1.frame = CGRect(x: 100, y: 100, width: 200, height: 50)
view.addSubview(button1)

let button2 = UIButton(type: .system)
button2.setTitle("Google Banner View", for: .normal)
button2.addAction(UIAction { [weak self] _ in
self?.openDemoAdPage(adType: .googleBanner)
}, for: .touchUpInside)
button2.frame = CGRect(x: 100, y: 300, width: 200, height: 50)
button2.frame = CGRect(x: 100, y: 150, width: 200, height: 50)
view.addSubview(button2)
let button3 = UIButton(type: .system)
button3.setTitle("Google Native View", for: .normal)
button3.addAction(UIAction { [weak self] _ in
self?.openDemoAdPage(adType: .googleNative)
}, for: .touchUpInside)
button3.frame = CGRect(x: 100, y: 400, width: 200, height: 50)
button3.frame = CGRect(x: 100, y: 200, width: 200, height: 50)
view.addSubview(button3)
let button4 = UIButton(type: .system)
button4.setTitle("Nova Native View", for: .normal)
button4.addAction(UIAction { [weak self] _ in
self?.openDemoAdPage(adType: .novaNative)
}, for: .touchUpInside)
button4.frame = CGRect(x: 100, y: 500, width: 200, height: 50)
button4.frame = CGRect(x: 100, y: 250, width: 200, height: 50)
view.addSubview(button4)
let button5 = UIButton(type: .system)
button5.setTitle("Google Interstitial View", for: .normal)
button5.addAction(UIAction { [weak self] _ in
self?.openDemoAdPage(adType: .googleInterstitial)
}, for: .touchUpInside)
button5.frame = CGRect(x: 100, y: 600, width: 200, height: 50)
button5.frame = CGRect(x: 100, y: 300, width: 200, height: 50)
view.addSubview(button5)
let button6 = UIButton(type: .system)
button6.setTitle("Nova Interstitial View", for: .normal)
button6.addAction(UIAction { [weak self] _ in
self?.openDemoAdPage(adType: .novaInterstitial)
}, for: .touchUpInside)
button6.frame = CGRect(x: 100, y: 700, width: 200, height: 50)
button6.frame = CGRect(x: 100, y: 350, width: 200, height: 50)
view.addSubview(button6)
/*

let button7 = UIButton(type: .system)
button7.setTitle("Facebook Native View", for: .normal)
button7.addAction(UIAction { [weak self] _ in
self?.openDemoAdPage(adType: .facebookNative)
}, for: .touchUpInside)
button7.frame = CGRect(x: 100, y: 800, width: 200, height: 50)
button7.frame = CGRect(x: 100, y: 400, width: 200, height: 50)
view.addSubview(button7)
*/

let button8 = UIButton(type: .system)
button8.setTitle("Facebook Interstitial View", for: .normal)
button8.addAction(UIAction { [weak self] _ in
self?.openDemoAdPage(adType: .facebookInterstitial)
}, for: .touchUpInside)
button8.frame = CGRect(x: 100, y: 450, width: 200, height: 50)
view.addSubview(button8)
}

func openDemoAdPage(adType: AdType) {
Expand Down
3 changes: 2 additions & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ target 'MSPDemoApp' do
#use_frameworks!
pod 'MSPCore', '0.0.65', :modular_headers => true
pod 'NovaAdapter', '0.0.65', :modular_headers => true
pod 'GoogleAdapter', '0.0.65', :modular_headers => true
pod 'GoogleAdapter', '0.0.66', :modular_headers => true
pod 'FacebookAdapter', '0.0.68', :modular_headers => true

end

Expand Down
17 changes: 13 additions & 4 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
PODS:
- FacebookAdapter (0.0.68):
- FBAudienceNetwork (= 6.15.0)
- MSPSharedLibraries (= 0.0.64)
- FBAudienceNetwork (6.15.0)
- Google-Mobile-Ads-SDK (11.2.0):
- GoogleUserMessagingPlatform (>= 1.1)
- GoogleAdapter (0.0.65):
- GoogleAdapter (0.0.66):
- Google-Mobile-Ads-SDK (= 11.2.0)
- MSPSharedLibraries (= 0.0.64)
- GoogleUserMessagingPlatform (2.6.0)
Expand All @@ -17,12 +21,15 @@ PODS:
- SwiftProtobuf (1.21.0)

DEPENDENCIES:
- GoogleAdapter (= 0.0.65)
- FacebookAdapter (= 0.0.68)
- GoogleAdapter (= 0.0.66)
- MSPCore (= 0.0.65)
- NovaAdapter (= 0.0.65)

SPEC REPOS:
trunk:
- FacebookAdapter
- FBAudienceNetwork
- Google-Mobile-Ads-SDK
- GoogleAdapter
- GoogleUserMessagingPlatform
Expand All @@ -33,15 +40,17 @@ SPEC REPOS:
- SwiftProtobuf

SPEC CHECKSUMS:
FacebookAdapter: a96ee32547a84129f8a52dcfa32a0f2dfd936c43
FBAudienceNetwork: 80a035aa69cc3a71c99e44cb5c2874e4cef9909f
Google-Mobile-Ads-SDK: 5a6d005a6cb5b5e8f4c7b69ca05cdea79c181139
GoogleAdapter: 706faa84350d60d0047339dedb96f2e8383304c3
GoogleAdapter: 5ee4b015fe542d23f6eb90e0f3bfa7e20b31dbdd
GoogleUserMessagingPlatform: 0c3a08353e53ce8c2feab7addd0b652cde522450
MSPCore: 2e7953623088be3c6451234bdb865e670e0bd7e9
MSPSharedLibraries: 5afabcfd3a685571361236d52bb63261f96e90bb
NovaAdapter: 14105fdb692e7ee800e73de321cc1ac41b011e96
PrebidAdapter: 9eb0fa13a4a9a9f433c7b7452734debed5b1c893
SwiftProtobuf: afced68785854575756db965e9da52bbf3dc45e7

PODFILE CHECKSUM: 4714c0021d5c3cdb1266a2c0dff4298a6a2711e5
PODFILE CHECKSUM: 44579de08abd39bd854124f523ec27a93f420472

COCOAPODS: 1.15.2

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 12ff024

Please sign in to comment.