Skip to content

Commit a53d5a9

Browse files
committed
feat: support external push provider
closes #7
1 parent c746104 commit a53d5a9

File tree

107 files changed

+2835
-533
lines changed

Some content is hidden

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

107 files changed

+2835
-533
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- [@nativescript/firebase-in-app-messaging](packages/firebase-in-app-messaging/README.md)
1313
- [@nativescript/firebase-installations](packages/firebase-installations/README.md)
1414
- [@nativescript/firebase-messaging](packages/firebase-messaging/README.md)
15+
- [@nativescript/firebase-messaging-core](packages/firebase-messaging-core/README.md)
1516
- [@nativescript/firebase-performance](packages/firebase-performance/README.md)
1617
- [@nativescript/firebase-remote-config](packages/firebase-remote-config/README.md)
1718
- [@nativescript/firebase-storage](packages/firebase-storage/README.md)

apps/demo-angular/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"@nativescript/firebase-dynamic-links": "file:../../dist/packages/firebase-dynamic-links",
1919
"@nativescript/firebase-messaging": "file:../../dist/packages/firebase-messaging",
2020
"@nativescript/firebase-functions": "file:../../dist/packages/firebase-functions",
21-
"@nativescript/firebase-app-check-debug": "file:../../dist/packages/firebase-app-check-debug"
21+
"@nativescript/firebase-app-check-debug": "file:../../dist/packages/firebase-app-check-debug",
22+
"@nativescript/firebase-messaging-core": "file:../../dist/packages/firebase-messaging-core"
2223
},
2324
"devDependencies": {
2425
"@nativescript/android": "~8.2.0",

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

+20-19
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,26 @@ import { NativeScriptRouterModule } from '@nativescript/angular';
55
import { HomeComponent } from './home.component';
66

77
const routes: Routes = [
8-
{ path: '', redirectTo: '/home', pathMatch: 'full' },
9-
{ path: 'home', component: HomeComponent },
10-
{ path: 'firebase-admob', loadChildren: () => import('./plugin-demos/firebase-admob.module').then(m => m.FirebaseAdmobModule) },
11-
{ path: 'firebase-analytics', loadChildren: () => import('./plugin-demos/firebase-analytics.module').then(m => m.FirebaseAnalyticsModule) },
12-
{ path: 'firebase-app-check', loadChildren: () => import('./plugin-demos/firebase-app-check.module').then(m => m.FirebaseAppCheckModule) },
13-
{ path: 'firebase-app-check-debug', loadChildren: () => import('./plugin-demos/firebase-app-check-debug.module').then(m => m.FirebaseAppCheckDebugModule) },
14-
{ path: 'firebase-auth', loadChildren: () => import('./plugin-demos/firebase-auth.module').then(m => m.FirebaseAuthModule) },
15-
{ path: 'firebase-core', loadChildren: () => import('./plugin-demos/firebase-core.module').then(m => m.FirebaseCoreModule) },
16-
{ path: 'firebase-crashlytics', loadChildren: () => import('./plugin-demos/firebase-crashlytics.module').then(m => m.FirebaseCrashlyticsModule) },
17-
{ path: 'firebase-database', loadChildren: () => import('./plugin-demos/firebase-database.module').then(m => m.FirebaseDatabaseModule) },
18-
{ path: 'firebase-dynamic-links', loadChildren: () => import('./plugin-demos/firebase-dynamic-links.module').then(m => m.FirebaseDynamicLinksModule) },
19-
{ path: 'firebase-firestore', loadChildren: () => import('./plugin-demos/firebase-firestore.module').then(m => m.FirebaseFirestoreModule) },
20-
{ path: 'firebase-functions', loadChildren: () => import('./plugin-demos/firebase-functions.module').then(m => m.FirebaseFunctionsModule) },
21-
{ path: 'firebase-in-app-messaging', loadChildren: () => import('./plugin-demos/firebase-in-app-messaging.module').then(m => m.FirebaseInAppMessagingModule) },
22-
{ path: 'firebase-installations', loadChildren: () => import('./plugin-demos/firebase-installations.module').then(m => m.FirebaseInstallationsModule) },
23-
{ path: 'firebase-messaging', loadChildren: () => import('./plugin-demos/firebase-messaging.module').then(m => m.FirebaseMessagingModule) },
24-
{ path: 'firebase-performance', loadChildren: () => import('./plugin-demos/firebase-performance.module').then(m => m.FirebasePerformanceModule) },
25-
{ path: 'firebase-remote-config', loadChildren: () => import('./plugin-demos/firebase-remote-config.module').then(m => m.FirebaseRemoteConfigModule) },
26-
{ path: 'firebase-storage', loadChildren: () => import('./plugin-demos/firebase-storage.module').then(m => m.FirebaseStorageModule) }
8+
{ path: '', redirectTo: '/home', pathMatch: 'full' },
9+
{ path: 'home', component: HomeComponent },
10+
{ path: 'firebase-admob', loadChildren: () => import('./plugin-demos/firebase-admob.module').then((m) => m.FirebaseAdmobModule) },
11+
{ path: 'firebase-analytics', loadChildren: () => import('./plugin-demos/firebase-analytics.module').then((m) => m.FirebaseAnalyticsModule) },
12+
{ path: 'firebase-app-check', loadChildren: () => import('./plugin-demos/firebase-app-check.module').then((m) => m.FirebaseAppCheckModule) },
13+
{ path: 'firebase-app-check-debug', loadChildren: () => import('./plugin-demos/firebase-app-check-debug.module').then((m) => m.FirebaseAppCheckDebugModule) },
14+
{ path: 'firebase-auth', loadChildren: () => import('./plugin-demos/firebase-auth.module').then((m) => m.FirebaseAuthModule) },
15+
{ path: 'firebase-core', loadChildren: () => import('./plugin-demos/firebase-core.module').then((m) => m.FirebaseCoreModule) },
16+
{ path: 'firebase-crashlytics', loadChildren: () => import('./plugin-demos/firebase-crashlytics.module').then((m) => m.FirebaseCrashlyticsModule) },
17+
{ path: 'firebase-database', loadChildren: () => import('./plugin-demos/firebase-database.module').then((m) => m.FirebaseDatabaseModule) },
18+
{ path: 'firebase-dynamic-links', loadChildren: () => import('./plugin-demos/firebase-dynamic-links.module').then((m) => m.FirebaseDynamicLinksModule) },
19+
{ path: 'firebase-firestore', loadChildren: () => import('./plugin-demos/firebase-firestore.module').then((m) => m.FirebaseFirestoreModule) },
20+
{ path: 'firebase-functions', loadChildren: () => import('./plugin-demos/firebase-functions.module').then((m) => m.FirebaseFunctionsModule) },
21+
{ path: 'firebase-in-app-messaging', loadChildren: () => import('./plugin-demos/firebase-in-app-messaging.module').then((m) => m.FirebaseInAppMessagingModule) },
22+
{ path: 'firebase-installations', loadChildren: () => import('./plugin-demos/firebase-installations.module').then((m) => m.FirebaseInstallationsModule) },
23+
{ path: 'firebase-messaging', loadChildren: () => import('./plugin-demos/firebase-messaging.module').then((m) => m.FirebaseMessagingModule) },
24+
{ path: 'firebase-messaging-core', loadChildren: () => import('./plugin-demos/firebase-messaging-core.module').then((m) => m.FirebaseMessagingCoreModule) },
25+
{ path: 'firebase-performance', loadChildren: () => import('./plugin-demos/firebase-performance.module').then((m) => m.FirebasePerformanceModule) },
26+
{ path: 'firebase-remote-config', loadChildren: () => import('./plugin-demos/firebase-remote-config.module').then((m) => m.FirebaseRemoteConfigModule) },
27+
{ path: 'firebase-storage', loadChildren: () => import('./plugin-demos/firebase-storage.module').then((m) => m.FirebaseStorageModule) },
2728
];
2829

2930
@NgModule({

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

+56-53
Original file line numberDiff line numberDiff line change
@@ -6,56 +6,59 @@ import { Component } from '@angular/core';
66
})
77
export class HomeComponent {
88
demos = [
9-
{
10-
name: 'firebase-admob'
11-
},
12-
{
13-
name: 'firebase-analytics'
14-
},
15-
{
16-
name: 'firebase-app-check'
17-
},
18-
{
19-
name: 'firebase-app-check-debug'
20-
},
21-
{
22-
name: 'firebase-auth'
23-
},
24-
{
25-
name: 'firebase-core'
26-
},
27-
{
28-
name: 'firebase-crashlytics'
29-
},
30-
{
31-
name: 'firebase-database'
32-
},
33-
{
34-
name: 'firebase-dynamic-links'
35-
},
36-
{
37-
name: 'firebase-firestore'
38-
},
39-
{
40-
name: 'firebase-functions'
41-
},
42-
{
43-
name: 'firebase-in-app-messaging'
44-
},
45-
{
46-
name: 'firebase-installations'
47-
},
48-
{
49-
name: 'firebase-messaging'
50-
},
51-
{
52-
name: 'firebase-performance'
53-
},
54-
{
55-
name: 'firebase-remote-config'
56-
},
57-
{
58-
name: 'firebase-storage'
59-
}
60-
];
61-
}
9+
{
10+
name: 'firebase-admob',
11+
},
12+
{
13+
name: 'firebase-analytics',
14+
},
15+
{
16+
name: 'firebase-app-check',
17+
},
18+
{
19+
name: 'firebase-app-check-debug',
20+
},
21+
{
22+
name: 'firebase-auth',
23+
},
24+
{
25+
name: 'firebase-core',
26+
},
27+
{
28+
name: 'firebase-crashlytics',
29+
},
30+
{
31+
name: 'firebase-database',
32+
},
33+
{
34+
name: 'firebase-dynamic-links',
35+
},
36+
{
37+
name: 'firebase-firestore',
38+
},
39+
{
40+
name: 'firebase-functions',
41+
},
42+
{
43+
name: 'firebase-in-app-messaging',
44+
},
45+
{
46+
name: 'firebase-installations',
47+
},
48+
{
49+
name: 'firebase-messaging',
50+
},
51+
{
52+
name: 'firebase-messaging-core',
53+
},
54+
{
55+
name: 'firebase-performance',
56+
},
57+
{
58+
name: 'firebase-remote-config',
59+
},
60+
{
61+
name: 'firebase-storage',
62+
},
63+
];
64+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<ActionBar title="firebase-messaging-core" class="action-bar"> </ActionBar>
2+
<StackLayout class="p-20">
3+
<ScrollView class="h-full">
4+
<StackLayout>
5+
<Button text="Test firebase-messaging-core" (tap)="demoShared.testIt()" class="btn btn-primary"></Button>
6+
</StackLayout>
7+
</ScrollView>
8+
</StackLayout>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Component, NgZone } from '@angular/core';
2+
import { DemoSharedFirebaseMessagingCore } from '@demo/shared';
3+
import {} from '@nativescript/firebase-messaging-core';
4+
5+
@Component({
6+
selector: 'demo-firebase-messaging-core',
7+
templateUrl: 'firebase-messaging-core.component.html',
8+
})
9+
export class FirebaseMessagingCoreComponent {
10+
demoShared: DemoSharedFirebaseMessagingCore;
11+
12+
constructor(private _ngZone: NgZone) {}
13+
14+
ngOnInit() {
15+
this.demoShared = new DemoSharedFirebaseMessagingCore();
16+
}
17+
}
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 { FirebaseMessagingCoreComponent } from './firebase-messaging-core.component';
4+
5+
@NgModule({
6+
imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: FirebaseMessagingCoreComponent }])],
7+
declarations: [FirebaseMessagingCoreComponent],
8+
schemas: [NO_ERRORS_SCHEMA],
9+
})
10+
export class FirebaseMessagingCoreModule {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<template>
2+
<Page>
3+
<ActionBar>
4+
<Label text="firebase-messaging-core"/>
5+
</ActionBar>
6+
7+
<GridLayout>
8+
<Button class="info" :text="message"/>
9+
</GridLayout>
10+
</Page>
11+
</template>
12+
13+
<script lang="ts">
14+
import Vue from "nativescript-vue";
15+
import { DemoSharedFirebaseMessagingCore } from '@demo/shared';
16+
import { } from '@nativescript/firebase-messaging-core';
17+
18+
export default Vue.extend({
19+
computed: {
20+
message() {
21+
return "Test firebase-messaging-core";
22+
}
23+
}
24+
});
25+
</script>
26+
27+
<style scoped lang="scss">
28+
29+
.info {
30+
font-size: 20;
31+
horizontal-align: center;
32+
vertical-align: center;
33+
}
34+
</style>

apps/demo-vue/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"@nativescript/firebase-performance": "file:../../packages/firebase-performance",
2020
"@nativescript/firebase-remote-config": "file:../../packages/firebase-remote-config",
2121
"@nativescript/firebase-storage": "file:../../packages/firebase-storage",
22-
"@nativescript/firebase-app-check-debug": "file:../../packages/firebase-app-check-debug"
22+
"@nativescript/firebase-app-check-debug": "file:../../packages/firebase-app-check-debug",
23+
"@nativescript/firebase-messaging-core": "file:../../packages/firebase-messaging-core"
2324
},
2425
"devDependencies": {
2526
"@nativescript/android": "~8.2.0",

apps/demo/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"@nativescript/firebase-remote-config": "file:../../packages/firebase-remote-config",
2323
"@nativescript/firebase-storage": "file:../../packages/firebase-storage",
2424
"@nativescript/google-signin": "^1.0.0-alpha.9",
25-
"@nativescript/firebase-app-check-debug": "file:../../packages/firebase-app-check-debug"
25+
"@nativescript/firebase-app-check-debug": "file:../../packages/firebase-app-check-debug",
26+
"@nativescript/firebase-messaging-core": "file:../../packages/firebase-messaging-core"
2627
},
2728
"devDependencies": {
2829
"@nativescript/android": "~8.2.0",

apps/demo/src/main-page.xml

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
12
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" class="page">
3+
<Button text="firebase-messaging-core" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
24
<Page.actionBar>
35
<ActionBar title="Plugin Demos" icon="" class="action-bar"/>
46
</Page.actionBar>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Observable, EventData, Page } from '@nativescript/core';
2+
import { DemoSharedFirebaseMessagingCore } from '@demo/shared';
3+
import {} from '@nativescript/firebase-messaging-core';
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 DemoSharedFirebaseMessagingCore {}
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="firebase-messaging-core" 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 firebase-messaging-core" tap="{{ testIt }}" class="btn btn-primary"/>
10+
11+
</StackLayout>
12+
</ScrollView>
13+
</StackLayout>
14+
</Page>

