Poll notifications (#1229)

* show poll notifications in the app

* show poll notifications in the app

* allow filtering poll notifications in the poll fragment

* show poll notifications in system notifications
This commit is contained in:
Konrad Pozniak 2019-05-02 19:44:35 +02:00 committed by GitHub
commit e735e4843e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 1076 additions and 318 deletions

View file

@ -222,7 +222,8 @@ public class NotificationsFragment extends SFragment implements
recyclerView.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL));
adapter = new NotificationsAdapter(dataSource, this, this);
adapter = new NotificationsAdapter(accountManager.getActiveAccount().getAccountId(),
dataSource, this, this);
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
alwaysShowSensitiveMedia = accountManager.getActiveAccount().getAlwaysShowSensitiveMedia();
boolean mediaPreviewEnabled = accountManager.getActiveAccount().getMediaPreviewEnabled();
@ -652,13 +653,15 @@ public class NotificationsFragment extends SFragment implements
private String getNotificationText(Notification.Type type) {
switch (type) {
case MENTION:
return getString(R.string.filter_mentions);
return getString(R.string.notification_mention_name);
case FAVOURITE:
return getString(R.string.filter_favorites);
return getString(R.string.notification_favourite_name);
case REBLOG:
return getString(R.string.filter_boosts);
return getString(R.string.notification_boost_name);
case FOLLOW:
return getString(R.string.filter_follows);
return getString(R.string.notification_follow_name);
case POLL:
return getString(R.string.notification_poll_name);
default:
return "Unknown";
}

View file

@ -62,6 +62,10 @@ class NotificationPreferencesFragment : PreferenceFragmentCompat(), Preference.O
favoritedPref.isChecked = activeAccount.notificationsFavorited
favoritedPref.onPreferenceChangeListener = this
val pollsPref = requirePreference("notificationFilterPolls") as SwitchPreference
pollsPref.isChecked = activeAccount.notificationsPolls
pollsPref.onPreferenceChangeListener = this
val soundPref = requirePreference("notificationAlertSound") as SwitchPreference
soundPref.isChecked = activeAccount.notificationSound
soundPref.onPreferenceChangeListener = this
@ -94,6 +98,7 @@ class NotificationPreferencesFragment : PreferenceFragmentCompat(), Preference.O
"notificationFilterFollows" -> activeAccount.notificationsFollowed = newValue as Boolean
"notificationFilterReblogs" -> activeAccount.notificationsReblogged = newValue as Boolean
"notificationFilterFavourites" -> activeAccount.notificationsFavorited = newValue as Boolean
"notificationFilterPolls" -> activeAccount.notificationsPolls = newValue as Boolean
"notificationAlertSound" -> activeAccount.notificationSound = newValue as Boolean
"notificationAlertVibrate" -> activeAccount.notificationVibration = newValue as Boolean
"notificationAlertLight" -> activeAccount.notificationLight = newValue as Boolean