Show album art with UserNotification api. #61

Merged
nevack merged 3 commits from nevack/notifications into master 2021-01-07 04:22:15 -03:00
nevack commented 2020-12-26 10:46:20 -03:00 (Migrated from github.com)

Also hide no-op iTunes Style option.

Also hide no-op iTunes Style option.
kode54 commented 2021-01-07 01:52:57 -03:00 (Migrated from github.com)

Quick question regarding this: Will there be a race condition for the temp file? Does it really need to be a file and not a memory object? I can apply this if you're sure it's ready.

Quick question regarding this: Will there be a race condition for the temp file? Does it really need to be a file and not a memory object? I can apply this if you're sure it's ready.
nevack (Migrated from github.com) reviewed 2021-01-07 02:47:32 -03:00
nevack (Migrated from github.com) left a comment

Quick question regarding this: Will there be a race condition for the temp file? Does it really need to be a file and not a memory object? I can apply this if you're sure it's ready.

I don't know a way to make URL to NSData.

Used this tutorial https://nshipster.com/temporary-files/#creating-a-temporary-file

> Quick question regarding this: Will there be a race condition for the temp file? Does it really need to be a file and not a memory object? I can apply this if you're sure it's ready. I don't know a way to make URL to NSData. Used this tutorial https://nshipster.com/temporary-files/#creating-a-temporary-file
nevack (Migrated from github.com) commented 2021-01-03 19:43:27 -03:00

@kode54 Can you suggest a better way to do this?
We need to supply URL to local file as per UNNotificationAttachment documentation.

@kode54 Can you suggest a better way to do this? We need to supply URL to local file as per UNNotificationAttachment documentation.
@ -409,3 +409,4 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Enable notifications" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="hqT-nY-NoU">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
nevack (Migrated from github.com) commented 2021-01-03 19:47:38 -03:00

image

![image](https://user-images.githubusercontent.com/8330119/103490726-d097bf00-4e2e-11eb-8e99-262332b4cc17.png)
nevack commented 2021-01-07 02:51:16 -03:00 (Migrated from github.com)

PS. I think it's better to save Album art in Cog's Cache folder instead of storing bytes in xml.

PS. I think it's better to save Album art in Cog's Cache folder instead of storing bytes in xml.
kode54 commented 2021-01-07 02:56:25 -03:00 (Migrated from github.com)

PS. I think it's better to save Album art in Cog's Cache folder instead of storing bytes in xml.

You're welcome to help make that possible, too. I'm thinking maybe hash filenames, similar to what I'm already using for the reference keys in the xml. Meh, I probably should have done this in the first place.

I'm also looking to some day make the whole thing sandbox-able. The whole main barrier is keeping a minimal amount of NSBookmark handles around in the saved data so permission to all the local tracks in the playlist persists. Perhaps permission to the entire local files' folders, too, since I also had some person ask if I could make it possible to scan for and add entire albums from folders just from adding one or more tracks. That sounds a mite complicated, though.

> PS. I think it's better to save Album art in Cog's Cache folder instead of storing bytes in xml. You're welcome to help make that possible, too. I'm thinking maybe hash filenames, similar to what I'm already using for the reference keys in the xml. Meh, I probably should have done this in the first place. I'm also looking to some day make the whole thing sandbox-able. The whole main barrier is keeping a minimal amount of NSBookmark handles around in the saved data so permission to all the local tracks in the playlist persists. Perhaps permission to the entire local files' folders, too, since I also had some person ask if I could make it possible to scan for and add entire albums from folders just from adding one or more tracks. That sounds a mite complicated, though.
kode54 (Migrated from github.com) reviewed 2021-01-07 02:58:32 -03:00
kode54 (Migrated from github.com) commented 2021-01-07 02:58:32 -03:00

Nope. And I can't suggest using a unique name, either, because then it's on us to wipe out the old files when placing a new file. Maybe using a specific temp file name pattern, and wiping them all on startup, exit, and before placing a new file, but still using a unique name, so that old requests pull the missing file, while new are guaranteed to always get the newly generated file. Or something.

Nope. And I can't suggest using a unique name, either, because then it's on us to wipe out the old files when placing a new file. Maybe using a specific temp file name pattern, and wiping them all on startup, exit, and before placing a new file, but still using a unique name, so that old requests pull the missing file, while new are guaranteed to always get the newly generated file. Or something.
kode54 (Migrated from github.com) reviewed 2021-01-07 02:59:21 -03:00
@ -409,3 +409,4 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Enable notifications" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="hqT-nY-NoU">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
kode54 (Migrated from github.com) commented 2021-01-07 02:59:21 -03:00

Also, I'm open to suggestions to replace the icon and category. It should be a "notifications" category or perhaps "toasts" or something, and it needs an appropriate icon.

Also, I'm open to suggestions to replace the icon and category. It should be a "notifications" category or perhaps "toasts" or something, and it needs an appropriate icon.
kode54 (Migrated from github.com) reviewed 2021-01-07 03:01:06 -03:00
kode54 (Migrated from github.com) commented 2021-01-07 03:01:06 -03:00

Oh, it already produces a unique name. Huh, sorry I didn't notice that sooner.

Oh, it already produces a unique name. Huh, sorry I didn't notice that sooner.
nevack commented 2021-01-07 03:23:44 -03:00 (Migrated from github.com)

I'll update preference pane icons to SF Symbols for macOS 11.0+ and rename Growl to Notifications in next PR

I'll update preference pane icons to SF Symbols for macOS 11.0+ and rename Growl to Notifications in next PR
kode54 (Migrated from github.com) approved these changes 2021-01-07 04:22:09 -03:00
kode54 (Migrated from github.com) left a comment

Okay, looks good.

Okay, looks good.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: chris/Cog#61
No description provided.