@@ -16,8 +16,7 @@ import '../model/narrow.dart';
16
16
import 'dialog.dart' ;
17
17
import 'store.dart' ;
18
18
19
- /// Returns true if mark as read process is completed successfully.
20
- Future <bool > markNarrowAsRead (
19
+ Future <void > markNarrowAsRead (
21
20
BuildContext context,
22
21
Narrow narrow,
23
22
bool useLegacy, // TODO(server-6)
@@ -27,7 +26,7 @@ Future<bool> markNarrowAsRead(
27
26
final connection = store.connection;
28
27
if (useLegacy) {
29
28
await _legacyMarkNarrowAsRead (context, narrow);
30
- return true ;
29
+ return ;
31
30
}
32
31
33
32
// Compare web's `mark_all_as_read` in web/src/unread_ops.js
@@ -69,7 +68,7 @@ Future<bool> markNarrowAsRead(
69
68
flag: MessageFlag .read);
70
69
if (! context.mounted) {
71
70
scaffoldMessenger.clearSnackBars ();
72
- return false ;
71
+ return ;
73
72
}
74
73
responseCount++ ;
75
74
updatedCount += result.updatedCount;
@@ -84,7 +83,7 @@ Future<bool> markNarrowAsRead(
84
83
..showSnackBar (SnackBar (behavior: SnackBarBehavior .floating,
85
84
content: Text (zulipLocalizations.markAsReadComplete (updatedCount))));
86
85
}
87
- return true ;
86
+ break ;
88
87
}
89
88
90
89
if (result.lastProcessedId == null ) {
@@ -94,7 +93,7 @@ Future<bool> markNarrowAsRead(
94
93
showErrorDialog (context: context,
95
94
title: zulipLocalizations.errorMarkAsReadFailedTitle,
96
95
message: zulipLocalizations.errorInvalidResponse);
97
- return false ;
96
+ return ;
98
97
}
99
98
anchor = NumericAnchor (result.lastProcessedId! );
100
99
@@ -116,12 +115,16 @@ Future<bool> markNarrowAsRead(
116
115
content: Text (zulipLocalizations.markAsReadInProgress)));
117
116
}
118
117
} catch (e) {
119
- if (! context.mounted) return false ;
118
+ if (! context.mounted) return ;
120
119
final zulipLocalizations = ZulipLocalizations .of (context);
121
120
showErrorDialog (context: context,
122
121
title: zulipLocalizations.errorMarkAsReadFailedTitle,
123
122
message: e.toString ()); // TODO(#741): extract user-facing message better
124
- return false ;
123
+ return ;
124
+ }
125
+ if (! context.mounted) return ;
126
+ if (narrow is CombinedFeedNarrow ) {
127
+ PerAccountStoreWidget .of (context).unreads.handleAllMessagesReadSuccess ();
125
128
}
126
129
}
127
130
0 commit comments