Skip to content

Commit 917a7ae

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 8cb2c7b commit 917a7ae

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
@@ -951,6 +951,26 @@
951951
"@pollWidgetOptionsMissing": {
952952
"description": "Text to display for a poll when it has no options"
953953
},
954+
"initialAnchorSettingTitle": "Open message feeds at",
955+
"@initialAnchorSettingTitle": {
956+
"description": "Title of setting controlling initial anchor of message list."
957+
},
958+
"initialAnchorSettingDescription": "You can choose whether message feeds open at your first unread message or at the newest messages.",
959+
"@initialAnchorSettingDescription": {
960+
"description": "Description of setting controlling initial anchor of message list."
961+
},
962+
"initialAnchorSettingFirstUnreadAlways": "First unread message",
963+
"@initialAnchorSettingFirstUnreadAlways": {
964+
"description": "Label for a value of setting controlling initial anchor of message list."
965+
},
966+
"initialAnchorSettingFirstUnreadConversations": "First unread message in single conversations, newest message elsewhere",
967+
"@initialAnchorSettingFirstUnreadConversations": {
968+
"description": "Label for a value of setting controlling initial anchor of message list."
969+
},
970+
"initialAnchorSettingNewestAlways": "Newest message",
971+
"@initialAnchorSettingNewestAlways": {
972+
"description": "Label for a value of setting controlling initial anchor of message list."
973+
},
954974
"experimentalFeatureSettingsPageTitle": "Experimental features",
955975
"@experimentalFeatureSettingsPageTitle": {
956976
"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
@@ -1415,6 +1415,36 @@ abstract class ZulipLocalizations {
14151415
/// **'This poll has no options yet.'**
14161416
String get pollWidgetOptionsMissing;
14171417

1418+
/// Title of setting controlling initial anchor of message list.
1419+
///
1420+
/// In en, this message translates to:
1421+
/// **'Open message feeds at'**
1422+
String get initialAnchorSettingTitle;
1423+
1424+
/// Description of setting controlling initial anchor of message list.
1425+
///
1426+
/// In en, this message translates to:
1427+
/// **'You can choose whether message feeds open at your first unread message or at the newest messages.'**
1428+
String get initialAnchorSettingDescription;
1429+
1430+
/// Label for a value of setting controlling initial anchor of message list.
1431+
///
1432+
/// In en, this message translates to:
1433+
/// **'First unread message'**
1434+
String get initialAnchorSettingFirstUnreadAlways;
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 in single conversations, newest message elsewhere'**
1440+
String get initialAnchorSettingFirstUnreadConversations;
1441+
1442+
/// Label for a value of setting controlling initial anchor of message list.
1443+
///
1444+
/// In en, this message translates to:
1445+
/// **'Newest message'**
1446+
String get initialAnchorSettingNewestAlways;
1447+
14181448
/// Title of settings page for experimental, in-development features
14191449
///
14201450
/// 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
@@ -773,6 +773,23 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
773773
@override
774774
String get pollWidgetOptionsMissing => 'This poll has no options yet.';
775775

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

lib/generated/l10n/zulip_localizations_de.dart

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

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

lib/generated/l10n/zulip_localizations_en.dart

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

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

lib/generated/l10n/zulip_localizations_ja.dart

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

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

lib/generated/l10n/zulip_localizations_nb.dart

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

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

lib/generated/l10n/zulip_localizations_pl.dart

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

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

lib/generated/l10n/zulip_localizations_ru.dart

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

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

lib/generated/l10n/zulip_localizations_sk.dart

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

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

lib/generated/l10n/zulip_localizations_uk.dart

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

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

lib/generated/l10n/zulip_localizations_zh.dart

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

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

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)