diff --git a/README.md b/README.md index 683a0da..6341c58 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ Cordova plugin to use Vungle ad network. We have tested with the following Vungle libraries -* Android 3.3.0 -* iOS 3.0.10 +* Android 4.0.2 +* iOS 4.0.4 ##Installing the plugin To add this plugin just type: @@ -18,7 +18,7 @@ To remove this plugin type: ###Android On Android, plugin does most of the prerequisites automatically, arranges permissions, etc. in AndroidManifest.xml. -Note: We do NOT install google-playservices as a dependency anymore, Vungle does not require it, it's optional, check [Vungle documentation](https://github.com/Vungle/vungle-resources/blob/master/English/Android/current-release/android-dev-guide.md) for more details. +Note: We do NOT install google-playservices as a dependency anymore, Vungle does not require it, it's optional, check [Vungle documentation](https://support.vungle.com/hc/en-us/articles/204222794-Get-started-with-Vungle-Android-SDK) for more details. #### Libs You should only download and add Vungle libraries. @@ -62,7 +62,7 @@ public class EachActivity extends android.app.Activity { ``` ###iOS -On iOS, you should manually follow the instructions to add the frameworks to your project at this [link](https://github.com/Vungle/vungle-resources/blob/master/English/iOS/iOS-dev-guide.md). First 3 steps explain how to add the vungle framework and its dependencies. +On iOS, you should manually follow the instructions to add the frameworks to your project at this [link](https://support.vungle.com/hc/en-us/articles/204430550-Getting-Started-with-Vungle-iOS-SDK). ##Usage @@ -81,7 +81,7 @@ Initializes the plugin. Must be called before calling any other function. >> *vungleId*: string: Your Vungle app id. >> *config*: object: Optional vungle config params as json object, see below for details. You do NOT need to supply all the params, defaults are used if a property is not supplied. -See vungle documentation [for android](https://github.com/Vungle/vungle-resources/blob/master/English/Android/3.2.x/android-advanced-settings.md#configuration-options) and [for ios](https://github.com/Vungle/vungle-resources/blob/master/English/iOS/iOS-advanced-settings.md#playad-options). +See vungle documentation [for android](https://support.vungle.com/hc/en-us/articles/204463100-Advanced-Settings-for-Vungle-Android-SDK) and [for ios](https://support.vungle.com/hc/en-us/articles/204463080-Advanced-Settings-for-Vungle-iOS-SDK). >> *successCallback*: function @@ -89,7 +89,7 @@ See vungle documentation [for android](https://github.com/Vungle/vungle-resource >####example - plugin.init('YOUR_VUNGLE_ID', { + Vungle.init('YOUR_VUNGLE_ID', { /* These are all the properties we support, they are here for demonstration purposes only. orientation: 0, // Android: 0 means Orientation.autoRotate, 1 means Orientation.matchVideo // iOS: We recommend just sending 0, Vungle api is not unified for this param, same parameter mean and behave different for each platform!) @@ -122,7 +122,7 @@ See vungle documentation [for android](https://github.com/Vungle/vungle-resource >####parameters ->> *config*: object: Optional vungle config params as json object, see init for details +>> *config*: object: Optional vungle config params as json object to overide init config. Use null if you are happy with the config defined in your init. >> *successCallback*: function: Called with a boolean for completion of video (to be used in incentivized ads) @@ -130,7 +130,7 @@ See vungle documentation [for android](https://github.com/Vungle/vungle-resource >####example - plugin.playAd(config + Vungle.playAd(config function(completed) { // success console.log("Ad played"); }), failureCallback); @@ -147,7 +147,7 @@ See vungle documentation [for android](https://github.com/Vungle/vungle-resource >####example - plugin.isVideoAvailable( + Vungle.isVideoAvailable( function(response) { // success if(response) console.log("We have an ad available."); diff --git a/plugin.xml b/plugin.xml index cc014ac..4311e59 100644 --- a/plugin.xml +++ b/plugin.xml @@ -14,7 +14,7 @@ vungle,phonegap,cordova - + @@ -25,12 +25,15 @@ - - + + + + + + + + diff --git a/src/android/CordovaVungle.java b/src/android/CordovaVungle.java index 35401de..739576a 100644 --- a/src/android/CordovaVungle.java +++ b/src/android/CordovaVungle.java @@ -72,7 +72,7 @@ public void onVideoView(boolean isCompletedView, int watchedMillis, int videoDur // video). if (isCompletedView) { Log.i(TAG, "completed view"); - callbackContext.success(1); + //callbackContext.success(1); } else { Log.i(TAG, "not completed view"); callbackContext.success(0); @@ -86,9 +86,10 @@ public void onAdStart() { } @Override - public void onAdEnd(boolean wasCallToActionClicked) { + public void onAdEnd(boolean wasSuccessfulView, boolean wasCallToActionClicked) { // Called when the user leaves the ad and control is returned to your application Log.i(TAG, "ad ended"); + callbackContext.success(1); } @Override diff --git a/src/ios/CordovaVungle.m b/src/ios/CordovaVungle.m index 603c050..2ae52fb 100644 --- a/src/ios/CordovaVungle.m +++ b/src/ios/CordovaVungle.m @@ -65,8 +65,6 @@ - (NSMutableDictionary*) processConfig: (NSDictionary*) config { [result setObject:[config objectForKey:key] forKey:VunglePlayAdOptionKeyExtra7]; } else if([keyVal isEqualToString:@"extra8"]) { [result setObject:[config objectForKey:key] forKey:VunglePlayAdOptionKeyExtra8]; - } else if([keyVal isEqualToString:@"incentivizedCancelDialogBodyText"]) { - [VungleSDK sharedSDK].incentivizedAlertText = [config objectForKey:key]; } else if([keyVal isEqualToString:@"soundEnabled"]) { BOOL muted = [[config objectForKey:key] isEqual: @(0)]; [[VungleSDK sharedSDK] setMuted:muted]; diff --git a/www/vungle.d.ts b/www/vungle.d.ts deleted file mode 100644 index 49547a0..0000000 --- a/www/vungle.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -declare module CC { - export interface IVungleConfig { - orientation?: number; - soundEnabled?: boolean; - backButtonImmediatelyEnabled?: boolean; - immersiveMode?: boolean; - incentivized?: boolean; - incentivizedUserId?: string; - incentivizedCancelDialogTitle?: string; - incentivizedCancelDialogBodyText?: string; - incentivizedCancelDialogCloseButtonText?: string; - incentivizedCancelDialogKeepWatchingButtonText?: string; - placement?: string; - extra1?: string; - extra2?: string; - extra3?: string; - extra4?: string; - extra5?: string; - extra6?: string; - extra7?: string; - extra8?: string; - } - - export interface IVungle { - init(vungleid: string, config?: IVungleConfig, successcb?: () => void, errorcb?: (err: string) => void): void; - playAd(config?: IVungleConfig, successcb?: (completed: boolean) => void, errorcb?: (err: string) => void): void; - isVideoAvailable(successcb: (avail: boolean) => void, errorcb?: (err: string) => void): void; - } -} \ No newline at end of file diff --git a/www/vungle.js b/www/vungle.js index b1d781e..fce8194 100644 --- a/www/vungle.js +++ b/www/vungle.js @@ -1,10 +1,7 @@ -/// -var CC; -(function (CC) { - var Vungle = (function () { - function Vungle() { - } - Vungle.prototype.init = function (vungleid, config, successcb, errorcb) { + + Vungle = {}; + + Vungle.init = function (vungleid, config, successcb, errorcb) { window.cordova.exec(function () { if (successcb) successcb(); @@ -13,7 +10,7 @@ var CC; errorcb(err); }, "CordovaVungle", "init", [vungleid, config]); }; - Vungle.prototype.playAd = function (config, successcb, errorcb) { + Vungle.playAd = function (config, successcb, errorcb) { window.cordova.exec(function (completed) { if (successcb) successcb(completed); @@ -22,7 +19,7 @@ var CC; errorcb(err); }, "CordovaVungle", "playAd", [config]); }; - Vungle.prototype.isVideoAvailable = function (successcb, errorcb) { + Vungle.isVideoAvailable = function (successcb, errorcb) { window.cordova.exec(function (s) { successcb(s == 1 ? true : false); }, function (err) { @@ -30,8 +27,5 @@ var CC; errorcb(err); }, "CordovaVungle", "isVideoAvailable", []); }; - return Vungle; - })(); - CC.Vungle = Vungle; -})(CC || (CC = {})); -module.exports = CC; + +module.exports = Vungle; diff --git a/www/vungle.ts b/www/vungle.ts deleted file mode 100644 index 5e5067e..0000000 --- a/www/vungle.ts +++ /dev/null @@ -1,32 +0,0 @@ -/// - -module CC { - export class Vungle implements IVungle { - init(vungleid: string, config?: IVungleConfig, successcb?: () => void, errorcb?: (err: string) => void) { - (window).cordova.exec(() => { - if (successcb) successcb(); - }, (err) => { - if(errorcb) errorcb(err); - }, "CordovaVungle", "init", [vungleid, config]); - } - - playAd(config?: IVungleConfig, successcb?: (completed: boolean) => void, errorcb?: (err: string) => void) { - (window).cordova.exec((completed: boolean) => { - if(successcb) successcb(completed); - }, (err) => { - if(errorcb) errorcb(err); - }, "CordovaVungle", "playAd", [config]); - } - - isVideoAvailable(successcb: (avail: boolean) => void, errorcb?: (err: string) => void) { - (window).cordova.exec((s: number) => { - successcb(s == 1 ? true : false); - }, (err) => { - if(errorcb) errorcb(err); - }, "CordovaVungle", "isVideoAvailable", []); - } - } -} - -declare var module; -module.exports = CC; \ No newline at end of file