fix cws not doing anything

This commit is contained in:
zoe 2022-08-30 11:34:30 +02:00
parent 6876d2b053
commit 1c7e11f503
1 changed files with 21 additions and 2 deletions

View File

@ -19,8 +19,8 @@ class NotificationModel implements Comparable {
time = json["created_at"];
id = json["id"];
account = AccountModel.fromJson(json["account"]);
type = NotificationType.values.firstWhere(
(element) => element.name == "NotificationType.${json["type"]}");
type = NotificationType.values
.firstWhere((element) => element.param == json["type"]);
if (json["status"] != null) {
post = PostModel.fromJson(json["status"], identity);
}
@ -122,6 +122,25 @@ extension NotificationTypeExtension on NotificationType {
}
}
String get param {
switch (this) {
case NotificationType.favourite:
return "favourite";
case NotificationType.followRequest:
return "follow_request";
case NotificationType.mention:
return "mention";
case NotificationType.reblog:
return "reblog";
case NotificationType.poll:
return "poll";
case NotificationType.status:
return "status";
case NotificationType.follow:
return "follow";
}
}
IconData get icon {
switch (this) {
case NotificationType.follow: