Skip to content

Commit bfb19d0

Browse files
authored
feat: google-mobile-ads (#622)
1 parent 5b4822a commit bfb19d0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+39414
-9
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- [@nativescript/fingerprint-auth](packages/fingerprint-auth/README.md)
1818
- [@nativescript/geolocation](packages/geolocation/README.md)
1919
- [@nativescript/google-maps](packages/google-maps/README.md)
20+
- [@nativescript/google-mobile-ads](packages/google-mobile-ads/README.md)
2021
- [@nativescript/google-signin](packages/google-signin/README.md)
2122
- [@nativescript/haptics](packages/haptics/README.md)
2223
- [@nativescript/imagepicker](packages/imagepicker/README.md)

apps/demo-angular/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"@nativescript/social-share": "file:../../dist/packages/social-share",
3737
"@nativescript/theme-switcher": "file:../../dist/packages/theme-switcher",
3838
"@nativescript/twitter": "file:../../dist/packages/twitter",
39-
"@nativescript/zip": "file:../../dist/packages/zip"
39+
"@nativescript/zip": "file:../../dist/packages/zip",
40+
"@nativescript/google-mobile-ads": "file:../../dist/packages/google-mobile-ads"
4041
},
4142
"devDependencies": {
4243
"@nativescript/android": "~8.8.0",

apps/demo-angular/src/app-routing.module.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const routes: Routes = [
2626
{ path: 'fingerprint-auth', loadChildren: () => import('./plugin-demos/fingerprint-auth.module').then((m) => m.FingerprintAuthModule) },
2727
{ path: 'geolocation', loadChildren: () => import('./plugin-demos/geolocation.module').then((m) => m.GeolocationModule) },
2828
{ path: 'google-maps', loadChildren: () => import('./plugin-demos/google-maps.module').then((m) => m.GoogleMapsModule) },
29+
{ path: 'google-mobile-ads', loadChildren: () => import('./plugin-demos/google-mobile-ads.module').then((m) => m.GoogleMobileAdsModule) },
2930
{ path: 'google-signin', loadChildren: () => import('./plugin-demos/google-signin.module').then((m) => m.GoogleSigninModule) },
3031
{ path: 'haptics', loadChildren: () => import('./plugin-demos/haptics.module').then((m) => m.HapticsModule) },
3132
{ path: 'imagepicker', loadChildren: () => import('./plugin-demos/imagepicker.module').then((m) => m.ImagepickerModule) },

apps/demo-angular/src/home.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ export class HomeComponent {
6363
{
6464
name: 'google-maps',
6565
},
66+
{
67+
name: 'google-mobile-ads',
68+
},
6669
{
6770
name: 'google-signin',
6871
},
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<ActionBar title="google-mobile-ads" class="action-bar"> </ActionBar>
2+
<StackLayout class="p-20">
3+
<ScrollView class="h-full">
4+
<StackLayout>
5+
<Button text="Test google-mobile-ads" (tap)="demoShared.testIt()" class="btn btn-primary"></Button>
6+
</StackLayout>
7+
</ScrollView>
8+
</StackLayout>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Component, NgZone } from '@angular/core';
2+
import { DemoSharedGoogleMobileAds } from '@demo/shared';
3+
import {} from '@nativescript/google-mobile-ads';
4+
5+
@Component({
6+
selector: 'demo-google-mobile-ads',
7+
templateUrl: 'google-mobile-ads.component.html',
8+
})
9+
export class GoogleMobileAdsComponent {
10+
demoShared: DemoSharedGoogleMobileAds;
11+
12+
constructor(private _ngZone: NgZone) {}
13+
14+
ngOnInit() {
15+
this.demoShared = new DemoSharedGoogleMobileAds();
16+
}
17+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
2+
import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular';
3+
import { GoogleMobileAdsComponent } from './google-mobile-ads.component';
4+
5+
@NgModule({
6+
imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: GoogleMobileAdsComponent }])],
7+
declarations: [GoogleMobileAdsComponent],
8+
schemas: [NO_ERRORS_SCHEMA],
9+
})
10+
export class GoogleMobileAdsModule {}

