Skip to content

Commit e54bf49

Browse files
authored
feat(perf): support "perf_auto_collection_enabled" flag in firebase.json (#4870)
1 parent 9c4ada8 commit e54bf49

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

packages/app/ios_config.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ if [[ ${_SEARCH_RESULT} ]]; then
9494
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_ANALYTICS_AUTO_COLLECTION")")
9595
fi
9696

97+
# config.perf_auto_collection_enabled
98+
_PERF_AUTO_COLLECTION=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "perf_auto_collection_enabled")
99+
if [[ $_PERF_AUTO_COLLECTION ]]; then
100+
_PLIST_ENTRY_KEYS+=("firebase_performance_collection_enabled")
101+
_PLIST_ENTRY_TYPES+=("bool")
102+
_PLIST_ENTRY_VALUES+=("$(jsonBoolToYesNo "$_PERF_AUTO_COLLECTION")")
103+
fi
104+
97105
# config.messaging_auto_init_enabled
98106
_MESSAGING_AUTO_INIT=$(getFirebaseJsonKeyValue "$_JSON_OUTPUT_RAW" "messaging_auto_init_enabled")
99107
if [[ $_MESSAGING_AUTO_INIT ]]; then

packages/perf/android/build.gradle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,22 @@ project.ext {
6363
])
6464
}
6565

66+
apply from: file("./../../app/android/firebase-json.gradle")
67+
68+
def autoCollectionEnabled = "true"
69+
70+
if (rootProject.ext && rootProject.ext.firebaseJson) {
71+
if (rootProject.ext.firebaseJson.isFlagEnabled("perf_auto_collection_enabled", true) == false) {
72+
autoCollectionEnabled = "false"
73+
}
74+
}
75+
6676
android {
6777
defaultConfig {
6878
multiDexEnabled true
79+
manifestPlaceholders = [
80+
firebaseJsonAutoCollectionEnabled: autoCollectionEnabled
81+
]
6982
}
7083
lintOptions {
7184
disable 'GradleCompatible'
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest package="io.invertase.firebase.perf" />
2+
3+
<manifest package="io.invertase.firebase.perf"
4+
xmlns:android="http://schemas.android.com/apk/res/android">
5+
<application>
6+
<meta-data
7+
android:name="firebase_performance_collection_enabled"
8+
android:value="${firebaseJsonAutoCollectionEnabled}" />
9+
</application>
10+
</manifest>

tests/firebase.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
"analytics_auto_collection_enabled": true,
1919

20-
"TODO_perf_auto_collection_enabled": true,
20+
"perf_auto_collection_enabled": true,
21+
2122
"TODO_in_app_messaging_auto_collection_enabled": true,
2223
"TODO_database_persistence_enabled": true,
2324
"TODO_firestore_persistence_enabled": true,

0 commit comments

Comments
 (0)