some updates
This commit is contained in:
parent
b94408c6a4
commit
4964c7f621
|
|
@ -111,13 +111,9 @@ class ChatListController extends State<ChatList>
|
|||
_activeSpaceId = null;
|
||||
});
|
||||
|
||||
void onChatTap(
|
||||
Room room, [
|
||||
BuildContext? posContext,
|
||||
Room? space,
|
||||
]) async {
|
||||
if (room.membership == Membership.invite && posContext != null) {
|
||||
chatContextAction(room, posContext, space);
|
||||
void onChatTap(Room room) async {
|
||||
if (room.membership == Membership.invite) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class ChatListViewBody extends StatelessWidget {
|
|||
key: ValueKey(activeSpace),
|
||||
spaceId: activeSpace,
|
||||
onBack: controller.clearActiveSpace,
|
||||
onChatTab: (room) => controller.onChatTap(room, context),
|
||||
onChatTab: (room) => controller.onChatTap(room),
|
||||
onChatContext: (room, context) =>
|
||||
controller.chatContextAction(room, context),
|
||||
activeChat: controller.activeChat,
|
||||
|
|
@ -259,7 +259,7 @@ class ChatListViewBody extends StatelessWidget {
|
|||
space: space,
|
||||
key: Key('chat_list_item_${room.id}'),
|
||||
filter: filter,
|
||||
onTap: () => controller.onChatTap(room, context, space),
|
||||
onTap: () => controller.onChatTap(room),
|
||||
onLongPress: (context) =>
|
||||
controller.chatContextAction(room, context, space),
|
||||
activeChat: controller.activeChat == room.id,
|
||||
|
|
|
|||
|
|
@ -93,6 +93,8 @@ class ChatListItem extends StatelessWidget {
|
|||
: room.getState(EventTypes.RoomMember, lastEvent.senderId) == null;
|
||||
final space = this.space;
|
||||
|
||||
final inviterMxId = room.getState(EventTypes.RoomMember, room.client.userID!)?.senderId;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
|
|
@ -319,7 +321,7 @@ class ChatListItem extends StatelessWidget {
|
|||
),
|
||||
builder: (context, snapshot) => Text(
|
||||
room.membership == Membership.invite
|
||||
? room
|
||||
? "${room
|
||||
.getState(
|
||||
EventTypes.RoomMember,
|
||||
room.client.userID!,
|
||||
|
|
@ -329,7 +331,7 @@ class ChatListItem extends StatelessWidget {
|
|||
(isDirectChat
|
||||
? L10n.of(context).newChatRequest
|
||||
: L10n.of(context)
|
||||
.inviteGroupChat)
|
||||
.inviteGroupChat)}${inviterMxId != null ? " ($inviterMxId)" : ""}"
|
||||
: snapshot.data ??
|
||||
L10n.of(context).emptyChat,
|
||||
softWrap: false,
|
||||
|
|
|
|||
|
|
@ -325,9 +325,12 @@ class BackgroundPush {
|
|||
|
||||
Future<void> goToRoom(NotificationResponse? response) async {
|
||||
try {
|
||||
final roomId = response?.payload;
|
||||
if (response?.payload == null) return;
|
||||
final arr = response?.payload?.split(' ');
|
||||
final roomId = arr?[0];
|
||||
final eventId = arr?[1];
|
||||
Logs().v('[Push] Attempting to go to room $roomId...');
|
||||
if (roomId == null) {
|
||||
if (roomId == null || eventId == null) {
|
||||
return;
|
||||
}
|
||||
await client.roomsLoading;
|
||||
|
|
@ -337,6 +340,21 @@ class BackgroundPush {
|
|||
.waitForRoomInSync(roomId)
|
||||
.timeout(const Duration(seconds: 30));
|
||||
}
|
||||
if (response?.actionId == "read") {
|
||||
if (AppConfig.sendPublicReadReceipts) {
|
||||
await client.setReadMarker(roomId, mRead: eventId);
|
||||
} else {
|
||||
await client.setReadMarker(roomId, mReadPrivate: eventId);
|
||||
}
|
||||
return;
|
||||
} else if (response?.actionId == "reply") {
|
||||
final replyText = response?.input;
|
||||
final room = client.getRoomById(roomId);
|
||||
if (replyText != null && room != null) {
|
||||
await room.sendTextEvent(replyText, inReplyTo: await room.getEventById(eventId));
|
||||
}
|
||||
return;
|
||||
}
|
||||
FluffyChatApp.router.go(
|
||||
client.getRoomById(roomId)?.membership == Membership.invite
|
||||
? '/rooms'
|
||||
|
|
|
|||
|
|
@ -247,6 +247,13 @@ Future<void> _tryPushHelper(
|
|||
number: notification.counts?.unread,
|
||||
category: AndroidNotificationCategory.message,
|
||||
shortcutId: event.room.id,
|
||||
actions: [
|
||||
AndroidNotificationAction("read", l10n.markAsRead),
|
||||
AndroidNotificationAction("reply",
|
||||
l10n.reply, inputs: [
|
||||
AndroidNotificationActionInput(label: l10n.writeAMessage)
|
||||
])
|
||||
],
|
||||
styleInformation: messagingStyleInformation ??
|
||||
MessagingStyleInformation(
|
||||
Person(
|
||||
|
|
@ -290,7 +297,7 @@ Future<void> _tryPushHelper(
|
|||
title,
|
||||
body,
|
||||
platformChannelSpecifics,
|
||||
payload: event.roomId,
|
||||
payload: '${event.roomId} ${event.eventId}',
|
||||
);
|
||||
Logs().v('Push helper has been completed!');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue