This repository was archived by the owner on Jan 14, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +6
-9
lines changed Expand file tree Collapse file tree 4 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -212,7 +212,7 @@ PushNotification.configure({
212212 console .log (" TOKEN:" , token);
213213 },
214214
215- // (required) Called when a remote is received in foreground or opened, or local notification is opened
215+ // (required) Called when a remote is received or opened, or local notification is opened
216216 onNotification : function (notification ) {
217217 console .log (" NOTIFICATION:" , notification);
218218
Original file line number Diff line number Diff line change @@ -120,13 +120,10 @@ export default class App extends Component {
120120 }
121121
122122 onRegister ( token ) {
123- //Alert.alert('Registered !', JSON.stringify(token));
124- console . log ( token ) ;
125123 this . setState ( { registerToken : token . token , fcmRegistered : true } ) ;
126124 }
127125
128126 onNotif ( notif ) {
129- console . log ( 'onNotification' , notif ) ;
130127 Alert . alert ( notif . title , notif . message ) ;
131128 }
132129
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ export default class NotifService {
55 constructor ( onRegister , onNotification ) {
66 this . lastId = 0 ;
77
8- NotificationHandler . onRegister ( onRegister ) ;
8+ NotificationHandler . attachRegister ( onRegister ) ;
99 NotificationHandler . attachNotification ( onNotification ) ;
1010
1111 // Clear badge number at start
Original file line number Diff line number Diff line change @@ -2,15 +2,15 @@ import PushNotification from 'react-native-push-notification';
22
33class NotificationHandler {
44 onNotification ( notification ) {
5- console . log ( notification ) ;
5+ console . log ( 'NotificationHandler:' , notification ) ;
66
77 if ( typeof this . _onNotification === 'function' ) {
88 this . _onNotification ( notification ) ;
99 }
1010 }
1111
1212 onRegister ( token ) {
13- console . log ( token ) ;
13+ console . log ( 'NotificationHandler:' , token ) ;
1414
1515 if ( typeof this . _onRegister === 'function' ) {
1616 this . _onRegister ( token ) ;
@@ -30,10 +30,10 @@ const handler = new NotificationHandler();
3030
3131PushNotification . configure ( {
3232 // (optional) Called when Token is generated (iOS and Android)
33- onRegister : handler . onRegister . bind ( handler ) , //this._onRegister.bind(this),
33+ onRegister : handler . onRegister . bind ( handler ) ,
3434
3535 // (required) Called when a remote or local notification is opened or received
36- onNotification : handler . onNotification . bind ( handler ) , //this._onNotification,
36+ onNotification : handler . onNotification . bind ( handler ) ,
3737
3838 // IOS ONLY (optional): default: all - Permissions to register.
3939 permissions : {
You can’t perform that action at this time.
0 commit comments