Enhancement: Notification Actions (Reply, Mark as Read)
Description
Notification Actions are the little things in the dropdown of a Notification which allow you to directly reply to a message, mark it as read, or whatever else. Element has this and it has been my main blocker for moving to Fluffychat.
Support for this is now available in the flutter_local_notifications plugin (see https://github.com/MaikuB/flutter_local_notifications/pull/880 and https://github.com/MaikuB/flutter_local_notifications/tree/master/flutter_local_notifications#notification-actions) so adding crossplatform support should be possible (it seems, I've never used Flutter).
Reply and Mark as read are something I'm definitely missing a lot
This issue is stale because it has been open for 120 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
Is this still planned?
I am taking that as a request for reopening
EDIT: I actually just found this PR which does it mostly, but testing reveals that it seems to have the same issue as described below (after the necessary AndroidManifest.xml update is done).
I tried to implement the "Reply" feature for Android, and it works, but there's a problem.
If we have the background test notification isolate as
@pragma('vm:entry-point')
static void onBackgroundNotificationResponse(NotificationResponse response) async {
final store = await SharedPreferences.getInstance();
final clients = await ClientManager.getClients(initialize: true, store: store);
final client = clients.firstOrNull;
if(client == null)
return;
final roomId = response?.payload;
if(roomId == null)
return;
//await client.ensureNotSoftLoggedOut();
//await client.roomsLoading;
//await client.accountDataLoading;
await client.roomsLoading;
await client.oneShotSync();
client.backgroundSync = true;
final room = client.getRoomById(roomId);
if(room != null){
await room.sendTextEvent("test reply from notification",inReplyTo: null, editEventId: null,parseCommands: false);
}
}
with onDidReceiveBackgroundNotificationResponse: onBackgroundNotificationResponse given to _flutterLocalNotificationsPlugin.initialize, I can get have the reply sent, and this would be the starting point for properly implementing the reply and mark as read.
However, it leaves the app in a weird state next time it's brought to foreground, unable to sync and with some errors coming from the secure storage / SQL for the client details. Reopening the app recovers it to normal state. The issue comes when initialize: true in getClients(), which is required so that the message can be sent.
Alternatively, I tried alternative(?) to initialize: true, similar to what is done in background push isolate.
final database = await client.databaseBuilder?.call(client);
if (!client.isLogged()) {
if (database == null) {
return;
}
final clientInfoMap = await database.getClient(client.clientName);
final token = clientInfoMap?.tryGet<String>('token');
if (token == null) {
return; //not logged in
}
client.accessToken = token;
}
Somehow this results in same thing. I guess something is not being done properly?