Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ppuviarasu committed Dec 9, 2019
2 parents e1dfd21 + 6d9a0d4 commit 80904c0
Show file tree
Hide file tree
Showing 26 changed files with 2,240 additions and 116 deletions.
4 changes: 4 additions & 0 deletions Example/PrebidDemo/PrebidDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/* Begin PBXBuildFile section */
357880CCDA9464E1BC8B6ACE /* Pods_PrebidDemoSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF0177D90B948D57DD24AEB9 /* Pods_PrebidDemoSwift.framework */; };
609C52C32395F17F001FA5BD /* NativeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 609C52C22395F17F001FA5BD /* NativeViewController.swift */; };
C7A1F0B942F152B467C71A70 /* Pods_PrebidDemoObjectiveC.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0B64CCFCC9D513DEAA95A372 /* Pods_PrebidDemoObjectiveC.framework */; };
DADFB9F410588613B69275BC /* Pods_PrebidDemoTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5976732304BFCF6E222040EE /* Pods_PrebidDemoTests.framework */; };
FA12E4B7231EB04100CAA05B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA12E4B6231EB04100CAA05B /* AppDelegate.swift */; };
Expand Down Expand Up @@ -114,6 +115,7 @@
55EA1793258A4B187A300E8E /* Pods-PrebidDemoSwift-PrebidDemoSwiftTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrebidDemoSwift-PrebidDemoSwiftTests.release.xcconfig"; path = "Target Support Files/Pods-PrebidDemoSwift-PrebidDemoSwiftTests/Pods-PrebidDemoSwift-PrebidDemoSwiftTests.release.xcconfig"; sourceTree = "<group>"; };
5976732304BFCF6E222040EE /* Pods_PrebidDemoTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PrebidDemoTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
5CA527E4B4E05598C6D7B462 /* Pods-PrebidDemoTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrebidDemoTests.debug.xcconfig"; path = "Target Support Files/Pods-PrebidDemoTests/Pods-PrebidDemoTests.debug.xcconfig"; sourceTree = "<group>"; };
609C52C22395F17F001FA5BD /* NativeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = NativeViewController.swift; path = ../../../example/PrebidDemo/PrebidDemoSwift/NativeViewController.swift; sourceTree = "<group>"; };
658745FEE114707D845BCCDA /* Pods-PrebidDemoPodTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrebidDemoPodTests.release.xcconfig"; path = "Target Support Files/Pods-PrebidDemoPodTests/Pods-PrebidDemoPodTests.release.xcconfig"; sourceTree = "<group>"; };
6CD6AD93320513F54EF922A8 /* Pods-PrebidDemoPodTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrebidDemoPodTests.debug.xcconfig"; path = "Target Support Files/Pods-PrebidDemoPodTests/Pods-PrebidDemoPodTests.debug.xcconfig"; sourceTree = "<group>"; };
71D584CFFA6132CB2B6B74A6 /* Pods-PrebidDemoObjectiveC.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PrebidDemoObjectiveC.debug.xcconfig"; path = "Target Support Files/Pods-PrebidDemoObjectiveC/Pods-PrebidDemoObjectiveC.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -270,6 +272,7 @@
FA12E4BD231EB04200CAA05B /* Assets.xcassets */,
FA12E4BF231EB04200CAA05B /* LaunchScreen.storyboard */,
FA12E4C2231EB04200CAA05B /* Info.plist */,
609C52C22395F17F001FA5BD /* NativeViewController.swift */,
);
path = PrebidDemoSwift;
sourceTree = "<group>";
Expand Down Expand Up @@ -579,6 +582,7 @@
FA12E4D0231EB3F000CAA05B /* IndexController.swift in Sources */,
FA12E4D1231EB3F000CAA05B /* BannerController.swift in Sources */,
FA12E4B7231EB04100CAA05B /* AppDelegate.swift in Sources */,
609C52C32395F17F001FA5BD /* NativeViewController.swift in Sources */,
FA12E4CF231EB3F000CAA05B /* InterstitialViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
19 changes: 16 additions & 3 deletions Example/PrebidDemo/PrebidDemoSwift/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
import UIKit
import PrebidMobile
import CoreLocation

//import GoogleMobileAds
//import MoPub
import GoogleMobileAds
import MoPub

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
Expand All @@ -32,11 +31,25 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
//Declare in AppDelegate to the user agent could be passed in first call
Prebid.shared.shareGeoLocation = true
//Prebid.shared.timeoutMillis = 1000;

Prebid.shared.prebidServerHost = PrebidHost.Appnexus
Prebid.shared.prebidServerAccountId = "bfa84af2-bd16-4d35-96ad-31c6bb888df0"

//Prebid.shared.prebidServerHost = PrebidHost.Rubicon
//Prebid.shared.prebidServerAccountId = "12345"

GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [ (kGADSimulatorID as! String), "cc7ca766f86b43ab6cdc92bed424069b"]
GADMobileAds.sharedInstance().start()
let sdkConfig = MPMoPubConfiguration(adUnitIdForAppInitialization: "a935eac11acd416f92640411234fbba6")
sdkConfig.globalMediationSettings = []

MoPub.sharedInstance().initializeSdk(with: sdkConfig) {

}

coreLocation = CLLocationManager()
coreLocation?.requestWhenInUseAuthorization()


return true
}
Expand Down
4 changes: 2 additions & 2 deletions Example/PrebidDemo/PrebidDemoSwift/BannerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class BannerController: UIViewController, GADBannerViewDelegate, MPAdViewDelegat

}

mpBanner = MPAdView(adUnitId: "a935eac11acd416f92640411234fbba6", size: CGSize(width: 300, height: 250))
mpBanner = MPAdView(adUnitId: "a935eac11acd416f92640411234fbba6")
mpBanner!.delegate = self

appBannerView.addSubview(mpBanner!)
Expand All @@ -159,7 +159,7 @@ class BannerController: UIViewController, GADBannerViewDelegate, MPAdViewDelegat
adUnit.fetchDemand(adObject: mpBanner!) { (resultCode: ResultCode) in
print("Prebid demand fetch for mopub \(resultCode.name())")

self.mpBanner!.loadAd()
self.mpBanner!.loadAd(withMaxAdSize: CGSize(width: 300,height: 250))
}

}
Expand Down
81 changes: 77 additions & 4 deletions Example/PrebidDemo/PrebidDemoSwift/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15400" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="4Oj-qG-uCu">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="4Oj-qG-uCu">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15404"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15510"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand Down Expand Up @@ -70,6 +70,14 @@
<segue destination="i5n-eA-fbo" kind="show" id="oHg-3D-EQi"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0gT-aH-qqc">
<rect key="frame" x="139" y="463" width="97" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Banner Native"/>
<connections>
<segue destination="g7Y-o0-qeY" kind="show" id="Mld-S3-Yyw"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
Expand All @@ -79,6 +87,7 @@
<constraint firstItem="H9f-Yj-Von" firstAttribute="centerX" secondItem="2BF-DS-686" secondAttribute="centerX" id="Ngz-Nm-10j"/>
<constraint firstItem="2BF-DS-686" firstAttribute="top" secondItem="gs4-Un-gLc" secondAttribute="bottom" constant="25" id="QCv-r0-6G9"/>
<constraint firstItem="fwP-lp-368" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="25" id="TB7-Cg-dlk"/>
<constraint firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="TVT-40-hfI"/>
<constraint firstItem="gs4-Un-gLc" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="UG4-q2-Cje"/>
<constraint firstItem="H9f-Yj-Von" firstAttribute="top" secondItem="2BF-DS-686" secondAttribute="bottom" constant="16.5" id="WHs-er-cHs"/>
<constraint firstItem="2BF-DS-686" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="q39-Lq-QPj"/>
Expand Down Expand Up @@ -128,7 +137,71 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ydj-9r-sui" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="789" y="592"/>
<point key="canvasLocation" x="753" y="-514"/>
</scene>
<!--Native View Controller-->
<scene sceneID="RcZ-hq-Ywf">
<objects>
<viewController id="g7Y-o0-qeY" customClass="NativeViewController" customModule="PrebidDemoSwift" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Bh5-l7-3oV">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="RMV-Sg-y3F">
<rect key="frame" x="37.5" y="54" width="300" height="559"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
</view>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="RMV-Sg-y3F" firstAttribute="top" secondItem="QKV-Tv-nlJ" secondAttribute="top" constant="10" id="9cf-Fd-nx4"/>
<constraint firstItem="RMV-Sg-y3F" firstAttribute="leading" secondItem="QKV-Tv-nlJ" secondAttribute="leading" constant="37.5" id="Ku5-Wf-cmr"/>
<constraint firstItem="RMV-Sg-y3F" firstAttribute="centerX" secondItem="Bh5-l7-3oV" secondAttribute="centerX" id="sUL-mH-7Wn"/>
<constraint firstItem="RMV-Sg-y3F" firstAttribute="centerY" secondItem="Bh5-l7-3oV" secondAttribute="centerY" id="uIa-ue-Ysy"/>
</constraints>
<viewLayoutGuide key="safeArea" id="QKV-Tv-nlJ"/>
</view>
<navigationItem key="navigationItem" id="h83-Tk-Cxc"/>
<connections>
<outlet property="nativeView" destination="RMV-Sg-y3F" id="JTj-CB-FRr"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="UgK-Ok-t7y" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-383" y="817"/>
</scene>
<!--Native Controller-->
<scene sceneID="Yuj-5b-jLm">
<objects>
<viewController id="8EE-dY-0p7" customClass="NativeController" customModule="PrebidDemoSwift" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="PI9-v6-Lfw">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="K0f-FZ-kxL">
<rect key="frame" x="37.5" y="208.5" width="300" height="250"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstAttribute="height" constant="250" id="Nko-Dd-qIR"/>
<constraint firstAttribute="width" constant="300" id="vpJ-Yx-RIu"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="K0f-FZ-kxL" firstAttribute="centerX" secondItem="PI9-v6-Lfw" secondAttribute="centerX" id="G5R-jm-Mef"/>
<constraint firstItem="K0f-FZ-kxL" firstAttribute="centerY" secondItem="PI9-v6-Lfw" secondAttribute="centerY" id="zoQ-vx-n1t"/>
</constraints>
<viewLayoutGuide key="safeArea" id="E0V-4p-0dE"/>
</view>
<navigationItem key="navigationItem" id="pQF-nK-uow"/>
<connections>
<outlet property="nativeView" destination="K0f-FZ-kxL" id="AwO-KS-6QB"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Lop-8Z-uUw" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="706" y="822"/>
</scene>
<!--Banner Controller-->
<scene sceneID="6fe-pu-VEN">
Expand Down Expand Up @@ -171,7 +244,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="y1z-cd-7BR" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1439" y="82"/>
<point key="canvasLocation" x="990" y="-27"/>
</scene>
</scenes>
<inferredMetricsTieBreakers>
Expand Down
32 changes: 11 additions & 21 deletions Example/PrebidDemo/PrebidDemoSwift/IndexController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,29 +45,19 @@ class IndexController: UIViewController {

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {

var buttonText = ""
if let button = sender as? UIButton, let text = button.titleLabel?.text {
buttonText = text
}
let adServerName = adServerSegment.titleForSegment(at: adServerSegment.selectedSegmentIndex)!

if segue.destination is BannerController {
if let vc = segue.destination as? BannerController {
vc.adServerName = adServerSegment.titleForSegment(at: adServerSegment.selectedSegmentIndex)!

if buttonText == "Banner Video" {
vc.bannerFormat = .vast
}
}
}
switch segue.destination {

case let vc as BannerController:
vc.adServerName = adServerName
case let vc as InterstitialViewController:
vc.adServerName = adServerName
case let vc as NativeViewController:
vc.adServerName = adServerName
default:
print("wrong controller")

if segue.destination is InterstitialViewController {
if let vc = segue.destination as? InterstitialViewController {
vc.adServerName = adServerSegment.titleForSegment(at: adServerSegment.selectedSegmentIndex)!

if buttonText == "Interstitial Video" {
vc.bannerFormat = .vast
}
}
}
}

Expand Down
Loading

0 comments on commit 80904c0

Please sign in to comment.