@capacitor-community/admob 7.0.2 → 7.1.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.
@@ -15,6 +15,6 @@ Pod::Spec.new do |s|
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', '11.3.0'
19
- s.dependency 'GoogleUserMessagingPlatform', '>= 2.7.0', '< 3.0.0'
18
+ s.dependency 'Google-Mobile-Ads-SDK', '12.7.0'
19
+ s.dependency 'GoogleUserMessagingPlatform', '3.0.0'
20
20
  end
package/Package.swift CHANGED
@@ -11,7 +11,7 @@ let package = Package(
11
11
  ],
12
12
  dependencies: [
13
13
  .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"),
14
- .package(url: "https://github.com/googleads/swift-package-manager-google-mobile-ads.git", from: "11.3.0")
14
+ .package(url: "https://github.com/googleads/swift-package-manager-google-mobile-ads.git", from: "12.7.0")
15
15
  ],
16
16
  targets: [
17
17
  .target(
package/README.md CHANGED
@@ -1084,10 +1084,14 @@ addListener(eventName: RewardInterstitialAdPluginEvents.Showed, listenerFunc: ()
1084
1084
 
1085
1085
  This interface extends <a href="#adoptions">AdOptions</a>
1086
1086
 
1087
- | Prop | Type | Description | Default | Since |
1088
- | -------------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- | ----- |
1089
- | **`adSize`** | <code><a href="#banneradsize">BannerAdSize</a></code> | Banner Ad Size, defaults to ADAPTIVE_BANNER. IT can be: ADAPTIVE_BANNER, SMART_BANNER, BANNER, MEDIUM_RECTANGLE, FULL_BANNER, LEADERBOARD | <code>ADAPTIVE_BANNER</code> | 3.0.0 |
1090
- | **`position`** | <code><a href="#banneradposition">BannerAdPosition</a></code> | Set Banner Ad position. TOP_CENTER or CENTER or BOTTOM_CENTER | <code>TOP_CENTER</code> | 1.1.2 |
1087
+ | Prop | Type | Description | Default | Since |
1088
+ | --------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- | ----- |
1089
+ | **`adSize`** | <code><a href="#banneradsize">BannerAdSize</a></code> | Banner Ad Size, defaults to ADAPTIVE_BANNER. IT can be: ADAPTIVE_BANNER, SMART_BANNER, BANNER, MEDIUM_RECTANGLE, FULL_BANNER, LEADERBOARD | <code>ADAPTIVE_BANNER</code> | 3.0.0 |
1090
+ | **`position`** | <code><a href="#banneradposition">BannerAdPosition</a></code> | Set Banner Ad position. TOP_CENTER or CENTER or BOTTOM_CENTER | <code>TOP_CENTER</code> | 1.1.2 |
1091
+ | **`adId`** | <code>string</code> | The ad unit ID that you want to request | | 1.1.2 |
1092
+ | **`isTesting`** | <code>boolean</code> | You can use test mode of ad. | <code>false</code> | 1.1.2 |
1093
+ | **`margin`** | <code>number</code> | Margin Banner. Default is 0px; If position is BOTTOM_CENTER, margin is be margin-bottom. If position is TOP_CENTER, margin is be margin-top. | <code>0</code> | 1.1.2 |
1094
+ | **`npa`** | <code>boolean</code> | The default behavior of the Google Mobile Ads SDK is to serve personalized ads. Set this to true to request Non-Personalized Ads | <code>false</code> | 1.2.0 |
1091
1095
 
1092
1096
 
1093
1097
  #### PluginListenerHandle
@@ -1154,9 +1158,13 @@ https://developers.google.com/android/reference/com/google/android/gms/ads/AdErr
1154
1158
 
1155
1159
  #### RewardAdOptions
1156
1160
 
1157
- | Prop | Type | Description |
1158
- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1159
- | **`ssv`** | <code><a href="#atleastone">AtLeastOne</a>&lt;{ /** * An optional UserId to pass to your SSV callback function. */ userId: string; /** * An optional custom set of data to pass to your SSV callback function. */ customData: string; }&gt;</code> | If you have enabled SSV in your AdMob Application. You can provide customData or a userId be passed to your callback to do further processing on. *Important* You *HAVE* to define one of them. |
1161
+ | Prop | Type | Description | Default | Since |
1162
+ | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- |
1163
+ | **`ssv`** | <code><a href="#atleastone">AtLeastOne</a>&lt;{ /** * An optional UserId to pass to your SSV callback function. */ userId: string; /** * An optional custom set of data to pass to your SSV callback function. */ customData: string; }&gt;</code> | If you have enabled SSV in your AdMob Application. You can provide customData or a userId be passed to your callback to do further processing on. *Important* You *HAVE* to define one of them. | | |
1164
+ | **`adId`** | <code>string</code> | The ad unit ID that you want to request | | 1.1.2 |
1165
+ | **`isTesting`** | <code>boolean</code> | You can use test mode of ad. | <code>false</code> | 1.1.2 |
1166
+ | **`margin`** | <code>number</code> | Margin Banner. Default is 0px; If position is BOTTOM_CENTER, margin is be margin-bottom. If position is TOP_CENTER, margin is be margin-top. | <code>0</code> | 1.1.2 |
1167
+ | **`npa`** | <code>boolean</code> | The default behavior of the Google Mobile Ads SDK is to serve personalized ads. Set this to true to request Non-Personalized Ads | <code>false</code> | 1.2.0 |
1160
1168
 
1161
1169
 
1162
1170
  #### AdMobRewardItem
@@ -1172,9 +1180,13 @@ https://developers.google.com/admob/android/rewarded-video-adapters?hl=en
1172
1180
 
1173
1181
  #### RewardInterstitialAdOptions
1174
1182
 
1175
- | Prop | Type | Description |
1176
- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1177
- | **`ssv`** | <code><a href="#atleastone">AtLeastOne</a>&lt;{ /** * An optional UserId to pass to your SSV callback function. */ userId: string; /** * An optional custom set of data to pass to your SSV callback function. */ customData: string; }&gt;</code> | If you have enabled SSV in your AdMob Application. You can provide customData or a userId be passed to your callback to do further processing on. *Important* You *HAVE* to define one of them. |
1183
+ | Prop | Type | Description | Default | Since |
1184
+ | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- |
1185
+ | **`ssv`** | <code><a href="#atleastone">AtLeastOne</a>&lt;{ /** * An optional UserId to pass to your SSV callback function. */ userId: string; /** * An optional custom set of data to pass to your SSV callback function. */ customData: string; }&gt;</code> | If you have enabled SSV in your AdMob Application. You can provide customData or a userId be passed to your callback to do further processing on. *Important* You *HAVE* to define one of them. | | |
1186
+ | **`adId`** | <code>string</code> | The ad unit ID that you want to request | | 1.1.2 |
1187
+ | **`isTesting`** | <code>boolean</code> | You can use test mode of ad. | <code>false</code> | 1.1.2 |
1188
+ | **`margin`** | <code>number</code> | Margin Banner. Default is 0px; If position is BOTTOM_CENTER, margin is be margin-bottom. If position is TOP_CENTER, margin is be margin-top. | <code>0</code> | 1.1.2 |
1189
+ | **`npa`** | <code>boolean</code> | The default behavior of the Google Mobile Ads SDK is to serve personalized ads. Set this to true to request Non-Personalized Ads | <code>false</code> | 1.2.0 |
1178
1190
 
1179
1191
 
1180
1192
  #### AdMobRewardInterstitialItem
@@ -4,12 +4,12 @@ ext {
4
4
  androidxCoordinatorLayoutVersion = project.hasProperty('androidxCoordinatorLayoutVersion') ? rootProject.ext.androidxCoordinatorLayoutVersion : '1.2.0'
5
5
  androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
6
6
  androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
7
- playServicesAdsVersion = project.hasProperty('playServicesAdsVersion') ? rootProject.ext.playServicesAdsVersion : '23.0.0'
7
+ playServicesAdsVersion = project.hasProperty('playServicesAdsVersion') ? rootProject.ext.playServicesAdsVersion : '24.4.+'
8
8
  androidxCoreKTXVersion = project.hasProperty('androidxCoreKTXVersion') ? rootProject.ext.androidxCoreKTXVersion : '1.13.0'
9
9
  }
10
10
 
11
11
  buildscript {
12
- ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.9.25'
12
+ ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '2.1.0'
13
13
  repositories {
14
14
  google()
15
15
  mavenCentral()
@@ -102,6 +102,22 @@ public class BannerExecutor extends Executor {
102
102
  break;
103
103
  }
104
104
 
105
+ // set Safe Area
106
+ View rootView = activitySupplier.get().getWindow().getDecorView();
107
+ rootView.setOnApplyWindowInsetsListener((v, insets) -> {
108
+ int bottomInset = insets.getSystemWindowInsetBottom();
109
+ int topInset = insets.getSystemWindowInsetTop();
110
+
111
+ if ("TOP_CENTER".equals(adOptions.position)) {
112
+ mAdViewLayoutParams.setMargins(0, topInset, 0, 0);
113
+ } else {
114
+ mAdViewLayoutParams.setMargins(0, 0, 0, bottomInset);
115
+ }
116
+
117
+ mAdViewLayout.setLayoutParams(mAdViewLayoutParams);
118
+ return insets;
119
+ });
120
+
105
121
  mAdViewLayout.setLayoutParams(mAdViewLayoutParams);
106
122
 
107
123
  int densityMargin = (int) (adOptions.margin * density);
package/dist/docs.json CHANGED
@@ -4,6 +4,13 @@
4
4
  "slug": "admobplugin",
5
5
  "docs": "",
6
6
  "tags": [],
7
+ "extends": [
8
+ "BannerDefinitions",
9
+ "RewardDefinitions",
10
+ "RewardInterstitialDefinitions",
11
+ "InterstitialDefinitions",
12
+ "AdmobConsentDefinitions"
13
+ ],
7
14
  "methods": [
8
15
  {
9
16
  "name": "initialize",
@@ -1115,20 +1122,7 @@
1115
1122
  "slug": "addlistenerrewardinterstitialadplugineventsshowed-"
1116
1123
  }
1117
1124
  ],
1118
- "properties": [],
1119
- "importObject": [
1120
- "BannerDefinitions",
1121
- "AdmobConsentDefinitions",
1122
- "InterstitialDefinitions",
1123
- "RewardDefinitions",
1124
- "RewardInterstitialDefinitions",
1125
- "TrackingAuthorizationStatusInterface",
1126
- "AdMobDefinitions",
1127
- "AdMobInitializationOptions",
1128
- "MaxAdContentRating",
1129
- "ApplicationMutedOptions",
1130
- "ApplicationVolumeOptions"
1131
- ]
1125
+ "properties": []
1132
1126
  },
1133
1127
  "interfaces": [
1134
1128
  {
@@ -1136,6 +1130,7 @@
1136
1130
  "slug": "admobinitializationoptions",
1137
1131
  "docs": "",
1138
1132
  "tags": [],
1133
+ "extends": [],
1139
1134
  "methods": [],
1140
1135
  "properties": [
1141
1136
  {
@@ -1224,19 +1219,6 @@
1224
1219
  ],
1225
1220
  "type": "MaxAdContentRating"
1226
1221
  }
1227
- ],
1228
- "importObject": [
1229
- "BannerDefinitions",
1230
- "AdmobConsentDefinitions",
1231
- "InterstitialDefinitions",
1232
- "RewardDefinitions",
1233
- "RewardInterstitialDefinitions",
1234
- "TrackingAuthorizationStatusInterface",
1235
- "AdMobDefinitions",
1236
- "AdMobPlugin",
1237
- "MaxAdContentRating",
1238
- "ApplicationMutedOptions",
1239
- "ApplicationVolumeOptions"
1240
1222
  ]
1241
1223
  },
1242
1224
  {
@@ -1249,6 +1231,7 @@
1249
1231
  "name": "url"
1250
1232
  }
1251
1233
  ],
1234
+ "extends": [],
1252
1235
  "methods": [],
1253
1236
  "properties": [
1254
1237
  {
@@ -1258,14 +1241,14 @@
1258
1241
  "complexTypes": [],
1259
1242
  "type": "'authorized' | 'denied' | 'notDetermined' | 'restricted'"
1260
1243
  }
1261
- ],
1262
- "importObject": []
1244
+ ]
1263
1245
  },
1264
1246
  {
1265
1247
  "name": "ApplicationMutedOptions",
1266
1248
  "slug": "applicationmutedoptions",
1267
1249
  "docs": "",
1268
1250
  "tags": [],
1251
+ "extends": [],
1269
1252
  "methods": [],
1270
1253
  "properties": [
1271
1254
  {
@@ -1284,19 +1267,6 @@
1284
1267
  "complexTypes": [],
1285
1268
  "type": "boolean | undefined"
1286
1269
  }
1287
- ],
1288
- "importObject": [
1289
- "BannerDefinitions",
1290
- "AdmobConsentDefinitions",
1291
- "InterstitialDefinitions",
1292
- "RewardDefinitions",
1293
- "RewardInterstitialDefinitions",
1294
- "TrackingAuthorizationStatusInterface",
1295
- "AdMobDefinitions",
1296
- "AdMobPlugin",
1297
- "AdMobInitializationOptions",
1298
- "MaxAdContentRating",
1299
- "ApplicationVolumeOptions"
1300
1270
  ]
1301
1271
  },
1302
1272
  {
@@ -1304,6 +1274,7 @@
1304
1274
  "slug": "applicationvolumeoptions",
1305
1275
  "docs": "",
1306
1276
  "tags": [],
1277
+ "extends": [],
1307
1278
  "methods": [],
1308
1279
  "properties": [
1309
1280
  {
@@ -1322,19 +1293,6 @@
1322
1293
  "complexTypes": [],
1323
1294
  "type": "0 | 1 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | undefined"
1324
1295
  }
1325
- ],
1326
- "importObject": [
1327
- "BannerDefinitions",
1328
- "AdmobConsentDefinitions",
1329
- "InterstitialDefinitions",
1330
- "RewardDefinitions",
1331
- "RewardInterstitialDefinitions",
1332
- "TrackingAuthorizationStatusInterface",
1333
- "AdMobDefinitions",
1334
- "AdMobPlugin",
1335
- "AdMobInitializationOptions",
1336
- "MaxAdContentRating",
1337
- "ApplicationMutedOptions"
1338
1296
  ]
1339
1297
  },
1340
1298
  {
@@ -1342,6 +1300,9 @@
1342
1300
  "slug": "banneradoptions",
1343
1301
  "docs": "This interface extends AdOptions",
1344
1302
  "tags": [],
1303
+ "extends": [
1304
+ "AdOptions"
1305
+ ],
1345
1306
  "methods": [],
1346
1307
  "properties": [
1347
1308
  {
@@ -1379,12 +1340,79 @@
1379
1340
  "BannerAdPosition"
1380
1341
  ],
1381
1342
  "type": "BannerAdPosition"
1343
+ },
1344
+ {
1345
+ "name": "adId",
1346
+ "tags": [
1347
+ {
1348
+ "text": "https ://support.google.com/admob/answer/7356431?hl=en",
1349
+ "name": "see"
1350
+ },
1351
+ {
1352
+ "text": "1.1.2",
1353
+ "name": "since"
1354
+ }
1355
+ ],
1356
+ "docs": "The ad unit ID that you want to request",
1357
+ "complexTypes": [],
1358
+ "type": "string"
1359
+ },
1360
+ {
1361
+ "name": "isTesting",
1362
+ "tags": [
1363
+ {
1364
+ "text": "false",
1365
+ "name": "default"
1366
+ },
1367
+ {
1368
+ "text": "1.1.2",
1369
+ "name": "since"
1370
+ }
1371
+ ],
1372
+ "docs": "You can use test mode of ad.",
1373
+ "complexTypes": [],
1374
+ "type": "boolean | undefined"
1375
+ },
1376
+ {
1377
+ "name": "margin",
1378
+ "tags": [
1379
+ {
1380
+ "text": "0",
1381
+ "name": "default"
1382
+ },
1383
+ {
1384
+ "text": "1.1.2",
1385
+ "name": "since"
1386
+ }
1387
+ ],
1388
+ "docs": "Margin Banner. Default is 0px;\r\nIf position is BOTTOM_CENTER, margin is be margin-bottom.\r\nIf position is TOP_CENTER, margin is be margin-top.",
1389
+ "complexTypes": [],
1390
+ "type": "number | undefined"
1391
+ },
1392
+ {
1393
+ "name": "npa",
1394
+ "tags": [
1395
+ {
1396
+ "text": "https ://developers.google.com/admob/ios/eu-consent",
1397
+ "name": "see"
1398
+ },
1399
+ {
1400
+ "text": "https ://developers.google.com/admob/android/eu-consent",
1401
+ "name": "see"
1402
+ },
1403
+ {
1404
+ "text": "false",
1405
+ "name": "default"
1406
+ },
1407
+ {
1408
+ "text": "1.2.0",
1409
+ "name": "since"
1410
+ }
1411
+ ],
1412
+ "docs": "The default behavior of the Google Mobile Ads SDK is to serve personalized ads.\r\nSet this to true to request Non-Personalized Ads",
1413
+ "complexTypes": [],
1414
+ "type": "boolean | undefined"
1382
1415
  }
1383
- ],
1384
- "importObject": [
1385
- "AdOptions",
1386
- "BannerAdPosition",
1387
- "BannerAdSize"
1388
1416
  ]
1389
1417
  },
