From 7e199bad2a54cb98392ed445f17d4dd32c6d0ddf Mon Sep 17 00:00:00 2001 From: Matthew Lilley Date: Sun, 13 Nov 2016 16:41:13 +0000 Subject: [PATCH 01/11] Removed reference to iOS key that prevents app from compiling --- src/ios/CordovaVungle.m | 2 -- 1 file changed, 2 deletions(-) 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]; From ac3ffc1445fda430998f0fe47ea5608180db9c22 Mon Sep 17 00:00:00 2001 From: Matthew Lilley Date: Sun, 13 Nov 2016 16:42:46 +0000 Subject: [PATCH 02/11] Simplified js --- www/vungle.js | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) 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; From eb1ec4473b577ebf7a278ce4b8f08647e971fe76 Mon Sep 17 00:00:00 2001 From: Matthew Lilley Date: Sun, 13 Nov 2016 16:44:19 +0000 Subject: [PATCH 03/11] Changed cordova target reference from CC to Vungle --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index cc014ac..7f7e8bb 100644 --- a/plugin.xml +++ b/plugin.xml @@ -14,7 +14,7 @@ vungle,phonegap,cordova - + From 8dbff8837040a2c6df00845119bdd0abd15ee783 Mon Sep 17 00:00:00 2001 From: Matthew Lilley Date: Sun, 13 Nov 2016 16:45:46 +0000 Subject: [PATCH 04/11] Updated Android manifest to be consistent with Vungle SDK 4.0.3 --- plugin.xml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugin.xml b/plugin.xml index 7f7e8bb..4311e59 100644 --- a/plugin.xml +++ b/plugin.xml @@ -25,12 +25,15 @@ - - + + + + + + + + From c9ee75522e2b282a7a3ebb96cf891c48a384b9dc Mon Sep 17 00:00:00 2001 From: Matthew Lilley Date: Sun, 13 Nov 2016 16:48:09 +0000 Subject: [PATCH 05/11] Moved success callback because it didn't seem to fire from isCompletedView --- src/android/CordovaVungle.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/android/CordovaVungle.java b/src/android/CordovaVungle.java index 35401de..2740eb2 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); @@ -89,6 +89,7 @@ public void onAdStart() { public void onAdEnd(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 From bc5c0f0965e898e1133aaa737a352ea57cd38616 Mon Sep 17 00:00:00 2001 From: Matthew Lilley Date: Sun, 13 Nov 2016 16:50:52 +0000 Subject: [PATCH 06/11] Updated event listener to make compatible with Vungle 4.0.3 (see https://support.vungle.com/hc/en-us/articles/226032888?flash_digest=59d86415cbfbed9f97bbd7cf6482c1533e2f481c#) --- src/android/CordovaVungle.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/CordovaVungle.java b/src/android/CordovaVungle.java index 2740eb2..739576a 100644 --- a/src/android/CordovaVungle.java +++ b/src/android/CordovaVungle.java @@ -86,7 +86,7 @@ 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); From 5587cd1783520e9dde04d0361b5b0f87151af548 Mon Sep 17 00:00:00 2001 From: Matthew Lilley Date: Sun, 13 Nov 2016 17:22:36 +0000 Subject: [PATCH 07/11] Removed unnecessary TypeScript files --- www/vungle.d.ts | 29 ----------------------------- www/vungle.ts | 32 -------------------------------- 2 files changed, 61 deletions(-) delete mode 100644 www/vungle.d.ts delete mode 100644 www/vungle.ts 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.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 From 663573bf871dac7d689100df2d632f27c4e79a12 Mon Sep 17 00:00:00 2001 From: Matthew Lilley Date: Sun, 13 Nov 2016 17:23:07 +0000 Subject: [PATCH 08/11] Updated Vungle SDK version that the plugin supports --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 683a0da..afa3fcf 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: From c8bedb220abbf0fa1fee06bc4645483102218e50 Mon Sep 17 00:00:00 2001 From: Matthew Lilley Date: Sun, 13 Nov 2016 17:23:39 +0000 Subject: [PATCH 09/11] Updated dead Vungle links --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index afa3fcf..d349890 100644 --- a/README.md +++ b/README.md @@ -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 From 690df77809356df84a3c853b9fef8e6b13ac97ab Mon Sep 17 00:00:00 2001 From: Matthew Lilley Date: Sun, 13 Nov 2016 17:24:36 +0000 Subject: [PATCH 10/11] Added some extra info for users that dont want to override init config --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d349890..22784fb 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,7 @@ See vungle documentation [for android](https://support.vungle.com/hc/en-us/artic >####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) From 806f0a087f26f762938ee27903634303ecc7a6e2 Mon Sep 17 00:00:00 2001 From: Matthew Lilley Date: Sun, 13 Nov 2016 17:25:02 +0000 Subject: [PATCH 11/11] Changed plugin reference to Vungle --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 22784fb..6341c58 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ See vungle documentation [for android](https://support.vungle.com/hc/en-us/artic >####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!) @@ -130,7 +130,7 @@ See vungle documentation [for android](https://support.vungle.com/hc/en-us/artic >####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://support.vungle.com/hc/en-us/artic >####example - plugin.isVideoAvailable( + Vungle.isVideoAvailable( function(response) { // success if(response) console.log("We have an ad available.");