1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-29 16:26:18 +02:00

Fossil Hybrid: can now delete notifications from watch

This commit is contained in:
Daniel Dakhno 2020-11-12 12:35:29 +01:00
parent 02b9cedcb7
commit 79939b7339
3 changed files with 10 additions and 6 deletions

View File

@ -798,11 +798,11 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
try {
for (NotificationHRConfiguration configuration : this.notificationConfigurations) {
if (configuration.getPackageName().equals(sourceAppId)) {
queueWrite(new PlayTextNotificationRequest(sourceAppId, senderOrTitle, notificationSpec.body, this));
queueWrite(new PlayTextNotificationRequest(sourceAppId, senderOrTitle, notificationSpec.body, notificationSpec.getId(), this));
return true;
}
}
queueWrite(new PlayTextNotificationRequest("generic", senderOrTitle, notificationSpec.body, this));
queueWrite(new PlayTextNotificationRequest("generic", senderOrTitle, notificationSpec.body, notificationSpec.getId(), this));
} catch (Exception e) {
e.printStackTrace();
}
@ -1281,6 +1281,10 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
buffer.order(ByteOrder.LITTLE_ENDIAN);
int notifId = buffer.getInt(3);
Intent deleteIntent = new Intent(NotificationListener.ACTION_DISMISS);
deleteIntent.putExtra("handle", (long) notifId);
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(deleteIntent);
}
private void handleCallRequest(byte[] value) {

View File

@ -32,8 +32,8 @@ public abstract class PlayNotificationRequest extends FilePutRequest {
super(FileHandle.NOTIFICATION_PLAY, createFile(notificationType, flags, packageName, packageName, packageName, getCurrentMessageId()), adapter);
}
public PlayNotificationRequest(int notificationType, int flags, String packageName, String sender, String message, FossilWatchAdapter adapter) {
super(FileHandle.NOTIFICATION_PLAY, createFile(notificationType, flags, packageName, sender, message, getCurrentMessageId()), adapter);
public PlayNotificationRequest(int notificationType, int flags, String packageName, String sender, String message, int notificationId, FossilWatchAdapter adapter) {
super(FileHandle.NOTIFICATION_PLAY, createFile(notificationType, flags, packageName, sender, message, notificationId), adapter);
}
public PlayNotificationRequest(int notificationType, int flags, int packageCRC, String sender, String message, int messageId, FossilWatchAdapter adapter) {

View File

@ -3,8 +3,8 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fo
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.adapter.fossil.FossilWatchAdapter;
public class PlayTextNotificationRequest extends PlayNotificationRequest {
public PlayTextNotificationRequest(String packageName, String sender, String message, FossilWatchAdapter adapter) {
super(3, 2, packageName, sender, message, adapter);
public PlayTextNotificationRequest(String packageName, String sender, String message, int messageId, FossilWatchAdapter adapter) {
super(3, 2, packageName, sender, message, messageId, adapter);
}
public PlayTextNotificationRequest(String packageName, FossilWatchAdapter adapter) {