Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(analytics): add support for analytics_auto_collection_enabled in firebase.json #4730

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/analytics/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,22 @@ project.ext {
])
}

apply from: file("./../../app/android/firebase-json.gradle")

def autoCollectionEnabled = "true"

if (rootProject.ext && rootProject.ext.firebaseJson) {
if (rootProject.ext.firebaseJson.isFlagEnabled("analytics_auto_collection_enabled") == false) {
autoCollectionEnabled = "false"
}
}

android {
defaultConfig {
multiDexEnabled true
manifestPlaceholders = [
firebaseJsonAutoCollectionEnabled: autoCollectionEnabled
]
}
lintOptions {
disable 'GradleCompatible'
Expand Down
6 changes: 6 additions & 0 deletions packages/analytics/android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

<application>
<meta-data
android:name="firebase_analytics_collection_enabled"
android:value="${firebaseJsonAutoCollectionEnabled}"/>
</application>
</manifest>
8 changes: 8 additions & 0 deletions packages/app/ios_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ if [[ ${_SEARCH_RESULT} ]]; then
_PLIST_ENTRY_TYPES+=("string")
_PLIST_ENTRY_VALUES+=("$_JSON_OUTPUT_BASE64")

# config.analytics_auto_collection_enabled
_ANALYTICS_AUTO_COLLECTION=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "analytics_auto_collection_enabled")
if [[ $_ANALYTICS_AUTO_COLLECTION ]]; then
_PLIST_ENTRY_KEYS+=("FIREBASE_ANALYTICS_COLLECTION_ENABLED")
_PLIST_ENTRY_TYPES+=("bool")
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_ANALYTICS_AUTO_COLLECTION")")
fi

# config.messaging_auto_init_enabled
_MESSAGING_AUTO_INIT=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "messaging_auto_init_enabled")
if [[ $_MESSAGING_AUTO_INIT ]]; then
Expand Down
3 changes: 2 additions & 1 deletion tests/firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"messaging_android_notification_color": "@color/hotpink",
"messaging_ios_auto_register_for_remote_messages": true,

"TODO_analytics_auto_collection_enabled": true,
"analytics_auto_collection_enabled": true,

"TODO_perf_auto_collection_enabled": true,
"TODO_in_app_messaging_auto_collection_enabled": true,
"TODO_database_persistence_enabled": true,
Expand Down