fix(firebase-analytics): consistent handling of Podfile variable $NSFirebaseAnalyticsWithoutAdIdSupport#167
Merged
Conversation
…irebaseAnalyticsWithoutAdIdSupport
romulowspp
approved these changes
Dec 27, 2022
NathanWalker
approved these changes
Dec 27, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some context:
Before we would find the platforms/ios/Podfile and add $NSFirebaseAnalyticsWithoutAdIdSupport to the top. Turns out that the file is not always available on before-checkForChanges and it's only available consistently in after-prepare, which is already too late (pods already installed). As a result, the first build would not have the option, and from the second build onwards it would.
So instead of adding another hook to the cli, I simply modify the Podfile in node_modules. The code is resilient enough to always update the Podfile if the desired result is different from the current state (if
$NSFirebaseAnalyticsWithoutAdIdSupport=truein the user Podfile, it will add to the plugin Podfile if missing. IfNSFirebaseAnalyticsWithoutAdIdSupport=trueis present in the plugin Podfile but not on the user Podfile then we always remove it).It also now supports comments (
#$NSFirebaseAnalyticsWithoutAdIdSupport=truewill not add to the podfile).Ideally we should fix the CLI so we could have a
BeforePluginsPodfile(or something. Similar tobefore-plugins.gradleon android)Fixes #128