@capacitor-community/admob 3.2.0 → 4.0.0-0
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/CapacitorCommunityAdmob.podspec +2 -2
- package/LICENSE +1 -1
- package/README.md +25 -30
- package/android/build.gradle +20 -18
- package/android/src/main/java/com/getcapacitor/community/admob/banner/BannerAdSizeInfo.kt +1 -1
- package/dist/plugin.js +1 -1
- package/ios/Plugin/Banner/BannerExecutor.swift +6 -5
- package/ios/Plugin/Interstitial/AdInterstitialExecutor.swift +5 -5
- package/ios/Plugin/Rewarded/AdRewardExecutor.swift +5 -5
- package/package.json +5 -6
- package/ios/Plugin/.DS_Store +0 -0
|
@@ -11,9 +11,9 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
13
|
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
-
s.ios.deployment_target = '
|
|
14
|
+
s.ios.deployment_target = '13.0'
|
|
15
15
|
s.swift_version = '5.1'
|
|
16
16
|
s.static_framework = true
|
|
17
17
|
s.dependency 'Capacitor'
|
|
18
|
-
s.dependency 'Google-Mobile-Ads-SDK', '
|
|
18
|
+
s.dependency 'Google-Mobile-Ads-SDK', '9.7.0'
|
|
19
19
|
end
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -6,15 +6,12 @@
|
|
|
6
6
|
</p>
|
|
7
7
|
|
|
8
8
|
<p align="center">
|
|
9
|
-
<img src="https://img.shields.io/maintenance/yes/
|
|
9
|
+
<img src="https://img.shields.io/maintenance/yes/2022?style=flat-square" />
|
|
10
10
|
<!-- <a href="https://github.com/capacitor-community/example/actions?query=workflow%3A%22CI%22"><img src="https://img.shields.io/github/workflow/status/capacitor-community/example/CI?style=flat-square" /></a> -->
|
|
11
11
|
<a href="https://www.npmjs.com/package/@capacitor-community/admob"><img src="https://img.shields.io/npm/l/@capacitor-community/admob?style=flat-square" /></a>
|
|
12
12
|
<br>
|
|
13
13
|
<a href="https://www.npmjs.com/package/@capacitor-community/admob"><img src="https://img.shields.io/npm/dw/@capacitor-community/admob?style=flat-square" /></a>
|
|
14
14
|
<a href="https://www.npmjs.com/package/@capacitor-community/admob"><img src="https://img.shields.io/npm/v/@capacitor-community/admob?style=flat-square" /></a>
|
|
15
|
-
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
16
|
-
<a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-7-orange?style=flat-square" /></a>
|
|
17
|
-
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
18
15
|
</p>
|
|
19
16
|
|
|
20
17
|
## Maintainers
|
|
@@ -26,6 +23,13 @@
|
|
|
26
23
|
|
|
27
24
|
Maintenance Status: Actively Maintained
|
|
28
25
|
|
|
26
|
+
## Contributors ✨
|
|
27
|
+
<a href="https://github.com/capacitor-community/admob/graphs/contributors">
|
|
28
|
+
<img src="https://contrib.rocks/image?repo=capacitor-community/admob" />
|
|
29
|
+
</a>
|
|
30
|
+
|
|
31
|
+
Made with [contributors-img](https://contrib.rocks).
|
|
32
|
+
|
|
29
33
|
## Demo
|
|
30
34
|
|
|
31
35
|
[Demo code is here.](https://github.com/capacitor-community/admob/tree/master/demo)
|
|
@@ -49,6 +53,8 @@ Maintenance Status: Actively Maintained
|
|
|
49
53
|
In file `android/app/src/main/java/**/**/MainActivity.java`, add the plugin to the initialization list:
|
|
50
54
|
|
|
51
55
|
```java
|
|
56
|
+
import android.os.Bundle;
|
|
57
|
+
|
|
52
58
|
public class MainActivity extends BridgeActivity {
|
|
53
59
|
@Override
|
|
54
60
|
public void onCreate(Bundle savedInstanceState) {
|
|
@@ -104,6 +110,21 @@ Don't forget to replace `[APP_ID]` by your AdMob application Id.
|
|
|
104
110
|
import { AdMob } from '@capacitor-community/admob';
|
|
105
111
|
|
|
106
112
|
export async function initialize(): Promise<void> {
|
|
113
|
+
const { status } = await AdMob.trackingAuthorizationStatus();
|
|
114
|
+
|
|
115
|
+
if (status === 'notDetermined') {
|
|
116
|
+
/**
|
|
117
|
+
* If you want to explain TrackingAuthorization before showing the iOS dialog,
|
|
118
|
+
* you can show the modal here.
|
|
119
|
+
* ex)
|
|
120
|
+
* const modal = await this.modalCtrl.create({
|
|
121
|
+
* component: RequestTrackingPage,
|
|
122
|
+
* });
|
|
123
|
+
* await modal.present();
|
|
124
|
+
* await modal.onDidDismiss(); // Wait for close modal
|
|
125
|
+
**/
|
|
126
|
+
}
|
|
127
|
+
|
|
107
128
|
AdMob.initialize({
|
|
108
129
|
requestTrackingAuthorization: true,
|
|
109
130
|
testingDevices: ['2077ef9a63d2b398840261c8221a0c9b'],
|
|
@@ -876,29 +897,3 @@ You should run `pod repo update` ;
|
|
|
876
897
|
## License
|
|
877
898
|
|
|
878
899
|
Capacitor AdMob is [MIT licensed](./LICENSE).
|
|
879
|
-
|
|
880
|
-
## Contributors ✨
|
|
881
|
-
|
|
882
|
-
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
|
883
|
-
|
|
884
|
-
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
885
|
-
<!-- prettier-ignore-start -->
|
|
886
|
-
<!-- markdownlint-disable -->
|
|
887
|
-
<table>
|
|
888
|
-
<tr>
|
|
889
|
-
<td align="center"><a href="https://wako.app"><img src="https://avatars1.githubusercontent.com/u/216573?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jean-Baptiste Malatrasi</b></sub></a><br /><a href="https://github.com/capacitor-community/admob/commits?author=JumBay" title="Code">💻</a></td>
|
|
890
|
-
<td align="center"><a href="https://github.com/gant02"><img src="https://avatars1.githubusercontent.com/u/6771123?v=4?s=100" width="100px;" alt=""/><br /><sub><b>gant02</b></sub></a><br /><a href="https://github.com/capacitor-community/admob/commits?author=gant02" title="Code">💻</a></td>
|
|
891
|
-
<td align="center"><a href="https://www.saninnsalas.com"><img src="https://avatars1.githubusercontent.com/u/5490201?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Saninn Salas Diaz</b></sub></a><br /><a href="https://github.com/capacitor-community/admob/commits?author=distante" title="Code">💻</a></td>
|
|
892
|
-
<td align="center"><a href="https://www.nicolueg.com"><img src="https://avatars.githubusercontent.com/u/48101693?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nico Lueg</b></sub></a><br /><a href="https://github.com/capacitor-community/admob/commits?author=NLueg" title="Code">💻</a></td>
|
|
893
|
-
<td align="center"><a href="https://www.linkedin.com/in/ghonche-yqr-21774b114/"><img src="https://avatars.githubusercontent.com/u/25591295?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ghonche Yqr</b></sub></a><br /><a href="https://github.com/capacitor-community/admob/commits?author=ghonche-yqr" title="Documentation">📖</a></td>
|
|
894
|
-
<td align="center"><a href="https://github.com/vanessag"><img src="https://avatars.githubusercontent.com/u/4007550?v=4?s=100" width="100px;" alt=""/><br /><sub><b>vanessag</b></sub></a><br /><a href="https://github.com/capacitor-community/admob/commits?author=vanessag" title="Code">💻</a></td>
|
|
895
|
-
<td align="center"><a href="https://mattmilan.dev/"><img src="https://avatars.githubusercontent.com/u/49694881?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Matt Milan</b></sub></a><br /><a href="https://github.com/capacitor-community/admob/commits?author=mattmilan-dev" title="Code">💻</a></td>
|
|
896
|
-
</tr>
|
|
897
|
-
</table>
|
|
898
|
-
|
|
899
|
-
<!-- markdownlint-restore -->
|
|
900
|
-
<!-- prettier-ignore-end -->
|
|
901
|
-
|
|
902
|
-
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
903
|
-
|
|
904
|
-
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
package/android/build.gradle
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
ext {
|
|
2
|
-
junitVersion =
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
buildscript {
|
|
8
|
-
ext.kotlin_version = '1.
|
|
9
|
+
ext.kotlin_version = '1.5.21'
|
|
9
10
|
repositories {
|
|
10
11
|
google()
|
|
11
|
-
|
|
12
|
+
mavenCentral()
|
|
12
13
|
}
|
|
13
14
|
dependencies {
|
|
14
|
-
classpath 'com.android.tools.build:gradle:
|
|
15
|
+
classpath 'com.android.tools.build:gradle:7.2.1'
|
|
15
16
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
16
17
|
}
|
|
17
18
|
}
|
|
@@ -20,10 +21,10 @@ apply plugin: 'com.android.library'
|
|
|
20
21
|
apply plugin: 'kotlin-android'
|
|
21
22
|
|
|
22
23
|
android {
|
|
23
|
-
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion :
|
|
24
|
+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
|
|
24
25
|
defaultConfig {
|
|
25
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion :
|
|
26
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
26
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
27
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
|
|
27
28
|
versionCode 1
|
|
28
29
|
versionName "1.0"
|
|
29
30
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
@@ -38,18 +39,18 @@ android {
|
|
|
38
39
|
abortOnError false
|
|
39
40
|
}
|
|
40
41
|
compileOptions {
|
|
41
|
-
sourceCompatibility JavaVersion.
|
|
42
|
-
targetCompatibility JavaVersion.
|
|
42
|
+
sourceCompatibility JavaVersion.VERSION_11
|
|
43
|
+
targetCompatibility JavaVersion.VERSION_11
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
repositories {
|
|
47
48
|
google()
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
mavenCentral()
|
|
50
|
+
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
def testRunner = "1.
|
|
53
|
+
def testRunner = "1.4.0"
|
|
53
54
|
|
|
54
55
|
dependencies {
|
|
55
56
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
@@ -70,14 +71,15 @@ dependencies {
|
|
|
70
71
|
// androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
71
72
|
// androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
72
73
|
|
|
73
|
-
|
|
74
|
-
implementation 'com.android.
|
|
74
|
+
// after 20.5.0, require minCompileSdk (31)
|
|
75
|
+
implementation 'com.google.android.gms:play-services-ads:21.1.0'
|
|
76
|
+
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
75
77
|
implementation "androidx.coordinatorlayout:coordinatorlayout:1.1.0"
|
|
76
|
-
implementation "androidx.core:core-ktx:1.
|
|
78
|
+
implementation "androidx.core:core-ktx:1.6.0"
|
|
77
79
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
// Allow to run unit test with ./gradlew test
|
|
81
83
|
tasks.withType(Test) {
|
|
82
84
|
useJUnitPlatform()
|
|
83
|
-
}
|
|
85
|
+
}
|
|
@@ -13,5 +13,5 @@ data class BannerAdSizeInfo(val width: Int, val height: Int) : JSObject() {
|
|
|
13
13
|
super.put("width", width)
|
|
14
14
|
super.put("height", height)
|
|
15
15
|
}
|
|
16
|
-
constructor(mAdView: AdView): this(Objects.requireNonNull(mAdView.adSize)
|
|
16
|
+
constructor(mAdView: AdView): this(Objects.requireNonNull(mAdView.adSize)!!.width, Objects.requireNonNull(mAdView.adSize)!!.height)
|
|
17
17
|
}
|
package/dist/plugin.js
CHANGED
|
@@ -17,19 +17,19 @@ class BannerExecutor: NSObject, GADBannerViewDelegate {
|
|
|
17
17
|
|
|
18
18
|
switch adSize {
|
|
19
19
|
case "BANNER":
|
|
20
|
-
bannerSize =
|
|
20
|
+
bannerSize = GADAdSizeBanner
|
|
21
21
|
break
|
|
22
22
|
case "LARGE_BANNER":
|
|
23
|
-
bannerSize =
|
|
23
|
+
bannerSize = GADAdSizeLargeBanner
|
|
24
24
|
break
|
|
25
25
|
case "FULL_BANNER":
|
|
26
|
-
bannerSize =
|
|
26
|
+
bannerSize = GADAdSizeFullBanner
|
|
27
27
|
break
|
|
28
28
|
case "LEADERBOARD":
|
|
29
|
-
bannerSize =
|
|
29
|
+
bannerSize = GADAdSizeLeaderboard
|
|
30
30
|
break
|
|
31
31
|
case "MEDIUM_RECTANGLE":
|
|
32
|
-
bannerSize =
|
|
32
|
+
bannerSize = GADAdSizeMediumRectangle
|
|
33
33
|
break
|
|
34
34
|
case "SMART_BANNER":
|
|
35
35
|
bannerSize = kGADAdSizeSmartBannerPortrait
|
|
@@ -136,6 +136,7 @@ class BannerExecutor: NSObject, GADBannerViewDelegate {
|
|
|
136
136
|
private func removeBannerViewToView() {
|
|
137
137
|
if let rootViewController = UIApplication.shared.keyWindow?.rootViewController {
|
|
138
138
|
if let subView = rootViewController.view.viewWithTag(2743243288699) {
|
|
139
|
+
bannerView.delegate = nil
|
|
139
140
|
NSLog("AdMob: find subView")
|
|
140
141
|
subView.removeFromSuperview()
|
|
141
142
|
}
|
|
@@ -43,11 +43,6 @@ class AdInterstitialExecutor: NSObject, GADFullScreenContentDelegate {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
public func adDidPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
|
|
47
|
-
NSLog("InterstitialFullScreenDelegate Ad did present full screen content.")
|
|
48
|
-
self.plugin?.notifyListeners(InterstitialAdPluginEvents.Showed.rawValue, data: [:])
|
|
49
|
-
}
|
|
50
|
-
|
|
51
46
|
public func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
|
|
52
47
|
NSLog("InterstitialFullScreenDelegate Ad failed to present full screen content with error \(error.localizedDescription).")
|
|
53
48
|
self.plugin?.notifyListeners(InterstitialAdPluginEvents.FailedToShow.rawValue, data: [
|
|
@@ -55,6 +50,11 @@ class AdInterstitialExecutor: NSObject, GADFullScreenContentDelegate {
|
|
|
55
50
|
"message": error.localizedDescription
|
|
56
51
|
])
|
|
57
52
|
}
|
|
53
|
+
|
|
54
|
+
public func adWillPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
|
|
55
|
+
NSLog("InterstitialFullScreenDelegate Ad did present full screen content.")
|
|
56
|
+
self.plugin?.notifyListeners(InterstitialAdPluginEvents.Showed.rawValue, data: [:])
|
|
57
|
+
}
|
|
58
58
|
|
|
59
59
|
public func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) {
|
|
60
60
|
NSLog("InterstitialFullScreenDelegate Ad did dismiss full screen content.")
|
|
@@ -64,11 +64,6 @@ class AdRewardExecutor: NSObject, GADFullScreenContentDelegate {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
public func adDidPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
|
|
68
|
-
NSLog("RewardFullScreenDelegate Ad did present full screen content.")
|
|
69
|
-
self.plugin?.notifyListeners(RewardAdPluginEvents.Showed.rawValue, data: [:])
|
|
70
|
-
}
|
|
71
|
-
|
|
72
67
|
public func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
|
|
73
68
|
NSLog("RewardFullScreenDelegate Ad failed to present full screen content with error \(error.localizedDescription).")
|
|
74
69
|
self.plugin?.notifyListeners(RewardAdPluginEvents.FailedToShow.rawValue, data: [
|
|
@@ -76,6 +71,11 @@ class AdRewardExecutor: NSObject, GADFullScreenContentDelegate {
|
|
|
76
71
|
"message": error.localizedDescription
|
|
77
72
|
])
|
|
78
73
|
}
|
|
74
|
+
|
|
75
|
+
public func adWillPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
|
|
76
|
+
NSLog("RewardFullScreenDelegate Ad did present full screen content.")
|
|
77
|
+
self.plugin?.notifyListeners(RewardAdPluginEvents.Showed.rawValue, data: [:])
|
|
78
|
+
}
|
|
79
79
|
|
|
80
80
|
public func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) {
|
|
81
81
|
NSLog("RewardFullScreenDelegate Ad did dismiss full screen content.")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor-community/admob",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-0",
|
|
4
4
|
"description": "A native plugin for AdMob",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"clean": "rimraf ./dist",
|
|
38
38
|
"watch": "tsc --watch",
|
|
39
39
|
"prepublishOnly": "npm run build",
|
|
40
|
-
"release": "np"
|
|
40
|
+
"release": "np --no-tests"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@capacitor/android": "^3.0.0",
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
"lint-staged": "^11.0.0",
|
|
53
53
|
"np": "^7.4.0",
|
|
54
54
|
"pre-commit": "^1.2.2",
|
|
55
|
-
"prettier": "~2.
|
|
56
|
-
"prettier-plugin-java": "~1.0.
|
|
55
|
+
"prettier": "~2.3.0",
|
|
56
|
+
"prettier-plugin-java": "~1.0.2",
|
|
57
57
|
"rimraf": "^3.0.2",
|
|
58
58
|
"rollup": "^2.32.0",
|
|
59
59
|
"swiftlint": "^1.0.1",
|
|
60
|
-
"typescript": "~4.
|
|
60
|
+
"typescript": "~4.1.5"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@capacitor/core": "^3.0.0"
|
|
@@ -69,7 +69,6 @@
|
|
|
69
69
|
},
|
|
70
70
|
"lint-staged": {
|
|
71
71
|
"*.{ts}": [
|
|
72
|
-
"npm run eslint -- --fix",
|
|
73
72
|
"npm run prettier -- --write",
|
|
74
73
|
"git add"
|
|
75
74
|
],
|
package/ios/Plugin/.DS_Store
DELETED
|
Binary file
|