Skip to content

Commit

Permalink
Merge 718d633 into 2efb5c2
Browse files Browse the repository at this point in the history
  • Loading branch information
gewfy authored Dec 30, 2020
2 parents 2efb5c2 + 718d633 commit 9cb44e4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
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

0 comments on commit 9cb44e4

Please sign in to comment.