Skip to content

Commit 2258e63

Browse files
committed
api: Read typing constants from the server.
Signed-off-by: Zixuan James Li <[email protected]>
1 parent 0219af0 commit 2258e63

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

lib/api/model/initial_snapshot.dart

+11
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

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/example_data.dart

+9
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,9 @@ InitialSnapshot initialSnapshot({
533533
String? zulipMergeBase,
534534
List<String>? alertWords,
535535
List<CustomProfileField>? customProfileFields,
536+
int? serverTypingStartedExpiryPeriodMilliseconds,
537+
int? serverTypingStoppedWaitPeriodMilliseconds,
538+
int? serverTypingStartedWaitPeriodMilliseconds,
536539
Map<String, RealmEmojiItem>? realmEmoji,
537540
List<RecentDmConversation>? recentPrivateConversations,
538541
List<Subscription>? subscriptions,
@@ -554,6 +557,12 @@ InitialSnapshot initialSnapshot({
554557
zulipMergeBase: zulipMergeBase ?? recentZulipVersion,
555558
alertWords: alertWords ?? ['klaxon'],
556559
customProfileFields: customProfileFields ?? [],
560+
serverTypingStartedExpiryPeriodMilliseconds:
561+
serverTypingStartedExpiryPeriodMilliseconds ?? 15000,
562+
serverTypingStoppedWaitPeriodMilliseconds:
563+
serverTypingStoppedWaitPeriodMilliseconds ?? 5000,
564+
serverTypingStartedWaitPeriodMilliseconds:
565+
serverTypingStartedWaitPeriodMilliseconds ?? 10000,
557566
realmEmoji: realmEmoji ?? {},
558567
recentPrivateConversations: recentPrivateConversations ?? [],
559568
subscriptions: subscriptions ?? [], // TODO add subscriptions to default

0 commit comments

Comments
 (0)