extender
extender copied to clipboard
Conflicting Info.plist merge strategies
There's a problem when merging Info.plists where the expected result is different depending on which type of key that is merged.
Case 1 - merging array of dictionaries with SKAdNetworkItems
PLIST 1
<plist version="1.0">
<dict>
<key>SKAdNetworkItems</key>
<array>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>7UG5ZH24HU.skadnetwork</string>
</dict>
</array>
</dict>
</plist>
PLIST 2
<plist version="1.0">
<dict>
<key>SKAdNetworkItems</key>
<array>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>ECPZ2SRF59.skadnetwork</string>
</dict>
</array>
</dict>
</plist>
The expected merge of the SKAdNetworkItems is one array with the two SKAdNetworkIdentifier fields:
EXPECTED
<plist version="1.0">
<dict>
<key>SKAdNetworkItems</key>
<array>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>ECPZ2SRF59.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>7UG5ZH24HU.skadnetwork</string>
</dict>
</array>
</dict>
</plist>
Case 2 - merging array of dicts with CFBundleURLTypes
PLIST 1
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb7886788786688</string>
</array>
</dict>
</array>
PLIST 2
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>REVERSED_CLIENT_ID</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.fjdkdknvhgjfd</string>
</array>
</dict>
</array>
In this case we expect ONE new merged entry:
EXPECTED
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>REVERSED_CLIENT_ID</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.fjdkdknvhgjfd</string>
<string>fb7886788786688</string>
</array>
</dict>
</array>
The current code handles the second case, not the first one. How are we going to deal with this? Should we have a list of keys which should be merged according to the first case, and default to a "deep merge" as in case 2?