Skip to content

Added support for dictionary info_plist values#6

Open
wellspringapps wants to merge 1 commit intoNativePHP:mainfrom
wellspringapps:ios-dict-merge
Open

Added support for dictionary info_plist values#6
wellspringapps wants to merge 1 commit intoNativePHP:mainfrom
wellspringapps:ios-dict-merge

Conversation

@wellspringapps
Copy link

Summary

The plist merge in the iOS compile only supports strings and arrays. There are features the require dictionary and boolean values in the plist file.

Solution

The change was to add a method to handle all the types (String, Array, Dictionary, and Bool).

Changes

  • src/Plugins/Compilers/IOSPluginCompiler.php - Added a method to recursively handle the structure.
  • tests/Feature/Plugins/IOSCompilerTest.php - Updated it_handles_various_plist_value_types with all the types

Copy link
Contributor

@shanerbaner82 shanerbaner82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work — this fills a real gap in plist handling. A few things I'd like to see addressed before merging:

Formatting / Output

  1. Inconsistent indentation — nested <dict> and <array> tags all use \n\t regardless of depth. At 3+ levels deep the output won't match proper plist indentation. Consider passing a $depth parameter through the recursion to control tab count.

  2. Bool output is inconsistent<true /> has a trailing \n\t but <false /> doesn't. Also Apple's canonical format is <true/> / <false/> (no space before />) — we should match that.

Edge Cases

  1. Empty array handlingarray_key_first() returns null on an empty array, and !is_int(null) evaluates to true, so an empty array [] would be treated as a dict. Add a guard for this.

  2. Missing integer/real support — plist also has <integer> and <real> types. If this is meant to be the comprehensive type handler, those should be covered (or at minimum, numeric values shouldn't silently become <string>).

Code Quality

  1. No type hintshandlePlistTypes($key, $value) is missing type declarations. The rest of the codebase uses them — this should match.

  2. substituteEnvPlaceholders only runs on leaf strings — works for values, but if a placeholder ever appears in a key name it won't get substituted. Worth noting or handling.

Tests

  1. No bool assertion — the test sets UIApplicationSupportsMultipleScenes => true but never asserts that <true/> appears in the output. Should verify bool rendering actually works.

  2. Assertions are too shallowassertStringContainsString for a few key names doesn't validate the actual XML structure or nesting. Consider asserting on the structural tags (<dict>, <array>, <true/>) and/or their relative positions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants