|
@ -37,6 +37,7 @@ 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' |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
await db.insert( |
|
|
await db.insert( |
|
@ -161,6 +162,7 @@ Future<Conversation> getConversationById(String id) 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, |
|
|
icon: file, |
|
|
icon: file, |
|
|
|
|
|
messageExpiryDefault: maps[0]['message_expiry'], |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -190,6 +192,7 @@ Future<List<Conversation>> getConversations() async { |
|
|
status: ConversationStatus.values[maps[i]['status']], |
|
|
status: ConversationStatus.values[maps[i]['status']], |
|
|
isRead: maps[i]['is_read'] == 1, |
|
|
isRead: maps[i]['is_read'] == 1, |
|
|
icon: file, |
|
|
icon: file, |
|
|
|
|
|
messageExpiryDefault: maps[i]['message_expiry'] ?? 'no_expiry', |
|
|
); |
|
|
); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@ -223,6 +226,7 @@ Future<Conversation?> getTwoUserConversation(String userId) async { |
|
|
twoUser: maps[0]['two_user'] == 1, |
|
|
twoUser: maps[0]['two_user'] == 1, |
|
|
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'], |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
@ -236,6 +240,7 @@ class Conversation { |
|
|
bool twoUser; |
|
|
bool twoUser; |
|
|
ConversationStatus status; |
|
|
ConversationStatus status; |
|
|
bool isRead; |
|
|
bool isRead; |
|
|
|
|
|
String messageExpiryDefault = 'no_expiry'; |
|
|
File? icon; |
|
|
File? icon; |
|
|
|
|
|
|
|
|
Conversation({ |
|
|
Conversation({ |
|
@ -247,6 +252,7 @@ class Conversation { |
|
|
required this.twoUser, |
|
|
required this.twoUser, |
|
|
required this.status, |
|
|
required this.status, |
|
|
required this.isRead, |
|
|
required this.isRead, |
|
|
|
|
|
required this.messageExpiryDefault, |
|
|
this.icon, |
|
|
this.icon, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -276,6 +282,7 @@ class Conversation { |
|
|
twoUser: false, |
|
|
twoUser: false, |
|
|
status: ConversationStatus.complete, |
|
|
status: ConversationStatus.complete, |
|
|
isRead: true, |
|
|
isRead: true, |
|
|
|
|
|
messageExpiryDefault: 'no_expiry', |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -321,6 +328,7 @@ class Conversation { |
|
|
'name': AesHelper.aesEncrypt(symKey, Uint8List.fromList(name.codeUnits)), |
|
|
'name': AesHelper.aesEncrypt(symKey, Uint8List.fromList(name.codeUnits)), |
|
|
'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, |
|
|
'user_conversations': userConversations, |
|
|
'user_conversations': userConversations, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -358,6 +366,7 @@ class Conversation { |
|
|
'status': status.index, |
|
|
'status': status.index, |
|
|
'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, |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|