import { ExpoConfig } from '@expo/config-types'; import { InfoPlist } from './IosConfig.types'; import { createInfoPlistPluginWithPropertyGuard } from '../plugins/ios-plugins'; export const withUsesNonExemptEncryption = createInfoPlistPluginWithPropertyGuard( setUsesNonExemptEncryption, { infoPlistProperty: 'ITSAppUsesNonExemptEncryption', expoConfigProperty: 'ios.config.usesNonExemptEncryption', }, 'withUsesNonExemptEncryption' ); export function getUsesNonExemptEncryption(config: Pick) { return config?.ios?.config?.usesNonExemptEncryption ?? null; } export function setUsesNonExemptEncryption( config: Pick, { ITSAppUsesNonExemptEncryption, ...infoPlist }: InfoPlist ): InfoPlist { const usesNonExemptEncryption = getUsesNonExemptEncryption(config); // Make no changes if the key is left blank if (usesNonExemptEncryption === null) { return infoPlist; } return { ...infoPlist, ITSAppUsesNonExemptEncryption: usesNonExemptEncryption, }; }