mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 21:09:21 +00:00
Fix unread conversations drop down
This commit is contained in:
parent
3257fd865f
commit
8f2574a555
@ -8,7 +8,7 @@ import 'package:comunic/models/unread_conversation.dart';
|
|||||||
class UnreadConversationsList extends AbstractList<UnreadConversation> {
|
class UnreadConversationsList extends AbstractList<UnreadConversation> {
|
||||||
/// Get the ID of the users included in this list
|
/// Get the ID of the users included in this list
|
||||||
Set<int> get usersID {
|
Set<int> get usersID {
|
||||||
final set = Set();
|
final set = Set<int>();
|
||||||
forEach((element) => set.addAll(element.message.usersID));
|
forEach((element) => set.addAll(element.message.usersID));
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,8 @@ class ConversationMessage extends SerializableElement<ConversationMessage> {
|
|||||||
Set<int> get usersID {
|
Set<int> get usersID {
|
||||||
if (userID != null) return Set()..add(userID);
|
if (userID != null) return Set()..add(userID);
|
||||||
|
|
||||||
return serverMessage.usersID;
|
if (serverMessage != null) return serverMessage.usersID;
|
||||||
|
return Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -3,8 +3,11 @@ import 'package:comunic/helpers/events_helper.dart';
|
|||||||
import 'package:comunic/helpers/users_helper.dart';
|
import 'package:comunic/helpers/users_helper.dart';
|
||||||
import 'package:comunic/lists/unread_conversations_list.dart';
|
import 'package:comunic/lists/unread_conversations_list.dart';
|
||||||
import 'package:comunic/lists/users_list.dart';
|
import 'package:comunic/lists/users_list.dart';
|
||||||
|
import 'package:comunic/ui/routes/main_route/main_route.dart';
|
||||||
import 'package:comunic/ui/widgets/async_screen_widget.dart';
|
import 'package:comunic/ui/widgets/async_screen_widget.dart';
|
||||||
|
import 'package:comunic/ui/widgets/conversation_image_widget.dart';
|
||||||
import 'package:comunic/ui/widgets/safe_state.dart';
|
import 'package:comunic/ui/widgets/safe_state.dart';
|
||||||
|
import 'package:comunic/utils/date_utils.dart';
|
||||||
import 'package:comunic/utils/intl_utils.dart';
|
import 'package:comunic/utils/intl_utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
@ -67,25 +70,41 @@ class _UnreadConversationsScreenState
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _tileBuilder(BuildContext context, int index) {
|
Widget _tileBuilder(BuildContext context, int index) {
|
||||||
/*final conv = _list[index];
|
final conv = _list[index];
|
||||||
final user = _users.getUser(conv.userID);
|
|
||||||
|
final message = _list[index].message;
|
||||||
|
|
||||||
|
final singleUserConv = conv.conv.members.length < 3;
|
||||||
|
|
||||||
|
String messageStr;
|
||||||
|
if (message.hasFile)
|
||||||
|
messageStr = tr("New file");
|
||||||
|
else if (message.hasMessage)
|
||||||
|
messageStr = singleUserConv
|
||||||
|
? message.message.content
|
||||||
|
: tr("%1% : %2%", args: {
|
||||||
|
"1": _users.getUser(message.userID).fullName,
|
||||||
|
"2": message.message.content,
|
||||||
|
});
|
||||||
|
else
|
||||||
|
message.serverMessage.getText(_users);
|
||||||
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: AccountImageWidget(user: user),
|
leading: ConversationImageWidget(
|
||||||
title: Text(user.displayName),
|
conversation: conv.conv,
|
||||||
|
users: _users,
|
||||||
|
),
|
||||||
|
title: Text(ConversationsHelper.getConversationName(conv.conv, _users)),
|
||||||
subtitle: RichText(
|
subtitle: RichText(
|
||||||
text: TextSpan(style: Theme.of(context).textTheme.bodyText2, children: [
|
text: TextSpan(style: Theme.of(context).textTheme.bodyText2, children: [
|
||||||
TextSpan(text: conv.convName.isNotEmpty ? conv.convName + "\n" : ""),
|
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: conv.message,
|
text: messageStr,
|
||||||
style: TextStyle(fontStyle: FontStyle.italic),
|
style: TextStyle(fontStyle: FontStyle.italic),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
)
|
),
|
||||||
trailing: Text(diffTimeFromNowToStr(conv.lastActive)),
|
trailing: Text(diffTimeFromNowToStr(conv.message.timeSent)),
|
||||||
onTap: () => MainController.of(context).openConversation(conv.id),
|
onTap: () => MainController.of(context).openConversation(conv.conv.id),
|
||||||
);*/
|
);
|
||||||
|
|
||||||
// TODO : reimplement
|
|
||||||
throw new Exception("unimplemented");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user