Export retained notification images in HTML
This commit is contained in:
@@ -77,17 +77,20 @@ class NotificationCaptureService : NotificationListenerService() {
|
||||
) {
|
||||
if (!NotificationRuleEvaluator.allows(ruleStore.ruleFor(loggingType), snapshot.packageName)) return
|
||||
val appName = appName(snapshot.packageName)
|
||||
val retainImage = includeContents && snapshot.imageBytes != null &&
|
||||
NotificationRuleEvaluator.allows(ruleStore.ruleFor(LoggingType.IMAGE_CONTENT), snapshot.packageName)
|
||||
val entry = NotificationLogEntry(
|
||||
recordedAtEpochMillis = System.currentTimeMillis(),
|
||||
packageName = snapshot.packageName,
|
||||
appName = appName,
|
||||
action = action,
|
||||
contents = if (includeContents) visibleContents(snapshot) else null,
|
||||
imageId = if (retainImage) java.util.UUID.randomUUID().toString() else null,
|
||||
)
|
||||
writeExecutor.execute {
|
||||
try {
|
||||
if (includeContents && snapshot.imageBytes != null && NotificationRuleEvaluator.allows(ruleStore.ruleFor(LoggingType.IMAGE_CONTENT), snapshot.packageName)) {
|
||||
imageStore.save(entry.id, snapshot.imageBytes)
|
||||
if (retainImage) {
|
||||
imageStore.save(entry.imageId!!, snapshot.imageBytes!!)
|
||||
}
|
||||
logStore.append(entry)
|
||||
} catch (error: Exception) {
|
||||
|
||||
Reference in New Issue
Block a user