Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion demo-ios-objc/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ target 'demo-ios-objc' do
#pod 'OptableSDK'

pod 'Google-Mobile-Ads-SDK'

pod 'PrebidMobile'

target 'demo-ios-objcTests' do
inherit! :search_paths
# Pods for testing
Expand Down
8 changes: 7 additions & 1 deletion demo-ios-objc/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ PODS:
- GoogleUserMessagingPlatform (>= 1.1)
- GoogleUserMessagingPlatform (3.0.0)
- OptableSDK (0.10.0)
- PrebidMobile (3.1.0):
- PrebidMobile/core (= 3.1.0)
- PrebidMobile/core (3.1.0)

DEPENDENCIES:
- Google-Mobile-Ads-SDK
- OptableSDK (from `../`)
- PrebidMobile

SPEC REPOS:
trunk:
- Google-Mobile-Ads-SDK
- GoogleUserMessagingPlatform
- PrebidMobile

EXTERNAL SOURCES:
OptableSDK:
Expand All @@ -21,7 +26,8 @@ SPEC CHECKSUMS:
Google-Mobile-Ads-SDK: 4dde70a8c18d96b14f9548759b8cec6ecb0bc3e6
GoogleUserMessagingPlatform: f8d0cdad3ca835406755d0a69aa634f00e76d576
OptableSDK: fc5d3852c29fac1881b1d3ab6ea397de71c8cbf1
PrebidMobile: 046bb6220157c7332dc6c6e19a99397bb481ac3a

PODFILE CHECKSUM: 48d927338b39550c29272b694f6c18710f33f913
PODFILE CHECKSUM: 5946bfde95ae1dcf09c2ab56c00445beb6cd26c2

COCOAPODS: 1.16.2
6 changes: 6 additions & 0 deletions demo-ios-objc/demo-ios-objc.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
10F4BF742EFDE899E4AE482F /* Pods_demo_ios_objc.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 35D48072B3533132ACEA0D21 /* Pods_demo_ios_objc.framework */; };
11D09485910F1A1EB9871E8E /* Pods_demo_ios_objcTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DB5262E52B5F4397F9533E61 /* Pods_demo_ios_objcTests.framework */; };
536D9E992EA0EE06006D86BE /* PrebidBannerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 536D9E982EA0EE06006D86BE /* PrebidBannerViewController.m */; };
6320EEFE2535F92300F76877 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6320EEFD2535F92300F76877 /* AppDelegate.m */; };
6320EF012535F92300F76877 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6320EF002535F92300F76877 /* SceneDelegate.m */; };
6320EF042535F92300F76877 /* IdentifyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6320EF032535F92300F76877 /* IdentifyViewController.m */; };
Expand Down Expand Up @@ -47,6 +48,8 @@
35D48072B3533132ACEA0D21 /* Pods_demo_ios_objc.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_demo_ios_objc.framework; sourceTree = BUILT_PRODUCTS_DIR; };
45728C7558D469A46F00466E /* Pods-demo-ios-objc-demo-ios-objcUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-demo-ios-objc-demo-ios-objcUITests.debug.xcconfig"; path = "Target Support Files/Pods-demo-ios-objc-demo-ios-objcUITests/Pods-demo-ios-objc-demo-ios-objcUITests.debug.xcconfig"; sourceTree = "<group>"; };
523A0EFF3A972FC18833C15D /* Pods-demo-ios-objc-demo-ios-objcUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-demo-ios-objc-demo-ios-objcUITests.release.xcconfig"; path = "Target Support Files/Pods-demo-ios-objc-demo-ios-objcUITests/Pods-demo-ios-objc-demo-ios-objcUITests.release.xcconfig"; sourceTree = "<group>"; };
536D9E972EA0EE06006D86BE /* PrebidBannerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrebidBannerViewController.h; sourceTree = "<group>"; };
536D9E982EA0EE06006D86BE /* PrebidBannerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PrebidBannerViewController.m; sourceTree = "<group>"; };
5C562AA9ABB1162DB4C0814E /* Pods_demo_ios_objc_demo_ios_objcUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_demo_ios_objc_demo_ios_objcUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
6320EEF92535F92300F76877 /* demo-ios-objc.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "demo-ios-objc.app"; sourceTree = BUILT_PRODUCTS_DIR; };
6320EEFC2535F92300F76877 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -149,6 +152,8 @@
6320EF032535F92300F76877 /* IdentifyViewController.m */,
63B5A8C52536704F000CA436 /* GAMBannerViewController.h */,
63B5A8C025366FE8000CA436 /* GAMBannerViewController.m */,
536D9E972EA0EE06006D86BE /* PrebidBannerViewController.h */,
536D9E982EA0EE06006D86BE /* PrebidBannerViewController.m */,
6320EF052535F92300F76877 /* Main.storyboard */,
6320EF082535F92500F76877 /* Assets.xcassets */,
6320EF0A2535F92500F76877 /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -479,6 +484,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
536D9E992EA0EE06006D86BE /* PrebidBannerViewController.m in Sources */,
63B5A91E2536825A000CA436 /* IdentifyViewController.h in Sources */,
6320EF042535F92300F76877 /* IdentifyViewController.m in Sources */,
63B5A91A25368252000CA436 /* GAMBannerViewController.h in Sources */,
Expand Down
26 changes: 24 additions & 2 deletions demo-ios-objc/demo-ios-objc/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@

