Skip to content

Commit 4c88bce

Browse files
committed
wip/link2 msglist: Fetch at first unread, optionally, instead of newest; TODO test
Fixes 80. This differs from the behavior of the legacy mobile app, and the original plan for 80: instead of always using the first unread, by default we use the first unread only for conversation narrows, and stick with the newest message for interleaved narrows. The reason is that once I implemented this behavior (for all narrows) and started trying it out, I immediately found that it was a lot slower than fetching the newest message any time I went to the combined feed, or to some channel feeds -- anywhere that I have a large number of unreads, it seems. The request to the server can take several seconds to complete. In retrospect it's unsurprising that this might be a naturally slower request for the database to handle. In any case, in a view where I have lots of accumulated old unreads, I don't really want to start from the first unread anyway: I want to look at the newest history, and perhaps scroll back a bit from there, to see the messages that are relevant now. OTOH for someone who makes a practice of keeping their Zulip unreads clear, the first unread will be relevant now, and they'll likely want to start from there even in interleaved views. So make it a setting.
1 parent 8c1ba1f commit 4c88bce

22 files changed

+1496
-13
lines changed

assets/l10n/app_en.arb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,26 @@
955955
"@pollWidgetOptionsMissing": {
956956
"description": "Text to display for a poll when it has no options"
957957
},
958+
"initialAnchorSettingTitle": "Open message feeds at",
959+
"@initialAnchorSettingTitle": {
960+
"description": "Title of setting controlling initial anchor of message list."
961+
},
962+
"initialAnchorSettingDescription": "You can choose whether message feeds open at your first unread message or at the newest messages.",
963+
"@initialAnchorSettingDescription": {
964+
"description": "Description of setting controlling initial anchor of message list."
965+
},
966+
"initialAnchorSettingFirstUnreadAlways": "First unread message",
967+
"@initialAnchorSettingFirstUnreadAlways": {
968+
"description": "Label for a value of setting controlling initial anchor of message list."
969+
},
970+
"initialAnchorSettingFirstUnreadConversations": "First unread message in single conversations, newest message elsewhere",
971+
"@initialAnchorSettingFirstUnreadConversations": {
972+
"description": "Label for a value of setting controlling initial anchor of message list."
973+
},
974+
"initialAnchorSettingNewestAlways": "Newest message",
975+
"@initialAnchorSettingNewestAlways": {
976+
"description": "Label for a value of setting controlling initial anchor of message list."
977+
},
958978
"experimentalFeatureSettingsPageTitle": "Experimental features",
959979
"@experimentalFeatureSettingsPageTitle": {
960980
"description": "Title of settings page for experimental, in-development features"

lib/generated/l10n/zulip_localizations.dart

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,36 @@ abstract class ZulipLocalizations {
14211421
/// **'This poll has no options yet.'**
14221422
String get pollWidgetOptionsMissing;
14231423

1424+
/// Title of setting controlling initial anchor of message list.
1425+
///
1426+
/// In en, this message translates to:
1427+
/// **'Open message feeds at'**
1428+
String get initialAnchorSettingTitle;
1429+
1430+
/// Description of setting controlling initial anchor of message list.
1431+
///
1432+
/// In en, this message translates to:
1433+
/// **'You can choose whether message feeds open at your first unread message or at the newest messages.'**
1434+
String get initialAnchorSettingDescription;
1435+
1436+
/// Label for a value of setting controlling initial anchor of message list.
1437+
///
1438+
/// In en, this message translates to:
1439+
/// **'First unread message'**
1440+
String get initialAnchorSettingFirstUnreadAlways;
1441+
1442+
/// Label for a value of setting controlling initial anchor of message list.
1443+
///
1444+
/// In en, this message translates to:
1445+
/// **'First unread message in single conversations, newest message elsewhere'**
1446+
String get initialAnchorSettingFirstUnreadConversations;
1447+
1448+
/// Label for a value of setting controlling initial anchor of message list.
1449+
///
1450+
/// In en, this message translates to:
1451+
/// **'Newest message'**
1452+
String get initialAnchorSettingNewestAlways;
1453+
14241454
/// Title of settings page for experimental, in-development features
14251455
///
14261456
/// In en, this message translates to:

lib/generated/l10n/zulip_localizations_ar.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,23 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
776776
@override
777777
String get pollWidgetOptionsMissing => 'This poll has no options yet.';
778778

779+
@override
780+
String get initialAnchorSettingTitle => 'Open message feeds at';
781+
782+
@override
783+
String get initialAnchorSettingDescription =>
784+
'You can choose whether message feeds open at your first unread message or at the newest messages.';
785+
786+
@override
787+
String get initialAnchorSettingFirstUnreadAlways => 'First unread message';
788+
789+
@override
790+
String get initialAnchorSettingFirstUnreadConversations =>
791+
'First unread message in single conversations, newest message elsewhere';
792+
793+
@override
794+
String get initialAnchorSettingNewestAlways => 'Newest message';
795+
779796
@override
780797
String get experimentalFeatureSettingsPageTitle => 'Experimental features';
781798

lib/generated/l10n/zulip_localizations_de.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,23 @@ class ZulipLocalizationsDe extends ZulipLocalizations {
776776
@override
777777
String get pollWidgetOptionsMissing => 'This poll has no options yet.';
778778

779+
@override
780+
String get initialAnchorSettingTitle => 'Open message feeds at';
781+
782+
@override
783+
String get initialAnchorSettingDescription =>
784+
'You can choose whether message feeds open at your first unread message or at the newest messages.';
785+
786+
@override
787+
String get initialAnchorSettingFirstUnreadAlways => 'First unread message';
788+
789+
@override
790+
String get initialAnchorSettingFirstUnreadConversations =>
791+
'First unread message in single conversations, newest message elsewhere';
792+
793+
@override
794+
String get initialAnchorSettingNewestAlways => 'Newest message';
795+
779796
@override
780797
String get experimentalFeatureSettingsPageTitle => 'Experimental features';
781798

lib/generated/l10n/zulip_localizations_en.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,23 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
776776
@override
777777
String get pollWidgetOptionsMissing => 'This poll has no options yet.';
778778

779+
@override
780+
String get initialAnchorSettingTitle => 'Open message feeds at';
781+
782+
@override
783+
String get initialAnchorSettingDescription =>
784+
'You can choose whether message feeds open at your first unread message or at the newest messages.';
785+
786+
@override
787+
String get initialAnchorSettingFirstUnreadAlways => 'First unread message';
788+
789+
@override
790+
String get initialAnchorSettingFirstUnreadConversations =>
791+
'First unread message in single conversations, newest message elsewhere';
792+
793+
@override
794+
String get initialAnchorSettingNewestAlways => 'Newest message';
795+
779796
@override
780797
String get experimentalFeatureSettingsPageTitle => 'Experimental features';
781798

lib/generated/l10n/zulip_localizations_ja.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,23 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
776776
@override
777777
String get pollWidgetOptionsMissing => 'This poll has no options yet.';
778778

779+
@override
780+
String get initialAnchorSettingTitle => 'Open message feeds at';
781+
782+
@override
783+
String get initialAnchorSettingDescription =>
784+
'You can choose whether message feeds open at your first unread message or at the newest messages.';
785+
786+
@override
787+
String get initialAnchorSettingFirstUnreadAlways => 'First unread message';
788+
789+
@override
790+
String get initialAnchorSettingFirstUnreadConversations =>
791+
'First unread message in single conversations, newest message elsewhere';
792+
793+
@override
794+
String get initialAnchorSettingNewestAlways => 'Newest message';
795+
779796
@override
780797
String get experimentalFeatureSettingsPageTitle => 'Experimental features';
781798

lib/generated/l10n/zulip_localizations_nb.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,23 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
776776
@override
777777
String get pollWidgetOptionsMissing => 'This poll has no options yet.';
778778

779+
@override
780+
String get initialAnchorSettingTitle => 'Open message feeds at';
781+
782+
@override
783+
String get initialAnchorSettingDescription =>
784+
'You can choose whether message feeds open at your first unread message or at the newest messages.';
785+
786+
@override
787+
String get initialAnchorSettingFirstUnreadAlways => 'First unread message';
788+
789+
@override
790+
String get initialAnchorSettingFirstUnreadConversations =>
791+
'First unread message in single conversations, newest message elsewhere';
792+
793+
@override
794+
String get initialAnchorSettingNewestAlways => 'Newest message';
795+
779796
@override
780797
String get experimentalFeatureSettingsPageTitle => 'Experimental features';
781798

lib/generated/l10n/zulip_localizations_pl.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,23 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
785785
@override
786786
String get pollWidgetOptionsMissing => 'Ta sonda nie ma opcji do wyboru.';
787787

788+
@override
789+
String get initialAnchorSettingTitle => 'Open message feeds at';
790+
791+
@override
792+
String get initialAnchorSettingDescription =>
793+
'You can choose whether message feeds open at your first unread message or at the newest messages.';
794+
795+
@override
796+
String get initialAnchorSettingFirstUnreadAlways => 'First unread message';
797+
798+
@override
799+
String get initialAnchorSettingFirstUnreadConversations =>
800+
'First unread message in single conversations, newest message elsewhere';
801+
802+
@override
803+
String get initialAnchorSettingNewestAlways => 'Newest message';
804+
788805
@override
789806
String get experimentalFeatureSettingsPageTitle => 'Funkcje eksperymentalne';
790807

lib/generated/l10n/zulip_localizations_ru.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,23 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
789789
@override
790790
String get pollWidgetOptionsMissing => 'В опросе пока нет вариантов ответа.';
791791

792+
@override
793+
String get initialAnchorSettingTitle => 'Open message feeds at';
794+
795+
@override
796+
String get initialAnchorSettingDescription =>
797+
'You can choose whether message feeds open at your first unread message or at the newest messages.';
798+
799+
@override
800+
String get initialAnchorSettingFirstUnreadAlways => 'First unread message';
801+
802+
@override
803+
String get initialAnchorSettingFirstUnreadConversations =>
804+
'First unread message in single conversations, newest message elsewhere';
805+
806+
@override
807+
String get initialAnchorSettingNewestAlways => 'Newest message';
808+
792809
@override
793810
String get experimentalFeatureSettingsPageTitle =>
794811
'Экспериментальные функции';

lib/generated/l10n/zulip_localizations_sk.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,23 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
778778
@override
779779
String get pollWidgetOptionsMissing => 'This poll has no options yet.';
780780

781+
@override
782+
String get initialAnchorSettingTitle => 'Open message feeds at';
783+
784+
@override
785+
String get initialAnchorSettingDescription =>
786+
'You can choose whether message feeds open at your first unread message or at the newest messages.';
787+
788+
@override
789+
String get initialAnchorSettingFirstUnreadAlways => 'First unread message';
790+
791+
@override
792+
String get initialAnchorSettingFirstUnreadConversations =>
793+
'First unread message in single conversations, newest message elsewhere';
794+
795+
@override
796+
String get initialAnchorSettingNewestAlways => 'Newest message';
797+
781798
@override
782799
String get experimentalFeatureSettingsPageTitle => 'Experimental features';
783800

lib/generated/l10n/zulip_localizations_uk.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,23 @@ class ZulipLocalizationsUk extends ZulipLocalizations {
790790
String get pollWidgetOptionsMissing =>
791791
'У цьому опитуванні ще немає варіантів.';
792792

793+
@override
794+
String get initialAnchorSettingTitle => 'Open message feeds at';
795+
796+
@override
797+
String get initialAnchorSettingDescription =>
798+
'You can choose whether message feeds open at your first unread message or at the newest messages.';
799+
800+
@override
801+
String get initialAnchorSettingFirstUnreadAlways => 'First unread message';
802+
803+
@override
804+
String get initialAnchorSettingFirstUnreadConversations =>
805+
'First unread message in single conversations, newest message elsewhere';
806+
807+
@override
808+
String get initialAnchorSettingNewestAlways => 'Newest message';
809+
793810
@override
794811
String get experimentalFeatureSettingsPageTitle => 'Експериментальні функції';
795812

lib/generated/l10n/zulip_localizations_zh.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,23 @@ class ZulipLocalizationsZh extends ZulipLocalizations {
776776
@override
777777
String get pollWidgetOptionsMissing => 'This poll has no options yet.';
778778

779+
@override
780+
String get initialAnchorSettingTitle => 'Open message feeds at';
781+
782+
@override
783+
String get initialAnchorSettingDescription =>
784+
'You can choose whether message feeds open at your first unread message or at the newest messages.';
785+
786+
@override
787+
String get initialAnchorSettingFirstUnreadAlways => 'First unread message';
788+
789+
@override
790+
String get initialAnchorSettingFirstUnreadConversations =>
791+
'First unread message in single conversations, newest message elsewhere';
792+
793+
@override
794+
String get initialAnchorSettingNewestAlways => 'Newest message';
795+
779796
@override
780797
String get experimentalFeatureSettingsPageTitle => 'Experimental features';
781798

lib/model/database.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ class GlobalSettings extends Table {
2424
Column<String> get browserPreference => textEnum<BrowserPreference>()
2525
.nullable()();
2626

27+
Column<String> get visitFirstUnread => textEnum<VisitFirstUnreadSetting>()
28+
.nullable()();
29+
2730
// If adding a new column to this table, consider whether [BoolGlobalSettings]
2831
// can do the job instead (by adding a value to the [BoolGlobalSetting] enum).
2932
// That way is more convenient, when it works, because
@@ -119,7 +122,7 @@ class AppDatabase extends _$AppDatabase {
119122
// information on using the build_runner.
120123
// * Write a migration in `_migrationSteps` below.
121124
// * Write tests.
122-
static const int latestSchemaVersion = 6; // See note.
125+
static const int latestSchemaVersion = 7; // See note.
123126

124127
@override
125128
int get schemaVersion => latestSchemaVersion;
@@ -174,6 +177,10 @@ class AppDatabase extends _$AppDatabase {
174177
from5To6: (m, schema) async {
175178
await m.createTable(schema.boolGlobalSettings);
176179
},
180+
from6To7: (m, schema) async {
181+
await m.addColumn(schema.globalSettings,
182+
schema.globalSettings.visitFirstUnread);
183+
},
177184
);
178185

179186
Future<void> _createLatestSchema(Migrator m) async {

0 commit comments

Comments
 (0)