From bce557cc2dc767628bed6aac87301a1be7c5431b Mon Sep 17 00:00:00 2001 From: rxliuli Date: Tue, 4 Nov 2025 05:03:50 +0800 Subject: init commit --- src/utils/app-platforms.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/utils/app-platforms.ts (limited to 'src/utils/app-platforms.ts') diff --git a/src/utils/app-platforms.ts b/src/utils/app-platforms.ts new file mode 100644 index 0000000..1adb840 --- /dev/null +++ b/src/utils/app-platforms.ts @@ -0,0 +1,25 @@ +import type { AppPlatform } from '@jet-app/app-store/api/models'; + +export const PlatformToExclusivityText: Partial> = { + watch: 'ASE.Web.AppStore.App.OnlyForWatch', + tv: 'ASE.Web.AppStore.App.OnlyForAppleTV', + messages: 'ASE.Web.AppStore.App.OnlyForiMessage', + mac: 'ASE.Web.AppStore.App.OnlyForMac', + phone: 'ASE.Web.AppStore.App.OnlyForPhone', +}; + +export function isPlatformSupported( + platform: AppPlatform, + appPlatforms: AppPlatform[], +) { + const dedupedPlatforms = new Set(appPlatforms); + return dedupedPlatforms.has(platform); +} + +export function isPlatformExclusivelySupported( + platform: AppPlatform, + appPlatforms: AppPlatform[], +) { + const dedupedPlatforms = new Set(appPlatforms); + return dedupedPlatforms.has(platform) && dedupedPlatforms.size === 1; +} -- cgit v1.2.3