Skip to content

Commit 8dfdcb9

Browse files
committed
store [nfc]: Use CorePerAccountStore with TypingNotifier
1 parent 3e9d884 commit 8dfdcb9

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

lib/model/store.dart

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -417,13 +417,7 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
417417
realmUrl: realmUrl, allRealmEmoji: initialSnapshot.realmEmoji),
418418
accountId: accountId,
419419
userSettings: initialSnapshot.userSettings,
420-
typingNotifier: TypingNotifier(
421-
connection: connection,
422-
typingStoppedWaitPeriod: Duration(
423-
milliseconds: initialSnapshot.serverTypingStoppedWaitPeriodMilliseconds),
424-
typingStartedWaitPeriod: Duration(
425-
milliseconds: initialSnapshot.serverTypingStartedWaitPeriodMilliseconds),
426-
),
420+
typingNotifier: TypingNotifier(core: core),
427421
users: UserStoreImpl(core: core),
428422
typingStatus: TypingStatus(core: core),
429423
channels: channels,

lib/model/typing_status.dart

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import 'dart:async';
22

33
import 'package:flutter/foundation.dart';
44

5-
import '../api/core.dart';
65
import '../api/model/events.dart';
76
import '../api/route/typing.dart';
87
import 'binding.dart';
@@ -92,14 +91,13 @@ class TypingStatus extends PerAccountStoreBase with ChangeNotifier {
9291
/// See also:
9392
/// * https://github.com/zulip/zulip/blob/52a9846cdf4abfbe937a94559690d508e95f4065/web/shared/src/typing_status.ts
9493
/// * https://zulip.readthedocs.io/en/latest/subsystems/typing-indicators.html
95-
class TypingNotifier {
96-
TypingNotifier({
97-
required this.connection,
98-
required this.typingStoppedWaitPeriod,
99-
required this.typingStartedWaitPeriod,
100-
});
101-
102-
final ApiConnection connection;
94+
class TypingNotifier extends PerAccountStoreBase {
95+
TypingNotifier({required super.core})
96+
: typingStartedWaitPeriod = Duration(milliseconds:
97+
core.initialSnapshot.serverTypingStartedWaitPeriodMilliseconds),
98+
typingStoppedWaitPeriod = Duration(milliseconds:
99+
core.initialSnapshot.serverTypingStoppedWaitPeriodMilliseconds);
100+
103101
final Duration typingStoppedWaitPeriod;
104102
final Duration typingStartedWaitPeriod;
105103

0 commit comments

Comments
 (0)