apps/demo-angular/tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
"@nativescript/google-maps": ["packages/google-maps/index.d.ts"],
4242
"@nativescript/google-maps/angular": ["packages/google-maps/angular/index.ts"],
4343
"@nativescript/contacts": ["packages/contacts/index.d.ts"],
44-
"@nativescript/*": ["../../dist/packages/*"]
44+
"@nativescript/*": ["../../dist/packages/*"],
45+
"@nativescript/google-mobile-ads": ["../../packages/google-mobile-ads/index.d.ts"],
46+
"@nativescript/google-mobile-ads/angular": ["../../packages/google-mobile-ads/angular/index.ts"]
4547
}
4648
},
4749
"files": ["./references.d.ts", "./src/main.ts", "./src/polyfills.ts"],

apps/demo/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
"@nativescript/social-share": "file:../../packages/social-share",
4040
"@nativescript/theme-switcher": "file:../../packages/theme-switcher",
4141
"@nativescript/twitter": "file:../../packages/twitter",
42-
"@nativescript/zip": "file:../../packages/zip"
42+
"@nativescript/zip": "file:../../packages/zip",
43+
"@nativescript/google-mobile-ads": "file:../../packages/google-mobile-ads"
4344
},
4445
"devDependencies": {
4546
"@nativescript/android": "~8.8.0",

apps/demo/src/main-page.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" class="page">
1+
2+
<Button text="google-mobile-ads" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/><Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" class="page">
23
<Page.actionBar>
34
<ActionBar title="Plugin Demos" icon="" class="action-bar"/>
45
</Page.actionBar>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Observable, EventData, Page } from '@nativescript/core';
2+
import { DemoSharedGoogleMobileAds } from '@demo/shared';
3+
import {} from '@nativescript/google-mobile-ads';
4+
5+
export function navigatingTo(args: EventData) {
6+
const page = <Page>args.object;
7+
page.bindingContext = new DemoModel();
8+
}
9+
10+
export class DemoModel extends DemoSharedGoogleMobileAds {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" class="page">
2+
<Page.actionBar>
3+
<ActionBar title="google-mobile-ads" icon="" class="action-bar">
4+
</ActionBar>
5+
</Page.actionBar>
6+
<StackLayout class="p-20">
7+
<ScrollView class="h-full">
8+
<StackLayout>
9+
<Button text="Test google-mobile-ads" tap="{{ testIt }}" class="btn btn-primary"/>
10+
11+
</StackLayout>
12+
</ScrollView>
13+
</StackLayout>
14+
</Page>

apps/demo/tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
"@nativescript/google-maps": ["../../packages/google-maps/index.d.ts"],
4444
"@nativescript/google-maps/angular": ["../../packages/google-maps/angular/index.ts"],
4545
"@nativescript/contacts": ["../../packages/contacts/index.d.ts"],
46-
"@nativescript/*": ["../../packages/*"]
46+
"@nativescript/*": ["../../packages/*"],
47+
"@nativescript/google-mobile-ads": ["../../packages/google-mobile-ads/index.d.ts"],
48+
"@nativescript/google-mobile-ads/angular": ["../../packages/google-mobile-ads/angular/index.ts"]
4749
}
4850
}
4951
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,6 @@
5858
"npx prettier --write"
5959
]
6060
},
61-
"dependencies": {}
61+
"dependencies": {},
62+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
6263
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
pod 'GoogleMaps', '~> 7.4.0'
1+
platform :ios, '14.0'
2+
pod 'GoogleMaps', '~> 8.4.0'
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"extends": ["../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*", "node_modules/**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"rules": {}
8+
},
9+
{
10+
"files": ["*.ts", "*.tsx"],
11+
"rules": {}
12+
},
13+
{
14+
"files": ["*.js", "*.jsx"],
15+
"rules": {}
16+
}
17+
]
18+
}

0 commit comments

Comments
 (0)