summaryrefslogtreecommitdiff
path: root/src/utils/app-platforms.ts
blob: 1adb840ee06653ad95a63b6b10c0d1caebe430c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import type { AppPlatform } from '@jet-app/app-store/api/models';

export const PlatformToExclusivityText: Partial<Record<AppPlatform, string>> = {
    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;
}