#import "AppDelegate.h"
#import "OptableSDKDelegate.h"

@import OptableSDK;

@import PrebidMobile;
@import GoogleMobileAds;

OptableSDK *OPTABLE = nil;

@interface AppDelegate ()
Expand All @@ -18,13 +22,31 @@ @interface AppDelegate ()
@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.

[self initOptable];

[self initPrebidMobile];
[self initGoogleMobileAds];

return YES;
}

- (void)initOptable {
OPTABLE = [[OptableSDK alloc] initWithHost: @"sandbox.optable.co" app: @"ios-sdk-demo" insecure: NO useragent: nil];
OptableSDKDelegate *delegate = [[OptableSDKDelegate alloc] init];
OPTABLE.delegate = delegate;
}

return YES;
- (void)initPrebidMobile {
Prebid.shared.prebidServerAccountId = @"0689a263-318d-448b-a3d4-b02e8a709d9d";

[Prebid initializeSDKWithServerURL:@"https://prebid-server-test-j.prebid.org/openrtb2/auction"
error:nil
:nil];
}

- (void)initGoogleMobileAds {
[[GADMobileAds sharedInstance] startWithCompletionHandler:^(GADInitializationStatus * _Nonnull status) {}];
}

#pragma mark - UISceneSession lifecycle
Expand Down
111 changes: 110 additions & 1 deletion demo-ios-objc/demo-ios-objc/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
<connections>
<segue destination="6oq-n5-l1F" kind="relationship" relationship="viewControllers" id="FxM-e6-chH"/>
<segue destination="9Cd-Yb-3vr" kind="relationship" relationship="viewControllers" id="BUR-3j-I8K"/>
<segue destination="ngO-uL-dBo" kind="relationship" relationship="viewControllers" id="vvr-Ue-W7g"/>
</connections>
</tabBarController>
<placeholder placeholderIdentifier="IBFirstResponder" id="9T0-ao-HOF" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
Expand Down Expand Up @@ -248,6 +249,114 @@
</objects>
<point key="canvasLocation" x="1047.8260869565217" y="758.70535714285711"/>
</scene>
<!--Prebid Banner-->
<scene sceneID="OCW-6e-nVP">
<objects>
<viewController storyboardIdentifier="PrebidBannerViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="jMf-TR-COO" customClass="PrebidBannerViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ure-FD-mxx">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" spacing="18" translatesAutoresizingMaskIntoConstraints="NO" id="efk-ya-KCx">
<rect key="frame" x="20" y="192" width="353" height="180"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="weY-Oz-xEW">
<rect key="frame" x="0.0" y="0.0" width="353" height="48"/>
<constraints>
<constraint firstAttribute="height" constant="48" id="yP9-tj-Mdh"/>
</constraints>
<state key="normal" title="Load Targeting and Banner"/>
<buttonConfiguration key="configuration" style="filled" title="Load Targeting and Banner">
<fontDescription key="titleFontDescription" type="system" weight="medium" pointSize="18"/>
</buttonConfiguration>
<connections>
<action selector="loadBannerWithTargeting:" destination="jMf-TR-COO" eventType="touchUpInside" id="QXR-g6-78z"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="xYE-Vh-vxp">
<rect key="frame" x="0.0" y="66" width="353" height="48"/>
<state key="normal" title="Cached Targeting and Banner"/>
<buttonConfiguration key="configuration" style="filled" title="Cached Targeting and Banner">
<fontDescription key="titleFontDescription" type="system" weight="medium" pointSize="18"/>
</buttonConfiguration>
<connections>
<action selector="loadBannerWithTargetingFromCache:" destination="jMf-TR-COO" eventType="touchUpInside" id="hsN-qc-qhJ"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jmX-aP-YnY">
<rect key="frame" x="0.0" y="132" width="353" height="48"/>
<state key="normal" title="Clear Targeting Cache"/>
<buttonConfiguration key="configuration" style="filled" title="Clear Targeting Cache">
<fontDescription key="titleFontDescription" type="system" weight="medium" pointSize="18"/>
</buttonConfiguration>
<connections>
<action selector="clearTargetingCache:" destination="jMf-TR-COO" eventType="touchUpInside" id="Aen-Ni-fgT"/>
</connections>
</button>
</subviews>
</stackView>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="IvT-26-Mrg">
<rect key="frame" x="20" y="392" width="353" height="268"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<color key="textColor" systemColor="labelColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pAN-ju-HLj">
<rect key="frame" x="36.666666666666657" y="675" width="320" height="50"/>
<color key="backgroundColor" systemColor="systemGray6Color"/>
<constraints>
<constraint firstAttribute="width" constant="320" id="7ed-w4-06b"/>
<constraint firstAttribute="height" constant="50" id="tGP-Se-Fjl"/>
</constraints>
</view>
</subviews>
<viewLayoutGuide key="safeArea" id="GiY-jL-0Qu"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="GiY-jL-0Qu" firstAttribute="trailing" secondItem="IvT-26-Mrg" secondAttribute="trailing" constant="20" id="372-L8-wbO"/>
<constraint firstItem="GiY-jL-0Qu" firstAttribute="trailing" secondItem="efk-ya-KCx" secondAttribute="trailing" constant="20" id="4a0-J4-fHx"/>
<constraint firstItem="IvT-26-Mrg" firstAttribute="top" secondItem="efk-ya-KCx" secondAttribute="bottom" constant="20" id="Bd3-rc-tVg"/>
<constraint firstItem="GiY-jL-0Qu" firstAttribute="bottom" secondItem="pAN-ju-HLj" secondAttribute="bottom" constant="10" id="ESu-FO-gHC"/>
<constraint firstItem="efk-ya-KCx" firstAttribute="top" secondItem="GiY-jL-0Qu" secondAttribute="top" constant="20" id="JZC-FC-tQX"/>
<constraint firstItem="pAN-ju-HLj" firstAttribute="centerX" secondItem="Ure-FD-mxx" secondAttribute="centerX" id="Yb1-ul-jWg"/>
<constraint firstItem="IvT-26-Mrg" firstAttribute="leading" secondItem="GiY-jL-0Qu" secondAttribute="leading" constant="20" id="gjM-t2-U5g"/>
<constraint firstItem="IvT-26-Mrg" firstAttribute="bottom" secondItem="pAN-ju-HLj" secondAttribute="top" constant="-15" id="kEO-A5-gm0"/>
<constraint firstItem="efk-ya-KCx" firstAttribute="leading" secondItem="GiY-jL-0Qu" secondAttribute="leading" constant="20" id="kpx-kZ-hmH"/>
</constraints>
</view>
<navigationItem key="navigationItem" title="Prebid Banner" id="QDT-xZ-pBs"/>
<connections>
<outlet property="adPlaceholder" destination="pAN-ju-HLj" id="apI-J9-3gH"/>
<outlet property="cachedBannerButton" destination="xYE-Vh-vxp" id="5m4-C3-W9F"/>
<outlet property="clearTargetingCacheButton" destination="jmX-aP-YnY" id="Egi-JW-J27"/>
<outlet property="loadBannerButton" destination="weY-Oz-xEW" id="Iie-ph-DpY"/>
<outlet property="targetingOutput" destination="IvT-26-Mrg" id="WYR-7X-ZNM"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Pmf-1X-kmB" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1956" y="1492"/>
</scene>
<!--Prebid Banner-->
<scene sceneID="F5y-Jh-TcN">
<objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="IZ6-g0-qTg" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="ngO-uL-dBo" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Prebid Banner" image="rectangle.3.group.fill" catalog="system" selectedImage="rectangle.3.group.fill" id="n1S-Jv-ndH"/>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="1Wc-Uk-EsU">
<rect key="frame" x="0.0" y="118" width="393" height="54"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="jMf-TR-COO" kind="relationship" relationship="rootViewController" id="riM-i9-2aK"/>
</connections>
</navigationController>
</objects>
<point key="canvasLocation" x="1047" y="1492"/>
</scene>
</scenes>
<resources>
<image name="person.fill.badge.plus" catalog="system" width="128" height="126"/>
Expand All @@ -259,7 +368,7 @@
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<systemColor name="systemGray6Color">
<color red="0.94901960784313721" green="0.94901960784313721" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>
18 changes: 12 additions & 6 deletions demo-ios-objc/demo-ios-objc/GAMBannerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@ @interface GAMBannerViewController ()

