Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit of AdPlugin

  • Loading branch information...
commit eeae2990da0512aa0907e07210951e0198bf2650 1 parent 3de1779
shazron authored
View
6 AdPlugin/iPhone/.gitignore
@@ -0,0 +1,6 @@
+.DS_Store
+*.pbxuser
+*.perspectivev3
+*.mode1v3
+javascripts/phonegap.js
+javascripts/SAiOSAdPlugin.js
View
54 AdPlugin/iPhone/README.md
@@ -0,0 +1,54 @@
+# PhoneGap AdPlugin #
+by Shazron Abdullah
+
+## Adding the Plugin to your project ##
+
+Using this plugin requires [iPhone PhoneGap](http://github.com/phonegap/phonegap-iphone) and iAd. iAd requires the [iOS 4 SDK](http://developer.apple.com/iphone).
+
+1. Make sure your PhoneGap Xcode project has been [updated for the iOS 4 SDK](http://wiki.phonegap.com/Upgrade-your-PhoneGap-Xcode-Template-for-iOS-4)
+2. Add the "iAd" framework to your Frameworks folder, and set it to be weak linked (see "Weak Linking the iAd Framework" section below)
+3. Add the .h and .m files to your Plugins folder in your project
+4. Add the .js files to your "www" folder on disk, and add reference(s) to the .js files as <link> tags in your html file(s)
+5. See the sample project "iAdHost" for an example use (examine the code in www/index.html)
+6. Make sure you check the "RELEASE NOTES" section below!
+
+## Weak Linking the iAd Framework ##
+
+1. In your project, under "Targets", double click on the Target item
+2. Go to the "General" Tab, under "Linked Libraries"
+3. For the iAd Framework, change the value from "Required" to "Weak"
+
+## FUTURE FEATURES ##
+* Landscape mode iAds
+* Showing of other ad network ads in place of iAds, if no iAds are available
+
+## RELEASE NOTES ##
+
+### 20100712 ###
+* Initial release
+* Only supports portrait iAd banners
+* Not tested on a 3.x device
+* WebView initial size being oversized is a PhoneGap Core issue, and is not addressed in this plugin. When an ad is shown, it correctly sizes the WebView, and when the ad is hidden, sets the WebView back to its original size.
+* Not tested with any other native UI plugins, like TabBar, and will not play nice with them (until we get a better layout management system/plugin)
+
+## BUGS AND CONTRIBUTIONS ##
+
+Patches welcome! Send a pull request. Since this is not a part of PhoneGap Core (which requires a CLA), this should be easier.
+
+Post issues in the [PhoneGap Google Groups](http://groups.google.com/group/phonegap), include in the subject heading - "AdPlugin" or on [Github](http://github.com/shazron/PhoneGap-Plugins/issues)
+(preferred)
+
+The latest code will always be [here](http://github.com/shazron/PhoneGap-Plugins/tree/master/AdPlugin/)
+
+## LICENSE ##
+
+The MIT License
+
+Copyright (c) 2010 Shazron Abdullah
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
View
31 AdPlugin/iPhone/SAiOSAdPlugin.h
@@ -0,0 +1,31 @@
+//
+// SAiOSAdPlugin.h
+// ADPlugin for PhoneGap
+//
+// Created by shazron on 10-07-12.
+// Copyright 2010 Shazron Abdullah. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "PhoneGapCommand.h"
+#import <iAd/iAd.h>
+
+@interface SAiOSAdPlugin : PhoneGapCommand <ADBannerViewDelegate> {
+
+ ADBannerView* adView;
+
+ BOOL bannerIsVisible;
+ BOOL bannerIsInitialized;
+ BOOL bannerIsAtBottom;
+}
+
+@property (nonatomic, retain) ADBannerView* adView;
+@property (assign) BOOL bannerIsVisible;
+@property (assign) BOOL bannerIsInitialized;
+@property (assign) BOOL bannerIsAtBottom;
+
+
+- (void) prepare:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
+- (void) showAd:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
+
+@end
View
43 AdPlugin/iPhone/SAiOSAdPlugin.js
@@ -0,0 +1,43 @@
+/**
+ * Constructor
+ */
+function SAiOSAdPlugin()
+{
+}
+
+/**
+ * show - true to show the ad, false to hide the ad
+ */
+SAiOSAdPlugin.prototype.showAd = function(show)
+{
+ PhoneGap.exec("SAiOSAdPlugin.showAd", show);
+}
+
+/**
+ * atBottom - true to put the ad at the bottom, false to put the ad at the top
+ */
+SAiOSAdPlugin.prototype.prepare = function(atBottom)
+{
+ if (!atBottom) {
+ atBottom = false;
+ }
+ PhoneGap.exec("SAiOSAdPlugin.prepare", atBottom);
+}
+
+/**
+ * Install function
+ */
+SAiOSAdPlugin.install = function()
+{
+ if ( !window.plugins )
+ window.plugins = {};
+ if ( !window.plugins.iAdPlugin )
+ window.plugins.iAdPlugin = new SAiOSAdPlugin();
+
+
+}
+
+/**
+ * Add to PhoneGap constructor
+ */
+PhoneGap.addConstructor(SAiOSAdPlugin.install);
View
160 AdPlugin/iPhone/SAiOSAdPlugin.m
@@ -0,0 +1,160 @@
+//
+// SAiOSAdPlugin.m
+// Ad Plugin for PhoneGap
+//
+// Created by shazron on 10-07-12.
+// Copyright 2010 Shazron Abdullah. All rights reserved.
+//
+
+#import "SAiOSAdPlugin.h"
+
+@interface SAiOSAdPlugin(PrivateMethods)
+
+- (void) __prepare:(BOOL)atBottom;
+- (void) __showAd:(BOOL)show;
+
+@end
+
+
+@implementation SAiOSAdPlugin
+
+@synthesize adView;
+@synthesize bannerIsVisible, bannerIsInitialized, bannerIsAtBottom;
+
+#pragma mark -
+#pragma mark Public Methods
+
+- (void) prepare:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
+{
+ NSUInteger argc = [arguments count];
+ if (argc > 1) {
+ return;
+ }
+
+ NSString* atBottomValue = [arguments objectAtIndex:0];
+ [self __prepare:[atBottomValue boolValue]];
+}
+
+- (void) showAd:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
+{
+ NSUInteger argc = [arguments count];
+ if (argc > 1) {
+ return;
+ }
+
+ NSString* showValue = [arguments objectAtIndex:0];
+ [self __showAd:[showValue boolValue]];
+}
+
+#pragma mark -
+#pragma mark Private Methods
+
+- (void) __prepare:(BOOL)atBottom
+{
+ NSLog(@"SAiOSAdPlugin Prepare Ad At Bottom: %d", atBottom);
+
+ Class adBannerViewClass = NSClassFromString(@"ADBannerView");
+ if (adBannerViewClass && !self.adView)
+ {
+ self.adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
+ self.adView.requiredContentSizeIdentifiers = [NSSet setWithObjects: ADBannerContentSizeIdentifier320x50, ADBannerContentSizeIdentifier480x32, nil];
+ self.adView.delegate = self;
+
+ CGFloat statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
+ if (atBottom) {
+ CGRect adViewFrame = self.adView.frame;
+ adViewFrame.origin.y = [UIScreen mainScreen].bounds.size.height - statusBarHeight - adViewFrame.size.height;
+ self.adView.frame = adViewFrame;
+
+ self.bannerIsAtBottom = YES;
+ }
+
+ self.bannerIsVisible = NO;
+ self.bannerIsInitialized = YES;
+ }
+}
+
+- (void) __showAd:(BOOL)show
+{
+ NSLog(@"SAiOSAdPlugin Show Ad: %d", show);
+
+ if (!self.bannerIsInitialized){
+ [self __prepare:NO];
+ }
+
+ if (!(NSClassFromString(@"ADBannerView") && self.adView)) { // ad classes not available
+ return;
+ }
+
+ if (show == self.bannerIsVisible) { // same state, nothing to do
+ return;
+ }
+
+ CGRect adViewFrame = self.adView.frame;
+ CGRect webViewFrame = [super webView].frame;
+ CGFloat statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
+
+ if (show)
+ {
+ if (self.bannerIsAtBottom)
+ {
+ webViewFrame.size.height -= (adViewFrame.size.height + statusBarHeight);
+ }
+ else
+ {
+ webViewFrame.origin.y += adViewFrame.size.height;
+ webViewFrame.size.height -= (adViewFrame.size.height + statusBarHeight);
+ }
+
+ [UIView beginAnimations:@"blah" context:NULL];
+ [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
+
+ [super webView].frame = webViewFrame;
+ [[[super webView] superview] addSubview:self.adView];
+
+ [UIView commitAnimations];
+
+ self.bannerIsVisible = YES;
+ }
+ else
+ {
+ if (self.bannerIsAtBottom)
+ {
+ webViewFrame.size.height += (adViewFrame.size.height + statusBarHeight);
+ }
+ else
+ {
+ webViewFrame.origin.y -= adViewFrame.size.height;
+ webViewFrame.size.height += (adViewFrame.size.height + statusBarHeight);
+ }
+
+ [UIView beginAnimations:@"blah" context:NULL];
+ [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
+
+ [super webView].frame = webViewFrame;
+ [self.adView removeFromSuperview];
+
+ [UIView commitAnimations];
+
+ self.bannerIsVisible = NO;
+ }
+
+}
+
+#pragma mark -
+#pragma ADBannerViewDelegate
+
+- (void)bannerViewDidLoadAd:(ADBannerView *)banner
+{
+ Class adBannerViewClass = NSClassFromString(@"ADBannerView");
+ if (adBannerViewClass)
+ {
+ NSString* jsString =
+ @"var e = document.createEvent('Events');"
+ "e.initEvent('iAdBannerViewDidLoadAdEvent');"
+ "document.dispatchEvent(e);";
+ [super writeJavascript:jsString];
+ }
+}
+
+@end
View
16 AdPlugin/iPhone/iAdHost/Classes/iAdHostAppDelegate.h
@@ -0,0 +1,16 @@
+//
+// iAdHostAppDelegate.h
+// iAdHost
+//
+// Created by shazron on 10-07-12.
+// Copyright __MyCompanyName__ 2010. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "PhoneGapDelegate.h"
+
+@interface iAdHostAppDelegate : PhoneGapDelegate {
+}
+
+@end
+
View
81 AdPlugin/iPhone/iAdHost/Classes/iAdHostAppDelegate.m
@@ -0,0 +1,81 @@
+//
+// iAdHostAppDelegate.m
+// iAdHost
+//
+// Created by shazron on 10-07-12.
+// Copyright __MyCompanyName__ 2010. All rights reserved.
+//
+
+#import "iAdHostAppDelegate.h"
+#import "PhoneGapViewController.h"
+
+@implementation iAdHostAppDelegate
+
+- (id) init
+{
+ /** If you need to do any extra app-specific initialization, you can do it here
+ * -jm
+ **/
+ return [super init];
+}
+
+/**
+ * This is main kick off after the app inits, the views and Settings are setup here.
+ */
+- (void)applicationDidFinishLaunching:(UIApplication *)application
+{
+ [ super applicationDidFinishLaunching:application ];
+}
+
+-(id) getCommandInstance:(NSString*)className
+{
+ /** You can catch your own commands here, if you wanted to extend the gap: protocol, or add your
+ * own app specific protocol to it. -jm
+ **/
+ return [super getCommandInstance:className];
+}
+
+/**
+ Called when the webview finishes loading. This stops the activity view and closes the imageview
+ */
+- (void)webViewDidFinishLoad:(UIWebView *)theWebView
+{
+ return [ super webViewDidFinishLoad:theWebView ];
+}
+
+- (void)webViewDidStartLoad:(UIWebView *)theWebView
+{
+ return [ super webViewDidStartLoad:theWebView ];
+}
+
+/**
+ * Fail Loading With Error
+ * Error - If the webpage failed to load display an error with the reson.
+ */
+- (void)webView:(UIWebView *)theWebView didFailLoadWithError:(NSError *)error
+{
+ return [ super webView:theWebView didFailLoadWithError:error ];
+}
+
+/**
+ * Start Loading Request
+ * This is where most of the magic happens... We take the request(s) and process the response.
+ * From here we can re direct links and other protocalls to different internal methods.
+ */
+- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
+{
+ return [ super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
+}
+
+
+- (BOOL) execute:(InvokedUrlCommand*)command
+{
+ return [ super execute:command];
+}
+
+- (void)dealloc
+{
+ [ super dealloc ];
+}
+
+@end
View
BIN  AdPlugin/iPhone/iAdHost/Default-Landscape.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  AdPlugin/iPhone/iAdHost/Default-Portrait.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  AdPlugin/iPhone/iAdHost/Default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
29 AdPlugin/iPhone/iAdHost/PhoneGap.plist
@@ -0,0 +1,29 @@
+<?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>DetectPhoneNumber</key>
+ <true/>
+ <key>TopActivityIndicator</key>
+ <string>gray</string>
+ <key>EnableLocation</key>
+ <true/>
+ <key>EnableAcceleration</key>
+ <true/>
+ <key>UIControls</key>
+ <dict>
+ <key>TabBarSettings</key>
+ <dict>
+ <key>height</key>
+ <integer>49</integer>
+ <key>position</key>
+ <string>bottom</string>
+ </dict>
+ <key>ToolBarSettings</key>
+ <dict>
+ <key>style</key>
+ <string>Default</string>
+ </dict>
+ </dict>
+</dict>
+</plist>
View
0  AdPlugin/iPhone/iAdHost/Plugins/dummy
No changes.
View
0  AdPlugin/iPhone/iAdHost/Resources-iPad/README
No changes.
View
48 AdPlugin/iPhone/iAdHost/iAdHost-Info.plist
@@ -0,0 +1,48 @@
+<?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>CFBundleIconFiles</key>
+ <array>
+ <string>icon.png</string>
+ <string>icon-72.png</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ </array>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string>icon.png</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>NSMainNibFile</key>
+ <string></string>
+ <key>NSMainNibFile~ipad</key>
+ <string>-iPad</string>
+</dict>
+</plist>
View
427 AdPlugin/iPhone/iAdHost/iAdHost.xcodeproj/project.pbxproj
@@ -0,0 +1,427 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 45;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1D3623260D0F684500981E51 /* iAdHostAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* iAdHostAppDelegate.m */; };
+ 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
+ 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; };
+ 301BF552109A68D80062928A /* libPhoneGapLib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF535109A57CC0062928A /* libPhoneGapLib.a */; };
+ 301BF570109A69640062928A /* www in Resources */ = {isa = PBXBuildFile; fileRef = 301BF56E109A69640062928A /* www */; };
+ 301BF5B5109A6A2B0062928A /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5B4109A6A2B0062928A /* AddressBook.framework */; };
+ 301BF5B7109A6A2B0062928A /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5B6109A6A2B0062928A /* AddressBookUI.framework */; };
+ 301BF5B9109A6A2B0062928A /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5B8109A6A2B0062928A /* AudioToolbox.framework */; };
+ 301BF5BB109A6A2B0062928A /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5BA109A6A2B0062928A /* AVFoundation.framework */; };
+ 301BF5BD109A6A2B0062928A /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5BC109A6A2B0062928A /* CFNetwork.framework */; };
+ 301BF5BF109A6A2B0062928A /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5BE109A6A2B0062928A /* CoreLocation.framework */; };
+ 301BF5C1109A6A2B0062928A /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5C0109A6A2B0062928A /* MediaPlayer.framework */; };
+ 301BF5C3109A6A2B0062928A /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5C2109A6A2B0062928A /* QuartzCore.framework */; };
+ 301BF5C5109A6A2B0062928A /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5C4109A6A2B0062928A /* SystemConfiguration.framework */; };
+ 302CC88810CD8CCE00C49659 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 302CC88610CD8CCE00C49659 /* Default.png */; };
+ 302CC88910CD8CCE00C49659 /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 302CC88710CD8CCE00C49659 /* icon.png */; };
+ 3044A3A111EAF92400B61B0E /* iAd.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3044A3A011EAF92400B61B0E /* iAd.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
+ 3044A3DE11EAFB0E00B61B0E /* SAiOSAdPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 3044A3DD11EAFB0E00B61B0E /* SAiOSAdPlugin.m */; };
+ 3053AC6F109B7857006FCFE7 /* VERSION in Resources */ = {isa = PBXBuildFile; fileRef = 3053AC6E109B7857006FCFE7 /* VERSION */; };
+ 305D5FD1115AB8F900A74A75 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */; };
+ 30E1352710E2C1420031B30D /* PhoneGap.plist in Resources */ = {isa = PBXBuildFile; fileRef = 30E1352610E2C1420031B30D /* PhoneGap.plist */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 301BF534109A57CC0062928A /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 301BF52D109A57CC0062928A /* PhoneGapLib.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = D2AAC07E0554694100DB518D;
+ remoteInfo = PhoneGapLib;
+ };
+ 301BF550109A68C00062928A /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 301BF52D109A57CC0062928A /* PhoneGapLib.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = D2AAC07D0554694100DB518D;
+ remoteInfo = PhoneGapLib;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+ 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 1D3623240D0F684500981E51 /* iAdHostAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iAdHostAppDelegate.h; sourceTree = "<group>"; };
+ 1D3623250D0F684500981E51 /* iAdHostAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iAdHostAppDelegate.m; sourceTree = "<group>"; };
+ 1D6058910D05DD3D006BFB54 /* iAdHost.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iAdHost.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 301BF52D109A57CC0062928A /* PhoneGapLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = PhoneGapLib.xcodeproj; sourceTree = PHONEGAPLIB; };
+ 301BF56E109A69640062928A /* www */ = {isa = PBXFileReference; lastKnownFileType = folder; path = www; sourceTree = SOURCE_ROOT; };
+ 301BF5B4109A6A2B0062928A /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; };
+ 301BF5B6109A6A2B0062928A /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; };
+ 301BF5B8109A6A2B0062928A /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
+ 301BF5BA109A6A2B0062928A /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
+ 301BF5BC109A6A2B0062928A /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
+ 301BF5BE109A6A2B0062928A /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
+ 301BF5C0109A6A2B0062928A /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; };
+ 301BF5C2109A6A2B0062928A /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
+ 301BF5C4109A6A2B0062928A /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
+ 302CC88610CD8CCE00C49659 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
+ 302CC88710CD8CCE00C49659 /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = "<group>"; };
+ 3044A3A011EAF92400B61B0E /* iAd.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = iAd.framework; path = System/Library/Frameworks/iAd.framework; sourceTree = SDKROOT; };
+ 3044A3DC11EAFB0E00B61B0E /* SAiOSAdPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SAiOSAdPlugin.h; path = ../SAiOSAdPlugin.h; sourceTree = SOURCE_ROOT; };
+ 3044A3DD11EAFB0E00B61B0E /* SAiOSAdPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SAiOSAdPlugin.m; path = ../SAiOSAdPlugin.m; sourceTree = SOURCE_ROOT; };
+ 3053AC6E109B7857006FCFE7 /* VERSION */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VERSION; sourceTree = PHONEGAPLIB; };
+ 305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
+ 30E1352610E2C1420031B30D /* PhoneGap.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = PhoneGap.plist; sourceTree = "<group>"; };
+ 32CA4F630368D1EE00C91783 /* iAdHost_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iAdHost_Prefix.pch; sourceTree = "<group>"; };
+ 8D1107310486CEB800E47090 /* iAdHost-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iAdHost-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 301BF552109A68D80062928A /* libPhoneGapLib.a in Frameworks */,
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
+ 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */,
+ 301BF5B5109A6A2B0062928A /* AddressBook.framework in Frameworks */,
+ 301BF5B7109A6A2B0062928A /* AddressBookUI.framework in Frameworks */,
+ 301BF5B9109A6A2B0062928A /* AudioToolbox.framework in Frameworks */,
+ 301BF5BB109A6A2B0062928A /* AVFoundation.framework in Frameworks */,
+ 301BF5BD109A6A2B0062928A /* CFNetwork.framework in Frameworks */,
+ 301BF5BF109A6A2B0062928A /* CoreLocation.framework in Frameworks */,
+ 301BF5C1109A6A2B0062928A /* MediaPlayer.framework in Frameworks */,
+ 301BF5C3109A6A2B0062928A /* QuartzCore.framework in Frameworks */,
+ 301BF5C5109A6A2B0062928A /* SystemConfiguration.framework in Frameworks */,
+ 305D5FD1115AB8F900A74A75 /* MobileCoreServices.framework in Frameworks */,
+ 3044A3A111EAF92400B61B0E /* iAd.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 080E96DDFE201D6D7F000001 /* Classes */ = {
+ isa = PBXGroup;
+ children = (
+ 1D3623240D0F684500981E51 /* iAdHostAppDelegate.h */,
+ 1D3623250D0F684500981E51 /* iAdHostAppDelegate.m */,
+ );
+ path = Classes;
+ sourceTree = SOURCE_ROOT;
+ };
+ 19C28FACFE9D520D11CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 1D6058910D05DD3D006BFB54 /* iAdHost.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
+ isa = PBXGroup;
+ children = (
+ 301BF56E109A69640062928A /* www */,
+ 301BF52D109A57CC0062928A /* PhoneGapLib.xcodeproj */,
+ 080E96DDFE201D6D7F000001 /* Classes */,
+ 307C750510C5A3420062BCA9 /* Plugins */,
+ 29B97315FDCFA39411CA2CEA /* Other Sources */,
+ 29B97317FDCFA39411CA2CEA /* Resources */,
+ 29B97323FDCFA39411CA2CEA /* Frameworks */,
+ 19C28FACFE9D520D11CA2CBB /* Products */,
+ );
+ name = CustomTemplate;
+ sourceTree = "<group>";
+ };
+ 29B97315FDCFA39411CA2CEA /* Other Sources */ = {
+ isa = PBXGroup;
+ children = (
+ 32CA4F630368D1EE00C91783 /* iAdHost_Prefix.pch */,
+ 29B97316FDCFA39411CA2CEA /* main.m */,
+ );
+ name = "Other Sources";
+ sourceTree = "<group>";
+ };
+ 29B97317FDCFA39411CA2CEA /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 30E1352610E2C1420031B30D /* PhoneGap.plist */,
+ 302CC88610CD8CCE00C49659 /* Default.png */,
+ 302CC88710CD8CCE00C49659 /* icon.png */,
+ 3053AC6E109B7857006FCFE7 /* VERSION */,
+ 8D1107310486CEB800E47090 /* iAdHost-Info.plist */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
+ 1D30AB110D05D00D00671497 /* Foundation.framework */,
+ 288765FC0DF74451002DB57D /* CoreGraphics.framework */,
+ 301BF5B4109A6A2B0062928A /* AddressBook.framework */,
+ 301BF5B6109A6A2B0062928A /* AddressBookUI.framework */,
+ 301BF5B8109A6A2B0062928A /* AudioToolbox.framework */,
+ 301BF5BA109A6A2B0062928A /* AVFoundation.framework */,
+ 301BF5BC109A6A2B0062928A /* CFNetwork.framework */,
+ 301BF5BE109A6A2B0062928A /* CoreLocation.framework */,
+ 301BF5C0109A6A2B0062928A /* MediaPlayer.framework */,
+ 301BF5C2109A6A2B0062928A /* QuartzCore.framework */,
+ 301BF5C4109A6A2B0062928A /* SystemConfiguration.framework */,
+ 305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */,
+ 3044A3A011EAF92400B61B0E /* iAd.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 301BF52E109A57CC0062928A /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 301BF535109A57CC0062928A /* libPhoneGapLib.a */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 307C750510C5A3420062BCA9 /* Plugins */ = {
+ isa = PBXGroup;
+ children = (
+ 3044A3DC11EAFB0E00B61B0E /* SAiOSAdPlugin.h */,
+ 3044A3DD11EAFB0E00B61B0E /* SAiOSAdPlugin.m */,
+ );
+ path = Plugins;
+ sourceTree = SOURCE_ROOT;
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 1D6058900D05DD3D006BFB54 /* iAdHost */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "iAdHost" */;
+ buildPhases = (
+ 30E9A9A110B758320022D3BA /* Copy PhoneGap Javascript */,
+ 304B58A110DAC018002A0835 /* Touch www folder */,
+ 1D60588D0D05DD3D006BFB54 /* Resources */,
+ 1D60588E0D05DD3D006BFB54 /* Sources */,
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */,
+ 3044A3AF11EAF96900B61B0E /* Copy Plugin Js */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 301BF551109A68C00062928A /* PBXTargetDependency */,
+ );
+ name = iAdHost;
+ productName = iAdHost;
+ productReference = 1D6058910D05DD3D006BFB54 /* iAdHost.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 29B97313FDCFA39411CA2CEA /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "iAdHost" */;
+ compatibilityVersion = "Xcode 3.1";
+ hasScannedForEncodings = 1;
+ mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
+ projectDirPath = "";
+ projectReferences = (
+ {
+ ProductGroup = 301BF52E109A57CC0062928A /* Products */;
+ ProjectRef = 301BF52D109A57CC0062928A /* PhoneGapLib.xcodeproj */;
+ },
+ );
+ projectRoot = "";
+ targets = (
+ 1D6058900D05DD3D006BFB54 /* iAdHost */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXReferenceProxy section */
+ 301BF535109A57CC0062928A /* libPhoneGapLib.a */ = {
+ isa = PBXReferenceProxy;
+ fileType = archive.ar;
+ path = libPhoneGapLib.a;
+ remoteRef = 301BF534109A57CC0062928A /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+/* End PBXReferenceProxy section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 1D60588D0D05DD3D006BFB54 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 301BF570109A69640062928A /* www in Resources */,
+ 3053AC6F109B7857006FCFE7 /* VERSION in Resources */,
+ 302CC88810CD8CCE00C49659 /* Default.png in Resources */,
+ 302CC88910CD8CCE00C49659 /* icon.png in Resources */,
+ 30E1352710E2C1420031B30D /* PhoneGap.plist in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 3044A3AF11EAF96900B61B0E /* Copy Plugin Js */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Copy Plugin Js";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "echo cp ../*.js \"${PROJECT_DIR}/www/\"\ncp ../*.js \"${PROJECT_DIR}/www/\"";
+ };
+ 304B58A110DAC018002A0835 /* Touch www folder */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Touch www folder";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "touch -cm ${PROJECT_DIR}/www";
+ };
+ 30E9A9A110B758320022D3BA /* Copy PhoneGap Javascript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Copy PhoneGap Javascript";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "make -C \"${PHONEGAPLIB}\"\necho cp ${PHONEGAPLIB}/javascripts/phonegap.js ${PROJECT_DIR}/www/phonegap.js\ncp \"${PHONEGAPLIB}/javascripts/phonegap.js\" \"${PROJECT_DIR}/www/phonegap.js\"";
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 1D60588E0D05DD3D006BFB54 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1D60589B0D05DD56006BFB54 /* main.m in Sources */,
+ 1D3623260D0F684500981E51 /* iAdHostAppDelegate.m in Sources */,
+ 3044A3DE11EAFB0E00B61B0E /* SAiOSAdPlugin.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 301BF551109A68C00062928A /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = PhoneGapLib;
+ targetProxy = 301BF550109A68C00062928A /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+ 1D6058940D05DD3E006BFB54 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = iAdHost_Prefix.pch;
+ INFOPLIST_FILE = "iAdHost-Info.plist";
+ PRODUCT_NAME = iAdHost;
+ };
+ name = Debug;
+ };
+ 1D6058950D05DD3E006BFB54 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = iAdHost_Prefix.pch;
+ INFOPLIST_FILE = "iAdHost-Info.plist";
+ PRODUCT_NAME = iAdHost;
+ };
+ name = Release;
+ };
+ C01FCF4F08A954540054247B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 3.0;
+ OTHER_LDFLAGS = (
+ "-all_load",
+ "-Obj-C",
+ );
+ PREBINDING = NO;
+ SDKROOT = iphoneos4.0;
+ USER_HEADER_SEARCH_PATHS = "$(PHONEGAPLIB)/Classes";
+ };
+ name = Debug;
+ };
+ C01FCF5008A954540054247B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 3.0;
+ OTHER_LDFLAGS = (
+ "-all_load",
+ "-Obj-C",
+ );
+ PREBINDING = NO;
+ SDKROOT = iphoneos4.0;
+ USER_HEADER_SEARCH_PATHS = "$(PHONEGAPLIB)/Classes";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "iAdHost" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1D6058940D05DD3E006BFB54 /* Debug */,
+ 1D6058950D05DD3E006BFB54 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ C01FCF4E08A954540054247B /* Build configuration list for PBXProject "iAdHost" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C01FCF4F08A954540054247B /* Debug */,
+ C01FCF5008A954540054247B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
+}
View
8 AdPlugin/iPhone/iAdHost/iAdHost_Prefix.pch
@@ -0,0 +1,8 @@
+//
+// Prefix header for all source files of the 'iAdHost' target in the 'iAdHost' project
+//
+
+#ifdef __OBJC__
+ #import <Foundation/Foundation.h>
+ #import <UIKit/UIKit.h>
+#endif
View
BIN  AdPlugin/iPhone/iAdHost/icon-72.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  AdPlugin/iPhone/iAdHost/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
17 AdPlugin/iPhone/iAdHost/main.m
@@ -0,0 +1,17 @@
+//
+// main.m
+// iAdHost
+//
+// Created by shazron on 10-07-12.
+// Copyright __MyCompanyName__ 2010. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+int main(int argc, char *argv[]) {
+
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+ int retVal = UIApplicationMain(argc, argv, nil, @"iAdHostAppDelegate");
+ [pool release];
+ return retVal;
+}
View
135 AdPlugin/iPhone/iAdHost/www/index.html
@@ -0,0 +1,135 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <!-- Change this if you want to allow scaling -->
+ <meta name="viewport" content="width=default-width; user-scalable=no" />
+
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
+
+ <title>iAdHost</title>
+
+ <!-- iPad/iPhone specific css below, add after your main css >
+ <link rel="stylesheet" media="only screen and (max-device-width: 1024px)" href="ipad.css" type="text/css" />
+ <link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="iphone.css" type="text/css" />
+ -->
+ <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
+ <script type="text/javascript" charset="utf-8" src="SAiOSAdPlugin.js"></script>
+ <script type="text/javascript" charset="utf-8">
+
+ // If you want to prevent dragging, uncomment this section
+ /*
+ function preventBehavior(e)
+ {
+ e.preventDefault();
+ };
+ document.addEventListener("touchmove", preventBehavior, false);
+ */
+
+ var gLastAdLoadedDate = null;
+ var gTotalAdsLoaded = 0;
+ var gTimerId = null;
+
+ function onBodyLoad()
+ {
+ document.addEventListener("deviceready", onDeviceReady,false);
+ }
+
+ /* When this function is called, PhoneGap has been initialized and is ready to roll */
+ function onDeviceReady()
+ {
+ // listen for the "iAdBannerViewDidLoadAdEvent" that is sent by the iAdPlugin
+ document.addEventListener("iAdBannerViewDidLoadAdEvent", iAdBannerViewDidLoadAdEventHandler, false);
+
+ var adAtBottom = true;
+ setTimeout(function() {
+ window.plugins.iAdPlugin.prepare(adAtBottom); // by default, ad is at Top
+ }, 1000);
+ }
+
+ function iAdBannerViewDidLoadAdEventHandler(evt)
+ {
+ // if we got this event, a new ad is loaded
+ var elem = document.getElementById("lastAdLoaded");
+ gLastAdLoadedDate = new Date();
+ elem.innerHTML = gLastAdLoadedDate.toLocaleString();
+
+ elem = document.getElementById("showAd");
+ elem.disabled = false;
+
+ gTotalAdsLoaded++;
+
+ elem = document.getElementById("totalAdsLoaded");
+ elem.innerHTML = gTotalAdsLoaded.toString();
+
+ if (gTimerId) {
+ clearInterval(gTimerId);
+ }
+ gTimerId = setInterval(lastAdLoadedInterval, 1000);
+ }
+
+ function lastAdLoadedInterval()
+ {
+ var now = (new Date()).getTime();
+ var diff = now - gLastAdLoadedDate.getTime();
+ var elem = document.getElementById("lastAdLoaded");
+
+ var ms_in_a_year = 31449600000; /* 1000ms x 60s x 60m x 24hrs x 7d x 52w */
+ var ms_in_a_week = 604800000; /* 1000ms x 60s x 60m x 24hrs * 7d */
+ var ms_in_a_day = 86400000; /* 1000ms x 60s x 60m x 24hrs */
+ var ms_in_an_hour = 3600000; /* 1000ms x 60s x 60m */
+ var ms_in_a_minute = 60000; /* 1000ms x 60s */
+ var ms_in_a_second = 1000;
+
+ var milliseconds = Math.floor(diff);
+ var seconds = Math.floor(milliseconds / ms_in_a_second) % 60;
+ var minutes = Math.floor(milliseconds / ms_in_a_minute) % 60;
+ var hours = Math.floor(milliseconds / ms_in_an_hour) % 24;
+ var days = Math.floor(milliseconds / ms_in_a_day) % 7;
+ var weeks = Math.floor(milliseconds / ms_in_a_week) % 52;
+ var years = Math.floor(milliseconds / ms_in_a_year);
+
+ var caption = seconds + "s ago";
+
+ if (minutes > 0) {
+ caption = minutes + "m " + caption;
+ }
+ if (hours > 0) {
+ caption = hours + "h " + caption;
+ }
+ if (days > 0) {
+ caption = days + "d " + caption;
+ }
+ if (weeks > 0) {
+ caption = weeks + "w " + caption;
+ }
+ if (years > 0) {
+ caption = years + "yr " + caption;
+ }
+
+ elem.innerHTML = caption;
+ }
+
+ function showAdClicked(evt)
+ {
+ window.plugins.iAdPlugin.showAd(evt.checked);
+ }
+
+ </script>
+ </head>
+ <body style="margin:0; padding:0;" onload="onBodyLoad()">
+ <span style="position:absolute; top:0;">
+ This is some text at the top of the webview.
+ </span>
+ <br /><br />
+ <form>
+ <input type="checkbox" id="showAd" name="showAd" disabled="disabled" onclick="showAdClicked(this);">Show iAd</input><br />
+ <br />
+ <span>New Ad Loaded: <span id="lastAdLoaded">Waiting.</span></span><br />
+ <span>Total Ads Loaded: <span id="totalAdsLoaded">None.</span></span>
+ </form>
+ <br />
+ <span style="position:absolute;bottom:0">
+ This is some text at the bottom of the webview.
+ </span>
+ </body>
+</html>
Please sign in to comment.
Something went wrong with that request. Please try again.