packages/firebase-core/common.d.ts

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
export interface IFirebaseOptions {
2+
apiKey?: string;
3+
gcmSenderId?: string;
4+
androidClientId?: string;
5+
appGroupId?: string;
6+
bundleId?: string;
7+
clientId?: string;
8+
databaseURL?: string;
9+
deepLinkURLScheme?: string;
10+
googleAppId?: string;
11+
projectId?: string;
12+
storageBucket?: string;
13+
trackingId?: string;
14+
}
15+
export interface FirebaseConfig {
16+
automaticDataCollectionEnabled?: boolean;
17+
automaticResourceManagement?: boolean;
18+
name?: string;
19+
}

packages/firebase-installations/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/firebase-installations",
3-
"version": "2.0.2",
3+
"version": "2.1.0",
44
"description": "NativeScript Firebase - Installations",
55
"main": "index",
66
"typings": "index.d.ts",
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+
}
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# @nativescript/firebase-messaging-core
2+
3+
```javascript
4+
ns plugin add @nativescript/firebase-messaging-core
5+
```
6+
7+
## Usage
8+
9+
// TODO
10+
11+
## License
12+
13+
Apache License Version 2.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export declare const enum AuthorizationStatus {
2+
AUTHORIZED = 0,
3+
DENIED = 1,
4+
NOT_DETERMINED = 2,
5+
PROVISIONAL = 3,
6+
EPHEMERAL = 4,
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export const enum AuthorizationStatus {
2+
AUTHORIZED,
3+
DENIED,
4+
NOT_DETERMINED,
5+
PROVISIONAL,
6+
EPHEMERAL,
7+
}

0 commit comments

Comments
 (0)