1390
1418
  {
@@ -1392,6 +1420,7 @@
1392
1420
  "slug": "pluginlistenerhandle",
1393
1421
  "docs": "",
1394
1422
  "tags": [],
1423
+ "extends": [],
1395
1424
  "methods": [],
1396
1425
  "properties": [
1397
1426
  {
@@ -1401,17 +1430,6 @@
1401
1430
  "complexTypes": [],
1402
1431
  "type": "() => Promise<void>"
1403
1432
  }
1404
- ],
1405
- "importObject": [
1406
- "CapacitorException",
1407
- "CapacitorGlobal",
1408
- "RegisterPlugin",
1409
- "PluginImplementations",
1410
- "Plugin",
1411
- "PermissionState",
1412
- "PluginResultData",
1413
- "PluginResultError",
1414
- "PluginCallback"
1415
1433
  ]
1416
1434
  },
1417
1435
  {
@@ -1419,6 +1437,7 @@
1419
1437
  "slug": "admobbannersize",
1420
1438
  "docs": "When notice listener of OnAdLoaded, you can get banner size.",
1421
1439
  "tags": [],
1440
+ "extends": [],
1422
1441
  "methods": [],
1423
1442
  "properties": [
1424
1443
  {
@@ -1435,14 +1454,14 @@
1435
1454
  "complexTypes": [],
1436
1455
  "type": "number"
1437
1456
  }
1438
- ],
1439
- "importObject": []
1457
+ ]
1440
1458
  },
