mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-12-26 04:48:51 +00:00
id => userID (improve clarity)
This commit is contained in:
parent
99ecc399ee
commit
c0856c5126
@ -29,7 +29,7 @@ class CallsHelper {
|
||||
CallMembersList()
|
||||
..addAll((await ws("calls/members", {"callID": callID}))
|
||||
.map((f) => CallMember(
|
||||
id: f["userID"],
|
||||
userID: f["userID"],
|
||||
status: f["ready"] ? MemberStatus.READY : MemberStatus.JOINED,
|
||||
))
|
||||
.toList()
|
||||
|
@ -7,11 +7,11 @@ import 'package:comunic/models/call_member.dart';
|
||||
|
||||
class CallMembersList extends AbstractList<CallMember> {
|
||||
/// Get the IDs of the users in this list
|
||||
Set<int> get usersID => this.map((f) => f.id).toSet();
|
||||
Set<int> get usersID => this.map((f) => f.userID).toSet();
|
||||
|
||||
/// Remove a specific member from this list
|
||||
void removeUser(int userID) => this.removeWhere((f) => f.id == userID);
|
||||
void removeUser(int userID) => this.removeWhere((f) => f.userID == userID);
|
||||
|
||||
/// Get the connection of a specific user
|
||||
CallMember getUser(int userID) => this.firstWhere((f) => f.id == userID);
|
||||
CallMember getUser(int userID) => this.firstWhere((f) => f.userID == userID);
|
||||
}
|
||||
|
@ -7,12 +7,12 @@ import 'package:flutter/material.dart';
|
||||
enum MemberStatus { JOINED, READY }
|
||||
|
||||
class CallMember {
|
||||
final int id;
|
||||
final int userID;
|
||||
MemberStatus status;
|
||||
|
||||
CallMember({
|
||||
@required this.id,
|
||||
@required this.userID,
|
||||
this.status = MemberStatus.JOINED,
|
||||
}) : assert(id != null),
|
||||
}) : assert(userID != null),
|
||||
assert(status != null);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class _CallScreenState extends SafeState<CallScreen> {
|
||||
// Register to events
|
||||
this.listenChangeState<UserJoinedCallEvent>((e) {
|
||||
// TODO : get user information if required
|
||||
if (e.callID == convID) _membersList.add(CallMember(id: e.userID));
|
||||
if (e.callID == convID) _membersList.add(CallMember(userID: e.userID));
|
||||
});
|
||||
|
||||
this.listen<UserLeftCallEvent>((e) {
|
||||
@ -191,7 +191,7 @@ class _CallScreenState extends SafeState<CallScreen> {
|
||||
text: TextSpan(
|
||||
children: _membersList
|
||||
.map((f) => TextSpan(
|
||||
text: _usersList.getUser(f.id).displayName + " ",
|
||||
text: _usersList.getUser(f.userID).displayName + " ",
|
||||
style: TextStyle(
|
||||
color: f.status == MemberStatus.JOINED
|
||||
? null
|
||||
|
Loading…
Reference in New Issue
Block a user