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

Commit 9bc466e

Browse files
EddyVerbruggeneddyverbruggen
authored andcommitted
send push notifications from app + small callback fix for push #286
1 parent 4197e04 commit 9bc466e

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

firebase.android.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ var GOOGLE_SIGNIN_INTENT_ID = 123;
2424
var extras = intent.getExtras();
2525
if (extras !== null) {
2626
var result = {
27-
foreground: false
27+
foreground: false,
28+
data: {}
2829
};
2930

3031
var iterator = extras.keySet().iterator();
3132
while (iterator.hasNext()) {
3233
var key = iterator.next();
3334
if (key !== "from" && key !== "collapse_key") {
3435
result[key] = extras.get(key);
36+
result.data[key] = extras.get(key);
3537
}
3638
}
3739

@@ -339,7 +341,7 @@ firebase.analytics.logEvent = function (arg) {
339341

340342
resolve();
341343
} catch (ex) {
342-
console.log("Error in firebase.logEvent: " + ex);
344+
console.log("Error in firebase.analytics.logEvent: " + ex);
343345
reject(ex);
344346
}
345347
});
@@ -361,7 +363,7 @@ firebase.analytics.setUserProperty = function (arg) {
361363

362364
resolve();
363365
} catch (ex) {
364-
console.log("Error in firebase.setUserProperty: " + ex);
366+
console.log("Error in firebase.analytics.setUserProperty: " + ex);
365367
reject(ex);
366368
}
367369
});

firebase.ios.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ firebase._processPendingNotifications = function() {
179179
userInfoJSON.title = userInfoJSON.aps.alert.title;
180180
userInfoJSON.body = userInfoJSON.aps.alert.body;
181181
}
182+
// also, to make the ts.d happy copy all properties to a data element
183+
userInfoJSON.data = userInfoJSON;
182184
// cleanup
183185
userInfoJSON.aps = undefined;
184186
firebase._receivedNotificationCallback(userInfoJSON);

index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,10 @@ export interface Message {
358358
* Not available on Android when the notification was received in the background.
359359
*/
360360
title?: string;
361+
/**
362+
* Any other data you may have added to the notification.
363+
*/
364+
data: any;
361365
}
362366

363367
export interface ProgressStatus {

0 commit comments

Comments
 (0)