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(){ ...@@ -42,6 +42,8 @@ export function registerAppListener(){
break; break;
case NotificationType.WillPresent: case NotificationType.WillPresent:
notif.finish(WillPresentNotificationResult.All) //other types available: WillPresentNotificationResult.None 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; break;
} }
} }
......
...@@ -56,6 +56,8 @@ https://github.com/evollu/react-native-fcm/blob/master/Examples/simple-fcm-clien ...@@ -56,6 +56,8 @@ https://github.com/evollu/react-native-fcm/blob/master/Examples/simple-fcm-clien
... ...
android:theme="@style/AppTheme"> 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"> + <service android:name="com.evollu.react.fcm.MessagingService" android:enabled="true" android:exported="true">
+ <intent-filter> + <intent-filter>
+ <action android:name="com.google.firebase.MESSAGING_EVENT"/> + <action android:name="com.google.firebase.MESSAGING_EVENT"/>
...@@ -187,7 +189,7 @@ cd ios && pod init ...@@ -187,7 +189,7 @@ cd ios && pod init
Edit the newly created `Podfile`: Edit the newly created `Podfile`:
```diff ```diff
# Pods for YOURAPP # Pods for YOURAPP
+ pod 'FirebaseMessaging' + pod 'Firebase/Messaging'
``` ```
Install the `Firebase/Messaging` pod: Install the `Firebase/Messaging` pod:
...@@ -277,7 +279,6 @@ Edit AndroidManifest.xml ...@@ -277,7 +279,6 @@ Edit AndroidManifest.xml
+ <uses-permission android:name="android.permission.VIBRATE" /> + <uses-permission android:name="android.permission.VIBRATE" />
<application <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:name="com.evollu.react.fcm.FIRLocalMessagingPublisher"/>
+ <receiver android:enabled="true" android:exported="true" android:name="com.evollu.react.fcm.FIRSystemBootEventReceiver"> + <receiver android:enabled="true" android:exported="true" android:name="com.evollu.react.fcm.FIRSystemBootEventReceiver">
+ <intent-filter> + <intent-filter>
......
...@@ -58,7 +58,10 @@ public class FIRLocalMessagingHelper { ...@@ -58,7 +58,10 @@ public class FIRLocalMessagingHelper {
return; 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) { 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;
......
...@@ -367,7 +367,9 @@ RCT_EXPORT_METHOD(removeAllDeliveredNotifications) ...@@ -367,7 +367,9 @@ RCT_EXPORT_METHOD(removeAllDeliveredNotifications)
if([UNUserNotificationCenter currentNotificationCenter] != nil){ if([UNUserNotificationCenter currentNotificationCenter] != nil){
[[UNUserNotificationCenter currentNotificationCenter] removeAllDeliveredNotifications]; [[UNUserNotificationCenter currentNotificationCenter] removeAllDeliveredNotifications];
} else { } else {
dispatch_async(dispatch_get_main_queue(), ^{
[RCTSharedApplication() setApplicationIconBadgeNumber: 0]; [RCTSharedApplication() setApplicationIconBadgeNumber: 0];
});
} }
} }
...@@ -416,7 +418,9 @@ RCT_EXPORT_METHOD(getScheduledLocalNotifications:(RCTPromiseResolveBlock)resolve ...@@ -416,7 +418,9 @@ RCT_EXPORT_METHOD(getScheduledLocalNotifications:(RCTPromiseResolveBlock)resolve
RCT_EXPORT_METHOD(setBadgeNumber: (NSInteger) number) RCT_EXPORT_METHOD(setBadgeNumber: (NSInteger) number)
{ {
dispatch_async(dispatch_get_main_queue(), ^{
[RCTSharedApplication() setApplicationIconBadgeNumber:number]; [RCTSharedApplication() setApplicationIconBadgeNumber:number];
});
} }
RCT_EXPORT_METHOD(getBadgeNumber: (RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) RCT_EXPORT_METHOD(getBadgeNumber: (RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
......
...@@ -230,6 +230,7 @@ ...@@ -230,6 +230,7 @@
"$(PROJECT_DIR)/../../../ios/Frameworks/**", "$(PROJECT_DIR)/../../../ios/Frameworks/**",
"$(SRCROOT)/../../../node_modules/react-native-firestack/ios/**", "$(SRCROOT)/../../../node_modules/react-native-firestack/ios/**",
"$(PROJECT_DIR)/../../../ios/Pods/Firebase/**", "$(PROJECT_DIR)/../../../ios/Pods/Firebase/**",
"$(PROJECT_DIR)/../../../ios/Pods/Headers/Public/**",
); );
LIBRARY_SEARCH_PATHS = "$(inherited)"; LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC"; OTHER_LDFLAGS = "-ObjC";
...@@ -257,6 +258,7 @@ ...@@ -257,6 +258,7 @@
"$(PROJECT_DIR)/../../../ios/Frameworks/**", "$(PROJECT_DIR)/../../../ios/Frameworks/**",
"$(SRCROOT)/../../../node_modules/react-native-firestack/ios/**", "$(SRCROOT)/../../../node_modules/react-native-firestack/ios/**",
"$(PROJECT_DIR)/../../../ios/Pods/Firebase/**", "$(PROJECT_DIR)/../../../ios/Pods/Firebase/**",
"$(PROJECT_DIR)/../../../ios/Pods/Headers/Public/**",
); );
LIBRARY_SEARCH_PATHS = "$(inherited)"; LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC"; OTHER_LDFLAGS = "-ObjC";
......
...@@ -24,5 +24,5 @@ ...@@ -24,5 +24,5 @@
"type": "git", "type": "git",
"url": "git+https://github.com/evollu/react-native-fcm.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| ...@@ -12,6 +12,9 @@ Pod::Spec.new do |s|
s.source = { :git => 'https://github.com/evollu/react-native-fcm.git' } s.source = { :git => 'https://github.com/evollu/react-native-fcm.git' }
s.platform = :ios, '8.0' s.platform = :ios, '8.0'
s.source_files = "ios/*.{h,m}" s.source_files = "ios/*.{h,m}"
s.public_header_files = ['ios/RNFIRMessaging.h']
s.static_framework = true
s.dependency "React"
s.dependency "Firebase/Messaging" s.dependency "Firebase/Messaging"
end 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