Commit aaee6819 authored by 0xd9a's avatar 0xd9a
Browse files

Replace an if/'else if' block with switch/case

parent 82e72747
Loading
Loading
Loading
Loading
+23 −29
Original line number Diff line number Diff line
@@ -235,7 +235,8 @@ public class FragmentMastodonNotification extends Fragment implements Notificati
        excludeType.add("admin.sign_up");
        excludeType.add("admin.report");
        excludeType.add("pleroma:emoji_reaction");
        if (notificationType == NotificationTypeEnum.ALL) {
        switch (notificationType) {
            case ALL -> {
                aggregateNotification = sharedpreferences.getBoolean(getString(R.string.SET_AGGREGATE_NOTIFICATION), true);
                if (excludedCategories != null) {
                    excludeType = new ArrayList<>();
@@ -244,28 +245,21 @@ public class FragmentMastodonNotification extends Fragment implements Notificati
                } else {
                    excludeType = null;
                }
        } else if (notificationType == NotificationTypeEnum.MENTIONS) {
            excludeType.remove("mention");
        } else if (notificationType == NotificationTypeEnum.FAVOURITES) {
            excludeType.remove("favourite");
        } else if (notificationType == NotificationTypeEnum.REBLOGS) {
            excludeType.remove("reblog");
        } else if (notificationType == NotificationTypeEnum.QUOTES) {
            excludeType.remove("quote");
        } else if (notificationType == NotificationTypeEnum.POLLS) {
            excludeType.remove("poll");
        } else if (notificationType == NotificationTypeEnum.UPDATES) {
            excludeType.remove("update");
        } else if (notificationType == NotificationTypeEnum.TOOTS) {
            excludeType.remove("status");
        } else if (notificationType == NotificationTypeEnum.ADMIN_SIGNUP) {
            excludeType.remove("admin.sign_up");
        } else if (notificationType == NotificationTypeEnum.ADMIN_REPORT) {
            excludeType.remove("admin.report");
        } else if (notificationType == NotificationTypeEnum.FOLLOWS) {
            }
            case MENTIONS -> excludeType.remove("mention");
            case FAVOURITES -> excludeType.remove("favourite");
            case UPDATES -> excludeType.remove("update");
            case REBLOGS -> excludeType.remove("reblog");
            case QUOTES -> excludeType.remove("quote");
            case POLLS -> excludeType.remove("poll");
            case ADMIN_SIGNUP -> excludeType.remove("admin.sign_up");
            case ADMIN_REPORT -> excludeType.remove("admin.report");
            case TOOTS -> excludeType.remove("status");
            case FOLLOWS -> {
                excludeType.remove("follow");
                excludeType.remove("follow_request");
            }
        }
        return excludeType;
    }