Support grouping follow notifications (AND-230)

This commit is contained in:
Grishka 2024-10-31 10:09:42 +03:00
parent 603c058ec9
commit c2f6b16aff
4 changed files with 9 additions and 4 deletions

View file

@ -13,8 +13,8 @@ android {
applicationId "org.joinmastodon.android" applicationId "org.joinmastodon.android"
minSdk 23 minSdk 23
targetSdk 34 targetSdk 34
versionCode 123 versionCode 125
versionName "2.7.3" versionName "2.8.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }

View file

@ -27,10 +27,10 @@ public enum NotificationType{
MODERATION_WARNING; MODERATION_WARNING;
public boolean canBeGrouped(){ public boolean canBeGrouped(){
return this==REBLOG || this==FAVORITE; return this==REBLOG || this==FAVORITE || this==FOLLOW;
} }
public static EnumSet<NotificationType> getGroupableTypes(){ public static EnumSet<NotificationType> getGroupableTypes(){
return EnumSet.of(FAVORITE, REBLOG); return EnumSet.of(FAVORITE, REBLOG, FOLLOW);
} }
} }

View file

@ -73,6 +73,7 @@ public class NotificationHeaderStatusDisplayItem extends StatusDisplayItem{
text=parentFragment.getResources().getQuantityString(switch(notification.notification.type){ text=parentFragment.getResources().getQuantityString(switch(notification.notification.type){
case FAVORITE -> R.plurals.user_and_x_more_favorited; case FAVORITE -> R.plurals.user_and_x_more_favorited;
case REBLOG -> R.plurals.user_and_x_more_boosted; case REBLOG -> R.plurals.user_and_x_more_boosted;
case FOLLOW -> R.plurals.user_and_x_more_followed;
default -> throw new IllegalStateException("Unexpected value: " + notification.notification.type); default -> throw new IllegalStateException("Unexpected value: " + notification.notification.type);
}, notification.notification.notificationsCount-1, "{{name}}", notification.notification.notificationsCount-1); }, notification.notification.notificationsCount-1, "{{name}}", notification.notification.notificationsCount-1);
}else if(notification.notification.type==NotificationType.POLL){ }else if(notification.notification.type==NotificationType.POLL){

View file

@ -814,4 +814,8 @@
<string name="avatar_move_and_scale">Move and scale</string> <string name="avatar_move_and_scale">Move and scale</string>
<string name="confirm_avatar_crop">Choose</string> <string name="confirm_avatar_crop">Choose</string>
<string name="settings_use_dynamic_colors">Use system dynamic color</string> <string name="settings_use_dynamic_colors">Use system dynamic color</string>
<plurals name="user_and_x_more_followed">
<item quantity="one">%1$s and %2$,d other followed you</item>
<item quantity="other">%1$s and %2$,d others followed you</item>
</plurals>
</resources> </resources>