Skip to content

fix(firebase-analytics): consistent handling of Podfile variable $NSFirebaseAnalyticsWithoutAdIdSupport#167

Merged
NathanWalker merged 1 commit into
NativeScript:mainfrom
edusperoni:fix/analyticsAdId
Dec 27, 2022
Merged

fix(firebase-analytics): consistent handling of Podfile variable $NSFirebaseAnalyticsWithoutAdIdSupport#167
NathanWalker merged 1 commit into
NativeScript:mainfrom
edusperoni:fix/analyticsAdId

Conversation

@edusperoni

@edusperoni edusperoni commented Dec 27, 2022

Copy link
Copy Markdown
Contributor

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=true in the user Podfile, it will add to the plugin Podfile if missing. If NSFirebaseAnalyticsWithoutAdIdSupport=true is present in the plugin Podfile but not on the user Podfile then we always remove it).

It also now supports comments (#$NSFirebaseAnalyticsWithoutAdIdSupport=true will not add to the podfile).

Ideally we should fix the CLI so we could have a BeforePluginsPodfile (or something. Similar to before-plugins.gradle on android)

Fixes #128

@cla-bot cla-bot Bot added the cla: yes label Dec 27, 2022
@NathanWalker NathanWalker merged commit 7ca3c04 into NativeScript:main Dec 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

error when set $NSFirebaseAnalyticsWithoutAdIdSupport=true

3 participants