Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
react-native-fcm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ym
react-native-fcm
Commits
c9b93dfc
Commit
c9b93dfc
authored
Sep 13, 2016
by
Libin Lu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
take away FCM.initData
parent
23cf81fe
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
41 deletions
+14
-41
android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java
...rc/main/java/com/evollu/react/fcm/FIRMessagingModule.java
+1
-15
index.js
index.js
+13
-20
ios/RNFIRMesssaging.m
ios/RNFIRMesssaging.m
+0
-6
No files found.
android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java
View file @
c9b93dfc
...
@@ -27,14 +27,12 @@ import android.util.Log;
...
@@ -27,14 +27,12 @@ import android.util.Log;
import
android.content.Context
;
import
android.content.Context
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
public
class
FIRMessagingModule
extends
ReactContextBaseJavaModule
implements
LifecycleEventListener
,
ActivityEventListener
{
public
class
FIRMessagingModule
extends
ReactContextBaseJavaModule
implements
LifecycleEventListener
,
ActivityEventListener
{
private
final
static
String
TAG
=
FIRMessagingModule
.
class
.
getCanonicalName
();
private
final
static
String
TAG
=
FIRMessagingModule
.
class
.
getCanonicalName
();
private
FIRLocalMessagingHelper
mFIRLocalMessagingHelper
;
private
FIRLocalMessagingHelper
mFIRLocalMessagingHelper
;
Intent
initIntent
;
public
FIRMessagingModule
(
ReactApplicationContext
reactContext
)
{
public
FIRMessagingModule
(
ReactApplicationContext
reactContext
)
{
super
(
reactContext
);
super
(
reactContext
);
...
@@ -45,12 +43,6 @@ public class FIRMessagingModule extends ReactContextBaseJavaModule implements Li
...
@@ -45,12 +43,6 @@ public class FIRMessagingModule extends ReactContextBaseJavaModule implements Li
registerMessageHandler
();
registerMessageHandler
();
}
}
@Override
public
Map
<
String
,
Object
>
getConstants
()
{
Map
<
String
,
Object
>
constants
=
new
HashMap
<>();
return
constants
;
}
@Override
@Override
public
String
getName
()
{
public
String
getName
()
{
return
"RNFIRMessaging"
;
return
"RNFIRMessaging"
;
...
@@ -180,12 +172,6 @@ public class FIRMessagingModule extends ReactContextBaseJavaModule implements Li
...
@@ -180,12 +172,6 @@ public class FIRMessagingModule extends ReactContextBaseJavaModule implements Li
@Override
@Override
public
void
onHostResume
()
{
public
void
onHostResume
()
{
if
(
initIntent
==
null
){
//the first intent is initial intent that opens the app
Intent
newIntent
=
getCurrentActivity
().
getIntent
();
sendEvent
(
"FCMInitData"
,
parseIntent
(
newIntent
));
initIntent
=
newIntent
;
}
}
}
@Override
@Override
...
...
index.js
View file @
c9b93dfc
...
@@ -6,48 +6,48 @@ const eventsMap = {
...
@@ -6,48 +6,48 @@ const eventsMap = {
localNotification
:
'
FCMLocalNotificationReceived
'
localNotification
:
'
FCMLocalNotificationReceived
'
};
};
const
FIRMessaging
=
NativeModules
.
RNFIRMessaging
;
const
RN
FIRMessaging
=
NativeModules
.
RNFIRMessaging
;
const
FCM
=
{};
const
FCM
=
{};
FCM
.
getInitialNotification
=
()
=>
{
FCM
.
getInitialNotification
=
()
=>
{
return
FIRMessaging
.
getInitialNotification
();
return
RN
FIRMessaging
.
getInitialNotification
();
}
}
FCM
.
getFCMToken
=
()
=>
{
FCM
.
getFCMToken
=
()
=>
{
return
FIRMessaging
.
getFCMToken
();
return
RN
FIRMessaging
.
getFCMToken
();
};
};
FCM
.
requestPermissions
=
()
=>
{
FCM
.
requestPermissions
=
()
=>
{
return
FIRMessaging
.
requestPermissions
();
return
RN
FIRMessaging
.
requestPermissions
();
};
};
FCM
.
presentLocalNotification
=
(
details
)
=>
{
FCM
.
presentLocalNotification
=
(
details
)
=>
{
FIRMessaging
.
presentLocalNotification
(
details
);
RN
FIRMessaging
.
presentLocalNotification
(
details
);
};
};
FCM
.
scheduleLocalNotification
=
function
(
details
)
{
FCM
.
scheduleLocalNotification
=
function
(
details
)
{
FIRMessaging
.
scheduleLocalNotification
(
details
);
RN
FIRMessaging
.
scheduleLocalNotification
(
details
);
};
};
FCM
.
getScheduledLocalNotifications
=
function
()
{
FCM
.
getScheduledLocalNotifications
=
function
()
{
return
FIRMessaging
.
getScheduledLocalNotifications
();
return
RN
FIRMessaging
.
getScheduledLocalNotifications
();
};
};
FCM
.
cancelLocalNotification
=
(
notificationID
)
=>
{
FCM
.
cancelLocalNotification
=
(
notificationID
)
=>
{
FIRMessaging
.
cancelLocalNotification
(
notificationID
);
RN
FIRMessaging
.
cancelLocalNotification
(
notificationID
);
};
};
FCM
.
cancelAllLocalNotifications
=
()
=>
{
FCM
.
cancelAllLocalNotifications
=
()
=>
{
FIRMessaging
.
cancelAllLocalNotifications
();
RN
FIRMessaging
.
cancelAllLocalNotifications
();
};
};
FCM
.
setBadgeNumber
=
()
=>
{
FCM
.
setBadgeNumber
=
()
=>
{
FIRMessaging
.
setBadgeNumber
();
RN
FIRMessaging
.
setBadgeNumber
();
}
}
FCM
.
getBadgeNumber
=
()
=>
{
FCM
.
getBadgeNumber
=
()
=>
{
return
FIRMessaging
.
getBadgeNumber
();
return
RN
FIRMessaging
.
getBadgeNumber
();
}
}
FCM
.
on
=
(
event
,
callback
)
=>
{
FCM
.
on
=
(
event
,
callback
)
=>
{
...
@@ -60,18 +60,11 @@ FCM.on = (event, callback) => {
...
@@ -60,18 +60,11 @@ FCM.on = (event, callback) => {
};
};
FCM
.
subscribeToTopic
=
(
topic
)
=>
{
FCM
.
subscribeToTopic
=
(
topic
)
=>
{
FIRMessaging
.
subscribeToTopic
(
topic
);
RN
FIRMessaging
.
subscribeToTopic
(
topic
);
};
};
FCM
.
unsubscribeFromTopic
=
(
topic
)
=>
{
FCM
.
unsubscribeFromTopic
=
(
topic
)
=>
{
FIRMessaging
.
unsubscribeFromTopic
(
topic
);
RN
FIRMessaging
.
unsubscribeFromTopic
(
topic
);
};
};
//once doesn't seem to work
DeviceEventEmitter
.
addListener
(
'
FCMInitData
'
,
(
data
)
=>
{
FCM
.
initialData
=
data
;
});
FCM
.
initialData
=
FIRMessaging
.
initialData
;
module
.
exports
=
FCM
;
module
.
exports
=
FCM
;
ios/RNFIRMesssaging.m
View file @
c9b93dfc
...
@@ -72,12 +72,6 @@ RCT_EXPORT_MODULE()
...
@@ -72,12 +72,6 @@ RCT_EXPORT_MODULE()
@synthesize
bridge
=
_bridge
;
@synthesize
bridge
=
_bridge
;
-
(
NSDictionary
<
NSString
*
,
id
>
*
)
constantsToExport
{
NSDictionary
<
NSString
*
,
id
>
*
initialNotification
=
[
_bridge
.
launchOptions
[
UIApplicationLaunchOptionsRemoteNotificationKey
]
copy
];
return
@{
@"initialData"
:
RCTNullIfNil
(
initialNotification
)};
}
-
(
void
)
dealloc
-
(
void
)
dealloc
{
{
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
];
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment