Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SDK-26 Branch from master #860

Merged
merged 125 commits into from
Mar 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
eadbef0
Update README.md
Dec 20, 2017
215180d
Update README.md
Dec 20, 2017
7119473
remove react dependency
Dec 20, 2017
b37ec04
Update README.md
Dec 21, 2017
3213970
Update README.md
Dec 27, 2017
3e179cf
Update README.md
kazuyakitahara Dec 28, 2017
c1239e0
Update README.md
kazuyakitahara Dec 28, 2017
e1a7d28
Merge pull request #717 from kazuyakitahara/master
Dec 28, 2017
0fb9d26
Update README.md
Dec 29, 2017
ea3672c
no group below lollipop
Jan 2, 2018
3877ad8
bump version
Jan 2, 2018
0d0b0ea
add wake_screen
Jan 3, 2018
33d0061
bump version
Jan 3, 2018
e604a9a
Update README.md
Jan 3, 2018
2c38541
Update README.md
Jan 5, 2018
bf37c6e
fix fail notification schedule after reboot on Android
germanst Jan 5, 2018
1ca8367
Merge pull request #730 from germanst/fix/android-schedule-after-reboot
Jan 5, 2018
5db48f7
Update package.json
Jan 5, 2018
fc49996
Update README.md
Jan 8, 2018
b8a814b
Fix cocoapods react-native-fcm 11
Titozzz Jan 10, 2018
b373805
Update react-native-fcm.podspec
Titozzz Jan 11, 2018
657da04
fix pod install typo
nicksarafa Jan 11, 2018
51df411
Merge pull request #738 from nsarafa/master
Jan 11, 2018
d28ddc5
Merge pull request #736 from Titozzz/patch-1
Jan 18, 2018
5232fed
Update package.json
Jan 18, 2018
58ed2d2
Update Listeners.js
Jan 18, 2018
4d6749a
fix crash
Jan 20, 2018
226313e
Update package.json
Jan 20, 2018
ddc50e1
Dispatch setApplicationIconBadgeNumber on main thread to prevent runt…
moriyoshi Jan 27, 2018
27c9a4a
Merge pull request #758 from opencollector/moriyoshi/fix-warnings-on-…
Jan 31, 2018
e5ee0b7
Add Pod paths to header search paths
slycoder Feb 1, 2018
7fad1b9
Merge pull request #767 from slycoder/react-pod-path
Feb 1, 2018
24f887f
Update README.md
Feb 1, 2018
f780e54
Add support for notification actions on iOS
krystofcelba Feb 3, 2018
acf7ca1
Add some documentation
krystofcelba Feb 5, 2018
c05a175
Rewrite handling of actions when JS is not yet initialized.
krystofcelba Feb 5, 2018
306b5f9
Add check if it is iOS to setNotificationCategories
krystofcelba Feb 5, 2018
7c6b143
Merge pull request #1 from evollu/master
Titozzz Feb 5, 2018
bc7bd73
Merge pull request #2 from evollu/sdk-26
Titozzz Feb 5, 2018
aa3c559
Add simple example to readme how to send notification with category
krystofcelba Feb 5, 2018
66da4eb
Merge pull request #773 from krystofcelba/ios-notification-actions
Feb 5, 2018
2eee4ca
Update package.json
Feb 5, 2018
0cce449
add deleteToken and getEntityToken methods for android
Panacee Feb 7, 2018
7466ad4
update version
Feb 7, 2018
134404c
use #import "Firebase.h"
Feb 8, 2018
4d5254f
Update package.json
Feb 8, 2018
c63281c
broadcast refresh token
Feb 8, 2018
e186923
Update package.json
Feb 8, 2018
5ffd26c
update example
Feb 8, 2018
3cb6099
Add deleteToken and getEntityToken methods for ios
ditkachuk Feb 8, 2018
15dc448
backward compatibility with xcode 8
Feb 12, 2018
832258d
Merge pull request #779 from ditkachuk/detele-token
Feb 12, 2018
903cefe
Update package.json
Feb 12, 2018
05d3353
update example
Feb 12, 2018
b03b51a
add opened_from_tray in initialNotificaiton
Feb 12, 2018
7035c08
support old RN version
Feb 12, 2018
bdcdcd1
update example with action
Feb 12, 2018
28381c8
Merge branch 'master' of https://github.com/evollu/react-native-fcm
Feb 12, 2018
51ea457
add dismiss button
Feb 12, 2018
2265afa
hold notification when app is bootstrapping
Feb 13, 2018
14c578d
revert change
Feb 13, 2018
26132aa
Merge pull request #792 from evollu/pending-notif
Feb 13, 2018
2e4230f
Update package.json
Feb 13, 2018
41970d9
update example
Feb 13, 2018
5d24e8b
hotfix symbol: variable FirebaseApp
frangeris Feb 13, 2018
c809346
Merge pull request #795 from frangeris/master
Feb 13, 2018
11a6acf
Update package.json
Feb 13, 2018
f918b56
backward compatible for addListener
Feb 24, 2018
f1049d2
Merge pull request #814 from evollu/evollu-patch-1
Feb 24, 2018
fad7b2d
Update package.json
Feb 24, 2018
1eb5e3c
update example
Feb 24, 2018
ef79029
Update RNFIRMessaging.m
Feb 24, 2018
a7ca733
Update package.json
Feb 24, 2018
6caa3b1
add navigation example
Feb 27, 2018
983aa00
update example
Feb 27, 2018
add9aad
add remote notif nav example
Feb 27, 2018
bb25359
Add missing dependency
Feb 28, 2018
d3ae831
Merge pull request #824 from justynspooner/patch-1
Mar 1, 2018
da07b4d
Update RNFIRMessaging.h
Mar 1, 2018
59832ab
Update package.json
Mar 1, 2018
f7e2b93
update example
Mar 1, 2018
d24e73f
added endpoint
Noitidart Mar 2, 2018
3d397f4
Update README.md
Noitidart Mar 2, 2018
a732abe
Update README.md
Noitidart Mar 2, 2018
2d707b2
Fix IOS simulator getEnitityToken
ditkachuk Mar 2, 2018
e54955d
Merge pull request #825 from Noitidart/patch-1
Mar 2, 2018
553a442
Merge pull request #827 from ditkachuk/fix-ios-simulator
Mar 2, 2018
3486a67
Update package.json
Mar 2, 2018
a2b9e61
Fix <application> tag
coderwassananmol Mar 5, 2018
39c84ac
Added action buttons generating
SergChr Mar 5, 2018
48f287b
Syntax fixes
SergChr Mar 5, 2018
660fc9a
update example with react-native-map
Mar 5, 2018
014f2af
Merge pull request #831 from coderwassananmol/patch-1
Mar 5, 2018
40e13ca
Update README.md
Mar 5, 2018
59e5948
Update README.md
Mar 5, 2018
9791773
Update README.md
Mar 5, 2018
d53f185
Replace to _ACTION: syntax fix
SergChr Mar 5, 2018
0697e71
Modified notification field to "android_actions"
SergChr Mar 5, 2018
739816e
Merge pull request #833 from SergChr/master
Mar 5, 2018
daed2e6
Fix IntentClassName; add ability to parse android_actions array
SergChr Mar 6, 2018
966231b
Fix getEntityFCMToken resolve
ditkachuk Mar 6, 2018
ec7a4f3
Update README.md
ditkachuk Mar 6, 2018
234faf4
Merge pull request #836 from ditkachuk/fix-get-entity-fcm
Mar 6, 2018
aaf3c5e
Merge pull request #835 from SergChr/fixes-#1
Mar 6, 2018
45077bc
convert android actions to json objects
Mar 6, 2018
3e0b4d7
bump version
Mar 6, 2018
0c53f19
update example
Mar 6, 2018
04e36af
update example
Mar 6, 2018
d78529a
Update README.md
Mar 6, 2018
0e4aca8
update example
Mar 6, 2018
dffb9bf
update example
Mar 7, 2018
376343b
update example
Mar 7, 2018
4354686
Update README.md
Mar 7, 2018
ea1413e
update error message
Mar 8, 2018
a498f92
Merge branch 'master' of https://github.com/evollu/react-native-fcm i…
Titozzz Mar 12, 2018
cb16cd8
Merge pull request #4 from Titozzz/evollu-master
Titozzz Mar 12, 2018
0cd6b5c
Remove the icon
SergChr Mar 16, 2018
496e289
add icon for actions
Mar 16, 2018
76dc354
Revert "add icon for actions"
Mar 16, 2018
1b98411
Merge pull request #850 from SergChr/fixes-#2
Mar 16, 2018
f083c6f
bump version
Mar 16, 2018
d23c6ec
update import
Mar 20, 2018
5e69fc3
Update package.json
Mar 20, 2018
14bd890
update lock
Mar 20, 2018
d1f64af
Merge pull request #5 from evollu/master
Titozzz Mar 21, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Examples/simple-fcm-client/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ android {
}

