Skip to content

Commit

Permalink
feat(perf): support "perf_auto_collection_enabled" flag in firebase.j…
Browse files Browse the repository at this point in the history
…son (#4870)
  • Loading branch information
michaelgmcd committed Feb 4, 2021
1 parent 9c4ada8 commit e54bf49
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
8 changes: 8 additions & 0 deletions packages/app/ios_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ if [[ ${_SEARCH_RESULT} ]]; then
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_ANALYTICS_AUTO_COLLECTION")")
fi

# config.perf_auto_collection_enabled
_PERF_AUTO_COLLECTION=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "perf_auto_collection_enabled")
if [[ $_PERF_AUTO_COLLECTION ]]; then
_PLIST_ENTRY_KEYS+=("firebase_performance_collection_enabled")
_PLIST_ENTRY_TYPES+=("bool")
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_PERF_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
13 changes: 13 additions & 0 deletions packages/perf/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("perf_auto_collection_enabled", true) == false) {
autoCollectionEnabled = "false"
}
}

android {
defaultConfig {
multiDexEnabled true
manifestPlaceholders = [
firebaseJsonAutoCollectionEnabled: autoCollectionEnabled
]
}
lintOptions {
disable 'GradleCompatible'
Expand Down
10 changes: 9 additions & 1 deletion packages/perf/android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="io.invertase.firebase.perf" />

<manifest package="io.invertase.firebase.perf"
xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<meta-data
android:name="firebase_performance_collection_enabled"
android:value="${firebaseJsonAutoCollectionEnabled}" />
</application>
</manifest>
3 changes: 2 additions & 1 deletion tests/firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

"analytics_auto_collection_enabled": true,

"TODO_perf_auto_collection_enabled": true,
"perf_auto_collection_enabled": true,

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

1 comment on commit e54bf49

@vercel
Copy link

@vercel vercel bot commented on e54bf49 Feb 4, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.