@expo/config-plugins 5.0.4 → 6.0.0
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/build/Plugin.types.d.ts +7 -7
- package/build/Plugin.types.js +0 -9
- package/build/Plugin.types.js.map +1 -1
- package/build/android/AllowBackup.js +0 -15
- package/build/android/AllowBackup.js.map +1 -1
- package/build/android/BuildProperties.js +2 -16
- package/build/android/BuildProperties.js.map +1 -1
- package/build/android/Colors.js +3 -25
- package/build/android/Colors.js.map +1 -1
- package/build/android/EasBuild.js +2 -22
- package/build/android/EasBuild.js.map +1 -1
- package/build/android/EasBuildGradleScript.js.map +1 -1
- package/build/android/GoogleMapsApiKey.js +0 -12
- package/build/android/GoogleMapsApiKey.js.map +1 -1
- package/build/android/GoogleServices.js +10 -48
- package/build/android/GoogleServices.js.map +1 -1
- package/build/android/IntentFilters.d.ts +1 -1
- package/build/android/IntentFilters.js +8 -24
- package/build/android/IntentFilters.js.map +1 -1
- package/build/android/Manifest.d.ts +19 -19
- package/build/android/Manifest.js +7 -66
- package/build/android/Manifest.js.map +1 -1
- package/build/android/Name.js +6 -27
- package/build/android/Name.js.map +1 -1
- package/build/android/Orientation.js +2 -12
- package/build/android/Orientation.js.map +1 -1
- package/build/android/Package.js +26 -111
- package/build/android/Package.js.map +1 -1
- package/build/android/Paths.d.ts +2 -2
- package/build/android/Paths.js +0 -47
- package/build/android/Paths.js.map +1 -1
- package/build/android/Permissions.js +8 -52
- package/build/android/Permissions.js.map +1 -1
- package/build/android/PrimaryColor.js +0 -18
- package/build/android/PrimaryColor.js.map +1 -1
- package/build/android/Properties.d.ts +1 -1
- package/build/android/Properties.js +0 -9
- package/build/android/Properties.js.map +1 -1
- package/build/android/Resources.d.ts +4 -4
- package/build/android/Resources.js +9 -29
- package/build/android/Resources.js.map +1 -1
- package/build/android/Scheme.d.ts +1 -1
- package/build/android/Scheme.js +13 -66
- package/build/android/Scheme.js.map +1 -1
- package/build/android/StatusBar.js +5 -33
- package/build/android/StatusBar.js.map +1 -1
- package/build/android/Strings.js +0 -14
- package/build/android/Strings.js.map +1 -1
- package/build/android/Styles.js +7 -34
- package/build/android/Styles.js.map +1 -1
- package/build/android/Updates.d.ts +2 -0
- package/build/android/Updates.js +50 -47
- package/build/android/Updates.js.map +1 -1
- package/build/android/Version.js +3 -29
- package/build/android/Version.js.map +1 -1
- package/build/android/WindowSoftInputMode.js +0 -14
- package/build/android/WindowSoftInputMode.js.map +1 -1
- package/build/android/codeMod.js +6 -22
- package/build/android/codeMod.js.map +1 -1
- package/build/android/index.js +0 -94
- package/build/android/index.js.map +1 -1
- package/build/index.js +2 -65
- package/build/index.js.map +1 -1
- package/build/ios/Bitcode.d.ts +1 -1
- package/build/ios/Bitcode.js +8 -28
- package/build/ios/Bitcode.js.map +1 -1
- package/build/ios/BuildProperties.js +2 -14
- package/build/ios/BuildProperties.js.map +1 -1
- package/build/ios/BuildScheme.js +2 -34
- package/build/ios/BuildScheme.js.map +1 -1
- package/build/ios/BundleIdentifier.js +13 -72
- package/build/ios/BundleIdentifier.js.map +1 -1
- package/build/ios/DeviceFamily.js +6 -24
- package/build/ios/DeviceFamily.js.map +1 -1
- package/build/ios/Entitlements.js +4 -45
- package/build/ios/Entitlements.js.map +1 -1
- package/build/ios/Google.d.ts +2 -2
- package/build/ios/Google.js +11 -66
- package/build/ios/Google.js.map +1 -1
- package/build/ios/IosConfig.types.d.ts +6 -11
- package/build/ios/IosConfig.types.js.map +1 -1
- package/build/ios/Locales.d.ts +3 -3
- package/build/ios/Locales.js +12 -43
- package/build/ios/Locales.js.map +1 -1
- package/build/ios/Maps.js +15 -53
- package/build/ios/Maps.js.map +1 -1
- package/build/ios/Name.js +7 -31
- package/build/ios/Name.js.map +1 -1
- package/build/ios/Orientation.js +2 -10
- package/build/ios/Orientation.js.map +1 -1
- package/build/ios/Paths.d.ts +2 -2
- package/build/ios/Paths.js +8 -73
- package/build/ios/Paths.js.map +1 -1
- package/build/ios/Permissions.js +1 -16
- package/build/ios/Permissions.js.map +1 -1
- package/build/ios/ProvisioningProfile.d.ts +1 -1
- package/build/ios/ProvisioningProfile.js +0 -18
- package/build/ios/ProvisioningProfile.js.map +1 -1
- package/build/ios/RequiresFullScreen.js +19 -31
- package/build/ios/RequiresFullScreen.js.map +1 -1
- package/build/ios/Scheme.js +10 -32
- package/build/ios/Scheme.js.map +1 -1
- package/build/ios/Swift.js +16 -50
- package/build/ios/Swift.js.map +1 -1
- package/build/ios/Target.js +0 -30
- package/build/ios/Target.js.map +1 -1
- package/build/ios/Updates.js +10 -49
- package/build/ios/Updates.js.map +1 -1
- package/build/ios/UsesNonExemptEncryption.js +4 -10
- package/build/ios/UsesNonExemptEncryption.js.map +1 -1
- package/build/ios/Version.js +4 -11
- package/build/ios/Version.js.map +1 -1
- package/build/ios/XcodeProjectFile.js +5 -23
- package/build/ios/XcodeProjectFile.js.map +1 -1
- package/build/ios/codeMod.js +19 -60
- package/build/ios/codeMod.js.map +1 -1
- package/build/ios/index.js +0 -97
- package/build/ios/index.js.map +1 -1
- package/build/ios/utils/Xcodeproj.d.ts +6 -6
- package/build/ios/utils/Xcodeproj.js +15 -101
- package/build/ios/utils/Xcodeproj.js.map +1 -1
- package/build/ios/utils/getInfoPlistPath.js +2 -15
- package/build/ios/utils/getInfoPlistPath.js.map +1 -1
- package/build/ios/utils/string.js +0 -1
- package/build/ios/utils/string.js.map +1 -1
- package/build/plugins/android-plugins.d.ts +2 -2
- package/build/plugins/android-plugins.js +11 -42
- package/build/plugins/android-plugins.js.map +1 -1
- package/build/plugins/createBaseMod.d.ts +3 -3
- package/build/plugins/createBaseMod.js +8 -25
- package/build/plugins/createBaseMod.js.map +1 -1
- package/build/plugins/ios-plugins.d.ts +2 -2
- package/build/plugins/ios-plugins.js +8 -48
- package/build/plugins/ios-plugins.js.map +1 -1
- package/build/plugins/mod-compiler.js +21 -72
- package/build/plugins/mod-compiler.js.map +1 -1
- package/build/plugins/withAndroidBaseMods.d.ts +1 -1
- package/build/plugins/withAndroidBaseMods.js +4 -89
- package/build/plugins/withAndroidBaseMods.js.map +1 -1
- package/build/plugins/withDangerousMod.js +0 -5
- package/build/plugins/withDangerousMod.js.map +1 -1
- package/build/plugins/withIosBaseMods.d.ts +1 -1
- package/build/plugins/withIosBaseMods.js +26 -118
- package/build/plugins/withIosBaseMods.js.map +1 -1
- package/build/plugins/withMod.d.ts +1 -1
- package/build/plugins/withMod.js +24 -59
- package/build/plugins/withMod.js.map +1 -1
- package/build/plugins/withPlugins.js +0 -9
- package/build/plugins/withPlugins.js.map +1 -1
- package/build/plugins/withRunOnce.js +3 -9
- package/build/plugins/withRunOnce.js.map +1 -1
- package/build/plugins/withStaticPlugin.js +21 -43
- package/build/plugins/withStaticPlugin.js.map +1 -1
- package/build/utils/BuildProperties.types.d.ts +2 -2
- package/build/utils/BuildProperties.types.js.map +1 -1
- package/build/utils/Updates.d.ts +3 -1
- package/build/utils/Updates.js +18 -77
- package/build/utils/Updates.js.map +1 -1
- package/build/utils/XML.d.ts +1 -1
- package/build/utils/XML.js +7 -44
- package/build/utils/XML.js.map +1 -1
- package/build/utils/commonCodeMod.js +2 -10
- package/build/utils/commonCodeMod.js.map +1 -1
- package/build/utils/errors.d.ts +1 -1
- package/build/utils/errors.js +3 -11
- package/build/utils/errors.js.map +1 -1
- package/build/utils/fs.js +1 -12
- package/build/utils/fs.js.map +1 -1
- package/build/utils/generateCode.d.ts +1 -1
- package/build/utils/generateCode.js +8 -25
- package/build/utils/generateCode.js.map +1 -1
- package/build/utils/history.d.ts +1 -1
- package/build/utils/history.js +0 -6
- package/build/utils/history.js.map +1 -1
- package/build/utils/matchBrackets.d.ts +3 -3
- package/build/utils/matchBrackets.js +2 -17
- package/build/utils/matchBrackets.js.map +1 -1
- package/build/utils/modules.js +0 -10
- package/build/utils/modules.js.map +1 -1
- package/build/utils/obj.js +0 -4
- package/build/utils/obj.js.map +1 -1
- package/build/utils/plugin-resolver.js +25 -69
- package/build/utils/plugin-resolver.js.map +1 -1
- package/build/utils/sortObject.js +4 -10
- package/build/utils/sortObject.js.map +1 -1
- package/build/utils/versions.js +0 -10
- package/build/utils/versions.js.map +1 -1
- package/build/utils/warnings.js +1 -9
- package/build/utils/warnings.js.map +1 -1
- package/package.json +5 -5
|
@@ -9,85 +9,65 @@ exports.getStatusBarTranslucent = getStatusBarTranslucent;
|
|
|
9
9
|
exports.setStatusBarColors = setStatusBarColors;
|
|
10
10
|
exports.setStatusBarStyles = setStatusBarStyles;
|
|
11
11
|
exports.withStatusBar = void 0;
|
|
12
|
-
|
|
13
12
|
function _assert() {
|
|
14
13
|
const data = _interopRequireDefault(require("assert"));
|
|
15
|
-
|
|
16
14
|
_assert = function () {
|
|
17
15
|
return data;
|
|
18
16
|
};
|
|
19
|
-
|
|
20
17
|
return data;
|
|
21
18
|
}
|
|
22
|
-
|
|
23
19
|
function _androidPlugins() {
|
|
24
20
|
const data = require("../plugins/android-plugins");
|
|
25
|
-
|
|
26
21
|
_androidPlugins = function () {
|
|
27
22
|
return data;
|
|
28
23
|
};
|
|
29
|
-
|
|
30
24
|
return data;
|
|
31
25
|
}
|
|
32
|
-
|
|
33
26
|
function _Colors() {
|
|
34
27
|
const data = require("./Colors");
|
|
35
|
-
|
|
36
28
|
_Colors = function () {
|
|
37
29
|
return data;
|
|
38
30
|
};
|
|
39
|
-
|
|
40
31
|
return data;
|
|
41
32
|
}
|
|
42
|
-
|
|
43
33
|
function _Styles() {
|
|
44
34
|
const data = require("./Styles");
|
|
45
|
-
|
|
46
35
|
_Styles = function () {
|
|
47
36
|
return data;
|
|
48
37
|
};
|
|
49
|
-
|
|
50
38
|
return data;
|
|
51
39
|
}
|
|
52
|
-
|
|
53
40
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
54
|
-
|
|
55
41
|
// https://developer.android.com/reference/android/R.attr#colorPrimaryDark
|
|
56
|
-
const COLOR_PRIMARY_DARK_KEY = 'colorPrimaryDark';
|
|
57
|
-
|
|
58
|
-
const WINDOW_TRANSLUCENT_STATUS = 'android:windowTranslucentStatus';
|
|
59
|
-
|
|
42
|
+
const COLOR_PRIMARY_DARK_KEY = 'colorPrimaryDark';
|
|
43
|
+
// https://developer.android.com/reference/android/R.attr#windowTranslucentStatus
|
|
44
|
+
const WINDOW_TRANSLUCENT_STATUS = 'android:windowTranslucentStatus';
|
|
45
|
+
// https://developer.android.com/reference/android/R.attr#windowLightStatusBar
|
|
60
46
|
const WINDOW_LIGHT_STATUS_BAR = 'android:windowLightStatusBar';
|
|
61
|
-
|
|
62
47
|
const withStatusBar = config => {
|
|
63
48
|
config = withStatusBarColors(config);
|
|
64
49
|
config = withStatusBarStyles(config);
|
|
65
50
|
return config;
|
|
66
51
|
};
|
|
67
|
-
|
|
68
52
|
exports.withStatusBar = withStatusBar;
|
|
69
|
-
|
|
70
53
|
const withStatusBarColors = config => {
|
|
71
54
|
return (0, _androidPlugins().withAndroidColors)(config, config => {
|
|
72
55
|
config.modResults = setStatusBarColors(config, config.modResults);
|
|
73
56
|
return config;
|
|
74
57
|
});
|
|
75
58
|
};
|
|
76
|
-
|
|
77
59
|
const withStatusBarStyles = config => {
|
|
78
60
|
return (0, _androidPlugins().withAndroidStyles)(config, config => {
|
|
79
61
|
config.modResults = setStatusBarStyles(config, config.modResults);
|
|
80
62
|
return config;
|
|
81
63
|
});
|
|
82
64
|
};
|
|
83
|
-
|
|
84
65
|
function setStatusBarColors(config, colors) {
|
|
85
66
|
return (0, _Colors().assignColorValue)(colors, {
|
|
86
67
|
name: COLOR_PRIMARY_DARK_KEY,
|
|
87
68
|
value: getStatusBarColor(config)
|
|
88
69
|
});
|
|
89
70
|
}
|
|
90
|
-
|
|
91
71
|
function setStatusBarStyles(config, styles) {
|
|
92
72
|
const hexString = getStatusBarColor(config);
|
|
93
73
|
const floatElement = getStatusBarTranslucent(config);
|
|
@@ -115,19 +95,16 @@ function setStatusBarStyles(config, styles) {
|
|
|
115
95
|
});
|
|
116
96
|
return styles;
|
|
117
97
|
}
|
|
118
|
-
|
|
119
98
|
function getStatusBarColor(config) {
|
|
120
99
|
var _config$androidStatus;
|
|
121
|
-
|
|
122
100
|
const backgroundColor = (_config$androidStatus = config.androidStatusBar) === null || _config$androidStatus === void 0 ? void 0 : _config$androidStatus.backgroundColor;
|
|
123
|
-
|
|
124
101
|
if (backgroundColor) {
|
|
125
102
|
// Drop support for translucent
|
|
126
103
|
(0, _assert().default)(backgroundColor !== 'translucent', `androidStatusBar.backgroundColor must be a valid hex string, instead got: "${backgroundColor}"`);
|
|
127
104
|
}
|
|
128
|
-
|
|
129
105
|
return backgroundColor;
|
|
130
106
|
}
|
|
107
|
+
|
|
131
108
|
/**
|
|
132
109
|
* Specifies whether the status bar should be "translucent". When true, the status bar is drawn with `position: absolute` and a gray underlay, when false `position: relative` (pushes content down).
|
|
133
110
|
*
|
|
@@ -135,17 +112,12 @@ function getStatusBarColor(config) {
|
|
|
135
112
|
* @param config
|
|
136
113
|
* @returns
|
|
137
114
|
*/
|
|
138
|
-
|
|
139
|
-
|
|
140
115
|
function getStatusBarTranslucent(config) {
|
|
141
116
|
var _config$androidStatus2, _config$androidStatus3;
|
|
142
|
-
|
|
143
117
|
return (_config$androidStatus2 = (_config$androidStatus3 = config.androidStatusBar) === null || _config$androidStatus3 === void 0 ? void 0 : _config$androidStatus3.translucent) !== null && _config$androidStatus2 !== void 0 ? _config$androidStatus2 : false;
|
|
144
118
|
}
|
|
145
|
-
|
|
146
119
|
function getStatusBarStyle(config) {
|
|
147
120
|
var _config$androidStatus4;
|
|
148
|
-
|
|
149
121
|
return ((_config$androidStatus4 = config.androidStatusBar) === null || _config$androidStatus4 === void 0 ? void 0 : _config$androidStatus4.barStyle) || 'light-content';
|
|
150
122
|
}
|
|
151
123
|
//# sourceMappingURL=StatusBar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBar.js","names":["COLOR_PRIMARY_DARK_KEY","WINDOW_TRANSLUCENT_STATUS","WINDOW_LIGHT_STATUS_BAR","withStatusBar","config","withStatusBarColors","withStatusBarStyles","withAndroidColors","modResults","setStatusBarColors","withAndroidStyles","setStatusBarStyles","colors","assignColorValue","name","value","getStatusBarColor","styles","hexString","floatElement","getStatusBarTranslucent","assignStylesValue","parent","getAppThemeLightNoActionBarGroup","targetApi","add","getStatusBarStyle","backgroundColor","androidStatusBar","assert","translucent","barStyle"],"sources":["../../src/android/StatusBar.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport assert from 'assert';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withAndroidColors, withAndroidStyles } from '../plugins/android-plugins';\nimport { assignColorValue } from './Colors';\nimport { ResourceXML } from './Resources';\nimport { assignStylesValue, getAppThemeLightNoActionBarGroup } from './Styles';\n\n// https://developer.android.com/reference/android/R.attr#colorPrimaryDark\nconst COLOR_PRIMARY_DARK_KEY = 'colorPrimaryDark';\n// https://developer.android.com/reference/android/R.attr#windowTranslucentStatus\nconst WINDOW_TRANSLUCENT_STATUS = 'android:windowTranslucentStatus';\n// https://developer.android.com/reference/android/R.attr#windowLightStatusBar\nconst WINDOW_LIGHT_STATUS_BAR = 'android:windowLightStatusBar';\n\nexport const withStatusBar: ConfigPlugin = (config) => {\n config = withStatusBarColors(config);\n config = withStatusBarStyles(config);\n return config;\n};\n\nconst withStatusBarColors: ConfigPlugin = (config) => {\n return withAndroidColors(config, (config) => {\n config.modResults = setStatusBarColors(config, config.modResults);\n return config;\n });\n};\n\nconst withStatusBarStyles: ConfigPlugin = (config) => {\n return withAndroidStyles(config, (config) => {\n config.modResults = setStatusBarStyles(config, config.modResults);\n return config;\n });\n};\n\nexport function setStatusBarColors(\n config: Pick<ExpoConfig, 'androidStatusBar'>,\n colors: ResourceXML\n): ResourceXML {\n return assignColorValue(colors, {\n name: COLOR_PRIMARY_DARK_KEY,\n value: getStatusBarColor(config),\n });\n}\n\nexport function setStatusBarStyles(\n config: Pick<ExpoConfig, 'androidStatusBar'>,\n styles: ResourceXML\n): ResourceXML {\n const hexString = getStatusBarColor(config);\n const floatElement = getStatusBarTranslucent(config);\n\n styles = assignStylesValue(styles, {\n parent: getAppThemeLightNoActionBarGroup(),\n name: WINDOW_LIGHT_STATUS_BAR,\n targetApi: '23',\n value: 'true',\n // Default is light-content, don't need to do anything to set it\n add: getStatusBarStyle(config) === 'dark-content',\n });\n\n styles = assignStylesValue(styles, {\n parent: getAppThemeLightNoActionBarGroup(),\n name: WINDOW_TRANSLUCENT_STATUS,\n value: 'true',\n // translucent status bar set in theme\n add: floatElement,\n });\n\n styles = assignStylesValue(styles, {\n parent: getAppThemeLightNoActionBarGroup(),\n name: COLOR_PRIMARY_DARK_KEY,\n value: `@color/${COLOR_PRIMARY_DARK_KEY}`,\n // Remove the color if translucent is used\n add: !!hexString,\n });\n\n return styles;\n}\n\nexport function getStatusBarColor(config: Pick<ExpoConfig, 'androidStatusBar'>) {\n const backgroundColor = config.androidStatusBar?.backgroundColor;\n if (backgroundColor) {\n // Drop support for translucent\n assert(\n backgroundColor !== 'translucent',\n `androidStatusBar.backgroundColor must be a valid hex string, instead got: \"${backgroundColor}\"`\n );\n }\n return backgroundColor;\n}\n\n/**\n * Specifies whether the status bar should be \"translucent\". When true, the status bar is drawn with `position: absolute` and a gray underlay, when false `position: relative` (pushes content down).\n *\n * @default false\n * @param config\n * @returns\n */\nexport function getStatusBarTranslucent(config: Pick<ExpoConfig, 'androidStatusBar'>): boolean {\n return config.androidStatusBar?.translucent ?? false;\n}\n\nexport function getStatusBarStyle(config: Pick<ExpoConfig, 'androidStatusBar'>) {\n return config.androidStatusBar?.barStyle || 'light-content';\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"StatusBar.js","names":["COLOR_PRIMARY_DARK_KEY","WINDOW_TRANSLUCENT_STATUS","WINDOW_LIGHT_STATUS_BAR","withStatusBar","config","withStatusBarColors","withStatusBarStyles","withAndroidColors","modResults","setStatusBarColors","withAndroidStyles","setStatusBarStyles","colors","assignColorValue","name","value","getStatusBarColor","styles","hexString","floatElement","getStatusBarTranslucent","assignStylesValue","parent","getAppThemeLightNoActionBarGroup","targetApi","add","getStatusBarStyle","backgroundColor","androidStatusBar","assert","translucent","barStyle"],"sources":["../../src/android/StatusBar.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport assert from 'assert';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withAndroidColors, withAndroidStyles } from '../plugins/android-plugins';\nimport { assignColorValue } from './Colors';\nimport { ResourceXML } from './Resources';\nimport { assignStylesValue, getAppThemeLightNoActionBarGroup } from './Styles';\n\n// https://developer.android.com/reference/android/R.attr#colorPrimaryDark\nconst COLOR_PRIMARY_DARK_KEY = 'colorPrimaryDark';\n// https://developer.android.com/reference/android/R.attr#windowTranslucentStatus\nconst WINDOW_TRANSLUCENT_STATUS = 'android:windowTranslucentStatus';\n// https://developer.android.com/reference/android/R.attr#windowLightStatusBar\nconst WINDOW_LIGHT_STATUS_BAR = 'android:windowLightStatusBar';\n\nexport const withStatusBar: ConfigPlugin = (config) => {\n config = withStatusBarColors(config);\n config = withStatusBarStyles(config);\n return config;\n};\n\nconst withStatusBarColors: ConfigPlugin = (config) => {\n return withAndroidColors(config, (config) => {\n config.modResults = setStatusBarColors(config, config.modResults);\n return config;\n });\n};\n\nconst withStatusBarStyles: ConfigPlugin = (config) => {\n return withAndroidStyles(config, (config) => {\n config.modResults = setStatusBarStyles(config, config.modResults);\n return config;\n });\n};\n\nexport function setStatusBarColors(\n config: Pick<ExpoConfig, 'androidStatusBar'>,\n colors: ResourceXML\n): ResourceXML {\n return assignColorValue(colors, {\n name: COLOR_PRIMARY_DARK_KEY,\n value: getStatusBarColor(config),\n });\n}\n\nexport function setStatusBarStyles(\n config: Pick<ExpoConfig, 'androidStatusBar'>,\n styles: ResourceXML\n): ResourceXML {\n const hexString = getStatusBarColor(config);\n const floatElement = getStatusBarTranslucent(config);\n\n styles = assignStylesValue(styles, {\n parent: getAppThemeLightNoActionBarGroup(),\n name: WINDOW_LIGHT_STATUS_BAR,\n targetApi: '23',\n value: 'true',\n // Default is light-content, don't need to do anything to set it\n add: getStatusBarStyle(config) === 'dark-content',\n });\n\n styles = assignStylesValue(styles, {\n parent: getAppThemeLightNoActionBarGroup(),\n name: WINDOW_TRANSLUCENT_STATUS,\n value: 'true',\n // translucent status bar set in theme\n add: floatElement,\n });\n\n styles = assignStylesValue(styles, {\n parent: getAppThemeLightNoActionBarGroup(),\n name: COLOR_PRIMARY_DARK_KEY,\n value: `@color/${COLOR_PRIMARY_DARK_KEY}`,\n // Remove the color if translucent is used\n add: !!hexString,\n });\n\n return styles;\n}\n\nexport function getStatusBarColor(config: Pick<ExpoConfig, 'androidStatusBar'>) {\n const backgroundColor = config.androidStatusBar?.backgroundColor;\n if (backgroundColor) {\n // Drop support for translucent\n assert(\n backgroundColor !== 'translucent',\n `androidStatusBar.backgroundColor must be a valid hex string, instead got: \"${backgroundColor}\"`\n );\n }\n return backgroundColor;\n}\n\n/**\n * Specifies whether the status bar should be \"translucent\". When true, the status bar is drawn with `position: absolute` and a gray underlay, when false `position: relative` (pushes content down).\n *\n * @default false\n * @param config\n * @returns\n */\nexport function getStatusBarTranslucent(config: Pick<ExpoConfig, 'androidStatusBar'>): boolean {\n return config.androidStatusBar?.translucent ?? false;\n}\n\nexport function getStatusBarStyle(config: Pick<ExpoConfig, 'androidStatusBar'>) {\n return config.androidStatusBar?.barStyle || 'light-content';\n}\n"],"mappings":";;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA+E;AAE/E;AACA,MAAMA,sBAAsB,GAAG,kBAAkB;AACjD;AACA,MAAMC,yBAAyB,GAAG,iCAAiC;AACnE;AACA,MAAMC,uBAAuB,GAAG,8BAA8B;AAEvD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ACrC,CAAC,CAAC;EAEFa,MAAM,GAAG,IAAAI,2BAAiB,EAACJ,MAAM,EAAE;IACjCK,MAAM,EAAE,IAAAC,0CAAgC,GAAE;IAC1CT,IAAI,EAAEb,yBAAyB;IAC/Bc,KAAK,EAAE,MAAM;IACb;IACAU,GAAG,EAAEN;EACP,CAAC,CAAC;EAEFF,MAAM,GAAG,IAAAI,2BAAiB,EAACJ,MAAM,EAAE;IACjCK,MAAM,EAAE,IAAAC,0CAAgC,GAAE;IAC1CT,IAAI,EAAEd,sBAAsB;IAC5Be,KAAK,EAAG,UAASf,sBAAuB,EAAC;IACzC;IACAyB,GAAG,EAAE,CAAC,CAACP;EACT,CAAC,CAAC;EAEF,OAAOD,MAAM;AACf;AAEO,SAASD,iBAAiB,CAACZ,MAA4C,EAAE;EAAA;EAC9E,MAAMuB,eAAe,4BAAGvB,MAAM,CAACwB,gBAAgB,0DAAvB,sBAAyBD,eAAe;EAChE,IAAIA,eAAe,EAAE;IACnB;IACA,IAAAE,iBAAM,EACJF,eAAe,KAAK,aAAa,EAChC,8EAA6EA,eAAgB,GAAE,CACjG;EACH;EACA,OAAOA,eAAe;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASP,uBAAuB,CAAChB,MAA4C,EAAW;EAAA;EAC7F,2DAAOA,MAAM,CAACwB,gBAAgB,2DAAvB,uBAAyBE,WAAW,2EAAI,KAAK;AACtD;AAEO,SAASJ,iBAAiB,CAACtB,MAA4C,EAAE;EAAA;EAC9E,OAAO,2BAAAA,MAAM,CAACwB,gBAAgB,2DAAvB,uBAAyBG,QAAQ,KAAI,eAAe;AAC7D"}
|
package/build/android/Strings.js
CHANGED
|
@@ -6,17 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getProjectStringsXMLPathAsync = getProjectStringsXMLPathAsync;
|
|
7
7
|
exports.removeStringItem = removeStringItem;
|
|
8
8
|
exports.setStringItem = setStringItem;
|
|
9
|
-
|
|
10
9
|
function _Paths() {
|
|
11
10
|
const data = require("./Paths");
|
|
12
|
-
|
|
13
11
|
_Paths = function () {
|
|
14
12
|
return data;
|
|
15
13
|
};
|
|
16
|
-
|
|
17
14
|
return data;
|
|
18
15
|
}
|
|
19
|
-
|
|
20
16
|
async function getProjectStringsXMLPathAsync(projectRoot, {
|
|
21
17
|
kind
|
|
22
18
|
} = {}) {
|
|
@@ -25,23 +21,18 @@ async function getProjectStringsXMLPathAsync(projectRoot, {
|
|
|
25
21
|
name: 'strings'
|
|
26
22
|
});
|
|
27
23
|
}
|
|
28
|
-
|
|
29
24
|
function setStringItem(itemToAdd, stringFileContentsJSON) {
|
|
30
25
|
var _stringFileContentsJS;
|
|
31
|
-
|
|
32
26
|
if (!(stringFileContentsJSON !== null && stringFileContentsJSON !== void 0 && (_stringFileContentsJS = stringFileContentsJSON.resources) !== null && _stringFileContentsJS !== void 0 && _stringFileContentsJS.string)) {
|
|
33
27
|
if (!stringFileContentsJSON.resources || typeof stringFileContentsJSON.resources === 'string') {
|
|
34
28
|
// file was empty and JSON is `{resources : ''}`
|
|
35
29
|
stringFileContentsJSON.resources = {};
|
|
36
30
|
}
|
|
37
|
-
|
|
38
31
|
stringFileContentsJSON.resources.string = itemToAdd;
|
|
39
32
|
return stringFileContentsJSON;
|
|
40
33
|
}
|
|
41
|
-
|
|
42
34
|
for (const newItem of itemToAdd) {
|
|
43
35
|
const stringNameExists = stringFileContentsJSON.resources.string.findIndex(e => e.$.name === newItem.$.name);
|
|
44
|
-
|
|
45
36
|
if (stringNameExists > -1) {
|
|
46
37
|
// replace the previous item
|
|
47
38
|
stringFileContentsJSON.resources.string[stringNameExists] = newItem;
|
|
@@ -49,22 +40,17 @@ function setStringItem(itemToAdd, stringFileContentsJSON) {
|
|
|
49
40
|
stringFileContentsJSON.resources.string = stringFileContentsJSON.resources.string.concat(newItem);
|
|
50
41
|
}
|
|
51
42
|
}
|
|
52
|
-
|
|
53
43
|
return stringFileContentsJSON;
|
|
54
44
|
}
|
|
55
|
-
|
|
56
45
|
function removeStringItem(named, stringFileContentsJSON) {
|
|
57
46
|
var _stringFileContentsJS2;
|
|
58
|
-
|
|
59
47
|
if (stringFileContentsJSON !== null && stringFileContentsJSON !== void 0 && (_stringFileContentsJS2 = stringFileContentsJSON.resources) !== null && _stringFileContentsJS2 !== void 0 && _stringFileContentsJS2.string) {
|
|
60
48
|
const stringNameExists = stringFileContentsJSON.resources.string.findIndex(e => e.$.name === named);
|
|
61
|
-
|
|
62
49
|
if (stringNameExists > -1) {
|
|
63
50
|
// replace the previous value
|
|
64
51
|
stringFileContentsJSON.resources.string.splice(stringNameExists, 1);
|
|
65
52
|
}
|
|
66
53
|
}
|
|
67
|
-
|
|
68
54
|
return stringFileContentsJSON;
|
|
69
55
|
}
|
|
70
56
|
//# sourceMappingURL=Strings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Strings.js","names":["getProjectStringsXMLPathAsync","projectRoot","kind","getResourceXMLPathAsync","name","setStringItem","itemToAdd","stringFileContentsJSON","resources","string","newItem","stringNameExists","findIndex","e","$","concat","removeStringItem","named","splice"],"sources":["../../src/android/Strings.ts"],"sourcesContent":["import { getResourceXMLPathAsync } from './Paths';\nimport { ResourceItemXML, ResourceKind, ResourceXML } from './Resources';\n\nexport async function getProjectStringsXMLPathAsync(\n projectRoot: string,\n { kind }: { kind?: ResourceKind } = {}\n): Promise<string> {\n return getResourceXMLPathAsync(projectRoot, { kind, name: 'strings' });\n}\n\nexport function setStringItem(\n itemToAdd: ResourceItemXML[],\n stringFileContentsJSON: ResourceXML\n): ResourceXML {\n if (!stringFileContentsJSON?.resources?.string) {\n if (!stringFileContentsJSON.resources || typeof stringFileContentsJSON.resources === 'string') {\n // file was empty and JSON is `{resources : ''}`\n stringFileContentsJSON.resources = {};\n }\n stringFileContentsJSON.resources.string = itemToAdd;\n return stringFileContentsJSON;\n }\n\n for (const newItem of itemToAdd) {\n const stringNameExists = stringFileContentsJSON.resources.string.findIndex(\n (e: ResourceItemXML) => e.$.name === newItem.$.name\n );\n if (stringNameExists > -1) {\n // replace the previous item\n stringFileContentsJSON.resources.string[stringNameExists] = newItem;\n } else {\n stringFileContentsJSON.resources.string =\n stringFileContentsJSON.resources.string.concat(newItem);\n }\n }\n return stringFileContentsJSON;\n}\n\nexport function removeStringItem(named: string, stringFileContentsJSON: ResourceXML): ResourceXML {\n if (stringFileContentsJSON?.resources?.string) {\n const stringNameExists = stringFileContentsJSON.resources.string.findIndex(\n (e: ResourceItemXML) => e.$.name === named\n );\n if (stringNameExists > -1) {\n // replace the previous value\n stringFileContentsJSON.resources.string.splice(stringNameExists, 1);\n }\n }\n return stringFileContentsJSON;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Strings.js","names":["getProjectStringsXMLPathAsync","projectRoot","kind","getResourceXMLPathAsync","name","setStringItem","itemToAdd","stringFileContentsJSON","resources","string","newItem","stringNameExists","findIndex","e","$","concat","removeStringItem","named","splice"],"sources":["../../src/android/Strings.ts"],"sourcesContent":["import { getResourceXMLPathAsync } from './Paths';\nimport { ResourceItemXML, ResourceKind, ResourceXML } from './Resources';\n\nexport async function getProjectStringsXMLPathAsync(\n projectRoot: string,\n { kind }: { kind?: ResourceKind } = {}\n): Promise<string> {\n return getResourceXMLPathAsync(projectRoot, { kind, name: 'strings' });\n}\n\nexport function setStringItem(\n itemToAdd: ResourceItemXML[],\n stringFileContentsJSON: ResourceXML\n): ResourceXML {\n if (!stringFileContentsJSON?.resources?.string) {\n if (!stringFileContentsJSON.resources || typeof stringFileContentsJSON.resources === 'string') {\n // file was empty and JSON is `{resources : ''}`\n stringFileContentsJSON.resources = {};\n }\n stringFileContentsJSON.resources.string = itemToAdd;\n return stringFileContentsJSON;\n }\n\n for (const newItem of itemToAdd) {\n const stringNameExists = stringFileContentsJSON.resources.string.findIndex(\n (e: ResourceItemXML) => e.$.name === newItem.$.name\n );\n if (stringNameExists > -1) {\n // replace the previous item\n stringFileContentsJSON.resources.string[stringNameExists] = newItem;\n } else {\n stringFileContentsJSON.resources.string =\n stringFileContentsJSON.resources.string.concat(newItem);\n }\n }\n return stringFileContentsJSON;\n}\n\nexport function removeStringItem(named: string, stringFileContentsJSON: ResourceXML): ResourceXML {\n if (stringFileContentsJSON?.resources?.string) {\n const stringNameExists = stringFileContentsJSON.resources.string.findIndex(\n (e: ResourceItemXML) => e.$.name === named\n );\n if (stringNameExists > -1) {\n // replace the previous value\n stringFileContentsJSON.resources.string.splice(stringNameExists, 1);\n }\n }\n return stringFileContentsJSON;\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,eAAeA,6BAA6B,CACjDC,WAAmB,EACnB;EAAEC;AAA8B,CAAC,GAAG,CAAC,CAAC,EACrB;EACjB,OAAO,IAAAC,gCAAuB,EAACF,WAAW,EAAE;IAAEC,IAAI;IAAEE,IAAI,EAAE;EAAU,CAAC,CAAC;AACxE;AAEO,SAASC,aAAa,CAC3BC,SAA4B,EAC5BC,sBAAmC,EACtB;EAAA;EACb,IAAI,EAACA,sBAAsB,aAAtBA,sBAAsB,wCAAtBA,sBAAsB,CAAEC,SAAS,kDAAjC,sBAAmCC,MAAM,GAAE;IAC9C,IAAI,CAACF,sBAAsB,CAACC,SAAS,IAAI,OAAOD,sBAAsB,CAACC,SAAS,KAAK,QAAQ,EAAE;MAC7F;MACAD,sBAAsB,CAACC,SAAS,GAAG,CAAC,CAAC;IACvC;IACAD,sBAAsB,CAACC,SAAS,CAACC,MAAM,GAAGH,SAAS;IACnD,OAAOC,sBAAsB;EAC/B;EAEA,KAAK,MAAMG,OAAO,IAAIJ,SAAS,EAAE;IAC/B,MAAMK,gBAAgB,GAAGJ,sBAAsB,CAACC,SAAS,CAACC,MAAM,CAACG,SAAS,CACvEC,CAAkB,IAAKA,CAAC,CAACC,CAAC,CAACV,IAAI,KAAKM,OAAO,CAACI,CAAC,CAACV,IAAI,CACpD;IACD,IAAIO,gBAAgB,GAAG,CAAC,CAAC,EAAE;MACzB;MACAJ,sBAAsB,CAACC,SAAS,CAACC,MAAM,CAACE,gBAAgB,CAAC,GAAGD,OAAO;IACrE,CAAC,MAAM;MACLH,sBAAsB,CAACC,SAAS,CAACC,MAAM,GACrCF,sBAAsB,CAACC,SAAS,CAACC,MAAM,CAACM,MAAM,CAACL,OAAO,CAAC;IAC3D;EACF;EACA,OAAOH,sBAAsB;AAC/B;AAEO,SAASS,gBAAgB,CAACC,KAAa,EAAEV,sBAAmC,EAAe;EAAA;EAChG,IAAIA,sBAAsB,aAAtBA,sBAAsB,yCAAtBA,sBAAsB,CAAEC,SAAS,mDAAjC,uBAAmCC,MAAM,EAAE;IAC7C,MAAME,gBAAgB,GAAGJ,sBAAsB,CAACC,SAAS,CAACC,MAAM,CAACG,SAAS,CACvEC,CAAkB,IAAKA,CAAC,CAACC,CAAC,CAACV,IAAI,KAAKa,KAAK,CAC3C;IACD,IAAIN,gBAAgB,GAAG,CAAC,CAAC,EAAE;MACzB;MACAJ,sBAAsB,CAACC,SAAS,CAACC,MAAM,CAACS,MAAM,CAACP,gBAAgB,EAAE,CAAC,CAAC;IACrE;EACF;EACA,OAAOJ,sBAAsB;AAC/B"}
|
package/build/android/Styles.js
CHANGED
|
@@ -12,30 +12,22 @@ exports.getStylesItem = getStylesItem;
|
|
|
12
12
|
exports.readStylesXMLAsync = readStylesXMLAsync;
|
|
13
13
|
exports.removeStylesItem = removeStylesItem;
|
|
14
14
|
exports.setStylesItem = setStylesItem;
|
|
15
|
-
|
|
16
15
|
function _Paths() {
|
|
17
16
|
const data = require("./Paths");
|
|
18
|
-
|
|
19
17
|
_Paths = function () {
|
|
20
18
|
return data;
|
|
21
19
|
};
|
|
22
|
-
|
|
23
20
|
return data;
|
|
24
21
|
}
|
|
25
|
-
|
|
26
22
|
function _Resources() {
|
|
27
23
|
const data = require("./Resources");
|
|
28
|
-
|
|
29
24
|
_Resources = function () {
|
|
30
25
|
return data;
|
|
31
26
|
};
|
|
32
|
-
|
|
33
27
|
return data;
|
|
34
28
|
}
|
|
35
|
-
|
|
36
29
|
// Adds support for `tools:x`
|
|
37
30
|
const fallbackResourceString = `<?xml version="1.0" encoding="utf-8"?><resources xmlns:tools="http://schemas.android.com/tools"></resources>`;
|
|
38
|
-
|
|
39
31
|
async function readStylesXMLAsync({
|
|
40
32
|
path,
|
|
41
33
|
fallback = fallbackResourceString
|
|
@@ -45,7 +37,6 @@ async function readStylesXMLAsync({
|
|
|
45
37
|
fallback
|
|
46
38
|
});
|
|
47
39
|
}
|
|
48
|
-
|
|
49
40
|
async function getProjectStylesXMLPathAsync(projectRoot, {
|
|
50
41
|
kind
|
|
51
42
|
} = {}) {
|
|
@@ -54,23 +45,17 @@ async function getProjectStylesXMLPathAsync(projectRoot, {
|
|
|
54
45
|
name: 'styles'
|
|
55
46
|
});
|
|
56
47
|
}
|
|
57
|
-
|
|
58
48
|
function ensureDefaultStyleResourceXML(xml) {
|
|
59
49
|
var _xml, _xml$resources;
|
|
60
|
-
|
|
61
50
|
xml = (0, _Resources().ensureDefaultResourceXML)(xml);
|
|
62
|
-
|
|
63
51
|
if (!Array.isArray((_xml = xml) === null || _xml === void 0 ? void 0 : (_xml$resources = _xml.resources) === null || _xml$resources === void 0 ? void 0 : _xml$resources.style)) {
|
|
64
52
|
xml.resources.style = [];
|
|
65
53
|
}
|
|
66
|
-
|
|
67
54
|
return xml;
|
|
68
55
|
}
|
|
69
|
-
|
|
70
56
|
function getStyleParent(xml, group) {
|
|
71
57
|
return (0, _Resources().findResourceGroup)(xml.resources.style, group);
|
|
72
58
|
}
|
|
73
|
-
|
|
74
59
|
function getStylesItem({
|
|
75
60
|
name,
|
|
76
61
|
xml,
|
|
@@ -78,24 +63,21 @@ function getStylesItem({
|
|
|
78
63
|
}) {
|
|
79
64
|
xml = ensureDefaultStyleResourceXML(xml);
|
|
80
65
|
const appTheme = getStyleParent(xml, parent);
|
|
81
|
-
|
|
82
66
|
if (!appTheme) {
|
|
83
67
|
return null;
|
|
84
68
|
}
|
|
85
|
-
|
|
86
69
|
if (appTheme.item) {
|
|
87
70
|
const existingItem = appTheme.item.filter(({
|
|
88
71
|
$: head
|
|
89
|
-
}) => head.name === name)[0];
|
|
72
|
+
}) => head.name === name)[0];
|
|
90
73
|
|
|
74
|
+
// Don't want to 2 of the same item, so if one exists, we overwrite it
|
|
91
75
|
if (existingItem) {
|
|
92
76
|
return existingItem;
|
|
93
77
|
}
|
|
94
78
|
}
|
|
95
|
-
|
|
96
79
|
return null;
|
|
97
80
|
}
|
|
98
|
-
|
|
99
81
|
function setStylesItem({
|
|
100
82
|
item,
|
|
101
83
|
xml,
|
|
@@ -103,17 +85,16 @@ function setStylesItem({
|
|
|
103
85
|
}) {
|
|
104
86
|
xml = ensureDefaultStyleResourceXML(xml);
|
|
105
87
|
let appTheme = getStyleParent(xml, parent);
|
|
106
|
-
|
|
107
88
|
if (!appTheme) {
|
|
108
89
|
appTheme = (0, _Resources().buildResourceGroup)(parent);
|
|
109
90
|
xml.resources.style.push(appTheme);
|
|
110
91
|
}
|
|
111
|
-
|
|
112
92
|
if (appTheme.item) {
|
|
113
93
|
const existingItem = appTheme.item.filter(({
|
|
114
94
|
$: head
|
|
115
|
-
}) => head.name === item.$.name)[0];
|
|
95
|
+
}) => head.name === item.$.name)[0];
|
|
116
96
|
|
|
97
|
+
// Don't want to 2 of the same item, so if one exists, we overwrite it
|
|
117
98
|
if (existingItem) {
|
|
118
99
|
existingItem._ = item._;
|
|
119
100
|
existingItem.$ = item.$;
|
|
@@ -123,10 +104,8 @@ function setStylesItem({
|
|
|
123
104
|
} else {
|
|
124
105
|
appTheme.item = [item];
|
|
125
106
|
}
|
|
126
|
-
|
|
127
107
|
return xml;
|
|
128
108
|
}
|
|
129
|
-
|
|
130
109
|
function removeStylesItem({
|
|
131
110
|
name,
|
|
132
111
|
xml,
|
|
@@ -134,28 +113,24 @@ function removeStylesItem({
|
|
|
134
113
|
}) {
|
|
135
114
|
xml = ensureDefaultStyleResourceXML(xml);
|
|
136
115
|
const appTheme = getStyleParent(xml, parent);
|
|
137
|
-
|
|
138
116
|
if (appTheme !== null && appTheme !== void 0 && appTheme.item) {
|
|
139
117
|
const index = appTheme.item.findIndex(({
|
|
140
118
|
$: head
|
|
141
119
|
}) => head.name === name);
|
|
142
|
-
|
|
143
120
|
if (index > -1) {
|
|
144
121
|
appTheme.item.splice(index, 1);
|
|
145
122
|
}
|
|
146
123
|
}
|
|
147
|
-
|
|
148
124
|
return xml;
|
|
149
|
-
}
|
|
150
|
-
|
|
125
|
+
}
|
|
151
126
|
|
|
127
|
+
// This is a very common theme so make it reusable.
|
|
152
128
|
function getAppThemeLightNoActionBarGroup() {
|
|
153
129
|
return {
|
|
154
130
|
name: 'AppTheme',
|
|
155
131
|
parent: 'Theme.AppCompat.Light.NoActionBar'
|
|
156
132
|
};
|
|
157
133
|
}
|
|
158
|
-
|
|
159
134
|
function assignStylesValue(xml, {
|
|
160
135
|
add,
|
|
161
136
|
value,
|
|
@@ -174,13 +149,13 @@ function assignStylesValue(xml, {
|
|
|
174
149
|
})
|
|
175
150
|
});
|
|
176
151
|
}
|
|
177
|
-
|
|
178
152
|
return removeStylesItem({
|
|
179
153
|
xml,
|
|
180
154
|
parent,
|
|
181
155
|
name
|
|
182
156
|
});
|
|
183
157
|
}
|
|
158
|
+
|
|
184
159
|
/**
|
|
185
160
|
* Helper to convert a styles.xml parent's children into a simple k/v pair.
|
|
186
161
|
* Added for testing purposes.
|
|
@@ -188,8 +163,6 @@ function assignStylesValue(xml, {
|
|
|
188
163
|
* @param xml
|
|
189
164
|
* @returns
|
|
190
165
|
*/
|
|
191
|
-
|
|
192
|
-
|
|
193
166
|
function getStylesGroupAsObject(xml, group) {
|
|
194
167
|
const xmlGroup = getStyleParent(xml, group);
|
|
195
168
|
return xmlGroup !== null && xmlGroup !== void 0 && xmlGroup.item ? (0, _Resources().getResourceItemsAsObject)(xmlGroup.item) : null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.js","names":["fallbackResourceString","readStylesXMLAsync","path","fallback","readResourcesXMLAsync","getProjectStylesXMLPathAsync","projectRoot","kind","getResourceXMLPathAsync","name","ensureDefaultStyleResourceXML","xml","ensureDefaultResourceXML","Array","isArray","resources","style","getStyleParent","group","findResourceGroup","getStylesItem","parent","appTheme","item","existingItem","filter","$","head","setStylesItem","buildResourceGroup","push","_","removeStylesItem","index","findIndex","splice","getAppThemeLightNoActionBarGroup","assignStylesValue","add","value","targetApi","buildResourceItem","getStylesGroupAsObject","xmlGroup","getResourceItemsAsObject"],"sources":["../../src/android/Styles.ts"],"sourcesContent":["import { getResourceXMLPathAsync } from './Paths';\nimport {\n buildResourceGroup,\n buildResourceItem,\n ensureDefaultResourceXML,\n findResourceGroup,\n getResourceItemsAsObject,\n readResourcesXMLAsync,\n ResourceGroupXML,\n ResourceItemXML,\n ResourceKind,\n ResourceXML,\n} from './Resources';\n\n// Adds support for `tools:x`\nconst fallbackResourceString = `<?xml version=\"1.0\" encoding=\"utf-8\"?><resources xmlns:tools=\"http://schemas.android.com/tools\"></resources>`;\n\nexport async function readStylesXMLAsync({\n path,\n fallback = fallbackResourceString,\n}: {\n path: string;\n fallback?: string | null;\n}): Promise<ResourceXML> {\n return readResourcesXMLAsync({ path, fallback });\n}\n\nexport async function getProjectStylesXMLPathAsync(\n projectRoot: string,\n { kind }: { kind?: ResourceKind } = {}\n): Promise<string> {\n return getResourceXMLPathAsync(projectRoot, { kind, name: 'styles' });\n}\n\nfunction ensureDefaultStyleResourceXML(xml: ResourceXML): ResourceXML {\n xml = ensureDefaultResourceXML(xml);\n if (!Array.isArray(xml?.resources?.style)) {\n xml.resources.style = [];\n }\n return xml;\n}\n\nexport function getStyleParent(\n xml: ResourceXML,\n group: { name: string; parent?: string }\n): ResourceGroupXML | null {\n return findResourceGroup(xml.resources.style, group);\n}\n\nexport function getStylesItem({\n name,\n xml,\n parent,\n}: {\n name: string;\n xml: ResourceXML;\n parent: { name: string; parent?: string };\n}): ResourceItemXML | null {\n xml = ensureDefaultStyleResourceXML(xml);\n\n const appTheme = getStyleParent(xml, parent);\n\n if (!appTheme) {\n return null;\n }\n\n if (appTheme.item) {\n const existingItem = appTheme.item.filter(({ $: head }) => head.name === name)[0];\n\n // Don't want to 2 of the same item, so if one exists, we overwrite it\n if (existingItem) {\n return existingItem;\n }\n }\n return null;\n}\n\nexport function setStylesItem({\n item,\n xml,\n parent,\n}: {\n item: ResourceItemXML;\n xml: ResourceXML;\n parent: { name: string; parent: string };\n}): ResourceXML {\n xml = ensureDefaultStyleResourceXML(xml);\n\n let appTheme = getStyleParent(xml, parent);\n\n if (!appTheme) {\n appTheme = buildResourceGroup(parent);\n xml.resources!.style!.push(appTheme);\n }\n\n if (appTheme.item) {\n const existingItem = appTheme.item.filter(({ $: head }) => head.name === item.$.name)[0];\n\n // Don't want to 2 of the same item, so if one exists, we overwrite it\n if (existingItem) {\n existingItem._ = item._;\n existingItem.$ = item.$;\n } else {\n appTheme.item.push(item);\n }\n } else {\n appTheme.item = [item];\n }\n return xml;\n}\n\nexport function removeStylesItem({\n name,\n xml,\n parent,\n}: {\n name: string;\n xml: ResourceXML;\n parent: { name: string; parent: string };\n}): ResourceXML {\n xml = ensureDefaultStyleResourceXML(xml);\n const appTheme = getStyleParent(xml, parent);\n if (appTheme?.item) {\n const index = appTheme.item.findIndex(({ $: head }: ResourceItemXML) => head.name === name);\n if (index > -1) {\n appTheme.item.splice(index, 1);\n }\n }\n return xml;\n}\n\n// This is a very common theme so make it reusable.\nexport function getAppThemeLightNoActionBarGroup() {\n return { name: 'AppTheme', parent: 'Theme.AppCompat.Light.NoActionBar' };\n}\n\nexport function assignStylesValue(\n xml: ResourceXML,\n {\n add,\n value,\n targetApi,\n name,\n parent,\n }: {\n add: boolean;\n value: string;\n targetApi?: string;\n name: string;\n parent: { name: string; parent: string };\n }\n): ResourceXML {\n if (add) {\n return setStylesItem({\n xml,\n parent,\n item: buildResourceItem({\n name,\n targetApi,\n value,\n }),\n });\n }\n return removeStylesItem({\n xml,\n parent,\n name,\n });\n}\n\n/**\n * Helper to convert a styles.xml parent's children into a simple k/v pair.\n * Added for testing purposes.\n *\n * @param xml\n * @returns\n */\nexport function getStylesGroupAsObject(\n xml: ResourceXML,\n group: { name: string; parent?: string }\n): Record<string, string> | null {\n const xmlGroup = getStyleParent(xml, group);\n return xmlGroup?.item ? getResourceItemsAsObject(xmlGroup.item) : null;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["fallbackResourceString","readStylesXMLAsync","path","fallback","readResourcesXMLAsync","getProjectStylesXMLPathAsync","projectRoot","kind","getResourceXMLPathAsync","name","ensureDefaultStyleResourceXML","xml","ensureDefaultResourceXML","Array","isArray","resources","style","getStyleParent","group","findResourceGroup","getStylesItem","parent","appTheme","item","existingItem","filter","$","head","setStylesItem","buildResourceGroup","push","_","removeStylesItem","index","findIndex","splice","getAppThemeLightNoActionBarGroup","assignStylesValue","add","value","targetApi","buildResourceItem","getStylesGroupAsObject","xmlGroup","getResourceItemsAsObject"],"sources":["../../src/android/Styles.ts"],"sourcesContent":["import { getResourceXMLPathAsync } from './Paths';\nimport {\n buildResourceGroup,\n buildResourceItem,\n ensureDefaultResourceXML,\n findResourceGroup,\n getResourceItemsAsObject,\n readResourcesXMLAsync,\n ResourceGroupXML,\n ResourceItemXML,\n ResourceKind,\n ResourceXML,\n} from './Resources';\n\n// Adds support for `tools:x`\nconst fallbackResourceString = `<?xml version=\"1.0\" encoding=\"utf-8\"?><resources xmlns:tools=\"http://schemas.android.com/tools\"></resources>`;\n\nexport async function readStylesXMLAsync({\n path,\n fallback = fallbackResourceString,\n}: {\n path: string;\n fallback?: string | null;\n}): Promise<ResourceXML> {\n return readResourcesXMLAsync({ path, fallback });\n}\n\nexport async function getProjectStylesXMLPathAsync(\n projectRoot: string,\n { kind }: { kind?: ResourceKind } = {}\n): Promise<string> {\n return getResourceXMLPathAsync(projectRoot, { kind, name: 'styles' });\n}\n\nfunction ensureDefaultStyleResourceXML(xml: ResourceXML): ResourceXML {\n xml = ensureDefaultResourceXML(xml);\n if (!Array.isArray(xml?.resources?.style)) {\n xml.resources.style = [];\n }\n return xml;\n}\n\nexport function getStyleParent(\n xml: ResourceXML,\n group: { name: string; parent?: string }\n): ResourceGroupXML | null {\n return findResourceGroup(xml.resources.style, group);\n}\n\nexport function getStylesItem({\n name,\n xml,\n parent,\n}: {\n name: string;\n xml: ResourceXML;\n parent: { name: string; parent?: string };\n}): ResourceItemXML | null {\n xml = ensureDefaultStyleResourceXML(xml);\n\n const appTheme = getStyleParent(xml, parent);\n\n if (!appTheme) {\n return null;\n }\n\n if (appTheme.item) {\n const existingItem = appTheme.item.filter(({ $: head }) => head.name === name)[0];\n\n // Don't want to 2 of the same item, so if one exists, we overwrite it\n if (existingItem) {\n return existingItem;\n }\n }\n return null;\n}\n\nexport function setStylesItem({\n item,\n xml,\n parent,\n}: {\n item: ResourceItemXML;\n xml: ResourceXML;\n parent: { name: string; parent: string };\n}): ResourceXML {\n xml = ensureDefaultStyleResourceXML(xml);\n\n let appTheme = getStyleParent(xml, parent);\n\n if (!appTheme) {\n appTheme = buildResourceGroup(parent);\n xml.resources!.style!.push(appTheme);\n }\n\n if (appTheme.item) {\n const existingItem = appTheme.item.filter(({ $: head }) => head.name === item.$.name)[0];\n\n // Don't want to 2 of the same item, so if one exists, we overwrite it\n if (existingItem) {\n existingItem._ = item._;\n existingItem.$ = item.$;\n } else {\n appTheme.item.push(item);\n }\n } else {\n appTheme.item = [item];\n }\n return xml;\n}\n\nexport function removeStylesItem({\n name,\n xml,\n parent,\n}: {\n name: string;\n xml: ResourceXML;\n parent: { name: string; parent: string };\n}): ResourceXML {\n xml = ensureDefaultStyleResourceXML(xml);\n const appTheme = getStyleParent(xml, parent);\n if (appTheme?.item) {\n const index = appTheme.item.findIndex(({ $: head }: ResourceItemXML) => head.name === name);\n if (index > -1) {\n appTheme.item.splice(index, 1);\n }\n }\n return xml;\n}\n\n// This is a very common theme so make it reusable.\nexport function getAppThemeLightNoActionBarGroup() {\n return { name: 'AppTheme', parent: 'Theme.AppCompat.Light.NoActionBar' };\n}\n\nexport function assignStylesValue(\n xml: ResourceXML,\n {\n add,\n value,\n targetApi,\n name,\n parent,\n }: {\n add: boolean;\n value: string;\n targetApi?: string;\n name: string;\n parent: { name: string; parent: string };\n }\n): ResourceXML {\n if (add) {\n return setStylesItem({\n xml,\n parent,\n item: buildResourceItem({\n name,\n targetApi,\n value,\n }),\n });\n }\n return removeStylesItem({\n xml,\n parent,\n name,\n });\n}\n\n/**\n * Helper to convert a styles.xml parent's children into a simple k/v pair.\n * Added for testing purposes.\n *\n * @param xml\n * @returns\n */\nexport function getStylesGroupAsObject(\n xml: ResourceXML,\n group: { name: string; parent?: string }\n): Record<string, string> | null {\n const xmlGroup = getStyleParent(xml, group);\n return xmlGroup?.item ? getResourceItemsAsObject(xmlGroup.item) : null;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAaA;AACA,MAAMA,sBAAsB,GAAI,8GAA6G;AAEtI,eAAeC,kBAAkB,CAAC;EACvCC,IAAI;EACJC,QAAQ,GAAGH;AAIb,CAAC,EAAwB;EACvB,OAAO,IAAAI,kCAAqB,EAAC;IAAEF,IAAI;IAAEC;EAAS,CAAC,CAAC;AAClD;AAEO,eAAeE,4BAA4B,CAChDC,WAAmB,EACnB;EAAEC;AAA8B,CAAC,GAAG,CAAC,CAAC,EACrB;EACjB,OAAO,IAAAC,gCAAuB,EAACF,WAAW,EAAE;IAAEC,IAAI;IAAEE,IAAI,EAAE;EAAS,CAAC,CAAC;AACvE;AAEA,SAASC,6BAA6B,CAACC,GAAgB,EAAe;EAAA;EACpEA,GAAG,GAAG,IAAAC,qCAAwB,EAACD,GAAG,CAAC;EACnC,IAAI,CAACE,KAAK,CAACC,OAAO,SAACH,GAAG,2DAAH,KAAK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C,EACY;EACb,IAAIiB,GAAG,EAAE;IACP,OAAOV,aAAa,CAAC;MACnBjB,GAAG;MACHU,MAAM;MACNE,IAAI,EAAE,IAAAkB,8BAAiB,EAAC;QACtBhC,IAAI;QACJ+B,SAAS;QACTD;MACF,CAAC;IACH,CAAC,CAAC;EACJ;EACA,OAAOP,gBAAgB,CAAC;IACtBrB,GAAG;IACHU,MAAM;IACNZ;EACF,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASiC,sBAAsB,CACpC/B,GAAgB,EAChBO,KAAwC,EACT;EAC/B,MAAMyB,QAAQ,GAAG1B,cAAc,CAACN,GAAG,EAAEO,KAAK,CAAC;EAC3C,OAAOyB,QAAQ,aAARA,QAAQ,eAARA,QAAQ,CAAEpB,IAAI,GAAG,IAAAqB,qCAAwB,EAACD,QAAQ,CAACpB,IAAI,CAAC,GAAG,IAAI;AACxE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ConfigPlugin } from '../Plugin.types';
|
|
2
2
|
import { ExpoConfigUpdates } from '../utils/Updates';
|
|
3
3
|
import { AndroidManifest } from './Manifest';
|
|
4
|
+
import { ResourceXML } from './Resources';
|
|
4
5
|
export declare enum Config {
|
|
5
6
|
ENABLED = "expo.modules.updates.ENABLED",
|
|
6
7
|
CHECK_ON_LAUNCH = "expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH",
|
|
@@ -16,6 +17,7 @@ export declare enum Config {
|
|
|
16
17
|
export declare const withUpdates: ConfigPlugin<{
|
|
17
18
|
expoUsername: string | null;
|
|
18
19
|
}>;
|
|
20
|
+
export declare function applyRuntimeVersionFromConfig(config: Pick<ExpoConfigUpdates, 'sdkVersion' | 'runtimeVersion'>, stringsJSON: ResourceXML): ResourceXML;
|
|
19
21
|
export declare function setUpdatesConfig(projectRoot: string, config: ExpoConfigUpdates, androidManifest: AndroidManifest, username: string | null, expoUpdatesPackageVersion?: string | null): AndroidManifest;
|
|
20
22
|
export declare function setVersionsConfig(config: Pick<ExpoConfigUpdates, 'sdkVersion' | 'runtimeVersion'>, androidManifest: AndroidManifest): AndroidManifest;
|
|
21
23
|
export declare function ensureBuildGradleContainsConfigurationScript(projectRoot: string, buildGradleContents: string): string;
|