mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Get call status from server
This commit is contained in:
parent
5eaf8d6b72
commit
f227209e9b
@ -215,7 +215,12 @@ class ConversationsHelper {
|
||||
following: map["following"] == 1,
|
||||
sawLastMessage: map["saw_last_message"] == 1,
|
||||
members: List<int>.from(map["members"]),
|
||||
);
|
||||
callCapabilities: map["can_have_video_call"]
|
||||
? CallCapabilities.VIDEO
|
||||
: (map["can_have_call"]
|
||||
? CallCapabilities.AUDIO
|
||||
: CallCapabilities.NONE),
|
||||
isHavingCall: map["has_call_now"]);
|
||||
}
|
||||
|
||||
/// Parse a list of messages given by the server
|
||||
|
@ -8,6 +8,8 @@ import 'package:meta/meta.dart';
|
||||
///
|
||||
/// @author Pierre HUBERT
|
||||
|
||||
enum CallCapabilities { NONE, AUDIO, VIDEO }
|
||||
|
||||
class Conversation extends CacheModel implements Comparable {
|
||||
final int ownerID;
|
||||
final int lastActive;
|
||||
@ -15,6 +17,8 @@ class Conversation extends CacheModel implements Comparable {
|
||||
final bool following;
|
||||
final bool sawLastMessage;
|
||||
final List<int> members;
|
||||
final CallCapabilities callCapabilities;
|
||||
final bool isHavingCall;
|
||||
|
||||
const Conversation({
|
||||
@required int id,
|
||||
@ -24,12 +28,16 @@ class Conversation extends CacheModel implements Comparable {
|
||||
@required this.following,
|
||||
@required this.sawLastMessage,
|
||||
@required this.members,
|
||||
this.callCapabilities = CallCapabilities.NONE,
|
||||
this.isHavingCall = false,
|
||||
}) : assert(id != null),
|
||||
assert(ownerID != null),
|
||||
assert(lastActive != null),
|
||||
assert(following != null),
|
||||
assert(sawLastMessage != null),
|
||||
assert(members != null),
|
||||
assert(callCapabilities != null),
|
||||
assert(isHavingCall != null),
|
||||
super(id: id);
|
||||
|
||||
/// Check out whether a conversation has a fixed name or not
|
||||
@ -45,8 +53,12 @@ class Conversation extends CacheModel implements Comparable {
|
||||
name = map[ConversationTableContract.C_NAME],
|
||||
following = map[ConversationTableContract.C_FOLLOWING] == 1,
|
||||
sawLastMessage = map[ConversationTableContract.C_SAW_LAST_MESSAGE] == 1,
|
||||
members = listToIntList(
|
||||
map[ConversationTableContract.C_MEMBERS].split(",")),
|
||||
members =
|
||||
listToIntList(map[ConversationTableContract.C_MEMBERS].split(",")),
|
||||
|
||||
// By default, we can not do any call
|
||||
callCapabilities = CallCapabilities.NONE,
|
||||
isHavingCall = false,
|
||||
super.fromMap(map);
|
||||
|
||||
@override
|
||||
|
@ -42,7 +42,8 @@ class _ConversationRouteState extends State<ConversationRoute> {
|
||||
Future<void> _loadConversation() async {
|
||||
setError(false);
|
||||
|
||||
_conversation = await _conversationsHelper.getSingle(widget.conversationID);
|
||||
_conversation = await _conversationsHelper.getSingle(widget.conversationID,
|
||||
force: true);
|
||||
|
||||
if (_conversation == null) return setError(true);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user