refactor: simplify app update toast

This commit is contained in:
zhom
2025-08-07 04:52:28 +04:00
parent d1d953b3e2
commit 28818bed77
3 changed files with 4 additions and 146 deletions
+1 -36
View File
@@ -46,23 +46,12 @@ interface VersionUpdateToastProps extends BaseToastProps {
};
}
interface AppUpdateToastProps extends BaseToastProps {
type: "app-update";
stage?: "downloading" | "extracting" | "installing" | "completed";
progress?: {
percentage: number;
speed?: string;
eta?: string;
};
}
type ToastProps =
| SuccessToastProps
| ErrorToastProps
| DownloadToastProps
| LoadingToastProps
| VersionUpdateToastProps
| AppUpdateToastProps;
| VersionUpdateToastProps;
export function showToast(props: ToastProps & { id?: string }) {
const toastId = props.id ?? `toast-${props.type}-${Date.now()}`;
@@ -257,27 +246,3 @@ export function showUnifiedVersionUpdateToast(
...options,
});
}
export function showAppUpdateToast(
title: string,
stage: "downloading" | "extracting" | "installing" | "completed",
options?: {
id?: string;
description?: string;
progress?: {
percentage: number;
speed?: string;
eta?: string;
};
duration?: number;
},
) {
return showToast({
type: "app-update",
title,
stage,
id: options?.id ?? "app-update-progress",
duration: stage === "downloading" ? Number.POSITIVE_INFINITY : 5000,
...options,
});
}