diff --git a/.gitignore b/.gitignore
index 3c3629e647f5ddf82548912e337bea9826b434af..b7dab5e9cbfea4afa2bc788899ccaea6df849062 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
node_modules
+build
\ No newline at end of file
diff --git a/.npmignore b/.npmignore
index 3c3629e647f5ddf82548912e337bea9826b434af..b7dab5e9cbfea4afa2bc788899ccaea6df849062 100644
--- a/.npmignore
+++ b/.npmignore
@@ -1 +1,2 @@
node_modules
+build
\ No newline at end of file
diff --git a/README.md b/README.md
index b90d94ee08736fb7176dcb9f44a2011dbb70b2bc..e428098e466b0e497b365d740a7e1a92a3fb40d3 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,11 @@
-# react-native-fcm
+# react-native-gcm-push-notification
Firebase notification for React Native Android and IOS
+## Demo
+
+https://github.com/oney/TestGcm
+
## Installation
- Run `npm install react-native-fcm --save`
diff --git a/android/react-native-fcm.iml b/android/react-native-fcm.iml
index 070a3d8400ac0c55944c97aeb18e3a9a585a548b..11ebe91a8b248e299f55f1c86589200da3f8a758 100644
--- a/android/react-native-fcm.iml
+++ b/android/react-native-fcm.iml
@@ -65,14 +65,6 @@
-
-
-
-
-
-
-
-
@@ -81,13 +73,19 @@
+
+
+
+
+
+
+
+
-
-
@@ -95,7 +93,6 @@
-
diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml
index 7f7c9ce52cc42973f37a26e1af69bb2c236c1721..0411f006a3596adc3179392b7f2ba5833349da7b 100644
--- a/android/src/main/AndroidManifest.xml
+++ b/android/src/main/AndroidManifest.xml
@@ -1,3 +1,3 @@
+ package="com.evollu.react.firebase">
diff --git a/android/src/main/java/com/evollu/react/fcm/FCMModule.java b/android/src/main/java/com/evollu/react/firebase/FIRMessagingModule.java
similarity index 77%
rename from android/src/main/java/com/evollu/react/fcm/FCMModule.java
rename to android/src/main/java/com/evollu/react/firebase/FIRMessagingModule.java
index 59111c077b6c1e4727b6452a4d97601d2f28c6a5..6395ad466114285835a05492603fcafc1b5e4c17 100644
--- a/android/src/main/java/com/evollu/react/fcm/FCMModule.java
+++ b/android/src/main/java/com/evollu/react/firebase/FIRMessagingModule.java
@@ -1,4 +1,4 @@
-package com.evollu.react.fcm;
+package com.evollu.react.firebase;
import android.content.BroadcastReceiver;
import android.content.Intent;
@@ -13,22 +13,19 @@ import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.google.firebase.iid.FirebaseInstanceId;
+import com.google.firebase.messaging.RemoteMessage;
+
import android.util.Log;
import android.content.Context;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-public class FCMModule extends ReactContextBaseJavaModule implements LifecycleEventListener {
- private final static String TAG = FCMModule.class.getCanonicalName();
+public class FIRMessagingModule extends ReactContextBaseJavaModule implements LifecycleEventListener {
+ private final static String TAG = FIRMessagingModule.class.getCanonicalName();
- public FCMModule(ReactApplicationContext reactContext, Intent intent) {
+ public FIRMessagingModule(ReactApplicationContext reactContext) {
super(reactContext);
getReactApplicationContext().addLifecycleEventListener(this);
@@ -39,7 +36,7 @@ public class FCMModule extends ReactContextBaseJavaModule implements LifecycleEv
@Override
public String getName() {
- return "FCMModule";
+ return "RNFIRMessaging";
}
@ReactMethod
@@ -59,7 +56,7 @@ public class FCMModule extends ReactContextBaseJavaModule implements LifecycleEv
}
private void registerTokenRefreshHandler() {
- IntentFilter intentFilter = new IntentFilter("com.evollu.react.fcm.FCMRefreshToken");
+ IntentFilter intentFilter = new IntentFilter("com.evollu.react.firebase.FCMRefreshToken");
getReactApplicationContext().registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -77,25 +74,24 @@ public class FCMModule extends ReactContextBaseJavaModule implements LifecycleEv
}
private void registerNotificationHandler() {
- IntentFilter intentFilter = new IntentFilter("com.evollu.fcm.ReceiveNotification");
+ IntentFilter intentFilter = new IntentFilter("com.evollu.react.firebase.ReceiveNotification");
getReactApplicationContext().registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (getReactApplicationContext().hasActiveCatalystInstance()) {
+ RemoteMessage message = intent.getParcelableExtra("data");
WritableMap params = Arguments.createMap();
- try {
- JSONObject data = new JSONObject(intent.getStringExtra("data"));
- Iterator keysIterator = data.keys();
- while(keysIterator.hasNext()){
- String key = keysIterator.next();
+ if(message.getData() != null){
+ Map data = message.getData();
+ Set keysIterator = data.keySet();
+ for(String key: keysIterator){
params.putString(key, (String) data.get(key));
}
sendEvent("FCMNotificationReceived", params);
- } catch (JSONException e){
-
+ abortBroadcast();
}
- abortBroadcast();
+
}
}
}, intentFilter);
diff --git a/android/src/main/java/com/evollu/react/fcm/FCMPackage.java b/android/src/main/java/com/evollu/react/firebase/FIRMessagingPackage.java
similarity index 81%
rename from android/src/main/java/com/evollu/react/fcm/FCMPackage.java
rename to android/src/main/java/com/evollu/react/firebase/FIRMessagingPackage.java
index e3d1aa4dbc19fe8b906fcafb64b14600ad176fd3..0c3a7ac887117d3ab06c6f37100ed2dd59f33fe7 100644
--- a/android/src/main/java/com/evollu/react/fcm/FCMPackage.java
+++ b/android/src/main/java/com/evollu/react/firebase/FIRMessagingPackage.java
@@ -1,6 +1,4 @@
-package com.evollu.react.fcm;
-
-import android.content.Intent;
+package com.evollu.react.firebase;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
@@ -12,9 +10,9 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-public class FCMPackage implements ReactPackage {
+public class FIRMessagingPackage implements ReactPackage {
- public FCMPackage() {
+ public FIRMessagingPackage() {
}
@Override
@@ -22,7 +20,7 @@ public class FCMPackage implements ReactPackage {
ReactApplicationContext reactContext) {
List modules = new ArrayList<>();
- modules.add(new FCMModule(reactContext, null));
+ modules.add(new FIRMessagingModule(reactContext));
return modules;
}
diff --git a/android/src/main/java/com/evollu/react/fcm/InstanceIdService.java b/android/src/main/java/com/evollu/react/firebase/InstanceIdService.java
similarity index 89%
rename from android/src/main/java/com/evollu/react/fcm/InstanceIdService.java
rename to android/src/main/java/com/evollu/react/firebase/InstanceIdService.java
index e7da8a1fa596b2666a7d0b59345fd810d6633395..0ff5acd84ecb3d8b8b730a096da101577df566ae 100644
--- a/android/src/main/java/com/evollu/react/fcm/InstanceIdService.java
+++ b/android/src/main/java/com/evollu/react/firebase/InstanceIdService.java
@@ -1,4 +1,4 @@
-package com.evollu.react.fcm;
+package com.evollu.react.firebase;
import android.content.Intent;
import android.os.Bundle;
@@ -25,7 +25,7 @@ public class InstanceIdService extends FirebaseInstanceIdService {
// Broadcast refreshed token
- Intent i = new Intent("com.evollu.react.fcm.FCMRefreshToken");
+ Intent i = new Intent("com.evollu.react.firebase.FCMRefreshToken");
Bundle bundle = new Bundle();
bundle.putString("token", refreshedToken);
i.putExtras(bundle);
diff --git a/android/src/main/java/com/evollu/react/fcm/MessagingService.java b/android/src/main/java/com/evollu/react/firebase/MessagingService.java
similarity index 62%
rename from android/src/main/java/com/evollu/react/fcm/MessagingService.java
rename to android/src/main/java/com/evollu/react/firebase/MessagingService.java
index ff57dc3b65aa89621c86ad61f0ea847552777bdc..ef609e5ad9753e1f371927b91045da6a25662364 100644
--- a/android/src/main/java/com/evollu/react/fcm/MessagingService.java
+++ b/android/src/main/java/com/evollu/react/firebase/MessagingService.java
@@ -1,4 +1,4 @@
-package com.evollu.react.fcm;
+package com.evollu.react.firebase;
import android.content.Intent;
import android.util.Log;
@@ -14,10 +14,8 @@ public class MessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.d(TAG, "Remote message received");
- Intent i = new Intent("com.evollu.fcm.ReceiveNotification");
- if(remoteMessage.getData() != null){
- i.putExtra("data", new JSONObject(remoteMessage.getData()).toString());
- sendOrderedBroadcast(i, null);
- }
+ Intent i = new Intent("com.evollu.react.firebase.ReceiveNotification");
+ i.putExtra("data", remoteMessage);
+ sendOrderedBroadcast(i, null);
}
}
diff --git a/index.js b/index.js
index 749970f6136b06c92850b4f640a30c496a76e4a7..eba05126e89ca558d3382c4f3d3c424521537d45 100644
--- a/index.js
+++ b/index.js
@@ -1,25 +1,22 @@
'use strict';
var React = require('react-native');
-var {
- NativeModules
-} = React;
+var {NativeModules} = React;
-var FCMModule = NativeModules.FCMModule;
+var FIRMessaging = NativeModules.RNFIRMessaging;
+
+console.log(NativeModules.RNFIRMessaging);
class FCM {
static getFCMToken() {
- return FCMModule.getFCMToken();
+ return FIRMessaging.getFCMToken();
}
static requestPermissions() {
- return FCMModule.requestPermissions();
+ return FIRMessaging.requestPermissions();
}
- constructor(data) {
- this.data = data;
- }
}
module.exports = FCM;
\ No newline at end of file
diff --git a/ios/FCMModule.h b/ios/RNFIRMessaging.h
similarity index 77%
rename from ios/FCMModule.h
rename to ios/RNFIRMessaging.h
index 441e0bef48cdb2b1f05d41b1523b1e0a712b8b71..67b09b01761fee6e67f745e4419aed8202db6db4 100644
--- a/ios/FCMModule.h
+++ b/ios/RNFIRMessaging.h
@@ -8,7 +8,7 @@
extern NSString *const FCMNotificationReceived;
-@interface FCMModule : NSObject
+@interface RNFIRMessaging : NSObject
@property (nonatomic, assign) bool connectedToFCM;
diff --git a/ios/RNFCM.xcodeproj/project.pbxproj b/ios/RNFIRMessaging.xcodeproj/project.pbxproj
similarity index 83%
rename from ios/RNFCM.xcodeproj/project.pbxproj
rename to ios/RNFIRMessaging.xcodeproj/project.pbxproj
index 8ec3ff2ca3a931e95f4a8b50dc4d2ce754679f2f..ff34dd84c825db75d13765397d6ce3c6bcb91904 100644
--- a/ios/RNFCM.xcodeproj/project.pbxproj
+++ b/ios/RNFIRMessaging.xcodeproj/project.pbxproj
@@ -7,7 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
- 3AD1DC2B1CFA802F008C092E /* FCMModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AD1DC2A1CFA802F008C092E /* FCMModule.m */; };
+ 3AD1DC2B1CFA802F008C092E /* RNFIRMesssaging.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AD1DC2A1CFA802F008C092E /* RNFIRMesssaging.m */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -23,9 +23,9 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
- 134814201AA4EA6300B7C361 /* libRNFCM.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNFCM.a; sourceTree = BUILT_PRODUCTS_DIR; };
- 3AD1DC291CFA802F008C092E /* FCMModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FCMModule.h; sourceTree = ""; };
- 3AD1DC2A1CFA802F008C092E /* FCMModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FCMModule.m; sourceTree = ""; };
+ 134814201AA4EA6300B7C361 /* libRNFIRMessaging.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNFIRMessaging.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ 3AD1DC291CFA802F008C092E /* RNFIRMessaging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNFIRMessaging.h; sourceTree = ""; };
+ 3AD1DC2A1CFA802F008C092E /* RNFIRMesssaging.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNFIRMesssaging.m; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -42,7 +42,7 @@
134814211AA4EA7D00B7C361 /* Products */ = {
isa = PBXGroup;
children = (
- 134814201AA4EA6300B7C361 /* libRNFCM.a */,
+ 134814201AA4EA6300B7C361 /* libRNFIRMessaging.a */,
);
name = Products;
sourceTree = "";
@@ -50,8 +50,8 @@
58B511D21A9E6C8500147676 = {
isa = PBXGroup;
children = (
- 3AD1DC291CFA802F008C092E /* FCMModule.h */,
- 3AD1DC2A1CFA802F008C092E /* FCMModule.m */,
+ 3AD1DC291CFA802F008C092E /* RNFIRMessaging.h */,
+ 3AD1DC2A1CFA802F008C092E /* RNFIRMesssaging.m */,
134814211AA4EA7D00B7C361 /* Products */,
);
indentWidth = 2;
@@ -61,9 +61,9 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
- 58B511DA1A9E6C8500147676 /* RNFCM */ = {
+ 58B511DA1A9E6C8500147676 /* RNFIRMessaging */ = {
isa = PBXNativeTarget;
- buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNFCM" */;
+ buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNFIRMessaging" */;
buildPhases = (
58B511D71A9E6C8500147676 /* Sources */,
58B511D81A9E6C8500147676 /* Frameworks */,
@@ -73,9 +73,9 @@
);
dependencies = (
);
- name = RNFCM;
+ name = RNFIRMessaging;
productName = RCTDataManager;
- productReference = 134814201AA4EA6300B7C361 /* libRNFCM.a */;
+ productReference = 134814201AA4EA6300B7C361 /* libRNFIRMessaging.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
@@ -92,7 +92,7 @@
};
};
};
- buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNFCM" */;
+ buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNFIRMessaging" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
@@ -104,7 +104,7 @@
projectDirPath = "";
projectRoot = "";
targets = (
- 58B511DA1A9E6C8500147676 /* RNFCM */,
+ 58B511DA1A9E6C8500147676 /* RNFIRMessaging */,
);
};
/* End PBXProject section */
@@ -114,7 +114,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 3AD1DC2B1CFA802F008C092E /* FCMModule.m in Sources */,
+ 3AD1DC2B1CFA802F008C092E /* RNFIRMesssaging.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -216,7 +216,7 @@
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
- PRODUCT_NAME = RNFCM;
+ PRODUCT_NAME = RNFIRMessaging;
RUN_CLANG_STATIC_ANALYZER = YES;
SKIP_INSTALL = YES;
};
@@ -232,7 +232,7 @@
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
- PRODUCT_NAME = RNFCM;
+ PRODUCT_NAME = RNFIRMessaging;
SKIP_INSTALL = YES;
};
name = Release;
@@ -240,7 +240,7 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
- 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNFCM" */ = {
+ 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNFIRMessaging" */ = {
isa = XCConfigurationList;
buildConfigurations = (
58B511ED1A9E6C8500147676 /* Debug */,
@@ -249,7 +249,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
- 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNFCM" */ = {
+ 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNFIRMessaging" */ = {
isa = XCConfigurationList;
buildConfigurations = (
58B511F01A9E6C8500147676 /* Debug */,
diff --git a/ios/RNFCM.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/RNFIRMessaging.xcodeproj/project.xcworkspace/contents.xcworkspacedata
similarity index 100%
rename from ios/RNFCM.xcodeproj/project.xcworkspace/contents.xcworkspacedata
rename to ios/RNFIRMessaging.xcodeproj/project.xcworkspace/contents.xcworkspacedata
diff --git a/ios/RNFCM.xcodeproj/project.xcworkspace/xcuserdata/libinlu.xcuserdatad/UserInterfaceState.xcuserstate b/ios/RNFIRMessaging.xcodeproj/project.xcworkspace/xcuserdata/libinlu.xcuserdatad/UserInterfaceState.xcuserstate
similarity index 100%
rename from ios/RNFCM.xcodeproj/project.xcworkspace/xcuserdata/libinlu.xcuserdatad/UserInterfaceState.xcuserstate
rename to ios/RNFIRMessaging.xcodeproj/project.xcworkspace/xcuserdata/libinlu.xcuserdatad/UserInterfaceState.xcuserstate
diff --git a/ios/RNFCM.xcodeproj/xcuserdata/LLu.xcuserdatad/xcschemes/RNFCM.xcscheme b/ios/RNFIRMessaging.xcodeproj/xcuserdata/LLu.xcuserdatad/xcschemes/RNFIRMessaging.xcscheme
similarity index 79%
rename from ios/RNFCM.xcodeproj/xcuserdata/LLu.xcuserdatad/xcschemes/RNFCM.xcscheme
rename to ios/RNFIRMessaging.xcodeproj/xcuserdata/LLu.xcuserdatad/xcschemes/RNFIRMessaging.xcscheme
index a464f878769f2f1565026804ae5308557ce9d4c8..252d6dc935cc372d5edc1c1b5ed70e099a167d61 100644
--- a/ios/RNFCM.xcodeproj/xcuserdata/LLu.xcuserdatad/xcschemes/RNFCM.xcscheme
+++ b/ios/RNFIRMessaging.xcodeproj/xcuserdata/LLu.xcuserdatad/xcschemes/RNFIRMessaging.xcscheme
@@ -15,9 +15,9 @@
+ BuildableName = "libRNFIRMessaging.a"
+ BlueprintName = "RNFIRMessaging"
+ ReferencedContainer = "container:RNFIRMessaging.xcodeproj">
@@ -33,9 +33,9 @@
+ BuildableName = "libRNFIRMessaging.a"
+ BlueprintName = "RNFIRMessaging"
+ ReferencedContainer = "container:RNFIRMessaging.xcodeproj">
@@ -55,9 +55,9 @@
+ BuildableName = "libRNFIRMessaging.a"
+ BlueprintName = "RNFIRMessaging"
+ ReferencedContainer = "container:RNFIRMessaging.xcodeproj">
@@ -73,9 +73,9 @@
+ BuildableName = "libRNFIRMessaging.a"
+ BlueprintName = "RNFIRMessaging"
+ ReferencedContainer = "container:RNFIRMessaging.xcodeproj">
diff --git a/ios/RNFCM.xcodeproj/xcuserdata/LLu.xcuserdatad/xcschemes/xcschememanagement.plist b/ios/RNFIRMessaging.xcodeproj/xcuserdata/LLu.xcuserdatad/xcschemes/xcschememanagement.plist
similarity index 87%
rename from ios/RNFCM.xcodeproj/xcuserdata/LLu.xcuserdatad/xcschemes/xcschememanagement.plist
rename to ios/RNFIRMessaging.xcodeproj/xcuserdata/LLu.xcuserdatad/xcschemes/xcschememanagement.plist
index abbd0403f69115af2030554f019713151e460486..92370e354fc602a76829959ab053f00c6739051b 100644
--- a/ios/RNFCM.xcodeproj/xcuserdata/LLu.xcuserdatad/xcschemes/xcschememanagement.plist
+++ b/ios/RNFIRMessaging.xcodeproj/xcuserdata/LLu.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -4,10 +4,10 @@
SchemeUserState
- RNFCM.xcscheme
+ RNFIRMessaging.xcscheme
orderHint
- 19
+ 20
SuppressBuildableAutocreation
diff --git a/ios/RNFCM.xcodeproj/xcuserdata/libinlu.xcuserdatad/xcschemes/RCTPushNotification.xcscheme b/ios/RNFIRMessaging.xcodeproj/xcuserdata/libinlu.xcuserdatad/xcschemes/RCTPushNotification.xcscheme
similarity index 100%
rename from ios/RNFCM.xcodeproj/xcuserdata/libinlu.xcuserdatad/xcschemes/RCTPushNotification.xcscheme
rename to ios/RNFIRMessaging.xcodeproj/xcuserdata/libinlu.xcuserdatad/xcschemes/RCTPushNotification.xcscheme
diff --git a/ios/RNFCM.xcodeproj/xcuserdata/libinlu.xcuserdatad/xcschemes/xcschememanagement.plist b/ios/RNFIRMessaging.xcodeproj/xcuserdata/libinlu.xcuserdatad/xcschemes/xcschememanagement.plist
similarity index 100%
rename from ios/RNFCM.xcodeproj/xcuserdata/libinlu.xcuserdatad/xcschemes/xcschememanagement.plist
rename to ios/RNFIRMessaging.xcodeproj/xcuserdata/libinlu.xcuserdatad/xcschemes/xcschememanagement.plist
diff --git a/ios/FCMModule.m b/ios/RNFIRMesssaging.m
similarity index 98%
rename from ios/FCMModule.m
rename to ios/RNFIRMesssaging.m
index c12fe0fc09cac519add6514de985276dbee2ea36..29b3e00e930efef2cb3cc8bdd793b970b3a8edae 100644
--- a/ios/FCMModule.m
+++ b/ios/RNFIRMesssaging.m
@@ -1,4 +1,4 @@
-#import "FCMModule.h"
+#import "RNFIRMessaging.h"
#import "RCTBridge.h"
#import "RCTConvert.h"
@@ -18,7 +18,7 @@
NSString *const FCMNotificationReceived = @"FCMNotificationReceived";
-@implementation FCMModule
+@implementation RNFIRMessaging
RCT_EXPORT_MODULE()
diff --git a/package.json b/package.json
index f0a0673efd28929921b94d7cf272ee13cf8625c5..0819ef082ac5b64dd01eb4187333d3a4b9538001 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,52 @@
{
- "name": "react-native-fcm",
- "version": "1.0.3",
- "description": "React Native component for FCM for IOS and Android",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/evollu/react-native-fcm.git"
+ "_args": [
+ [
+ "react-native-fcm@git://github.com/evollu/react-native-fcm.git",
+ "/Users/LLu/Code/Patient/client"
+ ]
+ ],
+ "_from": "git://github.com/evollu/react-native-fcm.git",
+ "_id": "react-native-fcm@1.0.2",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/react-native-fcm",
+ "_phantomChildren": {},
+ "_requested": {
+ "hosted": {
+ "directUrl": "https://raw.githubusercontent.com/evollu/react-native-fcm/master/package.json",
+ "gitUrl": "git://github.com/evollu/react-native-fcm.git",
+ "httpsUrl": "git+https://github.com/evollu/react-native-fcm.git",
+ "shortcut": "github:evollu/react-native-fcm",
+ "ssh": "git@github.com:evollu/react-native-fcm.git",
+ "sshUrl": "git+ssh://git@github.com/evollu/react-native-fcm.git",
+ "type": "github"
+ },
+ "name": "react-native-fcm",
+ "raw": "react-native-fcm@git://github.com/evollu/react-native-fcm.git",
+ "rawSpec": "git://github.com/evollu/react-native-fcm.git",
+ "scope": null,
+ "spec": "git://github.com/evollu/react-native-fcm.git",
+ "type": "hosted"
+ },
+ "_requiredBy": [
+ "/"
+ ],
+ "_resolved": "git://github.com/evollu/react-native-fcm.git#2ae6dfedcff3fea6afdae2d7f971d0f9e0dd2930",
+ "_shasum": "7669d2f1dfd25247edc26a29d69927faf1c43634",
+ "_shrinkwrap": null,
+ "_spec": "react-native-fcm@git://github.com/evollu/react-native-fcm.git",
+ "_where": "/Users/LLu/Code/Patient/client",
+ "author": {
+ "name": "Libin Lu"
+ },
+ "bugs": {
+ "url": "https://github.com/evollu/react-native-fcm/issues"
},
+ "dependencies": {},
+ "description": "React Native component for FCM for IOS and Android",
+ "devDependencies": {},
+ "gitHead": "2ae6dfedcff3fea6afdae2d7f971d0f9e0dd2930",
+ "homepage": "https://github.com/evollu/react-native-fcm",
"keywords": [
"React-Native",
"ios",
@@ -14,10 +55,14 @@
"firebase",
"cloud messaging"
],
- "author": "Libin Lu",
"license": "MIT",
- "bugs": {
- "url": "https://github.com/evollu/react-native-fcm/issues"
+ "name": "react-native-fcm",
+ "optionalDependencies": {},
+ "readme": "# react-native-gcm-push-notification\n\nFirebase notification for React Native Android and IOS\n\n## Demo\n\nhttps://github.com/oney/TestGcm\n\n## Installation\n\n- Run `npm install react-native-fcm --save`\n- Run rnpm link\n\n## Android Configuration\n\n- In `android/build.gradle`\n```gradle\ndependencies {\nclasspath 'com.android.tools.build:gradle:2.0.0'\nclasspath 'com.google.gms:google-services:3.0.0' // <- Add this line\n```\n\n- In `android/app/build.gradle`\n```gradle\napply plugin: \"com.android.application\"\napply plugin: 'com.google.gms.google-services' // <- Add this line\n...\n```\n\n- In `android/app/src/main/AndroidManifest.xml`, add these lines, be sure to change `com.xxx.yyy` to your package\n\n```\n\n\n...\n\n\n\n\n\n\n\n\n\n\n\n...\n```\n\n### IOS Configuration\n\ninstall pod 'Firebase/Messaging'\n\nin AppDelegate.m add\n```\n#import \"FCMModule.h\"\n...\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{\n....\n[FIRApp configure]; <-- add this line\n}\n\n//add this\n- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification {\n[[NSNotificationCenter defaultCenter] postNotificationName: FCMNotificationReceived\nobject:self\nuserInfo:notification];\n\n}\n\n//add this\n- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))handler {\n[[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived\nobject:self\nuserInfo:notification];\nhandler(UIBackgroundFetchResultNoData);\n}\n```\n\n\n### FCM config file\nIn [firebase console](https://console.firebase.google.com/), you can get `google-services.json` file and place it in `android/app` directory and get `googleServices-info.plist` file and place it in `/ios` directory\n\n### Usage\n\n```javascript\n\nvar FCM = require('react-native-fcm');\n\ncomponentWillMount() {\nFCM.requestPermissions();\nFCM.getFCMToken().then(token => {\n//store fcm token in your server\n});\nthis.fcmNotifLsnr = DeviceEventEmitter.addListener('FCMNotificationReceived', (notif) => {\n//there are two parts of notif. notif.notification contains the notification payload, notif.data contains data payload\n});\nthis.fcmTokenLsnr = DeviceEventEmitter.addListener('FCMTokenRefreshed', (token) => {\n//fcm token may not be available on first load, catch it here\n});\n}\n\ncomponentWillUnmount() {\n//prevent leak\nthis.fcmNotifLsnr.remove();\nthis.fcmTokenLsnr.remove();\n}\n\n}\n```\n\n## Q & A\n### My android build is failing\nTry update your SDK and google play service\n### I can't get data notification when app is killed?\nIf you send notification with payload only, you can only get the data message when app is in foreground or background. Killed app can't show notification\n### Why I don't get data notification when I'm sending hybrid notification when app is in background?\nI want to figure it out too. Looks like that is how GCM/FCM works. I'm sending 2 notification separately for now. Let me know if you find a better solution\n\n",
+ "readmeFilename": "README.md",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/evollu/react-native-fcm.git"
},
- "homepage": "https://github.com/evollu/react-native-fcm"
+ "version": "1.0.2"
}