@@ -86,8 +86,6 @@ class _InboxPageState extends State<InboxPage> with PerAccountStoreAwareStateMix
86
86
@override
87
87
Widget build (BuildContext context) {
88
88
final store = PerAccountStoreWidget .of (context);
89
-
90
- final streams = store.streams;
91
89
final subscriptions = store.subscriptions;
92
90
93
91
// TODO(perf) make an incrementally-updated view-model for InboxPage
@@ -111,30 +109,26 @@ class _InboxPageState extends State<InboxPage> with PerAccountStoreAwareStateMix
111
109
}
112
110
113
111
final sortedUnreadStreams = unreadsModel! .streams.entries
114
- .where ((entry) =>
115
- streams.containsKey (entry.key) // TODO(log) a bug if missing in streams
116
- // Filter out any straggling unreads in unsubscribed streams.
117
- // There won't normally be any, but it happens with certain infrequent
118
- // state changes, typically for less than a few hundred milliseconds.
119
- // See [Unreads].
120
- //
121
- // Also, we want to depend on the subscription data for things like
122
- // choosing the stream icon.
123
- && subscriptions.containsKey (entry.key))
112
+ // Filter out any straggling unreads in unsubscribed streams.
113
+ // There won't normally be any, but it happens with certain infrequent
114
+ // state changes, typically for less than a few hundred milliseconds.
115
+ // See [Unreads].
116
+ //
117
+ // Also, we want to depend on the subscription data for things like
118
+ // choosing the stream icon.
119
+ .where ((entry) => subscriptions.containsKey (entry.key))
124
120
.toList ()
125
121
..sort ((a, b) {
122
+ final subA = subscriptions[a.key]! ;
123
+ final subB = subscriptions[b.key]! ;
124
+
126
125
// TODO "pin" icon on the stream row? dividers in the list?
127
- final aPinned = subscriptions[a.key]! .pinToTop;
128
- final bPinned = subscriptions[b.key]! .pinToTop;
129
- if (aPinned != bPinned) {
130
- return aPinned ? - 1 : 1 ;
126
+ if (subA.pinToTop != subB.pinToTop) {
127
+ return subA.pinToTop ? - 1 : 1 ;
131
128
}
132
129
133
- final streamA = streams[a.key]! ;
134
- final streamB = streams[b.key]! ;
135
-
136
130
// TODO(i18n) something like JS's String.prototype.localeCompare
137
- return streamA .name.toLowerCase ().compareTo (streamB .name.toLowerCase ());
131
+ return subA .name.toLowerCase ().compareTo (subB .name.toLowerCase ());
138
132
});
139
133
140
134
for (final MapEntry (key: streamId, value: topics) in sortedUnreadStreams) {
0 commit comments