about summary refs log tree commit diff
path: root/plugins/starterPackAppClipExtension/withClipInfoPlist.js
blob: 4f104a654334fabfee4e21a2b8c3650ed516a20f (plain) (blame)
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
const {withInfoPlist} = require('@expo/config-plugins')
const plist = require('@expo/plist')
const path = require('path')
const fs = require('fs')

const withClipInfoPlist = (config, {targetName}) => {
  // eslint-disable-next-line no-shadow
  return withInfoPlist(config, config => {
    const targetPath = path.join(
      config.modRequest.platformProjectRoot,
      targetName,
      'Info.plist',
    )

    const newPlist = plist.default.build({
      NSAppClip: {
        NSAppClipRequestEphemeralUserNotification: false,
        NSAppClipRequestLocationConfirmation: false,
      },
      UILaunchScreen: {},
      CFBundleName: '$(PRODUCT_NAME)',
      CFBundleIdentifier: '$(PRODUCT_BUNDLE_IDENTIFIER)',
      CFBundleVersion: '$(CURRENT_PROJECT_VERSION)',
      CFBundleExecutable: '$(EXECUTABLE_NAME)',
      CFBundlePackageType: '$(PRODUCT_BUNDLE_PACKAGE_TYPE)',
      CFBundleShortVersionString: config.version,
      CFBundleIconName: 'AppIcon',
      UIViewControllerBasedStatusBarAppearance: 'NO',
      UISupportedInterfaceOrientations: [
        'UIInterfaceOrientationPortrait',
        'UIInterfaceOrientationPortraitUpsideDown',
      ],
      'UISupportedInterfaceOrientations~ipad': [
        'UIInterfaceOrientationPortrait',
        'UIInterfaceOrientationPortraitUpsideDown',
      ],
    })

    fs.mkdirSync(path.dirname(targetPath), {recursive: true})
    fs.writeFileSync(targetPath, newPlist)

    return config
  })
}

module.exports = {withClipInfoPlist}