72 lines
2.2 KiB
TypeScript
72 lines
2.2 KiB
TypeScript
import type { ConfigContext, ExpoConfig } from "expo/config"
|
|
|
|
export default ({ config }: ConfigContext): ExpoConfig => {
|
|
const variant: string =
|
|
process.env.APP_VARIANT ?? process.env.EAS_BUILD_PROFILE ?? "production"
|
|
if (
|
|
variant !== "development" &&
|
|
variant !== "preview" &&
|
|
variant !== "production"
|
|
) {
|
|
throw new Error(`Unsupported APP_VARIANT: ${variant}`)
|
|
}
|
|
|
|
const suffix = variant === "production" ? "" : `.${variant}`
|
|
const iconSuffix = variant === "production" ? "" : `-${variant}`
|
|
const nameSuffix =
|
|
variant === "development"
|
|
? " (Development)"
|
|
: variant === "preview"
|
|
? " (Preview)"
|
|
: ""
|
|
// Expo writes this filename into Xcode build settings without quoting it.
|
|
const composer = {
|
|
development: "oTunesDev",
|
|
preview: "oTunesPreview",
|
|
production: "oTunes",
|
|
}[variant]
|
|
|
|
const bundleIdentifier = `${config.ios!.bundleIdentifier}${suffix}`
|
|
|
|
return {
|
|
...config,
|
|
plugins: [
|
|
...(config.plugins ?? []),
|
|
[
|
|
"react-native-continued-task",
|
|
{
|
|
// Matches TASK_PREFIX in hooks/use-background-downloads.ts.
|
|
identifierPrefixes: [`${bundleIdentifier}.downloads`],
|
|
},
|
|
],
|
|
...(process.env.MAC_CATALYST === "1"
|
|
? ["./plugins/with-mac-catalyst"]
|
|
: []),
|
|
],
|
|
name: `${config.name}${nameSuffix}`,
|
|
slug: config.slug!,
|
|
scheme: variant === "production" ? "otunes" : `otunes-${variant}`,
|
|
icon: `./assets/icon${iconSuffix}.png`,
|
|
ios: {
|
|
...config.ios,
|
|
bundleIdentifier,
|
|
icon: `./assets/${composer}.icon`,
|
|
infoPlist: {
|
|
...config.ios?.infoPlist,
|
|
// HandoffModule publishes this `.media` type; Catalyst shares this bundle ID.
|
|
NSUserActivityTypes: [`${bundleIdentifier}.media`],
|
|
},
|
|
},
|
|
android: {
|
|
...config.android,
|
|
package: `${config.android!.package}${suffix}`,
|
|
icon: `./assets/android-icon${iconSuffix}.png`,
|
|
adaptiveIcon: {
|
|
monochromeImage: "./assets/android-icon-monochrome.png",
|
|
foregroundImage: `./assets/android-icon-foreground${iconSuffix}.png`,
|
|
backgroundImage: `./assets/android-icon-background${iconSuffix}.png`,
|
|
},
|
|
},
|
|
}
|
|
}
|