dependencies {
compile(project(':react-native-maps')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
}
compile project(':react-native-fcm')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:26.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />

<uses-sdk
android:minSdkVersion="16"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.google.firebase.quickstart.fcm;

import android.content.Intent;

import com.facebook.react.ReactActivity;

public class MainActivity extends ReactActivity {
Expand All @@ -12,4 +14,11 @@ public class MainActivity extends ReactActivity {
protected String getMainComponentName() {
return "SimpleFcmClient";
}

@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.util.Log;

import com.facebook.react.ReactApplication;
import com.airbnb.android.react.maps.MapsPackage;
import com.evollu.react.fcm.FIRMessagingPackage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
Expand All @@ -25,6 +26,7 @@ public boolean getUseDeveloperSupport() {
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new MapsPackage(),
new FIRMessagingPackage()
);
}
Expand Down
2 changes: 2 additions & 0 deletions Examples/simple-fcm-client/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
rootProject.name = 'SimpleFcmClient'
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')

include ':app'
include ':react-native-fcm'
Expand Down
151 changes: 103 additions & 48 deletions Examples/simple-fcm-client/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@ import {
TouchableOpacity,
View,
Clipboard,
Platform
Platform,
ScrollView
} from 'react-native';

import FCM from "react-native-fcm";
import { StackNavigator } from 'react-navigation';

import FCM, {NotificationActionType} from "react-native-fcm";

import {registerKilledListener, registerAppListener} from "./Listeners";
import firebaseClient from "./FirebaseClient";

registerKilledListener();

export default class App extends Component {
class MainPage extends Component {
constructor(props) {
super(props);

Expand All @@ -38,11 +41,16 @@ export default class App extends Component {
description: 'used for example',
priority: 'high'
})
registerAppListener();
registerAppListener(this.props.navigation);
FCM.getInitialNotification().then(notif => {
this.setState({
initNotif: notif
})
if(notif && notif.targetScreen === 'detail'){
setTimeout(()=>{
this.props.navigation.navigate('Detail')
}, 500)
}
});

try{
Expand All @@ -65,16 +73,30 @@ export default class App extends Component {

showLocalNotification() {
FCM.presentLocalNotification({
vibrate: 500,
title: 'Hello',
channel: 'default',
body: 'Test Notification',
big_text: 'i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large, i am large',
priority: "high",
sound: "bell.mp3",
large_icon: "https://image.freepik.com/free-icon/small-boy-cartoon_318-38077.jpg",
show_in_foreground: true,
number: 10
id: new Date().valueOf().toString(), // (optional for instant notification)
title: "Test Notification with action", // as FCM payload
body: "Force touch to reply", // as FCM payload (required)
sound: "bell.mp3", // "default" or filename
priority: "high", // as FCM payload
click_action: "com.myapp.MyCategory", // as FCM payload - this is used as category identifier on iOS.
badge: 10, // as FCM payload IOS only, set 0 to clear badges
number: 10, // Android only
ticker: "My Notification Ticker", // Android only
auto_cancel: true, // Android only (default true)
large_icon: "https://image.freepik.com/free-icon/small-boy-cartoon_318-38077.jpg", // Android only
icon: "ic_launcher", // as FCM payload, you can relace this with custom icon you put in mipmap
big_text: "Show when notification is expanded", // Android only
sub_text: "This is a subText", // Android only
color: "red", // Android only
vibrate: 300, // Android only default: 300, no vibration if you pass 0
wake_screen: true, // Android only, wake up screen when notification arrives
group: "group", // Android only
picture: "https://google.png", // Android only bigPicture style
ongoing: true, // Android only
my_custom_data:'my_custom_field_value', // extra data you want to throw
lights: true, // Android only, LED blinking (default false)
show_in_foreground: true // notification when app is in foreground (local & remote)
});
}

Expand All @@ -89,7 +111,10 @@ export default class App extends Component {
priority: "high",
large_icon: "https://image.freepik.com/free-icon/small-boy-cartoon_318-38077.jpg",
show_in_foreground: true,
picture: 'https://firebase.google.com/_static/af7ae4b3fc/images/firebase/lockup.png'
picture: 'https://firebase.google.com/_static/af7ae4b3fc/images/firebase/lockup.png',
wake_screen: true,
extra1: {a: 1},
extra2: 1
});
}

Expand All @@ -102,10 +127,11 @@ export default class App extends Component {
"data":{
"custom_notification": {
"title": "Simple FCM Client",
"body": "This is a notification with only NOTIFICATION.",
"body": "Click me to go to detail",
"sound": "default",
"priority": "high",
"show_in_foreground": true
"show_in_foreground": true,
targetScreen: 'detail'
}
},
"priority": 10
Expand All @@ -115,9 +141,12 @@ export default class App extends Component {
"to": token,
"notification":{
"title": "Simple FCM Client",
"body": "This is a notification with only NOTIFICATION.",
"body": "Click me to go to detail",
"sound": "default"
},
},
data: {
targetScreen: 'detail'
},
"priority": 10
}
}
Expand All @@ -139,41 +168,33 @@ export default class App extends Component {
firebaseClient.send(JSON.stringify(body), "data");
}

sendRemoteNotificationWithData(token) {
let body = {
"to": token,
"notification":{
"title": "Simple FCM Client",
"body": "This is a notification with NOTIFICATION and DATA (NOTIF).",
"sound": "default"
},
"data":{
"hello": "there"
},
"priority": "high"
}

firebaseClient.send(JSON.stringify(body), "notification-data");
showLocalNotificationWithAction() {
FCM.presentLocalNotification({
title: 'Test Notification with action',
body: 'Force touch to reply',
priority: "high",
show_in_foreground: true,
click_action: "com.myidentifi.fcm.text", // for ios
android_actions: JSON.stringify([{
id: "view",
title: 'view'
},{
id: "dismiss",
title: 'dismiss'
}]) // for android, take syntax similar to ios's. only buttons are supported
});
}

render() {
let { token, tokenCopyFeedback } = this.state;

return (
<View style={styles.container}>
<ScrollView style={{paddingHorizontal: 20}}>
<Text style={styles.welcome}>
Welcome to Simple Fcm Client!
</Text>

<Text>
Init notif: {JSON.stringify(this.state.initNotif)}

</Text>

<Text selectable={true} onPress={() => this.setClipboardContent(this.state.token)} style={styles.instructions}>
Token: {this.state.token}
</Text>

<Text style={styles.feedback}>
{this.state.tokenCopyFeedback}
</Text>
Expand All @@ -190,17 +211,32 @@ export default class App extends Component {
<Text style={styles.buttonText}>Send Remote Data</Text>
</TouchableOpacity>

<TouchableOpacity onPress={() => this.sendRemoteNotificationWithData(token)} style={styles.button}>
<Text style={styles.buttonText}>Send Remote Notification With Data</Text>
<TouchableOpacity onPress={() => this.showLocalNotification()} style={styles.button}>
<Text style={styles.buttonText}>Show Local Notification</Text>
</TouchableOpacity>

<TouchableOpacity onPress={() => this.showLocalNotification()} style={styles.button}>
<Text style={styles.buttonText}>Send Local Notification</Text>
<TouchableOpacity onPress={() => this.showLocalNotificationWithAction(token)} style={styles.button}>
<Text style={styles.buttonText}>Show Local Notification with Action</Text>
</TouchableOpacity>

<TouchableOpacity onPress={() => this.scheduleLocalNotification()} style={styles.button}>
<Text style={styles.buttonText}>Schedule Notification in 5s</Text>
</TouchableOpacity>

<Text style={styles.instructions}>
Init notif:
</Text>
<Text>
{JSON.stringify(this.state.initNotif)}
</Text>

<Text style={styles.instructions}>
Token:
</Text>
<Text selectable={true} onPress={() => this.setClipboardContent(this.state.token)}>
{this.state.token}
</Text>
</ScrollView>
</View>
);
}
Expand All @@ -216,6 +252,25 @@ export default class App extends Component {
}
}

class DetailPage extends Component {
render(){
return <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>Detail page</Text>
</View>
}
}

export default StackNavigator({
Main: {
screen: MainPage,
},
Detail: {
screen: DetailPage
}
}, {
initialRouteName: 'Main',
});

const styles = StyleSheet.create({
container: {
flex: 1,
Expand All @@ -241,8 +296,8 @@ const styles = StyleSheet.create({
button: {
backgroundColor: "teal",
paddingHorizontal: 20,
paddingVertical: 10,
marginVertical: 15,
paddingVertical: 15,
marginVertical: 10,
borderRadius: 10
},
buttonText: {
Expand Down
Loading