1441
1459
  {
1442
1460
  "name": "AdMobError",
1443
1461
  "slug": "admoberror",
1444
1462
  "docs": "For more information\r\nhttps://developers.google.com/android/reference/com/google/android/gms/ads/AdError",
1445
1463
  "tags": [],
1464
+ "extends": [],
1446
1465
  "methods": [],
1447
1466
  "properties": [
1448
1467
  {
@@ -1459,14 +1478,14 @@
1459
1478
  "complexTypes": [],
1460
1479
  "type": "string"
1461
1480
  }
1462
- ],
1463
- "importObject": []
1481
+ ]
1464
1482
  },
1465
1483
  {
1466
1484
  "name": "AdmobConsentInfo",
1467
1485
  "slug": "admobconsentinfo",
1468
1486
  "docs": "",
1469
1487
  "tags": [],
1488
+ "extends": [],
1470
1489
  "methods": [],
1471
1490
  "properties": [
1472
1491
  {
@@ -1495,9 +1514,6 @@
1495
1514
  "complexTypes": [],
1496
1515
  "type": "boolean | undefined"
1497
1516
  }
1498
- ],
1499
- "importObject": [
1500
- "AdmobConsentStatus"
1501
1517
  ]
1502
1518
  },
1503
1519
  {
@@ -1505,6 +1521,7 @@
1505
1521
  "slug": "admobconsentrequestoptions",
1506
1522
  "docs": "",
1507
1523
  "tags": [],
1524
+ "extends": [],
1508
1525
  "methods": [],
1509
1526
  "properties": [
1510
1527
  {
@@ -1549,9 +1566,6 @@
1549
1566
  "complexTypes": [],
1550
1567
  "type": "boolean | undefined"
1551
1568
  }
1552
- ],
1553
- "importObject": [
1554
- "AdmobConsentDebugGeography"
1555
1569
  ]
1556
1570
  },
1557
1571
  {
@@ -1559,6 +1573,7 @@
1559
1573
  "slug": "adloadinfo",
1560
1574
  "docs": "",
1561
1575
  "tags": [],
1576
+ "extends": [],
1562
1577
  "methods": [],
1563
1578
  "properties": [
1564
1579
  {
@@ -1568,14 +1583,14 @@
1568
1583
  "complexTypes": [],
1569
1584
  "type": "string"
1570
1585
  }
1571
- ],
1572
- "importObject": []
1586
+ ]
1573
1587
  },
1574
1588
  {
1575
1589
  "name": "AdOptions",
1576
1590
  "slug": "adoptions",
1577
1591
  "docs": "",
1578
1592
  "tags": [],
1593
+ "extends": [],
1579
1594
  "methods": [],
1580
1595
  "properties": [
1581
1596
  {
@@ -1650,14 +1665,16 @@
1650
1665
  "complexTypes": [],
1651
1666
  "type": "boolean | undefined"
1652
1667
  }
1653
- ],
1654
- "importObject": []
1668
+ ]
1655
1669
  },
