feat(smart-app): implement complete mobile app MVP

- App.tsx: full navigation (Auth stack + Main tabs with 5 screens)
- Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen
- HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors
- MapScreen: interactive map with layer toggles (6 layers)
- MarketplaceScreen: categories (6), products (5), search
- ChatScreen: AI chat with quick prompts (4), bot responses
- ProfileScreen: user info, stats, menu (9 items), logout
- AlertsScreen: alert list with severity, acknowledge
- SensorsScreen: sensor list with type filters (6 types), search
- ZonesScreen: zone cards with stats
- SettingsScreen: language picker (FR/EN/ES/DE), privacy, about
- Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n
- Hooks: useSensors, useAlerts, useNotifications, useLocation
- Components: Card, Button, LoadingSpinner, ErrorBoundary, Header
- Services: iotService, notificationService (with axios API client)
- Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN)
- Theme: colors.ts with full design system (Blue Ocean palette)
- Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
This commit is contained in:
Eric FELIXINE
2026-06-01 18:00:35 -04:00
parent 08ca495bde
commit e30ae8ed09
35578 changed files with 3703534 additions and 43 deletions

View File

@@ -0,0 +1,12 @@
import { ModPlatform, StaticPlugin } from '@expo/config-plugins';
import { ExpoConfig } from '@expo/config-types';
/**
* Returns a list of packages that are autolinked to a project.
*
* @param projectRoot
* @param platforms platforms to check for
* @returns list of packages ex: `['expo-camera', 'react-native-screens']`
*/
export declare function getAutolinkedPackagesAsync(projectRoot: string, platforms?: ModPlatform[]): Promise<string[]>;
export declare function resolvePackagesList(platformPaths: Record<string, any>[]): string[];
export declare function shouldSkipAutoPlugin(config: Pick<ExpoConfig, '_internal'>, plugin: StaticPlugin | string): boolean;

View File

@@ -0,0 +1,61 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getAutolinkedPackagesAsync = getAutolinkedPackagesAsync;
exports.resolvePackagesList = resolvePackagesList;
exports.shouldSkipAutoPlugin = shouldSkipAutoPlugin;
function _importExpoModulesAutolinking() {
const data = require("./importExpoModulesAutolinking");
_importExpoModulesAutolinking = function () {
return data;
};
return data;
}
/**
* Returns a list of packages that are autolinked to a project.
*
* @param projectRoot
* @param platforms platforms to check for
* @returns list of packages ex: `['expo-camera', 'react-native-screens']`
*/
async function getAutolinkedPackagesAsync(projectRoot, platforms = ['ios', 'android']) {
const autolinking = (0, _importExpoModulesAutolinking().importExpoModulesAutolinking)(projectRoot);
const searchPaths = await autolinking.resolveSearchPathsAsync(null, projectRoot);
const platformPaths = await Promise.all(platforms.map(platform => autolinking.findModulesAsync({
projectRoot,
platform,
searchPaths,
silent: true
})));
return resolvePackagesList(platformPaths);
}
function resolvePackagesList(platformPaths) {
const allPlatformPaths = platformPaths.map(paths => Object.keys(paths)).flat();
const uniquePaths = [...new Set(allPlatformPaths)];
return uniquePaths.sort();
}
function shouldSkipAutoPlugin(config, plugin) {
// Hack workaround because expo-dev-client doesn't use expo modules.
if (plugin === 'expo-dev-client') {
return false;
}
// Only perform the check if `autolinkedModules` is defined, otherwise we assume
// this is a legacy runner which doesn't support autolinking.
if (Array.isArray(config._internal?.autolinkedModules)) {
// Resolve the pluginId as a string.
const pluginId = Array.isArray(plugin) ? plugin[0] : plugin;
if (typeof pluginId === 'string') {
// Determine if the autolinked modules list includes our moduleId
const isIncluded = config._internal.autolinkedModules.includes(pluginId);
if (!isIncluded) {
// If it doesn't then we know that any potential plugin shouldn't be applied automatically.
return true;
}
}
}
return false;
}
//# sourceMappingURL=getAutolinkedPackages.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getAutolinkedPackages.js","names":["_importExpoModulesAutolinking","data","require","getAutolinkedPackagesAsync","projectRoot","platforms","autolinking","importExpoModulesAutolinking","searchPaths","resolveSearchPathsAsync","platformPaths","Promise","all","map","platform","findModulesAsync","silent","resolvePackagesList","allPlatformPaths","paths","Object","keys","flat","uniquePaths","Set","sort","shouldSkipAutoPlugin","config","plugin","Array","isArray","_internal","autolinkedModules","pluginId","isIncluded","includes"],"sources":["../src/getAutolinkedPackages.ts"],"sourcesContent":["import { ModPlatform, StaticPlugin } from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\n\nimport { importExpoModulesAutolinking } from './importExpoModulesAutolinking';\n\n/**\n * Returns a list of packages that are autolinked to a project.\n *\n * @param projectRoot\n * @param platforms platforms to check for\n * @returns list of packages ex: `['expo-camera', 'react-native-screens']`\n */\nexport async function getAutolinkedPackagesAsync(\n projectRoot: string,\n platforms: ModPlatform[] = ['ios', 'android']\n) {\n const autolinking = importExpoModulesAutolinking(projectRoot);\n const searchPaths = await autolinking.resolveSearchPathsAsync(null, projectRoot);\n\n const platformPaths = await Promise.all(\n platforms.map((platform) =>\n autolinking.findModulesAsync({\n projectRoot,\n platform,\n searchPaths,\n silent: true,\n })\n )\n );\n\n return resolvePackagesList(platformPaths);\n}\n\nexport function resolvePackagesList(platformPaths: Record<string, any>[]) {\n const allPlatformPaths = platformPaths.map((paths) => Object.keys(paths)).flat();\n\n const uniquePaths = [...new Set(allPlatformPaths)];\n\n return uniquePaths.sort();\n}\n\nexport function shouldSkipAutoPlugin(\n config: Pick<ExpoConfig, '_internal'>,\n plugin: StaticPlugin | string\n) {\n // Hack workaround because expo-dev-client doesn't use expo modules.\n if (plugin === 'expo-dev-client') {\n return false;\n }\n\n // Only perform the check if `autolinkedModules` is defined, otherwise we assume\n // this is a legacy runner which doesn't support autolinking.\n if (Array.isArray(config._internal?.autolinkedModules)) {\n // Resolve the pluginId as a string.\n const pluginId = Array.isArray(plugin) ? plugin[0] : plugin;\n if (typeof pluginId === 'string') {\n // Determine if the autolinked modules list includes our moduleId\n const isIncluded = config._internal!.autolinkedModules.includes(pluginId);\n if (!isIncluded) {\n // If it doesn't then we know that any potential plugin shouldn't be applied automatically.\n return true;\n }\n }\n }\n return false;\n}\n"],"mappings":";;;;;;;;AAGA,SAAAA,8BAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,6BAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeE,0BAA0BA,CAC9CC,WAAmB,EACnBC,SAAwB,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,EAC7C;EACA,MAAMC,WAAW,GAAG,IAAAC,4DAA4B,EAACH,WAAW,CAAC;EAC7D,MAAMI,WAAW,GAAG,MAAMF,WAAW,CAACG,uBAAuB,CAAC,IAAI,EAAEL,WAAW,CAAC;EAEhF,MAAMM,aAAa,GAAG,MAAMC,OAAO,CAACC,GAAG,CACrCP,SAAS,CAACQ,GAAG,CAAEC,QAAQ,IACrBR,WAAW,CAACS,gBAAgB,CAAC;IAC3BX,WAAW;IACXU,QAAQ;IACRN,WAAW;IACXQ,MAAM,EAAE;EACV,CAAC,CACH,CACF,CAAC;EAED,OAAOC,mBAAmB,CAACP,aAAa,CAAC;AAC3C;AAEO,SAASO,mBAAmBA,CAACP,aAAoC,EAAE;EACxE,MAAMQ,gBAAgB,GAAGR,aAAa,CAACG,GAAG,CAAEM,KAAK,IAAKC,MAAM,CAACC,IAAI,CAACF,KAAK,CAAC,CAAC,CAACG,IAAI,CAAC,CAAC;EAEhF,MAAMC,WAAW,GAAG,CAAC,GAAG,IAAIC,GAAG,CAACN,gBAAgB,CAAC,CAAC;EAElD,OAAOK,WAAW,CAACE,IAAI,CAAC,CAAC;AAC3B;AAEO,SAASC,oBAAoBA,CAClCC,MAAqC,EACrCC,MAA6B,EAC7B;EACA;EACA,IAAIA,MAAM,KAAK,iBAAiB,EAAE;IAChC,OAAO,KAAK;EACd;;EAEA;EACA;EACA,IAAIC,KAAK,CAACC,OAAO,CAACH,MAAM,CAACI,SAAS,EAAEC,iBAAiB,CAAC,EAAE;IACtD;IACA,MAAMC,QAAQ,GAAGJ,KAAK,CAACC,OAAO,CAACF,MAAM,CAAC,GAAGA,MAAM,CAAC,CAAC,CAAC,GAAGA,MAAM;IAC3D,IAAI,OAAOK,QAAQ,KAAK,QAAQ,EAAE;MAChC;MACA,MAAMC,UAAU,GAAGP,MAAM,CAACI,SAAS,CAAEC,iBAAiB,CAACG,QAAQ,CAACF,QAAQ,CAAC;MACzE,IAAI,CAACC,UAAU,EAAE;QACf;QACA,OAAO,IAAI;MACb;IACF;EACF;EACA,OAAO,KAAK;AACd","ignoreList":[]}

View File

@@ -0,0 +1,7 @@
import { getConfig } from '@expo/config';
import { ModPlatform } from '@expo/config-plugins';
export declare function getPrebuildConfigAsync(projectRoot: string, props: {
bundleIdentifier?: string;
packageName?: string;
platforms: ModPlatform[];
}): Promise<ReturnType<typeof getConfig>>;

View File

@@ -0,0 +1,83 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getPrebuildConfigAsync = getPrebuildConfigAsync;
function _config() {
const data = require("@expo/config");
_config = function () {
return data;
};
return data;
}
function _getAutolinkedPackages() {
const data = require("./getAutolinkedPackages");
_getAutolinkedPackages = function () {
return data;
};
return data;
}
function _withDefaultPlugins() {
const data = require("./plugins/withDefaultPlugins");
_withDefaultPlugins = function () {
return data;
};
return data;
}
async function getPrebuildConfigAsync(projectRoot, props) {
const autolinkedModules = await (0, _getAutolinkedPackages().getAutolinkedPackagesAsync)(projectRoot, props.platforms);
return getPrebuildConfig(projectRoot, {
...props,
autolinkedModules
});
}
function getPrebuildConfig(projectRoot, {
platforms,
bundleIdentifier,
packageName,
autolinkedModules
}) {
// let config: ExpoConfig;
let {
exp: config,
...rest
} = (0, _config().getConfig)(projectRoot, {
skipSDKVersionRequirement: true,
isModdedConfig: true
});
if (autolinkedModules) {
if (!config._internal) {
config._internal = {};
}
config._internal.autolinkedModules = autolinkedModules;
}
// Add all built-in plugins first because they should take
// priority over the unversioned plugins.
config = (0, _withDefaultPlugins().withVersionedExpoSDKPlugins)(config);
config = (0, _withDefaultPlugins().withLegacyExpoPlugins)(config);
if (platforms.includes('ios')) {
if (!config.ios) config.ios = {};
config.ios.bundleIdentifier = bundleIdentifier ?? config.ios.bundleIdentifier ?? `com.placeholder.appid`;
// Add all built-in plugins
config = (0, _withDefaultPlugins().withIosExpoPlugins)(config, {
bundleIdentifier: config.ios.bundleIdentifier
});
}
if (platforms.includes('android')) {
if (!config.android) config.android = {};
config.android.package = packageName ?? config.android.package ?? `com.placeholder.appid`;
// Add all built-in plugins
config = (0, _withDefaultPlugins().withAndroidExpoPlugins)(config, {
package: config.android.package
});
}
return {
exp: config,
...rest
};
}
//# sourceMappingURL=getPrebuildConfig.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getPrebuildConfig.js","names":["_config","data","require","_getAutolinkedPackages","_withDefaultPlugins","getPrebuildConfigAsync","projectRoot","props","autolinkedModules","getAutolinkedPackagesAsync","platforms","getPrebuildConfig","bundleIdentifier","packageName","exp","config","rest","getConfig","skipSDKVersionRequirement","isModdedConfig","_internal","withVersionedExpoSDKPlugins","withLegacyExpoPlugins","includes","ios","withIosExpoPlugins","android","package","withAndroidExpoPlugins"],"sources":["../src/getPrebuildConfig.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\n\nimport { getAutolinkedPackagesAsync } from './getAutolinkedPackages';\nimport {\n withAndroidExpoPlugins,\n withIosExpoPlugins,\n withLegacyExpoPlugins,\n withVersionedExpoSDKPlugins,\n} from './plugins/withDefaultPlugins';\n\nexport async function getPrebuildConfigAsync(\n projectRoot: string,\n props: {\n bundleIdentifier?: string;\n packageName?: string;\n platforms: ModPlatform[];\n }\n): Promise<ReturnType<typeof getConfig>> {\n const autolinkedModules = await getAutolinkedPackagesAsync(projectRoot, props.platforms);\n\n return getPrebuildConfig(projectRoot, {\n ...props,\n autolinkedModules,\n });\n}\n\nfunction getPrebuildConfig(\n projectRoot: string,\n {\n platforms,\n bundleIdentifier,\n packageName,\n autolinkedModules,\n }: {\n bundleIdentifier?: string;\n packageName?: string;\n platforms: ModPlatform[];\n autolinkedModules?: string[];\n }\n) {\n // let config: ExpoConfig;\n let { exp: config, ...rest } = getConfig(projectRoot, {\n skipSDKVersionRequirement: true,\n isModdedConfig: true,\n });\n\n if (autolinkedModules) {\n if (!config._internal) {\n config._internal = {};\n }\n config._internal.autolinkedModules = autolinkedModules;\n }\n\n // Add all built-in plugins first because they should take\n // priority over the unversioned plugins.\n config = withVersionedExpoSDKPlugins(config);\n config = withLegacyExpoPlugins(config);\n\n if (platforms.includes('ios')) {\n if (!config.ios) config.ios = {};\n config.ios.bundleIdentifier =\n bundleIdentifier ?? config.ios.bundleIdentifier ?? `com.placeholder.appid`;\n\n // Add all built-in plugins\n config = withIosExpoPlugins(config, {\n bundleIdentifier: config.ios.bundleIdentifier,\n });\n }\n\n if (platforms.includes('android')) {\n if (!config.android) config.android = {};\n config.android.package = packageName ?? config.android.package ?? `com.placeholder.appid`;\n\n // Add all built-in plugins\n config = withAndroidExpoPlugins(config, {\n package: config.android.package,\n });\n }\n\n return { exp: config, ...rest };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,uBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,sBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,oBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,mBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOO,eAAeI,sBAAsBA,CAC1CC,WAAmB,EACnBC,KAIC,EACsC;EACvC,MAAMC,iBAAiB,GAAG,MAAM,IAAAC,mDAA0B,EAACH,WAAW,EAAEC,KAAK,CAACG,SAAS,CAAC;EAExF,OAAOC,iBAAiB,CAACL,WAAW,EAAE;IACpC,GAAGC,KAAK;IACRC;EACF,CAAC,CAAC;AACJ;AAEA,SAASG,iBAAiBA,CACxBL,WAAmB,EACnB;EACEI,SAAS;EACTE,gBAAgB;EAChBC,WAAW;EACXL;AAMF,CAAC,EACD;EACA;EACA,IAAI;IAAEM,GAAG,EAAEC,MAAM;IAAE,GAAGC;EAAK,CAAC,GAAG,IAAAC,mBAAS,EAACX,WAAW,EAAE;IACpDY,yBAAyB,EAAE,IAAI;IAC/BC,cAAc,EAAE;EAClB,CAAC,CAAC;EAEF,IAAIX,iBAAiB,EAAE;IACrB,IAAI,CAACO,MAAM,CAACK,SAAS,EAAE;MACrBL,MAAM,CAACK,SAAS,GAAG,CAAC,CAAC;IACvB;IACAL,MAAM,CAACK,SAAS,CAACZ,iBAAiB,GAAGA,iBAAiB;EACxD;;EAEA;EACA;EACAO,MAAM,GAAG,IAAAM,iDAA2B,EAACN,MAAM,CAAC;EAC5CA,MAAM,GAAG,IAAAO,2CAAqB,EAACP,MAAM,CAAC;EAEtC,IAAIL,SAAS,CAACa,QAAQ,CAAC,KAAK,CAAC,EAAE;IAC7B,IAAI,CAACR,MAAM,CAACS,GAAG,EAAET,MAAM,CAACS,GAAG,GAAG,CAAC,CAAC;IAChCT,MAAM,CAACS,GAAG,CAACZ,gBAAgB,GACzBA,gBAAgB,IAAIG,MAAM,CAACS,GAAG,CAACZ,gBAAgB,IAAI,uBAAuB;;IAE5E;IACAG,MAAM,GAAG,IAAAU,wCAAkB,EAACV,MAAM,EAAE;MAClCH,gBAAgB,EAAEG,MAAM,CAACS,GAAG,CAACZ;IAC/B,CAAC,CAAC;EACJ;EAEA,IAAIF,SAAS,CAACa,QAAQ,CAAC,SAAS,CAAC,EAAE;IACjC,IAAI,CAACR,MAAM,CAACW,OAAO,EAAEX,MAAM,CAACW,OAAO,GAAG,CAAC,CAAC;IACxCX,MAAM,CAACW,OAAO,CAACC,OAAO,GAAGd,WAAW,IAAIE,MAAM,CAACW,OAAO,CAACC,OAAO,IAAI,uBAAuB;;IAEzF;IACAZ,MAAM,GAAG,IAAAa,4CAAsB,EAACb,MAAM,EAAE;MACtCY,OAAO,EAAEZ,MAAM,CAACW,OAAO,CAACC;IAC1B,CAAC,CAAC;EACJ;EAEA,OAAO;IAAEb,GAAG,EAAEC,MAAM;IAAE,GAAGC;EAAK,CAAC;AACjC","ignoreList":[]}

View File

@@ -0,0 +1,14 @@
export type SearchResults = {
[moduleName: string]: object;
};
export type SearchOptions = {
searchPaths: string[];
platform: 'ios' | 'android' | 'web';
silent?: boolean;
};
type AutolinkingModule = typeof import('expo-modules-autolinking/exports');
/**
* Imports the `expo-modules-autolinking` package installed in the project at the given path.
*/
export declare function importExpoModulesAutolinking(projectRoot: string): AutolinkingModule;
export {};

View File

@@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.importExpoModulesAutolinking = importExpoModulesAutolinking;
/**
* Imports the `expo-modules-autolinking` package installed in the project at the given path.
*/
function importExpoModulesAutolinking(projectRoot) {
const autolinking = tryRequireExpoModulesAutolinking(projectRoot);
assertAutolinkingCompatibility(autolinking);
return autolinking;
}
function tryRequireExpoModulesAutolinking(projectRoot) {
let resolvedAutolinkingPath;
const resolveOptions = {
paths: [projectRoot]
};
try {
resolvedAutolinkingPath = require.resolve('expo-modules-autolinking/exports', resolveOptions);
} catch {}
// Fallback to the older version of expo-modules-autolinking
try {
resolvedAutolinkingPath = require.resolve('expo-modules-autolinking/build/autolinking', resolveOptions);
} catch {}
if (!resolvedAutolinkingPath) {
throw new Error("Cannot find 'expo-modules-autolinking' package in your project, make sure that you have 'expo' package installed");
}
return require(resolvedAutolinkingPath);
}
function assertAutolinkingCompatibility(autolinking) {
if ('resolveSearchPathsAsync' in autolinking && 'findModulesAsync' in autolinking) {
return;
}
throw new Error("The 'expo-modules-autolinking' package has been found, but it seems to be incompatible with '@expo/prebuild-config'");
}
//# sourceMappingURL=importExpoModulesAutolinking.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"importExpoModulesAutolinking.js","names":["importExpoModulesAutolinking","projectRoot","autolinking","tryRequireExpoModulesAutolinking","assertAutolinkingCompatibility","resolvedAutolinkingPath","resolveOptions","paths","require","resolve","Error"],"sources":["../src/importExpoModulesAutolinking.ts"],"sourcesContent":["export type SearchResults = {\n [moduleName: string]: object;\n};\n\nexport type SearchOptions = {\n searchPaths: string[];\n platform: 'ios' | 'android' | 'web';\n silent?: boolean;\n};\n\ntype AutolinkingModule = typeof import('expo-modules-autolinking/exports');\n\n/**\n * Imports the `expo-modules-autolinking` package installed in the project at the given path.\n */\nexport function importExpoModulesAutolinking(projectRoot: string): AutolinkingModule {\n const autolinking = tryRequireExpoModulesAutolinking(projectRoot);\n assertAutolinkingCompatibility(autolinking);\n return autolinking;\n}\n\nfunction tryRequireExpoModulesAutolinking(projectRoot: string): AutolinkingModule {\n let resolvedAutolinkingPath;\n const resolveOptions = { paths: [projectRoot] };\n\n try {\n resolvedAutolinkingPath = require.resolve('expo-modules-autolinking/exports', resolveOptions);\n } catch {}\n // Fallback to the older version of expo-modules-autolinking\n try {\n resolvedAutolinkingPath = require.resolve(\n 'expo-modules-autolinking/build/autolinking',\n resolveOptions\n );\n } catch {}\n\n if (!resolvedAutolinkingPath) {\n throw new Error(\n \"Cannot find 'expo-modules-autolinking' package in your project, make sure that you have 'expo' package installed\"\n );\n }\n return require(resolvedAutolinkingPath);\n}\n\nfunction assertAutolinkingCompatibility(autolinking: AutolinkingModule): void {\n if ('resolveSearchPathsAsync' in autolinking && 'findModulesAsync' in autolinking) {\n return;\n }\n throw new Error(\n \"The 'expo-modules-autolinking' package has been found, but it seems to be incompatible with '@expo/prebuild-config'\"\n );\n}\n"],"mappings":";;;;;;AAYA;AACA;AACA;AACO,SAASA,4BAA4BA,CAACC,WAAmB,EAAqB;EACnF,MAAMC,WAAW,GAAGC,gCAAgC,CAACF,WAAW,CAAC;EACjEG,8BAA8B,CAACF,WAAW,CAAC;EAC3C,OAAOA,WAAW;AACpB;AAEA,SAASC,gCAAgCA,CAACF,WAAmB,EAAqB;EAChF,IAAII,uBAAuB;EAC3B,MAAMC,cAAc,GAAG;IAAEC,KAAK,EAAE,CAACN,WAAW;EAAE,CAAC;EAE/C,IAAI;IACFI,uBAAuB,GAAGG,OAAO,CAACC,OAAO,CAAC,kCAAkC,EAAEH,cAAc,CAAC;EAC/F,CAAC,CAAC,MAAM,CAAC;EACT;EACA,IAAI;IACFD,uBAAuB,GAAGG,OAAO,CAACC,OAAO,CACvC,4CAA4C,EAC5CH,cACF,CAAC;EACH,CAAC,CAAC,MAAM,CAAC;EAET,IAAI,CAACD,uBAAuB,EAAE;IAC5B,MAAM,IAAIK,KAAK,CACb,kHACF,CAAC;EACH;EACA,OAAOF,OAAO,CAACH,uBAAuB,CAAC;AACzC;AAEA,SAASD,8BAA8BA,CAACF,WAA8B,EAAQ;EAC5E,IAAI,yBAAyB,IAAIA,WAAW,IAAI,kBAAkB,IAAIA,WAAW,EAAE;IACjF;EACF;EACA,MAAM,IAAIQ,KAAK,CACb,qHACF,CAAC;AACH","ignoreList":[]}

