Skip to content

Commit 290067a

Browse files
committed
presence [nfc]: Use RealmStore for server/realm settings
1 parent b30df8b commit 290067a

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

lib/model/presence.dart

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import 'package:flutter/widgets.dart';
66
import '../api/model/events.dart';
77
import '../api/model/model.dart';
88
import '../api/route/users.dart';
9-
import 'store.dart';
9+
import 'realm.dart';
1010

1111
/// The model for tracking which users are online, idle, and offline.
1212
///
@@ -16,21 +16,12 @@ import 'store.dart';
1616
/// so callers need to remember to add a listener (and remove it on dispose).
1717
/// In particular, [PerAccountStoreWidget] doesn't subscribe a widget subtree
1818
/// to updates.
19-
class Presence extends PerAccountStoreBase with ChangeNotifier {
19+
class Presence extends HasRealmStore with ChangeNotifier {
2020
Presence({
21-
required super.core,
22-
required this.serverPresencePingInterval,
23-
required this.serverPresenceOfflineThresholdSeconds,
24-
required this.realmPresenceDisabled,
21+
required super.realm,
2522
required Map<int, PerUserPresence> initial,
2623
}) : _map = initial;
2724

28-
final Duration serverPresencePingInterval;
29-
final int serverPresenceOfflineThresholdSeconds;
30-
// TODO(#668): update this realm setting (probably by accessing it from a new
31-
// realm/server-settings substore that gets passed to Presence)
32-
final bool realmPresenceDisabled;
33-
3425
Map<int, PerUserPresence> _map;
3526

3627
AppLifecycleListener? _appLifecycleListener;

lib/model/store.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -504,10 +504,7 @@ class PerAccountStore extends PerAccountStoreBase with
504504
users: UserStoreImpl(core: core, initialSnapshot: initialSnapshot),
505505
typingStatus: TypingStatus(core: core,
506506
typingStartedExpiryPeriod: Duration(milliseconds: initialSnapshot.serverTypingStartedExpiryPeriodMilliseconds)),
507-
presence: Presence(core: core,
508-
serverPresencePingInterval: Duration(seconds: initialSnapshot.serverPresencePingIntervalSeconds),
509-
serverPresenceOfflineThresholdSeconds: initialSnapshot.serverPresenceOfflineThresholdSeconds,
510-
realmPresenceDisabled: initialSnapshot.realmPresenceDisabled,
507+
presence: Presence(realm: realm,
511508
initial: initialSnapshot.presences),
512509
channels: channels,
513510
messages: MessageStoreImpl(realm: realm),

0 commit comments

Comments
 (0)