mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-04-26 01:10:16 +08:00
fix(update-center): cascade local and remote icon fallbacks
Keep update list icons from dropping straight to placeholders by retrying the remote store icon after local load failures. Align the update-center IPC and renderer types with the split local/remote icon contract.
This commit is contained in:
@@ -181,21 +181,31 @@ export const buildRemoteFallbackIconUrl = ({
|
||||
return `${baseUrl}/${storeArch}/${category}/${pkgname}/icon.png`;
|
||||
};
|
||||
|
||||
export const resolveUpdateItemIcon = (item: UpdateCenterItem): string => {
|
||||
export const resolveUpdateItemIcons = (
|
||||
item: UpdateCenterItem,
|
||||
): Pick<UpdateCenterItem, "localIcon" | "remoteIcon"> => {
|
||||
const localIcon =
|
||||
item.source === "aptss"
|
||||
? resolveDesktopIcon(item.pkgname)
|
||||
: resolveApmIcon(item.pkgname);
|
||||
if (localIcon) {
|
||||
return localIcon;
|
||||
const remoteIcon = buildRemoteFallbackIconUrl({
|
||||
pkgname: item.pkgname,
|
||||
source: item.source,
|
||||
arch: item.arch,
|
||||
category: item.category,
|
||||
});
|
||||
|
||||
if (localIcon && remoteIcon) {
|
||||
return { localIcon, remoteIcon };
|
||||
}
|
||||
|
||||
return (
|
||||
buildRemoteFallbackIconUrl({
|
||||
pkgname: item.pkgname,
|
||||
source: item.source,
|
||||
arch: item.arch,
|
||||
category: item.category,
|
||||
}) || ""
|
||||
);
|
||||
if (localIcon) {
|
||||
return { localIcon };
|
||||
}
|
||||
|
||||
if (remoteIcon) {
|
||||
return { remoteIcon };
|
||||
}
|
||||
|
||||
return {};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user