emi-indo-cordova-plugin-admob 2.0.6 → 2.0.7
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/README.md +198 -52
- package/example/capacitor.config.json +1 -1
- package/example/config.xml +7 -0
- package/example/package.json +1 -1
- package/example/www/css/index.css +0 -0
- package/example/www/js/bannerAd.js +6 -65
- package/example/www/js/deviceready.js +1 -1
- package/example/www/js/interstitialAd.js +0 -2
- package/example/www/js/optionalFirebaseAnalytics.js +0 -2
- package/example/www/js/rewardedAd.js +0 -2
- package/package.json +1 -1
- package/plugin.xml +7 -9
- package/src/android/emiAdmobPlugin.kt +438 -256
- package/src/ios/emiAdmobPlugin.m +24 -5
- package/www/emiAdmobPlugin.js +3 -0
package/src/ios/emiAdmobPlugin.m
CHANGED
@@ -659,7 +659,25 @@ NSString *setKeyword = @"";
|
|
659
659
|
|
660
660
|
GADAdSize siz = [self __AdSizeFromString:size];
|
661
661
|
self.bannerView = [[GADBannerView alloc] initWithAdSize:siz];
|
662
|
-
|
662
|
+
|
663
|
+
|
664
|
+
CGSize bannerSize = self.bannerView.bounds.size;
|
665
|
+
CGFloat screenWidth = parentView.bounds.size.width;
|
666
|
+
CGFloat screenHeight = parentView.bounds.size.height;
|
667
|
+
|
668
|
+
// Default to top-center
|
669
|
+
CGFloat originX = (screenWidth - bannerSize.width) / 2;
|
670
|
+
CGFloat originY = 0;
|
671
|
+
|
672
|
+
if ([setPosition isEqualToString:@"bottom-center"]) {
|
673
|
+
originY = screenHeight - bannerSize.height;
|
674
|
+
} else if ([setPosition isEqualToString:@"top-center"]) {
|
675
|
+
originY = 0;
|
676
|
+
}
|
677
|
+
|
678
|
+
self.bannerView.frame = CGRectMake(originX, originY, bannerSize.width, bannerSize.height);
|
679
|
+
|
680
|
+
|
663
681
|
GADExtras *extras = [[GADExtras alloc] init];
|
664
682
|
|
665
683
|
if (isCollapsible) {
|
@@ -707,7 +725,6 @@ NSString *setKeyword = @"";
|
|
707
725
|
}
|
708
726
|
}
|
709
727
|
|
710
|
-
|
711
728
|
- (UIView*)findWebViewInView:(UIView*)view {
|
712
729
|
if ([view isKindOfClass:NSClassFromString(@"WKWebView")] || [view isKindOfClass:NSClassFromString(@"UIWebView")]) {
|
713
730
|
return view;
|
@@ -1445,7 +1462,10 @@ NSString *setKeyword = @"";
|
|
1445
1462
|
NSDictionary *options = [command.arguments objectAtIndex:0];
|
1446
1463
|
NSString *adUnitId = [options valueForKey:@"adUnitId"];
|
1447
1464
|
BOOL autoShow = [[options valueForKey:@"autoShow"] boolValue];
|
1448
|
-
auto_Show = autoShow;
|
1465
|
+
//auto_Show = autoShow;
|
1466
|
+
|
1467
|
+
__block BOOL shouldAutoShow = autoShow;
|
1468
|
+
|
1449
1469
|
adFormat = 3;
|
1450
1470
|
[self setAdRequest];
|
1451
1471
|
if (adFormat == 3) {
|
@@ -1489,7 +1509,7 @@ NSString *setKeyword = @"";
|
|
1489
1509
|
|
1490
1510
|
|
1491
1511
|
|
1492
|
-
if (
|
1512
|
+
if (shouldAutoShow) {
|
1493
1513
|
NSError *presentError = nil;
|
1494
1514
|
if ([self.rewardedAd canPresentFromRootViewController:self.viewController error:&presentError]) {
|
1495
1515
|
[self.rewardedAd presentFromRootViewController:self.viewController userDidEarnRewardHandler:^{
|
@@ -1898,4 +1918,3 @@ NSString *setKeyword = @"";
|
|
1898
1918
|
object:nil];
|
1899
1919
|
}
|
1900
1920
|
@end
|
1901
|
-
|
package/www/emiAdmobPlugin.js
CHANGED
@@ -21,6 +21,9 @@ exports.styleBannerAd = function (options, success, error) {
|
|
21
21
|
exports.loadBannerAd = function (options, success, error) {
|
22
22
|
exec(success, error, 'emiAdmobPlugin', 'loadBannerAd', [options]);
|
23
23
|
};
|
24
|
+
exports.loadBannerAdNewApi = function (options, success, error) {
|
25
|
+
exec(success, error, 'emiAdmobPlugin', 'loadBannerAdNewApi', [options]);
|
26
|
+
};
|
24
27
|
exports.showBannerAd = function (success, error) {
|
25
28
|
exec(success, error, 'emiAdmobPlugin', 'showBannerAd', []);
|
26
29
|
};
|