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