polyhorn_cli/ios/infoplist/
mod.rs

1//! Types to work with info plists that are used on iOS to convey metadata of an
2//! application. Note: the documentation of this module is taken directly from
3//! Apple.
4
5use serde::Serialize;
6use smart_default::SmartDefault;
7
8/// Data structure that contains the necessary metadata for apps running on iOS.
9#[derive(Copy, Clone, Debug, SmartDefault, Eq, PartialEq, Serialize)]
10pub struct InfoPlist<'a> {
11    /// The default language and region for the bundle, as a language ID. Use
12    /// the two-letter ISO 639-1 standard (preferred) or the three-letter ISO
13    /// 639-2 standard. If an ISO 639-1 code isn't available for a particular
14    /// language, use the ISO 639-2 code instead. There's no ISO 639-1 code for
15    /// the Hawaiian language, so use the ISO 639-2 code. To distinguish between
16    /// languages and regional dialects, use a language designator with a region
17    /// designator and a script designator separated by hyphens. To specify the
18    /// English language as it's used in the United Kingdom, use en-GB, where GB
19    /// is the region designator. To represent Mandarin Chinese, spoken in
20    /// Taiwan, and written in Traditional Chinese script, use zh-Hant-TW. To
21    /// specify a script, combine a language designator with a script designator
22    /// separated by a hyphen, as in az-Arab for Azerbaijani in the Arabic
23    /// script.
24    #[serde(rename = "CFBundleDevelopmentRegion")]
25    pub bundle_development_region: &'a str,
26
27    /// The name of the bundle's executable file.
28    #[serde(rename = "CFBundleExecutable")]
29    pub bundle_executable: &'a str,
30
31    /// A unique identifier for a bundle. A bundle ID uniquely identifies a
32    /// single app throughout the system. The bundle ID string must contain only
33    /// alphanumeric characters (A-Z, a-z, and 0-9), hyphens (-), and periods
34    /// (.).  The string should be in reverse-DNS format. Bundle IDs are case
35    /// sensitive.
36    #[serde(rename = "CFBundleIdentifier")]
37    pub bundle_identifier: &'a str,
38
39    /// The current version of the Information Property List structure. Xcode
40    /// adds this key automatically. Don't change the value.
41    #[serde(rename = "CFBundleInfoDictionaryVersion")]
42    pub bundle_info_dictionary_version: &'a str,
43
44    /// A user-visible short name for the bundle. This name can contain up to 15
45    /// characters. The system may display it to users if `CFBundleDisplayName`
46    /// isn't set.
47    #[serde(rename = "CFBundleName")]
48    pub bundle_name: &'a str,
49
50    /// The type of bundle. This key consists of a four-letter code for the
51    /// bundle type. For apps, the code is `APPL`, for framework, it's `FMWK`,
52    /// and for bundles, it's `BNDL`. The default value is derived from the
53    /// bundle extension or, if it can't be derived, the default value is
54    /// `BNDL`.
55    #[serde(rename = "CFBundlePackageType")]
56    pub bundle_package_type: &'a str,
57
58    /// The release or version number of the bundle. This key is a user-visible
59    /// string for the version of the bundle. The required format is three
60    /// period-separated integers, such as 10.14.1. The string can only contain
61    /// numeric characters (0-9) and periods. Each integer provides information
62    /// about the release in the format `[major].[minor].[patch]`. The key is
63    /// used throughout the system to identify the version of the bundle.
64    #[serde(rename = "CFBundleShortVersionString")]
65    pub bundle_short_version_string: &'a str,
66
67    /// The version of the build that identifies an iteration of the bundle.
68    /// This key is a machine-readable string composed of one to three
69    /// period-separated integers, such as 10.14.1. The string can only contain
70    /// numeric characters (0-9) and periods. Each integer provides information
71    /// about the build version in the format `[major].[minor].[patch]`. You can
72    /// include more integers but the system ignores them. You can also
73    /// abbreviate the build version by using only one or two integers, where
74    /// missing integers in the format are interpreted as zeros. For example, 0
75    /// specifies 0.0.0, 10 specifies 10.0.0, and 10.5 specifies 10.5.0. This
76    /// key is required by the App Store and is used throughout the system to
77    /// identify the version of the build. For macOS apps, increment the build
78    /// version before you distribute a build.
79    #[serde(rename = "CFBundleVersion")]
80    pub bundle_version: &'a str,
81
82    /// A Boolean value indicating whether the app must run in iOS.
83    #[serde(rename = "LSRequiresIPhoneOS")]
84    pub requires_iphone_os: bool,
85
86    /// The filename of the storyboard from which to generate the app's launch
87    /// image. Specify the name of the storyboard file without the filename
88    /// extension. For example, if the filename of your storyboard is
89    /// `LaunchScreen.storyboard`, specify "LaunchScreen" as the value for this
90    /// key. If you prefer to configure your app's launch screen without
91    /// storyboards, use `UILaunchScreen` instead.
92    #[serde(rename = "UILaunchStoryboardName")]
93    pub launch_storyboard_name: &'a str,
94
95    /// The device-related features that your app requires to run.
96    #[serde(rename = "UIRequiredDeviceCapabilities")]
97    pub required_device_capabilities: &'a [DeviceCapability],
98
99    /// The interface orientations the app supports.
100    #[serde(rename = "UISupportedInterfaceOrientations")]
101    pub supported_interface_orientations: &'a [InterfaceOrientation],
102
103    /// The interface orientations the app supports on iPad.
104    #[serde(rename = "UISupportedInterfaceOrientations~ipad")]
105    pub supported_interface_orientations_ipad: &'a [InterfaceOrientation],
106}
107
108/// Device-related feature that an app may require to run.
109#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)]
110pub enum DeviceCapability {
111    /// The presence of accelerometers. Use he Core Motion framework to receive
112    /// accelerometer events. You don't need to include this value if your app
113    /// detects only device orientation changes. Available in iOS 3.0 and later.
114    Accelerometer,
115
116    /// Support for ARKit. Available in iOS 11.0 and later.
117    #[serde(rename = "arkit")]
118    ARKit,
119
120    /// Compilation for the armv7 instruction set, or as a 32/64-bit universal
121    /// app. Available in iOS 3.1 and later.
122    Armv7,
123
124    /// Compilation for the arm64 instruction set. Include this key for all
125    /// 64-bit apps and embedded bundles, like extensions and frameworks.
126    /// Available in iOS 8.0 and later.
127    Arm64,
128
129    /// Autofocus capabilities in the device's still camera. You might need to
130    /// include this value if your app supports macro photography or requires
131    /// sharper images to perform certain image-processing tasks. Available in
132    /// iOS 3.0 and later.
133    #[serde(rename = "auto-focus-camera")]
134    AutoFocusCamera,
135
136    /// Bluetooth low-energy hardware. Available in iOS 5.0 and later.
137    #[serde(rename = "bluetooth-le")]
138    BluetoothLE,
139
140    /// A camera flash. Use the `cameraFlashMode` property of a
141    /// `UIImagePickerController` instance to control the camera's flash.
142    /// Available in iOS 3.0 and later.
143    #[serde(rename = "camera-flash")]
144    CameraFlash,
145
146    /// A forward-facing camera. Use the `cameraDevice` property of a
147    /// `UIImagePickerController` instance to select the device's camera.
148    /// Available in iOS 3.0 and later.
149    #[serde(rename = "front-facing-camera")]
150    FrontFacingCamera,
151
152    /// Access to the Game Center service. Enable the Game Center capability in
153    /// Xcode to add this value to your app. Available in iOS 4.1 and later.
154    #[serde(rename = "gamekit")]
155    GameKit,
156
157    /// GPS (or AGPS) hardware for tracking locations. If you include this
158    /// value, you should also include the location-services value. Require GPS
159    /// only if your app needs location data more accurate than the cellular or
160    /// Wi-Fi radios provide. Available in iOS 3.0 and later.
161    GPS,
162
163    /// A gyroscope. Use the Core Motion framework to retrieve information from
164    /// gyroscope hardware. Available in iOS 3.0 and later.
165    Gyroscope,
166
167    /// Support for HealthKit. Available in iOS 8.0 and later.
168    #[serde(rename = "healthkit")]
169    HealthKit,
170
171    /// Performance and capabilities of the A12 Bionic and later chips.
172    /// Available in iOS 12.0 and later.
173    #[serde(rename = "iphone-ipad-minimum-performance-a12")]
174    IPhoneIPadMinimumPerformanceA12,
175
176    /// Access to the device's current location using the Core Location
177    /// framework. This value refers to the general location services feature.
178    /// If you specifically need GPS-level accuracy, also include the gps
179    /// feature. Available in iOS 3.0 and later.
180    #[serde(rename = "location-services")]
181    LocationServices,
182
183    /// Magnetometer hardware. Apps use this hardware to receive heading-related
184    /// events through the Core Location framework. Available in iOS 3.0 and
185    /// later.
186    Magnetometer,
187
188    /// Support for graphics processing with Metal. Available in iOS 8.0 and
189    /// later.
190    Metal,
191
192    /// The built-in microphone or accessories that provide a microphone.
193    /// Available in iOS 3.0 and later.
194    Microphone,
195
196    /// Near Field Communication (NFC) tag detection and access to messages that
197    /// contain NFC Data Exchange Format data. Use the Core NFC framework to
198    /// detect and read NFC tags. Available in iOS 11.0 and later.
199    NFC,
200
201    /// The OpenGL ES 1.1 interface. Available in iOS 3.0 and later.
202    #[serde(rename = "opengles-1")]
203    OpenGLES1,
204
205    /// The OpenGL ES 2.0 interface. Available in iOS 3.0 and later.
206    #[serde(rename = "opengles-2")]
207    OpenGLES2,
208
209    /// The OpenGL ES 3.0 interface. Available in iOS 7.0 and later.
210    #[serde(rename = "opengles-3")]
211    OpenGLES3,
212
213    /// Peer-to-peer connectivity over a Bluetooth network. Available in iOS 3.1
214    /// and later.
215    #[serde(rename = "peer-peer")]
216    PeerPeer,
217
218    /// The Messages app. You might require this feature if your app opens URLs
219    /// with the sms scheme. Available in iOS 3.0 and later.
220    SMS,
221
222    /// A camera on the device. Use the `UIImagePickerController` interface to
223    /// capture images from the device's still camera. Available in iOS 3.0 and
224    /// later.
225    #[serde(rename = "still-camera")]
226    StillCamera,
227
228    /// The Phone app. You might require this feature if your app opens URLs
229    /// with the tel scheme. Available in iOS 3.0 and later.
230    Telephony,
231
232    /// A camera with video capabilities on the device. Use the
233    /// `UIImagePickerController` interface to capture video from the device's
234    /// camera. Available in iOS 3.0 and later.
235    VideoCamera,
236
237    /// Networking features related to Wi-Fi access. Available in iOS 3.0 and
238    /// later.
239    #[serde(rename = "wifi")]
240    WiFi,
241}
242
243/// Represents a interface orientation that the app may support.
244#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)]
245pub enum InterfaceOrientation {
246    /// The device is in portrait mode, with the device upright and the Home
247    /// button on the bottom.
248    #[serde(rename = "UIInterfaceOrientationPortrait")]
249    Portrait,
250
251    /// The device is in portrait mode but is upside down, with the device
252    /// upright and the Home button at the top.
253    #[serde(rename = "UIInterfaceOrientationPortraitUpsideDown")]
254    PortraitUpsideDown,
255
256    /// The device is in landscape mode, with the device upright and the Home
257    /// button on the left.
258    #[serde(rename = "UIInterfaceOrientationLandscapeLeft")]
259    LandscapeLeft,
260
261    /// The device is in landscape mode, with the device upright and the Home
262    /// button on the right.
263    #[serde(rename = "UIInterfaceOrientationLandscapeRight")]
264    LandscapeRight,
265}