75 lines
1.8 KiB
Dart
75 lines
1.8 KiB
Dart
class NotificationMessage {
|
|
String? notificationType;
|
|
String? title;
|
|
String? body;
|
|
String? id;
|
|
String? type;
|
|
String? link;
|
|
String? image;
|
|
// Remote cover image URL — set by content-service broadcasts. Used by the
|
|
// local notification builder to render a BigPictureStyle preview.
|
|
String? imageUrl;
|
|
String? photo;
|
|
String? groupKey;
|
|
String? userId;
|
|
|
|
NotificationMessage({
|
|
this.notificationType,
|
|
this.title,
|
|
this.body,
|
|
this.id,
|
|
this.type,
|
|
this.link,
|
|
this.image,
|
|
this.imageUrl,
|
|
this.photo,
|
|
this.groupKey,
|
|
this.userId,
|
|
});
|
|
|
|
NotificationMessage.fromJson(Map<String, dynamic> json) {
|
|
notificationType = json['notificationType'];
|
|
title = json['title'];
|
|
body = json['body'];
|
|
id = json['id'];
|
|
type = json['type'];
|
|
link = json['link'];
|
|
image = json['image'];
|
|
imageUrl = json['imageUrl'];
|
|
photo = json['photo'];
|
|
groupKey = json['groupKey'];
|
|
userId = json['userId'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data['notificationType'] = notificationType;
|
|
data['title'] = title;
|
|
data['body'] = body;
|
|
data['id'] = id;
|
|
data['type'] = type;
|
|
data['link'] = link;
|
|
data['image'] = image;
|
|
data['imageUrl'] = imageUrl;
|
|
data['photo'] = photo;
|
|
data['groupKey'] = groupKey;
|
|
data['userId'] = userId;
|
|
return data;
|
|
}
|
|
|
|
Map<String, String> toPayload() {
|
|
final Map<String, String> data = <String, String>{};
|
|
data['notificationType'] = notificationType ?? '';
|
|
data['title'] = title ?? '';
|
|
data['body'] = body ?? '';
|
|
data['id'] = id ?? '';
|
|
data['type'] = type ?? '';
|
|
data['link'] = link ?? '';
|
|
data['image'] = image ?? '';
|
|
data['imageUrl'] = imageUrl ?? '';
|
|
data['photo'] = photo ?? '';
|
|
data['userId'] = userId ?? '';
|
|
return data;
|
|
}
|
|
}
|