summaryrefslogtreecommitdiff
path: root/node_modules/@jet-app/app-store/tmp/src/common/privacy/privacy-suppression.js
blob: f43144f0f6818ae5ca9966caa4ff17014c0519af (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
import { isNothing } from "@jet/environment/types/optional";
import * as serverData from "../../foundation/json-parsing/server-data";
let suppressedPrivacyApps = null;
function initialize(objectGraph) {
    if (suppressedPrivacyApps !== null) {
        return;
    }
    suppressedPrivacyApps = new Set();
    for (const appId of objectGraph.bag.suppressedPrivacyAppIds) {
        suppressedPrivacyApps.add(appId);
    }
}
export function shouldSuppressPrivacyInformationForAdamId(objectGraph, adamId) {
    initialize(objectGraph);
    if (isNothing(suppressedPrivacyApps) || serverData.isNullOrEmpty(adamId)) {
        return false;
    }
    return suppressedPrivacyApps.has(adamId);
}
export function shouldSuppressPrivacyInformationForBundleId(objectGraph, bundleId) {
    initialize(objectGraph);
    if (isNothing(suppressedPrivacyApps) || serverData.isNullOrEmpty(bundleId)) {
        return false;
    }
    /// This handles a special case wildcard entry for macOS installers, to avoid the churn of adding new bundleIDs
    /// for each macOS release. We specifically do not want to treat all entries in `suppressedPrivacyApps` as a regex,
    /// as there is no expectation that any other entry will be a regex, and treating them as such may lead to false matches.
    if (suppressedPrivacyApps.has("com.apple.InstallAssistant.*") &&
        bundleId.startsWith("com.apple.InstallAssistant.")) {
        return true;
    }
    return suppressedPrivacyApps.has(bundleId);
}
//# sourceMappingURL=privacy-suppression.js.map