mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59: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,
|
||||
sawLastMessage: map["saw_last_message"] == 1,
|
||||
members: List<int>.from(map["members"]),
|
||||
canEveryoneAddMembers: map["canEveryoneAddMembers"],
|
||||
callCapabilities: map["can_have_video_call"]
|
||||
? CallCapabilities.VIDEO
|
||||
: (map["can_have_call"]
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
/// Main information
|
||||
class DatabaseContract {
|
||||
static const DATABASE_VERSION = 1;
|
||||
static const DATABASE_VERSION = 2;
|
||||
static const DATABASE_FILE_NAME = "database.sqlite";
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ abstract class UserTableContract {
|
||||
static const C_ID = BaseTableContract.C_ID;
|
||||
static const C_FIRST_NAME = "first_name";
|
||||
static const C_LAST_NAME = "last_name";
|
||||
static const C_VISIBILITY = "visibility";
|
||||
static const C_VISIBILITY = "visibility";
|
||||
static const C_VIRTUAL_DIRECTORY = "virtual_directory";
|
||||
static const C_ACCOUNT_IMAGE_URL = "account_image_url";
|
||||
}
|
||||
@ -34,6 +34,7 @@ abstract class ConversationTableContract {
|
||||
static const C_FOLLOWING = "following";
|
||||
static const C_SAW_LAST_MESSAGE = "saw_last_message";
|
||||
static const C_MEMBERS = "members";
|
||||
static const C_CAN_EVERYONE_ADD_MEMBERS = "can_everyone_add_members";
|
||||
}
|
||||
|
||||
/// Conversations messages table contract
|
||||
@ -55,4 +56,4 @@ abstract class FriendsListTableContract {
|
||||
static const C_LAST_ACTIVE = "last_active";
|
||||
static const C_FOLLOWING = "following";
|
||||
static const C_CAN_POST_TEXTS = "can_post_texts";
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,8 @@ abstract class DatabaseHelper {
|
||||
"${ConversationTableContract.C_NAME} TEXT, "
|
||||
"${ConversationTableContract.C_FOLLOWING} 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
|
||||
|
@ -17,6 +17,7 @@ class Conversation extends CacheModel implements Comparable {
|
||||
final bool following;
|
||||
final bool sawLastMessage;
|
||||
final List<int> members;
|
||||
final bool canEveryoneAddMembers;
|
||||
final CallCapabilities callCapabilities;
|
||||
final bool isHavingCall;
|
||||
|
||||
@ -28,6 +29,7 @@ class Conversation extends CacheModel implements Comparable {
|
||||
@required this.following,
|
||||
@required this.sawLastMessage,
|
||||
@required this.members,
|
||||
@required this.canEveryoneAddMembers,
|
||||
this.callCapabilities = CallCapabilities.NONE,
|
||||
this.isHavingCall = false,
|
||||
}) : assert(id != null),
|
||||
@ -36,6 +38,7 @@ class Conversation extends CacheModel implements Comparable {
|
||||
assert(following != null),
|
||||
assert(sawLastMessage != null),
|
||||
assert(members != null),
|
||||
assert(canEveryoneAddMembers != null),
|
||||
assert(callCapabilities != null),
|
||||
assert(isHavingCall != null),
|
||||
super(id: id);
|
||||
@ -55,6 +58,8 @@ class Conversation extends CacheModel implements Comparable {
|
||||
sawLastMessage = map[ConversationTableContract.C_SAW_LAST_MESSAGE] == 1,
|
||||
members =
|
||||
listToIntList(map[ConversationTableContract.C_MEMBERS].split(",")),
|
||||
canEveryoneAddMembers =
|
||||
map[ConversationTableContract.C_CAN_EVERYONE_ADD_MEMBERS] == 1,
|
||||
|
||||
// By default, we can not do any call
|
||||
callCapabilities = CallCapabilities.NONE,
|
||||
@ -71,6 +76,8 @@ class Conversation extends CacheModel implements Comparable {
|
||||
ConversationTableContract.C_FOLLOWING: following ? 1 : 0,
|
||||
ConversationTableContract.C_SAW_LAST_MESSAGE: sawLastMessage ? 1 : 0,
|
||||
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();
|
||||
UsersList _members = UsersList();
|
||||
bool _followConversation = true;
|
||||
bool _canEveryoneAddMembers = true;
|
||||
|
||||
get isUpdating => widget.initialSettings != null;
|
||||
|
||||
@ -147,6 +148,7 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
|
||||
name: _nameController.text,
|
||||
following: _followConversation,
|
||||
members: _members.usersID,
|
||||
canEveryoneAddMembers: _canEveryoneAddMembers,
|
||||
|
||||
// Give random value to these fields as they are ignored here
|
||||
lastActive: 0,
|
||||
|
Loading…
Reference in New Issue
Block a user