mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-10-25 17:22:27 +08:00
Uploading an icon used to attach the image to the one provider being edited, shown as a lone "Custom icon" strip above the built-in grid. It had no name, could not be searched and had to be uploaded again for every provider that wanted it. The icon picker now has two groups, filtered by the same search box: - My Icons: the first tile uploads an image. After it is resized, a dialog asks for a name (the file name by default); "Save and Use" stores it in the library and selects it. Library icons show their names, can be picked by any provider in any app, and can be renamed or deleted from the buttons that appear on hover. Uploading an image that is already in the library reuses the existing entry. A current custom icon that is not in the library (for example one from an import link) shows as "Current icon" and can be saved, named after the provider. - Built-in Icons, as before. Clicking an icon now selects it and closes the picker, so the "Done" button is gone; "Clear icon" next to the search box removes the icon. The library lives in the settings table under `custom_icons`, which is already cloud-synced. Providers still store the image itself, not a library id, so renaming or deleting a library entry never changes a provider that uses it, and a provider shows its icon on a device whose library differs. Adding to the library decodes the PNG fully like saving a provider does, caps the library at 100 icons and names at 64 characters. SQL import and cloud sync drop library entries whose image is invalid, alongside the existing provider and universal provider cleanup; unknown fields on the remaining entries are kept. The naming dialog stops its submit event from propagating: React events bubble through portals, so without it saving a name would also submit the provider form the picker is rendered in. The user manual's icon section (2.3, zh/en/ja) describes the new flow.