@@ -16,15 +16,17 @@ import '../model/narrow.dart';
16
16
import 'dialog.dart' ;
17
17
import 'store.dart' ;
18
18
19
- Future <void > markNarrowAsRead (
19
+ /// Returns true if mark as read process is completed successfully.
20
+ Future <bool > markNarrowAsRead (
20
21
BuildContext context,
21
22
Narrow narrow,
22
23
bool useLegacy, // TODO(server-6)
23
24
) async {
24
25
final store = PerAccountStoreWidget .of (context);
25
26
final connection = store.connection;
26
27
if (useLegacy) {
27
- return await _legacyMarkNarrowAsRead (context, narrow);
28
+ await _legacyMarkNarrowAsRead (context, narrow);
29
+ return true ;
28
30
}
29
31
30
32
// Compare web's `mark_all_as_read` in web/src/unread_ops.js
@@ -66,7 +68,7 @@ Future<void> markNarrowAsRead(
66
68
flag: MessageFlag .read);
67
69
if (! context.mounted) {
68
70
scaffoldMessenger.clearSnackBars ();
69
- return ;
71
+ return false ;
70
72
}
71
73
responseCount++ ;
72
74
updatedCount += result.updatedCount;
@@ -81,7 +83,7 @@ Future<void> markNarrowAsRead(
81
83
..showSnackBar (SnackBar (behavior: SnackBarBehavior .floating,
82
84
content: Text (zulipLocalizations.markAsReadComplete (updatedCount))));
83
85
}
84
- return ;
86
+ return true ;
85
87
}
86
88
87
89
if (result.lastProcessedId == null ) {
@@ -91,7 +93,7 @@ Future<void> markNarrowAsRead(
91
93
await showErrorDialog (context: context,
92
94
title: zulipLocalizations.errorMarkAsReadFailedTitle,
93
95
message: zulipLocalizations.errorInvalidResponse);
94
- return ;
96
+ return false ;
95
97
}
96
98
anchor = NumericAnchor (result.lastProcessedId! );
97
99
0 commit comments