emi-indo-cordova-plugin-admob 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -2
- package/plugin.xml +1 -1
- package/src/ios/emiAdmobPlugin.h +6 -5
- package/src/ios/emiAdmobPlugin.m +299 -186
- package/www/emiAdmobPlugin.js +14 -22
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "emi-indo-cordova-plugin-admob",
|
3
|
-
"version": "1.4.
|
3
|
+
"version": "1.4.2",
|
4
4
|
"description": "Cordova Plugin Admob Android IOS",
|
5
5
|
"cordova": {
|
6
6
|
"id": "emi-indo-cordova-plugin-admob",
|
@@ -20,7 +20,6 @@
|
|
20
20
|
"cordova-admob-pro",
|
21
21
|
"cordova-admob-ios",
|
22
22
|
"cordova-admob-android"
|
23
|
-
|
24
23
|
],
|
25
24
|
"author": "EMI INDO",
|
26
25
|
"email": "cordova.c3addon@gmail.com",
|
package/plugin.xml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
2
2
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
3
|
-
id="emi-indo-cordova-plugin-admob" version="1.4.
|
3
|
+
id="emi-indo-cordova-plugin-admob" version="1.4.2">
|
4
4
|
|
5
5
|
<name>emiAdmobPlugin</name>
|
6
6
|
<description>Cordova Plugin Admob Android IOS</description>
|
package/src/ios/emiAdmobPlugin.h
CHANGED
@@ -2,13 +2,16 @@
|
|
2
2
|
#import <Cordova/CDVPlugin.h>
|
3
3
|
#import <GoogleMobileAds/GoogleMobileAds.h>
|
4
4
|
#import <UserMessagingPlatform/UserMessagingPlatform.h>
|
5
|
-
@interface emiAdmobPlugin : CDVPlugin<GADBannerViewDelegate, GADFullScreenContentDelegate>
|
5
|
+
@interface emiAdmobPlugin : CDVPlugin<GADBannerViewDelegate, GADFullScreenContentDelegate>
|
6
|
+
{}
|
6
7
|
@property(nonatomic, strong) GADAppOpenAd *appOpenAd;
|
7
8
|
@property(nonatomic, strong) GADBannerView *bannerView;
|
8
9
|
@property(nonatomic, strong) GADInterstitialAd *interstitial;
|
9
10
|
@property(nonatomic, strong) GADRewardedInterstitialAd* rewardedInterstitialAd;
|
10
11
|
@property(nonatomic, strong) GADRewardedAd *rewardedAd;
|
11
12
|
@property(nonatomic, readonly) BOOL isPrivacyOptionsRequired;
|
13
|
+
@property(nonatomic, strong) CDVInvokedUrlCommand *command;
|
14
|
+
@property(nonatomic, strong) GADResponseInfo *responseInfo;
|
12
15
|
- (void)initialize:(CDVInvokedUrlCommand *)command;
|
13
16
|
- (void)requestIDFA:(CDVInvokedUrlCommand *)command;
|
14
17
|
- (void)showPrivacyOptionsForm:(CDVInvokedUrlCommand *)command;
|
@@ -17,9 +20,9 @@
|
|
17
20
|
- (void)getIabTfc:(CDVInvokedUrlCommand *)command;
|
18
21
|
- (void)loadAppOpenAd:(CDVInvokedUrlCommand *)command;
|
19
22
|
- (void)showAppOpenAd:(CDVInvokedUrlCommand *)command;
|
20
|
-
- (void)
|
23
|
+
- (void)loadBannerAd:(CDVInvokedUrlCommand *)command;
|
21
24
|
- (void)showBannerAd:(CDVInvokedUrlCommand *)command;
|
22
|
-
- (void)
|
25
|
+
- (void)hideBannerAd:(CDVInvokedUrlCommand *)command;
|
23
26
|
- (void)removeBannerAd:(CDVInvokedUrlCommand *)command;
|
24
27
|
- (void)loadInterstitialAd:(CDVInvokedUrlCommand *)command;
|
25
28
|
- (void)showInterstitialAd:(CDVInvokedUrlCommand *)command;
|
@@ -29,5 +32,3 @@
|
|
29
32
|
- (void)showRewardedAd:(CDVInvokedUrlCommand *)command;
|
30
33
|
- (void) fireEvent:(NSString *)obj event:(NSString *)eventName withData:(NSString *)jsonStr;
|
31
34
|
@end
|
32
|
-
|
33
|
-
|
package/src/ios/emiAdmobPlugin.m
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
#import "emiAdmobPlugin.h"
|
3
2
|
#import <Cordova/CDVPlugin.h>
|
4
3
|
#import <UserMessagingPlatform/UserMessagingPlatform.h>
|
@@ -11,16 +10,47 @@
|
|
11
10
|
@synthesize interstitial;
|
12
11
|
@synthesize rewardedInterstitialAd;
|
13
12
|
@synthesize rewardedAd;
|
13
|
+
@synthesize command;
|
14
|
+
@synthesize responseInfo;
|
14
15
|
@synthesize isPrivacyOptionsRequired;
|
15
16
|
int idfaStatus = 0;
|
16
17
|
int fromStatus = 0;
|
17
18
|
int adFormat = 0;
|
18
19
|
int adWidth = 320;
|
20
|
+
BOOL auto_Show = NO;
|
21
|
+
NSString *Npa = @"1";
|
22
|
+
NSString *Position = @"bottom";
|
23
|
+
BOOL EnableCollapsible = NO;
|
24
|
+
BOOL ResponseInfo = NO;
|
19
25
|
BOOL isIAB = NO;
|
26
|
+
- (void) fireEvent:(NSString *)obj event:(NSString *)eventName withData:(NSString *)jsonStr {
|
27
|
+
NSString* js;
|
28
|
+
if(obj && [obj isEqualToString:@"window"]) {
|
29
|
+
js = [NSString stringWithFormat:@"var evt=document.createEvent(\"UIEvents\");evt.initUIEvent(\"%@\",true,false,window,0);window.dispatchEvent(evt);", eventName];
|
30
|
+
} else if(jsonStr && [jsonStr length]>0) {
|
31
|
+
js = [NSString stringWithFormat:@"javascript:cordova.fireDocumentEvent('%@',%@);", eventName, jsonStr];
|
32
|
+
} else {
|
33
|
+
js = [NSString stringWithFormat:@"javascript:cordova.fireDocumentEvent('%@');", eventName];
|
34
|
+
}
|
35
|
+
[self.commandDelegate evalJs:js];
|
36
|
+
}
|
20
37
|
- (void)pluginInitialize {
|
21
38
|
isIAB = YES;
|
22
39
|
[[NSUserDefaults standardUserDefaults] synchronize];
|
23
40
|
}
|
41
|
+
- (void)initialize:(CDVInvokedUrlCommand*)command {
|
42
|
+
GADMobileAds *ads = [GADMobileAds sharedInstance];
|
43
|
+
[ads startWithCompletionHandler:^(GADInitializationStatus *status) {
|
44
|
+
// Optional: Log each adapter's initialization latency.
|
45
|
+
NSDictionary *adapterStatuses = [status adapterStatusesByClassName];
|
46
|
+
for (NSString *adapter in adapterStatuses) {
|
47
|
+
GADAdapterStatus *adapterStatus = adapterStatuses[adapter];
|
48
|
+
NSLog(@"Adapter Name: %@, Description: %@, Latency: %f", adapter,
|
49
|
+
adapterStatus.description, adapterStatus.latency);
|
50
|
+
}
|
51
|
+
[self fireEvent:@"" event:@"on.sdkInitialization" withData:nil];
|
52
|
+
}];
|
53
|
+
}
|
24
54
|
- (void)requestIDFA:(CDVInvokedUrlCommand*)command {
|
25
55
|
CDVPluginResult *pluginResult;
|
26
56
|
NSString *callbackId = command.callbackId;
|
@@ -34,9 +64,9 @@ BOOL isIAB = NO;
|
|
34
64
|
idfaStatus = ATTrackingManagerAuthorizationStatusRestricted;
|
35
65
|
} else if (status == ATTrackingManagerAuthorizationStatusNotDetermined) {
|
36
66
|
idfaStatus = ATTrackingManagerAuthorizationStatusNotDetermined;
|
37
|
-
}
|
67
|
+
}
|
38
68
|
}];
|
39
|
-
[self fireEvent:@"" event:@"on.getIDFA" withData:nil];
|
69
|
+
[self fireEvent:@"" event:@"on.getIDFA.status" withData:nil];
|
40
70
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:idfaStatus];
|
41
71
|
} else {
|
42
72
|
[self fireEvent:@"" event:@"on.getIDFA.error" withData:nil];
|
@@ -48,12 +78,12 @@ BOOL isIAB = NO;
|
|
48
78
|
CDVPluginResult *pluginResult;
|
49
79
|
NSString *callbackId = command.callbackId;
|
50
80
|
UMPRequestParameters *parameters = [[UMPRequestParameters alloc] init];
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
81
|
+
// UMPDebugSettings *debugSettings = [[UMPDebugSettings alloc] init];
|
82
|
+
// debugSettings.testDeviceIdentifiers = @[@"59156CDC-B042-4D81-A9FA-900869782912"];
|
83
|
+
// parameters.debugSettings = debugSettings;
|
84
|
+
// debugSettings.geography = UMPDebugGeographyEEA;
|
85
|
+
BOOL tagForUnderAgeOfConsent = [[command argumentAtIndex:0] boolValue];
|
86
|
+
parameters.tagForUnderAgeOfConsent = tagForUnderAgeOfConsent;
|
57
87
|
[UMPConsentInformation.sharedInstance
|
58
88
|
requestConsentInfoUpdateWithParameters:parameters
|
59
89
|
completionHandler:^(NSError *_Nullable requestConsentError) {
|
@@ -63,56 +93,54 @@ BOOL isIAB = NO;
|
|
63
93
|
return;
|
64
94
|
}
|
65
95
|
[UMPConsentForm loadAndPresentIfRequiredFromViewController:self.viewController
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
96
|
+
completionHandler:^(NSError *loadAndPresentError) {
|
97
|
+
if (loadAndPresentError) {
|
98
|
+
// Consent gathering failed.
|
99
|
+
NSLog(@"Error: %@", loadAndPresentError.localizedDescription);
|
100
|
+
return;
|
101
|
+
}
|
72
102
|
UMPFormStatus formStatus = UMPConsentInformation.sharedInstance.formStatus;
|
73
103
|
if (formStatus == UMPFormStatusUnknown) {
|
74
104
|
fromStatus = 0;
|
75
|
-
} else if (formStatus == UMPFormStatusAvailable) {
|
105
|
+
} else if (formStatus == UMPFormStatusAvailable) {
|
76
106
|
fromStatus = 1;
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
}
|
107
|
+
} else if (formStatus == UMPFormStatusUnavailable) {
|
108
|
+
fromStatus = 2;
|
109
|
+
}
|
81
110
|
[self fireEvent:@"" event:@"on.get.from.status" withData:nil];
|
82
|
-
|
83
|
-
|
111
|
+
}];
|
84
112
|
}];
|
85
|
-
|
113
|
+
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:fromStatus];
|
86
114
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
|
87
115
|
}
|
88
116
|
- (void)showPrivacyOptionsForm:(CDVInvokedUrlCommand*)command {
|
89
117
|
UMPRequestParameters *parameters = [[UMPRequestParameters alloc] init];
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
118
|
+
// UMPDebugSettings *debugSettings = [[UMPDebugSettings alloc] init];
|
119
|
+
// debugSettings.testDeviceIdentifiers = @[@"59156CDC-B042-4D81-A9FA-900869782912"];
|
120
|
+
// parameters.debugSettings = debugSettings;
|
121
|
+
// debugSettings.geography = UMPDebugGeographyEEA;
|
94
122
|
BOOL tagForUnderAgeOfConsent = [[command argumentAtIndex:0] boolValue];
|
95
123
|
parameters.tagForUnderAgeOfConsent = tagForUnderAgeOfConsent;
|
96
124
|
[UMPConsentInformation.sharedInstance
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
125
|
+
requestConsentInfoUpdateWithParameters:parameters
|
126
|
+
completionHandler:^(NSError *_Nullable requestConsentError) {
|
127
|
+
// ...
|
128
|
+
[UMPConsentForm loadAndPresentIfRequiredFromViewController:self.viewController
|
129
|
+
completionHandler:^(NSError *loadAndPresentError) {
|
130
|
+
}];
|
131
|
+
[self isPrivacyOptionsRequired];
|
132
|
+
}];
|
105
133
|
[UMPConsentForm presentPrivacyOptionsFormFromViewController:self.viewController completionHandler:^(NSError * _Nullable formError) {
|
106
134
|
if (formError) {
|
107
|
-
|
108
|
-
|
135
|
+
// Handle the error.
|
136
|
+
NSLog(@"Error: %@", formError.localizedDescription);
|
109
137
|
[self fireEvent:@"" event:@"on.getPrivacyOptionsFrom.error" withData:nil];
|
110
138
|
}
|
111
|
-
|
139
|
+
}];
|
112
140
|
}
|
113
141
|
- (BOOL)isPrivacyOptionsRequired {
|
114
|
-
|
115
|
-
|
142
|
+
return UMPConsentInformation.sharedInstance.privacyOptionsRequirementStatus ==
|
143
|
+
UMPPrivacyOptionsRequirementStatusRequired;
|
116
144
|
}
|
117
145
|
- (void)getIabTfc:(CDVInvokedUrlCommand*)command {
|
118
146
|
CDVPluginResult *pluginResult;
|
@@ -124,28 +152,27 @@ BOOL isIAB = NO;
|
|
124
152
|
NSString *purposeConsents = [NSUserDefaults.standardUserDefaults
|
125
153
|
stringForKey:@"IABTCF_PurposeConsents"] ?: @"";
|
126
154
|
NSString *tCString = [NSUserDefaults.standardUserDefaults
|
127
|
-
|
155
|
+
stringForKey:@"IABTCF_TCString"] ?: @"";
|
128
156
|
NSInteger gdprApplies = [NSUserDefaults.standardUserDefaults
|
129
157
|
integerForKey:@"IABTCF_gdprApplies"] ?: 0;
|
130
158
|
[result setObject:[NSNumber numberWithInteger:CmpSdkVersion] forKey:@"IABTCF_CmpSdkVersion"];
|
131
159
|
[result setObject:[NSNumber numberWithInteger:gdprApplies] forKey:@"IABTCF_gdprApplies"];
|
132
160
|
[result setObject:[NSString stringWithString:purposeConsents] forKey:@"IABTCF_PurposeConsents"];
|
133
161
|
[result setObject:[NSString stringWithString:tCString] forKey:@"IABTCF_TCString"];
|
134
|
-
|
135
162
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:result];
|
136
163
|
[self fireEvent:@"" event:@"on.getIabTfc" withData:nil];
|
137
164
|
} else {
|
138
165
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
|
139
|
-
}
|
166
|
+
}
|
140
167
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
|
141
168
|
}
|
142
169
|
- (void)consentReset:(CDVInvokedUrlCommand*)command {
|
143
170
|
CDVPluginResult *pluginResult;
|
144
171
|
NSString *callbackId = command.callbackId;
|
145
172
|
@try {
|
146
|
-
|
173
|
+
[UMPConsentInformation.sharedInstance reset];
|
147
174
|
}@catch (NSException *exception) {
|
148
|
-
|
175
|
+
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:exception.reason];
|
149
176
|
}
|
150
177
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
|
151
178
|
}
|
@@ -154,9 +181,15 @@ BOOL isIAB = NO;
|
|
154
181
|
NSString *callbackId = command.callbackId;
|
155
182
|
BOOL setAppMuted = [[command argumentAtIndex:0] boolValue];
|
156
183
|
float setAppVolume = [[command argumentAtIndex:1] floatValue];
|
184
|
+
NSString* npa = [command.arguments objectAtIndex:2];
|
185
|
+
BOOL enableCollapsible = [[command argumentAtIndex:3] boolValue];
|
186
|
+
BOOL responseInfo = [[command argumentAtIndex:4] boolValue];
|
157
187
|
@try {
|
158
|
-
|
159
|
-
|
188
|
+
GADMobileAds.sharedInstance.applicationVolume = setAppVolume;
|
189
|
+
GADMobileAds.sharedInstance.applicationMuted = setAppMuted;
|
190
|
+
Npa = npa;
|
191
|
+
EnableCollapsible = enableCollapsible;
|
192
|
+
ResponseInfo = responseInfo;
|
160
193
|
}@catch (NSException *exception) {
|
161
194
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:exception.reason];
|
162
195
|
}
|
@@ -169,33 +202,20 @@ BOOL isIAB = NO;
|
|
169
202
|
NSNumber *tagForUnderAgeOfConsent = [command argumentAtIndex:1];
|
170
203
|
NSString *maxAdContentRating = [command argumentAtIndex:2];
|
171
204
|
@try {
|
172
|
-
|
205
|
+
GADRequestConfiguration *requestConfiguration = GADMobileAds.sharedInstance.requestConfiguration;
|
173
206
|
requestConfiguration.tagForChildDirectedTreatment = TagForChildDirectedTreatment;
|
174
207
|
requestConfiguration.tagForUnderAgeOfConsent = tagForUnderAgeOfConsent;
|
175
208
|
requestConfiguration.maxAdContentRating = maxAdContentRating;
|
176
|
-
|
177
|
-
|
178
|
-
|
209
|
+
}@catch (NSException *exception) {
|
210
|
+
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:exception.reason];
|
211
|
+
}
|
179
212
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
|
180
213
|
}
|
181
|
-
- (void)initialize:(CDVInvokedUrlCommand*)command {
|
182
|
-
GADMobileAds *ads = [GADMobileAds sharedInstance];
|
183
|
-
[ads startWithCompletionHandler:^(GADInitializationStatus *status) {
|
184
|
-
// Optional: Log each adapter's initialization latency.
|
185
|
-
NSDictionary *adapterStatuses = [status adapterStatusesByClassName];
|
186
|
-
for (NSString *adapter in adapterStatuses) {
|
187
|
-
GADAdapterStatus *adapterStatus = adapterStatuses[adapter];
|
188
|
-
NSLog(@"Adapter Name: %@, Description: %@, Latency: %f", adapter,
|
189
|
-
adapterStatus.description, adapterStatus.latency);
|
190
|
-
}
|
191
|
-
[self fireEvent:@"" event:@"on.sdkInitialization" withData:nil];
|
192
|
-
}];
|
193
|
-
}
|
194
214
|
- (GADAdSize)__AdSizeFromString:(NSString *)size
|
195
215
|
{
|
196
|
-
if ([size isEqualToString:@"
|
216
|
+
if ([size isEqualToString:@"ANCHORED"]) {
|
197
217
|
return GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(adWidth);
|
198
|
-
} else if ([size isEqualToString:@"
|
218
|
+
} else if ([size isEqualToString:@"IN_LINE"]) {
|
199
219
|
return GADCurrentOrientationInlineAdaptiveBannerAdSizeWithWidth(adWidth);
|
200
220
|
} else if ([size isEqualToString:@"BANNER"]) {
|
201
221
|
return GADAdSizeBanner;
|
@@ -209,7 +229,7 @@ BOOL isIAB = NO;
|
|
209
229
|
return GADAdSizeBanner;
|
210
230
|
}
|
211
231
|
}
|
212
|
-
- (void)
|
232
|
+
- (void)loadBannerAd:(CDVInvokedUrlCommand*)command {
|
213
233
|
if(self.bannerView) {
|
214
234
|
NSLog(@"Admob banner has been initing");
|
215
235
|
return;
|
@@ -218,33 +238,39 @@ BOOL isIAB = NO;
|
|
218
238
|
NSString *callbackId = command.callbackId;
|
219
239
|
adFormat = 3;
|
220
240
|
if (adFormat == 3) {
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
241
|
+
UIView *parentView = [self.webView superview];
|
242
|
+
NSString* adUnitId = [command.arguments objectAtIndex:0];
|
243
|
+
// NSNumber* x = [command.arguments objectAtIndex:1];
|
244
|
+
// NSNumber* y = [command.arguments objectAtIndex:2];
|
245
|
+
NSString* position = [command.arguments objectAtIndex:1];
|
246
|
+
NSString* size = [command.arguments objectAtIndex:2];
|
247
|
+
NSString* collapsible = [command.arguments objectAtIndex:3];
|
248
|
+
NSNumber* adaptive_Width = [command.arguments objectAtIndex:4];
|
249
|
+
BOOL autoShow = [[command argumentAtIndex:5] boolValue];
|
250
|
+
auto_Show = autoShow;
|
251
|
+
int intValue = [adaptive_Width intValue];
|
252
|
+
adWidth = intValue;
|
253
|
+
Position = position;
|
254
|
+
// float posX = [x floatValue];
|
255
|
+
// float posY = [y floatValue];
|
256
|
+
GADAdSize sizes = [self __AdSizeFromString:size];
|
257
|
+
// CGPoint origin = CGPointMake(posX,posY);
|
258
|
+
self.bannerView = [[GADBannerView alloc]
|
259
|
+
initWithAdSize:sizes];
|
260
|
+
GADRequest *request = [GADRequest request];
|
261
|
+
GADExtras *extras = [[GADExtras alloc] init];
|
262
|
+
if (EnableCollapsible){
|
263
|
+
extras.additionalParameters = @{@"collapsible" : collapsible};
|
264
|
+
}
|
265
|
+
extras.additionalParameters = @{@"npa": Npa};
|
266
|
+
[request registerAdNetworkExtras:extras];
|
267
|
+
self.bannerView.adUnitID = adUnitId;
|
268
|
+
self.bannerView.rootViewController = self.viewController;
|
269
|
+
self.bannerView.delegate = self;
|
270
|
+
[self.bannerView loadRequest:request];
|
271
|
+
self.bannerView.hidden = YES;
|
272
|
+
[parentView addSubview:self.bannerView];
|
273
|
+
[parentView bringSubviewToFront:self.bannerView];
|
248
274
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
249
275
|
} else {
|
250
276
|
NSLog(@"Admob Option invalid for banner");
|
@@ -257,24 +283,66 @@ BOOL isIAB = NO;
|
|
257
283
|
NSString *callbackId = command.callbackId;
|
258
284
|
if(self.bannerView) {
|
259
285
|
self.bannerView.hidden = NO;
|
286
|
+
[self addBannerViewToView:command];
|
260
287
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
261
288
|
} else {
|
289
|
+
[self fireEvent:@"" event:@"on.banner.failed.show" withData:nil];
|
262
290
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
|
263
291
|
}
|
264
292
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
|
265
293
|
}
|
266
|
-
- (void)
|
294
|
+
- (void)addBannerViewToView:(CDVInvokedUrlCommand*)command{
|
295
|
+
bannerView.translatesAutoresizingMaskIntoConstraints = NO;
|
296
|
+
[self.viewController.view addSubview:bannerView];
|
297
|
+
if ([Position isEqualToString:@"bottom"]){
|
298
|
+
[self.viewController.view addConstraints:@[
|
299
|
+
[NSLayoutConstraint constraintWithItem:bannerView
|
300
|
+
attribute:NSLayoutAttributeBottom
|
301
|
+
relatedBy:NSLayoutRelationEqual
|
302
|
+
toItem:self.viewController.view.safeAreaLayoutGuide
|
303
|
+
attribute:NSLayoutAttributeBottom
|
304
|
+
multiplier:1
|
305
|
+
constant:0
|
306
|
+
],
|
307
|
+
[NSLayoutConstraint constraintWithItem:bannerView
|
308
|
+
attribute:NSLayoutAttributeCenterX
|
309
|
+
relatedBy:NSLayoutRelationEqual
|
310
|
+
toItem:self.viewController.view
|
311
|
+
attribute:NSLayoutAttributeCenterX
|
312
|
+
multiplier:1
|
313
|
+
constant:0]
|
314
|
+
]];
|
315
|
+
} else {
|
316
|
+
[self.viewController.view addConstraints:@[
|
317
|
+
[NSLayoutConstraint constraintWithItem:bannerView
|
318
|
+
attribute:NSLayoutAttributeTop
|
319
|
+
relatedBy:NSLayoutRelationEqual
|
320
|
+
toItem:self.viewController.view.safeAreaLayoutGuide
|
321
|
+
attribute:NSLayoutAttributeTop
|
322
|
+
multiplier:1
|
323
|
+
constant:0],
|
324
|
+
[NSLayoutConstraint constraintWithItem:bannerView
|
325
|
+
attribute:NSLayoutAttributeCenterX
|
326
|
+
relatedBy:NSLayoutRelationEqual
|
327
|
+
toItem:self.viewController.view
|
328
|
+
attribute:NSLayoutAttributeCenterX
|
329
|
+
multiplier:1
|
330
|
+
constant:0]
|
331
|
+
]];
|
332
|
+
}
|
333
|
+
}
|
334
|
+
- (void)hideBannerAd:(CDVInvokedUrlCommand*)command {
|
267
335
|
CDVPluginResult *pluginResult;
|
268
336
|
NSString *callbackId = command.callbackId;
|
269
337
|
if(self.bannerView) {
|
270
338
|
self.bannerView.hidden = YES;
|
339
|
+
[self fireEvent:@"" event:@"on.banner.hide" withData:nil];
|
271
340
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
272
341
|
} else {
|
273
342
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
|
274
343
|
}
|
275
344
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
|
276
345
|
}
|
277
|
-
|
278
346
|
- (void)removeBannerAd:(CDVInvokedUrlCommand*)command {
|
279
347
|
CDVPluginResult *pluginResult;
|
280
348
|
NSString *callbackId = command.callbackId;
|
@@ -282,6 +350,7 @@ BOOL isIAB = NO;
|
|
282
350
|
self.bannerView.hidden = YES;
|
283
351
|
[self.bannerView removeFromSuperview];
|
284
352
|
self.bannerView = nil;
|
353
|
+
[self fireEvent:@"" event:@"on.banner.remove" withData:nil];
|
285
354
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
286
355
|
} else {
|
287
356
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
|
@@ -292,13 +361,19 @@ BOOL isIAB = NO;
|
|
292
361
|
CDVPluginResult *pluginResult;
|
293
362
|
NSString *callbackId = command.callbackId;
|
294
363
|
NSString* adUnitId = [command.arguments objectAtIndex:0];
|
295
|
-
|
364
|
+
BOOL autoShow = [[command argumentAtIndex:1] boolValue];
|
365
|
+
auto_Show = autoShow;
|
366
|
+
adFormat = 1;
|
296
367
|
self.appOpenAd = nil;
|
297
368
|
if (adFormat == 1){
|
369
|
+
GADRequest *request = [GADRequest request];
|
370
|
+
GADExtras *extras = [[GADExtras alloc] init];
|
371
|
+
extras.additionalParameters = @{@"npa": Npa};
|
372
|
+
[request registerAdNetworkExtras:extras];
|
298
373
|
[GADAppOpenAd loadWithAdUnitID:adUnitId
|
299
|
-
|
300
|
-
|
301
|
-
|
374
|
+
request:request
|
375
|
+
orientation:UIInterfaceOrientationPortrait
|
376
|
+
completionHandler:^(GADAppOpenAd *ad, NSError *error) {
|
302
377
|
if (error) {
|
303
378
|
[self fireEvent:@"" event:@"on.appOpenAd.failed.loaded" withData:nil];
|
304
379
|
NSLog(@"Failed to load App Open Ad ad with error: %@", [error localizedDescription]);
|
@@ -307,29 +382,38 @@ BOOL isIAB = NO;
|
|
307
382
|
self.appOpenAd = ad;
|
308
383
|
self.appOpenAd.fullScreenContentDelegate = self;
|
309
384
|
[self fireEvent:@"" event:@"on.appOpenAd.loaded" withData:nil];
|
385
|
+
if (auto_Show){
|
386
|
+
if (self.appOpenAd && [self.appOpenAd
|
387
|
+
canPresentFromRootViewController:self.viewController
|
388
|
+
error:nil]) { [self.appOpenAd presentFromRootViewController:self.viewController];
|
389
|
+
} else {
|
390
|
+
[self fireEvent:@"" event:@"on.appOpenAd.failed.show" withData:nil];
|
391
|
+
}}
|
310
392
|
}];
|
393
|
+
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
311
394
|
}
|
312
|
-
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
313
395
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
|
314
396
|
}
|
315
397
|
- (void)showAppOpenAd:(CDVInvokedUrlCommand *)command {
|
316
398
|
CDVPluginResult *pluginResult;
|
317
399
|
NSString *callbackId = command.callbackId;
|
318
400
|
if (self.appOpenAd && [self.appOpenAd
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
401
|
+
canPresentFromRootViewController:self.viewController
|
402
|
+
error:nil]) { [self.appOpenAd presentFromRootViewController:self.viewController];
|
403
|
+
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
404
|
+
} else {
|
405
|
+
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
|
406
|
+
[self fireEvent:@"" event:@"on.appOpenAd.failed.show" withData:nil];
|
407
|
+
}
|
326
408
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
|
327
409
|
}
|
328
410
|
- (void)loadInterstitialAd:(CDVInvokedUrlCommand *)command {
|
329
411
|
CDVPluginResult *pluginResult;
|
330
412
|
NSString *callbackId = command.callbackId;
|
331
|
-
|
332
|
-
|
413
|
+
NSString* adUnitId = [command.arguments objectAtIndex:0];
|
414
|
+
BOOL autoShow = [[command argumentAtIndex:1] boolValue];
|
415
|
+
auto_Show = autoShow;
|
416
|
+
adFormat = 2;
|
333
417
|
if (adFormat == 2){
|
334
418
|
GADRequest *request = [GADRequest request];
|
335
419
|
[GADInterstitialAd
|
@@ -338,72 +422,94 @@ BOOL isIAB = NO;
|
|
338
422
|
completionHandler:^(GADInterstitialAd *ad, NSError *error) {
|
339
423
|
if (error) {
|
340
424
|
NSLog(@"Failed to load interstitial ad with error: %@", [error localizedDescription]);
|
425
|
+
// [self fireEvent:@"" event:@"on.interstitial.failed.load" withData:nil];
|
341
426
|
return;
|
342
427
|
}
|
343
428
|
self.interstitial = ad;
|
344
429
|
self.interstitial.fullScreenContentDelegate = self;
|
345
430
|
[self fireEvent:@"" event:@"on.interstitial.loaded" withData:nil];
|
431
|
+
if (auto_Show){
|
432
|
+
if (self.interstitial && [self.interstitial
|
433
|
+
canPresentFromRootViewController:self.viewController error:nil]) {
|
434
|
+
[self.interstitial presentFromRootViewController:self.viewController];
|
435
|
+
} else {
|
436
|
+
[self fireEvent:@"" event:@"on.interstitial.failed.show" withData:nil];
|
437
|
+
}
|
438
|
+
}
|
346
439
|
}];
|
347
440
|
}
|
348
441
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
349
|
-
|
350
442
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
|
351
443
|
}
|
352
444
|
- (void)showInterstitialAd:(CDVInvokedUrlCommand *)command {
|
353
445
|
CDVPluginResult *pluginResult;
|
354
446
|
NSString *callbackId = command.callbackId;
|
355
447
|
if (self.interstitial && [self.interstitial
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
}
|
448
|
+
canPresentFromRootViewController:self.viewController error:nil]) {
|
449
|
+
[self.interstitial presentFromRootViewController:self.viewController];
|
450
|
+
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
451
|
+
} else {
|
452
|
+
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
|
453
|
+
[self fireEvent:@"" event:@"on.interstitial.failed.show" withData:nil];
|
454
|
+
}
|
364
455
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
|
365
456
|
}
|
366
457
|
- (void)loadRewardedInterstitialAd:(CDVInvokedUrlCommand*)command {
|
367
458
|
CDVPluginResult *pluginResult;
|
368
459
|
NSString *callbackId = command.callbackId;
|
369
460
|
NSString* adUnitId = [command.arguments objectAtIndex:0];
|
461
|
+
BOOL autoShow = [[command argumentAtIndex:1] boolValue];
|
462
|
+
auto_Show = autoShow;
|
370
463
|
adFormat = 4;
|
371
|
-
if (adFormat == 4){
|
464
|
+
if (adFormat == 4){
|
372
465
|
GADRequest *request = [GADRequest request];
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
466
|
+
[GADRewardedInterstitialAd
|
467
|
+
loadWithAdUnitID:adUnitId
|
468
|
+
request:request
|
469
|
+
completionHandler:^(GADRewardedInterstitialAd *ad, NSError *error) {
|
470
|
+
if (error) {
|
471
|
+
NSLog(@"Rewarded ad failed to load with error: %@", [error localizedDescription]);
|
472
|
+
return;
|
473
|
+
}
|
474
|
+
self.rewardedInterstitialAd = ad;
|
475
|
+
NSLog(@"Rewarded ad loaded.");
|
476
|
+
self.rewardedInterstitialAd.fullScreenContentDelegate = self;
|
477
|
+
[self fireEvent:@"" event:@"on.rewardedInt.loaded" withData:nil];
|
478
|
+
if (auto_Show){
|
479
|
+
if (self.rewardedInterstitialAd && [self.rewardedInterstitialAd canPresentFromRootViewController:self.viewController error:nil]) {
|
480
|
+
[self.rewardedInterstitialAd presentFromRootViewController:self.viewController
|
481
|
+
userDidEarnRewardHandler:^{
|
482
|
+
GADAdReward *reward =
|
483
|
+
self.rewardedInterstitialAd.adReward;
|
484
|
+
[self fireEvent:@"" event:@"on.rewardedInt.userEarnedReward" withData:nil];
|
485
|
+
NSString *rewardMessage = [NSString stringWithFormat:@"Reward received with "
|
486
|
+
@"currency %@ , amount %ld",
|
487
|
+
reward.type, [reward.amount longValue]];
|
488
|
+
NSLog(@"%@", rewardMessage);
|
489
|
+
}];
|
490
|
+
} else {
|
491
|
+
[self fireEvent:@"" event:@"on.rewardedInt.failed.show" withData:nil];
|
380
492
|
}
|
381
|
-
|
382
|
-
|
383
|
-
self.rewardedInterstitialAd.fullScreenContentDelegate = self;
|
384
|
-
[self fireEvent:@"" event:@"on.rewardedInt.loaded" withData:nil];
|
385
|
-
}];
|
493
|
+
}
|
494
|
+
}];
|
386
495
|
}
|
387
496
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
388
497
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
|
389
498
|
}
|
390
|
-
|
499
|
+
-(void)showRewardedInterstitialAd:(CDVInvokedUrlCommand *)command {
|
391
500
|
CDVPluginResult *pluginResult;
|
392
501
|
NSString *callbackId = command.callbackId;
|
393
502
|
if (self.rewardedInterstitialAd && [self.rewardedInterstitialAd canPresentFromRootViewController:self.viewController error:nil]) {
|
394
|
-
|
395
503
|
[self.rewardedInterstitialAd presentFromRootViewController:self.viewController
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
}];
|
504
|
+
userDidEarnRewardHandler:^{
|
505
|
+
GADAdReward *reward =
|
506
|
+
self.rewardedInterstitialAd.adReward;
|
507
|
+
[self fireEvent:@"" event:@"on.rewardedInt.userEarnedReward" withData:nil];
|
508
|
+
NSString *rewardMessage = [NSString stringWithFormat:@"Reward received with "
|
509
|
+
@"currency %@ , amount %ld",
|
510
|
+
reward.type, [reward.amount longValue]];
|
511
|
+
NSLog(@"%@", rewardMessage);
|
512
|
+
}];
|
407
513
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
408
514
|
} else {
|
409
515
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
|
@@ -412,45 +518,57 @@ if (adFormat == 4){
|
|
412
518
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
|
413
519
|
}
|
414
520
|
- (void)loadRewardedAd:(CDVInvokedUrlCommand*)command {
|
415
|
-
|
416
521
|
CDVPluginResult *pluginResult;
|
417
522
|
NSString *callbackId = command.callbackId;
|
418
523
|
NSString* adUnitId = [command.arguments objectAtIndex:0];
|
524
|
+
BOOL autoShow = [[command argumentAtIndex:1] boolValue];
|
525
|
+
auto_Show = autoShow;
|
419
526
|
adFormat = 3;
|
420
|
-
if (adFormat == 3){
|
527
|
+
if (adFormat == 3){
|
421
528
|
GADRequest *request = [GADRequest request];
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
529
|
+
[GADRewardedAd
|
530
|
+
loadWithAdUnitID:adUnitId
|
531
|
+
request:request
|
532
|
+
completionHandler:^(GADRewardedAd *ad, NSError *error) {
|
533
|
+
if (error) {
|
534
|
+
NSLog(@"Rewarded ad failed to load with error: %@", [error localizedDescription]);
|
535
|
+
return;
|
536
|
+
}
|
537
|
+
self.rewardedAd = ad;
|
538
|
+
NSLog(@"Rewarded ad loaded.");
|
539
|
+
self.rewardedAd.fullScreenContentDelegate = self;
|
540
|
+
[self fireEvent:@"" event:@"on.rewarded.loaded" withData:nil];
|
541
|
+
if (auto_Show){
|
542
|
+
if (self.rewardedAd && [self.rewardedAd canPresentFromRootViewController:self.viewController error:nil]) {
|
543
|
+
[self.rewardedAd presentFromRootViewController:self.viewController
|
544
|
+
userDidEarnRewardHandler:^{
|
545
|
+
GADAdReward *reward =
|
546
|
+
self.rewardedAd.adReward;
|
547
|
+
[self fireEvent:@"" event:@"on.reward.userEarnedReward" withData:nil];
|
548
|
+
NSString *rewardMessage = [NSString stringWithFormat:@"Reward received with currency %@ , amount %lf", reward.type, [reward.amount doubleValue]];
|
549
|
+
NSLog(@"%@", rewardMessage);
|
550
|
+
}];
|
551
|
+
} else {
|
552
|
+
[self fireEvent:@"" event:@"on.rewarded.failed.show" withData:nil];
|
429
553
|
}
|
430
|
-
|
431
|
-
|
432
|
-
self.rewardedAd.fullScreenContentDelegate = self;
|
433
|
-
[self fireEvent:@"" event:@"on.rewarded.loaded" withData:nil];
|
434
|
-
}];
|
554
|
+
}
|
555
|
+
}];
|
435
556
|
}
|
436
557
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
437
558
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
|
438
559
|
}
|
439
|
-
|
560
|
+
-(void)showRewardedAd:(CDVInvokedUrlCommand *)command {
|
440
561
|
CDVPluginResult *pluginResult;
|
441
562
|
NSString *callbackId = command.callbackId;
|
442
563
|
if (self.rewardedAd && [self.rewardedAd canPresentFromRootViewController:self.viewController error:nil]) {
|
443
|
-
|
444
564
|
[self.rewardedAd presentFromRootViewController:self.viewController
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
}];
|
565
|
+
userDidEarnRewardHandler:^{
|
566
|
+
GADAdReward *reward =
|
567
|
+
self.rewardedAd.adReward;
|
568
|
+
[self fireEvent:@"" event:@"on.reward.userEarnedReward" withData:nil];
|
569
|
+
NSString *rewardMessage = [NSString stringWithFormat:@"Reward received with currency %@ , amount %lf", reward.type, [reward.amount doubleValue]];
|
570
|
+
NSLog(@"%@", rewardMessage);
|
571
|
+
}];
|
454
572
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
455
573
|
} else {
|
456
574
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
|
@@ -458,21 +576,18 @@ if (adFormat == 3){
|
|
458
576
|
}
|
459
577
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
|
460
578
|
}
|
461
|
-
- (void) fireEvent:(NSString *)obj event:(NSString *)eventName withData:(NSString *)jsonStr {
|
462
|
-
NSString* js;
|
463
|
-
if(obj && [obj isEqualToString:@"window"]) {
|
464
|
-
js = [NSString stringWithFormat:@"var evt=document.createEvent(\"UIEvents\");evt.initUIEvent(\"%@\",true,false,window,0);window.dispatchEvent(evt);", eventName];
|
465
|
-
} else if(jsonStr && [jsonStr length]>0) {
|
466
|
-
js = [NSString stringWithFormat:@"javascript:cordova.fireDocumentEvent('%@',%@);", eventName, jsonStr];
|
467
|
-
} else {
|
468
|
-
js = [NSString stringWithFormat:@"javascript:cordova.fireDocumentEvent('%@');", eventName];
|
469
|
-
}
|
470
|
-
[self.commandDelegate evalJs:js];
|
471
|
-
}
|
472
579
|
#pragma mark GADBannerViewDelegate implementation
|
473
580
|
- (void)bannerViewDidReceiveAd:(GADBannerView *)bannerView {
|
474
581
|
[self fireEvent:@"" event:@"on.banner.load" withData:nil];
|
475
|
-
|
582
|
+
NSLog(@"bannerViewDidReceiveAd");
|
583
|
+
if (auto_Show){
|
584
|
+
if(self.bannerView) {
|
585
|
+
[self addBannerViewToView:command];
|
586
|
+
self.bannerView.hidden = NO;
|
587
|
+
}
|
588
|
+
} else {
|
589
|
+
[self fireEvent:@"" event:@"on.banner.failed.show" withData:nil];
|
590
|
+
}
|
476
591
|
}
|
477
592
|
- (void)bannerView:(GADBannerView *)bannerView didFailToReceiveAdWithError:(NSError *)error {
|
478
593
|
[self fireEvent:@"" event:@"on.banner.failed.load" withData:nil];
|
@@ -500,13 +615,12 @@ if (adFormat == 3){
|
|
500
615
|
[self fireEvent:@"" event:@"on.appOpenAd.show" withData:nil];
|
501
616
|
NSLog(@"Ad will present full screen content App Open Ad.");
|
502
617
|
} else if (adFormat == 2){
|
503
|
-
|
504
618
|
[self fireEvent:@"" event:@"on.interstitial.show" withData:nil];
|
505
619
|
[self fireEvent:@"" event:@"onPresentAd" withData:nil];
|
506
620
|
NSLog(@"Ad will present full screen content interstitial.");
|
507
621
|
} else if (adFormat == 3) {
|
508
622
|
[self fireEvent:@"" event:@"on.rewarded.show" withData:nil];
|
509
|
-
NSLog(@"Ad will present full screen content rewarded.");
|
623
|
+
NSLog(@"Ad will present full screen content rewarded.");
|
510
624
|
} else if (adFormat == 4) {
|
511
625
|
[self fireEvent:@"" event:@"on.rewardedInt.showed" withData:nil];
|
512
626
|
NSLog(@"Ad will present full screen content interstitial rewarded.");
|
@@ -524,7 +638,7 @@ if (adFormat == 3){
|
|
524
638
|
NSLog(@"Ad failed to present full screen content with error rewarded %@.", [error localizedDescription]);
|
525
639
|
} else if (adFormat == 4) {
|
526
640
|
[self fireEvent:@"" event:@"on.rewardedInt.failed.load" withData:nil];
|
527
|
-
NSLog(@"Ad failed to present full screen content with error interstitial rewarded %@.", [error localizedDescription]);
|
641
|
+
NSLog(@"Ad failed to present full screen content with error interstitial rewarded %@.", [error localizedDescription]);
|
528
642
|
}
|
529
643
|
}
|
530
644
|
- (void)adDidDismissFullScreenContent:(id)ad {
|
@@ -551,4 +665,3 @@ if (adFormat == 3){
|
|
551
665
|
self.rewardedInterstitialAd = nil;
|
552
666
|
}
|
553
667
|
@end
|
554
|
-
|
package/www/emiAdmobPlugin.js
CHANGED
@@ -1,69 +1,61 @@
|
|
1
1
|
var exec = require('cordova/exec');
|
2
|
-
|
3
2
|
exports.initialize = function (success, error) {
|
4
3
|
exec(success, error, 'emiAdmobPlugin', 'initialize', []);
|
5
4
|
};
|
6
|
-
|
5
|
+
exports.getIabTfc = function (success, error) {
|
6
|
+
exec(success, error, 'emiAdmobPlugin', 'getIabTfc', []);
|
7
|
+
};
|
8
|
+
exports.showPrivacyOptionsForm = function (success, error) {
|
9
|
+
exec(success, error, 'emiAdmobPlugin', 'showPrivacyOptionsForm', []);
|
10
|
+
};
|
7
11
|
exports.loadAppOpenAd = function (arg0, arg1, success, error) {
|
8
12
|
exec(success, error, 'emiAdmobPlugin', 'loadAppOpenAd', [arg0, arg1]);
|
9
13
|
};
|
10
|
-
|
11
14
|
exports.showAppOpenAd = function (success, error) {
|
12
15
|
exec(success, error, 'emiAdmobPlugin', 'showAppOpenAd', []);
|
13
16
|
};
|
14
|
-
|
15
17
|
exports.loadBannerAd = function (arg0, arg1, arg2, arg3, arg4, arg5, success, error) {
|
16
18
|
exec(success, error, 'emiAdmobPlugin', 'loadBannerAd', [arg0, arg1, arg2, arg3, arg4, arg5]);
|
17
19
|
};
|
18
|
-
|
20
|
+
exports.requestIDFA = function (success, error) {
|
21
|
+
exec(success, error, 'emiAdmobPlugin', 'requestIDFA', []);
|
22
|
+
};
|
19
23
|
exports.showBannerAd = function (success, error) {
|
20
24
|
exec(success, error, 'emiAdmobPlugin', 'showBannerAd', []);
|
21
25
|
};
|
22
|
-
|
26
|
+
exports.hideBannerAd = function (success, error) {
|
27
|
+
exec(success, error, 'emiAdmobPlugin', 'hideBannerAd', []);
|
28
|
+
};
|
23
29
|
exports.removeBannerAd = function (arg0, success, error) {
|
24
30
|
exec(success, error, 'emiAdmobPlugin', 'removeBannerAd', [arg0]);
|
25
31
|
};
|
26
|
-
|
27
|
-
exports.hideBannerAd = function (success, error) {
|
28
|
-
exec(success, error, 'emiAdmobPlugin', 'hideBannerAd', []);
|
29
|
-
};
|
30
|
-
|
31
32
|
exports.loadInterstitialAd = function (arg0, arg1, success, error) {
|
32
33
|
exec(success, error, 'emiAdmobPlugin', 'loadInterstitialAd', [arg0, arg1]);
|
33
34
|
};
|
34
|
-
|
35
35
|
exports.showInterstitialAd = function (success, error) {
|
36
36
|
exec(success, error, 'emiAdmobPlugin', 'showInterstitialAd', []);
|
37
37
|
};
|
38
|
-
|
39
38
|
exports.loadRewardedAd = function (arg0, arg1, success, error) {
|
40
39
|
exec(success, error, 'emiAdmobPlugin', 'loadRewardedAd', [arg0, arg1]);
|
41
40
|
};
|
42
|
-
|
43
41
|
exports.showRewardedAd = function (success, error) {
|
44
42
|
exec(success, error, 'emiAdmobPlugin', 'showRewardedAd', []);
|
45
43
|
};
|
46
|
-
|
47
44
|
exports.loadRewardedInterstitialAd = function (arg0, arg1, success, error) {
|
48
45
|
exec(success, error, 'emiAdmobPlugin', 'loadRewardedInterstitialAd', [arg0, arg1]);
|
49
46
|
};
|
50
|
-
|
51
47
|
exports.showRewardedInterstitialAd = function (success, error) {
|
52
48
|
exec(success, error, 'emiAdmobPlugin', 'showRewardedInterstitialAd', []);
|
53
49
|
};
|
54
|
-
|
55
50
|
exports.getConsentRequest = function (success, error) {
|
56
51
|
exec(success, error, 'emiAdmobPlugin', 'getConsentRequest', []);
|
57
52
|
};
|
58
|
-
|
59
53
|
exports.consentReset = function (success, error) {
|
60
54
|
exec(success, error, 'emiAdmobPlugin', 'consentReset', []);
|
61
55
|
};
|
62
|
-
|
63
56
|
exports.targeting = function (arg0, arg1, arg2, success, error) {
|
64
57
|
exec(success, error, 'emiAdmobPlugin', 'targeting', [arg0, arg1, arg2]);
|
65
58
|
};
|
66
|
-
|
67
|
-
|
68
|
-
exec(success, error, 'emiAdmobPlugin', 'globalSettings', [arg0, arg1, arg2, arg3, arg4, arg5]);
|
59
|
+
exports.globalSettings = function (arg0, arg1, arg2, arg3, arg4, success, error) {
|
60
|
+
exec(success, error, 'emiAdmobPlugin', 'globalSettings', [arg0, arg1, arg2, arg3, arg4]);
|
69
61
|
};
|