Commit 7c6b1435 authored by Thibault Malbranche's avatar Thibault Malbranche Committed by GitHub

Merge pull request #1 from evollu/master

Update from master
parents fc499968 24f887fd
......@@ -42,6 +42,8 @@ export function registerAppListener(){
break;
case NotificationType.WillPresent:
notif.finish(WillPresentNotificationResult.All) //other types available: WillPresentNotificationResult.None
// this type of notificaiton will be called only when you are in foreground.
// if it is a remote notification, don't do any app logic here. Another notification callback will be triggered with type NotificationType.Remote
break;
}
}
......
......@@ -56,6 +56,8 @@ https://github.com/evollu/react-native-fcm/blob/master/Examples/simple-fcm-clien
...
android:theme="@style/AppTheme">
+ <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_notif"/>
+ <service android:name="com.evollu.react.fcm.MessagingService" android:enabled="true" android:exported="true">
+ <intent-filter>
+ <action android:name="com.google.firebase.MESSAGING_EVENT"/>
......@@ -187,7 +189,7 @@ cd ios && pod init
Edit the newly created `Podfile`:
```diff
# Pods for YOURAPP
+ pod 'FirebaseMessaging'
+ pod 'Firebase/Messaging'
```
Install the `Firebase/Messaging` pod:
......@@ -277,7 +279,6 @@ Edit AndroidManifest.xml
+ <uses-permission android:name="android.permission.VIBRATE" />
<application
+ <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_notif"/>
+ <receiver android:name="com.evollu.react.fcm.FIRLocalMessagingPublisher"/>
+ <receiver android:enabled="true" android:exported="true" android:name="com.evollu.react.fcm.FIRSystemBootEventReceiver">
+ <intent-filter>
......
......@@ -58,7 +58,10 @@ public class FIRLocalMessagingHelper {
return;
}
Long fireDate = Math.round(bundle.getDouble("fire_date", bundle.getLong("fire_date")));
long fireDate = Math.round(bundle.getDouble("fire_date"));
if(fireDate == 0){
fireDate = Math.round(bundle.getLong("fire_date"));
}
if (fireDate == 0) {
Log.e(TAG, "failed to schedule notification because fire date is missing");
return;
......
......@@ -367,7 +367,9 @@ RCT_EXPORT_METHOD(removeAllDeliveredNotifications)
if([UNUserNotificationCenter currentNotificationCenter] != nil){
[[UNUserNotificationCenter currentNotificationCenter] removeAllDeliveredNotifications];
} else {
[RCTSharedApplication() setApplicationIconBadgeNumber: 0];
dispatch_async(dispatch_get_main_queue(), ^{
[RCTSharedApplication() setApplicationIconBadgeNumber: 0];
});
}
}
......@@ -416,7 +418,9 @@ RCT_EXPORT_METHOD(getScheduledLocalNotifications:(RCTPromiseResolveBlock)resolve
RCT_EXPORT_METHOD(setBadgeNumber: (NSInteger) number)
{
[RCTSharedApplication() setApplicationIconBadgeNumber:number];
dispatch_async(dispatch_get_main_queue(), ^{
[RCTSharedApplication() setApplicationIconBadgeNumber:number];
});
}
RCT_EXPORT_METHOD(getBadgeNumber: (RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
......
......@@ -230,6 +230,7 @@
"$(PROJECT_DIR)/../../../ios/Frameworks/**",
"$(SRCROOT)/../../../node_modules/react-native-firestack/ios/**",
"$(PROJECT_DIR)/../../../ios/Pods/Firebase/**",
"$(PROJECT_DIR)/../../../ios/Pods/Headers/Public/**",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
......@@ -257,6 +258,7 @@
"$(PROJECT_DIR)/../../../ios/Frameworks/**",
"$(SRCROOT)/../../../node_modules/react-native-firestack/ios/**",
"$(PROJECT_DIR)/../../../ios/Pods/Firebase/**",
"$(PROJECT_DIR)/../../../ios/Pods/Headers/Public/**",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
......
......@@ -24,5 +24,5 @@
"type": "git",
"url": "git+https://github.com/evollu/react-native-fcm.git"
},
"version": "11.2.0"
"version": "11.3.1"
}
......@@ -12,6 +12,9 @@ Pod::Spec.new do |s|
s.source = { :git => 'https://github.com/evollu/react-native-fcm.git' }
s.platform = :ios, '8.0'
s.source_files = "ios/*.{h,m}"
s.public_header_files = ['ios/RNFIRMessaging.h']
s.static_framework = true
s.dependency "React"
s.dependency "Firebase/Messaging"
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment