Skip to content

Commit 117f059

Browse files
committed
api: Read typing constants from the server.
Signed-off-by: Zixuan James Li <[email protected]>
1 parent 2cbd790 commit 117f059

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

lib/api/model/initial_snapshot.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ class InitialSnapshot {
2424

2525
final List<CustomProfileField> customProfileFields;
2626

27+
// TODO(server-8): Remove the default values.
28+
@JsonKey(defaultValue: 15000)
29+
final int serverTypingStartedExpiryPeriodMilliseconds;
30+
@JsonKey(defaultValue: 5000)
31+
final int serverTypingStoppedWaitPeriodMilliseconds;
32+
@JsonKey(defaultValue: 10000)
33+
final int serverTypingStartedWaitPeriodMilliseconds;
34+
2735
// final List<…> mutedTopics; // TODO(#422) we ignore this feature on older servers
2836

2937
final Map<String, RealmEmojiItem> realmEmoji;
@@ -86,6 +94,9 @@ class InitialSnapshot {
8694
required this.zulipMergeBase,
8795
required this.alertWords,
8896
required this.customProfileFields,
97+
required this.serverTypingStartedExpiryPeriodMilliseconds,
98+
required this.serverTypingStoppedWaitPeriodMilliseconds,
99+
required this.serverTypingStartedWaitPeriodMilliseconds,
89100
required this.realmEmoji,
90101
required this.recentPrivateConversations,
91102
required this.subscriptions,

lib/api/model/initial_snapshot.g.dart

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

test/example_data.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,9 @@ InitialSnapshot initialSnapshot({
484484
String? zulipMergeBase,
485485
List<String>? alertWords,
486486
List<CustomProfileField>? customProfileFields,
487+
int? serverTypingStartedExpiryPeriodMilliseconds,
488+
int? serverTypingStoppedWaitPeriodMilliseconds,
489+
int? serverTypingStartedWaitPeriodMilliseconds,
487490
Map<String, RealmEmojiItem>? realmEmoji,
488491
List<RecentDmConversation>? recentPrivateConversations,
489492
List<Subscription>? subscriptions,
@@ -505,6 +508,12 @@ InitialSnapshot initialSnapshot({
505508
zulipMergeBase: zulipMergeBase ?? recentZulipVersion,
506509
alertWords: alertWords ?? ['klaxon'],
507510
customProfileFields: customProfileFields ?? [],
511+
serverTypingStartedExpiryPeriodMilliseconds:
512+
serverTypingStartedExpiryPeriodMilliseconds ?? 15000,
513+
serverTypingStoppedWaitPeriodMilliseconds:
514+
serverTypingStoppedWaitPeriodMilliseconds ?? 5000,
515+
serverTypingStartedWaitPeriodMilliseconds:
516+
serverTypingStartedWaitPeriodMilliseconds ?? 10000,
508517
realmEmoji: realmEmoji ?? {},
509518
recentPrivateConversations: recentPrivateConversations ?? [],
510519
subscriptions: subscriptions ?? [], // TODO add subscriptions to default

0 commit comments

Comments
 (0)