2019-03-11 15:14:37 +01:00
|
|
|
public enum Tootle.API.NotificationType {
|
2018-04-17 14:01:55 +02:00
|
|
|
MENTION,
|
|
|
|
REBLOG,
|
2019-03-08 12:54:44 +01:00
|
|
|
REBLOG_REMOTE_USER, // Internal
|
2018-04-17 14:01:55 +02:00
|
|
|
FAVORITE,
|
2018-05-09 17:32:53 +02:00
|
|
|
FOLLOW,
|
2019-03-08 12:54:44 +01:00
|
|
|
FOLLOW_REQUEST, // Internal
|
|
|
|
WATCHLIST; // Internal
|
2018-04-17 14:01:55 +02:00
|
|
|
|
|
|
|
public string to_string() {
|
|
|
|
switch (this) {
|
|
|
|
case MENTION:
|
|
|
|
return "mention";
|
|
|
|
case REBLOG:
|
|
|
|
return "reblog";
|
2019-03-08 12:54:44 +01:00
|
|
|
case REBLOG_REMOTE_USER:
|
|
|
|
return "reblog_remote";
|
2018-04-17 14:01:55 +02:00
|
|
|
case FAVORITE:
|
|
|
|
return "favourite";
|
|
|
|
case FOLLOW:
|
|
|
|
return "follow";
|
2018-05-09 17:32:53 +02:00
|
|
|
case FOLLOW_REQUEST:
|
|
|
|
return "follow_request";
|
2018-07-14 10:37:41 +02:00
|
|
|
case WATCHLIST:
|
|
|
|
return "watchlist";
|
2018-04-17 14:01:55 +02:00
|
|
|
default:
|
|
|
|
assert_not_reached();
|
|
|
|
}
|
|
|
|
}
|
2019-03-08 12:54:44 +01:00
|
|
|
|
2018-04-17 14:01:55 +02:00
|
|
|
public static NotificationType from_string (string str) {
|
|
|
|
switch (str) {
|
|
|
|
case "mention":
|
|
|
|
return MENTION;
|
|
|
|
case "reblog":
|
|
|
|
return REBLOG;
|
2019-03-08 12:54:44 +01:00
|
|
|
case "reblog_remote":
|
|
|
|
return REBLOG_REMOTE_USER;
|
2018-04-17 14:01:55 +02:00
|
|
|
case "favourite":
|
|
|
|
return FAVORITE;
|
|
|
|
case "follow":
|
|
|
|
return FOLLOW;
|
2018-05-09 17:32:53 +02:00
|
|
|
case "follow_request":
|
|
|
|
return FOLLOW_REQUEST;
|
2018-07-14 10:37:41 +02:00
|
|
|
case "watchlist":
|
|
|
|
return WATCHLIST;
|
2018-04-17 14:01:55 +02:00
|
|
|
default:
|
|
|
|
assert_not_reached();
|
|
|
|
}
|
|
|
|
}
|
2019-03-08 12:54:44 +01:00
|
|
|
|
2018-04-17 14:01:55 +02:00
|
|
|
public string get_desc (Account? account) {
|
|
|
|
switch (this) {
|
|
|
|
case MENTION:
|
2019-03-08 12:54:44 +01:00
|
|
|
return _("<span underline=\"none\"><a href=\"%s\"><b>%s</b></a> mentioned you</span>").printf (account.url, account.display_name);
|
2018-04-17 14:01:55 +02:00
|
|
|
case REBLOG:
|
2019-03-08 12:54:44 +01:00
|
|
|
return _("<span underline=\"none\"><a href=\"%s\"><b>%s</b></a> boosted your toot</span>").printf (account.url, account.display_name);
|
|
|
|
case REBLOG_REMOTE_USER:
|
|
|
|
return _("<span underline=\"none\"><a href=\"%s\"><b>%s</b></a> boosted</span>").printf (account.url, account.display_name);
|
2018-04-17 14:01:55 +02:00
|
|
|
case FAVORITE:
|
2019-03-08 12:54:44 +01:00
|
|
|
return _("<span underline=\"none\"><a href=\"%s\"><b>%s</b></a> favorited your toot</span>").printf (account.url, account.display_name);
|
2018-04-17 14:01:55 +02:00
|
|
|
case FOLLOW:
|
2019-03-08 12:54:44 +01:00
|
|
|
return _("<span underline=\"none\"><a href=\"%s\"><b>%s</b></a> now follows you</span>").printf (account.url, account.display_name);
|
2018-05-09 17:32:53 +02:00
|
|
|
case FOLLOW_REQUEST:
|
2019-03-08 12:54:44 +01:00
|
|
|
return _("<span underline=\"none\"><a href=\"%s\"><b>%s</b></a> wants to follow you</span>").printf (account.url, account.display_name);
|
2018-07-14 10:37:41 +02:00
|
|
|
case WATCHLIST:
|
2019-03-08 12:54:44 +01:00
|
|
|
return _("<span underline=\"none\"><a href=\"%s\"><b>%s</b></a> posted a toot</span>").printf (account.url, account.display_name);
|
2018-04-17 14:01:55 +02:00
|
|
|
default:
|
|
|
|
assert_not_reached();
|
|
|
|
}
|
|
|
|
}
|
2019-03-08 12:54:44 +01:00
|
|
|
|
2018-04-17 14:01:55 +02:00
|
|
|
public string get_icon () {
|
|
|
|
switch (this) {
|
|
|
|
case MENTION:
|
2018-07-14 10:37:41 +02:00
|
|
|
case WATCHLIST:
|
2018-04-17 14:01:55 +02:00
|
|
|
return "user-available-symbolic";
|
|
|
|
case REBLOG:
|
2018-06-03 18:44:36 +02:00
|
|
|
return "media-playlist-repeat-symbolic";
|
2018-04-17 14:01:55 +02:00
|
|
|
case FAVORITE:
|
2019-03-09 11:32:26 +01:00
|
|
|
return "emblem-favorite-symbolic";
|
2018-04-17 14:01:55 +02:00
|
|
|
case FOLLOW:
|
2018-05-09 17:32:53 +02:00
|
|
|
case FOLLOW_REQUEST:
|
2018-04-17 14:01:55 +02:00
|
|
|
return "contact-new-symbolic";
|
|
|
|
default:
|
|
|
|
assert_not_reached();
|
|
|
|
}
|
|
|
|
}
|
2019-03-08 12:54:44 +01:00
|
|
|
|
2018-04-17 14:01:55 +02:00
|
|
|
}
|