View File

@@ -0,0 +1,2 @@
export { getPrebuildConfigAsync } from './getPrebuildConfig';
export * from './plugins/withDefaultPlugins';

View File

@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {
getPrebuildConfigAsync: true
};
Object.defineProperty(exports, "getPrebuildConfigAsync", {
enumerable: true,
get: function () {
return _getPrebuildConfig().getPrebuildConfigAsync;
}
});
function _getPrebuildConfig() {
const data = require("./getPrebuildConfig");
_getPrebuildConfig = function () {
return data;
};
return data;
}
var _withDefaultPlugins = require("./plugins/withDefaultPlugins");
Object.keys(_withDefaultPlugins).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _withDefaultPlugins[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _withDefaultPlugins[key];
}
});
});
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","names":["_getPrebuildConfig","data","require","_withDefaultPlugins","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get"],"sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable import/export */\n\nexport { getPrebuildConfigAsync } from './getPrebuildConfig';\nexport * from './plugins/withDefaultPlugins';\n"],"mappings":";;;;;;;;;;;;;;AAEA,SAAAA,mBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,kBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,IAAAE,mBAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,mBAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,mBAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,mBAAA,CAAAI,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}

View File

@@ -0,0 +1,29 @@
export type ContentsJsonImageIdiom = 'iphone' | 'ipad' | 'watchos' | 'ios' | 'ios-marketing' | 'universal';
export type ContentsJsonImageAppearance = {
appearance: 'luminosity';
value: 'dark';
};
export type ContentsJsonImageScale = '1x' | '2x' | '3x';
export interface ContentsJsonImage {
appearances?: ContentsJsonImageAppearance[];
idiom: ContentsJsonImageIdiom;
size?: string;
scale?: ContentsJsonImageScale;
filename?: string;
platform?: ContentsJsonImageIdiom;
}
export interface ContentsJson {
images: ContentsJsonImage[];
info: {
version: number;
author: string;
};
}
export declare function createContentsJsonItem(item: ContentsJsonImage): ContentsJsonImage;
/**
* Writes the Config.json which is used to assign images to their respective platform, dpi, and idiom.
*
* @param directory path to add the Contents.json to.
* @param contents image json data
*/
export declare function writeContentsJsonAsync(directory: string, { images }: Pick<ContentsJson, 'images'>): Promise<void>;

View File

@@ -0,0 +1,46 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createContentsJsonItem = createContentsJsonItem;
exports.writeContentsJsonAsync = writeContentsJsonAsync;
function _fsExtra() {
const data = _interopRequireDefault(require("fs-extra"));
_fsExtra = function () {
return data;
};
return data;
}
function _path() {
const data = require("path");
_path = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function createContentsJsonItem(item) {
return item;
}
/**
* Writes the Config.json which is used to assign images to their respective platform, dpi, and idiom.
*
* @param directory path to add the Contents.json to.
* @param contents image json data
*/
async function writeContentsJsonAsync(directory, {
images
}) {
await _fsExtra().default.ensureDir(directory);
await _fsExtra().default.writeFile((0, _path().join)(directory, 'Contents.json'), JSON.stringify({
images,
info: {
version: 1,
// common practice is for the tool that generated the icons to be the "author"
author: 'expo'
}
}, null, 2));
}
//# sourceMappingURL=AssetContents.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AssetContents.js","names":["_fsExtra","data","_interopRequireDefault","require","_path","obj","__esModule","default","createContentsJsonItem","item","writeContentsJsonAsync","directory","images","fs","ensureDir","writeFile","join","JSON","stringify","info","version","author"],"sources":["../../../src/plugins/icons/AssetContents.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport { join } from 'path';\n\nexport type ContentsJsonImageIdiom =\n | 'iphone'\n | 'ipad'\n | 'watchos'\n | 'ios'\n | 'ios-marketing'\n | 'universal';\n\nexport type ContentsJsonImageAppearance = {\n appearance: 'luminosity';\n value: 'dark';\n};\n\nexport type ContentsJsonImageScale = '1x' | '2x' | '3x';\n\nexport interface ContentsJsonImage {\n appearances?: ContentsJsonImageAppearance[];\n idiom: ContentsJsonImageIdiom;\n size?: string;\n scale?: ContentsJsonImageScale;\n filename?: string;\n platform?: ContentsJsonImageIdiom;\n}\n\nexport interface ContentsJson {\n images: ContentsJsonImage[];\n info: {\n version: number;\n author: string;\n };\n}\n\nexport function createContentsJsonItem(item: ContentsJsonImage): ContentsJsonImage {\n return item;\n}\n\n/**\n * Writes the Config.json which is used to assign images to their respective platform, dpi, and idiom.\n *\n * @param directory path to add the Contents.json to.\n * @param contents image json data\n */\nexport async function writeContentsJsonAsync(\n directory: string,\n { images }: Pick<ContentsJson, 'images'>\n): Promise<void> {\n await fs.ensureDir(directory);\n\n await fs.writeFile(\n join(directory, 'Contents.json'),\n JSON.stringify(\n {\n images,\n info: {\n version: 1,\n // common practice is for the tool that generated the icons to be the \"author\"\n author: 'expo',\n },\n },\n null,\n 2\n )\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA4B,SAAAC,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAkCrB,SAASG,sBAAsBA,CAACC,IAAuB,EAAqB;EACjF,OAAOA,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,sBAAsBA,CAC1CC,SAAiB,EACjB;EAAEC;AAAqC,CAAC,EACzB;EACf,MAAMC,kBAAE,CAACC,SAAS,CAACH,SAAS,CAAC;EAE7B,MAAME,kBAAE,CAACE,SAAS,CAChB,IAAAC,YAAI,EAACL,SAAS,EAAE,eAAe,CAAC,EAChCM,IAAI,CAACC,SAAS,CACZ;IACEN,MAAM;IACNO,IAAI,EAAE;MACJC,OAAO,EAAE,CAAC;MACV;MACAC,MAAM,EAAE;IACV;EACF,CAAC,EACD,IAAI,EACJ,CACF,CACF,CAAC;AACH","ignoreList":[]}

View File

@@ -0,0 +1,39 @@
import { AndroidConfig, ConfigPlugin } from '@expo/config-plugins';
import { ExpoConfig } from '@expo/config-types';
type DPIString = 'mdpi' | 'hdpi' | 'xhdpi' | 'xxhdpi' | 'xxxhdpi';
type dpiMap = Record<DPIString, {
folderName: string;
scale: number;
}>;
export declare const dpiValues: dpiMap;
export declare const ANDROID_RES_PATH = "android/app/src/main/res/";
export declare const withAndroidIcons: ConfigPlugin;
export declare function setRoundIconManifest(config: Pick<ExpoConfig, 'android'>, manifest: AndroidConfig.Manifest.AndroidManifest): AndroidConfig.Manifest.AndroidManifest;
export declare function getIcon(config: ExpoConfig): string | null;
export declare function getAdaptiveIcon(config: ExpoConfig): {
foregroundImage: string | null;
backgroundColor: string | null;
backgroundImage: string | null;
monochromeImage: string | null;
};
/**
* Resizes the user-provided icon to create a set of legacy icon files in
* their respective "mipmap" directories for <= Android 7, and creates a set of adaptive
* icon files for > Android 7 from the adaptive icon files (if provided).
*/
export declare function setIconAsync(projectRoot: string, { icon, backgroundColor, backgroundImage, monochromeImage, isAdaptive, }: {
icon: string | null;
backgroundColor: string | null;
backgroundImage: string | null;
monochromeImage: string | null;
isAdaptive: boolean;
}): Promise<true | null>;
/**
* Configures adaptive icon files to be used on Android 8 and up. A foreground image must be provided,
* and will have a transparent background unless:
* - A backgroundImage is provided, or
* - A backgroundColor was specified
*/
export declare function configureAdaptiveIconAsync(projectRoot: string, foregroundImage: string, backgroundImage: string | null, monochromeImage: string | null, isAdaptive: boolean): Promise<void>;
export declare const createAdaptiveIconXmlString: (backgroundImage: string | null, monochromeImage: string | null) => string;
export {};

View File

@@ -0,0 +1,356 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ANDROID_RES_PATH = void 0;
exports.configureAdaptiveIconAsync = configureAdaptiveIconAsync;
exports.dpiValues = exports.createAdaptiveIconXmlString = void 0;
exports.getAdaptiveIcon = getAdaptiveIcon;
exports.getIcon = getIcon;
exports.setIconAsync = setIconAsync;
exports.setRoundIconManifest = setRoundIconManifest;
exports.withAndroidIcons = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
function _imageUtils() {
const data = require("@expo/image-utils");
_imageUtils = function () {
return data;
};
return data;
}
function _fsExtra() {
const data = _interopRequireDefault(require("fs-extra"));
_fsExtra = function () {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _withAndroidManifestIcons() {
const data = require("./withAndroidManifestIcons");
_withAndroidManifestIcons = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const {
Colors
} = _configPlugins().AndroidConfig;
const dpiValues = exports.dpiValues = {
mdpi: {
folderName: 'mipmap-mdpi',
scale: 1
},
hdpi: {
folderName: 'mipmap-hdpi',
scale: 1.5
},
xhdpi: {
folderName: 'mipmap-xhdpi',
scale: 2
},
xxhdpi: {
folderName: 'mipmap-xxhdpi',
scale: 3
},
xxxhdpi: {
folderName: 'mipmap-xxxhdpi',
scale: 4
}
};
const BASELINE_PIXEL_SIZE = 108;
const ANDROID_RES_PATH = exports.ANDROID_RES_PATH = 'android/app/src/main/res/';
const MIPMAP_ANYDPI_V26 = 'mipmap-anydpi-v26';
const ICON_BACKGROUND = 'iconBackground';
const IC_LAUNCHER_PNG = 'ic_launcher.png';
const IC_LAUNCHER_ROUND_PNG = 'ic_launcher_round.png';
const IC_LAUNCHER_BACKGROUND_PNG = 'ic_launcher_background.png';
const IC_LAUNCHER_FOREGROUND_PNG = 'ic_launcher_foreground.png';
const IC_LAUNCHER_MONOCHROME_PNG = 'ic_launcher_monochrome.png';
const IC_LAUNCHER_XML = 'ic_launcher.xml';
const IC_LAUNCHER_ROUND_XML = 'ic_launcher_round.xml';
const withAndroidIcons = config => {
const {
foregroundImage,
backgroundColor,
backgroundImage,
monochromeImage
} = getAdaptiveIcon(config);
const icon = foregroundImage ?? getIcon(config);
if (!icon) {
return config;
}
config = (0, _withAndroidManifestIcons().withAndroidManifestIcons)(config);
// Apply colors.xml changes
config = withAndroidAdaptiveIconColors(config, backgroundColor);
return (0, _configPlugins().withDangerousMod)(config, ['android', async config => {
await setIconAsync(config.modRequest.projectRoot, {
icon,
backgroundColor,
backgroundImage,
monochromeImage,
isAdaptive: !!config.android?.adaptiveIcon
});
return config;
}]);
};
exports.withAndroidIcons = withAndroidIcons;
function setRoundIconManifest(config, manifest) {
const isAdaptive = !!config.android?.adaptiveIcon;
const application = _configPlugins().AndroidConfig.Manifest.getMainApplicationOrThrow(manifest);
if (isAdaptive) {
application.$['android:roundIcon'] = '@mipmap/ic_launcher_round';
} else {
delete application.$['android:roundIcon'];
}
return manifest;
}
const withAndroidAdaptiveIconColors = (config, backgroundColor) => {
return (0, _configPlugins().withAndroidColors)(config, config => {
config.modResults = setBackgroundColor(backgroundColor ?? '#FFFFFF', config.modResults);
return config;
});
};
function getIcon(config) {
return config.android?.icon || config.icon || null;
}
function getAdaptiveIcon(config) {
return {
foregroundImage: config.android?.adaptiveIcon?.foregroundImage ?? null,
backgroundColor: config.android?.adaptiveIcon?.backgroundColor ?? null,
backgroundImage: config.android?.adaptiveIcon?.backgroundImage ?? null,
monochromeImage: config.android?.adaptiveIcon?.monochromeImage ?? null
};
}
/**
* Resizes the user-provided icon to create a set of legacy icon files in
* their respective "mipmap" directories for <= Android 7, and creates a set of adaptive
* icon files for > Android 7 from the adaptive icon files (if provided).
*/
async function setIconAsync(projectRoot, {
icon,
backgroundColor,
backgroundImage,
monochromeImage,
isAdaptive
}) {
if (!icon) {
return null;
}
await configureLegacyIconAsync(projectRoot, icon, backgroundImage, backgroundColor);
if (isAdaptive) {
await generateRoundIconAsync(projectRoot, icon, backgroundImage, backgroundColor);
} else {
await deleteIconNamedAsync(projectRoot, IC_LAUNCHER_ROUND_PNG);
}
await configureAdaptiveIconAsync(projectRoot, icon, backgroundImage, monochromeImage, isAdaptive);
return true;
}
/**
* Configures legacy icon files to be used on Android 7 and earlier. If adaptive icon configuration
* was provided, we create a pseudo-adaptive icon by layering the provided files (or background
* color if no backgroundImage is provided. If no backgroundImage and no backgroundColor are provided,
* the background is set to transparent.)
*/
async function configureLegacyIconAsync(projectRoot, icon, backgroundImage, backgroundColor) {
return generateMultiLayerImageAsync(projectRoot, {
icon,
backgroundImage,
backgroundColor,
outputImageFileName: IC_LAUNCHER_PNG,
imageCacheFolder: 'android-standard-square',
backgroundImageCacheFolder: 'android-standard-square-background'
});
}
async function generateRoundIconAsync(projectRoot, icon, backgroundImage, backgroundColor) {
return generateMultiLayerImageAsync(projectRoot, {
icon,
borderRadiusRatio: 0.5,
outputImageFileName: IC_LAUNCHER_ROUND_PNG,
backgroundImage,
backgroundColor,
imageCacheFolder: 'android-standard-circle',
backgroundImageCacheFolder: 'android-standard-round-background'
});
}
/**
* Configures adaptive icon files to be used on Android 8 and up. A foreground image must be provided,
* and will have a transparent background unless:
* - A backgroundImage is provided, or
* - A backgroundColor was specified
*/
async function configureAdaptiveIconAsync(projectRoot, foregroundImage, backgroundImage, monochromeImage, isAdaptive) {
if (monochromeImage) {
await generateMonochromeImageAsync(projectRoot, {
icon: monochromeImage,
imageCacheFolder: 'android-adaptive-monochrome',
outputImageFileName: IC_LAUNCHER_MONOCHROME_PNG
});
}
await generateMultiLayerImageAsync(projectRoot, {
backgroundColor: 'transparent',
backgroundImage,
backgroundImageCacheFolder: 'android-adaptive-background',
outputImageFileName: IC_LAUNCHER_FOREGROUND_PNG,
icon: foregroundImage,
imageCacheFolder: 'android-adaptive-foreground',
backgroundImageFileName: IC_LAUNCHER_BACKGROUND_PNG
});
// create ic_launcher.xml and ic_launcher_round.xml
const icLauncherXmlString = createAdaptiveIconXmlString(backgroundImage, monochromeImage);
await createAdaptiveIconXmlFiles(projectRoot, icLauncherXmlString,
// If the user only defined icon and not android.adaptiveIcon, then skip enabling the layering system
// this will scale the image down and present it uncropped.
isAdaptive);
}
function setBackgroundColor(backgroundColor, colors) {
return Colors.assignColorValue(colors, {
value: backgroundColor,
name: ICON_BACKGROUND
});
}
const createAdaptiveIconXmlString = (backgroundImage, monochromeImage) => {
const background = backgroundImage ? `@mipmap/ic_launcher_background` : `@color/iconBackground`;
const iconElements = [`<background android:drawable="${background}"/>`, '<foreground android:drawable="@mipmap/ic_launcher_foreground"/>'];
if (monochromeImage) {
iconElements.push('<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>');
}
return `<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
${iconElements.join('\n ')}
</adaptive-icon>`;
};
exports.createAdaptiveIconXmlString = createAdaptiveIconXmlString;
async function createAdaptiveIconXmlFiles(projectRoot, icLauncherXmlString, add) {
const anyDpiV26Directory = _path().default.resolve(projectRoot, ANDROID_RES_PATH, MIPMAP_ANYDPI_V26);
await _fsExtra().default.ensureDir(anyDpiV26Directory);
const launcherPath = _path().default.resolve(anyDpiV26Directory, IC_LAUNCHER_XML);
const launcherRoundPath = _path().default.resolve(anyDpiV26Directory, IC_LAUNCHER_ROUND_XML);
if (add) {
await Promise.all([_fsExtra().default.writeFile(launcherPath, icLauncherXmlString), _fsExtra().default.writeFile(launcherRoundPath, icLauncherXmlString)]);
} else {
// Remove the xml if the icon switches from adaptive to standard.
await Promise.all([launcherPath, launcherRoundPath].map(async path => {
if (_fsExtra().default.existsSync(path)) {
return _fsExtra().default.remove(path);
}
}));
}
}
async function generateMultiLayerImageAsync(projectRoot, {
icon,
backgroundColor,
backgroundImage,
imageCacheFolder,
backgroundImageCacheFolder,
borderRadiusRatio,
outputImageFileName,
backgroundImageFileName
}) {
await iterateDpiValues(projectRoot, async ({
dpiFolder,
scale
}) => {
let iconLayer = await generateIconAsync(projectRoot, {
cacheType: imageCacheFolder,
src: icon,
scale,
// backgroundImage overrides backgroundColor
backgroundColor: backgroundImage ? 'transparent' : backgroundColor ?? 'transparent',
borderRadiusRatio
});
if (backgroundImage) {
const backgroundLayer = await generateIconAsync(projectRoot, {
cacheType: backgroundImageCacheFolder,
src: backgroundImage,
scale,
backgroundColor: 'transparent',
borderRadiusRatio
});
if (backgroundImageFileName) {
await _fsExtra().default.writeFile(_path().default.resolve(dpiFolder, backgroundImageFileName), backgroundLayer);
} else {
iconLayer = await (0, _imageUtils().compositeImagesAsync)({
foreground: iconLayer,
background: backgroundLayer
});
}
} else if (backgroundImageFileName) {
// Remove any instances of ic_launcher_background.png that are there from previous icons
await deleteIconNamedAsync(projectRoot, backgroundImageFileName);
}
await _fsExtra().default.ensureDir(dpiFolder);
await _fsExtra().default.writeFile(_path().default.resolve(dpiFolder, outputImageFileName), iconLayer);
});
}
async function generateMonochromeImageAsync(projectRoot, {
icon,
imageCacheFolder,
outputImageFileName
}) {
await iterateDpiValues(projectRoot, async ({
dpiFolder,
scale
}) => {
const monochromeIcon = await generateIconAsync(projectRoot, {
cacheType: imageCacheFolder,
src: icon,
scale,
backgroundColor: 'transparent'
});
await _fsExtra().default.ensureDir(dpiFolder);
await _fsExtra().default.writeFile(_path().default.resolve(dpiFolder, outputImageFileName), monochromeIcon);
});
}
function iterateDpiValues(projectRoot, callback) {
return Promise.all(Object.values(dpiValues).map(value => callback({
dpiFolder: _path().default.resolve(projectRoot, ANDROID_RES_PATH, value.folderName),
...value
})));
}
async function deleteIconNamedAsync(projectRoot, name) {
return iterateDpiValues(projectRoot, ({
dpiFolder
}) => {
return _fsExtra().default.remove(_path().default.resolve(dpiFolder, name));
});
}
async function generateIconAsync(projectRoot, {
cacheType,
src,
scale,
backgroundColor,
borderRadiusRatio
}) {
const iconSizePx = BASELINE_PIXEL_SIZE * scale;
return (await (0, _imageUtils().generateImageAsync)({
projectRoot,
cacheType
}, {
src,
width: iconSizePx,
height: iconSizePx,
resizeMode: 'cover',
backgroundColor,
borderRadius: borderRadiusRatio ? iconSizePx * borderRadiusRatio : undefined
})).source;
}
//# sourceMappingURL=withAndroidIcons.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
import { AndroidConfig, ConfigPlugin } from '@expo/config-plugins';
import { ExpoConfig } from '@expo/config-types';
export declare const withAndroidManifestIcons: ConfigPlugin;
export declare function setRoundIconManifest(config: Pick<ExpoConfig, 'android'>, manifest: AndroidConfig.Manifest.AndroidManifest): AndroidConfig.Manifest.AndroidManifest;

View File

@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.setRoundIconManifest = setRoundIconManifest;
exports.withAndroidManifestIcons = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
const withAndroidManifestIcons = config => (0, _configPlugins().withAndroidManifest)(config, config => {
config.modResults = setRoundIconManifest(config, config.modResults);
return config;
});
exports.withAndroidManifestIcons = withAndroidManifestIcons;
function setRoundIconManifest(config, manifest) {
const isAdaptive = !!config.android?.adaptiveIcon;
const application = _configPlugins().AndroidConfig.Manifest.getMainApplicationOrThrow(manifest);
if (isAdaptive) {
application.$['android:roundIcon'] = '@mipmap/ic_launcher_round';
} else {
delete application.$['android:roundIcon'];
}
return manifest;
}
//# sourceMappingURL=withAndroidManifestIcons.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"withAndroidManifestIcons.js","names":["_configPlugins","data","require","withAndroidManifestIcons","config","withAndroidManifest","modResults","setRoundIconManifest","exports","manifest","isAdaptive","android","adaptiveIcon","application","AndroidConfig","Manifest","getMainApplicationOrThrow","$"],"sources":["../../../src/plugins/icons/withAndroidManifestIcons.ts"],"sourcesContent":["import { AndroidConfig, ConfigPlugin, withAndroidManifest } from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\n\nexport const withAndroidManifestIcons: ConfigPlugin = (config) =>\n withAndroidManifest(config, (config) => {\n config.modResults = setRoundIconManifest(config, config.modResults);\n return config;\n });\n\nexport function setRoundIconManifest(\n config: Pick<ExpoConfig, 'android'>,\n manifest: AndroidConfig.Manifest.AndroidManifest\n): AndroidConfig.Manifest.AndroidManifest {\n const isAdaptive = !!config.android?.adaptiveIcon;\n const application = AndroidConfig.Manifest.getMainApplicationOrThrow(manifest);\n\n if (isAdaptive) {\n application.$['android:roundIcon'] = '@mipmap/ic_launcher_round';\n } else {\n delete application.$['android:roundIcon'];\n }\n return manifest;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGO,MAAME,wBAAsC,GAAIC,MAAM,IAC3D,IAAAC,oCAAmB,EAACD,MAAM,EAAGA,MAAM,IAAK;EACtCA,MAAM,CAACE,UAAU,GAAGC,oBAAoB,CAACH,MAAM,EAAEA,MAAM,CAACE,UAAU,CAAC;EACnE,OAAOF,MAAM;AACf,CAAC,CAAC;AAACI,OAAA,CAAAL,wBAAA,GAAAA,wBAAA;AAEE,SAASI,oBAAoBA,CAClCH,MAAmC,EACnCK,QAAgD,EACR;EACxC,MAAMC,UAAU,GAAG,CAAC,CAACN,MAAM,CAACO,OAAO,EAAEC,YAAY;EACjD,MAAMC,WAAW,GAAGC,8BAAa,CAACC,QAAQ,CAACC,yBAAyB,CAACP,QAAQ,CAAC;EAE9E,IAAIC,UAAU,EAAE;IACdG,WAAW,CAACI,CAAC,CAAC,mBAAmB,CAAC,GAAG,2BAA2B;EAClE,CAAC,MAAM;IACL,OAAOJ,WAAW,CAACI,CAAC,CAAC,mBAAmB,CAAC;EAC3C;EACA,OAAOR,QAAQ;AACjB","ignoreList":[]}

View File

@@ -0,0 +1,12 @@
import { ConfigPlugin } from '@expo/config-plugins';
import { ExpoConfig } from '@expo/config-types';
import { ContentsJson } from './AssetContents';
export declare const withIosIcons: ConfigPlugin;
export declare function getIcons(config: Pick<ExpoConfig, 'icon' | 'ios'>): string | null;
export declare function setIconsAsync(config: ExpoConfig, projectRoot: string): Promise<void>;
export declare function generateUniversalIconAsync(projectRoot: string, { icon, cacheKey, iosNamedProjectRoot, platform, }: {
platform: 'watchos' | 'ios';
icon?: string | null;
iosNamedProjectRoot: string;
cacheKey: string;
}): Promise<ContentsJson['images']>;

View File

@@ -0,0 +1,143 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.generateUniversalIconAsync = generateUniversalIconAsync;
exports.getIcons = getIcons;
exports.setIconsAsync = setIconsAsync;
exports.withIosIcons = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
function _imageUtils() {
const data = require("@expo/image-utils");
_imageUtils = function () {
return data;
};
return data;
}
function fs() {
const data = _interopRequireWildcard(require("fs-extra"));
fs = function () {
return data;
};
return data;
}
function _path() {
const data = require("path");
_path = function () {
return data;
};
return data;
}
function _AssetContents() {
const data = require("./AssetContents");
_AssetContents = function () {
return data;
};
return data;
}
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
const {
getProjectName
} = _configPlugins().IOSConfig.XcodeUtils;
const IMAGE_CACHE_NAME = 'icons';
const IMAGESET_PATH = 'Images.xcassets/AppIcon.appiconset';
const withIosIcons = config => {
return (0, _configPlugins().withDangerousMod)(config, ['ios', async config => {
await setIconsAsync(config, config.modRequest.projectRoot);
return config;
}]);
};
exports.withIosIcons = withIosIcons;
function getIcons(config) {
// No support for empty strings.
return config.ios?.icon || config.icon || null;
}
async function setIconsAsync(config, projectRoot) {
const icon = getIcons(config);
if (!icon) {
_configPlugins().WarningAggregator.addWarningIOS('icon', 'No icon is defined in the Expo config.');
}
// Something like projectRoot/ios/MyApp/
const iosNamedProjectRoot = getIosNamedProjectPath(projectRoot);
// Ensure the Images.xcassets/AppIcon.appiconset path exists
await fs().ensureDir((0, _path().join)(iosNamedProjectRoot, IMAGESET_PATH));
// Store the image JSON data for assigning via the Contents.json
const imagesJson = await generateUniversalIconAsync(projectRoot, {
icon,
cacheKey: 'universal-icon',
iosNamedProjectRoot,
platform: 'ios'
});
// Finally, write the Config.json
await (0, _AssetContents().writeContentsJsonAsync)((0, _path().join)(iosNamedProjectRoot, IMAGESET_PATH), {
images: imagesJson
});
}
/**
* Return the project's named iOS path: ios/MyProject/
*
* @param projectRoot Expo project root path.
*/
function getIosNamedProjectPath(projectRoot) {
const projectName = getProjectName(projectRoot);
return (0, _path().join)(projectRoot, 'ios', projectName);
}
function getAppleIconName(size, scale) {
return `App-Icon-${size}x${size}@${scale}x.png`;
}
async function generateUniversalIconAsync(projectRoot, {
icon,
cacheKey,
iosNamedProjectRoot,
platform
}) {
const size = 1024;
const filename = getAppleIconName(size, 1);
let source;
if (icon) {
// Using this method will cache the images in `.expo` based on the properties used to generate them.
// this method also supports remote URLs and using the global sharp instance.
source = (await (0, _imageUtils().generateImageAsync)({
projectRoot,
cacheType: IMAGE_CACHE_NAME + cacheKey
}, {
src: icon,
name: filename,
width: size,
height: size,
removeTransparency: true,
// The icon should be square, but if it's not then it will be cropped.
resizeMode: 'cover',
// Force the background color to solid white to prevent any transparency.
// TODO: Maybe use a more adaptive option based on the icon color?
backgroundColor: '#ffffff'
})).source;
} else {
// Create a white square image if no icon exists to mitigate the chance of a submission failure to the app store.
source = await (0, _imageUtils().createSquareAsync)({
size
});
}
// Write image buffer to the file system.
const assetPath = (0, _path().join)(iosNamedProjectRoot, IMAGESET_PATH, filename);
await fs().writeFile(assetPath, source);
return [{
filename: getAppleIconName(size, 1),
idiom: 'universal',
platform,
size: `${size}x${size}`
}];
}
//# sourceMappingURL=withIosIcons.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
import { ConfigPlugin, PluginParameters, withPlugins } from '@expo/config-plugins';
export declare function createLegacyPlugin({ packageName, fallback, }: {
packageName: string;
fallback: ConfigPlugin | PluginParameters<typeof withPlugins>;
}): ConfigPlugin;

View File

@@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createLegacyPlugin = createLegacyPlugin;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
const toCamelCase = s => s.replace(/-./g, x => x.toUpperCase()[1]);
function isModuleExcluded(config, packageName) {
// Skip using the versioned plugin when autolinking is enabled
// and doesn't link the native module.
return config._internal?.autolinkedModules && !config._internal.autolinkedModules.includes(packageName);
}
function createLegacyPlugin({
packageName,
fallback
}) {
let withFallback;
if (Array.isArray(fallback)) {
withFallback = config => (0, _configPlugins().withPlugins)(config, fallback);
} else {
withFallback = fallback;
}
const withUnknown = config => {
// Skip using the versioned plugin when autolinking is enabled
// and doesn't link the native module.
if (isModuleExcluded(config, packageName)) {
return (0, _configPlugins().createRunOncePlugin)(withFallback, packageName)(config);
}
return (0, _configPlugins().withStaticPlugin)(config, {
_isLegacyPlugin: true,
plugin: packageName,
// If the static plugin isn't found, use the unversioned one.
fallback: (0, _configPlugins().createRunOncePlugin)(withFallback, packageName)
});
};
const methodName = toCamelCase(`with-${packageName}`);
Object.defineProperty(withUnknown, 'name', {
value: methodName
});
return withUnknown;
}
//# sourceMappingURL=createLegacyPlugin.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"createLegacyPlugin.js","names":["_configPlugins","data","require","toCamelCase","s","replace","x","toUpperCase","isModuleExcluded","config","packageName","_internal","autolinkedModules","includes","createLegacyPlugin","fallback","withFallback","Array","isArray","withPlugins","withUnknown","createRunOncePlugin","withStaticPlugin","_isLegacyPlugin","plugin","methodName","Object","defineProperty","value"],"sources":["../../../src/plugins/unversioned/createLegacyPlugin.ts"],"sourcesContent":["import {\n ConfigPlugin,\n createRunOncePlugin,\n PluginParameters,\n withPlugins,\n withStaticPlugin,\n} from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\n\nconst toCamelCase = (s: string) => s.replace(/-./g, (x) => x.toUpperCase()[1]);\n\nfunction isModuleExcluded(config: Pick<ExpoConfig, '_internal'>, packageName: string): boolean {\n // Skip using the versioned plugin when autolinking is enabled\n // and doesn't link the native module.\n return (\n config._internal?.autolinkedModules && !config._internal.autolinkedModules.includes(packageName)\n );\n}\n\nexport function createLegacyPlugin({\n packageName,\n fallback,\n}: {\n packageName: string;\n fallback: ConfigPlugin | PluginParameters<typeof withPlugins>;\n}): ConfigPlugin {\n let withFallback: ConfigPlugin;\n\n if (Array.isArray(fallback)) {\n withFallback = (config) => withPlugins(config, fallback);\n } else {\n withFallback = fallback;\n }\n\n const withUnknown: ConfigPlugin = (config) => {\n // Skip using the versioned plugin when autolinking is enabled\n // and doesn't link the native module.\n if (isModuleExcluded(config, packageName)) {\n return createRunOncePlugin(withFallback, packageName)(config);\n }\n\n return withStaticPlugin(config, {\n _isLegacyPlugin: true,\n plugin: packageName,\n // If the static plugin isn't found, use the unversioned one.\n fallback: createRunOncePlugin(withFallback, packageName),\n });\n };\n\n const methodName = toCamelCase(`with-${packageName}`);\n Object.defineProperty(withUnknown, 'name', {\n value: methodName,\n });\n\n return withUnknown;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AASA,MAAME,WAAW,GAAIC,CAAS,IAAKA,CAAC,CAACC,OAAO,CAAC,KAAK,EAAGC,CAAC,IAAKA,CAAC,CAACC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9E,SAASC,gBAAgBA,CAACC,MAAqC,EAAEC,WAAmB,EAAW;EAC7F;EACA;EACA,OACED,MAAM,CAACE,SAAS,EAAEC,iBAAiB,IAAI,CAACH,MAAM,CAACE,SAAS,CAACC,iBAAiB,CAACC,QAAQ,CAACH,WAAW,CAAC;AAEpG;AAEO,SAASI,kBAAkBA,CAAC;EACjCJ,WAAW;EACXK;AAIF,CAAC,EAAgB;EACf,IAAIC,YAA0B;EAE9B,IAAIC,KAAK,CAACC,OAAO,CAACH,QAAQ,CAAC,EAAE;IAC3BC,YAAY,GAAIP,MAAM,IAAK,IAAAU,4BAAW,EAACV,MAAM,EAAEM,QAAQ,CAAC;EAC1D,CAAC,MAAM;IACLC,YAAY,GAAGD,QAAQ;EACzB;EAEA,MAAMK,WAAyB,GAAIX,MAAM,IAAK;IAC5C;IACA;IACA,IAAID,gBAAgB,CAACC,MAAM,EAAEC,WAAW,CAAC,EAAE;MACzC,OAAO,IAAAW,oCAAmB,EAACL,YAAY,EAAEN,WAAW,CAAC,CAACD,MAAM,CAAC;IAC/D;IAEA,OAAO,IAAAa,iCAAgB,EAACb,MAAM,EAAE;MAC9Bc,eAAe,EAAE,IAAI;MACrBC,MAAM,EAAEd,WAAW;MACnB;MACAK,QAAQ,EAAE,IAAAM,oCAAmB,EAACL,YAAY,EAAEN,WAAW;IACzD,CAAC,CAAC;EACJ,CAAC;EAED,MAAMe,UAAU,GAAGtB,WAAW,CAAC,QAAQO,WAAW,EAAE,CAAC;EACrDgB,MAAM,CAACC,cAAc,CAACP,WAAW,EAAE,MAAM,EAAE;IACzCQ,KAAK,EAAEH;EACT,CAAC,CAAC;EAEF,OAAOL,WAAW;AACpB","ignoreList":[]}

View File

@@ -0,0 +1,2 @@
declare const _default: import("@expo/config-plugins").ConfigPlugin;
export default _default;

View File

@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _withAndroidAdMob() {
const data = require("./withAndroidAdMob");
_withAndroidAdMob = function () {
return data;
};
return data;
}
function _withIosAdMob() {
const data = require("./withIosAdMob");
_withIosAdMob = function () {
return data;
};
return data;
}
function _createLegacyPlugin() {
const data = require("../createLegacyPlugin");
_createLegacyPlugin = function () {
return data;
};
return data;
}
var _default = exports.default = (0, _createLegacyPlugin().createLegacyPlugin)({
packageName: 'expo-ads-admob',
fallback: [_withAndroidAdMob().withAndroidAdMob, _withIosAdMob().withIosAdMob]
});
//# sourceMappingURL=expo-ads-admob.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"expo-ads-admob.js","names":["_withAndroidAdMob","data","require","_withIosAdMob","_createLegacyPlugin","_default","exports","default","createLegacyPlugin","packageName","fallback","withAndroidAdMob","withIosAdMob"],"sources":["../../../../src/plugins/unversioned/expo-ads-admob/expo-ads-admob.ts"],"sourcesContent":["import { withAndroidAdMob } from './withAndroidAdMob';\nimport { withIosAdMob } from './withIosAdMob';\nimport { createLegacyPlugin } from '../createLegacyPlugin';\n\nexport default createLegacyPlugin({\n packageName: 'expo-ads-admob',\n fallback: [withAndroidAdMob, withIosAdMob],\n});\n"],"mappings":";;;;;;AAAA,SAAAA,kBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,iBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,cAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,aAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,oBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,mBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA2D,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAE5C,IAAAC,wCAAkB,EAAC;EAChCC,WAAW,EAAE,gBAAgB;EAC7BC,QAAQ,EAAE,CAACC,oCAAgB,EAAEC,4BAAY;AAC3C,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,6 @@
import { AndroidConfig, ConfigPlugin } from '@expo/config-plugins';
import { ExpoConfig } from '@expo/config-types';
export declare const withAndroidAdMob: ConfigPlugin;
export declare function getGoogleMobileAdsAppId(config: Pick<ExpoConfig, 'android'>): string | null;
export declare function getGoogleMobileAdsAutoInit(config: Pick<ExpoConfig, 'android'>): boolean;
export declare function setAdMobConfig(config: Pick<ExpoConfig, 'android'>, androidManifest: AndroidConfig.Manifest.AndroidManifest): AndroidConfig.Manifest.AndroidManifest;

View File

@@ -0,0 +1,50 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getGoogleMobileAdsAppId = getGoogleMobileAdsAppId;
exports.getGoogleMobileAdsAutoInit = getGoogleMobileAdsAutoInit;
exports.setAdMobConfig = setAdMobConfig;
exports.withAndroidAdMob = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
const {
addMetaDataItemToMainApplication,
getMainApplicationOrThrow,
removeMetaDataItemFromMainApplication
} = _configPlugins().AndroidConfig.Manifest;
const META_APPLICATION_ID = 'com.google.android.gms.ads.APPLICATION_ID';
const META_DELAY_APP_MEASUREMENT_INIT = 'com.google.android.gms.ads.DELAY_APP_MEASUREMENT_INIT';
const withAndroidAdMob = config => {
return (0, _configPlugins().withAndroidManifest)(config, config => {
config.modResults = setAdMobConfig(config, config.modResults);
return config;
});
};
exports.withAndroidAdMob = withAndroidAdMob;
function getGoogleMobileAdsAppId(config) {
return config.android?.config?.googleMobileAdsAppId ?? null;
}
function getGoogleMobileAdsAutoInit(config) {
return config.android?.config?.googleMobileAdsAutoInit ?? false;
}
function setAdMobConfig(config, androidManifest) {
const appId = getGoogleMobileAdsAppId(config);
const autoInit = getGoogleMobileAdsAutoInit(config);
const mainApplication = getMainApplicationOrThrow(androidManifest);
if (appId) {
addMetaDataItemToMainApplication(mainApplication, META_APPLICATION_ID, appId);
addMetaDataItemToMainApplication(mainApplication, META_DELAY_APP_MEASUREMENT_INIT, String(!autoInit));
} else {
removeMetaDataItemFromMainApplication(mainApplication, META_APPLICATION_ID);
removeMetaDataItemFromMainApplication(mainApplication, META_DELAY_APP_MEASUREMENT_INIT);
}
return androidManifest;
}
//# sourceMappingURL=withAndroidAdMob.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"withAndroidAdMob.js","names":["_configPlugins","data","require","addMetaDataItemToMainApplication","getMainApplicationOrThrow","removeMetaDataItemFromMainApplication","AndroidConfig","Manifest","META_APPLICATION_ID","META_DELAY_APP_MEASUREMENT_INIT","withAndroidAdMob","config","withAndroidManifest","modResults","setAdMobConfig","exports","getGoogleMobileAdsAppId","android","googleMobileAdsAppId","getGoogleMobileAdsAutoInit","googleMobileAdsAutoInit","androidManifest","appId","autoInit","mainApplication","String"],"sources":["../../../../src/plugins/unversioned/expo-ads-admob/withAndroidAdMob.ts"],"sourcesContent":["import { AndroidConfig, ConfigPlugin, withAndroidManifest } from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\n\nconst {\n addMetaDataItemToMainApplication,\n getMainApplicationOrThrow,\n removeMetaDataItemFromMainApplication,\n} = AndroidConfig.Manifest;\n\nconst META_APPLICATION_ID = 'com.google.android.gms.ads.APPLICATION_ID';\nconst META_DELAY_APP_MEASUREMENT_INIT = 'com.google.android.gms.ads.DELAY_APP_MEASUREMENT_INIT';\n\nexport const withAndroidAdMob: ConfigPlugin = (config) => {\n return withAndroidManifest(config, (config) => {\n config.modResults = setAdMobConfig(config, config.modResults);\n return config;\n });\n};\n\nexport function getGoogleMobileAdsAppId(config: Pick<ExpoConfig, 'android'>) {\n return config.android?.config?.googleMobileAdsAppId ?? null;\n}\n\nexport function getGoogleMobileAdsAutoInit(config: Pick<ExpoConfig, 'android'>) {\n return config.android?.config?.googleMobileAdsAutoInit ?? false;\n}\n\nexport function setAdMobConfig(\n config: Pick<ExpoConfig, 'android'>,\n androidManifest: AndroidConfig.Manifest.AndroidManifest\n) {\n const appId = getGoogleMobileAdsAppId(config);\n const autoInit = getGoogleMobileAdsAutoInit(config);\n const mainApplication = getMainApplicationOrThrow(androidManifest);\n\n if (appId) {\n addMetaDataItemToMainApplication(mainApplication, META_APPLICATION_ID, appId);\n addMetaDataItemToMainApplication(\n mainApplication,\n META_DELAY_APP_MEASUREMENT_INIT,\n String(!autoInit)\n );\n } else {\n removeMetaDataItemFromMainApplication(mainApplication, META_APPLICATION_ID);\n removeMetaDataItemFromMainApplication(mainApplication, META_DELAY_APP_MEASUREMENT_INIT);\n }\n\n return androidManifest;\n}\n"],"mappings":";;;;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,MAAM;EACJE,gCAAgC;EAChCC,yBAAyB;EACzBC;AACF,CAAC,GAAGC,8BAAa,CAACC,QAAQ;AAE1B,MAAMC,mBAAmB,GAAG,2CAA2C;AACvE,MAAMC,+BAA+B,GAAG,uDAAuD;AAExF,MAAMC,gBAA8B,GAAIC,MAAM,IAAK;EACxD,OAAO,IAAAC,oCAAmB,EAACD,MAAM,EAAGA,MAAM,IAAK;IAC7CA,MAAM,CAACE,UAAU,GAAGC,cAAc,CAACH,MAAM,EAAEA,MAAM,CAACE,UAAU,CAAC;IAC7D,OAAOF,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;AAACI,OAAA,CAAAL,gBAAA,GAAAA,gBAAA;AAEK,SAASM,uBAAuBA,CAACL,MAAmC,EAAE;EAC3E,OAAOA,MAAM,CAACM,OAAO,EAAEN,MAAM,EAAEO,oBAAoB,IAAI,IAAI;AAC7D;AAEO,SAASC,0BAA0BA,CAACR,MAAmC,EAAE;EAC9E,OAAOA,MAAM,CAACM,OAAO,EAAEN,MAAM,EAAES,uBAAuB,IAAI,KAAK;AACjE;AAEO,SAASN,cAAcA,CAC5BH,MAAmC,EACnCU,eAAuD,EACvD;EACA,MAAMC,KAAK,GAAGN,uBAAuB,CAACL,MAAM,CAAC;EAC7C,MAAMY,QAAQ,GAAGJ,0BAA0B,CAACR,MAAM,CAAC;EACnD,MAAMa,eAAe,GAAGpB,yBAAyB,CAACiB,eAAe,CAAC;EAElE,IAAIC,KAAK,EAAE;IACTnB,gCAAgC,CAACqB,eAAe,EAAEhB,mBAAmB,EAAEc,KAAK,CAAC;IAC7EnB,gCAAgC,CAC9BqB,eAAe,EACff,+BAA+B,EAC/BgB,MAAM,CAAC,CAACF,QAAQ,CAClB,CAAC;EACH,CAAC,MAAM;IACLlB,qCAAqC,CAACmB,eAAe,EAAEhB,mBAAmB,CAAC;IAC3EH,qCAAqC,CAACmB,eAAe,EAAEf,+BAA+B,CAAC;EACzF;EAEA,OAAOY,eAAe;AACxB","ignoreList":[]}

View File

@@ -0,0 +1,5 @@
import { ConfigPlugin, InfoPlist } from '@expo/config-plugins';
import { ExpoConfig } from '@expo/config-types';
export declare const withIosAdMob: ConfigPlugin;
export declare function getGoogleMobileAdsAppId(config: Pick<ExpoConfig, 'ios'>): string | null;
export declare function setGoogleMobileAdsAppId(config: Pick<ExpoConfig, 'ios'>, { GADApplicationIdentifier, ...infoPlist }: InfoPlist): InfoPlist;

View File

@@ -0,0 +1,51 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getGoogleMobileAdsAppId = getGoogleMobileAdsAppId;
exports.setGoogleMobileAdsAppId = setGoogleMobileAdsAppId;
exports.withIosAdMob = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
const withIosAdMob = config => {
return (0, _configPlugins().withInfoPlist)(config, config => {
config.modResults = setAdMobConfig(config, config.modResults);
return config;
});
};
// NOTE(brentvatne): if the developer has installed the google ads sdk and does
// not provide an app id their app will crash. Standalone apps get around this by
// providing some default value, we will instead here assume that the user can
// do the right thing if they have installed the package. This is a slight discrepancy
// that arises in ejecting because it's possible for the package to be installed and
// not crashing in the managed workflow, then you eject and the app crashes because
// you don't have an id to fall back to.
exports.withIosAdMob = withIosAdMob;
function getGoogleMobileAdsAppId(config) {
return config.ios?.config?.googleMobileAdsAppId ?? null;
}
function setGoogleMobileAdsAppId(config, {
GADApplicationIdentifier,
...infoPlist
}) {
const appId = getGoogleMobileAdsAppId(config);
if (appId === null) {
return infoPlist;
}
return {
...infoPlist,
GADApplicationIdentifier: appId
};
}
function setAdMobConfig(config, infoPlist) {
infoPlist = setGoogleMobileAdsAppId(config, infoPlist);
return infoPlist;
}
//# sourceMappingURL=withIosAdMob.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"withIosAdMob.js","names":["_configPlugins","data","require","withIosAdMob","config","withInfoPlist","modResults","setAdMobConfig","exports","getGoogleMobileAdsAppId","ios","googleMobileAdsAppId","setGoogleMobileAdsAppId","GADApplicationIdentifier","infoPlist","appId"],"sources":["../../../../src/plugins/unversioned/expo-ads-admob/withIosAdMob.ts"],"sourcesContent":["import { ConfigPlugin, InfoPlist, withInfoPlist } from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\n\nexport const withIosAdMob: ConfigPlugin = (config) => {\n return withInfoPlist(config, (config) => {\n config.modResults = setAdMobConfig(config, config.modResults);\n return config;\n });\n};\n\n// NOTE(brentvatne): if the developer has installed the google ads sdk and does\n// not provide an app id their app will crash. Standalone apps get around this by\n// providing some default value, we will instead here assume that the user can\n// do the right thing if they have installed the package. This is a slight discrepancy\n// that arises in ejecting because it's possible for the package to be installed and\n// not crashing in the managed workflow, then you eject and the app crashes because\n// you don't have an id to fall back to.\nexport function getGoogleMobileAdsAppId(config: Pick<ExpoConfig, 'ios'>) {\n return config.ios?.config?.googleMobileAdsAppId ?? null;\n}\n\nexport function setGoogleMobileAdsAppId(\n config: Pick<ExpoConfig, 'ios'>,\n { GADApplicationIdentifier, ...infoPlist }: InfoPlist\n): InfoPlist {\n const appId = getGoogleMobileAdsAppId(config);\n\n if (appId === null) {\n return infoPlist;\n }\n\n return {\n ...infoPlist,\n GADApplicationIdentifier: appId,\n };\n}\n\nfunction setAdMobConfig(config: Pick<ExpoConfig, 'ios'>, infoPlist: InfoPlist): InfoPlist {\n infoPlist = setGoogleMobileAdsAppId(config, infoPlist);\n return infoPlist;\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGO,MAAME,YAA0B,GAAIC,MAAM,IAAK;EACpD,OAAO,IAAAC,8BAAa,EAACD,MAAM,EAAGA,MAAM,IAAK;IACvCA,MAAM,CAACE,UAAU,GAAGC,cAAc,CAACH,MAAM,EAAEA,MAAM,CAACE,UAAU,CAAC;IAC7D,OAAOF,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AAAAI,OAAA,CAAAL,YAAA,GAAAA,YAAA;AACO,SAASM,uBAAuBA,CAACL,MAA+B,EAAE;EACvE,OAAOA,MAAM,CAACM,GAAG,EAAEN,MAAM,EAAEO,oBAAoB,IAAI,IAAI;AACzD;AAEO,SAASC,uBAAuBA,CACrCR,MAA+B,EAC/B;EAAES,wBAAwB;EAAE,GAAGC;AAAqB,CAAC,EAC1C;EACX,MAAMC,KAAK,GAAGN,uBAAuB,CAACL,MAAM,CAAC;EAE7C,IAAIW,KAAK,KAAK,IAAI,EAAE;IAClB,OAAOD,SAAS;EAClB;EAEA,OAAO;IACL,GAAGA,SAAS;IACZD,wBAAwB,EAAEE;EAC5B,CAAC;AACH;AAEA,SAASR,cAAcA,CAACH,MAA+B,EAAEU,SAAoB,EAAa;EACxFA,SAAS,GAAGF,uBAAuB,CAACR,MAAM,EAAEU,SAAS,CAAC;EACtD,OAAOA,SAAS;AAClB","ignoreList":[]}

View File

@@ -0,0 +1,3 @@
import { ConfigPlugin } from '@expo/config-plugins';
declare const _default: ConfigPlugin;
export default _default;

View File

@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
function _createLegacyPlugin() {
const data = require("./createLegacyPlugin");
_createLegacyPlugin = function () {
return data;
};
return data;
}
const withAppleSignInWarning = config => {
return (0, _configPlugins().withEntitlementsPlist)(config, config => {
if (config.ios?.usesAppleSignIn) {
_configPlugins().WarningAggregator.addWarningIOS('ios.usesAppleSignIn', 'Install expo-apple-authentication to enable this feature', 'https://docs.expo.dev/versions/latest/sdk/apple-authentication/#eas-build');
}
return config;
});
};
var _default = exports.default = (0, _createLegacyPlugin().createLegacyPlugin)({
packageName: 'expo-apple-authentication',
fallback: withAppleSignInWarning
});
//# sourceMappingURL=expo-apple-authentication.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"expo-apple-authentication.js","names":["_configPlugins","data","require","_createLegacyPlugin","withAppleSignInWarning","config","withEntitlementsPlist","ios","usesAppleSignIn","WarningAggregator","addWarningIOS","_default","exports","default","createLegacyPlugin","packageName","fallback"],"sources":["../../../src/plugins/unversioned/expo-apple-authentication.ts"],"sourcesContent":["import { ConfigPlugin, WarningAggregator, withEntitlementsPlist } from '@expo/config-plugins';\n\nimport { createLegacyPlugin } from './createLegacyPlugin';\n\nconst withAppleSignInWarning: ConfigPlugin = (config) => {\n return withEntitlementsPlist(config, (config) => {\n if (config.ios?.usesAppleSignIn) {\n WarningAggregator.addWarningIOS(\n 'ios.usesAppleSignIn',\n 'Install expo-apple-authentication to enable this feature',\n 'https://docs.expo.dev/versions/latest/sdk/apple-authentication/#eas-build'\n );\n }\n\n return config;\n });\n};\n\nexport default createLegacyPlugin({\n packageName: 'expo-apple-authentication',\n fallback: withAppleSignInWarning,\n});\n"],"mappings":";;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,oBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,mBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,MAAMG,sBAAoC,GAAIC,MAAM,IAAK;EACvD,OAAO,IAAAC,sCAAqB,EAACD,MAAM,EAAGA,MAAM,IAAK;IAC/C,IAAIA,MAAM,CAACE,GAAG,EAAEC,eAAe,EAAE;MAC/BC,kCAAiB,CAACC,aAAa,CAC7B,qBAAqB,EACrB,0DAA0D,EAC1D,2EACF,CAAC;IACH;IAEA,OAAOL,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;AAAC,IAAAM,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa,IAAAC,wCAAkB,EAAC;EAChCC,WAAW,EAAE,2BAA2B;EACxCC,QAAQ,EAAEZ;AACZ,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,3 @@
import { ConfigPlugin } from '@expo/config-plugins';
declare const _default: ConfigPlugin;
export default _default;

View File

@@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
function _createLegacyPlugin() {
const data = require("./createLegacyPlugin");
_createLegacyPlugin = function () {
return data;
};
return data;
}
const withAccessesContactNotes = config => {
return (0, _configPlugins().withEntitlementsPlist)(config, config => {
config.modResults = setAccessesContactNotes(config, config.modResults);
return config;
});
};
function setAccessesContactNotes(config, entitlementsPlist) {
if (config.ios?.accessesContactNotes) {
return {
...entitlementsPlist,
'com.apple.developer.contacts.notes': true
};
}
return entitlementsPlist;
}
var _default = exports.default = (0, _createLegacyPlugin().createLegacyPlugin)({
packageName: 'expo-contacts',
fallback: withAccessesContactNotes
});
//# sourceMappingURL=expo-contacts.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"expo-contacts.js","names":["_configPlugins","data","require","_createLegacyPlugin","withAccessesContactNotes","config","withEntitlementsPlist","modResults","setAccessesContactNotes","entitlementsPlist","ios","accessesContactNotes","_default","exports","default","createLegacyPlugin","packageName","fallback"],"sources":["../../../src/plugins/unversioned/expo-contacts.ts"],"sourcesContent":["import { ConfigPlugin, withEntitlementsPlist } from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\nimport { JSONObject } from '@expo/json-file';\n\nimport { createLegacyPlugin } from './createLegacyPlugin';\n\nconst withAccessesContactNotes: ConfigPlugin = (config) => {\n return withEntitlementsPlist(config, (config) => {\n config.modResults = setAccessesContactNotes(config, config.modResults);\n return config;\n });\n};\n\nfunction setAccessesContactNotes(config: ExpoConfig, entitlementsPlist: JSONObject): JSONObject {\n if (config.ios?.accessesContactNotes) {\n return {\n ...entitlementsPlist,\n 'com.apple.developer.contacts.notes': true,\n };\n }\n\n return entitlementsPlist;\n}\n\nexport default createLegacyPlugin({\n packageName: 'expo-contacts',\n fallback: withAccessesContactNotes,\n});\n"],"mappings":";;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAE,oBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,mBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,MAAMG,wBAAsC,GAAIC,MAAM,IAAK;EACzD,OAAO,IAAAC,sCAAqB,EAACD,MAAM,EAAGA,MAAM,IAAK;IAC/CA,MAAM,CAACE,UAAU,GAAGC,uBAAuB,CAACH,MAAM,EAAEA,MAAM,CAACE,UAAU,CAAC;IACtE,OAAOF,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;AAED,SAASG,uBAAuBA,CAACH,MAAkB,EAAEI,iBAA6B,EAAc;EAC9F,IAAIJ,MAAM,CAACK,GAAG,EAAEC,oBAAoB,EAAE;IACpC,OAAO;MACL,GAAGF,iBAAiB;MACpB,oCAAoC,EAAE;IACxC,CAAC;EACH;EAEA,OAAOA,iBAAiB;AAC1B;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,wCAAkB,EAAC;EAChCC,WAAW,EAAE,eAAe;EAC5BC,QAAQ,EAAEb;AACZ,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,2 @@
declare const _default: import("@expo/config-plugins").ConfigPlugin;
export default _default;

View File

@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
function _createLegacyPlugin() {
const data = require("./createLegacyPlugin");
_createLegacyPlugin = function () {
return data;
};
return data;
}
var _default = exports.default = (0, _createLegacyPlugin().createLegacyPlugin)({
packageName: 'expo-document-picker',
fallback(config) {
if (config.ios?.usesIcloudStorage) {
_configPlugins().WarningAggregator.addWarningIOS('ios.usesIcloudStorage', 'Install expo-document-picker to enable the ios.usesIcloudStorage feature'
// TODO: add a link to a docs page with more information on how to do this
);
}
return config;
}
});
//# sourceMappingURL=expo-document-picker.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"expo-document-picker.js","names":["_configPlugins","data","require","_createLegacyPlugin","_default","exports","default","createLegacyPlugin","packageName","fallback","config","ios","usesIcloudStorage","WarningAggregator","addWarningIOS"],"sources":["../../../src/plugins/unversioned/expo-document-picker.ts"],"sourcesContent":["import { WarningAggregator } from '@expo/config-plugins';\n\nimport { createLegacyPlugin } from './createLegacyPlugin';\n\nexport default createLegacyPlugin({\n packageName: 'expo-document-picker',\n fallback(config) {\n if (config.ios?.usesIcloudStorage) {\n WarningAggregator.addWarningIOS(\n 'ios.usesIcloudStorage',\n 'Install expo-document-picker to enable the ios.usesIcloudStorage feature'\n // TODO: add a link to a docs page with more information on how to do this\n );\n }\n return config;\n },\n});\n"],"mappings":";;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,oBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,mBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0D,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAE3C,IAAAC,wCAAkB,EAAC;EAChCC,WAAW,EAAE,sBAAsB;EACnCC,QAAQA,CAACC,MAAM,EAAE;IACf,IAAIA,MAAM,CAACC,GAAG,EAAEC,iBAAiB,EAAE;MACjCC,kCAAiB,CAACC,aAAa,CAC7B,uBAAuB,EACvB;MACA;MACF,CAAC;IACH;IACA,OAAOJ,MAAM;EACf;AACF,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,2 @@
declare const _default: import("@expo/config-plugins").ConfigPlugin;
export default _default;

View File

@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _withAndroidNavigationBar() {
const data = require("./withAndroidNavigationBar");
_withAndroidNavigationBar = function () {
return data;
};
return data;
}
function _createLegacyPlugin() {
const data = require("../createLegacyPlugin");
_createLegacyPlugin = function () {
return data;
};
return data;
}
var _default = exports.default = (0, _createLegacyPlugin().createLegacyPlugin)({
packageName: 'expo-navigation-bar',
fallback: [
// Android
_withAndroidNavigationBar().withNavigationBar]
});
//# sourceMappingURL=expo-navigation-bar.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"expo-navigation-bar.js","names":["_withAndroidNavigationBar","data","require","_createLegacyPlugin","_default","exports","default","createLegacyPlugin","packageName","fallback","withNavigationBar"],"sources":["../../../../src/plugins/unversioned/expo-navigation-bar/expo-navigation-bar.ts"],"sourcesContent":["import { withNavigationBar } from './withAndroidNavigationBar';\nimport { createLegacyPlugin } from '../createLegacyPlugin';\n\nexport default createLegacyPlugin({\n packageName: 'expo-navigation-bar',\n fallback: [\n // Android\n withNavigationBar,\n ],\n});\n"],"mappings":";;;;;;AAAA,SAAAA,0BAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,yBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,oBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,mBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA2D,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAE5C,IAAAC,wCAAkB,EAAC;EAChCC,WAAW,EAAE,qBAAqB;EAClCC,QAAQ,EAAE;EACR;EACAC,6CAAiB;AAErB,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,8 @@
import { AndroidConfig, ConfigPlugin } from '@expo/config-plugins';
import { ExpoConfig } from '@expo/config-types';
export declare const withNavigationBar: ConfigPlugin;
export declare function setNavigationBarColors(config: Pick<ExpoConfig, 'androidNavigationBar'>, colors: AndroidConfig.Resources.ResourceXML): AndroidConfig.Resources.ResourceXML;
export declare function setNavigationBarStyles(config: Pick<ExpoConfig, 'androidNavigationBar'>, styles: AndroidConfig.Resources.ResourceXML): AndroidConfig.Resources.ResourceXML;
export declare function getNavigationBarImmersiveMode(config: Pick<ExpoConfig, 'androidNavigationBar'>): "leanback" | "immersive" | "sticky-immersive" | null;
export declare function getNavigationBarColor(config: Pick<ExpoConfig, 'androidNavigationBar'>): string | null;
export declare function getNavigationBarStyle(config: Pick<ExpoConfig, 'androidNavigationBar'>): "light-content" | "dark-content";

View File

@@ -0,0 +1,77 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getNavigationBarColor = getNavigationBarColor;
exports.getNavigationBarImmersiveMode = getNavigationBarImmersiveMode;
exports.getNavigationBarStyle = getNavigationBarStyle;
exports.setNavigationBarColors = setNavigationBarColors;
exports.setNavigationBarStyles = setNavigationBarStyles;
exports.withNavigationBar = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
const NAVIGATION_BAR_COLOR = 'navigationBarColor';
const withNavigationBar = config => {
const immersiveMode = getNavigationBarImmersiveMode(config);
if (immersiveMode) {
// Immersive mode needs to be set programmatically
_configPlugins().WarningAggregator.addWarningAndroid('androidNavigationBar.visible', 'Property is deprecated in Android 11 (API 30) and will be removed from Expo SDK.', 'https://expo.fyi/android-navigation-bar-visible-deprecated');
}
config = withNavigationBarColors(config);
config = withNavigationBarStyles(config);
return config;
};
exports.withNavigationBar = withNavigationBar;
const withNavigationBarColors = config => {
return (0, _configPlugins().withAndroidColors)(config, config => {
config.modResults = setNavigationBarColors(config, config.modResults);
return config;
});
};
const withNavigationBarStyles = config => {
return (0, _configPlugins().withAndroidStyles)(config, config => {
config.modResults = setNavigationBarStyles(config, config.modResults);
return config;
});
};
function setNavigationBarColors(config, colors) {
const hexString = getNavigationBarColor(config);
if (hexString) {
colors = _configPlugins().AndroidConfig.Colors.setColorItem(_configPlugins().AndroidConfig.Resources.buildResourceItem({
name: NAVIGATION_BAR_COLOR,
value: hexString
}), colors);
}
return colors;
}
function setNavigationBarStyles(config, styles) {
styles = _configPlugins().AndroidConfig.Styles.assignStylesValue(styles, {
add: getNavigationBarStyle(config) === 'dark-content',
parent: _configPlugins().AndroidConfig.Styles.getAppThemeLightNoActionBarGroup(),
name: 'android:windowLightNavigationBar',
value: 'true'
});
styles = _configPlugins().AndroidConfig.Styles.assignStylesValue(styles, {
add: !!getNavigationBarColor(config),
parent: _configPlugins().AndroidConfig.Styles.getAppThemeLightNoActionBarGroup(),
name: `android:${NAVIGATION_BAR_COLOR}`,
value: `@color/${NAVIGATION_BAR_COLOR}`
});
return styles;
}
function getNavigationBarImmersiveMode(config) {
return config.androidNavigationBar?.visible || null;
}
function getNavigationBarColor(config) {
return config.androidNavigationBar?.backgroundColor || null;
}
function getNavigationBarStyle(config) {
return config.androidNavigationBar?.barStyle || 'light-content';
}
//# sourceMappingURL=withAndroidNavigationBar.js.map

View File

@@ -0,0 +1,2 @@
declare const _default: import("@expo/config-plugins").ConfigPlugin;
export default _default;

View File

@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _withAndroidNotifications() {
const data = require("./withAndroidNotifications");
_withAndroidNotifications = function () {
return data;
};
return data;
}
function _createLegacyPlugin() {
const data = require("../createLegacyPlugin");
_createLegacyPlugin = function () {
return data;
};
return data;
}
var _default = exports.default = (0, _createLegacyPlugin().createLegacyPlugin)({
packageName: 'expo-notifications',
fallback: [
// Android
_withAndroidNotifications().withNotificationManifest, _withAndroidNotifications().withNotificationIconColor, _withAndroidNotifications().withNotificationIcons
// iOS
// Automatic setting of APNS entitlement is no longer needed
]
});
//# sourceMappingURL=expo-notifications.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"expo-notifications.js","names":["_withAndroidNotifications","data","require","_createLegacyPlugin","_default","exports","default","createLegacyPlugin","packageName","fallback","withNotificationManifest","withNotificationIconColor","withNotificationIcons"],"sources":["../../../../src/plugins/unversioned/expo-notifications/expo-notifications.ts"],"sourcesContent":["import {\n withNotificationIconColor,\n withNotificationIcons,\n withNotificationManifest,\n} from './withAndroidNotifications';\nimport { createLegacyPlugin } from '../createLegacyPlugin';\n\nexport default createLegacyPlugin({\n packageName: 'expo-notifications',\n fallback: [\n // Android\n withNotificationManifest,\n withNotificationIconColor,\n withNotificationIcons,\n // iOS\n // Automatic setting of APNS entitlement is no longer needed\n ],\n});\n"],"mappings":";;;;;;AAAA,SAAAA,0BAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,yBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA,SAAAE,oBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,mBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA2D,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAE5C,IAAAC,wCAAkB,EAAC;EAChCC,WAAW,EAAE,oBAAoB;EACjCC,QAAQ,EAAE;EACR;EACAC,oDAAwB,EACxBC,qDAAyB,EACzBC;EACA;EACA;EAAA;AAEJ,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,22 @@
import { AndroidConfig, ConfigPlugin } from '@expo/config-plugins';
import { ExpoConfig } from '@expo/config-types';
type AndroidManifest = AndroidConfig.Manifest.AndroidManifest;
export declare const META_DATA_NOTIFICATION_ICON = "expo.modules.notifications.default_notification_icon";
export declare const META_DATA_NOTIFICATION_ICON_COLOR = "expo.modules.notifications.default_notification_color";
export declare const NOTIFICATION_ICON = "notification_icon";
export declare const NOTIFICATION_ICON_RESOURCE: string;
export declare const NOTIFICATION_ICON_COLOR = "notification_icon_color";
export declare const NOTIFICATION_ICON_COLOR_RESOURCE: string;
export declare const withNotificationIcons: ConfigPlugin;
export declare const withNotificationIconColor: ConfigPlugin;
export declare const withNotificationManifest: ConfigPlugin;
export declare function getNotificationIcon(config: ExpoConfig): string | null;
export declare function getNotificationColor(config: ExpoConfig): string | null;
/**
* Applies configuration for expo-notifications, including
* the notification icon and notification color.
*/
export declare function setNotificationIconAsync(config: ExpoConfig, projectRoot: string): Promise<void>;
export declare function setNotificationConfig(config: ExpoConfig, manifest: AndroidManifest): AndroidConfig.Manifest.AndroidManifest;
export declare function setNotificationIconColor(config: ExpoConfig, colors: AndroidConfig.Resources.ResourceXML): AndroidConfig.Resources.ResourceXML;
export {};

View File

@@ -0,0 +1,161 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.NOTIFICATION_ICON_RESOURCE = exports.NOTIFICATION_ICON_COLOR_RESOURCE = exports.NOTIFICATION_ICON_COLOR = exports.NOTIFICATION_ICON = exports.META_DATA_NOTIFICATION_ICON_COLOR = exports.META_DATA_NOTIFICATION_ICON = void 0;
exports.getNotificationColor = getNotificationColor;
exports.getNotificationIcon = getNotificationIcon;
exports.setNotificationConfig = setNotificationConfig;
exports.setNotificationIconAsync = setNotificationIconAsync;
exports.setNotificationIconColor = setNotificationIconColor;
exports.withNotificationManifest = exports.withNotificationIcons = exports.withNotificationIconColor = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
function _imageUtils() {
const data = require("@expo/image-utils");
_imageUtils = function () {
return data;
};
return data;
}
function _fsExtra() {
const data = _interopRequireDefault(require("fs-extra"));
_fsExtra = function () {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _withAndroidIcons() {
const data = require("../../icons/withAndroidIcons");
_withAndroidIcons = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const {
Colors
} = _configPlugins().AndroidConfig;
const {
addMetaDataItemToMainApplication,
getMainApplicationOrThrow,
removeMetaDataItemFromMainApplication
} = _configPlugins().AndroidConfig.Manifest;
const BASELINE_PIXEL_SIZE = 24;
const META_DATA_NOTIFICATION_ICON = exports.META_DATA_NOTIFICATION_ICON = 'expo.modules.notifications.default_notification_icon';
const META_DATA_NOTIFICATION_ICON_COLOR = exports.META_DATA_NOTIFICATION_ICON_COLOR = 'expo.modules.notifications.default_notification_color';
const NOTIFICATION_ICON = exports.NOTIFICATION_ICON = 'notification_icon';
const NOTIFICATION_ICON_RESOURCE = exports.NOTIFICATION_ICON_RESOURCE = `@drawable/${NOTIFICATION_ICON}`;
const NOTIFICATION_ICON_COLOR = exports.NOTIFICATION_ICON_COLOR = 'notification_icon_color';
const NOTIFICATION_ICON_COLOR_RESOURCE = exports.NOTIFICATION_ICON_COLOR_RESOURCE = `@color/${NOTIFICATION_ICON_COLOR}`;
const withNotificationIcons = config => {
return (0, _configPlugins().withDangerousMod)(config, ['android', async config => {
await setNotificationIconAsync(config, config.modRequest.projectRoot);
return config;
}]);
};
exports.withNotificationIcons = withNotificationIcons;
const withNotificationIconColor = config => {
return (0, _configPlugins().withAndroidColors)(config, config => {
config.modResults = setNotificationIconColor(config, config.modResults);
return config;
});
};
exports.withNotificationIconColor = withNotificationIconColor;
const withNotificationManifest = config => {
return (0, _configPlugins().withAndroidManifest)(config, config => {
config.modResults = setNotificationConfig(config, config.modResults);
return config;
});
};
exports.withNotificationManifest = withNotificationManifest;
function getNotificationIcon(config) {
return config.notification?.icon || null;
}
function getNotificationColor(config) {
return config.notification?.color || null;
}
/**
* Applies configuration for expo-notifications, including
* the notification icon and notification color.
*/
async function setNotificationIconAsync(config, projectRoot) {
const icon = getNotificationIcon(config);
if (icon) {
await writeNotificationIconImageFilesAsync(icon, projectRoot);
} else {
await removeNotificationIconImageFilesAsync(projectRoot);
}
}
function setNotificationConfig(config, manifest) {
const icon = getNotificationIcon(config);
const color = getNotificationColor(config);
const mainApplication = getMainApplicationOrThrow(manifest);
if (icon) {
addMetaDataItemToMainApplication(mainApplication, META_DATA_NOTIFICATION_ICON, NOTIFICATION_ICON_RESOURCE, 'resource');
} else {
removeMetaDataItemFromMainApplication(mainApplication, META_DATA_NOTIFICATION_ICON);
}
if (color) {
addMetaDataItemToMainApplication(mainApplication, META_DATA_NOTIFICATION_ICON_COLOR, NOTIFICATION_ICON_COLOR_RESOURCE, 'resource');
} else {
removeMetaDataItemFromMainApplication(mainApplication, META_DATA_NOTIFICATION_ICON_COLOR);
}
return manifest;
}
function setNotificationIconColor(config, colors) {
return Colors.assignColorValue(colors, {
name: NOTIFICATION_ICON_COLOR,
value: getNotificationColor(config)
});
}
async function writeNotificationIconImageFilesAsync(icon, projectRoot) {
await Promise.all(Object.values(_withAndroidIcons().dpiValues).map(async ({
folderName,
scale
}) => {
const drawableFolderName = folderName.replace('mipmap', 'drawable');
const dpiFolderPath = _path().default.resolve(projectRoot, _withAndroidIcons().ANDROID_RES_PATH, drawableFolderName);
await _fsExtra().default.ensureDir(dpiFolderPath);
const iconSizePx = BASELINE_PIXEL_SIZE * scale;
try {
const resizedIcon = (await (0, _imageUtils().generateImageAsync)({
projectRoot,
cacheType: 'android-notification'
}, {
src: icon,
width: iconSizePx,
height: iconSizePx,
resizeMode: 'cover',
backgroundColor: 'transparent'
})).source;
await _fsExtra().default.writeFile(_path().default.resolve(dpiFolderPath, NOTIFICATION_ICON + '.png'), resizedIcon);
} catch (e) {
throw new Error('Encountered an issue resizing Android notification icon: ' + e);
}
}));
}
async function removeNotificationIconImageFilesAsync(projectRoot) {
await Promise.all(Object.values(_withAndroidIcons().dpiValues).map(async ({
folderName
}) => {
const drawableFolderName = folderName.replace('mipmap', 'drawable');
const dpiFolderPath = _path().default.resolve(projectRoot, _withAndroidIcons().ANDROID_RES_PATH, drawableFolderName);
await _fsExtra().default.remove(_path().default.resolve(dpiFolderPath, NOTIFICATION_ICON + '.png'));
}));
}
//# sourceMappingURL=withAndroidNotifications.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,222 @@
export type IBBoolean = 'YES' | 'NO' | boolean;
export type IBItem<H extends Record<string, any>, B extends Record<string, any[]> = {
[key: string]: any;
}> = {
$: H;
} & B;
export type Rect = {
key: string;
x: number;
y: number;
width: number;
height: number;
};
export type IBRect = IBItem<Rect>;
export type IBAutoresizingMask = IBItem<{
/** @example `autoresizingMask` */
key: string;
flexibleMaxX: IBBoolean;
flexibleMaxY: IBBoolean;
}>;
/** @example `<color key="textColor" systemColor="linkColor"/>` */
export type IBColor = IBItem<{
/** @example `textColor` */
key: string;
} & (/** Custom color */ {
/** @example `0.86584504117670746` */
red: number;
/** @example `0.26445041990630447` */
green: number;
/** @example `0.3248577810203549` */
blue: number;
/** @example `1` */
alpha: number;
colorSpace: 'custom' | string;
customColorSpace: 'displayP3' | 'sRGB' | string;
}
/** Built-in color */
| {
systemColor: 'linkColor' | string;
})>;
export type IBFontDescription = IBItem<{
/** @example `fontDescription` */
key: string;
/** Font size */
pointSize: number;
/** Custom font */
name?: 'HelveticaNeue' | string;
family?: 'Helvetica Neue' | string;
/** Built-in font */
type?: 'system' | 'boldSystem' | 'UICTFontTextStyleCallout' | 'UICTFontTextStyleBody' | string;
}>;
export type ImageContentMode = 'scaleAspectFit' | 'scaleAspectFill';
export type ConstraintAttribute = 'top' | 'bottom' | 'trailing' | 'leading';
export type IBImageView = IBItem<{
id: string;
userLabel: string;
image: string;
clipsSubviews?: IBBoolean;
userInteractionEnabled: IBBoolean;
contentMode: IBContentMode;
horizontalHuggingPriority: number;
verticalHuggingPriority: number;
insetsLayoutMarginsFromSafeArea?: IBBoolean;
translatesAutoresizingMaskIntoConstraints?: IBBoolean;
}, {
rect: IBRect[];
}>;
export type IBLabel = IBItem<{
id: string;
/** The main value. */
text: string;
opaque: IBBoolean;
fixedFrame: IBBoolean;
textAlignment?: IBTextAlignment;
lineBreakMode: 'clip' | 'characterWrap' | 'wordWrap' | 'headTruncation' | 'middleTruncation' | 'tailTruncation';
baselineAdjustment?: 'none' | 'alignBaselines';
adjustsFontSizeToFit: IBBoolean;
userInteractionEnabled: IBBoolean;
contentMode: IBContentMode;
horizontalHuggingPriority: number;
verticalHuggingPriority: number;
translatesAutoresizingMaskIntoConstraints?: IBBoolean;
}, {
/** @example `<rect key="frame" x="175" y="670" width="35" height="17"/>` */
rect: IBRect[];
/** @example `<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>` */
autoresizingMask?: IBAutoresizingMask[];
/** @example `<fontDescription key="fontDescription" type="system" pointSize="19"/>` */
fontDescription?: IBFontDescription[];
/** @example `<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>` */
color?: IBColor[];
nil?: IBItem<{
/** @example `textColor` `highlightedColor` */
key: string;
}>[];
}>;
export type IBTextAlignment = 'left' | 'center' | 'right' | 'justified' | 'natural';
export type IBContentMode = string | 'left' | 'scaleAspectFill';
export type IBConstraint = IBItem<{
firstItem: string;
firstAttribute: ConstraintAttribute;
secondItem: string;
secondAttribute: ConstraintAttribute;
constant?: number;
id: string;
}>;
export type IBViewController = IBItem<{
id: string;
placeholderIdentifier?: string;
userLabel: string;
sceneMemberID: string;
}, {
view: IBItem<{
id: string;
key: string;
userInteractionEnabled: IBBoolean;
contentMode: string | 'scaleToFill';
insetsLayoutMarginsFromSafeArea: IBBoolean;
userLabel: string;
}, {
rect: IBRect[];
autoresizingMask: IBItem<{
key: string;
flexibleMaxX: IBBoolean;
flexibleMaxY: IBBoolean;
}>[];
subviews: IBItem<object, {
imageView: IBImageView[];
label: IBLabel[];
}>[];
color: IBItem<{
key: string | 'backgroundColor';
systemColor: string | 'systemBackgroundColor';
}>[];
constraints: IBItem<object, {
constraint: IBConstraint[];
}>[];
viewLayoutGuide: IBItem<{
id: string;
key: string | 'safeArea';
}>[];
}>[];
}>;
export type IBPoint = IBItem<{
key: string | 'canvasLocation';
x: number;
y: number;
}>;
export type IBScene = IBItem<{
sceneID: string;
}, {
objects: {
viewController: IBViewController[];
placeholder: IBItem<{
id: string;
placeholderIdentifier?: string;
userLabel: string;
sceneMemberID: string;
}>[];
}[];
point: IBPoint[];
}>;
export type IBResourceImage = IBItem<{
name: string;
width: number;
height: number;
}>;
export type IBDevice = IBItem<{
id: string;
orientation: string | 'portrait';
appearance: string | 'light';
}>;
export type IBSplashScreenDocument = {
document: IBItem<{
type: 'com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB' | string;
version: '3.0' | string;
toolsVersion: number;
targetRuntime: 'iOS.CocoaTouch' | string;
propertyAccessControl: 'none' | string;
useAutolayout: IBBoolean;
launchScreen: IBBoolean;
useTraitCollections: IBBoolean;
useSafeAreas: IBBoolean;
colorMatched: IBBoolean;
initialViewController: string;
}, {
device: IBDevice[];
dependencies: unknown[];
scenes: {
scene: IBScene[];
}[];
resources: {
image: IBResourceImage[];
}[];
}>;
};
export declare function createConstraint([firstItem, firstAttribute]: [string, ConstraintAttribute], [secondItem, secondAttribute]: [string, ConstraintAttribute], constant?: number): IBConstraint;
export declare function createConstraintId(...attributes: string[]): string;
export declare function removeImageFromSplashScreen(xml: IBSplashScreenDocument, { imageName }: {
imageName: string;
}): IBSplashScreenDocument;
export declare function applyImageToSplashScreenXML(xml: IBSplashScreenDocument, { imageName, contentMode, }: {
imageName: string;
contentMode: ImageContentMode;
}): IBSplashScreenDocument;
/**
* IB does not allow two items to have the same ID.
* This method will add an item by first removing any existing item with the same `$.id`.
*/
export declare function ensureUniquePush<TItem extends {
$: {
id: string;
};
}>(array: TItem[], item: TItem): TItem[];
export declare function removeExisting<TItem extends {
$: {
id: string;
};
}>(array: TItem[], item: TItem | string): TItem[];
export declare function toString(xml: any): string;
/** Parse string contents into an object. */
export declare function toObjectAsync(contents: string): Promise<any>;

View File

@@ -0,0 +1,175 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.applyImageToSplashScreenXML = applyImageToSplashScreenXML;
exports.createConstraint = createConstraint;
exports.createConstraintId = createConstraintId;
exports.ensureUniquePush = ensureUniquePush;
exports.removeExisting = removeExisting;
exports.removeImageFromSplashScreen = removeImageFromSplashScreen;
exports.toObjectAsync = toObjectAsync;
exports.toString = toString;
function _crypto() {
const data = _interopRequireDefault(require("crypto"));
_crypto = function () {
return data;
};
return data;
}
function _xml2js() {
const data = require("xml2js");
_xml2js = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const debug = require('debug')('expo:prebuild-config:expo-splash-screen:ios:InterfaceBuilder');
/** @example `<color key="textColor" systemColor="linkColor"/>` */
function createConstraint([firstItem, firstAttribute], [secondItem, secondAttribute], constant) {
return {
$: {
firstItem,
firstAttribute,
secondItem,
secondAttribute,
constant,
// Prevent updating between runs
id: createConstraintId(firstItem, firstAttribute, secondItem, secondAttribute)
}
};
}
function createConstraintId(...attributes) {
return _crypto().default.createHash('sha1').update(attributes.join('-')).digest('hex');
}
const IMAGE_ID = 'EXPO-SplashScreen';
const CONTAINER_ID = 'EXPO-ContainerView';
function removeImageFromSplashScreen(xml, {
imageName
}) {
const mainView = xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0];
debug(`Remove all splash screen image elements`);
removeExisting(mainView.subviews[0].imageView, IMAGE_ID);
// Add Constraints
getAbsoluteConstraints(IMAGE_ID, CONTAINER_ID).forEach(constraint => {
// <constraint firstItem="EXPO-SplashScreen" firstAttribute="top" secondItem="EXPO-ContainerView" secondAttribute="top" id="2VS-Uz-0LU"/>
const constrainsArray = mainView.constraints[0].constraint;
removeExisting(constrainsArray, constraint);
});
// Add resource
const imageSection = xml.document.resources[0].image;
const existingImageIndex = imageSection.findIndex(image => image.$.name === imageName);
if (existingImageIndex > -1) {
imageSection.splice(existingImageIndex, 1);
}
return xml;
}
function getAbsoluteConstraints(childId, parentId) {
return [createConstraint([childId, 'top'], [parentId, 'top']), createConstraint([childId, 'leading'], [parentId, 'leading']), createConstraint([childId, 'trailing'], [parentId, 'trailing']), createConstraint([childId, 'bottom'], [parentId, 'bottom'])];
}
function applyImageToSplashScreenXML(xml, {
imageName,
contentMode
}) {
const width = 414;
const height = 736;
const imageView = {
$: {
id: IMAGE_ID,
userLabel: imageName,
image: imageName,
contentMode,
horizontalHuggingPriority: 251,
verticalHuggingPriority: 251,
clipsSubviews: true,
userInteractionEnabled: false,
translatesAutoresizingMaskIntoConstraints: false
},
rect: [{
$: {
key: 'frame',
x: 0.0,
y: 0.0,
width,
height
}
}]
};
const mainView = xml.document.scenes[0].scene[0].objects[0].viewController[0].view[0];
// Add ImageView
ensureUniquePush(mainView.subviews[0].imageView, imageView);
// Add Constraints
getAbsoluteConstraints(IMAGE_ID, CONTAINER_ID).forEach(constraint => {
// <constraint firstItem="EXPO-SplashScreen" firstAttribute="top" secondItem="EXPO-ContainerView" secondAttribute="top" id="2VS-Uz-0LU"/>
const constrainsArray = mainView.constraints[0].constraint;
ensureUniquePush(constrainsArray, constraint);
});
// Add resource
const imageSection = xml.document.resources[0].image;
const existingImageIndex = imageSection.findIndex(image => image.$.name === imageName);
if (existingImageIndex > -1) {
debug(`Removing existing IB image asset at index ${existingImageIndex}`);
imageSection.splice(existingImageIndex, 1);
}
imageSection.push({
// <image name="SplashScreen" width="414" height="736"/>
$: {
name: imageName,
width,
height
}
});
return xml;
}
/**
* IB does not allow two items to have the same ID.
* This method will add an item by first removing any existing item with the same `$.id`.
*/
function ensureUniquePush(array, item) {
if (!array) return array;
removeExisting(array, item);
array.push(item);
return array;
}
function removeExisting(array, item) {
const id = typeof item === 'string' ? item : item.$?.id;
const existingItem = array?.findIndex(existingItem => existingItem.$.id === id);
if (existingItem > -1) {
debug(`Removing existing IB item with id ${id}, from: %O`, array);
array.splice(existingItem, 1);
}
return array;
}
// Attempt to copy Xcode formatting.
function toString(xml) {
const builder = new (_xml2js().Builder)({
// @ts-expect-error: untyped
preserveChildrenOrder: true,
xmldec: {
version: '1.0',
encoding: 'UTF-8'
},
renderOpts: {
pretty: true,
indent: ' '
}
});
return builder.buildObject(xml);
}
/** Parse string contents into an object. */
function toObjectAsync(contents) {
return new (_xml2js().Parser)().parseStringPromise(contents);
}
//# sourceMappingURL=InterfaceBuilder.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
declare const _default: import("@expo/config-plugins").ConfigPlugin;
export default _default;

View File

@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _withAndroidSplashScreen() {
const data = require("./withAndroidSplashScreen");
_withAndroidSplashScreen = function () {
return data;
};
return data;
}
function _withIosSplashScreen() {
const data = require("./withIosSplashScreen");
_withIosSplashScreen = function () {
return data;
};
return data;
}
function _createLegacyPlugin() {
const data = require("../createLegacyPlugin");
_createLegacyPlugin = function () {
return data;
};
return data;
}
var _default = exports.default = (0, _createLegacyPlugin().createLegacyPlugin)({
packageName: 'expo-splash-screen',
fallback: [_withAndroidSplashScreen().withAndroidSplashScreen, _withIosSplashScreen().withIosSplashScreen]
});
//# sourceMappingURL=expo-splash-screen.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"expo-splash-screen.js","names":["_withAndroidSplashScreen","data","require","_withIosSplashScreen","_createLegacyPlugin","_default","exports","default","createLegacyPlugin","packageName","fallback","withAndroidSplashScreen","withIosSplashScreen"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/expo-splash-screen.ts"],"sourcesContent":["import { withAndroidSplashScreen } from './withAndroidSplashScreen';\nimport { withIosSplashScreen } from './withIosSplashScreen';\nimport { createLegacyPlugin } from '../createLegacyPlugin';\n\nexport default createLegacyPlugin({\n packageName: 'expo-splash-screen',\n fallback: [withAndroidSplashScreen, withIosSplashScreen],\n});\n"],"mappings":";;;;;;AAAA,SAAAA,yBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,wBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,qBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,oBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,oBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,mBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA2D,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAE5C,IAAAC,wCAAkB,EAAC;EAChCC,WAAW,EAAE,oBAAoB;EACjCC,QAAQ,EAAE,CAACC,kDAAuB,EAAEC,0CAAmB;AACzD,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,12 @@
import { ExpoConfig } from '@expo/config-types';
export type SplashScreenConfig = {
xxxhdpi: string | null;
xxhdpi: string | null;
xhdpi: string | null;
hdpi: string | null;
mdpi: string | null;
backgroundColor: string | null;
resizeMode: 'contain' | 'cover' | 'native';
};
export declare function getAndroidSplashConfig(config: Pick<ExpoConfig, 'splash' | 'android'>): SplashScreenConfig | null;
export declare function getAndroidDarkSplashConfig(config: Pick<ExpoConfig, 'splash' | 'android'>): SplashScreenConfig | null;

View File

@@ -0,0 +1,57 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getAndroidDarkSplashConfig = getAndroidDarkSplashConfig;
exports.getAndroidSplashConfig = getAndroidSplashConfig;
const defaultResizeMode = 'contain';
function getAndroidSplashConfig(config) {
// Respect the splash screen object, don't mix and match across different splash screen objects
// in case the user wants the top level splash to apply to every platform except android.
if (config.android?.splash) {
const splash = config.android?.splash;
return {
xxxhdpi: splash.xxxhdpi ?? splash.image ?? null,
xxhdpi: splash.xxhdpi ?? splash.image ?? null,
xhdpi: splash.xhdpi ?? splash.image ?? null,
hdpi: splash.hdpi ?? splash.image ?? null,
mdpi: splash.mdpi ?? splash.image ?? null,
backgroundColor: splash.backgroundColor ?? null,
resizeMode: splash.resizeMode ?? defaultResizeMode
};
}
if (config.splash) {
const splash = config.splash;
return {
xxxhdpi: splash.image ?? null,
xxhdpi: splash.image ?? null,
xhdpi: splash.image ?? null,
hdpi: splash.image ?? null,
mdpi: splash.image ?? null,
backgroundColor: splash.backgroundColor ?? null,
resizeMode: splash.resizeMode ?? defaultResizeMode
};
}
return null;
}
function getAndroidDarkSplashConfig(config) {
// Respect the splash screen object, don't mix and match across different splash screen objects
// in case the user wants the top level splash to apply to every platform except android.
if (config.android?.splash?.dark) {
const splash = config.android?.splash?.dark;
const lightTheme = getAndroidSplashConfig(config);
return {
xxxhdpi: splash.xxxhdpi ?? splash.image ?? null,
xxhdpi: splash.xxhdpi ?? splash.image ?? null,
xhdpi: splash.xhdpi ?? splash.image ?? null,
hdpi: splash.hdpi ?? splash.image ?? null,
mdpi: splash.mdpi ?? splash.image ?? null,
backgroundColor: splash.backgroundColor ?? null,
// Can't support dark resizeMode because the resize mode is hardcoded into the MainActivity.java
resizeMode: lightTheme?.resizeMode ?? defaultResizeMode
};
}
return null;
}
//# sourceMappingURL=getAndroidSplashConfig.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getAndroidSplashConfig.js","names":["defaultResizeMode","getAndroidSplashConfig","config","android","splash","xxxhdpi","image","xxhdpi","xhdpi","hdpi","mdpi","backgroundColor","resizeMode","getAndroidDarkSplashConfig","dark","lightTheme"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/getAndroidSplashConfig.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nexport type SplashScreenConfig = {\n xxxhdpi: string | null;\n xxhdpi: string | null;\n xhdpi: string | null;\n hdpi: string | null;\n mdpi: string | null;\n backgroundColor: string | null;\n resizeMode: 'contain' | 'cover' | 'native';\n};\n\nconst defaultResizeMode = 'contain';\n\nexport function getAndroidSplashConfig(\n config: Pick<ExpoConfig, 'splash' | 'android'>\n): SplashScreenConfig | null {\n // Respect the splash screen object, don't mix and match across different splash screen objects\n // in case the user wants the top level splash to apply to every platform except android.\n if (config.android?.splash) {\n const splash = config.android?.splash;\n return {\n xxxhdpi: splash.xxxhdpi ?? splash.image ?? null,\n xxhdpi: splash.xxhdpi ?? splash.image ?? null,\n xhdpi: splash.xhdpi ?? splash.image ?? null,\n hdpi: splash.hdpi ?? splash.image ?? null,\n mdpi: splash.mdpi ?? splash.image ?? null,\n backgroundColor: splash.backgroundColor ?? null,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n };\n }\n\n if (config.splash) {\n const splash = config.splash;\n return {\n xxxhdpi: splash.image ?? null,\n xxhdpi: splash.image ?? null,\n xhdpi: splash.image ?? null,\n hdpi: splash.image ?? null,\n mdpi: splash.image ?? null,\n backgroundColor: splash.backgroundColor ?? null,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n };\n }\n\n return null;\n}\n\nexport function getAndroidDarkSplashConfig(\n config: Pick<ExpoConfig, 'splash' | 'android'>\n): SplashScreenConfig | null {\n // Respect the splash screen object, don't mix and match across different splash screen objects\n // in case the user wants the top level splash to apply to every platform except android.\n if (config.android?.splash?.dark) {\n const splash = config.android?.splash?.dark;\n const lightTheme = getAndroidSplashConfig(config);\n return {\n xxxhdpi: splash.xxxhdpi ?? splash.image ?? null,\n xxhdpi: splash.xxhdpi ?? splash.image ?? null,\n xhdpi: splash.xhdpi ?? splash.image ?? null,\n hdpi: splash.hdpi ?? splash.image ?? null,\n mdpi: splash.mdpi ?? splash.image ?? null,\n backgroundColor: splash.backgroundColor ?? null,\n // Can't support dark resizeMode because the resize mode is hardcoded into the MainActivity.java\n resizeMode: lightTheme?.resizeMode ?? defaultResizeMode,\n };\n }\n\n return null;\n}\n"],"mappings":";;;;;;;AAYA,MAAMA,iBAAiB,GAAG,SAAS;AAE5B,SAASC,sBAAsBA,CACpCC,MAA8C,EACnB;EAC3B;EACA;EACA,IAAIA,MAAM,CAACC,OAAO,EAAEC,MAAM,EAAE;IAC1B,MAAMA,MAAM,GAAGF,MAAM,CAACC,OAAO,EAAEC,MAAM;IACrC,OAAO;MACLC,OAAO,EAAED,MAAM,CAACC,OAAO,IAAID,MAAM,CAACE,KAAK,IAAI,IAAI;MAC/CC,MAAM,EAAEH,MAAM,CAACG,MAAM,IAAIH,MAAM,CAACE,KAAK,IAAI,IAAI;MAC7CE,KAAK,EAAEJ,MAAM,CAACI,KAAK,IAAIJ,MAAM,CAACE,KAAK,IAAI,IAAI;MAC3CG,IAAI,EAAEL,MAAM,CAACK,IAAI,IAAIL,MAAM,CAACE,KAAK,IAAI,IAAI;MACzCI,IAAI,EAAEN,MAAM,CAACM,IAAI,IAAIN,MAAM,CAACE,KAAK,IAAI,IAAI;MACzCK,eAAe,EAAEP,MAAM,CAACO,eAAe,IAAI,IAAI;MAC/CC,UAAU,EAAER,MAAM,CAACQ,UAAU,IAAIZ;IACnC,CAAC;EACH;EAEA,IAAIE,MAAM,CAACE,MAAM,EAAE;IACjB,MAAMA,MAAM,GAAGF,MAAM,CAACE,MAAM;IAC5B,OAAO;MACLC,OAAO,EAAED,MAAM,CAACE,KAAK,IAAI,IAAI;MAC7BC,MAAM,EAAEH,MAAM,CAACE,KAAK,IAAI,IAAI;MAC5BE,KAAK,EAAEJ,MAAM,CAACE,KAAK,IAAI,IAAI;MAC3BG,IAAI,EAAEL,MAAM,CAACE,KAAK,IAAI,IAAI;MAC1BI,IAAI,EAAEN,MAAM,CAACE,KAAK,IAAI,IAAI;MAC1BK,eAAe,EAAEP,MAAM,CAACO,eAAe,IAAI,IAAI;MAC/CC,UAAU,EAAER,MAAM,CAACQ,UAAU,IAAIZ;IACnC,CAAC;EACH;EAEA,OAAO,IAAI;AACb;AAEO,SAASa,0BAA0BA,CACxCX,MAA8C,EACnB;EAC3B;EACA;EACA,IAAIA,MAAM,CAACC,OAAO,EAAEC,MAAM,EAAEU,IAAI,EAAE;IAChC,MAAMV,MAAM,GAAGF,MAAM,CAACC,OAAO,EAAEC,MAAM,EAAEU,IAAI;IAC3C,MAAMC,UAAU,GAAGd,sBAAsB,CAACC,MAAM,CAAC;IACjD,OAAO;MACLG,OAAO,EAAED,MAAM,CAACC,OAAO,IAAID,MAAM,CAACE,KAAK,IAAI,IAAI;MAC/CC,MAAM,EAAEH,MAAM,CAACG,MAAM,IAAIH,MAAM,CAACE,KAAK,IAAI,IAAI;MAC7CE,KAAK,EAAEJ,MAAM,CAACI,KAAK,IAAIJ,MAAM,CAACE,KAAK,IAAI,IAAI;MAC3CG,IAAI,EAAEL,MAAM,CAACK,IAAI,IAAIL,MAAM,CAACE,KAAK,IAAI,IAAI;MACzCI,IAAI,EAAEN,MAAM,CAACM,IAAI,IAAIN,MAAM,CAACE,KAAK,IAAI,IAAI;MACzCK,eAAe,EAAEP,MAAM,CAACO,eAAe,IAAI,IAAI;MAC/C;MACAC,UAAU,EAAEG,UAAU,EAAEH,UAAU,IAAIZ;IACxC,CAAC;EACH;EAEA,OAAO,IAAI;AACb","ignoreList":[]}

View File

@@ -0,0 +1,17 @@
import { ExpoConfig } from '@expo/config-types';
type ExpoConfigIosSplash = NonNullable<NonNullable<ExpoConfig['ios']>['splash']>;
export interface IOSSplashConfig {
image?: string | null;
backgroundColor: string;
resizeMode: NonNullable<ExpoConfigIosSplash['resizeMode']>;
tabletImage: string | null;
tabletBackgroundColor: string | null;
dark?: {
image?: string | null;
backgroundColor?: string | null;
tabletImage?: string | null;
tabletBackgroundColor?: string | null;
};
}
export declare function getIosSplashConfig(config: ExpoConfig): IOSSplashConfig | null;
export {};

View File

@@ -0,0 +1,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getIosSplashConfig = getIosSplashConfig;
const defaultResizeMode = 'contain';
const defaultBackgroundColor = '#ffffff';
// TODO: Maybe use an array on splash with theme value. Then remove the array in serialization for legacy and manifest.
function getIosSplashConfig(config) {
// Respect the splash screen object, don't mix and match across different splash screen objects
// in case the user wants the top level splash to apply to every platform except iOS.
if (config.ios?.splash) {
const splash = config.ios?.splash;
const image = splash.image ?? null;
return {
image,
resizeMode: splash.resizeMode ?? defaultResizeMode,
backgroundColor: splash.backgroundColor ?? defaultBackgroundColor,
tabletImage: splash.tabletImage ?? null,
tabletBackgroundColor: splash.tabletBackgroundColor,
dark: {
image: splash.dark?.image ?? null,
backgroundColor: splash.dark?.backgroundColor,
tabletImage: splash.dark?.tabletImage ?? null,
tabletBackgroundColor: splash.dark?.tabletBackgroundColor
}
};
}
if (config.splash) {
const splash = config.splash;
const image = splash.image ?? null;
return {
image,
resizeMode: splash.resizeMode ?? defaultResizeMode,
backgroundColor: splash.backgroundColor ?? defaultBackgroundColor,
tabletImage: null,
tabletBackgroundColor: null,
dark: {
image: null,
backgroundColor: null,
tabletImage: null,
tabletBackgroundColor: null
}
};
}
return {
backgroundColor: '#ffffff',
resizeMode: 'contain',
tabletImage: null,
tabletBackgroundColor: null
};
}
//# sourceMappingURL=getIosSplashConfig.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getIosSplashConfig.js","names":["defaultResizeMode","defaultBackgroundColor","getIosSplashConfig","config","ios","splash","image","resizeMode","backgroundColor","tabletImage","tabletBackgroundColor","dark"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/getIosSplashConfig.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\ntype ExpoConfigIosSplash = NonNullable<NonNullable<ExpoConfig['ios']>['splash']>;\n\nconst defaultResizeMode = 'contain';\nconst defaultBackgroundColor = '#ffffff';\n\nexport interface IOSSplashConfig {\n image?: string | null;\n // tabletImage: string | null;\n backgroundColor: string;\n resizeMode: NonNullable<ExpoConfigIosSplash['resizeMode']>;\n tabletImage: string | null;\n // TODO: These are here just to test the functionality, the API should be more robust and account for tablet images.\n tabletBackgroundColor: string | null;\n dark?: {\n image?: string | null;\n backgroundColor?: string | null;\n tabletImage?: string | null;\n tabletBackgroundColor?: string | null;\n };\n}\n\n// TODO: Maybe use an array on splash with theme value. Then remove the array in serialization for legacy and manifest.\nexport function getIosSplashConfig(config: ExpoConfig): IOSSplashConfig | null {\n // Respect the splash screen object, don't mix and match across different splash screen objects\n // in case the user wants the top level splash to apply to every platform except iOS.\n if (config.ios?.splash) {\n const splash = config.ios?.splash;\n const image = splash.image ?? null;\n return {\n image,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n backgroundColor: splash.backgroundColor ?? defaultBackgroundColor,\n tabletImage: splash.tabletImage ?? null,\n tabletBackgroundColor: splash.tabletBackgroundColor,\n dark: {\n image: splash.dark?.image ?? null,\n backgroundColor: splash.dark?.backgroundColor,\n tabletImage: splash.dark?.tabletImage ?? null,\n tabletBackgroundColor: splash.dark?.tabletBackgroundColor,\n },\n };\n }\n\n if (config.splash) {\n const splash = config.splash;\n const image = splash.image ?? null;\n return {\n image,\n resizeMode: splash.resizeMode ?? defaultResizeMode,\n backgroundColor: splash.backgroundColor ?? defaultBackgroundColor,\n tabletImage: null,\n tabletBackgroundColor: null,\n dark: {\n image: null,\n backgroundColor: null,\n tabletImage: null,\n tabletBackgroundColor: null,\n },\n };\n }\n\n return {\n backgroundColor: '#ffffff',\n resizeMode: 'contain',\n tabletImage: null,\n tabletBackgroundColor: null,\n };\n}\n"],"mappings":";;;;;;AAIA,MAAMA,iBAAiB,GAAG,SAAS;AACnC,MAAMC,sBAAsB,GAAG,SAAS;AAkBxC;AACO,SAASC,kBAAkBA,CAACC,MAAkB,EAA0B;EAC7E;EACA;EACA,IAAIA,MAAM,CAACC,GAAG,EAAEC,MAAM,EAAE;IACtB,MAAMA,MAAM,GAAGF,MAAM,CAACC,GAAG,EAAEC,MAAM;IACjC,MAAMC,KAAK,GAAGD,MAAM,CAACC,KAAK,IAAI,IAAI;IAClC,OAAO;MACLA,KAAK;MACLC,UAAU,EAAEF,MAAM,CAACE,UAAU,IAAIP,iBAAiB;MAClDQ,eAAe,EAAEH,MAAM,CAACG,eAAe,IAAIP,sBAAsB;MACjEQ,WAAW,EAAEJ,MAAM,CAACI,WAAW,IAAI,IAAI;MACvCC,qBAAqB,EAAEL,MAAM,CAACK,qBAAqB;MACnDC,IAAI,EAAE;QACJL,KAAK,EAAED,MAAM,CAACM,IAAI,EAAEL,KAAK,IAAI,IAAI;QACjCE,eAAe,EAAEH,MAAM,CAACM,IAAI,EAAEH,eAAe;QAC7CC,WAAW,EAAEJ,MAAM,CAACM,IAAI,EAAEF,WAAW,IAAI,IAAI;QAC7CC,qBAAqB,EAAEL,MAAM,CAACM,IAAI,EAAED;MACtC;IACF,CAAC;EACH;EAEA,IAAIP,MAAM,CAACE,MAAM,EAAE;IACjB,MAAMA,MAAM,GAAGF,MAAM,CAACE,MAAM;IAC5B,MAAMC,KAAK,GAAGD,MAAM,CAACC,KAAK,IAAI,IAAI;IAClC,OAAO;MACLA,KAAK;MACLC,UAAU,EAAEF,MAAM,CAACE,UAAU,IAAIP,iBAAiB;MAClDQ,eAAe,EAAEH,MAAM,CAACG,eAAe,IAAIP,sBAAsB;MACjEQ,WAAW,EAAE,IAAI;MACjBC,qBAAqB,EAAE,IAAI;MAC3BC,IAAI,EAAE;QACJL,KAAK,EAAE,IAAI;QACXE,eAAe,EAAE,IAAI;QACrBC,WAAW,EAAE,IAAI;QACjBC,qBAAqB,EAAE;MACzB;IACF,CAAC;EACH;EAEA,OAAO;IACLF,eAAe,EAAE,SAAS;IAC1BD,UAAU,EAAE,SAAS;IACrBE,WAAW,EAAE,IAAI;IACjBC,qBAAqB,EAAE;EACzB,CAAC;AACH","ignoreList":[]}

View File

@@ -0,0 +1,4 @@
import { ConfigPlugin } from '@expo/config-plugins';
import { SplashScreenConfig } from './getAndroidSplashConfig';
export declare const withAndroidSplashDrawables: ConfigPlugin<Pick<SplashScreenConfig, 'resizeMode'>>;
export declare function setSplashDrawableAsync({ resizeMode }: Pick<SplashScreenConfig, 'resizeMode'>, projectRoot: string): Promise<void>;

View File

@@ -0,0 +1,61 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.setSplashDrawableAsync = setSplashDrawableAsync;
exports.withAndroidSplashDrawables = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
const withAndroidSplashDrawables = (config, splash) => {
return (0, _configPlugins().withDangerousMod)(config, ['android', async config => {
if (splash) {
await setSplashDrawableAsync(splash, config.modRequest.projectRoot);
}
return config;
}]);
};
exports.withAndroidSplashDrawables = withAndroidSplashDrawables;
async function setSplashDrawableAsync({
resizeMode
}, projectRoot) {
const filePath = await _configPlugins().AndroidConfig.Paths.getResourceXMLPathAsync(projectRoot, {
name: 'splashscreen',
kind: 'drawable'
});
// Nuke and rewrite the splashscreen.xml drawable
const xmlContent = {
'layer-list': {
$: {
'xmlns:android': 'http://schemas.android.com/apk/res/android'
},
item: [{
$: {
// TODO: Ensure these keys don't get out of sync
'android:drawable': '@color/splashscreen_background'
}
},
// Only include the image if resizeMode native is in-use.
resizeMode === 'native' && {
bitmap: [{
$: {
'android:gravity': 'center',
// TODO: Ensure these keys don't get out of sync
'android:src': '@drawable/splashscreen_image'
}
}]
}].filter(Boolean)
}
};
await _configPlugins().XML.writeXMLAsync({
path: filePath,
xml: xmlContent
});
}
//# sourceMappingURL=withAndroidSplashDrawables.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"withAndroidSplashDrawables.js","names":["_configPlugins","data","require","withAndroidSplashDrawables","config","splash","withDangerousMod","setSplashDrawableAsync","modRequest","projectRoot","exports","resizeMode","filePath","AndroidConfig","Paths","getResourceXMLPathAsync","name","kind","xmlContent","$","item","bitmap","filter","Boolean","XML","writeXMLAsync","path","xml"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashDrawables.ts"],"sourcesContent":["import { AndroidConfig, ConfigPlugin, withDangerousMod, XML } from '@expo/config-plugins';\n\nimport { SplashScreenConfig } from './getAndroidSplashConfig';\n\nexport const withAndroidSplashDrawables: ConfigPlugin<Pick<SplashScreenConfig, 'resizeMode'>> = (\n config,\n splash\n) => {\n return withDangerousMod(config, [\n 'android',\n async (config) => {\n if (splash) {\n await setSplashDrawableAsync(splash, config.modRequest.projectRoot);\n }\n return config;\n },\n ]);\n};\n\nexport async function setSplashDrawableAsync(\n { resizeMode }: Pick<SplashScreenConfig, 'resizeMode'>,\n projectRoot: string\n) {\n const filePath = (await AndroidConfig.Paths.getResourceXMLPathAsync(projectRoot, {\n name: 'splashscreen',\n kind: 'drawable',\n }))!;\n\n // Nuke and rewrite the splashscreen.xml drawable\n const xmlContent = {\n 'layer-list': {\n $: {\n 'xmlns:android': 'http://schemas.android.com/apk/res/android',\n },\n item: [\n {\n $: {\n // TODO: Ensure these keys don't get out of sync\n 'android:drawable': '@color/splashscreen_background',\n },\n },\n // Only include the image if resizeMode native is in-use.\n resizeMode === 'native' && {\n bitmap: [\n {\n $: {\n 'android:gravity': 'center',\n // TODO: Ensure these keys don't get out of sync\n 'android:src': '@drawable/splashscreen_image',\n },\n },\n ],\n },\n ].filter(Boolean),\n },\n };\n await XML.writeXMLAsync({ path: filePath, xml: xmlContent });\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIO,MAAME,0BAAgF,GAAGA,CAC9FC,MAAM,EACNC,MAAM,KACH;EACH,OAAO,IAAAC,iCAAgB,EAACF,MAAM,EAAE,CAC9B,SAAS,EACT,MAAOA,MAAM,IAAK;IAChB,IAAIC,MAAM,EAAE;MACV,MAAME,sBAAsB,CAACF,MAAM,EAAED,MAAM,CAACI,UAAU,CAACC,WAAW,CAAC;IACrE;IACA,OAAOL,MAAM;EACf,CAAC,CACF,CAAC;AACJ,CAAC;AAACM,OAAA,CAAAP,0BAAA,GAAAA,0BAAA;AAEK,eAAeI,sBAAsBA,CAC1C;EAAEI;AAAmD,CAAC,EACtDF,WAAmB,EACnB;EACA,MAAMG,QAAQ,GAAI,MAAMC,8BAAa,CAACC,KAAK,CAACC,uBAAuB,CAACN,WAAW,EAAE;IAC/EO,IAAI,EAAE,cAAc;IACpBC,IAAI,EAAE;EACR,CAAC,CAAG;;EAEJ;EACA,MAAMC,UAAU,GAAG;IACjB,YAAY,EAAE;MACZC,CAAC,EAAE;QACD,eAAe,EAAE;MACnB,CAAC;MACDC,IAAI,EAAE,CACJ;QACED,CAAC,EAAE;UACD;UACA,kBAAkB,EAAE;QACtB;MACF,CAAC;MACD;MACAR,UAAU,KAAK,QAAQ,IAAI;QACzBU,MAAM,EAAE,CACN;UACEF,CAAC,EAAE;YACD,iBAAiB,EAAE,QAAQ;YAC3B;YACA,aAAa,EAAE;UACjB;QACF,CAAC;MAEL,CAAC,CACF,CAACG,MAAM,CAACC,OAAO;IAClB;EACF,CAAC;EACD,MAAMC,oBAAG,CAACC,aAAa,CAAC;IAAEC,IAAI,EAAEd,QAAQ;IAAEe,GAAG,EAAET;EAAW,CAAC,CAAC;AAC9D","ignoreList":[]}

View File

@@ -0,0 +1,13 @@
import { ConfigPlugin } from '@expo/config-plugins';
import { ExpoConfig } from '@expo/config-types';
import { SplashScreenConfig } from './getAndroidSplashConfig';
export declare const withAndroidSplashImages: ConfigPlugin;
/**
* Deletes all previous splash_screen_images and copies new one to desired drawable directory.
* If path isn't provided then no new image is placed in drawable directories.
* @see https://developer.android.com/training/multiscreen/screendensities
*
* @param androidMainPath Absolute path to the main directory containing code and resources in Android project. In general that would be `android/app/src/main`.
*/
export declare function setSplashImageDrawablesAsync(config: Pick<ExpoConfig, 'android' | 'splash'>, projectRoot: string): Promise<void>;
export declare function setSplashImageDrawablesForThemeAsync(config: SplashScreenConfig | null, theme: 'dark' | 'light', projectRoot: string): Promise<void>;

View File

@@ -0,0 +1,181 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.setSplashImageDrawablesAsync = setSplashImageDrawablesAsync;
exports.setSplashImageDrawablesForThemeAsync = setSplashImageDrawablesForThemeAsync;
exports.withAndroidSplashImages = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
function _imageUtils() {
const data = require("@expo/image-utils");
_imageUtils = function () {
return data;
};
return data;
}
function _fsExtra() {
const data = _interopRequireDefault(require("fs-extra"));
_fsExtra = function () {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _getAndroidSplashConfig() {
const data = require("./getAndroidSplashConfig");
_getAndroidSplashConfig = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const IMAGE_CACHE_NAME = 'splash-android';
const SPLASH_SCREEN_FILENAME = 'splashscreen_image.png';
const DRAWABLES_CONFIGS = {
default: {
modes: {
light: {
path: `./res/drawable/${SPLASH_SCREEN_FILENAME}`
},
dark: {
path: `./res/drawable-night/${SPLASH_SCREEN_FILENAME}`
}
},
dimensionsMultiplier: 1
},
mdpi: {
modes: {
light: {
path: `./res/drawable-mdpi/${SPLASH_SCREEN_FILENAME}`
},
dark: {
path: `./res/drawable-night-mdpi/${SPLASH_SCREEN_FILENAME}`
}
},
dimensionsMultiplier: 1
},
hdpi: {
modes: {
light: {
path: `./res/drawable-hdpi/${SPLASH_SCREEN_FILENAME}`
},
dark: {
path: `./res/drawable-night-hdpi/${SPLASH_SCREEN_FILENAME}`
}
},
dimensionsMultiplier: 1.5
},
xhdpi: {
modes: {
light: {
path: `./res/drawable-xhdpi/${SPLASH_SCREEN_FILENAME}`
},
dark: {
path: `./res/drawable-night-xhdpi/${SPLASH_SCREEN_FILENAME}`
}
},
dimensionsMultiplier: 2
},
xxhdpi: {
modes: {
light: {
path: `./res/drawable-xxhdpi/${SPLASH_SCREEN_FILENAME}`
},
dark: {
path: `./res/drawable-night-xxhdpi/${SPLASH_SCREEN_FILENAME}`
}
},
dimensionsMultiplier: 3
},
xxxhdpi: {
modes: {
light: {
path: `./res/drawable-xxxhdpi/${SPLASH_SCREEN_FILENAME}`
},
dark: {
path: `./res/drawable-night-xxxhdpi/${SPLASH_SCREEN_FILENAME}`
}
},
dimensionsMultiplier: 4
}
};
const withAndroidSplashImages = config => {
return (0, _configPlugins().withDangerousMod)(config, ['android', async config => {
await setSplashImageDrawablesAsync(config, config.modRequest.projectRoot);
return config;
}]);
};
/**
* Deletes all previous splash_screen_images and copies new one to desired drawable directory.
* If path isn't provided then no new image is placed in drawable directories.
* @see https://developer.android.com/training/multiscreen/screendensities
*
* @param androidMainPath Absolute path to the main directory containing code and resources in Android project. In general that would be `android/app/src/main`.
*/
exports.withAndroidSplashImages = withAndroidSplashImages;
async function setSplashImageDrawablesAsync(config, projectRoot) {
await clearAllExistingSplashImagesAsync(projectRoot);
const splash = (0, _getAndroidSplashConfig().getAndroidSplashConfig)(config);
const darkSplash = (0, _getAndroidSplashConfig().getAndroidDarkSplashConfig)(config);
await Promise.all([setSplashImageDrawablesForThemeAsync(splash, 'light', projectRoot), setSplashImageDrawablesForThemeAsync(darkSplash, 'dark', projectRoot)]);
}
async function clearAllExistingSplashImagesAsync(projectRoot) {
const androidMainPath = _path().default.join(projectRoot, 'android/app/src/main');
await Promise.all(Object.values(DRAWABLES_CONFIGS).map(async ({
modes
}) => {
await Promise.all(Object.values(modes).map(async ({
path: filePath
}) => {
if (await _fsExtra().default.pathExists(_path().default.resolve(androidMainPath, filePath))) {
await _fsExtra().default.remove(_path().default.resolve(androidMainPath, filePath));
}
}));
}));
}
async function setSplashImageDrawablesForThemeAsync(config, theme, projectRoot) {
if (!config) return;
const androidMainPath = _path().default.join(projectRoot, 'android/app/src/main');
await Promise.all(['mdpi', 'hdpi', 'xhdpi', 'xxhdpi', 'xxxhdpi'].map(async imageKey => {
// @ts-ignore
const image = config[imageKey];
if (image) {
// Using this method will cache the images in `.expo` based on the properties used to generate them.
// this method also supports remote URLs and using the global sharp instance.
const {
source
} = await (0, _imageUtils().generateImageAsync)({
projectRoot,
cacheType: IMAGE_CACHE_NAME
}, {
src: image
});
// Get output path for drawable.
const outputPath = _path().default.join(androidMainPath,
// @ts-ignore
DRAWABLES_CONFIGS[imageKey].modes[theme].path);
// Ensure directory exists.
const folder = _path().default.dirname(outputPath);
await _fsExtra().default.ensureDir(folder);
// Write image buffer to the file system.
await _fsExtra().default.writeFile(outputPath, source);
}
return null;
}));
}
//# sourceMappingURL=withAndroidSplashImages.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
import { ConfigPlugin } from '@expo/config-plugins';
import { ExpoConfig } from '@expo/config-types';
export declare const withAndroidSplashLegacyMainActivity: ConfigPlugin;
export declare function setSplashScreenLegacyMainActivity(config: Pick<ExpoConfig, 'android' | 'androidStatusBar' | 'userInterfaceStyle'>, mainActivity: string, language: 'java' | 'kt'): string;

View File

@@ -0,0 +1,117 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.setSplashScreenLegacyMainActivity = setSplashScreenLegacyMainActivity;
exports.withAndroidSplashLegacyMainActivity = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
function _codeMod() {
const data = require("@expo/config-plugins/build/android/codeMod");
_codeMod = function () {
return data;
};
return data;
}
function _generateCode() {
const data = require("@expo/config-plugins/build/utils/generateCode");
_generateCode = function () {
return data;
};
return data;
}
function _debug() {
const data = _interopRequireDefault(require("debug"));
_debug = function () {
return data;
};
return data;
}
function _getAndroidSplashConfig() {
const data = require("./getAndroidSplashConfig");
_getAndroidSplashConfig = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const debug = (0, _debug().default)('expo:prebuild-config:expo-splash-screen:android:mainActivity');
// DO NOT CHANGE
const SHOW_SPLASH_ID = 'expo-splash-screen-mainActivity-onCreate-show-splash';
const withAndroidSplashLegacyMainActivity = config => {
return (0, _configPlugins().withMainActivity)(config, config => {
config.modResults.contents = setSplashScreenLegacyMainActivity(config, config.modResults.contents, config.modResults.language);
return config;
});
};
exports.withAndroidSplashLegacyMainActivity = withAndroidSplashLegacyMainActivity;
function setSplashScreenLegacyMainActivity(config, mainActivity, language) {
debug(`Modify with language: "${language}"`);
const splashConfig = (0, _getAndroidSplashConfig().getAndroidSplashConfig)(config);
if (!splashConfig) {
// Remove our generated code safely...
const mod = (0, _generateCode().removeContents)({
src: mainActivity,
tag: SHOW_SPLASH_ID
});
mainActivity = mod.contents;
if (mod.didClear) {
debug('Removed SplashScreen.show()');
}
return mainActivity;
}
// TODO: Translucent is weird
const statusBarTranslucent = !!config.androidStatusBar?.translucent;
const {
resizeMode
} = splashConfig;
const isJava = language === 'java';
const LE = isJava ? ';' : '';
mainActivity = (0, _codeMod().addImports)(mainActivity, ['expo.modules.splashscreen.singletons.SplashScreen', 'expo.modules.splashscreen.SplashScreenImageResizeMode', 'com.facebook.react.ReactRootView', 'android.os.Bundle'], isJava);
if (!mainActivity.match(/(?<=^.*super\.onCreate.*$)/m)) {
const onCreateBlock = isJava ? [' @Override', ' protected void onCreate(Bundle savedInstanceState) {', ' super.onCreate(savedInstanceState);', ' }'] : [' override fun onCreate(savedInstanceState: Bundle?) {', ' super.onCreate(savedInstanceState)', ' }'];
mainActivity = (0, _generateCode().mergeContents)({
src: mainActivity,
// insert just below super.onCreate
anchor: isJava ? /(?<=public\s+class\s+.*\s+extends\s+.*\s+{.*$)/m : /(?<=class\s+.*\s+:\s+.*\s+{.*$)/m,
offset: 1,
comment: '//',
tag: 'expo-splash-screen-mainActivity-onCreate',
newSrc: onCreateBlock.join('\n')
}).contents;
}
// Remove our generated code safely...
mainActivity = (0, _generateCode().removeContents)({
src: mainActivity,
tag: SHOW_SPLASH_ID
}).contents;
// Remove code from `@expo/configure-splash-screen`
mainActivity = mainActivity.split('\n').filter(line => {
return !/SplashScreen\.show\(this,\s?SplashScreenImageResizeMode\./.test(line);
}).join('\n');
// Reapply generated code.
mainActivity = (0, _generateCode().mergeContents)({
src: mainActivity,
// insert just below super.onCreate
anchor: /(?<=^.*super\.onCreate.*$)/m,
offset: 1,
comment: '//',
tag: SHOW_SPLASH_ID,
newSrc: ` SplashScreen.show(this, SplashScreenImageResizeMode.${resizeMode.toUpperCase()}, ReactRootView${isJava ? '.class' : '::class.java'}, ${statusBarTranslucent})${LE}`
}).contents;
// TODO: Remove old `SplashScreen.show`
return mainActivity;
}
//# sourceMappingURL=withAndroidSplashLegacyMainActivity.js.map

View File

@@ -0,0 +1,2 @@
import { ConfigPlugin } from '@expo/config-plugins';
export declare const withAndroidSplashScreen: ConfigPlugin;

View File

@@ -0,0 +1,108 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.withAndroidSplashScreen = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
function _jsonFile() {
const data = _interopRequireDefault(require("@expo/json-file"));
_jsonFile = function () {
return data;
};
return data;
}
function _resolveFrom() {
const data = _interopRequireDefault(require("resolve-from"));
_resolveFrom = function () {
return data;
};
return data;
}
function _semver() {
const data = _interopRequireDefault(require("semver"));
_semver = function () {
return data;
};
return data;
}
function _getAndroidSplashConfig() {
const data = require("./getAndroidSplashConfig");
_getAndroidSplashConfig = function () {
return data;
};
return data;
}
function _withAndroidSplashDrawables() {
const data = require("./withAndroidSplashDrawables");
_withAndroidSplashDrawables = function () {
return data;
};
return data;
}
function _withAndroidSplashImages() {
const data = require("./withAndroidSplashImages");
_withAndroidSplashImages = function () {
return data;
};
return data;
}
function _withAndroidSplashLegacyMainActivity() {
const data = require("./withAndroidSplashLegacyMainActivity");
_withAndroidSplashLegacyMainActivity = function () {
return data;
};
return data;
}
function _withAndroidSplashStrings() {
const data = require("./withAndroidSplashStrings");
_withAndroidSplashStrings = function () {
return data;
};
return data;
}
function _withAndroidSplashStyles() {
const data = require("./withAndroidSplashStyles");
_withAndroidSplashStyles = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const withAndroidSplashScreen = config => {
const splashConfig = (0, _getAndroidSplashConfig().getAndroidSplashConfig)(config);
// Update the android status bar to match the splash screen
// androidStatusBar applies info to the app activity style.
const backgroundColor = splashConfig?.backgroundColor || '#ffffff';
if (config.androidStatusBar?.backgroundColor) {
if (backgroundColor.toLowerCase() !== config.androidStatusBar?.backgroundColor?.toLowerCase?.()) {
_configPlugins().WarningAggregator.addWarningAndroid('androidStatusBar.backgroundColor', 'Color conflicts with the splash.backgroundColor');
}
} else {
if (!config.androidStatusBar) config.androidStatusBar = {};
config.androidStatusBar.backgroundColor = backgroundColor;
}
return (0, _configPlugins().withPlugins)(config, [_withAndroidSplashImages().withAndroidSplashImages, [_withAndroidSplashDrawables().withAndroidSplashDrawables, splashConfig], ...(shouldUpdateLegacyMainActivity(config) ? [_withAndroidSplashLegacyMainActivity().withAndroidSplashLegacyMainActivity] : []), _withAndroidSplashStyles().withAndroidSplashStyles, _withAndroidSplashStrings().withAndroidSplashStrings]);
};
exports.withAndroidSplashScreen = withAndroidSplashScreen;
function shouldUpdateLegacyMainActivity(config) {
try {
const projectRoot = config._internal?.projectRoot;
const packagePath = (0, _resolveFrom().default)(projectRoot, 'expo-splash-screen/package.json');
if (packagePath) {
const version = _jsonFile().default.read(packagePath).version?.toString() ?? '';
return _semver().default.lt(version, '0.12.0');
}
// If expo-splash-screen didn't be installed or included in template, we check the sdkVersion instead.
return !!(config.sdkVersion && _semver().default.lt(config.sdkVersion, '43.0.0'));
} catch {}
return false;
}
//# sourceMappingURL=withAndroidSplashScreen.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
import { AndroidConfig, ConfigPlugin } from '@expo/config-plugins';
export declare const withAndroidSplashStrings: ConfigPlugin;
export declare function setSplashStrings(strings: AndroidConfig.Resources.ResourceXML, resizeMode: string, statusBarTranslucent: boolean): AndroidConfig.Resources.ResourceXML;

View File

@@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.setSplashStrings = setSplashStrings;
exports.withAndroidSplashStrings = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
function _getAndroidSplashConfig() {
const data = require("./getAndroidSplashConfig");
_getAndroidSplashConfig = function () {
return data;
};
return data;
}
const RESIZE_MODE_KEY = 'expo_splash_screen_resize_mode';
const STATUS_BAR_TRANSLUCENT_KEY = 'expo_splash_screen_status_bar_translucent';
const withAndroidSplashStrings = config => {
return (0, _configPlugins().withStringsXml)(config, config => {
const splashConfig = (0, _getAndroidSplashConfig().getAndroidSplashConfig)(config);
if (splashConfig) {
const {
resizeMode
} = splashConfig;
const statusBarTranslucent = !!config.androidStatusBar?.translucent;
config.modResults = setSplashStrings(config.modResults, resizeMode, statusBarTranslucent);
}
return config;
});
};
exports.withAndroidSplashStrings = withAndroidSplashStrings;
function setSplashStrings(strings, resizeMode, statusBarTranslucent) {
return _configPlugins().AndroidConfig.Strings.setStringItem([_configPlugins().AndroidConfig.Resources.buildResourceItem({
name: RESIZE_MODE_KEY,
value: resizeMode,
translatable: false
}), _configPlugins().AndroidConfig.Resources.buildResourceItem({
name: STATUS_BAR_TRANSLUCENT_KEY,
value: String(statusBarTranslucent),
translatable: false
})], strings);
}
//# sourceMappingURL=withAndroidSplashStrings.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"withAndroidSplashStrings.js","names":["_configPlugins","data","require","_getAndroidSplashConfig","RESIZE_MODE_KEY","STATUS_BAR_TRANSLUCENT_KEY","withAndroidSplashStrings","config","withStringsXml","splashConfig","getAndroidSplashConfig","resizeMode","statusBarTranslucent","androidStatusBar","translucent","modResults","setSplashStrings","exports","strings","AndroidConfig","Strings","setStringItem","Resources","buildResourceItem","name","value","translatable","String"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withAndroidSplashStrings.ts"],"sourcesContent":["import { AndroidConfig, ConfigPlugin, withStringsXml } from '@expo/config-plugins';\n\nimport { getAndroidSplashConfig } from './getAndroidSplashConfig';\n\nconst RESIZE_MODE_KEY = 'expo_splash_screen_resize_mode';\nconst STATUS_BAR_TRANSLUCENT_KEY = 'expo_splash_screen_status_bar_translucent';\n\nexport const withAndroidSplashStrings: ConfigPlugin = (config) => {\n return withStringsXml(config, (config) => {\n const splashConfig = getAndroidSplashConfig(config);\n if (splashConfig) {\n const { resizeMode } = splashConfig;\n const statusBarTranslucent = !!config.androidStatusBar?.translucent;\n config.modResults = setSplashStrings(config.modResults, resizeMode, statusBarTranslucent);\n }\n return config;\n });\n};\n\nexport function setSplashStrings(\n strings: AndroidConfig.Resources.ResourceXML,\n resizeMode: string,\n statusBarTranslucent: boolean\n): AndroidConfig.Resources.ResourceXML {\n return AndroidConfig.Strings.setStringItem(\n [\n AndroidConfig.Resources.buildResourceItem({\n name: RESIZE_MODE_KEY,\n value: resizeMode,\n translatable: false,\n }),\n AndroidConfig.Resources.buildResourceItem({\n name: STATUS_BAR_TRANSLUCENT_KEY,\n value: String(statusBarTranslucent),\n translatable: false,\n }),\n ],\n strings\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,wBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,uBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,MAAMG,eAAe,GAAG,gCAAgC;AACxD,MAAMC,0BAA0B,GAAG,2CAA2C;AAEvE,MAAMC,wBAAsC,GAAIC,MAAM,IAAK;EAChE,OAAO,IAAAC,+BAAc,EAACD,MAAM,EAAGA,MAAM,IAAK;IACxC,MAAME,YAAY,GAAG,IAAAC,gDAAsB,EAACH,MAAM,CAAC;IACnD,IAAIE,YAAY,EAAE;MAChB,MAAM;QAAEE;MAAW,CAAC,GAAGF,YAAY;MACnC,MAAMG,oBAAoB,GAAG,CAAC,CAACL,MAAM,CAACM,gBAAgB,EAAEC,WAAW;MACnEP,MAAM,CAACQ,UAAU,GAAGC,gBAAgB,CAACT,MAAM,CAACQ,UAAU,EAAEJ,UAAU,EAAEC,oBAAoB,CAAC;IAC3F;IACA,OAAOL,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;AAACU,OAAA,CAAAX,wBAAA,GAAAA,wBAAA;AAEK,SAASU,gBAAgBA,CAC9BE,OAA4C,EAC5CP,UAAkB,EAClBC,oBAA6B,EACQ;EACrC,OAAOO,8BAAa,CAACC,OAAO,CAACC,aAAa,CACxC,CACEF,8BAAa,CAACG,SAAS,CAACC,iBAAiB,CAAC;IACxCC,IAAI,EAAEpB,eAAe;IACrBqB,KAAK,EAAEd,UAAU;IACjBe,YAAY,EAAE;EAChB,CAAC,CAAC,EACFP,8BAAa,CAACG,SAAS,CAACC,iBAAiB,CAAC;IACxCC,IAAI,EAAEnB,0BAA0B;IAChCoB,KAAK,EAAEE,MAAM,CAACf,oBAAoB,CAAC;IACnCc,YAAY,EAAE;EAChB,CAAC,CAAC,CACH,EACDR,OACF,CAAC;AACH","ignoreList":[]}

View File

@@ -0,0 +1,8 @@
import { AndroidConfig, ConfigPlugin } from '@expo/config-plugins';
import { ExpoConfig } from '@expo/config-types';
export declare const withAndroidSplashStyles: ConfigPlugin;
export declare function removeOldSplashStyleGroup(styles: AndroidConfig.Resources.ResourceXML): AndroidConfig.Resources.ResourceXML;
export declare function getSplashBackgroundColor(config: ExpoConfig): string | null;
export declare function getSplashDarkBackgroundColor(config: ExpoConfig): string | null;
export declare function setSplashStylesForTheme(styles: AndroidConfig.Resources.ResourceXML): AndroidConfig.Resources.ResourceXML;
export declare function setSplashColorsForTheme(colors: AndroidConfig.Resources.ResourceXML, backgroundColor: string | null): AndroidConfig.Resources.ResourceXML;

View File

@@ -0,0 +1,96 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getSplashBackgroundColor = getSplashBackgroundColor;
exports.getSplashDarkBackgroundColor = getSplashDarkBackgroundColor;
exports.removeOldSplashStyleGroup = removeOldSplashStyleGroup;
exports.setSplashColorsForTheme = setSplashColorsForTheme;
exports.setSplashStylesForTheme = setSplashStylesForTheme;
exports.withAndroidSplashStyles = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
function _android() {
const data = require("@expo/config-plugins/build/android");
_android = function () {
return data;
};
return data;
}
function _getAndroidSplashConfig() {
const data = require("./getAndroidSplashConfig");
_getAndroidSplashConfig = function () {
return data;
};
return data;
}
const styleResourceGroup = {
name: 'Theme.App.SplashScreen',
parent: 'AppTheme'
};
const SPLASH_COLOR_NAME = 'splashscreen_background';
const withAndroidSplashStyles = config => {
config = (0, _configPlugins().withAndroidColors)(config, config => {
const backgroundColor = getSplashBackgroundColor(config);
config.modResults = setSplashColorsForTheme(config.modResults, backgroundColor);
return config;
});
config = (0, _configPlugins().withAndroidColorsNight)(config, config => {
const backgroundColor = getSplashDarkBackgroundColor(config);
config.modResults = setSplashColorsForTheme(config.modResults, backgroundColor);
return config;
});
config = (0, _configPlugins().withAndroidStyles)(config, config => {
config.modResults = removeOldSplashStyleGroup(config.modResults);
config.modResults = setSplashStylesForTheme(config.modResults);
return config;
});
return config;
};
// Remove the old style group which didn't extend the base theme properly.
exports.withAndroidSplashStyles = withAndroidSplashStyles;
function removeOldSplashStyleGroup(styles) {
const group = {
name: 'Theme.App.SplashScreen',
parent: 'Theme.AppCompat.Light.NoActionBar'
};
styles.resources.style = styles.resources.style?.filter?.(({
$: head
}) => {
let matches = head.name === group.name;
if (group.parent != null && matches) {
matches = head.parent === group.parent;
}
return !matches;
});
return styles;
}
function getSplashBackgroundColor(config) {
return (0, _getAndroidSplashConfig().getAndroidSplashConfig)(config)?.backgroundColor ?? null;
}
function getSplashDarkBackgroundColor(config) {
return (0, _getAndroidSplashConfig().getAndroidDarkSplashConfig)(config)?.backgroundColor ?? null;
}
function setSplashStylesForTheme(styles) {
// Add splash screen image
return _configPlugins().AndroidConfig.Styles.assignStylesValue(styles, {
add: true,
value: '@drawable/splashscreen',
name: 'android:windowBackground',
parent: styleResourceGroup
});
}
function setSplashColorsForTheme(colors, backgroundColor) {
return _android().Colors.assignColorValue(colors, {
value: backgroundColor,
name: SPLASH_COLOR_NAME
});
}
//# sourceMappingURL=withAndroidSplashStyles.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
import { ConfigPlugin } from '@expo/config-plugins';
import { IOSSplashConfig } from './getIosSplashConfig';
import { ContentsJsonImage } from '../../icons/AssetContents';
export declare const withIosSplashAssets: ConfigPlugin<IOSSplashConfig>;
export declare function buildContentsJsonImages({ image, darkImage, tabletImage, darkTabletImage, }: {
image: string;
tabletImage: string | null;
darkImage: string | null;
darkTabletImage: string | null;
}): ContentsJsonImage[];

View File

@@ -0,0 +1,293 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.buildContentsJsonImages = buildContentsJsonImages;
exports.withIosSplashAssets = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
function _imageUtils() {
const data = require("@expo/image-utils");
_imageUtils = function () {
return data;
};
return data;
}
function _debug() {
const data = _interopRequireDefault(require("debug"));
_debug = function () {
return data;
};
return data;
}
function _fsExtra() {
const data = _interopRequireDefault(require("fs-extra"));
_fsExtra = function () {
return data;
};
return data;
}
function _jimpCompact() {
const data = _interopRequireDefault(require("jimp-compact"));
_jimpCompact = function () {
return data;
};
return data;
}
function path() {
const data = _interopRequireWildcard(require("path"));
path = function () {
return data;
};
return data;
}
function _AssetContents() {
const data = require("../../icons/AssetContents");
_AssetContents = function () {
return data;
};
return data;
}
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// @ts-ignore
const debug = (0, _debug().default)('expo:prebuild-config:expo-splash-screen:ios:assets');
const IMAGE_CACHE_NAME = 'splash-ios';
const IMAGESET_PATH = 'Images.xcassets/SplashScreen.imageset';
const BACKGROUND_IMAGESET_PATH = 'Images.xcassets/SplashScreenBackground.imageset';
const PNG_FILENAME = 'image.png';
const DARK_PNG_FILENAME = 'dark_image.png';
const TABLET_PNG_FILENAME = 'tablet_image.png';
const DARK_TABLET_PNG_FILENAME = 'dark_tablet_image.png';
const withIosSplashAssets = (config, splash) => {
if (!splash) {
return config;
}
return (0, _configPlugins().withDangerousMod)(config, ['ios', async config => {
const iosNamedProjectRoot = _configPlugins().IOSConfig.Paths.getSourceRoot(config.modRequest.projectRoot);
await createSplashScreenBackgroundImageAsync({
iosNamedProjectRoot,
splash
});
await configureImageAssets({
projectRoot: config.modRequest.projectRoot,
iosNamedProjectRoot,
image: splash.image,
darkImage: splash.dark?.image,
tabletImage: splash.tabletImage,
darkTabletImage: splash.dark?.tabletImage
});
return config;
}]);
};
/**
* Creates imageset containing image for Splash/Launch Screen.
*/
exports.withIosSplashAssets = withIosSplashAssets;
async function configureImageAssets({
projectRoot,
iosNamedProjectRoot,
image,
darkImage,
tabletImage,
darkTabletImage
}) {
const imageSetPath = path().resolve(iosNamedProjectRoot, IMAGESET_PATH);
// ensure old SplashScreen imageSet is removed
await _fsExtra().default.remove(imageSetPath);
if (!image) {
return;
}
await writeContentsJsonFileAsync({
assetPath: imageSetPath,
image: PNG_FILENAME,
darkImage: darkImage ? DARK_PNG_FILENAME : null,
tabletImage: tabletImage ? TABLET_PNG_FILENAME : null,
darkTabletImage: darkTabletImage ? DARK_TABLET_PNG_FILENAME : null
});
await copyImageFiles({
projectRoot,
iosNamedProjectRoot,
image,
darkImage,
tabletImage,
darkTabletImage
});
}
async function createPngFileAsync(color, filePath) {
const png = new (_jimpCompact().default)(1, 1, color);
return png.writeAsync(filePath);
}
async function createBackgroundImagesAsync({
iosNamedProjectRoot,
color,
darkColor,
tabletColor,
darkTabletColor
}) {
await generateImagesAssetsAsync({
async generateImageAsset(item, fileName) {
await createPngFileAsync(item, path().resolve(iosNamedProjectRoot, BACKGROUND_IMAGESET_PATH, fileName));
},
anyItem: color,
darkItem: darkColor,
tabletItem: tabletColor,
darkTabletItem: darkTabletColor
});
}
async function copyImageFiles({
projectRoot,
iosNamedProjectRoot,
image,
darkImage,
tabletImage,
darkTabletImage
}) {
await generateImagesAssetsAsync({
async generateImageAsset(item, fileName) {
// Using this method will cache the images in `.expo` based on the properties used to generate them.
// this method also supports remote URLs and using the global sharp instance.
const {
source
} = await (0, _imageUtils().generateImageAsync)({
projectRoot,
cacheType: IMAGE_CACHE_NAME
}, {
src: item
});
// Write image buffer to the file system.
// const assetPath = join(iosNamedProjectRoot, IMAGESET_PATH, filename);
await _fsExtra().default.writeFile(path().resolve(iosNamedProjectRoot, IMAGESET_PATH, fileName), source);
},
anyItem: image,
darkItem: darkImage,
tabletItem: tabletImage,
darkTabletItem: darkTabletImage
});
}
async function generateImagesAssetsAsync({
generateImageAsset,
anyItem,
darkItem,
tabletItem,
darkTabletItem
}) {
const items = [[anyItem, PNG_FILENAME], [darkItem, DARK_PNG_FILENAME], [tabletItem, TABLET_PNG_FILENAME], [darkTabletItem, DARK_TABLET_PNG_FILENAME]].filter(([item]) => !!item);
await Promise.all(items.map(([item, fileName]) => generateImageAsset(item, fileName)));
}
async function createSplashScreenBackgroundImageAsync({
iosNamedProjectRoot,
splash
}) {
const color = splash.backgroundColor;
const darkColor = splash.dark?.backgroundColor;
const tabletColor = splash.tabletBackgroundColor;
const darkTabletColor = splash.dark?.tabletBackgroundColor;
const imagesetPath = path().join(iosNamedProjectRoot, BACKGROUND_IMAGESET_PATH);
// Ensure the Images.xcassets/... path exists
await _fsExtra().default.remove(imagesetPath);
await _fsExtra().default.ensureDir(imagesetPath);
await createBackgroundImagesAsync({
iosNamedProjectRoot,
color,
darkColor: darkColor ? darkColor : null,
tabletColor: tabletColor ? tabletColor : null,
darkTabletColor: darkTabletColor ? darkTabletColor : null
});
await writeContentsJsonFileAsync({
assetPath: path().resolve(iosNamedProjectRoot, BACKGROUND_IMAGESET_PATH),
image: PNG_FILENAME,
darkImage: darkColor ? DARK_PNG_FILENAME : null,
tabletImage: tabletColor ? TABLET_PNG_FILENAME : null,
darkTabletImage: darkTabletColor ? DARK_TABLET_PNG_FILENAME : null
});
}
const darkAppearances = [{
appearance: 'luminosity',
value: 'dark'
}];
function buildContentsJsonImages({
image,
darkImage,
tabletImage,
darkTabletImage
}) {
return [
// Phone light
(0, _AssetContents().createContentsJsonItem)({
idiom: 'universal',
filename: image,
scale: '1x'
}), (0, _AssetContents().createContentsJsonItem)({
idiom: 'universal',
scale: '2x'
}), (0, _AssetContents().createContentsJsonItem)({
idiom: 'universal',
scale: '3x'
}),
// Phone dark
darkImage && (0, _AssetContents().createContentsJsonItem)({
idiom: 'universal',
appearances: darkAppearances,
filename: darkImage,
scale: '1x'
}), darkImage && (0, _AssetContents().createContentsJsonItem)({
idiom: 'universal',
appearances: darkAppearances,
scale: '2x'
}), darkImage && (0, _AssetContents().createContentsJsonItem)({
idiom: 'universal',
appearances: darkAppearances,
scale: '3x'
}),
// Tablet light
tabletImage && (0, _AssetContents().createContentsJsonItem)({
idiom: 'ipad',
filename: tabletImage,
scale: '1x'
}), tabletImage && (0, _AssetContents().createContentsJsonItem)({
idiom: 'ipad',
scale: '2x'
}),
// Phone dark
darkTabletImage && (0, _AssetContents().createContentsJsonItem)({
idiom: 'ipad',
appearances: darkAppearances,
filename: darkTabletImage ?? undefined,
scale: '1x'
}), darkTabletImage && (0, _AssetContents().createContentsJsonItem)({
idiom: 'ipad',
appearances: darkAppearances,
scale: '2x'
})].filter(Boolean);
}
async function writeContentsJsonFileAsync({
assetPath,
image,
darkImage,
tabletImage,
darkTabletImage
}) {
const images = buildContentsJsonImages({
image,
darkImage,
tabletImage,
darkTabletImage
});
debug(`create contents.json:`, assetPath);
debug(`use images:`, images);
await (0, _AssetContents().writeContentsJsonAsync)(assetPath, {
images
});
}
//# sourceMappingURL=withIosSplashAssets.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
import { ConfigPlugin, InfoPlist } from '@expo/config-plugins';
import { ExpoConfig } from '@expo/config-types';
import { IOSSplashConfig } from './getIosSplashConfig';
export declare const withIosSplashInfoPlist: ConfigPlugin<IOSSplashConfig>;
export declare function setSplashInfoPlist(config: ExpoConfig, infoPlist: InfoPlist, splash: IOSSplashConfig): InfoPlist;

View File

@@ -0,0 +1,58 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.setSplashInfoPlist = setSplashInfoPlist;
exports.withIosSplashInfoPlist = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
function _debug() {
const data = _interopRequireDefault(require("debug"));
_debug = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const debug = (0, _debug().default)('expo:prebuild-config:expo-splash-screen:ios:infoPlist');
const withIosSplashInfoPlist = (config, splash) => {
return (0, _configPlugins().withInfoPlist)(config, config => {
config.modResults = setSplashInfoPlist(config, config.modResults, splash);
return config;
});
};
exports.withIosSplashInfoPlist = withIosSplashInfoPlist;
function setSplashInfoPlist(config, infoPlist, splash) {
const isDarkModeEnabled = !!(splash?.dark?.image || splash?.dark?.tabletImage || splash?.dark?.backgroundColor || splash?.dark?.tabletBackgroundColor);
debug(`isDarkModeEnabled: `, isDarkModeEnabled);
if (isDarkModeEnabled) {
// IOSConfig.UserInterfaceStyle.getUserInterfaceStyle(config);
// Determine if the user manually defined the userInterfaceStyle incorrectly
const existing = config.ios?.userInterfaceStyle ?? config.userInterfaceStyle;
// Add a warning to prevent the dark mode splash screen from not being shown -- this was learned the hard way.
if (existing && existing !== 'automatic') {
_configPlugins().WarningAggregator.addWarningIOS('userInterfaceStyle', 'The existing `userInterfaceStyle` property is preventing splash screen from working properly. Please remove it or disable dark mode splash screens.');
}
// assigning it to auto anyways, but this is fragile because the order of operations matter now
infoPlist.UIUserInterfaceStyle = 'Automatic';
} else {
// NOTE(brentvatne): Commented out this line because it causes https://github.com/expo/expo-cli/issues/3935
// We should revisit this approach.
// delete infoPlist.UIUserInterfaceStyle;
}
if (splash) {
// TODO: What to do here ??
infoPlist.UILaunchStoryboardName = 'SplashScreen';
} else {
debug(`Disabling UILaunchStoryboardName`);
delete infoPlist.UILaunchStoryboardName;
}
return infoPlist;
}
//# sourceMappingURL=withIosSplashInfoPlist.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"withIosSplashInfoPlist.js","names":["_configPlugins","data","require","_debug","_interopRequireDefault","obj","__esModule","default","debug","Debug","withIosSplashInfoPlist","config","splash","withInfoPlist","modResults","setSplashInfoPlist","exports","infoPlist","isDarkModeEnabled","dark","image","tabletImage","backgroundColor","tabletBackgroundColor","existing","ios","userInterfaceStyle","WarningAggregator","addWarningIOS","UIUserInterfaceStyle","UILaunchStoryboardName"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withIosSplashInfoPlist.ts"],"sourcesContent":["import { ConfigPlugin, InfoPlist, WarningAggregator, withInfoPlist } from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\nimport Debug from 'debug';\n\nimport { IOSSplashConfig } from './getIosSplashConfig';\n\nconst debug = Debug('expo:prebuild-config:expo-splash-screen:ios:infoPlist');\n\nexport const withIosSplashInfoPlist: ConfigPlugin<IOSSplashConfig> = (config, splash) => {\n return withInfoPlist(config, (config) => {\n config.modResults = setSplashInfoPlist(config, config.modResults, splash);\n return config;\n });\n};\n\nexport function setSplashInfoPlist(\n config: ExpoConfig,\n infoPlist: InfoPlist,\n splash: IOSSplashConfig\n): InfoPlist {\n const isDarkModeEnabled = !!(\n splash?.dark?.image ||\n splash?.dark?.tabletImage ||\n splash?.dark?.backgroundColor ||\n splash?.dark?.tabletBackgroundColor\n );\n debug(`isDarkModeEnabled: `, isDarkModeEnabled);\n\n if (isDarkModeEnabled) {\n // IOSConfig.UserInterfaceStyle.getUserInterfaceStyle(config);\n // Determine if the user manually defined the userInterfaceStyle incorrectly\n const existing = config.ios?.userInterfaceStyle ?? config.userInterfaceStyle;\n // Add a warning to prevent the dark mode splash screen from not being shown -- this was learned the hard way.\n if (existing && existing !== 'automatic') {\n WarningAggregator.addWarningIOS(\n 'userInterfaceStyle',\n 'The existing `userInterfaceStyle` property is preventing splash screen from working properly. Please remove it or disable dark mode splash screens.'\n );\n }\n // assigning it to auto anyways, but this is fragile because the order of operations matter now\n infoPlist.UIUserInterfaceStyle = 'Automatic';\n } else {\n // NOTE(brentvatne): Commented out this line because it causes https://github.com/expo/expo-cli/issues/3935\n // We should revisit this approach.\n // delete infoPlist.UIUserInterfaceStyle;\n }\n\n if (splash) {\n // TODO: What to do here ??\n infoPlist.UILaunchStoryboardName = 'SplashScreen';\n } else {\n debug(`Disabling UILaunchStoryboardName`);\n delete infoPlist.UILaunchStoryboardName;\n }\n\n return infoPlist;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAG,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAI1B,MAAMG,KAAK,GAAG,IAAAC,gBAAK,EAAC,uDAAuD,CAAC;AAErE,MAAMC,sBAAqD,GAAGA,CAACC,MAAM,EAAEC,MAAM,KAAK;EACvF,OAAO,IAAAC,8BAAa,EAACF,MAAM,EAAGA,MAAM,IAAK;IACvCA,MAAM,CAACG,UAAU,GAAGC,kBAAkB,CAACJ,MAAM,EAAEA,MAAM,CAACG,UAAU,EAAEF,MAAM,CAAC;IACzE,OAAOD,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;AAACK,OAAA,CAAAN,sBAAA,GAAAA,sBAAA;AAEK,SAASK,kBAAkBA,CAChCJ,MAAkB,EAClBM,SAAoB,EACpBL,MAAuB,EACZ;EACX,MAAMM,iBAAiB,GAAG,CAAC,EACzBN,MAAM,EAAEO,IAAI,EAAEC,KAAK,IACnBR,MAAM,EAAEO,IAAI,EAAEE,WAAW,IACzBT,MAAM,EAAEO,IAAI,EAAEG,eAAe,IAC7BV,MAAM,EAAEO,IAAI,EAAEI,qBAAqB,CACpC;EACDf,KAAK,CAAC,qBAAqB,EAAEU,iBAAiB,CAAC;EAE/C,IAAIA,iBAAiB,EAAE;IACrB;IACA;IACA,MAAMM,QAAQ,GAAGb,MAAM,CAACc,GAAG,EAAEC,kBAAkB,IAAIf,MAAM,CAACe,kBAAkB;IAC5E;IACA,IAAIF,QAAQ,IAAIA,QAAQ,KAAK,WAAW,EAAE;MACxCG,kCAAiB,CAACC,aAAa,CAC7B,oBAAoB,EACpB,qJACF,CAAC;IACH;IACA;IACAX,SAAS,CAACY,oBAAoB,GAAG,WAAW;EAC9C,CAAC,MAAM;IACL;IACA;IACA;EAAA;EAGF,IAAIjB,MAAM,EAAE;IACV;IACAK,SAAS,CAACa,sBAAsB,GAAG,cAAc;EACnD,CAAC,MAAM;IACLtB,KAAK,CAAC,kCAAkC,CAAC;IACzC,OAAOS,SAAS,CAACa,sBAAsB;EACzC;EAEA,OAAOb,SAAS;AAClB","ignoreList":[]}

View File

@@ -0,0 +1,3 @@
import { ConfigPlugin } from '@expo/config-plugins';
import { IOSSplashConfig } from './getIosSplashConfig';
export declare const withIosSplashScreen: ConfigPlugin<IOSSplashConfig | undefined | null | void>;

View File

@@ -0,0 +1,83 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.withIosSplashScreen = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
function _debug() {
const data = _interopRequireDefault(require("debug"));
_debug = function () {
return data;
};
return data;
}
function _getIosSplashConfig() {
const data = require("./getIosSplashConfig");
_getIosSplashConfig = function () {
return data;
};
return data;
}
function _withIosSplashAssets() {
const data = require("./withIosSplashAssets");
_withIosSplashAssets = function () {
return data;
};
return data;
}
function _withIosSplashInfoPlist() {
const data = require("./withIosSplashInfoPlist");
_withIosSplashInfoPlist = function () {
return data;
};
return data;
}
function _withIosSplashScreenStoryboard() {
const data = require("./withIosSplashScreenStoryboard");
_withIosSplashScreenStoryboard = function () {
return data;
};
return data;
}
function _withIosSplashXcodeProject() {
const data = require("./withIosSplashXcodeProject");
_withIosSplashXcodeProject = function () {
return data;
};
return data;
}
function _wtihIosSplashScreenStoryboardImage() {
const data = require("./wtihIosSplashScreenStoryboardImage");
_wtihIosSplashScreenStoryboardImage = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const debug = (0, _debug().default)('expo:prebuild-config:expo-splash-screen:ios');
const withIosSplashScreen = (config, splash) => {
// If the user didn't specify a splash object, infer the splash object from the Expo config.
if (!splash) {
splash = (0, _getIosSplashConfig().getIosSplashConfig)(config);
} else {
debug(`custom splash config provided`);
}
debug(`config:`, splash);
return (0, _configPlugins().withPlugins)(config, [[_withIosSplashInfoPlist().withIosSplashInfoPlist, splash], [_withIosSplashAssets().withIosSplashAssets, splash],
// Add the image settings to the storyboard.
[_wtihIosSplashScreenStoryboardImage().withIosSplashScreenImage, splash],
// Link storyboard to xcode project.
// TODO: Maybe fold this into the base mod.
_withIosSplashXcodeProject().withIosSplashXcodeProject,
// Insert the base mod last, no other ios.splashScreenStoryboard mods can be added after this.
_withIosSplashScreenStoryboard().withIosSplashScreenStoryboardBaseMod]);
};
exports.withIosSplashScreen = withIosSplashScreen;
//# sourceMappingURL=withIosSplashScreen.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"withIosSplashScreen.js","names":["_configPlugins","data","require","_debug","_interopRequireDefault","_getIosSplashConfig","_withIosSplashAssets","_withIosSplashInfoPlist","_withIosSplashScreenStoryboard","_withIosSplashXcodeProject","_wtihIosSplashScreenStoryboardImage","obj","__esModule","default","debug","Debug","withIosSplashScreen","config","splash","getIosSplashConfig","withPlugins","withIosSplashInfoPlist","withIosSplashAssets","withIosSplashScreenImage","withIosSplashXcodeProject","withIosSplashScreenStoryboardBaseMod","exports"],"sources":["../../../../src/plugins/unversioned/expo-splash-screen/withIosSplashScreen.ts"],"sourcesContent":["import { ConfigPlugin, withPlugins } from '@expo/config-plugins';\nimport Debug from 'debug';\n\nimport { getIosSplashConfig, IOSSplashConfig } from './getIosSplashConfig';\nimport { withIosSplashAssets } from './withIosSplashAssets';\nimport { withIosSplashInfoPlist } from './withIosSplashInfoPlist';\nimport { withIosSplashScreenStoryboardBaseMod } from './withIosSplashScreenStoryboard';\nimport { withIosSplashXcodeProject } from './withIosSplashXcodeProject';\nimport { withIosSplashScreenImage } from './wtihIosSplashScreenStoryboardImage';\n\nconst debug = Debug('expo:prebuild-config:expo-splash-screen:ios');\n\nexport const withIosSplashScreen: ConfigPlugin<IOSSplashConfig | undefined | null | void> = (\n config,\n splash\n) => {\n // If the user didn't specify a splash object, infer the splash object from the Expo config.\n if (!splash) {\n splash = getIosSplashConfig(config);\n } else {\n debug(`custom splash config provided`);\n }\n\n debug(`config:`, splash);\n\n return withPlugins(config, [\n [withIosSplashInfoPlist, splash],\n [withIosSplashAssets, splash],\n // Add the image settings to the storyboard.\n [withIosSplashScreenImage, splash],\n // Link storyboard to xcode project.\n // TODO: Maybe fold this into the base mod.\n withIosSplashXcodeProject,\n // Insert the base mod last, no other ios.splashScreenStoryboard mods can be added after this.\n withIosSplashScreenStoryboardBaseMod,\n ]);\n};\n"],"mappings":";;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,oBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,mBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,qBAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,oBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,wBAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,uBAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,+BAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,8BAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,2BAAA;EAAA,MAAAR,IAAA,GAAAC,OAAA;EAAAO,0BAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,oCAAA;EAAA,MAAAT,IAAA,GAAAC,OAAA;EAAAQ,mCAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAgF,SAAAG,uBAAAO,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEhF,MAAMG,KAAK,GAAG,IAAAC,gBAAK,EAAC,6CAA6C,CAAC;AAE3D,MAAMC,mBAA4E,GAAGA,CAC1FC,MAAM,EACNC,MAAM,KACH;EACH;EACA,IAAI,CAACA,MAAM,EAAE;IACXA,MAAM,GAAG,IAAAC,wCAAkB,EAACF,MAAM,CAAC;EACrC,CAAC,MAAM;IACLH,KAAK,CAAC,+BAA+B,CAAC;EACxC;EAEAA,KAAK,CAAC,SAAS,EAAEI,MAAM,CAAC;EAExB,OAAO,IAAAE,4BAAW,EAACH,MAAM,EAAE,CACzB,CAACI,gDAAsB,EAAEH,MAAM,CAAC,EAChC,CAACI,0CAAmB,EAAEJ,MAAM,CAAC;EAC7B;EACA,CAACK,8DAAwB,EAAEL,MAAM,CAAC;EAClC;EACA;EACAM,sDAAyB;EACzB;EACAC,qEAAoC,CACrC,CAAC;AACJ,CAAC;AAACC,OAAA,CAAAV,mBAAA,GAAAA,mBAAA","ignoreList":[]}

View File

@@ -0,0 +1,14 @@
import { ConfigPlugin, Mod } from '@expo/config-plugins';
import { IBSplashScreenDocument } from './InterfaceBuilder';
export declare const STORYBOARD_FILE_PATH = "./SplashScreen.storyboard";
/**
* Provides the SplashScreen `.storyboard` xml data for modification.
*
* @param config
* @param action
*/
export declare const withIosSplashScreenStoryboard: ConfigPlugin<Mod<IBSplashScreenDocument>>;
/** Append a custom rule to supply SplashScreen `.storyboard` xml data to mods on `mods.ios.splashScreenStoryboard` */
export declare const withIosSplashScreenStoryboardBaseMod: ConfigPlugin;
/** Get a template splash screen storyboard file. */
export declare function getTemplateAsync(): Promise<IBSplashScreenDocument>;

View File

@@ -0,0 +1,187 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.STORYBOARD_FILE_PATH = void 0;
exports.getTemplateAsync = getTemplateAsync;
exports.withIosSplashScreenStoryboardBaseMod = exports.withIosSplashScreenStoryboard = void 0;
function _configPlugins() {
const data = require("@expo/config-plugins");
_configPlugins = function () {
return data;
};
return data;
}
function fs() {
const data = _interopRequireWildcard(require("fs"));
fs = function () {
return data;
};
return data;
}
function path() {
const data = _interopRequireWildcard(require("path"));
path = function () {
return data;
};
return data;
}
function _xml2js() {
const data = require("xml2js");
_xml2js = function () {
return data;
};
return data;
}
function _InterfaceBuilder() {
const data = require("./InterfaceBuilder");
_InterfaceBuilder = function () {
return data;
};
return data;
}
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
const STORYBOARD_FILE_PATH = exports.STORYBOARD_FILE_PATH = './SplashScreen.storyboard';
const STORYBOARD_MOD_NAME = 'splashScreenStoryboard';
/**
* Provides the SplashScreen `.storyboard` xml data for modification.
*
* @param config
* @param action
*/
const withIosSplashScreenStoryboard = (config, action) => {
return (0, _configPlugins().withMod)(config, {
platform: 'ios',
mod: STORYBOARD_MOD_NAME,
action
});
};
/** Append a custom rule to supply SplashScreen `.storyboard` xml data to mods on `mods.ios.splashScreenStoryboard` */
exports.withIosSplashScreenStoryboard = withIosSplashScreenStoryboard;
const withIosSplashScreenStoryboardBaseMod = config => {
return _configPlugins().BaseMods.withGeneratedBaseMods(config, {
platform: 'ios',
saveToInternal: true,
skipEmptyMod: false,
providers: {
// Append a custom rule to supply .storyboard xml data to mods on `mods.ios.splashScreenStoryboard`
[STORYBOARD_MOD_NAME]: _configPlugins().BaseMods.provider({
isIntrospective: true,
async getFilePath({
modRequest
}) {
//: [root]/myapp/ios/MyApp/SplashScreen.storyboard
return path().join(
//: myapp/ios
modRequest.platformProjectRoot,
// ./MyApp
modRequest.projectName,
// ./SplashScreen.storyboard
STORYBOARD_FILE_PATH);
},
async read(filePath) {
try {
const contents = await fs().promises.readFile(filePath, 'utf8');
const xml = await new (_xml2js().Parser)().parseStringPromise(contents);
return xml;
} catch {
return getTemplateAsync();
}
},
async write(filePath, {
modResults,
modRequest: {
introspect
}
}) {
if (introspect) {
return;
}
await fs().promises.writeFile(filePath, (0, _InterfaceBuilder().toString)(modResults));
}
})
}
});
};
/** Get a template splash screen storyboard file. */
exports.withIosSplashScreenStoryboardBaseMod = withIosSplashScreenStoryboardBaseMod;
async function getTemplateAsync() {
const contents = `<?xml version="1.0" encoding="UTF-8"?>
<document
type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version="3.0"
toolsVersion="16096"
targetRuntime="iOS.CocoaTouch"
propertyAccessControl="none"
useAutolayout="YES"
launchScreen="YES"
useTraitCollections="YES"
useSafeAreas="YES"
colorMatched="YES"
initialViewController="EXPO-VIEWCONTROLLER-1"
>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<scene sceneID="EXPO-SCENE-1">
<objects>
<viewController
storyboardIdentifier="SplashScreenViewController"
id="EXPO-VIEWCONTROLLER-1"
sceneMemberID="viewController"
>
<view
key="view"
userInteractionEnabled="NO"
contentMode="scaleToFill"
insetsLayoutMarginsFromSafeArea="NO"
id="EXPO-ContainerView"
userLabel="ContainerView"
>
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView
userInteractionEnabled="NO"
contentMode="scaleAspectFill"
horizontalHuggingPriority="251"
verticalHuggingPriority="251"
insetsLayoutMarginsFromSafeArea="NO"
image="SplashScreenBackground"
translatesAutoresizingMaskIntoConstraints="NO"
id="EXPO-SplashScreenBackground"
userLabel="SplashScreenBackground"
>
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
</imageView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="EXPO-SplashScreenBackground" firstAttribute="top" secondItem="EXPO-ContainerView" secondAttribute="top" id="1gX-mQ-vu6"/>
<constraint firstItem="EXPO-SplashScreenBackground" firstAttribute="leading" secondItem="EXPO-ContainerView" secondAttribute="leading" id="6tX-OG-Sck"/>
<constraint firstItem="EXPO-SplashScreenBackground" firstAttribute="trailing" secondItem="EXPO-ContainerView" secondAttribute="trailing" id="ABX-8g-7v4"/>
<constraint firstItem="EXPO-SplashScreenBackground" firstAttribute="bottom" secondItem="EXPO-ContainerView" secondAttribute="bottom" id="jkI-2V-eW5"/>
</constraints>
<viewLayoutGuide key="safeArea" id="EXPO-SafeArea"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="EXPO-PLACEHOLDER-1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
<resources>
<image name="SplashScreenBackground" width="1" height="1"/>
</resources>
</document>`;
return await new (_xml2js().Parser)().parseStringPromise(contents);
}
//# sourceMappingURL=withIosSplashScreenStoryboard.js.map

View File

@@ -0,0 +1,11 @@
import { ConfigPlugin } from '@expo/config-plugins';
import { XcodeProject } from 'xcode';
export declare const withIosSplashXcodeProject: ConfigPlugin;
/**
* Modifies `.pbxproj` by:
* - adding reference for `.storyboard` file
*/
export declare function setSplashStoryboardAsync({ projectName, project, }: {
projectName: string;
project: XcodeProject;
}): Promise<XcodeProject>;

Some files were not shown because too many files have changed in this diff Show More