Skip to content

Commit 8ddd947

Browse files
Merge branch 'main' into todos
2 parents c93f494 + 673ff5b commit 8ddd947

28 files changed

+1837
-82
lines changed

lib/api/model/initial_snapshot.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ class InitialSnapshot {
8888

8989
final bool realmMandatoryTopics;
9090

91+
final String realmName;
92+
9193
/// The number of days until a user's account is treated as a full member.
9294
///
9395
/// Search for "realm_waiting_period_threshold" in https://zulip.com/api/register-queue.
@@ -103,6 +105,8 @@ class InitialSnapshot {
103105

104106
final bool realmEnableReadReceipts;
105107

108+
final Uri realmIconUrl;
109+
106110
final bool realmPresenceDisabled;
107111

108112
final Map<String, RealmDefaultExternalAccount> realmDefaultExternalAccounts;
@@ -174,11 +178,13 @@ class InitialSnapshot {
174178
required this.realmDeleteOwnMessagePolicy,
175179
required this.realmWildcardMentionPolicy,
176180
required this.realmMandatoryTopics,
181+
required this.realmName,
177182
required this.realmWaitingPeriodThreshold,
178183
required this.realmMessageContentDeleteLimitSeconds,
179184
required this.realmAllowMessageEditing,
180185
required this.realmMessageContentEditLimitSeconds,
181186
required this.realmEnableReadReceipts,
187+
required this.realmIconUrl,
182188
required this.realmPresenceDisabled,
183189
required this.realmDefaultExternalAccounts,
184190
required this.maxFileUploadSizeMib,

lib/api/model/initial_snapshot.g.dart

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

lib/api/route/realm.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class GetServerSettingsResult {
4848
final Uri realmUrl;
4949

5050
final String realmName;
51-
final String realmIcon;
51+
final Uri realmIcon;
5252
final String realmDescription;
5353
final bool realmWebPublicAccessEnabled;
5454

lib/api/route/realm.g.dart

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

lib/model/database.dart

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'package:drift/internal/versioned_schema.dart';
88
import 'package:drift/remote.dart';
99
import 'package:sqlite3/common.dart';
1010

11+
import '../api/route/realm.dart';
1112
import '../log.dart';
1213
import 'legacy_app_data.dart';
1314
import 'schema_versions.g.dart';
@@ -128,6 +129,20 @@ class Accounts extends Table {
128129
/// It never changes for a given account.
129130
Column<String> get realmUrl => text().map(const UriConverter())();
130131

132+
/// The name of the Zulip realm this account is on.
133+
///
134+
/// This corresponds to [GetServerSettingsResult.realmName].
135+
///
136+
/// Nullable just because older versions of the app didn't store this.
137+
Column<String> get realmName => text().nullable()();
138+
139+
/// The icon URL of the Zulip realm this account is on.
140+
///
141+
/// This corresponds to [GetServerSettingsResult.realmIcon].
142+
///
143+
/// Nullable just because older versions of the app didn't store this.
144+
Column<String> get realmIcon => text().map(const UriConverter()).nullable()();
145+
131146
/// The Zulip user ID of this account.
132147
///
133148
/// This is the identifier the server uses for the account.
@@ -169,7 +184,7 @@ class AppDatabase extends _$AppDatabase {
169184
// information on using the build_runner.
170185
// * Write a migration in `_migrationSteps` below.
171186
// * Write tests.
172-
static const int latestSchemaVersion = 11; // See note.
187+
static const int latestSchemaVersion = 12; // See note.
173188

174189
@override
175190
int get schemaVersion => latestSchemaVersion;
@@ -264,6 +279,10 @@ class AppDatabase extends _$AppDatabase {
264279
'value': Variable(firstAccountId),
265280
}));
266281
},
282+
from11To12: (Migrator m, Schema12 schema) async {
283+
await m.addColumn(schema.accounts, schema.accounts.realmName);
284+
await m.addColumn(schema.accounts, schema.accounts.realmIcon);
285+
},
267286
);
268287

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

0 commit comments

Comments
 (0)