-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSupersonicAdsPlugin.js
61 lines (60 loc) · 2.63 KB
/
SupersonicAdsPlugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
var SupersonicAdsPlugin = {
initBrandConnect: function (userid, success, fail) {
return cordova && cordova.exec(success, fail, "SupersonicAdsPlugin", "initBrandConnect", [userid]);
},
showBrandConnect: function (success, fail) {
return cordova && cordova.exec(success, fail, "SupersonicAdsPlugin", "showBrandConnect",[]);
},
showOfferWall: function (userid, success, fail) {
return cordova && cordova.exec(success, fail, "SupersonicAdsPlugin", "showOfferWall", [userid]);
},
// function()
onBrandConnectDidInitWithCampaignInfo: null,
// function()
onBrandConnectDidFailInitWithError: null,
// function()
onBrandConnectWindowWillOpen: null,
// function()
onBrandConnectWindowDidClose: null,
// function()
onBrandConnectDidFinishAd: null,
// function()
onBrandConnectNoMoreOffers: null,
// function()
onOfferWallClosed: null,
//////////////////////////////////////////////////
/////////// called from plugin ///////////////////
_handleEvents: function (resultObj) {
console.log('SupersonicAdsPlugin JS - ' + resultObj.eventName + ' triggered.');
switch (resultObj.eventName) {
case 'brandConnectDidInitWithCampaignInfo':
if (typeof this.onBrandConnectDidInitWithCampaignInfo === 'function')
this.onBrandConnectDidInitWithCampaignInfo(resultObj.data);
break;
case 'brandConnectDidFailInitWithError':
if (typeof this.onBrandConnectDidFailInitWithError === 'function')
this.onBrandConnectDidFailInitWithError(resultObj.data);
break;
case 'brandConnectWindowWillOpen':
if (typeof this.onBrandConnectWindowWillOpen === 'function')
this.onBrandConnectWindowWillOpen();
break;
case 'brandConnectWindowDidClose':
if (typeof this.onBrandConnectWindowDidClose === 'function')
this.onBrandConnectWindowDidClose();
break;
case 'brandConnectDidFinishAd':
if (typeof this.onBrandConnectDidFinishAd === 'function')
this.onBrandConnectDidFinishAd(resultObj.data);
break;
case 'brandConnectNoMoreOffers':
if (typeof this.onBrandConnectNoMoreOffers === 'function')
this.onBrandConnectNoMoreOffers();
break;
case 'offerWallDidClose':
if (typeof this.onOfferWallClosed === 'function')
this.onOfferWallClosed();
break;
}
}
};