Skip to content

Commit 4f50767

Browse files
authored
docs: fix typos and clarify documentation (#2334)
Closes #2176. Closes #2156. Closes #2248. Closes #2264.
1 parent 882b254 commit 4f50767

File tree

5 files changed

+44
-34
lines changed

5 files changed

+44
-34
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# AngularFire
2-
The official Angular library for Firebase
2+
The official [Angular](https://angular.io/) library for [Firebase](https://firebase.google.com/).
33

44
```bash
55
ng add @angular/fire@next

docs/ionic/authentication.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ionic cordova plugin add cordova-plugin-customurlscheme
1010

1111
# Step 2: Add Firebase to your Ionic
1212

13-
**Install firebase to angular project**
13+
**Install Firebase to Angular project**
1414

1515
Follow [this tutorial](https://github.com/angular/angularfire2/blob/master/docs/install-and-setup.md) to make a basic setup for your Ionic project.
1616

@@ -19,7 +19,9 @@ Follow [this tutorial](https://github.com/angular/angularfire2/blob/master/docs/
1919
Go to [Firebase console](https://console.firebase.google.com/) then click **Add Firebase to your Android app** and follow the setup steps.
2020

2121

22-
# Step 3: Set up Firebase Authentication for Cordova ( summary from [firebase instruction](https://firebase.google.com/docs/auth/web/cordova))
22+
# Step 3: Set up Firebase Authentication for Cordova
23+
24+
*This is a summary from the [Firebase instructions](https://firebase.google.com/docs/auth/web/cordova).*
2325

2426
**Setup Dynamic Link**
2527
In the Firebase console, open the **Dynamic Links** section at bottom left panel, setup by their instruction
@@ -39,11 +41,11 @@ Go to [Firebase console](https://console.firebase.google.com/) then click **Add
3941
<preference name="AndroidLaunchMode" value="singleTask" />
4042
```
4143

42-
*Make sure your `<widget id="com.yourandroid.id" ... >` the same with android app's id you
43-
added in firebase*
44+
*Make sure your `<widget id="com.yourandroid.id" ... >` the same with Android app's id you
45+
added in Firebase.*
4446

45-
# Step 4: Add login code:
46-
at `login.service.ts` add this function:
47+
# Step 4: Add login code
48+
In `login.service.ts` add this function:
4749
```ts
4850

4951
import { AngularFireAuth } from '@angular/fire/auth';
@@ -59,12 +61,12 @@ export class AuthService {
5961
}
6062

6163
signInWithFacebook() {
62-
console.log('Sign in with google');
64+
console.log('Sign in with Facebook');
6365
return this.oauthSignIn(new firebase.auth.FacebookAuthProvider());
6466
}
6567

6668
signInWithGoogle() {
67-
console.log('Sign in with google');
69+
console.log('Sign in with Google');
6870
return this.oauthSignIn(new firebase.auth.GoogleAuthProvider());
6971
}
7072

@@ -75,8 +77,7 @@ export class AuthService {
7577
return this.afAuth.auth.signInWithRedirect(provider)
7678
.then(() => {
7779
return this.afAuth.auth.getRedirectResult().then( result => {
78-
// This gives you a Google Access Token.
79-
// You can use it to access the Google API.
80+
// This gives you an Access Token. You can use it to access the associated APIs.
8081
let token = result.credential.accessToken;
8182
// The signed-in user info.
8283
let user = result.user;
@@ -93,9 +94,11 @@ export class AuthService {
9394

9495
# Common problems
9596

96-
If you got error when build code like this:
97-
`UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'manifest' of undefined`
97+
If you get an error, when you build the code, that looks like this:
98+
```
99+
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'manifest' of undefined
100+
```
98101

99-
Please, using this fix from [issue](https://github.com/nordnet/cordova-universal-links-plugin/issues/134):
102+
Please take a look at the fix from [this issue](https://github.com/nordnet/cordova-universal-links-plugin/issues/134):
100103
> Making this change in 'cordova-universal-links-plugin/hooks/lib/android/manifestWriter.js' fixed this issue for me:
101104
> [b2c5784#diff-d5955d9f4d88b42e5efd7a3385be79e9](https://github.com/nordnet/cordova-universal-links-plugin/commit/b2c5784764225319648e26aa5d3f42ede6d1b289#diff-d5955d9f4d88b42e5efd7a3385be79e9)

docs/messaging/messaging.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@
44
55
### AngularFireMessaging is not compatible with the Angular Service Worker
66

7-
If you are using the Angular Service Worker, you are not currently able to use AngularFireMessaging. If you'd like this feature please file an issue in [either repository](https://github.com/angular/angular/tree/master/packages/service-worker). Your alternatives are to use [WorkboxJS](https://developers.google.com/web/tools/workbox/) or just simply use the Firebase Messaging Service Worker, which is detailed below.
7+
If you are using the Angular Service Worker, you are not currently able to use AngularFireMessaging.
8+
If you'd like this feature please add your 👍 to [this issue](https://github.com/angular/angular/issues/34352).
9+
10+
Your alternatives are to use
11+
- [WorkboxJS](https://developers.google.com/web/tools/workbox/)
12+
- The Firebase Messaging Service Worker, which is detailed below
813

914
### Import the `NgModule`
1015

11-
Push Notifications for AngularFire is contained in the `@angular/fire/messaging` module namespace. Import the `AngularFireMessagingModule` in your `NgModule`. This sets up the `AngularFireMessaging` service for dependency injection.
16+
Push Notifications for AngularFire are contained in the `@angular/fire/messaging` module namespace. Import the `AngularFireMessagingModule` in your `NgModule`. This sets up the `AngularFireMessaging` service for dependency injection.
1217

1318
```ts
1419
import { BrowserModule } from '@angular/platform-browser';
@@ -32,9 +37,9 @@ export class AppModule {}
3237

3338
### Setting up the Firebase Messaging Service Worker
3439

35-
There are two parts Firebase Messaging, a Service Worker and the DOM API. AngularFireMessaging allows you to request permission, get tokens, delete tokens, and subscribe to messages on the DOM side. To register to receive notifications you need to set up the Service Worker. [The official Firebase documentation for setting up the details exactly how to do that](https://firebase.google.com/docs/cloud-messaging/js/client).
40+
There are two parts to Firebase Messaging, a Service Worker and the DOM API. AngularFireMessaging allows you to request permission, get tokens, delete tokens, and subscribe to messages on the DOM side. To register to receive notifications you need to set up the Service Worker. [The official Firebase documentation for setting up the details exactly how to do that](https://firebase.google.com/docs/cloud-messaging/js/client).
3641

37-
You can either use the `firebase-messaging-sw.js` file provided in the docs or you can set your own Service Worker to import that script. Make sure to set up your `.angular-cli.json` file to copy over the Service Worker file:
42+
You can either use the `firebase-messaging-sw.js` file provided in the docs or you can set your own Service Worker to import that script. Make sure to set up your `angular.json` file to copy over the Service Worker file:
3843

3944
```json
4045
"assets": [
@@ -47,7 +52,7 @@ You can either use the `firebase-messaging-sw.js` file provided in the docs or y
4752

4853
### Requesting permission
4954

50-
Once you have the Firebase Messaging Service Worker setup and installed, you need to request permission to send a user notifications. While the browser will popup a UI for you, it is highly recommend to ask the user for permission with a custom UI and only ask when it makes sense. If you blindly ask for permission you have an extremely high chance of getting denied.
55+
Once you have the Firebase Messaging Service Worker set up and installed, you need to request permission to send a user notifications. While the browser will popup a UI for you, it is highly recommend to ask the user for permission with a custom UI and only ask when it makes sense. If you blindly ask for permission, you have an extremely high chance of getting denied or blocked.
5156

5257
```ts
5358
import { Component } from '@angular/core';
@@ -57,7 +62,7 @@ import { AngularFireMessaging } from '@angular/fire/messaging';
5762
selector: 'app-root',
5863
template: `
5964
<button (click)="requestPermission()">
60-
Hey this is a chat app, you should let us send you notifications for these reasons!
65+
Hello this is a chat app. You should let us send you notifications for this reason.
6166
</button>
6267
`
6368
})
@@ -84,7 +89,7 @@ import { mergeMapTo } from 'rxjs/operators';
8489
selector: 'app-root',
8590
template: `
8691
<button (click)="requestPermission()">
87-
Hey this is a chat app, you should let us send you notifications for these reasons!
92+
Hello this is a chat app. You should let us send you notifications for this reason.
8893
</button>
8994
`
9095
})
@@ -101,7 +106,7 @@ export class AppComponent {
101106
}
102107
```
103108

104-
Once you have a user's token, you need to save it to the server in order to send them notifications in response to events. Let's say ou want to send a push each time a user sends a chat message. Once a user grants permission, you can send the token to the Realtime Database or Cloud Firestore and associate it with a unique id, like a Firebase Auth UID. You can then create a Cloud Function trigger that looks up the user's token when a chat message is created.
109+
Once you have a user's token, you need to save it to the server in order to send them notifications in response to events. Let's say you want to send a push each time a user sends a chat message. Once a user grants permission, you can send the token to the Realtime Database or Cloud Firestore and associate it with a unique id, like a Firebase Auth UID. You can then create a Cloud Function trigger that looks up the user's token when a chat message is created.
105110

106111
### Shortcutting token requests
107112

@@ -115,7 +120,7 @@ import { AngularFireMessaging } from '@angular/fire/messaging';
115120
selector: 'app-root',
116121
template: `
117122
<button (click)="requestPermission()">
118-
Hey this is a chat app, you should let us send you notifications for these reasons!
123+
Hello this is a chat app. You should let us send you notifications for this reason.
119124
</button>
120125
`
121126
})
@@ -146,7 +151,7 @@ import { mergeMap } from 'rxjs/operators';
146151
selector: 'app-root',
147152
template: `
148153
<button (click)="deleteMyToken()">
149-
Delete my token plz
154+
Delete my token
150155
</button>
151156
`
152157
})
@@ -156,7 +161,7 @@ export class AppComponent {
156161
this.afMessaging.getToken
157162
.pipe(mergeMap(token => this.afMessaging.deleteToken(token)))
158163
.subscribe(
159-
(token) => { console.log('Deleted!'); },
164+
(token) => { console.log('Token deleted!'); },
160165
);
161166
}
162167
}

docs/remote-config/getting-started.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ budget: <T>(interval: number) => MonoTypeOperatorFunction<T>
4646
// scanToObject is for use with .changes
4747
scanToObject: () => OperatorFunction<Parameter, {[key: string]: string|undefined}>
4848

49-
// mapToObject is the same behavior are scanToObject but for use with .parameters,
49+
// mapToObject is the same behavior as scanToObject but for use with .parameters
5050
mapToObject: () => OperatorFunction<Parameter[], {[key: string]: string|undefined}>
5151

5252
SETTINGS = InjectionToken<remoteConfig.Settings>;
@@ -61,9 +61,9 @@ Using the `SETTINGS` DI Token (*default: {}*) will allow you to [configure Fireb
6161

6262
### Configure default values with `DEFAULTS`
6363

64-
Providing `DEFAULTS ({[key: string]: string | number | boolean})` has `AngularFireRemoteConfig` emit the provided defaults first, which allows you to count on Remote Config when the user is offline or in environments that the Remote Config service does not handle (i.e, Server Side Rendering).
64+
Providing `DEFAULTS ({[key: string]: string | number | boolean})` tells `AngularFireRemoteConfig` to emit the provided defaults first. This allows you to count on Remote Config when the user is offline or in environments that the Remote Config service does not handle (i.e. Server Side Rendering).
6565

66-
## Putting it all together:
66+
## Putting it all together
6767

6868
```ts
6969
@NgModule({
@@ -106,23 +106,25 @@ constructor(remoteConfig: AngularFireRemoteConfig) {
106106
remoteConfig.booleans.enableAwesome.subscribe(...); // boolean
107107
remoteConfig.numbers.titleBackgroundColor.subscribe(...); // number
108108

109-
// however those may emit more than once as the remote config cache fires and gets fresh values from the server
110-
// you can filter it out of .changes for more control:
109+
// however those may emit more than once as the remote config cache fires and gets fresh values
110+
// from the server. You can filter it out of .changes for more control:
111111
remoteConfig.changes.pipe(
112112
filter(param => param.key === 'titleBackgroundColor'),
113113
map(param => param.asString())
114114
// budget at most 800ms and return the freshest value possible in that time
115-
// our budget pipe is similar to timeout but won't error or abort the pending server fetch (it won't emit it, if the deadline is exceeded, but it will have been fetched so can use the freshest values on next subscription)
115+
// our budget pipe is similar to timeout but won't error or abort the pending server fetch
116+
// (it won't emit it, if the deadline is exceeded, but it will have been fetched so can use the
117+
// freshest values on next subscription)
116118
budget(800),
117119
last()
118120
).subscribe(...)
119121

120-
// just like .changes, but scanned as into an array
122+
// just like .changes, but scanned into an array
121123
remoteConfig.parameters.subscribe(all => ...);
122124

123125
// or make promisified firebase().remoteConfig() calls direct off AngularFireRemoteConfig
124126
// using our proxy
125127
remoteConfig.getAll().then(all => ...);
126128
remoteConfig.lastFetchStatus.then(status => ...);
127129
}
128-
```
130+
```

docs/rtdb/querying-lists.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ size$.next('small');
8181
import { Component } from '@angular/core';
8282
import { AngularFireDatabase, AngularFireAction } from '@angular/fire/database';
8383
import { Observable, Subscription, BehaviorSubject } from 'rxjs';
84-
import { switchMap } 'rxjs/operators';
84+
import { switchMap } from 'rxjs/operators';
8585
import 'firebase/database';
8686

8787
@Component({

0 commit comments

Comments
 (0)