|
@ -37,7 +37,10 @@ Future<Conversation> createConversation(String title, List<Friend> friends, bool |
|
|
twoUser: twoUser, |
|
|
twoUser: twoUser, |
|
|
status: ConversationStatus.pending, |
|
|
status: ConversationStatus.pending, |
|
|
isRead: true, |
|
|
isRead: true, |
|
|
messageExpiryDefault: 'no_expiry' |
|
|
|
|
|
|
|
|
messageExpiryDefault: 'no_expiry', |
|
|
|
|
|
adminAddMembers: true, |
|
|
|
|
|
adminEditInfo: true, |
|
|
|
|
|
adminSendMessages: false, |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
await db.insert( |
|
|
await db.insert( |
|
@ -163,6 +166,9 @@ Future<Conversation> getConversationById(String id) async { |
|
|
isRead: maps[0]['is_read'] == 1, |
|
|
isRead: maps[0]['is_read'] == 1, |
|
|
icon: file, |
|
|
icon: file, |
|
|
messageExpiryDefault: maps[0]['message_expiry'], |
|
|
messageExpiryDefault: maps[0]['message_expiry'], |
|
|
|
|
|
adminAddMembers: maps[0]['admin_add_members'] == 1, |
|
|
|
|
|
adminEditInfo: maps[0]['admin_edit_info'] == 1, |
|
|
|
|
|
adminSendMessages: maps[0]['admin_send_messages'] == 1, |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -193,6 +199,9 @@ Future<List<Conversation>> getConversations() async { |
|
|
isRead: maps[i]['is_read'] == 1, |
|
|
isRead: maps[i]['is_read'] == 1, |
|
|
icon: file, |
|
|
icon: file, |
|
|
messageExpiryDefault: maps[i]['message_expiry'] ?? 'no_expiry', |
|
|
messageExpiryDefault: maps[i]['message_expiry'] ?? 'no_expiry', |
|
|
|
|
|
adminAddMembers: maps[i]['admin_add_members'] == 1, |
|
|
|
|
|
adminEditInfo: maps[i]['admin_edit_info'] == 1, |
|
|
|
|
|
adminSendMessages: maps[i]['admin_send_messages'] == 1, |
|
|
); |
|
|
); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@ -227,6 +236,9 @@ Future<Conversation?> getTwoUserConversation(String userId) async { |
|
|
status: ConversationStatus.values[maps[0]['status']], |
|
|
status: ConversationStatus.values[maps[0]['status']], |
|
|
isRead: maps[0]['is_read'] == 1, |
|
|
isRead: maps[0]['is_read'] == 1, |
|
|
messageExpiryDefault: maps[0]['message_expiry'], |
|
|
messageExpiryDefault: maps[0]['message_expiry'], |
|
|
|
|
|
adminAddMembers: maps[0]['admin_add_members'] == 1, |
|
|
|
|
|
adminEditInfo: maps[0]['admin_edit_info'] == 1, |
|
|
|
|
|
adminSendMessages: maps[0]['admin_send_messages'] == 1, |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
@ -241,6 +253,9 @@ class Conversation { |
|
|
ConversationStatus status; |
|
|
ConversationStatus status; |
|
|
bool isRead; |
|
|
bool isRead; |
|
|
String messageExpiryDefault = 'no_expiry'; |
|
|
String messageExpiryDefault = 'no_expiry'; |
|
|
|
|
|
bool adminAddMembers = true; |
|
|
|
|
|
bool adminEditInfo = true; |
|
|
|
|
|
bool adminSendMessages = false; |
|
|
File? icon; |
|
|
File? icon; |
|
|
|
|
|
|
|
|
Conversation({ |
|
|
Conversation({ |
|
@ -253,6 +268,9 @@ class Conversation { |
|
|
required this.status, |
|
|
required this.status, |
|
|
required this.isRead, |
|
|
required this.isRead, |
|
|
required this.messageExpiryDefault, |
|
|
required this.messageExpiryDefault, |
|
|
|
|
|
required this.adminAddMembers, |
|
|
|
|
|
required this.adminEditInfo, |
|
|
|
|
|
required this.adminSendMessages, |
|
|
this.icon, |
|
|
this.icon, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -283,6 +301,9 @@ class Conversation { |
|
|
status: ConversationStatus.complete, |
|
|
status: ConversationStatus.complete, |
|
|
isRead: true, |
|
|
isRead: true, |
|
|
messageExpiryDefault: 'no_expiry', |
|
|
messageExpiryDefault: 'no_expiry', |
|
|
|
|
|
adminAddMembers: true, |
|
|
|
|
|
adminEditInfo: true, |
|
|
|
|
|
adminSendMessages: false, |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -329,6 +350,9 @@ class Conversation { |
|
|
'users': await getEncryptedConversationUsers(this, symKey), |
|
|
'users': await getEncryptedConversationUsers(this, symKey), |
|
|
'two_user': AesHelper.aesEncrypt(symKey, Uint8List.fromList((twoUser ? 'true' : 'false').codeUnits)), |
|
|
'two_user': AesHelper.aesEncrypt(symKey, Uint8List.fromList((twoUser ? 'true' : 'false').codeUnits)), |
|
|
'message_expiry': messageExpiryDefault, |
|
|
'message_expiry': messageExpiryDefault, |
|
|
|
|
|
'admin_add_members': AesHelper.aesEncrypt(symKey, Uint8List.fromList((adminAddMembers ? 'true' : 'false').codeUnits)), |
|
|
|
|
|
'admin_edit_info': AesHelper.aesEncrypt(symKey, Uint8List.fromList((adminEditInfo ? 'true' : 'false').codeUnits)), |
|
|
|
|
|
'admin_send_messages': AesHelper.aesEncrypt(symKey, Uint8List.fromList((adminSendMessages ? 'true' : 'false').codeUnits)), |
|
|
'user_conversations': userConversations, |
|
|
'user_conversations': userConversations, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -367,6 +391,9 @@ class Conversation { |
|
|
'is_read': isRead ? 1 : 0, |
|
|
'is_read': isRead ? 1 : 0, |
|
|
'file': icon != null ? icon!.path : null, |
|
|
'file': icon != null ? icon!.path : null, |
|
|
'message_expiry': messageExpiryDefault, |
|
|
'message_expiry': messageExpiryDefault, |
|
|
|
|
|
'admin_add_members': adminAddMembers ? 1 : 0, |
|
|
|
|
|
'admin_edit_info': adminEditInfo ? 1 : 0, |
|
|
|
|
|
'admin_send_messages': adminSendMessages ? 1 : 0, |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|