@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
22
33import '../api/model/model.dart' ;
44import '../generated/l10n/zulip_localizations.dart' ;
5+ import '../model/channel.dart' ;
56import '../model/narrow.dart' ;
67import '../model/unreads.dart' ;
78import 'action_sheet.dart' ;
@@ -66,27 +67,12 @@ class _SubscriptionListPageBodyState extends State<SubscriptionListPageBody> wit
6667 });
6768 }
6869
69- // TODO(linter): The linter incorrectly flags the following regexp string
70- // as invalid. See: https://github.com/dart-lang/sdk/issues/61246
71- // ignore: valid_regexps
72- static final _startsWithEmojiRegex = RegExp (r'^\p{Emoji}' , unicode: true );
73-
7470 void _sortSubs (List <Subscription > list) {
7571 list.sort ((a, b) {
7672 if (a.isMuted && ! b.isMuted) return 1 ;
7773 if (! a.isMuted && b.isMuted) return - 1 ;
7874
79- // A user gave feedback wanting zulip-flutter to match web in putting
80- // emoji-prefixed channels first; see #1202.
81- // For matching web's ordering completely, see:
82- // https://github.com/zulip/zulip-flutter/issues/1165
83- final aStartsWithEmoji = _startsWithEmojiRegex.hasMatch (a.name);
84- final bStartsWithEmoji = _startsWithEmojiRegex.hasMatch (b.name);
85- if (aStartsWithEmoji && ! bStartsWithEmoji) return - 1 ;
86- if (! aStartsWithEmoji && bStartsWithEmoji) return 1 ;
87-
88- // TODO(i18n): add locale-aware sorting
89- return a.name.toLowerCase ().compareTo (b.name.toLowerCase ());
75+ return ChannelStore .compareChannelsByName (a, b);
9076 });
9177 }
9278
0 commit comments