[expo-manifests] Fix error in handling nested array (#23562)# Why Fix crash on iOS if a plugin is passed in as an array, but with only the name element and not the props element. Also fix co
[expo-manifests] Fix error in handling nested array (#23562)# Why Fix crash on iOS if a plugin is passed in as an array, but with only the name element and not the props element. Also fix corresponding code on Android, where an exception is thrown. Fixes #23549. # How Modified `Manifest.swift` and `Manifest.kt` to handle the above case correctly. # Test Plan - Tested with Expo Go and the project provided in the above issue - New unit tests for both iOS and Android # Checklist - [x] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [x] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [x] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin).
show more ...
[manifests] introduce getPluginProperties (#22701)# Why currently we enable the network inspector through `expo-build-properties`, e.g. in app.json ```json { "expo": { "plugins": [
[manifests] introduce getPluginProperties (#22701)# Why currently we enable the network inspector through `expo-build-properties`, e.g. in app.json ```json { "expo": { "plugins": [ [ "expo-build-properties", { "android": { "unstable_networkInspector": true }, "ios": { "unstable_networkInspector": true } } ] ] } } ``` to support this feature on expo go, i want to leverage the same configuration without introducing new properties to app.json schema. this pr adds `Manifests.getPluginProperties` to query properties from the `plugins` array. # How - introduce `Manifests.getPluginProperties(packageName: String): [String: Any]?` that will return the matched `packageName` inside the plugins. for package setting without extra properties, e.g. `plugins: ["expo-camera"]`, this function will also return nil. - also move the original android instrumentation tests as unit tests. that would be faster without android emulator. #### Usage example for instance, to get the `unstable_networkInspector`, we can call it like: ```objc NSDictionary<NSString *, id> *buildProps = [_appRecord.appLoader.manifest getPluginPropertiesWithPackageName:@"expo-build-properties"]; BOOL networkInspector = [[[buildProps objectForKey:@"ios"] objectForKey:@"unstable_networkInspector"] boolValue]; ``` ```kotlin val buildProps = (instanceManagerBuilderProperties.manifest.getPluginProperties("expo-build-properties")?.get("android") as? Map<*, *>) ?.mapKeys { it.key.toString() } val networkInspector = buildProps?.get("unstable_networkInspector") as? Boolean ?: false ``` # Test Plan - add unit tests both on android and ios --------- Co-authored-by: Will Schurman <[email protected]>