@implementation GAMBannerViewController

- (NSString *)AD_MANAGER_AD_UNIT_ID {
return @"/22081946781/ios-sdk-demo/mobile-leaderboard";
}

- (void)viewDidLoad {
[super viewDidLoad];

self.bannerView = [[GADBannerView alloc] initWithAdSize:GADAdSizeBanner];
self.bannerView.adUnitID = @"/22081946781/ios-sdk-demo/mobile-leaderboard";
[self addBannerViewToView:self.bannerView];
self.bannerView.adUnitID = self.AD_MANAGER_AD_UNIT_ID;
self.bannerView.rootViewController = self;
[self addBannerViewToView:self.bannerView];

OptableSDKDelegate *delegate = (OptableSDKDelegate *)OPTABLE.delegate;
delegate.bannerView = self.bannerView;
delegate.adManagerBannerView = self.bannerView;
delegate.targetingOutput = self.targetingOutput;
}

Expand All @@ -48,16 +52,16 @@ - (IBAction)loadBannerWithTargetingFromCache:(id)sender {
GAMRequest *request = [GAMRequest request];
NSDictionary *keyvals = nil;

[_targetingOutput setText:@"Checking local targeting cache...\n\n"];
[_targetingOutput setText:@"🗂 Checking local targeting cache...\n\n"];

keyvals = [OPTABLE targetingFromCache];

if (keyvals != nil) {
request.customTargeting = keyvals;
NSLog(@"[OptableSDK] Cached targeting values found: %@", keyvals);
[_targetingOutput setText:[NSString stringWithFormat:@"%@\nFound cached data: %@\n", [_targetingOutput text], keyvals]];
[_targetingOutput setText:[NSString stringWithFormat:@"%@\n✅ Found cached data: %@\n", [_targetingOutput text], keyvals]];
} else {
[_targetingOutput setText:[NSString stringWithFormat:@"%@\nCache empty.\n",
[_targetingOutput setText:[NSString stringWithFormat:@"%@\nℹ️ Cache empty.\n",
[_targetingOutput text]]];
}

Expand All @@ -71,6 +75,8 @@ - (IBAction)clearTargetingCache:(id)sender {
[OPTABLE targetingClearCache];
}

// MARK: - Helpers

- (void)addBannerViewToView:(UIView *)bannerView {
bannerView.translatesAutoresizingMaskIntoConstraints = NO;
[self.adPlaceholder addSubview:bannerView];
Expand Down
Loading