blob: eed6d293e6353bf1db913e4625a68bd5a2a6eef9 (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
import { isNothing, isSome } from "@jet/environment";
import { unreachable } from "../../foundation/util/errors";
import { isNotEmpty } from "../../foundation/util/array-util";
let suppressedAccessibilityApps = null;
/**
* Intiailizes `suppressedAccessibilityApps` with whatever is in the bag for `suppressedAccessibilityAppIds`, so that it only needs to be mapped to a Set once.
*/
function initialize(objectGraph) {
if (suppressedAccessibilityApps !== null) {
return;
}
suppressedAccessibilityApps = new Set();
for (const appId of objectGraph.bag.suppressedAccessibilityAppIds) {
suppressedAccessibilityApps.add(appId);
}
}
/**
* Returns whether the accessibility support feature is enabled.
*/
export function isProductAccessibilityLabelsEnabled(objectGraph) {
return (objectGraph.featureFlags.isEnabled("product_accessibility_support_2025A") &&
objectGraph.bag.enableAppAccessibilityLabels);
}
/**
* Returns whether we should suppress the accessibility information for a given adamId.
*/
export function shouldSuppressAccessibilityLabelsForAdamId(objectGraph, adamId) {
initialize(objectGraph);
return isSome(suppressedAccessibilityApps) && isNotEmpty(adamId) && suppressedAccessibilityApps.has(adamId);
}
/**
* Returns whether we should suppress the accessibility information for a given bundleId.
*/
export function shouldSuppressAccessibilityLabelsForBundleId(objectGraph, bundleId) {
initialize(objectGraph);
// We always want to suppress accessibility information for macOS installers, as accessibility labels don't apply.
if (bundleId.startsWith("com.apple.InstallAssistant.")) {
return true;
}
return isSome(suppressedAccessibilityApps) && isNotEmpty(bundleId) && suppressedAccessibilityApps.has(bundleId);
}
/**
* Returns the device family we want to display the accessibility labels for, based on `AppPlatform` for the first set
* of screenshots we display on the product page.
*/
export function deviceFamilyForAccessibilityLabels(platform) {
if (isNothing(platform)) {
return null;
}
switch (platform) {
case "phone":
return "iphone";
case "pad":
return "ipad";
case "mac":
return "mac";
case "tv":
return "tvos";
case "vision":
return "realityDevice";
case "watch":
return "watch";
case "messages":
// If we are surfacing Messages metadata, we want to hide the labels.
return null;
default:
unreachable(platform);
}
}
//# sourceMappingURL=accessibility-common.js.map
|