@@ -15,7 +15,12 @@ import 'package:flutter_twitter_clone/state/appState.dart';
15
15
16
16
class NotificationState extends AppState {
17
17
String fcmToken;
18
- NotificationType notificationType = NotificationType .NOT_DETERMINED ;
18
+ NotificationType _notificationType = NotificationType .NOT_DETERMINED ;
19
+ String notificationReciverId;
20
+ NotificationType get notificationType => _notificationType;
21
+ set setrNotificationType (NotificationType type){
22
+ _notificationType = type;
23
+ }
19
24
// FcmNotificationModel notification;
20
25
String notificationSenderId;
21
26
dabase.Query query;
@@ -151,24 +156,25 @@ class NotificationState extends AppState {
151
156
void initfirebaseService (){
152
157
_firebaseMessaging.configure (
153
158
onMessage: (Map <String , dynamic > message) async {
154
- print ("onMessage: $message " );
159
+ // print("onMessage: $message");
155
160
print (message['data' ]);
156
161
notifyListeners ();
157
162
},
158
163
onLaunch: (Map <String , dynamic > message) async {
159
- cprint ("Send to " ,event: "UnBox " );
164
+ cprint ("Notification " ,event: "onLaunch " );
160
165
var data = message['data' ];
161
- print (message['data' ]);
166
+ // print(message['data']);
162
167
notificationSenderId = data["userId" ];
163
- notificationType = NotificationType .Message ;
168
+ setrNotificationType = NotificationType .Message ;
164
169
notifyListeners ();
165
170
},
166
171
onResume: (Map <String , dynamic > message) async {
167
- cprint ("Send to " ,event: "UnBox " );
172
+ cprint ("Notification " ,event: "onResume " );
168
173
var data = message['data' ];
169
- print (message['data' ]);
170
- notificationSenderId = data["userId" ];
171
- notificationType = NotificationType .Message ;
174
+ // print(message['data']);
175
+ notificationSenderId = data["senderId" ];
176
+ notificationReciverId = data["receiverId" ];
177
+ setrNotificationType = NotificationType .Message ;
172
178
notifyListeners ();
173
179
},
174
180
);
0 commit comments