Skip to content

Commit 3fd0817

Browse files
gnpricechrisbobbe
authored andcommitted
presence [nfc]: Expose a debugHandlePresenceResponse method for testing
1 parent 11849c1 commit 3fd0817

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/model/presence.dart

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ class Presence extends HasRealmStore with ChangeNotifier {
9696
newUserInput: false);
9797
}
9898
if (!pingOnly) {
99-
_map = result.presences!;
100-
notifyListeners();
99+
_handlePresenceResponse(result.presences!);
101100
}
102101
}
103102

@@ -124,6 +123,16 @@ class Presence extends HasRealmStore with ChangeNotifier {
124123
super.dispose();
125124
}
126125

126+
@visibleForTesting
127+
void debugHandlePresenceResponse(Map<int, PerUserPresence> presences) {
128+
_handlePresenceResponse(presences);
129+
}
130+
131+
void _handlePresenceResponse(Map<int, PerUserPresence> presences) {
132+
_map = presences;
133+
notifyListeners();
134+
}
135+
127136
/// The [PresenceStatus] for [userId], or null if the user is offline.
128137
PresenceStatus? presenceStatusForUser(int userId, {required DateTime utcNow}) {
129138
final now = utcNow.millisecondsSinceEpoch ~/ 1000;

0 commit comments

Comments
 (0)