@@ -3,8 +3,8 @@ import * as os from 'node:os';
33import * as path from 'node:path' ;
44
55import {
6- extractApplicationMetaDataFromAndroidManifest ,
7- extractStringResourcesFromResourcesXml ,
6+ extractApplicationMetaData ,
7+ extractStringResourcesFromXml ,
88 renderLibraryManifestApplication ,
99 renderLibraryStringResources ,
1010} from '../androidManifest' ;
@@ -128,7 +128,7 @@ describe('android manifest helpers', () => {
128128 ) ;
129129 } ) ;
130130
131- it ( 'keeps typed extraction aligned for android:value entries and referenced string resources' , ( ) => {
131+ it ( 'keeps raw XML extraction aligned for android:value entries and referenced string resources' , ( ) => {
132132 const androidDir = createAndroidDir ( ) ;
133133 const manifestContent = `<?xml version="1.0" encoding="utf-8"?>
134134<manifest xmlns:android="http://schemas.android.com/apk/res/android">
@@ -138,122 +138,49 @@ describe('android manifest helpers', () => {
138138 <meta-data android:name="com.example.NOT_UPDATES" android:value="ignored" />
139139 </application>
140140</manifest>` ;
141- const typedManifest = {
142- manifest : {
143- $ : {
144- 'xmlns:android' : 'http://schemas.android.com/apk/res/android' ,
145- } ,
146- queries : [ ] ,
147- application : [
148- {
149- $ : {
150- 'android:name' : '.MainApplication' ,
151- } ,
152- 'meta-data' : [
153- {
154- $ : {
155- 'android:name' : 'expo.modules.updates.ENABLED' ,
156- 'android:value' : 'true' ,
157- } ,
158- } ,
159- {
160- $ : {
161- 'android:name' : 'expo.modules.updates.EXPO_RUNTIME_VERSION' ,
162- 'android:value' : '@string/expo_runtime_version' ,
163- } ,
164- } ,
165- {
166- $ : {
167- 'android:name' : 'com.example.NOT_UPDATES' ,
168- 'android:value' : 'ignored' ,
169- } ,
170- } ,
171- ] ,
172- } ,
173- ] ,
174- } ,
175- } ;
176-
177- writeAppStrings (
178- androidDir ,
179- `<?xml version="1.0" encoding="utf-8"?>
141+ const stringsContent = `<?xml version="1.0" encoding="utf-8"?>
180142<resources>
181143 <string name="expo_runtime_version">1.0.0-preview</string>
182- </resources>`
183- ) ;
144+ </resources>` ;
145+
146+ writeAppManifest ( androidDir , manifestContent ) ;
147+ writeAppStrings ( androidDir , stringsContent ) ;
184148
185149 const fileMetaData = extractExpoUpdatesApplicationMetaData ( manifestContent ) ;
186- const typedMetaData = extractApplicationMetaDataFromAndroidManifest (
187- typedManifest
188- ) . filter ( ( { name } ) => name . startsWith ( 'expo.modules.updates.' ) ) ;
150+ const rawMetaData = extractApplicationMetaData ( manifestContent ) . filter (
151+ ( { name } ) => name . startsWith ( 'expo.modules.updates.' )
152+ ) ;
189153
190- expect ( typedMetaData ) . toEqual ( fileMetaData ) ;
154+ expect ( rawMetaData ) . toEqual ( fileMetaData ) ;
191155 expect (
192- extractStringResourcesFromResourcesXml (
193- {
194- resources : {
195- string : [
196- {
197- $ : { name : 'expo_runtime_version' } ,
198- _ : '1.0.0-preview' ,
199- } ,
200- ] ,
201- } ,
202- } ,
203- [ 'expo_runtime_version' ]
204- )
156+ extractStringResourcesFromXml ( stringsContent , [ 'expo_runtime_version' ] )
205157 ) . toEqual ( readExpoUpdatesStringResources ( androidDir , 'app' , fileMetaData ) ) ;
206158 } ) ;
207159
208- it ( 'supports android:resource entries in the typed manifest adapter' , ( ) => {
209- const metaDataEntries = extractApplicationMetaDataFromAndroidManifest ( {
210- manifest : {
211- $ : {
212- 'xmlns:android' : 'http://schemas.android.com/apk/res/android' ,
213- } ,
214- queries : [ ] ,
215- application : [
216- {
217- $ : {
218- 'android:name' : '.MainApplication' ,
219- } ,
220- 'meta-data' : [
221- {
222- $ : {
223- 'android:name' : 'expo.modules.updates.EXPO_RUNTIME_VERSION' ,
224- 'android:resource' : '@string/expo_runtime_version' ,
225- } ,
226- } ,
227- {
228- $ : {
229- 'android:name' : 'com.example.NOT_UPDATES' ,
230- 'android:resource' : '@string/ignored' ,
231- } ,
232- } ,
233- ] ,
234- } ,
235- ] ,
236- } ,
237- } ) . filter ( ( { name } ) => name . startsWith ( 'expo.modules.updates.' ) ) ;
238-
239- expect ( metaDataEntries ) . toEqual ( [
160+ it ( 'ignores android:resource entries because only android:value metadata is supported' , ( ) => {
161+ expect (
162+ extractApplicationMetaData ( `<?xml version="1.0" encoding="utf-8"?>
163+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
164+ <application android:name=".MainApplication">
165+ <meta-data
166+ android:name="expo.modules.updates.EXPO_RUNTIME_VERSION"
167+ android:resource="@string/expo_runtime_version" />
168+ <meta-data android:name="expo.modules.updates.ENABLED" android:value="true" />
169+ </application>
170+ </manifest>` )
171+ ) . toEqual ( [
240172 {
241- name : 'expo.modules.updates.EXPO_RUNTIME_VERSION ' ,
242- value : '@string/expo_runtime_version ' ,
173+ name : 'expo.modules.updates.ENABLED ' ,
174+ value : 'true ' ,
243175 } ,
244176 ] ) ;
177+
245178 expect (
246- extractStringResourcesFromResourcesXml (
247- {
248- resources : {
249- string : [
250- {
251- $ : { name : 'expo_runtime_version' } ,
252- _ : '2.0.0' ,
253- } ,
254- ] ,
255- } ,
256- } ,
179+ extractStringResourcesFromXml (
180+ `<?xml version="1.0" encoding="utf-8"?>
181+ <resources>
182+ <string name="expo_runtime_version">2.0.0</string>
183+ </resources>` ,
257184 [ 'expo_runtime_version' ]
258185 )
259186 ) . toEqual ( [
0 commit comments