serenadeai / serenade

Apache License 2.0
317 stars 57 forks source link

Add support for custom application icons #4

Closed charlespascoe closed 2 years ago

charlespascoe commented 2 years ago

Approved Issue: #1

Description

Add support for custom app icons to be passed from the plugin.

I've tested icons up to 400KB and it handled everything fine without any noticeable performance or functionality issues. The 20KB limit is far below this (and in reality icons will only be a few KBs), so I believe the fact that we're passing icons as strings through the Electron IPC will not be a problem.

Test Plan

  1. Encode a small (e.g. less than 48x48 px) icon as a data URL.
  2. In a test plugin (e.g. using one of the protocol examples), pass the icon string in the initial active message.
  3. Check that the icon is displayed as expected.

To test the icon updates, send a different icon in a new active message some time later.

Pre-Review Checklist

[x] I've performed a self-review of my own code [x] I've run the pre-commit hook to enforce code style [x] I've added or corresponding updated tests [x] I've run all tests and there were no failures [x] I've updated the documentation, if applicable

charlespascoe commented 2 years ago

By the way, would you rather I amended the commit or create a new commit with the suggested changes?