@expo/config-plugins 4.0.6 → 4.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/build/Plugin.types.js +6 -6
- package/build/android/AllowBackup.js +1 -1
- package/build/android/Colors.js +3 -3
- package/build/android/EasBuild.js +1 -1
- package/build/android/GoogleServices.js +3 -3
- package/build/android/IntentFilters.js +1 -1
- package/build/android/JsEngine.js +2 -1
- package/build/android/JsEngine.js.map +1 -1
- package/build/android/Manifest.js +10 -10
- package/build/android/Name.d.ts +2 -1
- package/build/android/Name.js +7 -4
- package/build/android/Name.js.map +1 -1
- package/build/android/Orientation.js +2 -1
- package/build/android/Orientation.js.map +1 -1
- package/build/android/Package.js +4 -4
- package/build/android/Package.js.map +1 -1
- package/build/android/Paths.js +9 -9
- package/build/android/Permissions.js +6 -6
- package/build/android/Resources.js +5 -5
- package/build/android/Scheme.js +3 -3
- package/build/android/StatusBar.js +3 -3
- package/build/android/Strings.js +1 -1
- package/build/android/Styles.js +5 -5
- package/build/android/Updates.d.ts +0 -5
- package/build/android/Updates.js +14 -23
- package/build/android/Updates.js.map +1 -1
- package/build/android/Version.js +2 -2
- package/build/android/WindowSoftInputMode.js +1 -1
- package/build/android/codeMod.js +2 -2
- package/build/android/index.d.ts +1 -3
- package/build/android/index.js +1 -35
- package/build/android/index.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.js +57 -49
- package/build/index.js.map +1 -1
- package/build/ios/Bitcode.js +1 -1
- package/build/ios/BuildScheme.js +2 -2
- package/build/ios/BundleIdentifier.js +3 -3
- package/build/ios/DeviceFamily.js +3 -3
- package/build/ios/Entitlements.js +2 -2
- package/build/ios/Entitlements.js.map +1 -1
- package/build/ios/Google.js +2 -2
- package/build/ios/JsEngine.d.ts +2 -1
- package/build/ios/JsEngine.js +2 -1
- package/build/ios/JsEngine.js.map +1 -1
- package/build/ios/Locales.js +1 -1
- package/build/ios/Maps.js +29 -8
- package/build/ios/Maps.js.map +1 -1
- package/build/ios/Orientation.js +2 -1
- package/build/ios/Orientation.js.map +1 -1
- package/build/ios/Paths.js +14 -14
- package/build/ios/Paths.js.map +1 -1
- package/build/ios/Permissions.js +1 -1
- package/build/ios/Permissions.js.map +1 -1
- package/build/ios/Scheme.js +4 -4
- package/build/ios/Swift.js +2 -2
- package/build/ios/Target.js +5 -5
- package/build/ios/Updates.d.ts +0 -5
- package/build/ios/Updates.js +14 -23
- package/build/ios/Updates.js.map +1 -1
- package/build/ios/Version.js +3 -3
- package/build/ios/codeMod.js +2 -2
- package/build/ios/index.d.ts +1 -3
- package/build/ios/index.js +3 -35
- package/build/ios/index.js.map +1 -1
- package/build/ios/utils/Xcodeproj.js +9 -9
- package/build/plugins/android-plugins.js +1 -1
- package/build/plugins/createBaseMod.js +2 -2
- package/build/plugins/createBaseMod.js.map +1 -1
- package/build/plugins/ios-plugins.d.ts +2 -2
- package/build/plugins/ios-plugins.js +2 -2
- package/build/plugins/ios-plugins.js.map +1 -1
- package/build/plugins/mod-compiler.js +3 -3
- package/build/plugins/mod-compiler.js.map +1 -1
- package/build/plugins/withAndroidBaseMods.js +1 -1
- package/build/plugins/withIosBaseMods.d.ts +3 -3
- package/build/plugins/withIosBaseMods.js +1 -1
- package/build/plugins/withIosBaseMods.js.map +1 -1
- package/build/plugins/withStaticPlugin.js +16 -5
- package/build/plugins/withStaticPlugin.js.map +1 -1
- package/build/utils/Updates.d.ts +1 -0
- package/build/utils/Updates.js +24 -1
- package/build/utils/Updates.js.map +1 -1
- package/build/utils/XML.d.ts +6 -0
- package/build/utils/XML.js +57 -10
- package/build/utils/XML.js.map +1 -1
- package/build/utils/errors.js +1 -1
- package/build/utils/generateCode.js +2 -2
- package/build/utils/history.js +1 -1
- package/build/utils/modules.js +1 -1
- package/build/utils/plugin-resolver.js +4 -4
- package/build/utils/sortObject.js +2 -2
- package/build/utils/warnings.js +1 -1
- package/package.json +3 -3
- package/build/android/RootViewBackgroundColor.d.ts +0 -6
- package/build/android/RootViewBackgroundColor.js +0 -81
- package/build/android/RootViewBackgroundColor.js.map +0 -1
- package/build/android/UserInterfaceStyle.d.ts +0 -10
- package/build/android/UserInterfaceStyle.js +0 -119
- package/build/android/UserInterfaceStyle.js.map +0 -1
- package/build/ios/RootViewBackgroundColor.d.ts +0 -6
- package/build/ios/RootViewBackgroundColor.js +0 -70
- package/build/ios/RootViewBackgroundColor.js.map +0 -1
- package/build/ios/UserInterfaceStyle.d.ts +0 -5
- package/build/ios/UserInterfaceStyle.js +0 -59
- package/build/ios/UserInterfaceStyle.js.map +0 -1
package/build/utils/Updates.js
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getUpdateUrl = getUpdateUrl;
|
|
7
6
|
exports.getNativeVersion = getNativeVersion;
|
|
8
7
|
exports.getRuntimeVersion = getRuntimeVersion;
|
|
8
|
+
exports.getRuntimeVersionNullable = getRuntimeVersionNullable;
|
|
9
|
+
exports.getUpdateUrl = getUpdateUrl;
|
|
9
10
|
exports.withRuntimeVersion = void 0;
|
|
10
11
|
|
|
11
12
|
function _sdkRuntimeVersions() {
|
|
@@ -18,6 +19,16 @@ function _sdkRuntimeVersions() {
|
|
|
18
19
|
return data;
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
function _getenv() {
|
|
23
|
+
const data = require("getenv");
|
|
24
|
+
|
|
25
|
+
_getenv = function () {
|
|
26
|
+
return data;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
|
|
21
32
|
function _() {
|
|
22
33
|
const data = require("..");
|
|
23
34
|
|
|
@@ -97,6 +108,18 @@ const withRuntimeVersion = config => {
|
|
|
97
108
|
|
|
98
109
|
exports.withRuntimeVersion = withRuntimeVersion;
|
|
99
110
|
|
|
111
|
+
function getRuntimeVersionNullable(...[config, platform]) {
|
|
112
|
+
try {
|
|
113
|
+
return getRuntimeVersion(config, platform);
|
|
114
|
+
} catch (e) {
|
|
115
|
+
if ((0, _getenv().boolish)('EXPO_DEBUG', false)) {
|
|
116
|
+
console.log(e);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
100
123
|
function getRuntimeVersion(config, platform) {
|
|
101
124
|
var _config$platform$runt, _config$platform;
|
|
102
125
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/Updates.ts"],"names":["getUpdateUrl","config","username","updates","url","user","owner","slug","getNativeVersion","platform","version","IOSConfig","Version","getVersion","buildNumber","getBuildNumber","versionCode","AndroidConfig","getVersionCode","Error","withRuntimeVersion","ios","runtimeVersion","getRuntimeVersion","android","policy","sdkVersion","JSON","stringify"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/Updates.ts"],"names":["getUpdateUrl","config","username","updates","url","user","owner","slug","getNativeVersion","platform","version","IOSConfig","Version","getVersion","buildNumber","getBuildNumber","versionCode","AndroidConfig","getVersionCode","Error","withRuntimeVersion","ios","runtimeVersion","getRuntimeVersion","android","getRuntimeVersionNullable","e","console","log","policy","sdkVersion","JSON","stringify"],"mappings":";;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAOO,SAASA,YAAT,CACLC,MADK,EAELC,QAFK,EAGU;AAAA;;AACf,yBAAID,MAAM,CAACE,OAAX,4CAAI,gBAAgBC,GAApB,EAAyB;AAAA;;AACvB,+BAAOH,MAAM,CAACE,OAAd,qDAAO,iBAAgBC,GAAvB;AACD;;AAED,QAAMC,IAAI,GAAG,OAAOJ,MAAM,CAACK,KAAd,KAAwB,QAAxB,GAAmCL,MAAM,CAACK,KAA1C,GAAkDJ,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eVersionForSDKVersion } from '@expo/sdk-runtime-versions';\nimport { boolish } from 'getenv';\n\nimport { AndroidConfig, IOSConfig } from '..';\n\nexport type ExpoConfigUpdates = Pick<\n ExpoConfig,\n 'sdkVersion' | 'owner' | 'runtimeVersion' | 'updates' | 'slug'\n>;\n\nexport function getUpdateUrl(\n config: Pick<ExpoConfigUpdates, 'owner' | 'slug' | 'updates'>,\n username: string | null\n): string | null {\n if (config.updates?.url) {\n return config.updates?.url;\n }\n\n const user = typeof config.owner === 'string' ? config.owner : username;\n if (!user) {\n return null;\n }\n return `https://exp.host/@${user}/${config.slug}`;\n}\n\nexport function getNativeVersion(\n config: Pick<ExpoConfig, 'version'> & {\n android?: Pick<Android, 'versionCode'>;\n ios?: Pick<IOS, 'buildNumber'>;\n },\n platform: 'android' | 'ios'\n): string {\n const version = IOSConfig.Version.getVersion(config);\n switch (platform) {\n case 'ios': {\n const buildNumber = IOSConfig.Version.getBuildNumber(config);\n return `${version}(${buildNumber})`;\n }\n case 'android': {\n const versionCode = AndroidConfig.Version.getVersionCode(config);\n return `${version}(${versionCode})`;\n }\n default: {\n throw new Error(\n `\"${platform}\" is not a supported platform. Choose either \"ios\" or \"android\".`\n );\n }\n }\n}\n\n/**\n * Compute runtime version policies.\n * @return an expoConfig with only string valued platform specific runtime versions.\n */\nexport const withRuntimeVersion: (config: ExpoConfig) => ExpoConfig = config => {\n if (config.ios?.runtimeVersion || config.runtimeVersion) {\n config.ios = {\n ...config.ios,\n runtimeVersion: getRuntimeVersion(config, 'ios'),\n };\n }\n if (config.android?.runtimeVersion || config.runtimeVersion) {\n config.android = {\n ...config.android,\n runtimeVersion: getRuntimeVersion(config, 'android'),\n };\n }\n delete config.runtimeVersion;\n return config;\n};\n\nexport function getRuntimeVersionNullable(\n ...[config, platform]: Parameters<typeof getRuntimeVersion>\n): string | null {\n try {\n return getRuntimeVersion(config, platform);\n } catch (e) {\n if (boolish('EXPO_DEBUG', false)) {\n console.log(e);\n }\n return null;\n }\n}\n\nexport function getRuntimeVersion(\n config: Pick<ExpoConfig, 'version' | 'runtimeVersion' | 'sdkVersion'> & {\n android?: Pick<Android, 'versionCode' | 'runtimeVersion'>;\n ios?: Pick<IOS, 'buildNumber' | 'runtimeVersion'>;\n },\n platform: 'android' | 'ios'\n): string {\n const runtimeVersion = config[platform]?.runtimeVersion ?? config.runtimeVersion;\n if (!runtimeVersion) {\n throw new Error(\n `There is neither a value or a policy set for the runtime version on \"${platform}\"`\n );\n }\n\n if (typeof runtimeVersion === 'string') {\n return runtimeVersion;\n } else if (runtimeVersion.policy === 'nativeVersion') {\n return getNativeVersion(config, platform);\n } else if (runtimeVersion.policy === 'sdkVersion') {\n if (!config.sdkVersion) {\n throw new Error(\"An SDK version must be defined when using the 'sdkVersion' runtime policy.\");\n }\n return getRuntimeVersionForSDKVersion(config.sdkVersion);\n }\n\n throw new Error(\n `\"${\n typeof runtimeVersion === 'object' ? JSON.stringify(runtimeVersion) : runtimeVersion\n }\" is not a valid runtime version. getRuntimeVersion only supports a string, \"sdkVersion\", or \"nativeVersion\" policy.`\n );\n}\n"],"file":"Updates.js"}
|
package/build/utils/XML.d.ts
CHANGED
|
@@ -17,3 +17,9 @@ export declare function format(manifest: any, { indentLevel, newline }?: {
|
|
|
17
17
|
indentLevel?: number | undefined;
|
|
18
18
|
newline?: string | undefined;
|
|
19
19
|
}): string;
|
|
20
|
+
/**
|
|
21
|
+
* Escapes Android string literals, specifically characters `"`, `'`, `\`, `\n`, `\r`, `\t`
|
|
22
|
+
*
|
|
23
|
+
* @param value unescaped Android XML string literal.
|
|
24
|
+
*/
|
|
25
|
+
export declare function escapeAndroidString(value: string): string;
|
package/build/utils/XML.js
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
exports.readXMLAsync = readXMLAsync;
|
|
8
|
-
exports.parseXMLAsync = parseXMLAsync;
|
|
6
|
+
exports.escapeAndroidString = escapeAndroidString;
|
|
9
7
|
exports.format = format;
|
|
8
|
+
exports.parseXMLAsync = parseXMLAsync;
|
|
9
|
+
exports.readXMLAsync = readXMLAsync;
|
|
10
|
+
exports.writeXMLAsync = writeXMLAsync;
|
|
10
11
|
|
|
11
12
|
function _fsExtra() {
|
|
12
13
|
const data = _interopRequireDefault(require("fs-extra"));
|
|
@@ -51,7 +52,7 @@ function _xml2js() {
|
|
|
51
52
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
52
53
|
|
|
53
54
|
async function writeXMLAsync(options) {
|
|
54
|
-
const xml =
|
|
55
|
+
const xml = format(options.xml);
|
|
55
56
|
await _fsExtra().default.ensureDir(_path().default.dirname(options.path));
|
|
56
57
|
await _fsExtra().default.writeFile(options.path, xml);
|
|
57
58
|
}
|
|
@@ -88,9 +89,24 @@ function format(manifest, {
|
|
|
88
89
|
if (typeof manifest === 'string') {
|
|
89
90
|
xmlInput = manifest;
|
|
90
91
|
} else if (manifest.toString) {
|
|
92
|
+
var _manifest$resources;
|
|
93
|
+
|
|
91
94
|
const builder = new (_xml2js().Builder)({
|
|
92
95
|
headless: true
|
|
93
|
-
});
|
|
96
|
+
}); // For strings.xml
|
|
97
|
+
|
|
98
|
+
if (Array.isArray(manifest === null || manifest === void 0 ? void 0 : (_manifest$resources = manifest.resources) === null || _manifest$resources === void 0 ? void 0 : _manifest$resources.string)) {
|
|
99
|
+
for (const string of manifest === null || manifest === void 0 ? void 0 : (_manifest$resources2 = manifest.resources) === null || _manifest$resources2 === void 0 ? void 0 : _manifest$resources2.string) {
|
|
100
|
+
var _manifest$resources2;
|
|
101
|
+
|
|
102
|
+
if (string.$.translatable === 'false' || string.$.translatable === false) {
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
string._ = escapeAndroidString(string._);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
94
110
|
xmlInput = builder.buildObject(manifest);
|
|
95
111
|
return xmlInput;
|
|
96
112
|
} else {
|
|
@@ -108,9 +124,6 @@ function format(manifest, {
|
|
|
108
124
|
if (line.match(/.+<\/\w[^>]*>$/)) {
|
|
109
125
|
indent = 0;
|
|
110
126
|
} else if (line.match(/^<\/\w/)) {
|
|
111
|
-
// Somehow istanbul doesn't see the else case as covered, although it is. Skip it.
|
|
112
|
-
|
|
113
|
-
/* istanbul ignore else */
|
|
114
127
|
if (pad !== 0) {
|
|
115
128
|
pad -= 1;
|
|
116
129
|
}
|
|
@@ -121,10 +134,44 @@ function format(manifest, {
|
|
|
121
134
|
}
|
|
122
135
|
|
|
123
136
|
const padding = stringTimesN(pad, indentString);
|
|
124
|
-
formatted += padding + line + newline;
|
|
125
|
-
|
|
137
|
+
formatted += padding + line + newline;
|
|
126
138
|
pad += indent;
|
|
127
139
|
});
|
|
128
140
|
return formatted.trim();
|
|
129
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Escapes Android string literals, specifically characters `"`, `'`, `\`, `\n`, `\r`, `\t`
|
|
144
|
+
*
|
|
145
|
+
* @param value unescaped Android XML string literal.
|
|
146
|
+
*/
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
function escapeAndroidString(value) {
|
|
150
|
+
value = value.replace(/[\n\r\t'"@]/g, m => {
|
|
151
|
+
switch (m) {
|
|
152
|
+
case '"':
|
|
153
|
+
case "'":
|
|
154
|
+
case '@':
|
|
155
|
+
return '\\' + m;
|
|
156
|
+
|
|
157
|
+
case '\n':
|
|
158
|
+
return '\\n';
|
|
159
|
+
|
|
160
|
+
case '\r':
|
|
161
|
+
return '\\r';
|
|
162
|
+
|
|
163
|
+
case '\t':
|
|
164
|
+
return '\\t';
|
|
165
|
+
|
|
166
|
+
default:
|
|
167
|
+
throw new Error(`Cannot escape unhandled XML character: ${m}`);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
if (value.match(/(^\s|\s$)/)) {
|
|
172
|
+
value = '"' + value + '"';
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return value;
|
|
176
|
+
}
|
|
130
177
|
//# sourceMappingURL=XML.js.map
|
package/build/utils/XML.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/XML.ts"],"names":["writeXMLAsync","options","xml","
|
|
1
|
+
{"version":3,"sources":["../../src/utils/XML.ts"],"names":["writeXMLAsync","options","xml","format","fs","ensureDir","path","dirname","writeFile","readXMLAsync","contents","readFile","encoding","flag","parser","Parser","manifest","parseStringPromise","fallback","parseXMLAsync","stringTimesN","n","char","Array","join","indentLevel","newline","EOL","xmlInput","toString","builder","Builder","headless","isArray","resources","string","$","translatable","_","escapeAndroidString","buildObject","Error","indentString","formatted","regex","replace","pad","split","map","line","trim","forEach","indent","match","padding","value","m"],"mappings":";;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAUO,eAAeA,aAAf,CAA6BC,OAA7B,EAAiF;AACtF,QAAMC,GAAG,GAAGC,MAAM,CAACF,OAAO,CAACC,GAAT,CAAlB;AACA,QAAME,mBAAGC,SAAH,CAAaC,gBAAKC,OAAL,CAAaN,OAAO,CAACK,IAArB,CAAb,CAAN;AACA,QAAMF,mBAAGI,SAAH,CAAaP,OAAO,CAACK,IAArB,EAA2BJ,GAA3B,CAAN;AACD;;AAEM,eAAeO,YAAf,CAA4BR,OAA5B,EAGgB;AACrB,MAAIS,QAAgB,GAAG,EAAvB;;AACA,MAAI;AACFA,IAAAA,QAAQ,GAAG,MAAMN,mBAAGO,QAAH,CAAYV,OAAO,CAACK,IAApB,EAA0B;AAAEM,MAAAA,QAAQ,EAAE,MAAZ;AAAoBC,MAAAA,IAAI,EAAE;AAA1B,KA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C,IAAAA,SAAS,IAAIW,OAAO,GAAGL,IAAV,GAAiBvB,OAA9B;AACAoB,IAAAA,GAAG,IAAIM,MAAP;AACD,GApBH;AAsBA,SAAOT,SAAS,CAACO,IAAV,EAAP;AACD;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASX,mBAAT,CAA6BgB,KAA7B,EAAoD;AACzDA,EAAAA,KAAK,GAAGA,KAAK,CAACV,OAAN,CAAc,cAAd,EAA8BW,CAAC,IAAI;AACzC,YAAQA,CAAR;AACE,WAAK,GAAL;AACA,WAAK,GAAL;AACA,WAAK,GAAL;AACE,eAAO,OAAOA,CAAd;;AACF,WAAK,IAAL;AACE,eAAO,KAAP;;AACF,WAAK,IAAL;AACE,eAAO,KAAP;;AACF,WAAK,IAAL;AACE,eAAO,KAAP;;AACF;AACE,cAAM,IAAIf,KAAJ,CAAW,0CAAyCe,CAAE,EAAtD,CAAN;AAZJ;AAcD,GAfO,CAAR;;AAgBA,MAAID,KAAK,CAACF,KAAN,CAAY,WAAZ,CAAJ,EAA8B;AAC5BE,IAAAA,KAAK,GAAG,MAAMA,KAAN,GAAc,GAAtB;AACD;;AACD,SAAOA,KAAP;AACD","sourcesContent":["import fs from 'fs-extra';\nimport { EOL } from 'os';\nimport path from 'path';\nimport { Builder, Parser } from 'xml2js';\n\nexport type XMLValue = boolean | number | string | null | XMLArray | XMLObject;\n\nexport interface XMLArray extends Array<XMLValue> {}\n\nexport interface XMLObject {\n [key: string]: XMLValue | undefined;\n}\n\nexport async function writeXMLAsync(options: { path: string; xml: any }): Promise<void> {\n const xml = format(options.xml);\n await fs.ensureDir(path.dirname(options.path));\n await fs.writeFile(options.path, xml);\n}\n\nexport async function readXMLAsync(options: {\n path: string;\n fallback?: string | null;\n}): Promise<XMLObject> {\n let contents: string = '';\n try {\n contents = await fs.readFile(options.path, { encoding: 'utf8', flag: 'r' });\n } catch {\n // catch and use fallback\n }\n const parser = new Parser();\n const manifest = await parser.parseStringPromise(contents || options.fallback || '');\n return manifest;\n}\n\nexport async function parseXMLAsync(contents: string): Promise<XMLObject> {\n const xml = await new Parser().parseStringPromise(contents);\n return xml;\n}\n\nconst stringTimesN = (n: number, char: string) => Array(n + 1).join(char);\n\nexport function format(manifest: any, { indentLevel = 2, newline = EOL } = {}): string {\n let xmlInput: string;\n if (typeof manifest === 'string') {\n xmlInput = manifest;\n } else if (manifest.toString) {\n const builder = new Builder({\n headless: true,\n });\n\n // For strings.xml\n if (Array.isArray(manifest?.resources?.string)) {\n for (const string of manifest?.resources?.string) {\n if (string.$.translatable === 'false' || string.$.translatable === false) {\n continue;\n }\n string._ = escapeAndroidString(string._);\n }\n }\n\n xmlInput = builder.buildObject(manifest);\n\n return xmlInput;\n } else {\n throw new Error(`Invalid XML value passed in: ${manifest}`);\n }\n const indentString = stringTimesN(indentLevel, ' ');\n\n let formatted = '';\n const regex = /(>)(<)(\\/*)/g;\n const xml = xmlInput.replace(regex, `$1${newline}$2$3`);\n let pad = 0;\n xml\n .split(/\\r?\\n/)\n .map((line: string) => line.trim())\n .forEach((line: string) => {\n let indent = 0;\n if (line.match(/.+<\\/\\w[^>]*>$/)) {\n indent = 0;\n } else if (line.match(/^<\\/\\w/)) {\n if (pad !== 0) {\n pad -= 1;\n }\n } else if (line.match(/^<\\w([^>]*[^/])?>.*$/)) {\n indent = 1;\n } else {\n indent = 0;\n }\n\n const padding = stringTimesN(pad, indentString);\n formatted += padding + line + newline;\n pad += indent;\n });\n\n return formatted.trim();\n}\n\n/**\n * Escapes Android string literals, specifically characters `\"`, `'`, `\\`, `\\n`, `\\r`, `\\t`\n *\n * @param value unescaped Android XML string literal.\n */\nexport function escapeAndroidString(value: string): string {\n value = value.replace(/[\\n\\r\\t'\"@]/g, m => {\n switch (m) {\n case '\"':\n case \"'\":\n case '@':\n return '\\\\' + m;\n case '\\n':\n return '\\\\n';\n case '\\r':\n return '\\\\r';\n case '\\t':\n return '\\\\t';\n default:\n throw new Error(`Cannot escape unhandled XML character: ${m}`);\n }\n });\n if (value.match(/(^\\s|\\s$)/)) {\n value = '\"' + value + '\"';\n }\n return value;\n}\n"],"file":"XML.js"}
|
package/build/utils/errors.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.UnexpectedError = exports.PluginError = void 0;
|
|
7
7
|
|
|
8
8
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
9
|
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.createGeneratedHeaderComment = createGeneratedHeaderComment;
|
|
7
|
+
exports.createHash = createHash;
|
|
6
8
|
exports.mergeContents = mergeContents;
|
|
7
9
|
exports.removeContents = removeContents;
|
|
8
10
|
exports.removeGeneratedContents = removeGeneratedContents;
|
|
9
|
-
exports.createGeneratedHeaderComment = createGeneratedHeaderComment;
|
|
10
|
-
exports.createHash = createHash;
|
|
11
11
|
|
|
12
12
|
function _crypto() {
|
|
13
13
|
const data = _interopRequireDefault(require("crypto"));
|
package/build/utils/history.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getHistoryItem = getHistoryItem;
|
|
7
6
|
exports.addHistoryItem = addHistoryItem;
|
|
7
|
+
exports.getHistoryItem = getHistoryItem;
|
|
8
8
|
|
|
9
9
|
function getHistoryItem(config, name) {
|
|
10
10
|
var _config$_internal$plu, _config$_internal, _config$_internal$plu2;
|
package/build/utils/modules.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.fileExistsAsync = fileExistsAsync;
|
|
7
6
|
exports.directoryExistsAsync = directoryExistsAsync;
|
|
8
7
|
exports.fileExists = fileExists;
|
|
8
|
+
exports.fileExistsAsync = fileExistsAsync;
|
|
9
9
|
|
|
10
10
|
function _fs() {
|
|
11
11
|
const data = _interopRequireDefault(require("fs"));
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.assertInternalProjectRoot = assertInternalProjectRoot;
|
|
7
7
|
exports.moduleNameIsDirectFileReference = moduleNameIsDirectFileReference;
|
|
8
8
|
exports.normalizeStaticPlugin = normalizeStaticPlugin;
|
|
9
|
-
exports.
|
|
9
|
+
exports.pluginFileName = void 0;
|
|
10
|
+
exports.resolveConfigPluginExport = resolveConfigPluginExport;
|
|
10
11
|
exports.resolveConfigPluginFunction = resolveConfigPluginFunction;
|
|
11
12
|
exports.resolveConfigPluginFunctionWithInfo = resolveConfigPluginFunctionWithInfo;
|
|
12
|
-
exports.
|
|
13
|
-
exports.pluginFileName = void 0;
|
|
13
|
+
exports.resolvePluginForModule = resolvePluginForModule;
|
|
14
14
|
|
|
15
15
|
function _assert() {
|
|
16
16
|
const data = _interopRequireDefault(require("assert"));
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.reverseSortString = void 0;
|
|
7
7
|
exports.sortObjWithOrder = sortObjWithOrder;
|
|
8
|
+
exports.sortObject = sortObject;
|
|
8
9
|
exports.sortWithOrder = sortWithOrder;
|
|
9
|
-
exports.reverseSortString = void 0;
|
|
10
10
|
|
|
11
11
|
function sortObject(obj, compareFn) {
|
|
12
12
|
return Object.keys(obj).sort(compareFn).reduce((acc, key) => ({ ...acc,
|
package/build/utils/warnings.js
CHANGED
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.addWarningAndroid = addWarningAndroid;
|
|
7
|
-
exports.addWarningIOS = addWarningIOS;
|
|
8
7
|
exports.addWarningForPlatform = addWarningForPlatform;
|
|
8
|
+
exports.addWarningIOS = addWarningIOS;
|
|
9
9
|
|
|
10
10
|
function _chalk() {
|
|
11
11
|
const data = _interopRequireDefault(require("chalk"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/config-plugins",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.10",
|
|
4
4
|
"description": "A library for Expo config plugins",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@expo/config-types": "^43.0.1",
|
|
36
|
-
"@expo/json-file": "8.2.
|
|
37
|
-
"@expo/plist": "0.0.
|
|
36
|
+
"@expo/json-file": "8.2.34",
|
|
37
|
+
"@expo/plist": "0.0.16",
|
|
38
38
|
"@react-native/normalize-color": "^2.0.0",
|
|
39
39
|
"chalk": "^4.1.2",
|
|
40
40
|
"debug": "^4.3.1",
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ExpoConfig } from '@expo/config-types';
|
|
2
|
-
import { ConfigPlugin } from '../Plugin.types';
|
|
3
|
-
export declare const withRootViewBackgroundColor: ConfigPlugin;
|
|
4
|
-
export declare const withRootViewBackgroundColorColors: ConfigPlugin;
|
|
5
|
-
export declare const withRootViewBackgroundColorStyles: ConfigPlugin;
|
|
6
|
-
export declare function getRootViewBackgroundColor(config: Pick<ExpoConfig, 'android' | 'backgroundColor'>): string | null;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getRootViewBackgroundColor = getRootViewBackgroundColor;
|
|
7
|
-
exports.withRootViewBackgroundColorStyles = exports.withRootViewBackgroundColorColors = exports.withRootViewBackgroundColor = void 0;
|
|
8
|
-
|
|
9
|
-
function _androidPlugins() {
|
|
10
|
-
const data = require("../plugins/android-plugins");
|
|
11
|
-
|
|
12
|
-
_androidPlugins = function () {
|
|
13
|
-
return data;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
return data;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function _Colors() {
|
|
20
|
-
const data = require("./Colors");
|
|
21
|
-
|
|
22
|
-
_Colors = function () {
|
|
23
|
-
return data;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
return data;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function _Styles() {
|
|
30
|
-
const data = require("./Styles");
|
|
31
|
-
|
|
32
|
-
_Styles = function () {
|
|
33
|
-
return data;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
return data;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const ANDROID_WINDOW_BACKGROUND = 'android:windowBackground';
|
|
40
|
-
const WINDOW_BACKGROUND_COLOR = 'activityBackground';
|
|
41
|
-
|
|
42
|
-
const withRootViewBackgroundColor = config => {
|
|
43
|
-
config = withRootViewBackgroundColorColors(config);
|
|
44
|
-
config = withRootViewBackgroundColorStyles(config);
|
|
45
|
-
return config;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
exports.withRootViewBackgroundColor = withRootViewBackgroundColor;
|
|
49
|
-
|
|
50
|
-
const withRootViewBackgroundColorColors = config => {
|
|
51
|
-
return (0, _androidPlugins().withAndroidColors)(config, async config => {
|
|
52
|
-
config.modResults = (0, _Colors().assignColorValue)(config.modResults, {
|
|
53
|
-
value: getRootViewBackgroundColor(config),
|
|
54
|
-
name: WINDOW_BACKGROUND_COLOR
|
|
55
|
-
});
|
|
56
|
-
return config;
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
exports.withRootViewBackgroundColorColors = withRootViewBackgroundColorColors;
|
|
61
|
-
|
|
62
|
-
const withRootViewBackgroundColorStyles = config => {
|
|
63
|
-
return (0, _androidPlugins().withAndroidStyles)(config, async config => {
|
|
64
|
-
config.modResults = (0, _Styles().assignStylesValue)(config.modResults, {
|
|
65
|
-
add: !!getRootViewBackgroundColor(config),
|
|
66
|
-
parent: (0, _Styles().getAppThemeLightNoActionBarGroup)(),
|
|
67
|
-
name: ANDROID_WINDOW_BACKGROUND,
|
|
68
|
-
value: `@color/${WINDOW_BACKGROUND_COLOR}`
|
|
69
|
-
});
|
|
70
|
-
return config;
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
exports.withRootViewBackgroundColorStyles = withRootViewBackgroundColorStyles;
|
|
75
|
-
|
|
76
|
-
function getRootViewBackgroundColor(config) {
|
|
77
|
-
var _config$android;
|
|
78
|
-
|
|
79
|
-
return ((_config$android = config.android) === null || _config$android === void 0 ? void 0 : _config$android.backgroundColor) || config.backgroundColor || null;
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=RootViewBackgroundColor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/android/RootViewBackgroundColor.ts"],"names":["ANDROID_WINDOW_BACKGROUND","WINDOW_BACKGROUND_COLOR","withRootViewBackgroundColor","config","withRootViewBackgroundColorColors","withRootViewBackgroundColorStyles","modResults","value","getRootViewBackgroundColor","name","add","parent","android","backgroundColor"],"mappings":";;;;;;;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA,MAAMA,yBAAyB,GAAG,0BAAlC;AACA,MAAMC,uBAAuB,GAAG,oBAAhC;;AAEO,MAAMC,2BAAyC,GAAGC,MAAM,IAAI;AACjEA,EAAAA,MAAM,GAAGC,iCAAiC,CAACD,MAAD,CAA1C;AACAA,EAAAA,MAAM,GAAGE,iCAAiC,CAACF,MAAD,CAA1C;AACA,SAAOA,MAAP;AACD,CAJM;;;;AAMA,MAAMC,iCAA+C,GAAGD,MAAM,IAAI;AACvE,SAAO,yCAAkBA,MAAlB,EAA0B,MAAMA,MAAN,IAAgB;AAC/CA,IAAAA,MAAM,CAACG,UAAP,GAAoB,gCAAiBH,MAAM,CAACG,UAAxB,EAAoC;AACtDC,MAAAA,KAAK,EAAEC,0BAA0B,CAACL,MAAD,CADqB;AAEtDM,MAAAA,IAAI,EAAER;AAFgD,KAApC,CAApB;AAIA,WAAOE,MAAP;AACD,GANM,CAAP;AAOD,CARM;;;;AAUA,MAAME,iCAA+C,GAAGF,MAAM,IAAI;AACvE,SAAO,yCAAkBA,MAAlB,EAA0B,MAAMA,MAAN,IAAgB;AAC/CA,IAAAA,MAAM,CAACG,UAAP,GAAoB,iCAAkBH,MAAM,CAACG,UAAzB,EAAqC;AACvDI,MAAAA,GAAG,EAAE,CAAC,CAACF,0BAA0B,CAACL,MAAD,CADsB;AAEvDQ,MAAAA,MAAM,EAAE,iDAF+C;AAGvDF,MAAAA,IAAI,EAAET,yBAHiD;AAIvDO,MAAAA,KAAK,EAAG,UAASN,uBAAwB;AAJc,KAArC,CAApB;AAMA,WAAOE,MAAP;AACD,GARM,CAAP;AASD,CAVM;;;;AAYA,SAASK,0BAAT,CACLL,MADK,EAEL;AAAA;;AACA,SAAO,oBAAAA,MAAM,CAACS,OAAP,oEAAgBC,eAAhB,KAAmCV,MAAM,CAACU,eAA1C,IAA6D,IAApE;AACD","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withAndroidColors, withAndroidStyles } from '../plugins/android-plugins';\nimport { assignColorValue } from './Colors';\nimport { assignStylesValue, getAppThemeLightNoActionBarGroup } from './Styles';\n\nconst ANDROID_WINDOW_BACKGROUND = 'android:windowBackground';\nconst WINDOW_BACKGROUND_COLOR = 'activityBackground';\n\nexport const withRootViewBackgroundColor: ConfigPlugin = config => {\n config = withRootViewBackgroundColorColors(config);\n config = withRootViewBackgroundColorStyles(config);\n return config;\n};\n\nexport const withRootViewBackgroundColorColors: ConfigPlugin = config => {\n return withAndroidColors(config, async config => {\n config.modResults = assignColorValue(config.modResults, {\n value: getRootViewBackgroundColor(config),\n name: WINDOW_BACKGROUND_COLOR,\n });\n return config;\n });\n};\n\nexport const withRootViewBackgroundColorStyles: ConfigPlugin = config => {\n return withAndroidStyles(config, async config => {\n config.modResults = assignStylesValue(config.modResults, {\n add: !!getRootViewBackgroundColor(config),\n parent: getAppThemeLightNoActionBarGroup(),\n name: ANDROID_WINDOW_BACKGROUND,\n value: `@color/${WINDOW_BACKGROUND_COLOR}`,\n });\n return config;\n });\n};\n\nexport function getRootViewBackgroundColor(\n config: Pick<ExpoConfig, 'android' | 'backgroundColor'>\n) {\n return config.android?.backgroundColor || config.backgroundColor || null;\n}\n"],"file":"RootViewBackgroundColor.js"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ExpoConfig } from '@expo/config-types';
|
|
2
|
-
import { ConfigPlugin } from '../Plugin.types';
|
|
3
|
-
import { AndroidManifest } from './Manifest';
|
|
4
|
-
export declare const CONFIG_CHANGES_ATTRIBUTE = "android:configChanges";
|
|
5
|
-
export declare const ON_CONFIGURATION_CHANGED = "\npublic class MainActivity extends ReactActivity {\n\n // Added automatically by Expo Config\n @Override\n public void onConfigurationChanged(Configuration newConfig) {\n super.onConfigurationChanged(newConfig);\n Intent intent = new Intent(\"onConfigurationChanged\");\n intent.putExtra(\"newConfig\", newConfig);\n sendBroadcast(intent);\n }\n";
|
|
6
|
-
export declare const withUiModeManifest: ConfigPlugin<void>;
|
|
7
|
-
export declare const withUiModeMainActivity: ConfigPlugin;
|
|
8
|
-
export declare function getUserInterfaceStyle(config: Pick<ExpoConfig, 'android' | 'userInterfaceStyle'>): string;
|
|
9
|
-
export declare function setUiModeAndroidManifest(config: Pick<ExpoConfig, 'android' | 'userInterfaceStyle'>, androidManifest: AndroidManifest): AndroidManifest;
|
|
10
|
-
export declare function addOnConfigurationChangedMainActivity(config: Pick<ExpoConfig, 'android' | 'userInterfaceStyle'>, mainActivity: string): string;
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getUserInterfaceStyle = getUserInterfaceStyle;
|
|
7
|
-
exports.setUiModeAndroidManifest = setUiModeAndroidManifest;
|
|
8
|
-
exports.addOnConfigurationChangedMainActivity = addOnConfigurationChangedMainActivity;
|
|
9
|
-
exports.withUiModeMainActivity = exports.withUiModeManifest = exports.ON_CONFIGURATION_CHANGED = exports.CONFIG_CHANGES_ATTRIBUTE = void 0;
|
|
10
|
-
|
|
11
|
-
function _androidPlugins() {
|
|
12
|
-
const data = require("../plugins/android-plugins");
|
|
13
|
-
|
|
14
|
-
_androidPlugins = function () {
|
|
15
|
-
return data;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
return data;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function _warnings() {
|
|
22
|
-
const data = require("../utils/warnings");
|
|
23
|
-
|
|
24
|
-
_warnings = function () {
|
|
25
|
-
return data;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
return data;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function _Manifest() {
|
|
32
|
-
const data = require("./Manifest");
|
|
33
|
-
|
|
34
|
-
_Manifest = function () {
|
|
35
|
-
return data;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
return data;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function _codeMod() {
|
|
42
|
-
const data = require("./codeMod");
|
|
43
|
-
|
|
44
|
-
_codeMod = function () {
|
|
45
|
-
return data;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
return data;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const CONFIG_CHANGES_ATTRIBUTE = 'android:configChanges';
|
|
52
|
-
exports.CONFIG_CHANGES_ATTRIBUTE = CONFIG_CHANGES_ATTRIBUTE;
|
|
53
|
-
const ON_CONFIGURATION_CHANGED = `
|
|
54
|
-
public class MainActivity extends ReactActivity {
|
|
55
|
-
|
|
56
|
-
// Added automatically by Expo Config
|
|
57
|
-
@Override
|
|
58
|
-
public void onConfigurationChanged(Configuration newConfig) {
|
|
59
|
-
super.onConfigurationChanged(newConfig);
|
|
60
|
-
Intent intent = new Intent("onConfigurationChanged");
|
|
61
|
-
intent.putExtra("newConfig", newConfig);
|
|
62
|
-
sendBroadcast(intent);
|
|
63
|
-
}
|
|
64
|
-
`;
|
|
65
|
-
exports.ON_CONFIGURATION_CHANGED = ON_CONFIGURATION_CHANGED;
|
|
66
|
-
const withUiModeManifest = (0, _androidPlugins().createAndroidManifestPlugin)(setUiModeAndroidManifest, 'withUiModeManifest');
|
|
67
|
-
exports.withUiModeManifest = withUiModeManifest;
|
|
68
|
-
|
|
69
|
-
const withUiModeMainActivity = config => {
|
|
70
|
-
return (0, _androidPlugins().withMainActivity)(config, config => {
|
|
71
|
-
if (config.modResults.language === 'java') {
|
|
72
|
-
config.modResults.contents = addOnConfigurationChangedMainActivity(config, config.modResults.contents);
|
|
73
|
-
} else {
|
|
74
|
-
(0, _warnings().addWarningAndroid)('android.userInterfaceStyle', `Cannot automatically configure MainActivity if it's not java`);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return config;
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
exports.withUiModeMainActivity = withUiModeMainActivity;
|
|
82
|
-
|
|
83
|
-
function getUserInterfaceStyle(config) {
|
|
84
|
-
var _ref, _config$android$userI, _config$android;
|
|
85
|
-
|
|
86
|
-
return (_ref = (_config$android$userI = (_config$android = config.android) === null || _config$android === void 0 ? void 0 : _config$android.userInterfaceStyle) !== null && _config$android$userI !== void 0 ? _config$android$userI : config.userInterfaceStyle) !== null && _ref !== void 0 ? _ref : 'light';
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function setUiModeAndroidManifest(config, androidManifest) {
|
|
90
|
-
const userInterfaceStyle = getUserInterfaceStyle(config); // TODO: Remove this if we decide to remove any uiMode configuration when not specified
|
|
91
|
-
|
|
92
|
-
if (!userInterfaceStyle) {
|
|
93
|
-
return androidManifest;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const mainActivity = (0, _Manifest().getMainActivityOrThrow)(androidManifest);
|
|
97
|
-
mainActivity.$[CONFIG_CHANGES_ATTRIBUTE] = 'keyboard|keyboardHidden|orientation|screenSize|uiMode';
|
|
98
|
-
return androidManifest;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function addOnConfigurationChangedMainActivity(config, mainActivity) {
|
|
102
|
-
var _mainActivity$match;
|
|
103
|
-
|
|
104
|
-
const userInterfaceStyle = getUserInterfaceStyle(config);
|
|
105
|
-
|
|
106
|
-
if (!userInterfaceStyle) {
|
|
107
|
-
return mainActivity;
|
|
108
|
-
} // Cruzan: this is not ideal, but I'm not sure of a better way to handle writing to MainActivity.java
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if ((_mainActivity$match = mainActivity.match(`onConfigurationChanged`)) !== null && _mainActivity$match !== void 0 && _mainActivity$match.length) {
|
|
112
|
-
return mainActivity;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const MainActivityWithImports = (0, _codeMod().addImports)(mainActivity, ['android.content.Intent', 'android.content.res.Configuration'], true);
|
|
116
|
-
const pattern = new RegExp(`public class MainActivity extends ReactActivity {`);
|
|
117
|
-
return MainActivityWithImports.replace(pattern, ON_CONFIGURATION_CHANGED);
|
|
118
|
-
}
|
|
119
|
-
//# sourceMappingURL=UserInterfaceStyle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/android/UserInterfaceStyle.ts"],"names":["CONFIG_CHANGES_ATTRIBUTE","ON_CONFIGURATION_CHANGED","withUiModeManifest","setUiModeAndroidManifest","withUiModeMainActivity","config","modResults","language","contents","addOnConfigurationChangedMainActivity","getUserInterfaceStyle","android","userInterfaceStyle","androidManifest","mainActivity","$","match","length","MainActivityWithImports","pattern","RegExp","replace"],"mappings":";;;;;;;;;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,wBAAwB,GAAG,uBAAjC;;AAEA,MAAMC,wBAAwB,GAAI;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAXO;;AAaA,MAAMC,kBAAkB,GAAG,mDAChCC,wBADgC,EAEhC,oBAFgC,CAA3B;;;AAKA,MAAMC,sBAAoC,GAAGC,MAAM,IAAI;AAC5D,SAAO,wCAAiBA,MAAjB,EAAyBA,MAAM,IAAI;AACxC,QAAIA,MAAM,CAACC,UAAP,CAAkBC,QAAlB,KAA+B,MAAnC,EAA2C;AACzCF,MAAAA,MAAM,CAACC,UAAP,CAAkBE,QAAlB,GAA6BC,qCAAqC,CAChEJ,MADgE,EAEhEA,MAAM,CAACC,UAAP,CAAkBE,QAF8C,CAAlE;AAID,KALD,MAKO;AACL,yCACE,4BADF,EAEG,8DAFH;AAID;;AACD,WAAOH,MAAP;AACD,GAbM,CAAP;AAcD,CAfM;;;;AAiBA,SAASK,qBAAT,CACLL,MADK,EAEG;AAAA;;AACR,6DAAOA,MAAM,CAACM,OAAd,oDAAO,gBAAgBC,kBAAvB,yEAA6CP,MAAM,CAACO,kBAApD,uCAA0E,OAA1E;AACD;;AAEM,SAAST,wBAAT,CACLE,MADK,EAELQ,eAFK,EAGL;AACA,QAAMD,kBAAkB,GAAGF,qBAAqB,CAACL,MAAD,CAAhD,CADA,CAEA;;AACA,MAAI,CAACO,kBAAL,EAAyB;AACvB,WAAOC,eAAP;AACD;;AAED,QAAMC,YAAY,GAAG,wCAAuBD,eAAvB,CAArB;AACAC,EAAAA,YAAY,CAACC,CAAb,CAAef,wBAAf,IACE,uDADF;AAGA,SAAOa,eAAP;AACD;;AAEM,SAASJ,qCAAT,CACLJ,MADK,EAELS,YAFK,EAGG;AAAA;;AACR,QAAMF,kBAAkB,GAAGF,qBAAqB,CAACL,MAAD,CAAhD;;AACA,MAAI,CAACO,kBAAL,EAAyB;AACvB,WAAOE,YAAP;AACD,GAJO,CAMR;;;AACA,6BAAIA,YAAY,CAACE,KAAb,CAAoB,wBAApB,CAAJ,gDAAI,oBAA8CC,MAAlD,EAA0D;AACxD,WAAOH,YAAP;AACD;;AAED,QAAMI,uBAAuB,GAAG,2BAC9BJ,YAD8B,EAE9B,CAAC,wBAAD,EAA2B,mCAA3B,CAF8B,EAG9B,IAH8B,CAAhC;AAMA,QAAMK,OAAO,GAAG,IAAIC,MAAJ,CAAY,mDAAZ,CAAhB;AACA,SAAOF,uBAAuB,CAACG,OAAxB,CAAgCF,OAAhC,EAAyClB,wBAAzC,CAAP;AACD","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { createAndroidManifestPlugin, withMainActivity } from '../plugins/android-plugins';\nimport { addWarningAndroid } from '../utils/warnings';\nimport { AndroidManifest, getMainActivityOrThrow } from './Manifest';\nimport { addImports } from './codeMod';\n\nexport const CONFIG_CHANGES_ATTRIBUTE = 'android:configChanges';\n\nexport const ON_CONFIGURATION_CHANGED = `\npublic class MainActivity extends ReactActivity {\n\n // Added automatically by Expo Config\n @Override\n public void onConfigurationChanged(Configuration newConfig) {\n super.onConfigurationChanged(newConfig);\n Intent intent = new Intent(\"onConfigurationChanged\");\n intent.putExtra(\"newConfig\", newConfig);\n sendBroadcast(intent);\n }\n`;\n\nexport const withUiModeManifest = createAndroidManifestPlugin(\n setUiModeAndroidManifest,\n 'withUiModeManifest'\n);\n\nexport const withUiModeMainActivity: ConfigPlugin = config => {\n return withMainActivity(config, config => {\n if (config.modResults.language === 'java') {\n config.modResults.contents = addOnConfigurationChangedMainActivity(\n config,\n config.modResults.contents\n );\n } else {\n addWarningAndroid(\n 'android.userInterfaceStyle',\n `Cannot automatically configure MainActivity if it's not java`\n );\n }\n return config;\n });\n};\n\nexport function getUserInterfaceStyle(\n config: Pick<ExpoConfig, 'android' | 'userInterfaceStyle'>\n): string {\n return config.android?.userInterfaceStyle ?? config.userInterfaceStyle ?? 'light';\n}\n\nexport function setUiModeAndroidManifest(\n config: Pick<ExpoConfig, 'android' | 'userInterfaceStyle'>,\n androidManifest: AndroidManifest\n) {\n const userInterfaceStyle = getUserInterfaceStyle(config);\n // TODO: Remove this if we decide to remove any uiMode configuration when not specified\n if (!userInterfaceStyle) {\n return androidManifest;\n }\n\n const mainActivity = getMainActivityOrThrow(androidManifest);\n mainActivity.$[CONFIG_CHANGES_ATTRIBUTE] =\n 'keyboard|keyboardHidden|orientation|screenSize|uiMode';\n\n return androidManifest;\n}\n\nexport function addOnConfigurationChangedMainActivity(\n config: Pick<ExpoConfig, 'android' | 'userInterfaceStyle'>,\n mainActivity: string\n): string {\n const userInterfaceStyle = getUserInterfaceStyle(config);\n if (!userInterfaceStyle) {\n return mainActivity;\n }\n\n // Cruzan: this is not ideal, but I'm not sure of a better way to handle writing to MainActivity.java\n if (mainActivity.match(`onConfigurationChanged`)?.length) {\n return mainActivity;\n }\n\n const MainActivityWithImports = addImports(\n mainActivity,\n ['android.content.Intent', 'android.content.res.Configuration'],\n true\n );\n\n const pattern = new RegExp(`public class MainActivity extends ReactActivity {`);\n return MainActivityWithImports.replace(pattern, ON_CONFIGURATION_CHANGED);\n}\n"],"file":"UserInterfaceStyle.js"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ExpoConfig } from '@expo/config-types';
|
|
2
|
-
import { ConfigPlugin } from '../Plugin.types';
|
|
3
|
-
import { InfoPlist } from './IosConfig.types';
|
|
4
|
-
export declare const withRootViewBackgroundColor: ConfigPlugin;
|
|
5
|
-
export declare function setRootViewBackgroundColor(config: Pick<ExpoConfig, 'backgroundColor' | 'ios'>, infoPlist: InfoPlist): InfoPlist;
|
|
6
|
-
export declare function getRootViewBackgroundColor(config: Pick<ExpoConfig, 'ios' | 'backgroundColor'>): string | null;
|