Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 5c77966

Browse files
Allow using this plugin as a standalone 'push notification client' - without loading the Firebase SDK #909
1 parent deb6878 commit 5c77966

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

demo-push/app/push-view-model.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,10 @@ export class PushViewModel extends Observable {
187187
// Whether you want this plugin to automatically display the notifications or just notify the callback. Currently used on iOS only. Default true.
188188
showNotifications: true,
189189

190-
// Whether you want this plugin to always handle the notifications when the app is in foreground. Currently used on iOS only. Default false.
191-
showNotificationsWhenInForeground: true
190+
// Whether you want this plugin to always handle the notifications when the app is in foreground.
191+
// Currently used on iOS only. Default false.
192+
// When false, you can still force showing it when the app is in the foreground by adding 'showWhenInForeground' to the notification as mentioned in the readme.
193+
showNotificationsWhenInForeground: false
192194
}).then(() => console.log("Registered for push"));
193195
}
194196

docs/NON_FIREBASE_MESSAGING.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -171,27 +171,25 @@ model.onNotificationActionTakenCallback = (actionIdentifier: string, message: Me
171171
messaging.registerForInteractivePush(model);
172172
```
173173

174-
To send an interactive push, add the `"click_action"` property to the notification, with a value corresponding to the `category` defined in the model you've registered in the app.
174+
To send an interactive push, add the `"category"` property to the notification, with a value corresponding to the `category` defined in the model you've registered in the app.
175175
The payload to trigger the notification in the screenshots above is:
176176

177177
```json
178178
{
179-
"notification": {
180-
"title": "I DEMAND YOUR ATTENTION",
181-
"subtitle": "Just kidding, but not really",
182-
"text": "Sorry to bother you I meant, please pick an option below..",
183-
"click_action": "GENERAL",
184-
"badge": "1",
179+
"aps": {
180+
"alert": {
181+
"title": "Realtime Custom Push Notifications",
182+
"subtitle": "Now with iOS 10 support!",
183+
"body": "Add multimedia content to your notifications"
184+
},
185185
"sound": "default",
186-
"showWhenInForeground": true // this can go either here..
187-
},
188-
"showWhenInForeground": true, // .. or here
189-
"content_available": false,
190-
"data": {
191-
"foo": "bar"
192-
},
193-
"priority": "High",
194-
"to": "DEVICE_PUSH_KEY>"
186+
"badge": 1,
187+
"category": "GENERAL",
188+
"showWhenInForeground": true,
189+
"data": {
190+
"foo": "bar"
191+
}
192+
}
195193
}
196194
```
197195

src/firebase.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ export interface MessagingOptions {
9090
* For Messaging (Push Notifications). Whether you want this plugin to automatically display the notifications or just notify the callback.
9191
* Currently used on iOS only. Default true.
9292
*/
93-
showNotifications: boolean;
93+
showNotifications?: boolean;
9494

9595
/**
9696
* For Messaging (Push Notifications). Whether you want this plugin to always handle the notifications when the app is in foreground.
9797
* Currently used on iOS only. Default false.
9898
*/
99-
showNotificationsWhenInForeground: boolean;
99+
showNotificationsWhenInForeground?: boolean;
100100
}
101101

102102
/**

0 commit comments

Comments
 (0)