Update lib/src/Store.dart

This commit is contained in:
Christian 2019-06-12 07:48:26 +00:00
parent fcf6b55c43
commit f530d09de3

View file

@ -177,18 +177,14 @@ class Store {
/// Stores an UserUpdate object in the database. Must be called inside of /// Stores an UserUpdate object in the database. Must be called inside of
/// [transaction]. /// [transaction].
Future<void> storeUserEventUpdate(UserUpdate userUpdate) { Future<void> storeUserEventUpdate(UserUpdate userUpdate) {
print("New userUpdate ${userUpdate.eventType} und ${userUpdate.type}");
dynamic eventContent = userUpdate.content; dynamic eventContent = userUpdate.content;
String type = userUpdate.type; String type = userUpdate.type;
switch (userUpdate.eventType) { switch (userUpdate.eventType) {
case "m.direct": case "m.direct":
print("New direct update: type: ${userUpdate.content["content"].runtimeType}");
if (userUpdate.content["content"] is Map<String, dynamic>) { if (userUpdate.content["content"] is Map<String, dynamic>) {
print("Is a Map of String to List of Strings");
final Map<String,dynamic> directMap = userUpdate.content["content"]; final Map<String,dynamic> directMap = userUpdate.content["content"];
directMap.forEach((String key, dynamic value) { directMap.forEach((String key, dynamic value) {
print("Key $key, Value: $value");
if (value is List<dynamic> && value.length > 0) if (value is List<dynamic> && value.length > 0)
txn.rawUpdate( txn.rawUpdate(
"UPDATE Rooms SET direct_chat_matrix_id=? WHERE id=?", "UPDATE Rooms SET direct_chat_matrix_id=? WHERE id=?",