mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 21:09:21 +00:00
Add new conversation property
This commit is contained in:
parent
8bd937420e
commit
1b5169eb56
@ -228,6 +228,7 @@ class ConversationsHelper {
|
|||||||
following: map["following"] == 1,
|
following: map["following"] == 1,
|
||||||
sawLastMessage: map["saw_last_message"] == 1,
|
sawLastMessage: map["saw_last_message"] == 1,
|
||||||
members: List<int>.from(map["members"]),
|
members: List<int>.from(map["members"]),
|
||||||
|
canEveryoneAddMembers: map["canEveryoneAddMembers"],
|
||||||
callCapabilities: map["can_have_video_call"]
|
callCapabilities: map["can_have_video_call"]
|
||||||
? CallCapabilities.VIDEO
|
? CallCapabilities.VIDEO
|
||||||
: (map["can_have_call"]
|
: (map["can_have_call"]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
/// Main information
|
/// Main information
|
||||||
class DatabaseContract {
|
class DatabaseContract {
|
||||||
static const DATABASE_VERSION = 1;
|
static const DATABASE_VERSION = 2;
|
||||||
static const DATABASE_FILE_NAME = "database.sqlite";
|
static const DATABASE_FILE_NAME = "database.sqlite";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,6 +34,7 @@ abstract class ConversationTableContract {
|
|||||||
static const C_FOLLOWING = "following";
|
static const C_FOLLOWING = "following";
|
||||||
static const C_SAW_LAST_MESSAGE = "saw_last_message";
|
static const C_SAW_LAST_MESSAGE = "saw_last_message";
|
||||||
static const C_MEMBERS = "members";
|
static const C_MEMBERS = "members";
|
||||||
|
static const C_CAN_EVERYONE_ADD_MEMBERS = "can_everyone_add_members";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Conversations messages table contract
|
/// Conversations messages table contract
|
||||||
|
@ -81,7 +81,8 @@ abstract class DatabaseHelper {
|
|||||||
"${ConversationTableContract.C_NAME} TEXT, "
|
"${ConversationTableContract.C_NAME} TEXT, "
|
||||||
"${ConversationTableContract.C_FOLLOWING} INTEGER, "
|
"${ConversationTableContract.C_FOLLOWING} INTEGER, "
|
||||||
"${ConversationTableContract.C_SAW_LAST_MESSAGE} INTEGER, "
|
"${ConversationTableContract.C_SAW_LAST_MESSAGE} INTEGER, "
|
||||||
"${ConversationTableContract.C_MEMBERS} TEXT"
|
"${ConversationTableContract.C_MEMBERS} TEXT, "
|
||||||
|
"${ConversationTableContract.C_CAN_EVERYONE_ADD_MEMBERS} INTEGER"
|
||||||
")");
|
")");
|
||||||
|
|
||||||
// Create conversation messages table
|
// Create conversation messages table
|
||||||
|
@ -17,6 +17,7 @@ class Conversation extends CacheModel implements Comparable {
|
|||||||
final bool following;
|
final bool following;
|
||||||
final bool sawLastMessage;
|
final bool sawLastMessage;
|
||||||
final List<int> members;
|
final List<int> members;
|
||||||
|
final bool canEveryoneAddMembers;
|
||||||
final CallCapabilities callCapabilities;
|
final CallCapabilities callCapabilities;
|
||||||
final bool isHavingCall;
|
final bool isHavingCall;
|
||||||
|
|
||||||
@ -28,6 +29,7 @@ class Conversation extends CacheModel implements Comparable {
|
|||||||
@required this.following,
|
@required this.following,
|
||||||
@required this.sawLastMessage,
|
@required this.sawLastMessage,
|
||||||
@required this.members,
|
@required this.members,
|
||||||
|
@required this.canEveryoneAddMembers,
|
||||||
this.callCapabilities = CallCapabilities.NONE,
|
this.callCapabilities = CallCapabilities.NONE,
|
||||||
this.isHavingCall = false,
|
this.isHavingCall = false,
|
||||||
}) : assert(id != null),
|
}) : assert(id != null),
|
||||||
@ -36,6 +38,7 @@ class Conversation extends CacheModel implements Comparable {
|
|||||||
assert(following != null),
|
assert(following != null),
|
||||||
assert(sawLastMessage != null),
|
assert(sawLastMessage != null),
|
||||||
assert(members != null),
|
assert(members != null),
|
||||||
|
assert(canEveryoneAddMembers != null),
|
||||||
assert(callCapabilities != null),
|
assert(callCapabilities != null),
|
||||||
assert(isHavingCall != null),
|
assert(isHavingCall != null),
|
||||||
super(id: id);
|
super(id: id);
|
||||||
@ -55,6 +58,8 @@ class Conversation extends CacheModel implements Comparable {
|
|||||||
sawLastMessage = map[ConversationTableContract.C_SAW_LAST_MESSAGE] == 1,
|
sawLastMessage = map[ConversationTableContract.C_SAW_LAST_MESSAGE] == 1,
|
||||||
members =
|
members =
|
||||||
listToIntList(map[ConversationTableContract.C_MEMBERS].split(",")),
|
listToIntList(map[ConversationTableContract.C_MEMBERS].split(",")),
|
||||||
|
canEveryoneAddMembers =
|
||||||
|
map[ConversationTableContract.C_CAN_EVERYONE_ADD_MEMBERS] == 1,
|
||||||
|
|
||||||
// By default, we can not do any call
|
// By default, we can not do any call
|
||||||
callCapabilities = CallCapabilities.NONE,
|
callCapabilities = CallCapabilities.NONE,
|
||||||
@ -71,6 +76,8 @@ class Conversation extends CacheModel implements Comparable {
|
|||||||
ConversationTableContract.C_FOLLOWING: following ? 1 : 0,
|
ConversationTableContract.C_FOLLOWING: following ? 1 : 0,
|
||||||
ConversationTableContract.C_SAW_LAST_MESSAGE: sawLastMessage ? 1 : 0,
|
ConversationTableContract.C_SAW_LAST_MESSAGE: sawLastMessage ? 1 : 0,
|
||||||
ConversationTableContract.C_MEMBERS: members.join(","),
|
ConversationTableContract.C_MEMBERS: members.join(","),
|
||||||
|
ConversationTableContract.C_CAN_EVERYONE_ADD_MEMBERS:
|
||||||
|
canEveryoneAddMembers ? 1 : 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
|
|||||||
TextEditingController _nameController = TextEditingController();
|
TextEditingController _nameController = TextEditingController();
|
||||||
UsersList _members = UsersList();
|
UsersList _members = UsersList();
|
||||||
bool _followConversation = true;
|
bool _followConversation = true;
|
||||||
|
bool _canEveryoneAddMembers = true;
|
||||||
|
|
||||||
get isUpdating => widget.initialSettings != null;
|
get isUpdating => widget.initialSettings != null;
|
||||||
|
|
||||||
@ -147,6 +148,7 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
|
|||||||
name: _nameController.text,
|
name: _nameController.text,
|
||||||
following: _followConversation,
|
following: _followConversation,
|
||||||
members: _members.usersID,
|
members: _members.usersID,
|
||||||
|
canEveryoneAddMembers: _canEveryoneAddMembers,
|
||||||
|
|
||||||
// Give random value to these fields as they are ignored here
|
// Give random value to these fields as they are ignored here
|
||||||
lastActive: 0,
|
lastActive: 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user