1656
1670
  {
1657
1671
  "name": "RewardAdOptions",
1658
1672
  "slug": "rewardadoptions",
1659
1673
  "docs": "",
1660
1674
  "tags": [],
1675
+ "extends": [
1676
+ "AdOptions"
1677
+ ],
1661
1678
  "methods": [],
1662
1679
  "properties": [
1663
1680
  {
@@ -1673,11 +1690,79 @@
1673
1690
  "AtLeastOne"
1674
1691
  ],
1675
1692
  "type": "AtLeastOne<{\n /**\n * An optional UserId to pass to your SSV callback function.\n */\n userId: string;\n /**\n * An optional custom set of data to pass to your SSV callback function.\n */\n customData: string;\n }>"
1693
+ },
1694
+ {
1695
+ "name": "adId",
1696
+ "tags": [
1697
+ {
1698
+ "text": "https ://support.google.com/admob/answer/7356431?hl=en",
1699
+ "name": "see"
1700
+ },
1701
+ {
1702
+ "text": "1.1.2",
1703
+ "name": "since"
1704
+ }
1705
+ ],
1706
+ "docs": "The ad unit ID that you want to request",
1707
+ "complexTypes": [],
1708
+ "type": "string"
1709
+ },
1710
+ {
1711
+ "name": "isTesting",
1712
+ "tags": [
1713
+ {
1714
+ "text": "false",
1715
+ "name": "default"
1716
+ },
1717
+ {
1718
+ "text": "1.1.2",
1719
+ "name": "since"
1720
+ }
1721
+ ],
1722
+ "docs": "You can use test mode of ad.",
1723
+ "complexTypes": [],
1724
+ "type": "boolean | undefined"
1725
+ },
1726
+ {
1727
+ "name": "margin",
1728
+ "tags": [
1729
+ {
1730
+ "text": "0",
1731
+ "name": "default"
1732
+ },
1733
+ {
1734
+ "text": "1.1.2",
1735
+ "name": "since"
1736
+ }
1737
+ ],
1738
+ "docs": "Margin Banner. Default is 0px;\r\nIf position is BOTTOM_CENTER, margin is be margin-bottom.\r\nIf position is TOP_CENTER, margin is be margin-top.",
1739
+ "complexTypes": [],
1740
+ "type": "number | undefined"
1741
+ },
1742
+ {
1743
+ "name": "npa",
1744
+ "tags": [
1745
+ {
1746
+ "text": "https ://developers.google.com/admob/ios/eu-consent",
1747
+ "name": "see"
1748
+ },
1749
+ {
1750
+ "text": "https ://developers.google.com/admob/android/eu-consent",
1751
+ "name": "see"
1752
+ },
1753
+ {
1754
+ "text": "false",
1755
+ "name": "default"
1756
+ },
1757
+ {
1758
+ "text": "1.2.0",
1759
+ "name": "since"
1760
+ }
1761
+ ],
1762
+ "docs": "The default behavior of the Google Mobile Ads SDK is to serve personalized ads.\r\nSet this to true to request Non-Personalized Ads",
1763
+ "complexTypes": [],
1764
+ "type": "boolean | undefined"
1676
1765
  }
1677
- ],
1678
- "importObject": [
1679
- "AdOptions",
1680
- "AtLeastOne"
1681
1766
  ]
1682
1767
  },
1683
1768
  {
@@ -1685,6 +1770,7 @@
1685
1770
  "slug": "admobrewarditem",
1686
1771
  "docs": "For more information\r\nhttps://developers.google.com/admob/android/rewarded-video-adapters?hl=en",
1687
1772
  "tags": [],
1773
+ "extends": [],
1688
1774
  "methods": [],
1689
1775
  "properties": [
1690
1776
  {
@@ -1701,14 +1787,16 @@
1701
1787
  "complexTypes": [],
1702
1788
  "type": "number"
1703
1789
  }
1704
- ],
1705
- "importObject": []
1790
+ ]
1706
1791
  },
1707
1792
  {
1708
1793
  "name": "RewardInterstitialAdOptions",
1709
1794
  "slug": "rewardinterstitialadoptions",
1710
1795
  "docs": "",
1711
1796
  "tags": [],
1797
+ "extends": [
1798
+ "AdOptions"
1799
+ ],
1712
1800
  "methods": [],
1713
1801
  "properties": [
1714
1802
  {
@@ -1724,11 +1812,79 @@
1724
1812
  "AtLeastOne"
1725
1813
  ],
1726
1814
  "type": "AtLeastOne<{\n /**\n * An optional UserId to pass to your SSV callback function.\n */\n userId: string;\n /**\n * An optional custom set of data to pass to your SSV callback function.\n */\n customData: string;\n }>"
1815
+ },
1816
+ {
1817
+ "name": "adId",
1818
+ "tags": [
1819
+ {
1820
+ "text": "https ://support.google.com/admob/answer/7356431?hl=en",
1821
+ "name": "see"
1822
+ },
1823
+ {
1824
+ "text": "1.1.2",
1825
+ "name": "since"
1826
+ }
1827
+ ],
1828
+ "docs": "The ad unit ID that you want to request",
1829
+ "complexTypes": [],
1830
+ "type": "string"
1831
+ },
1832
+ {
1833
+ "name": "isTesting",
1834
+ "tags": [
1835
+ {
1836
+ "text": "false",
1837
+ "name": "default"
1838
+ },
1839
+ {
1840
+ "text": "1.1.2",
1841
+ "name": "since"
1842
+ }
1843
+ ],
1844
+ "docs": "You can use test mode of ad.",
1845
+ "complexTypes": [],
1846
+ "type": "boolean | undefined"
1847
+ },
1848
+ {
1849
+ "name": "margin",
1850
+ "tags": [
1851
+ {
1852
+ "text": "0",
1853
+ "name": "default"
1854
+ },
1855
+ {
1856
+ "text": "1.1.2",
1857
+ "name": "since"
1858
+ }
1859
+ ],
1860
+ "docs": "Margin Banner. Default is 0px;\r\nIf position is BOTTOM_CENTER, margin is be margin-bottom.\r\nIf position is TOP_CENTER, margin is be margin-top.",
1861
+ "complexTypes": [],
1862
+ "type": "number | undefined"
1863
+ },
1864
+ {
1865
+ "name": "npa",
1866
+ "tags": [
1867
+ {
1868
+ "text": "https ://developers.google.com/admob/ios/eu-consent",
1869
+ "name": "see"
1870
+ },
1871
+ {
1872
+ "text": "https ://developers.google.com/admob/android/eu-consent",
1873
+ "name": "see"
1874
+ },
1875
+ {
1876
+ "text": "false",
1877
+ "name": "default"
1878
+ },
1879
+ {
1880
+ "text": "1.2.0",
1881
+ "name": "since"
1882
+ }
1883
+ ],
1884
+ "docs": "The default behavior of the Google Mobile Ads SDK is to serve personalized ads.\r\nSet this to true to request Non-Personalized Ads",
1885
+ "complexTypes": [],
1886
+ "type": "boolean | undefined"
1727
1887
  }
1728
- ],
1729
- "importObject": [
1730
- "AdOptions",
1731
- "AtLeastOne"
1732
1888
  ]
1733
1889
  },
1734
1890
  {
@@ -1736,6 +1892,7 @@
1736
1892
  "slug": "admobrewardinterstitialitem",
1737
1893
  "docs": "For more information\nhttps://developers.google.com/admob/android/rewarded-video-adapters?hl=en",
1738
1894
  "tags": [],
1895
+ "extends": [],
1739
1896
  "methods": [],
1740
1897
  "properties": [
1741
1898
  {
@@ -1752,8 +1909,7 @@
1752
1909
  "complexTypes": [],
1753
1910
  "type": "number"
1754
1911
  }
1755
- ],
1756
- "importObject": []
1912
+ ]
1757
1913
  }
1758
1914
  ],
1759
1915
  "enums": [
@@ -25,7 +25,9 @@ public class AdMobPlugin: CAPPlugin, CAPBridgedPlugin {
25
25
  CAPPluginMethod(name: "prepareInterstitial", returnType: CAPPluginReturnPromise),
26
26
  CAPPluginMethod(name: "showInterstitial", returnType: CAPPluginReturnPromise),
27
27
  CAPPluginMethod(name: "prepareRewardVideoAd", returnType: CAPPluginReturnPromise),
28
- CAPPluginMethod(name: "showRewardVideoAd", returnType: CAPPluginReturnPromise)
28
+ CAPPluginMethod(name: "showRewardVideoAd", returnType: CAPPluginReturnPromise),
29
+ CAPPluginMethod(name: "prepareRewardInterstitialAd", returnType: CAPPluginReturnPromise),
30
+ CAPPluginMethod(name: "showRewardInterstitialAd", returnType: CAPPluginReturnPromise)
29
31
  ]
30
32
 
31
33
  var testingDevices: [String] = []
@@ -49,7 +51,7 @@ public class AdMobPlugin: CAPPlugin, CAPBridgedPlugin {
49
51
  self.consentExecutor.plugin = self
50
52
  self.setRequestConfiguration(call)
51
53
 
52
- GADMobileAds.sharedInstance().start(completionHandler: nil)
54
+ MobileAds.shared.start(completionHandler: nil)
53
55
  call.resolve([:])
54
56
  }
55
57
 
@@ -72,7 +74,7 @@ public class AdMobPlugin: CAPPlugin, CAPBridgedPlugin {
72
74
 
73
75
  @objc func setApplicationMuted(_ call: CAPPluginCall) {
74
76
  if let shouldMute = call.getBool("muted") {
75
- GADMobileAds.sharedInstance().applicationMuted = shouldMute
77
+ MobileAds.shared.isApplicationMuted = shouldMute
76
78
  call.resolve([:])
77
79
  } else {
78
80
  call.reject("muted property cannot be null")
@@ -85,7 +87,7 @@ public class AdMobPlugin: CAPPlugin, CAPBridgedPlugin {
85
87
  // Clamp volumes.
86
88
  if volume < 0.0 {volume = 0.0} else if volume > 1.0 {volume = 1.0}
87
89
 
88
- GADMobileAds.sharedInstance().applicationVolume = volume
90
+ MobileAds.shared.applicationVolume = volume
89
91
 
90
92
  call.resolve([:])
91
93
  } else {
@@ -252,11 +254,11 @@ public class AdMobPlugin: CAPPlugin, CAPBridgedPlugin {
252
254
  return adUnitID
253
255
  }
254
256
 
255
- private func GADRequestWithOption(_ npa: Bool) -> GADRequest {
256
- let request = GADRequest()
257
+ private func GADRequestWithOption(_ npa: Bool) -> Request {
258
+ let request = Request()
257
259
 
258
260
  if npa {
259
- let extras = GADExtras()
261
+ let extras = Extras()
260
262
  extras.additionalParameters = ["npa": "1"]
261
263
  request.register(extras)
262
264
  }
@@ -270,30 +272,30 @@ public class AdMobPlugin: CAPPlugin, CAPBridgedPlugin {
270
272
  private func setRequestConfiguration(_ call: CAPPluginCall) {
271
273
 
272
274
  if call.getBool("initializeForTesting") ?? false {
273
- GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = call.getArray("testingDevices", String.self) ?? []
275
+ MobileAds.shared.requestConfiguration.testDeviceIdentifiers = call.getArray("testingDevices", String.self) ?? []
274
276
  }
275
277
 
276
278
  if call.getBool("tagForChildDirectedTreatment") == true {
277
- GADMobileAds.sharedInstance().requestConfiguration.tagForChildDirectedTreatment = true
279
+ MobileAds.shared.requestConfiguration.tagForChildDirectedTreatment = true
278
280
  }
279
281
 
280
282
  if call.getBool("tagForUnderAgeOfConsent") == true {
281
- GADMobileAds.sharedInstance().requestConfiguration.tagForUnderAgeOfConsent = true
283
+ MobileAds.shared.requestConfiguration.tagForUnderAgeOfConsent = true
282
284
  }
283
285
 
284
286
  if call.getString("maxAdContentRating") != nil {
285
287
  switch call.getString("maxAdContentRating") {
286
288
  case "General":
287
- GADMobileAds.sharedInstance().requestConfiguration.maxAdContentRating =
289
+ MobileAds.shared.requestConfiguration.maxAdContentRating =
288
290
  GADMaxAdContentRating.general
289
291
  case "ParentalGuidance":
290
- GADMobileAds.sharedInstance().requestConfiguration.maxAdContentRating =
292
+ MobileAds.shared.requestConfiguration.maxAdContentRating =
291
293
  GADMaxAdContentRating.parentalGuidance
292
294
  case "Teen":
293
- GADMobileAds.sharedInstance().requestConfiguration.maxAdContentRating =
295
+ MobileAds.shared.requestConfiguration.maxAdContentRating =
294
296
  GADMaxAdContentRating.teen
295
297
  case "MatureAudience":
296
- GADMobileAds.sharedInstance().requestConfiguration.maxAdContentRating =
298
+ MobileAds.shared.requestConfiguration.maxAdContentRating =
297
299
  GADMaxAdContentRating.matureAudience
298
300
  default:
299
301
  print("maxAdContentRating can't find value")
@@ -2,34 +2,36 @@ import Foundation
2
2
  import Capacitor
3
3
  import GoogleMobileAds
4
4
 
5
- class BannerExecutor: NSObject, GADBannerViewDelegate {
5
+ class BannerExecutor: NSObject, BannerViewDelegate {
6
6
  weak var plugin: AdMobPlugin?
7
- var bannerView: GADBannerView!
7
+ var bannerView: BannerView!
8
+ var adPosition: String = ""
9
+ var Margin: Int = 0
8
10
 
9
- func showBanner(_ call: CAPPluginCall, _ request: GADRequest, _ adUnitID: String) {
11
+ func showBanner(_ call: CAPPluginCall, _ request: Request, _ adUnitID: String) {
10
12
  if let rootViewController = plugin?.getRootVC() {
11
13
 
12
14
  let adSize = call.getString("adSize") ?? "ADAPTIVE_BANNER"
13
15
  let adPosition = call.getString("position") ?? "BOTTOM_CENTER"
14
16
  let adMargin = call.getInt("margin") ?? 0
15
17
 
16
- var bannerSize: GADAdSize
18
+ var bannerSize: AdSize
17
19
 
18
20
  switch adSize {
19
21
  case "BANNER":
20
- bannerSize = GADAdSizeBanner
22
+ bannerSize = AdSizeBanner
21
23
  break
22
24
  case "LARGE_BANNER":
23
- bannerSize = GADAdSizeLargeBanner
25
+ bannerSize = AdSizeLargeBanner
24
26
  break
25
27
  case "FULL_BANNER":
26
- bannerSize = GADAdSizeFullBanner
28
+ bannerSize = AdSizeFullBanner
27
29
  break
28
30
  case "LEADERBOARD":
29
- bannerSize = GADAdSizeLeaderboard
31
+ bannerSize = AdSizeLeaderboard
30
32
  break
31
33
  case "MEDIUM_RECTANGLE":
32
- bannerSize = GADAdSizeMediumRectangle
34
+ bannerSize = AdSizeMediumRectangle
33
35
  break
34
36
  case "SMART_BANNER":
35
37
  bannerSize = kGADAdSizeSmartBannerPortrait
@@ -45,11 +47,11 @@ class BannerExecutor: NSObject, GADBannerViewDelegate {
45
47
  }
46
48
  }()
47
49
  let viewWidth = frame.size.width
48
- bannerSize = GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(viewWidth)
50
+ bannerSize = currentOrientationAnchoredAdaptiveBanner(width: viewWidth)
49
51
  break
50
52
  }
51
53
 
52
- self.bannerView = GADBannerView(adSize: bannerSize)
54
+ self.bannerView = BannerView(adSize: bannerSize)
53
55
  self.addBannerViewToView(self.bannerView, adPosition, adMargin)
54
56
  self.bannerView.translatesAutoresizingMaskIntoConstraints = false
55
57
  self.bannerView.adUnitID = adUnitID
@@ -107,22 +109,38 @@ class BannerExecutor: NSObject, GADBannerViewDelegate {
107
109
  call.resolve([:])
108
110
  }
109
111
 
110
- private func addBannerViewToView(_ bannerView: GADBannerView, _ adPosition: String, _ Margin: Int) {
112
+ private func addBannerViewToView(_ bannerView: BannerView, _ adPosition: String, _ Margin: Int) {
111
113
  removeBannerViewToView()
114
+ bannerView.translatesAutoresizingMaskIntoConstraints = false
115
+ bannerView.tag = 2743243288699 // rand
116
+ self.Margin = Margin
117
+ self.adPosition = adPosition
118
+ }
119
+
120
+ private func removeBannerViewToView() {
112
121
  if let rootViewController = plugin?.getRootVC() {
122
+ if let subView = rootViewController.view.viewWithTag(2743243288699) {
123
+ bannerView.delegate = nil
124
+ NSLog("AdMob: find subView")
125
+ subView.removeFromSuperview()
126
+ }
127
+ }
128
+ }
113
129
 
114
- bannerView.translatesAutoresizingMaskIntoConstraints = false
115
- bannerView.tag = 2743243288699 // rand
130
+ /// Tells the delegate an ad request loaded an ad.
131
+ func bannerViewDidReceiveAd(_ bannerView: GADBannerView) {
132
+ NSLog("bannerViewDidReceiveAd")
133
+ if let rootViewController = plugin?.getRootVC() {
116
134
  rootViewController.view.addSubview(bannerView)
117
135
  rootViewController.view.addConstraints(
118
136
  [NSLayoutConstraint(item: bannerView,
119
- attribute: adPosition == "TOP_CENTER" ? .top : .bottom,
137
+ attribute: self.adPosition == "TOP_CENTER" ? .top : .bottom,
120
138
  relatedBy: .equal,
121
139
  toItem: rootViewController.view.safeAreaLayoutGuide,
122
- attribute: adPosition == "TOP_CENTER" ? .top : .bottom,
140
+ attribute: self.adPosition == "TOP_CENTER" ? .top : .bottom,
123
141
  multiplier: 1,
124
- constant: CGFloat(Int(Margin) * -1)),
125
- NSLayoutConstraint(item: bannerView,
142
+ constant: CGFloat(Int(self.Margin) * -1)),
143
+ NSLayoutConstraint(item: bannerView,
126
144
  attribute: .centerX,
127
145
  relatedBy: .equal,
128
146
  toItem: rootViewController.view,
@@ -144,7 +162,7 @@ class BannerExecutor: NSObject, GADBannerViewDelegate {
144
162
  }
145
163
 
146
164
  /// Tells the delegate an ad request loaded an ad.
147
- func bannerViewDidReceiveAd(_ bannerView: GADBannerView) {
165
+ func bannerViewDidReceiveAd(_ bannerView: BannerView) {
148
166
  NSLog("bannerViewDidReceiveAd")
149
167
 
150
168
  self.plugin?.notifyListeners(BannerAdPluginEvents.SizeChanged.rawValue, data: [
@@ -155,7 +173,7 @@ class BannerExecutor: NSObject, GADBannerViewDelegate {
155
173
  }
156
174
 
157
175
  /// Tells the delegate an ad request failed.
158
- func bannerView(_ bannerView: GADBannerView,
176
+ func bannerView(_ bannerView: BannerView,
159
177
  didFailToReceiveAdWithError error: Error) {
160
178
  NSLog("bannerView:didFailToReceiveAdWithError: \(error.localizedDescription)")
161
179
  self.removeBannerViewToView()
@@ -169,18 +187,18 @@ class BannerExecutor: NSObject, GADBannerViewDelegate {
169
187
  ])
170
188
  }
171
189
 
172
- func bannerViewDidRecordImpression(_ bannerView: GADBannerView) {
190
+ func bannerViewDidRecordImpression(_ bannerView: BannerView) {
173
191
  self.plugin?.notifyListeners(BannerAdPluginEvents.AdImpression.rawValue, data: [:])
174
192
  }
175
193
 
176
194
  /// Tells the delegate that a full-screen view will be presented in response
177
195
  /// to the user clicking on an ad.
178
- func bannerViewWillPresentScreen(_ bannerView: GADBannerView) {
196
+ func bannerViewWillPresentScreen(_ bannerView: BannerView) {
179
197
  self.plugin?.notifyListeners(BannerAdPluginEvents.Opened.rawValue, data: [:])
180
198
  }
181
199
 
182
200
  /// Tells the delegate that the full-screen view will be dismissed.
183
- func bannerViewWillDismissScreen(_ bannerView: GADBannerView) {
201
+ func bannerViewWillDismissScreen(_ bannerView: BannerView) {
184
202
  self.plugin?.notifyListeners(BannerAdPluginEvents.Closed.rawValue, data: [:])
185
203
  }
186
204
  }
@@ -7,25 +7,25 @@ class ConsentExecutor: NSObject {
7
7
  weak var plugin: AdMobPlugin?
8
8
 
9
9
  func requestConsentInfo(_ call: CAPPluginCall, _ debugGeography: Int, _ testDeviceIdentifiers: [String], _ tagForUnderAgeOfConsent: Bool) {
10
- let parameters = UMPRequestParameters()
11
- let debugSettings = UMPDebugSettings()
10
+ let parameters = RequestParameters()
11
+ let debugSettings = DebugSettings()
12
12
 
13
- debugSettings.geography = UMPDebugGeography(rawValue: debugGeography) ?? UMPDebugGeography.disabled
13
+ debugSettings.geography = DebugGeography(rawValue: debugGeography) ?? DebugGeography.disabled
14
14
  debugSettings.testDeviceIdentifiers = testDeviceIdentifiers
15
15
 
16
16
  parameters.debugSettings = debugSettings
17
- parameters.tagForUnderAgeOfConsent = tagForUnderAgeOfConsent
17
+ parameters.isTaggedForUnderAgeOfConsent = tagForUnderAgeOfConsent
18
18
 
19
19
  // Request an update to the consent information.
20
- UMPConsentInformation.sharedInstance.requestConsentInfoUpdate(
20
+ ConsentInformation.shared.requestConsentInfoUpdate(
21
21
  with: parameters,
22
22
  completionHandler: { error in
23
23
  if error != nil {
24
24
  call.reject("Request consent info failed")
25
25
  } else {
26
26
  call.resolve([
27
- "status": self.getConsentStatusString(UMPConsentInformation.sharedInstance.consentStatus),
28
- "isConsentFormAvailable": UMPConsentInformation.sharedInstance.formStatus == UMPFormStatus.available
27
+ "status": self.getConsentStatusString(ConsentInformation.shared.consentStatus),
28
+ "isConsentFormAvailable": ConsentInformation.shared.formStatus == FormStatus.available
29
29
  ])
30
30
  }
31
31
  })
@@ -33,16 +33,16 @@ class ConsentExecutor: NSObject {
33
33
 
34
34
  func showConsentForm(_ call: CAPPluginCall) {
35
35
  if let rootViewController = plugin?.getRootVC() {
36
- let formStatus = UMPConsentInformation.sharedInstance.formStatus
36
+ let formStatus = ConsentInformation.shared.formStatus
37
37
 
38
- if formStatus == UMPFormStatus.available {
39
- UMPConsentForm.load(completionHandler: {form, loadError in
38
+ if formStatus == FormStatus.available {
39
+ ConsentForm.load(with: {form, loadError in
40
40
  if loadError != nil {
41
41
  call.reject(loadError?.localizedDescription ?? "Load consent form error")
42
42
  return
43
43
  }
44
44
 
45
- if UMPConsentInformation.sharedInstance.consentStatus == UMPConsentStatus.required {
45
+ if ConsentInformation.shared.consentStatus == ConsentStatus.required {
46
46
  form?.present(from: rootViewController, completionHandler: { dismissError in
47
47
  if dismissError != nil {
48
48
  call.reject(dismissError?.localizedDescription ?? "Consent dismiss error")
@@ -50,12 +50,12 @@ class ConsentExecutor: NSObject {
50
50
  }
51
51
 
52
52
  call.resolve([
53
- "status": self.getConsentStatusString(UMPConsentInformation.sharedInstance.consentStatus)
53
+ "status": self.getConsentStatusString(ConsentInformation.shared.consentStatus)
54
54
  ])
55
55
  })
56
56
  } else {
57
57
  call.resolve([
58
- "status": self.getConsentStatusString(UMPConsentInformation.sharedInstance.consentStatus)
58
+ "status": self.getConsentStatusString(ConsentInformation.shared.consentStatus)
59
59
  ])
60
60
  }
61
61
  })
@@ -68,17 +68,17 @@ class ConsentExecutor: NSObject {
68
68
  }
69
69
 
70
70
  func resetConsentInfo(_ call: CAPPluginCall) {
71
- UMPConsentInformation.sharedInstance.reset()
71
+ ConsentInformation.shared.reset()
72
72
  call.resolve()
73
73
  }
74
74
 
75
- func getConsentStatusString(_ consentStatus: UMPConsentStatus) -> String {
75
+ func getConsentStatusString(_ consentStatus: ConsentStatus) -> String {
76
76
  switch consentStatus {
77
- case UMPConsentStatus.required:
77
+ case ConsentStatus.required:
78
78
  return "REQUIRED"
79
- case UMPConsentStatus.notRequired:
79
+ case ConsentStatus.notRequired:
80
80
  return "NOT_REQUIRED"
81
- case UMPConsentStatus.obtained:
81
+ case ConsentStatus.obtained:
82
82
  return "OBTAINED"
83
83
  default:
84
84
  return "UNKNOWN"
@@ -2,13 +2,13 @@ import Foundation
2
2
  import Capacitor
3
3
  import GoogleMobileAds
4
4
 
5
- class AdInterstitialExecutor: NSObject, GADFullScreenContentDelegate {
5
+ class AdInterstitialExecutor: NSObject, FullScreenContentDelegate {
6
6
  weak var plugin: AdMobPlugin?
7
- var interstitial: GADInterstitialAd!
7
+ var interstitial: InterstitialAd!
8
8
 
9
- func prepareInterstitial(_ call: CAPPluginCall, _ request: GADRequest, _ adUnitID: String) {
10
- GADInterstitialAd.load(
11
- withAdUnitID: adUnitID,
9
+ func prepareInterstitial(_ call: CAPPluginCall, _ request: Request, _ adUnitID: String) {
10
+ InterstitialAd.load(
11
+ with: adUnitID,
12
12
  request: request,
13
13
  completionHandler: { (ad, error) in
14
14
  if let error = error {
@@ -36,7 +36,7 @@ class AdInterstitialExecutor: NSObject, GADFullScreenContentDelegate {
36
36
  func showInterstitial(_ call: CAPPluginCall) {
37
37
  if let rootViewController = plugin?.getRootVC() {
38
38
  if let ad = self.interstitial {
39
- ad.present(fromRootViewController: rootViewController)
39
+ ad.present(from: rootViewController)
40
40
  call.resolve([:])
41
41
  } else {
42
42
  NSLog("Ad wasn't ready")
@@ -45,7 +45,7 @@ class AdInterstitialExecutor: NSObject, GADFullScreenContentDelegate {
45
45
  }
46
46
  }
47
47
 
48
- func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
48
+ func ad(_ ad: FullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
49
49
  NSLog("InterstitialFullScreenDelegate Ad failed to present full screen content with error \(error.localizedDescription).")
50
50
  self.plugin?.notifyListeners(InterstitialAdPluginEvents.FailedToShow.rawValue, data: [
51
51
  "code": 0,
@@ -53,12 +53,12 @@ class AdInterstitialExecutor: NSObject, GADFullScreenContentDelegate {
53
53
  ])
54
54
  }
55
55
 
56
- func adWillPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
56
+ func adWillPresentFullScreenContent(_ ad: FullScreenPresentingAd) {
57
57
  NSLog("InterstitialFullScreenDelegate Ad did present full screen content.")
58
58
  self.plugin?.notifyListeners(InterstitialAdPluginEvents.Showed.rawValue, data: [:])
59
59
  }
60
60
 
61
- func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) {
61
+ func adDidDismissFullScreenContent(_ ad: FullScreenPresentingAd) {
62
62
  NSLog("InterstitialFullScreenDelegate Ad did dismiss full screen content.")
63
63
  self.plugin?.notifyListeners(InterstitialAdPluginEvents.Dismissed.rawValue, data: [:])
64
64
  }
@@ -2,13 +2,13 @@ import Foundation
2
2
  import Capacitor
3
3
  import GoogleMobileAds
4
4
 
5
- class AdRewardExecutor: NSObject, GADFullScreenContentDelegate {
5
+ class AdRewardExecutor: NSObject, FullScreenContentDelegate {
6
6
  weak var plugin: AdMobPlugin?
7
- var rewardedAd: GADRewardedAd!
7
+ var rewardedAd: RewardedAd!
8
8
 
9
- func prepareRewardVideoAd(_ call: CAPPluginCall, _ request: GADRequest, _ adUnitID: String) {
10
- GADRewardedAd.load(
11
- withAdUnitID: adUnitID,
9
+ func prepareRewardVideoAd(_ call: CAPPluginCall, _ request: Request, _ adUnitID: String) {
10
+ RewardedAd.load(
11
+ with: adUnitID,
12
12
  request: request,
13
13
  completionHandler: { (ad, error) in
14
14
  if let error = error {
@@ -24,11 +24,11 @@ class AdRewardExecutor: NSObject, GADFullScreenContentDelegate {
24
24
  self.rewardedAd = ad
25
25
 
26
26
  if let providedOptions = call.getObject("ssv") {
27
- let ssvOptions = GADServerSideVerificationOptions()
27
+ let ssvOptions = ServerSideVerificationOptions()
28
28
 
29
29
  if let customData = providedOptions["customData"] as? String {
30
30
  NSLog("Sending Custom Data: \(customData) to SSV callback")
31
- ssvOptions.customRewardString = customData
31
+ ssvOptions.customRewardText = customData
32
32
  }
33
33
 
34
34
  if let userId = providedOptions["userId"] as? String {
@@ -53,7 +53,7 @@ class AdRewardExecutor: NSObject, GADFullScreenContentDelegate {
53
53
  func showRewardVideoAd(_ call: CAPPluginCall) {
54
54
  if let rootViewController = plugin?.getRootVC() {
55
55
  if let ad = self.rewardedAd {
56
- ad.present(fromRootViewController: rootViewController,
56
+ ad.present(from: rootViewController,
57
57
  userDidEarnRewardHandler: {
58
58
  let reward = ad.adReward
59
59
  self.plugin?.notifyListeners(RewardAdPluginEvents.Rewarded.rawValue, data: ["type": reward.type, "amount": reward.amount])
@@ -66,7 +66,7 @@ class AdRewardExecutor: NSObject, GADFullScreenContentDelegate {
66
66
  }
67
67
  }
68
68
 
69
- func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
69
+ func ad(_ ad: FullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
70
70
  NSLog("RewardFullScreenDelegate Ad failed to present full screen content with error \(error.localizedDescription).")
71
71
  self.plugin?.notifyListeners(RewardAdPluginEvents.FailedToShow.rawValue, data: [
72
72
  "code": 0,
@@ -74,12 +74,12 @@ class AdRewardExecutor: NSObject, GADFullScreenContentDelegate {
74
74
  ])
75
75
  }
76
76
 
77
- func adWillPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
77
+ func adWillPresentFullScreenContent(_ ad: FullScreenPresentingAd) {
78
78
  NSLog("RewardFullScreenDelegate Ad did present full screen content.")
79
79
  self.plugin?.notifyListeners(RewardAdPluginEvents.Showed.rawValue, data: [:])
80
80
  }
81
81
 
82
- func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) {
82
+ func adDidDismissFullScreenContent(_ ad: FullScreenPresentingAd) {
83
83
  NSLog("RewardFullScreenDelegate Ad did dismiss full screen content.")
84
84
  self.plugin?.notifyListeners(RewardAdPluginEvents.Dismissed.rawValue, data: [:])
85
85
  }
@@ -2,13 +2,13 @@ import Foundation
2
2
  import Capacitor
3
3
  import GoogleMobileAds
4
4
 
5
- class AdRewardInterstitialExecutor: NSObject, GADFullScreenContentDelegate {
5
+ class AdRewardInterstitialExecutor: NSObject, FullScreenContentDelegate {
6
6
  weak var plugin: AdMobPlugin?
7
- var rewardedInterstitialAd: GADRewardedInterstitialAd!
7
+ var rewardedInterstitialAd: RewardedInterstitialAd!
8
8
 
9
- func prepareRewardInterstitialAd(_ call: CAPPluginCall, _ request: GADRequest, _ adUnitID: String) {
10
- GADRewardedInterstitialAd.load(
11
- withAdUnitID: adUnitID,
9
+ func prepareRewardInterstitialAd(_ call: CAPPluginCall, _ request: Request, _ adUnitID: String) {
10
+ RewardedInterstitialAd.load(
11
+ with: adUnitID,
12
12
  request: request,
13
13
  completionHandler: { (ad, error) in
14
14
  if let error = error {
@@ -24,11 +24,11 @@ class AdRewardInterstitialExecutor: NSObject, GADFullScreenContentDelegate {
24
24
  self.rewardedInterstitialAd = ad
25
25
 
26
26
  if let providedOptions = call.getObject("ssv") {
27
- let ssvOptions = GADServerSideVerificationOptions()
27
+ let ssvOptions = ServerSideVerificationOptions()
28
28
 
29
29
  if let customData = providedOptions["customData"] as? String {
30
30
  NSLog("Sending Custom Data: \(customData) to SSV callback")
31
- ssvOptions.customRewardString = customData
31
+ ssvOptions.customRewardText = customData
32
32
  }
33
33
 
34
34
  if let userId = providedOptions["userId"] as? String {
@@ -53,7 +53,7 @@ class AdRewardInterstitialExecutor: NSObject, GADFullScreenContentDelegate {
53
53
  func showRewardInterstitialAd(_ call: CAPPluginCall) {
54
54
  if let rootViewController = plugin?.getRootVC() {
55
55
  if let ad = self.rewardedInterstitialAd {
56
- ad.present(fromRootViewController: rootViewController,
56
+ ad.present(from: rootViewController,
57
57
  userDidEarnRewardHandler: {
58
58
  let reward = ad.adReward
59
59
  self.plugin?.notifyListeners(RewardInterstitialAdPluginEvents.Rewarded.rawValue, data: ["type": reward.type, "amount": reward.amount])
@@ -66,7 +66,7 @@ class AdRewardInterstitialExecutor: NSObject, GADFullScreenContentDelegate {
66
66
  }
67
67
  }
68
68
 
69
- func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
69
+ func ad(_ ad: FullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
70
70
  NSLog("RewardFullScreenDelegate Ad failed to present full screen content with error \(error.localizedDescription).")
71
71
  self.plugin?.notifyListeners(RewardInterstitialAdPluginEvents.FailedToShow.rawValue, data: [
72
72
  "code": 0,
@@ -74,12 +74,12 @@ class AdRewardInterstitialExecutor: NSObject, GADFullScreenContentDelegate {
74
74
  ])
75
75
  }
76
76
 
77
- func adWillPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
77
+ func adWillPresentFullScreenContent(_ ad: FullScreenPresentingAd) {
78
78
  NSLog("RewardFullScreenDelegate Ad did present full screen content.")
79
79
  self.plugin?.notifyListeners(RewardInterstitialAdPluginEvents.Showed.rawValue, data: [:])
80
80
  }
81
81
 
82
- func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) {
82
+ func adDidDismissFullScreenContent(_ ad: FullScreenPresentingAd) {
83
83
  NSLog("RewardFullScreenDelegate Ad did dismiss full screen content.")
84
84
  self.plugin?.notifyListeners(RewardInterstitialAdPluginEvents.Dismissed.rawValue, data: [:])
85
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor-community/admob",
3
- "version": "7.0.2",
3
+ "version": "7.1.0-0",
4
4
  "description": "A native plugin for AdMob",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -49,7 +49,6 @@
49
49
  "@capacitor/android": "^7.0.0",
50
50
  "@capacitor/cli": "^7.0.0",
51
51
  "@capacitor/core": "^7.0.0",
52
- "@capacitor/docgen": "github:rdlabo/capacitor-docgen#feat/support_extends_build",
53
52
  "@capacitor/ios": "^7.0.0",
54
53
  "@ionic/eslint-config": "^0.4.0",
55
54
  "@ionic/prettier-config": "^4.0.0",
@@ -68,7 +67,8 @@
68
67
  "typescript": "~4.1.5"
69
68
  },
70
69
  "dependencies": {
71
- "@capacitor/core": "^7.0.0"
70
+ "@capacitor/core": "^7.0.0",
71
+ "@rdlabo/capacitor-docgen": "^0.4.1"
72
72
  },
73
73
  "lint-staged": {
74
74
  "*.{ts}": [