Fix missing chat notification avatar on Apple Watch
Chat notifications are upgraded to Communication Notifications and attach the sender's avatar to the INPerson via downloadAvatarImage. The image was built with INImage(imageData:), which renders on the iPhone but is not relayed to paired devices like the Apple Watch. The Watch then falls back to drawing a monogram from the sender's initials instead of the avatar. Write the downloaded avatar bytes to a file in the shared App Group container and back the INImage with INImage(url:) so the system can resolve the image lazily across devices. Files are named by a stable hash of the content-addressed thumbnail URL so notifications from the same sender reuse one file.
This commit is contained in:
@@ -47,6 +47,14 @@ Two sound types are supported:
|
||||
|
||||
DM sound only plays if the user has enabled the `playSoundChat` preference in the main app's chat settings.
|
||||
|
||||
### Communication Notifications (Avatars)
|
||||
|
||||
Chat notifications (`reason == "chat-message"` / `"chat-reaction"`) are upgraded to iOS Communication Notifications via `INSendMessageIntent`, which lets the sender's avatar appear alongside the message.
|
||||
|
||||
The avatar is downloaded from `senderAvatarUrl` (rewritten to the `avatar_thumbnail` variant to keep it small) and attached to the `INPerson` sender. The downloaded bytes are written to a file in the shared App Group container and the `INImage` is created with `INImage(url:)`, **not** `INImage(imageData:)`.
|
||||
|
||||
This distinction matters for paired devices: an `INImage` backed by in-memory data renders on the iPhone but is not relayed to the Apple Watch, which then falls back to drawing a monogram from the sender's initials. Backing the image with a file URL the system can resolve lazily lets the Watch render the real avatar. Avatar files are written under `notification-avatars/` in the container and named by a stable hash of the (content-addressed) source URL, so notifications from the same sender reuse one file.
|
||||
|
||||
## Key Files
|
||||
|
||||
| File | Purpose |
|
||||
|
||||
Reference in New Issue
Block a user