mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-25 05:52:50 -05:00
notifications: add image persistence
This commit is contained in:
@@ -362,6 +362,7 @@ PanelWindow {
|
||||
id: iconContainer
|
||||
|
||||
readonly property bool hasNotificationImage: notificationData && notificationData.image && notificationData.image !== ""
|
||||
readonly property bool needsImagePersist: hasNotificationImage && notificationData.image.startsWith("image://qsimage/") && !notificationData.persistedImagePath
|
||||
|
||||
width: 63
|
||||
height: 63
|
||||
@@ -391,6 +392,22 @@ PanelWindow {
|
||||
const appName = notificationData?.appName || "?";
|
||||
return appName.charAt(0).toUpperCase();
|
||||
}
|
||||
|
||||
onImageStatusChanged: {
|
||||
if (imageStatus === Image.Ready && needsImagePersist) {
|
||||
const cachePath = NotificationService.getImageCachePath(notificationData);
|
||||
saveImageToFile(cachePath);
|
||||
}
|
||||
}
|
||||
|
||||
onImageSaved: filePath => {
|
||||
if (!notificationData)
|
||||
return;
|
||||
notificationData.persistedImagePath = filePath;
|
||||
const wrapperId = notificationData.notification?.id?.toString() || "";
|
||||
if (wrapperId)
|
||||
NotificationService.updateHistoryImage(wrapperId, filePath);
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
||||
Reference in New Issue
Block a user