Fire notification read
This commit is contained in:
parent
04171cdc12
commit
b7468de0d1
10 changed files with 66 additions and 22 deletions
|
|
@ -9,12 +9,14 @@ final fireNotificationReducer = combineReducers<List<FireNotification>>([
|
|||
new TypedReducer<List<FireNotification>, DeletedFireNotificationAction>(
|
||||
_deletedFireNotification),
|
||||
new TypedReducer<List<FireNotification>, DeletedAllFireNotificationAction>(
|
||||
_deletedAllFireNotifications)
|
||||
_deletedAllFireNotifications),
|
||||
new TypedReducer<List<FireNotification>, ReadedFireNotificationAction>(
|
||||
_readedFireNotification)
|
||||
]);
|
||||
|
||||
List<FireNotification> _receivedFireNotification(
|
||||
List<FireNotification> yourLocations, AddedFireNotificationAction action) {
|
||||
return new List.from(yourLocations)..add(action.notif);
|
||||
List<FireNotification> notifications, AddedFireNotificationAction action) {
|
||||
return new List.from(notifications)..add(action.notif);
|
||||
}
|
||||
|
||||
List<FireNotification> _deletedFireNotification(
|
||||
|
|
@ -22,6 +24,14 @@ List<FireNotification> _deletedFireNotification(
|
|||
return new List.from(notifications)..remove(action.notif);
|
||||
}
|
||||
|
||||
List<FireNotification> _readedFireNotification(
|
||||
List<FireNotification> notifications, ReadedFireNotificationAction action) {
|
||||
return notifications
|
||||
.map((yourLocation) =>
|
||||
yourLocation.id == action.notif.id ? action.notif : yourLocation)
|
||||
.toList();
|
||||
}
|
||||
|
||||
List<FireNotification> _deletedAllFireNotifications(
|
||||
List<FireNotification> notifications, DeletedAllFireNotificationAction action) {
|
||||
return new List<FireNotification>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue