Skip to content

Commit

Permalink
Merge branch 'develop' into release/1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
grgar committed Apr 25, 2015
2 parents 79041ca + 1ba8f81 commit d03bdf1
Show file tree
Hide file tree
Showing 39 changed files with 1,863 additions and 5 deletions.
35 changes: 33 additions & 2 deletions platforms/ios/TDA Connect.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
};
objectVersion = 46;
objects = {

/* Begin PBXBuildFile section */
171DACF61AEAD2420089C97D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 171DACF51AEAD2420089C97D /* Images.xcassets */; };
1D3623260D0F684500981E51 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* AppDelegate.m */; };
Expand All @@ -16,6 +15,10 @@
302D95F214D2391D003F00A1 /* MainViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 302D95F014D2391D003F00A1 /* MainViewController.xib */; };
305D5FD1115AB8F900A74A75 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */; };
5B1594DD16A7569C00FEF299 /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B1594DC16A7569C00FEF299 /* AssetsLibrary.framework */; };
322E5881BAA6461A971E79DA /* CDVPluginExt.m in Sources */ = {isa = PBXBuildFile; fileRef = 58ABDD5E8EA84B678A3604A8 /* CDVPluginExt.m */; };
C7A453660D404592BF127830 /* libCordovaGenericAd.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8FC27066CE4A4781B78B173F /* libCordovaGenericAd.a */; };
3F2DCB07BE944265AB83F073 /* iAdPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = A670D767EB784D57A2A0D4FB /* iAdPlugin.m */; };
C3A0B0B99A064F1BB97947F2 /* iAd.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 75063882C45E4F30B0C4834B /* iAd.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -55,6 +58,14 @@
EB87FDF31871DA8E0020F90C /* www */ = {isa = PBXFileReference; lastKnownFileType = folder; name = www; path = ../../www; sourceTree = "<group>"; };
EB87FDF41871DAF40020F90C /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = config.xml; path = ../../config.xml; sourceTree = "<group>"; };
F840E1F0165FE0F500CFE078 /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = config.xml; path = "TDA Connect/config.xml"; sourceTree = "<group>"; };
58ABDD5E8EA84B678A3604A8 /* CDVPluginExt.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "CDVPluginExt.m"; path = "com.rjfun.cordova.extension/CDVPluginExt.m"; sourceTree = "<group>"; fileEncoding = 4; };
8FC27066CE4A4781B78B173F /* libCordovaGenericAd.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libCordovaGenericAd.a"; path = "TDA Connect/Plugins/com.rjfun.cordova.extension/libCordovaGenericAd.a"; sourceTree = "<group>"; fileEncoding = 4; };
11D4B158E0F54804989AD641 /* PluginAdapterDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "PluginAdapterDelegate.h"; path = "com.rjfun.cordova.extension/PluginAdapterDelegate.h"; sourceTree = "<group>"; fileEncoding = 4; };
92653B8B09D4402ABF14132E /* CDVPluginExt.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "CDVPluginExt.h"; path = "com.rjfun.cordova.extension/CDVPluginExt.h"; sourceTree = "<group>"; fileEncoding = 4; };
D053F63B68F344C09BE035D5 /* GenericAdPlugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "GenericAdPlugin.h"; path = "com.rjfun.cordova.extension/GenericAdPlugin.h"; sourceTree = "<group>"; fileEncoding = 4; };
A670D767EB784D57A2A0D4FB /* iAdPlugin.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "iAdPlugin.m"; path = "com.rjfun.cordova.iad/iAdPlugin.m"; sourceTree = "<group>"; fileEncoding = 4; };
603CE0630DA54B1D91EA7864 /* iAdPlugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "iAdPlugin.h"; path = "com.rjfun.cordova.iad/iAdPlugin.h"; sourceTree = "<group>"; fileEncoding = 4; };
75063882C45E4F30B0C4834B /* iAd.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "iAd.framework"; path = "System/Library/Frameworks/iAd.framework"; sourceTree = SDKROOT; fileEncoding = 4; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -66,6 +77,8 @@
301BF552109A68D80062928A /* libCordova.a in Frameworks */,
288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */,
305D5FD1115AB8F900A74A75 /* MobileCoreServices.framework in Frameworks */,
C7A453660D404592BF127830 /* libCordovaGenericAd.a in Frameworks */,
C3A0B0B99A064F1BB97947F2 /* iAd.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -137,6 +150,8 @@
5B1594DC16A7569C00FEF299 /* AssetsLibrary.framework */,
288765FC0DF74451002DB57D /* CoreGraphics.framework */,
305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */,
8FC27066CE4A4781B78B173F /* libCordovaGenericAd.a */,
75063882C45E4F30B0C4834B /* iAd.framework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand All @@ -152,6 +167,12 @@
307C750510C5A3420062BCA9 /* Plugins */ = {
isa = PBXGroup;
children = (
58ABDD5E8EA84B678A3604A8 /* CDVPluginExt.m */,
11D4B158E0F54804989AD641 /* PluginAdapterDelegate.h */,
92653B8B09D4402ABF14132E /* CDVPluginExt.h */,
D053F63B68F344C09BE035D5 /* GenericAdPlugin.h */,
A670D767EB784D57A2A0D4FB /* iAdPlugin.m */,
603CE0630DA54B1D91EA7864 /* iAdPlugin.h */,
);
name = Plugins;
path = "TDA Connect/Plugins";
Expand Down Expand Up @@ -194,7 +215,7 @@
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0510;
LastUpgradeCheck = 510;
TargetAttributes = {
1D6058900D05DD3D006BFB54 = {
DevelopmentTeam = 5TFUK958NL;
Expand Down Expand Up @@ -278,6 +299,8 @@
1D60589B0D05DD56006BFB54 /* main.m in Sources */,
1D3623260D0F684500981E51 /* AppDelegate.m in Sources */,
302D95F114D2391D003F00A1 /* MainViewController.m in Sources */,
322E5881BAA6461A971E79DA /* CDVPluginExt.m in Sources */,
3F2DCB07BE944265AB83F073 /* iAdPlugin.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -323,6 +346,10 @@
);
PRODUCT_NAME = "TDA Connect";
TARGETED_DEVICE_FAMILY = 2;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/TDA Connect/Plugins/com.rjfun.cordova.extension\"",
);
};
name = Debug;
};
Expand Down Expand Up @@ -355,6 +382,10 @@
);
PRODUCT_NAME = "TDA Connect";
TARGETED_DEVICE_FAMILY = 2;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/TDA Connect/Plugins/com.rjfun.cordova.extension\"",
);
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// CDVPluginExt.h
// TestAdMobCombo
//
// Created by Xie Liming on 14-10-28.
//
//

#import "PluginAdapterDelegate.h"

@interface CDVPluginExt : CDVPlugin <PluginAdapterDelegate>

@property(nonatomic, retain) id<PluginAdapterDelegate> adapter;

- (UIView*) getView;
- (UIViewController*) getViewController;
- (void) fireEvent:(NSString *)obj event:(NSString *)eventName withData:(NSString *)jsonStr;
- (void) sendPluginResult:(CDVPluginResult *)result to:(NSString *)callbackId;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//
// CDVPluginExt.m
// TestAdMobCombo
//
// Created by Xie Liming on 14-10-28.
//
//

#import "CDVPluginExt.h"

@implementation CDVPluginExt

- (UIView*) getView
{
if(self.adapter) return [self.adapter getView];
else return self.webView;
}

- (UIViewController*) getViewController
{
if(self.adapter) return [self.adapter getViewController];
else return self.viewController;
}

- (void) fireEvent:(NSString *)obj event:(NSString *)eventName withData:(NSString *)jsonStr
{
NSLog(@"%@, %@, %@", obj, eventName, jsonStr?jsonStr:@"");

if(self.adapter) [self.adapter fireEvent:obj event:eventName withData:jsonStr];
else {
NSString* js;
if(obj && [obj isEqualToString:@"window"]) {
js = [NSString stringWithFormat:@"var evt=document.createEvent(\"UIEvents\");evt.initUIEvent(\"%@\",true,false,window,0);window.dispatchEvent(evt);", eventName];
} else if(jsonStr && [jsonStr length]>0) {
js = [NSString stringWithFormat:@"javascript:cordova.fireDocumentEvent('%@',%@);", eventName, jsonStr];
} else {
js = [NSString stringWithFormat:@"javascript:cordova.fireDocumentEvent('%@');", eventName];
}
[self.commandDelegate evalJs:js];
}
}

- (void) sendPluginResult:(CDVPluginResult *)result to:(NSString *)callbackId
{
if(self.adapter) [self.adapter sendPluginResult:result to:callbackId];
else {
[self.commandDelegate sendPluginResult:result callbackId:callbackId];
}
}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
//
// GenericAdPlugin.h
// TestAdMobCombo
//
// Created by Xie Liming on 14-10-28.
//
//

#import "CDVPluginExt.h"

#define OPT_LICENSE @"license"
#define OPT_IS_TESTING @"isTesting"
#define OPT_LOG_VERBOSE @"logVerbose"

#define OPT_ADID @"adId"
#define OPT_AUTO_SHOW @"autoShow"

#define OPT_AD_SIZE @"adSize"
#define OPT_AD_WIDTH @"width"
#define OPT_AD_HEIGHT @"height"
#define OPT_OVERLAP @"overlap"
#define OPT_ORIENTATION_RENEW @"orientationRenew"
#define OPT_OFFSET_TOPBAR @"offsetTopBar"

#define OPT_POSITION @"position"
#define OPT_X @"x"
#define OPT_Y @"y"

#define OPT_AD_EXTRAS @"adExtras"

enum {
POS_NO_CHANGE = 0,
POS_TOP_LEFT = 1,
POS_TOP_CENTER = 2,
POS_TOP_RIGHT = 3,
POS_LEFT = 4,
POS_CENTER = 5,
POS_RIGHT = 6,
POS_BOTTOM_LEFT = 7,
POS_BOTTOM_CENTER = 8,
POS_BOTTOM_RIGHT = 9,
POS_XY = 10
};

#define EVENT_AD_LOADED @"onAdLoaded"
#define EVENT_AD_FAILLOAD @"onAdFailLoad"
#define EVENT_AD_PRESENT @"onAdPresent"
#define EVENT_AD_LEAVEAPP @"onAdLeaveApp"
#define EVENT_AD_DISMISS @"onAdDismiss"
#define EVENT_AD_WILLPRESENT @"onAdWillPresent"
#define EVENT_AD_WILLDISMISS @"onAdWillDismiss"

#define ADTYPE_BANNER @"banner"
#define ADTYPE_INTERSTITIAL @"interstitial"
#define ADTYPE_NATIVE @"native"

@interface GenericAdPlugin : CDVPluginExt

- (void) setOptions:(CDVInvokedUrlCommand *)command;

- (void)createBanner:(CDVInvokedUrlCommand *)command;
- (void)showBanner:(CDVInvokedUrlCommand *)command;
- (void)showBannerAtXY:(CDVInvokedUrlCommand *)command;
- (void)hideBanner:(CDVInvokedUrlCommand *)command;
- (void)removeBanner:(CDVInvokedUrlCommand *)command;

- (void)prepareInterstitial:(CDVInvokedUrlCommand *)command;
- (void)showInterstitial:(CDVInvokedUrlCommand *)command;
- (void)removeInterstitial:(CDVInvokedUrlCommand *)command;

@property (assign) BOOL testTraffic;
@property (assign) BOOL licenseValidated;
@property (assign) BOOL isTesting;
@property (assign) BOOL logVerbose;

@property (nonatomic, retain) NSString* bannerId;
@property (nonatomic, retain) NSString* interstitialId;

@property (assign) int adWidth;
@property (assign) int adHeight;
@property (assign) BOOL overlap;
@property (assign) BOOL orientationRenew;
@property (assign) BOOL offsetTopBar;

@property (assign) int adPosition;
@property (assign) int posX;
@property (assign) int posY;

@property (assign) BOOL autoShowBanner;
@property (assign) BOOL autoShowInterstitial;

@property (assign) int widthOfView;

@property (nonatomic, retain) UIView *banner;
@property (nonatomic, retain) NSObject *interstitial;

@property (assign) BOOL bannerInited;
@property (assign) BOOL bannerVisible;

#pragma mark virtual methods

- (void)pluginInitialize;

- (void) parseOptions:(NSDictionary*) options;
- (NSString*) md5:(NSString*) s;

- (void) onOrientationChange;

- (CGRect)statusBarFrameViewRect:(UIView*)view;
- (bool) __isLandscape;
- (void) __showBanner:(int) position atX:(int)x atY:(int)y;

- (NSString*) __getProductShortName;
- (NSString*) __getTestBannerId;
- (NSString*) __getTestInterstitialId;

- (UIView*) __createAdView:(NSString*)adId;
- (int) __getAdViewWidth:(UIView*)view;
- (int) __getAdViewHeight:(UIView*)view;
- (void) __loadAdView:(UIView*)view;
- (void) __pauseAdView:(UIView*)view;
- (void) __resumeAdView:(UIView*)view;
- (void) __destroyAdView:(UIView*)view;

- (NSObject*) __createInterstitial:(NSString*)adId;
- (void) __loadInterstitial:(NSObject*)interstitial;
- (void) __showInterstitial:(NSObject*)interstitial;
- (void) __destroyInterstitial:(NSObject*)interstitial;

- (void) fireAdEvent:(NSString*)event withType:(NSString*)adType;
- (void) fireAdErrorEvent:(NSString*)event withCode:(int)errCode withMsg:(NSString*)errMsg withType:(NSString*)adType;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// PluginAdapterDelegate.h
// TestAdMobCombo
//
// Created by Xie Liming on 14-10-20.
//
//

#import <Foundation/Foundation.h>
#import <Cordova/CDV.h>

@protocol PluginAdapterDelegate <NSObject>

- (UIView*) getView;

- (UIViewController*) getViewController;

- (void) fireEvent:(NSString*)obj event:(NSString*)eventName withData:(NSString*)jsonStr;

- (void) sendPluginResult:(CDVPluginResult*)result to:(NSString*)callbackId;

@end
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// iAdPlugin.h
// TestAdPlugins
//
// Created by Xie Liming on 14-11-12.
//
//

#import "GenericAdPlugin.h"

@interface iAdPlugin : GenericAdPlugin

- (void)pluginInitialize;

- (void) parseOptions:(NSDictionary *)options;

- (NSString*) __getProductShortName;
- (NSString*) __getTestBannerId;
- (NSString*) __getTestInterstitialId;

- (UIView*) __createAdView:(NSString*)adId;
- (int) __getAdViewWidth:(UIView*)view;
- (int) __getAdViewHeight:(UIView*)view;
- (void) __loadAdView:(UIView*)view;
- (void) __pauseAdView:(UIView*)view;
- (void) __resumeAdView:(UIView*)view;
- (void) __destroyAdView:(UIView*)view;

- (NSObject*) __createInterstitial:(NSString*)adId;
- (void) __loadInterstitial:(NSObject*)interstitial;
- (void) __showInterstitial:(NSObject*)interstitial;
- (void) __destroyInterstitial:(NSObject*)interstitial;

@end
Loading

0 comments on commit d03bdf1

Please sign in to comment.