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