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
a9215e75
Commit
a9215e75
authored
Aug 28, 2017
by
Libin Lu
Committed by
GitHub
Aug 28, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #517 from douglasjunior/patch-1
Allow local notification without sound (Android and iOS)
parents
bb63b523
5b079c1b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
android/src/main/java/com/evollu/react/fcm/FIRLocalMessagingHelper.java
...in/java/com/evollu/react/fcm/FIRLocalMessagingHelper.java
+11
-8
ios/RNFIRMessaging.m
ios/RNFIRMessaging.m
+5
-3
No files found.
android/src/main/java/com/evollu/react/fcm/FIRLocalMessagingHelper.java
View file @
a9215e75
...
...
@@ -82,7 +82,6 @@ public class FIRLocalMessagingHelper {
.
setSubText
(
bundle
.
getString
(
"sub_text"
))
.
setGroup
(
bundle
.
getString
(
"group"
))
.
setVibrate
(
new
long
[]{
0
,
DEFAULT_VIBRATION
})
.
setSound
(
RingtoneManager
.
getDefaultUri
(
RingtoneManager
.
TYPE_NOTIFICATION
))
.
setExtras
(
bundle
.
getBundle
(
"data"
));
//priority
...
...
@@ -151,14 +150,18 @@ public class FIRLocalMessagingHelper {
}
//sound
String
soundName
=
bundle
.
getString
(
"sound"
,
"default"
);
if
(!
soundName
.
equalsIgnoreCase
(
"default"
))
{
int
soundResourceId
=
res
.
getIdentifier
(
soundName
,
"raw"
,
packageName
);
if
(
soundResourceId
==
0
){
soundName
=
soundName
.
substring
(
0
,
soundName
.
lastIndexOf
(
'.'
));
soundResourceId
=
res
.
getIdentifier
(
soundName
,
"raw"
,
packageName
);
String
soundName
=
bundle
.
getString
(
"sound"
);
if
(
soundName
!=
null
)
{
if
(
soundName
.
equalsIgnoreCase
(
"default"
))
{
notification
.
setSound
(
RingtoneManager
.
getDefaultUri
(
RingtoneManager
.
TYPE_NOTIFICATION
));
}
else
{
int
soundResourceId
=
res
.
getIdentifier
(
soundName
,
"raw"
,
packageName
);
if
(
soundResourceId
==
0
)
{
soundName
=
soundName
.
substring
(
0
,
soundName
.
lastIndexOf
(
'.'
));
soundResourceId
=
res
.
getIdentifier
(
soundName
,
"raw"
,
packageName
);
}
notification
.
setSound
(
Uri
.
parse
(
"android.resource://"
+
packageName
+
"/"
+
soundResourceId
));
}
notification
.
setSound
(
Uri
.
parse
(
"android.resource://"
+
packageName
+
"/"
+
soundResourceId
));
}
//color
...
...
ios/RNFIRMessaging.m
View file @
a9215e75
...
...
@@ -45,9 +45,11 @@ RCT_ENUM_CONVERTER(NSCalendarUnit,
content
.
body
=
[
RCTConvert
NSString
:
details
[
@"body"
]];
NSString
*
sound
=
[
RCTConvert
NSString
:
details
[
@"sound"
]];
if
(
sound
!=
nil
){
content
.
sound
=
[
UNNotificationSound
soundNamed
:
sound
];
}
else
{
content
.
sound
=
[
UNNotificationSound
defaultSound
];
if
([
sound
isEqual
:
@"default"
])
{
content
.
sound
=
[
UNNotificationSound
defaultSound
];
}
else
{
content
.
sound
=
[
UNNotificationSound
soundNamed
:
sound
];
}
}
content
.
categoryIdentifier
=
[
RCTConvert
NSString
:
details
[
@"click_action"
]];
content
.
userInfo
=
details
;
...
...
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