Skip to content

Commit 535648a

Browse files
committed
fix(google-mobile-ads): index types
closes #625
1 parent cf16839 commit 535648a

File tree

5 files changed

+27
-28
lines changed

5 files changed

+27
-28
lines changed

packages/google-mobile-ads/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ The `@nativescript/google-mobile-ads` plugin currently supports loading and disp
1515
- [@nativescript/google-mobile-ads](#nativescriptgoogle-mobile-ads)
1616
- [Contents](#contents)
1717
- [Installation](#installation)
18-
- [Setup Admob for iOS](#setup-admob-for-ios)
19-
- [Setup Admob for Android](#setup-admob-for-android)
18+
- [Setup Mobile Ads for iOS](#setup-mobile-ads-for-ios)
19+
- [Setup Mobile Ads for Android](#setup-mobile-ads-for-android)
2020
- [Use @nativescript/google-mobile-ads](#use-nativescriptgoogle-mobile-ads)
2121
- [1. Initialize the Mobile Ads SDK](#1-initialize-the-mobile-ads-sdk)
2222
- [2. Add your preferred ad format to the app](#2-add-your-preferred-ad-format-to-the-app)
@@ -58,7 +58,7 @@ To install `@nativescript/google-mobile-ads`, run the following command in the r
5858
npm install @nativescript/google-mobile-ads
5959
```
6060

61-
## Setup Admob for iOS
61+
## Setup Mobile Ads for iOS
6262

6363
Update your `Info.plist` file at `App_Resources/iOS` with a `GADApplicationIdentifier` key with a string value of your AdMob app ID ([identified in the AdMob UI](https://support.google.com/admob/answer/7356431)).
6464

@@ -76,7 +76,7 @@ Also add the `NSUserTrackingUsageDescription` key.
7676

7777
For more information about configuring the `Info.plist` and setting up your App ID, see [Update your Info.plist](https://developers.google.com/admob/ios/quick-start#update%5C_your%5C_infoplist).
7878

79-
## Setup Admob for Android
79+
## Setup Mobile Ads for Android
8080

8181
Add AdMob App ID ([identified in the AdMob UI](https://support.google.com/admob/answer/7356431)) to the app's `AndroidManifest.xml` file, found at `App_Resources/Android/src/main`. Failure to do so will result in a crash on app launch. Add the ID by adding a `<meta-data>` tag with name `com.google.android.gms.ads.APPLICATION_ID`, as shown below. For `android:value` insert your own AdMob App ID in quotes.
8282

@@ -169,14 +169,14 @@ export function loadBanner(args) {
169169

170170
#### Add Banner ad in NativeScript Angular
171171

172-
Register the `BannerAd` view by adding its `AdmobModule` to the `imports` array of the `@NgModule` decorator of the component where you want to use the view.
172+
Register the `BannerAd` view by adding its `MobileAdsModule` to the `imports` array of the `@NgModule` decorator of the component where you want to use the view.
173173

174174
```ts
175-
import { AdmobModule } from '@nativescript/google-mobile-ads/angular';
175+
import { MobileAdsModule } from '@nativescript/google-mobile-ads/angular';
176176

177177
@NgModule({
178178
imports: [
179-
AdmobModule
179+
MobileAdsModule
180180
],
181181
declarations: [
182182
AppComponent
@@ -201,11 +201,11 @@ Register the `BannerAd` view in the `app.ts` file as follows:
201201

202202
```ts
203203
import { createApp } from 'nativescript-vue';
204-
import Admob from '@nativescript/google-mobile-ads/vue';
204+
import MobileAds from '@nativescript/google-mobile-ads/vue';
205205
import Home from './components/Home.vue';
206206

207207
const app = createApp(Home);
208-
app.use(Admob);
208+
app.use(MobileAds);
209209
```
210210

211211
And then add it to markup as follows. The `BannerAd` requires the following attributes to be set:
@@ -424,7 +424,7 @@ To add a Native ad to your {N} Core app, follow these steps:
424424

425425
```xml
426426
<Page xmlns:ui="@nativescript/google-mobile-ads">
427-
<ActionBar title="Admob" />
427+
<ActionBar title="Mobile Ads" />
428428
<StackLayout>
429429
<ui:NativeAdView height="400" loaded="{{nativeAdLoaded}}" />
430430
</StackLayout>
@@ -709,7 +709,7 @@ If the tags to enable the Child-directed setting and `tagForUnderAgeOfConsent`ar
709709

710710
This setting can be set via `RequestConfiguration.maxAdContentRating`:
711711

712-
AdMob ads returned for these requests have a content rating at or below that level. The possible values for this network extra are based on [digital content label classifications](https://support.google.com/admob/answer/7562142), and should be one of the following MaxAdContentRating objects:
712+
Mobile ads returned for these requests have a content rating at or below that level. The possible values for this network extra are based on [digital content label classifications](https://support.google.com/admob/answer/7562142), and should be one of the following MaxAdContentRating objects:
713713

714714
- MaxAdContentRating.G
715715
- MaxAdContentRating.PG

packages/google-mobile-ads/angular/index.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ export * from './media-view-directive';
1313
declarations: [BannerAdDirective, NativeAdViewDirective, MediaViewDirective],
1414
exports: [BannerAdDirective, NativeAdViewDirective, MediaViewDirective],
1515
})
16-
// @ts-ignore
17-
export class AdmobModule {}
16+
export class MobileAdsModule {}
1817

19-
registerElement('NativeAdView', () => require('@nativescript/firebase-admob').NativeAdView);
20-
registerElement('BannerAd', () => require('@nativescript/firebase-admob').BannerAd);
21-
registerElement('MediaView', () => require('@nativescript/firebase-admob').MediaView);
18+
registerElement('NativeAdView', () => require('@nativescript/google-mobile-ads').NativeAdView);
19+
registerElement('BannerAd', () => require('@nativescript/google-mobile-ads').BannerAd);
20+
registerElement('MediaView', () => require('@nativescript/google-mobile-ads').MediaView);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"name": "nativescript-firebase-admob-angular"
2+
"name": "nativescript-google-mobile-ads-angular"
33
}

packages/google-mobile-ads/angular/tsconfig.angular.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"types": ["node"],
55
"baseUrl": ".",
66
"paths": {
7-
"@nativescript/firebase-admob": ["../../../dist/packages/firebase-admob"]
7+
"@nativescript/google-mobile-ads": ["../../../dist/packages/google-mobile-ads"]
88
},
99
"outDir": "../../../dist/out-tsc",
1010
"declarationDir": "../../../dist/out-tsc"

packages/google-mobile-ads/index.d.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IAdmob, IInterstitialAd, IRewardedAd, BannerAdBase, IRewardedInterstitialAd, RewardedAdEventType, MaxAdContentRating, ServerSideVerificationOptions } from './common';
1+
import { IInterstitialAd, IRewardedAd, BannerAdBase, BannerAdSizeBase, IRewardedInterstitialAd, RewardedAdEventType, MaxAdContentRating, ServerSideVerificationOptions } from './common';
22

33
export { MaxAdContentRating, RewardedAdEventType };
44

@@ -173,11 +173,11 @@ export declare class BannerAd extends BannerAdBase {
173173

174174
isLoading(): boolean;
175175

176-
on(event: 'adClicked', callback: (args: any) => void, thisArg?: any);
177-
on(event: 'adLoaded', callback: (args: any) => void, thisArg?: any);
178-
on(event: 'adClosed', callback: (args: any) => void, thisArg?: any);
179-
on(event: 'adImpression', callback: (args: any) => void, thisArg?: any);
180-
on(event: 'adFailedToLoad', callback: (args: any) => void, thisArg?: any);
176+
on(event: 'adClicked', callback: (args: any) => void, thisArg?: any): any;
177+
on(event: 'adLoaded', callback: (args: any) => void, thisArg?: any): any;
178+
on(event: 'adClosed', callback: (args: any) => void, thisArg?: any): any;
179+
on(event: 'adImpression', callback: (args: any) => void, thisArg?: any): any;
180+
on(event: 'adFailedToLoad', callback: (args: any) => void, thisArg?: any): any;
181181
}
182182

183183
export declare class BannerAdSize extends BannerAdSizeBase {
@@ -201,21 +201,21 @@ export declare class BannerAdSize extends BannerAdSizeBase {
201201

202202
static readonly SEARCH: BannerAdSize;
203203

204-
static createAnchoredAdaptiveBanner(width: number, orientation: 'portrait' | 'landscape' | 'device' = 'device'): BannerAdSize;
204+
static createAnchoredAdaptiveBanner(width: number, orientation: 'portrait' | 'landscape' | 'device'): BannerAdSize;
205205

206-
static createInLineAdaptiveBanner(width: number, maxHeight: number = 0, orientation: 'portrait' | 'landscape' | 'device' = 'device'): BannerAdSize;
206+
static createInLineAdaptiveBanner(width: number, maxHeight: number, orientation: 'portrait' | 'landscape' | 'device'): BannerAdSize;
207207

208208
readonly native: any;
209209
readonly android: any;
210210
readonly ios: any;
211211
}
212212

213-
export declare class Admob implements IAdmob {
213+
export declare class MobileAds implements IMobileAds {
214214
readonly app: any;
215215

216216
static init(): Promise<{ [key: string]: AdapterStatus }>;
217217

218-
static getInstance(): Admob;
218+
static getInstance(): MobileAds;
219219

220220
requestConfiguration: RequestConfiguration;
221221

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy