[android,js] misc messaging

This commit is contained in:
Salakar 2017-03-21 11:26:16 +00:00
parent 605a7515aa
commit 7650ae42e4
2 changed files with 17 additions and 5 deletions

View File

@ -219,7 +219,8 @@ public class RNFirebaseLocalMessagingHelper {
return; return;
} }
Long fireDate = bundle.getLong("fire_date", Math.round(bundle.getDouble("fire_date"))); Long fireDate = Math.round(bundle.getDouble("fire_date"));
if (fireDate == 0) { if (fireDate == 0) {
Log.e(TAG, "failed to schedule notification because fire date is missing"); Log.e(TAG, "failed to schedule notification because fire date is missing");
return; return;

View File

@ -175,10 +175,21 @@ export default class Messaging extends Base {
} }
/** /**
* Set notification count badge number * Request notification permission
* @platforms ios
* @returns {*|Promise.<*>}
*/ */
setBadgeNumber() { requestPermissions() {
FirebaseMessaging.setBadgeNumber(); return FirebaseMessaging.requestPermissions();
}
/**
* Set notification count badge number
* @param n
*/
setBadgeNumber(n: number) {
FirebaseMessaging.setBadgeNumber(n);
} }
/** /**
@ -194,7 +205,7 @@ export default class Messaging extends Base {
* @param listener * @param listener
* @returns {*} * @returns {*}
*/ */
onMessageReceived(listener: Function) { onMessage(listener: Function) {
return DeviceEventEmitter.addListener(EVENT_TYPE.Notification, async(event) => { return DeviceEventEmitter.addListener(EVENT_TYPE.Notification, async(event) => {
const data = Object.assign({}, event); const data = Object.assign({}, event);