-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into release/1.0
- Loading branch information
Showing
39 changed files
with
1,863 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
platforms/ios/TDA Connect/Plugins/com.rjfun.cordova.extension/CDVPluginExt.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
51 changes: 51 additions & 0 deletions
51
platforms/ios/TDA Connect/Plugins/com.rjfun.cordova.extension/CDVPluginExt.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
133 changes: 133 additions & 0 deletions
133
platforms/ios/TDA Connect/Plugins/com.rjfun.cordova.extension/GenericAdPlugin.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
22 changes: 22 additions & 0 deletions
22
platforms/ios/TDA Connect/Plugins/com.rjfun.cordova.extension/PluginAdapterDelegate.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 added
BIN
+718 KB
platforms/ios/TDA Connect/Plugins/com.rjfun.cordova.extension/libCordovaGenericAd.a
Binary file not shown.
34 changes: 34 additions & 0 deletions
34
platforms/ios/TDA Connect/Plugins/com.rjfun.cordova.iad/iAdPlugin.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.