Support getting push notifications on move
Based on 28a02cf72a
by a1ba.
This commit is contained in:
parent
384503b96b
commit
1906507ff7
|
@ -129,6 +129,7 @@ public class NotificationHelper {
|
|||
public static final String CHANNEL_REPORT = "CHANNEL_REPORT";
|
||||
public static final String CHANNEL_BACKGROUND_TASKS = "CHANNEL_BACKGROUND_TASKS";
|
||||
public static final String CHANNEL_EMOJI_REACTION = "CHANNEL_EMOJI_REACTION";
|
||||
public static final String CHANNEL_MOVE = "CHANNEL_MOVE";
|
||||
|
||||
/**
|
||||
* WorkManager Tag
|
||||
|
@ -540,6 +541,7 @@ public class NotificationHelper {
|
|||
CHANNEL_UPDATES + account.getIdentifier(),
|
||||
CHANNEL_REPORT + account.getIdentifier(),
|
||||
CHANNEL_EMOJI_REACTION + account.getIdentifier(),
|
||||
CHANNEL_MOVE + account.getIdentifier(),
|
||||
};
|
||||
int[] channelNames = {
|
||||
R.string.notification_mention_name,
|
||||
|
@ -553,6 +555,7 @@ public class NotificationHelper {
|
|||
R.string.notification_update_name,
|
||||
R.string.notification_report_name,
|
||||
R.string.notification_emoji_name,
|
||||
R.string.notification_move_name,
|
||||
};
|
||||
int[] channelDescriptions = {
|
||||
R.string.notification_mention_descriptions,
|
||||
|
@ -566,6 +569,7 @@ public class NotificationHelper {
|
|||
R.string.notification_update_description,
|
||||
R.string.notification_report_description,
|
||||
R.string.notification_emoji_description,
|
||||
R.string.notification_move_description,
|
||||
};
|
||||
|
||||
List<NotificationChannel> channels = new ArrayList<>(6);
|
||||
|
@ -710,6 +714,8 @@ public class NotificationHelper {
|
|||
return account.getNotificationsReports();
|
||||
case EMOJI_REACTION:
|
||||
return account.getNotificationsEmojiReactions();
|
||||
case MOVE:
|
||||
return account.getNotificationsMoves();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -841,6 +847,8 @@ public class NotificationHelper {
|
|||
|
||||
private static String bodyForType(Notification notification, Context context, Boolean alwaysOpenSpoiler) {
|
||||
switch (notification.getType()) {
|
||||
case MOVE:
|
||||
return "@" + notification.getTarget().getUsername();
|
||||
case FOLLOW:
|
||||
case FOLLOW_REQUEST:
|
||||
case SIGN_UP:
|
||||
|
|
|
@ -166,6 +166,17 @@ class NotificationPreferencesFragment : PreferenceFragmentCompat(), Injectable {
|
|||
true
|
||||
}
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
setTitle(R.string.pref_title_notification_filter_move)
|
||||
key = PrefKeys.NOTIFICATION_FILTER_MOVES
|
||||
isIconSpaceReserved = false
|
||||
isChecked = activeAccount.notificationsMoves
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
updateAccount { it.notificationsMoves = newValue as Boolean }
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
preferenceCategory(R.string.pref_title_notification_alerts) { category ->
|
||||
|
|
|
@ -58,6 +58,8 @@ data class AccountEntity(
|
|||
var notificationsReports: Boolean = true,
|
||||
@ColumnInfo(defaultValue = "1")
|
||||
var notificationsEmojiReactions: Boolean = true,
|
||||
@ColumnInfo(defaultValue = "1")
|
||||
var notificationsMoves: Boolean = true,
|
||||
var notificationSound: Boolean = true,
|
||||
var notificationVibration: Boolean = true,
|
||||
var notificationLight: Boolean = true,
|
||||
|
|
|
@ -100,6 +100,7 @@ object PrefKeys {
|
|||
const val NOTIFICATION_FILTER_UPDATES = "notificationFilterUpdates"
|
||||
const val NOTIFICATION_FILTER_REPORTS = "notificationFilterReports"
|
||||
const val NOTIFICATION_FILTER_EMOJI_REACTIONS = "notificationFilterEmojiReactions"
|
||||
const val NOTIFICATION_FILTER_MOVES = "notificationFilterMoves"
|
||||
|
||||
const val TAB_FILTER_HOME_REPLIES = "tabFilterHomeReplies_v2" // This was changed once to reset an unintentionally set default.
|
||||
const val TAB_FILTER_HOME_BOOSTS = "tabFilterHomeBoosts"
|
||||
|
|
|
@ -16,5 +16,7 @@
|
|||
<string name="pref_title_notification_filter_emoji">my posts are reacted with emojis</string>
|
||||
<string name="notification_move_format">%s migrated to</string>
|
||||
<string name="notification_move_name">Move</string>
|
||||
<string name="notification_move_description">Notifications when somebody you\'re following migrated to another profile</string>
|
||||
<string name="pref_title_notification_filter_move">somebody I\'m following migrated to another profile</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue