Skip to content

Commit 843cc69

Browse files
committed
db: Support setting browser preference
Signed-off-by: Zixuan James Li <zixuan@zulip.com>
1 parent ef9d889 commit 843cc69

20 files changed

+874
-30
lines changed

assets/l10n/app_en.arb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
"@settingsPageTitle": {
2424
"description": "Title for the settings page."
2525
},
26+
"settingsUseExternal": "Use external browser",
27+
"@settingsUseExternal": {
28+
"description": "Whether to open links with external browser or not"
29+
},
2630
"switchAccountButton": "Switch account",
2731
"@switchAccountButton": {
2832
"description": "Label for main-menu button leading to the choose-account page."

lib/generated/l10n/zulip_localizations.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ abstract class ZulipLocalizations {
139139
/// **'Settings'**
140140
String get settingsPageTitle;
141141

142+
/// Whether to open links with external browser or not
143+
///
144+
/// In en, this message translates to:
145+
/// **'Use external browser'**
146+
String get settingsUseExternal;
147+
142148
/// Label for main-menu button leading to the choose-account page.
143149
///
144150
/// In en, this message translates to:

lib/generated/l10n/zulip_localizations_ar.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
2626
@override
2727
String get settingsPageTitle => 'Settings';
2828

29+
@override
30+
String get settingsUseExternal => 'Use external browser';
31+
2932
@override
3033
String get switchAccountButton => 'Switch account';
3134

lib/generated/l10n/zulip_localizations_en.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
2626
@override
2727
String get settingsPageTitle => 'Settings';
2828

29+
@override
30+
String get settingsUseExternal => 'Use external browser';
31+
2932
@override
3033
String get switchAccountButton => 'Switch account';
3134

lib/generated/l10n/zulip_localizations_fr.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ class ZulipLocalizationsFr extends ZulipLocalizations {
2626
@override
2727
String get settingsPageTitle => 'Settings';
2828

29+
@override
30+
String get settingsUseExternal => 'Use external browser';
31+
2932
@override
3033
String get switchAccountButton => 'Switch account';
3134

lib/generated/l10n/zulip_localizations_ja.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
2626
@override
2727
String get settingsPageTitle => 'Settings';
2828

29+
@override
30+
String get settingsUseExternal => 'Use external browser';
31+
2932
@override
3033
String get switchAccountButton => 'Switch account';
3134

lib/generated/l10n/zulip_localizations_pl.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
2626
@override
2727
String get settingsPageTitle => 'Settings';
2828

29+
@override
30+
String get settingsUseExternal => 'Use external browser';
31+
2932
@override
3033
String get switchAccountButton => 'Switch account';
3134

lib/generated/l10n/zulip_localizations_ru.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
2626
@override
2727
String get settingsPageTitle => 'Settings';
2828

29+
@override
30+
String get settingsUseExternal => 'Use external browser';
31+
2932
@override
3033
String get switchAccountButton => 'Switch account';
3134

lib/model/database.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ class Accounts extends Table {
5353
class GlobalSettings extends Table {
5454
Column<String> get themeSetting => textEnum<ThemeSetting>()
5555
.withDefault(const Variable('unset'))();
56+
57+
Column<String> get browserPreference => textEnum<BrowserPreference>()
58+
.nullable()();
5659
}
5760

5861
class UriConverter extends TypeConverter<Uri, String> {
@@ -73,7 +76,7 @@ class AppDatabase extends _$AppDatabase {
7376
// * Write a migration in `onUpgrade` below.
7477
// * Write tests.
7578
@override
76-
int get schemaVersion => 3; // See note.
79+
int get schemaVersion => 4; // See note.
7780

7881
@override
7982
MigrationStrategy get migration {
@@ -104,6 +107,10 @@ class AppDatabase extends _$AppDatabase {
104107
from2To3: (m, schema) async {
105108
await m.createTable(schema.globalSettings);
106109
},
110+
from3To4: (m, schema) async {
111+
await m.addColumn(
112+
schema.globalSettings, schema.globalSettings.browserPreference);
113+
},
107114
));
108115
});
109116
}

lib/model/database.g.dart

Lines changed: 85 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)