install prompt support and iOS “Share → Add to Home Screen” guidance. Also added a small helper + tests to decide when/which banner variant should show, and shared copy in common.json.
29 lines
563 B
TypeScript
29 lines
563 B
TypeScript
export type InstallBannerVariant = 'prompt' | 'ios';
|
|
|
|
export type InstallBannerState = {
|
|
variant: InstallBannerVariant;
|
|
};
|
|
|
|
export type InstallBannerInput = {
|
|
isInstalled: boolean;
|
|
isStandalone: boolean;
|
|
canInstall: boolean;
|
|
isIos: boolean;
|
|
};
|
|
|
|
export function resolveInstallBannerState(input: InstallBannerInput): InstallBannerState | null {
|
|
if (input.isInstalled || input.isStandalone) {
|
|
return null;
|
|
}
|
|
|
|
if (input.canInstall) {
|
|
return { variant: 'prompt' };
|
|
}
|
|
|
|
if (input.isIos) {
|
|
return { variant: 'ios' };
|
|
}
|
|
|
|
return null;
|
|
}
|