diff --git a/app/build.gradle b/app/build.gradle index ac8de19c1e..a3f5e478af 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -252,9 +252,10 @@ dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.google.android.gms:play-services-wearable:17.0.0' implementation 'com.google.android.gms:play-services-location:17.1.0' - implementation 'com.google.firebase:firebase-core:17.4.3' - implementation 'com.google.firebase:firebase-auth:19.4.0' - implementation 'com.google.firebase:firebase-database:19.5.0' + implementation platform('com.google.firebase:firebase-bom:25.12.0') + implementation "com.google.firebase:firebase-analytics-ktx" + implementation 'com.google.firebase:firebase-auth-ktx' + implementation 'com.google.firebase:firebase-database-ktx' implementation "androidx.appcompat:appcompat:$appcompat_verison" implementation 'androidx.legacy:legacy-support-v13:1.0.0' @@ -266,7 +267,7 @@ dependencies { implementation 'androidx.percentlayout:percentlayout:1.0.0' implementation "androidx.preference:preference-ktx:$preferencektx_version" implementation "androidx.activity:activity-ktx:${activityVersion}" - implementation "androidx.fragment:fragment:${fragmentVersion}" + implementation "androidx.fragment:fragment-ktx:${fragmentktx_version}" implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version" implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-ui-ktx:$nav_version" diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/elements/ProfileElement.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/elements/ProfileElement.kt index cae2dd7b6a..dbc9888e3e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/elements/ProfileElement.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/elements/ProfileElement.kt @@ -3,9 +3,7 @@ package info.nightscout.androidaps.plugins.general.tidepool.elements import com.google.gson.annotations.Expose import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.db.ProfileSwitch -import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.general.tidepool.comm.TidepoolUploader -import info.nightscout.androidaps.utils.InstanceId import java.util.* import kotlin.collections.ArrayList diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/messages/OpenDatasetRequestMessage.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/messages/OpenDatasetRequestMessage.kt index bc6e00f59a..e6fd2c63dd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/messages/OpenDatasetRequestMessage.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/tidepool/messages/OpenDatasetRequestMessage.kt @@ -2,10 +2,8 @@ package info.nightscout.androidaps.plugins.general.tidepool.messages import com.google.gson.annotations.Expose import info.nightscout.androidaps.BuildConfig -import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin import info.nightscout.androidaps.plugins.general.tidepool.comm.TidepoolUploader import info.nightscout.androidaps.utils.DateUtil -import info.nightscout.androidaps.utils.InstanceId import info.nightscout.androidaps.utils.T import java.util.* diff --git a/build.gradle b/build.gradle index 3ca7cbe714..93357b1828 100644 --- a/build.gradle +++ b/build.gradle @@ -12,15 +12,13 @@ buildscript { dagger_version = '2.29.1' coroutinesVersion = '1.3.7' activityVersion = '1.2.0-beta01' - fragmentVersion = '1.3.0-beta01' + fragmentktx_version = '1.3.0-beta01' ormLiteVersion = '4.46' nav_version = '2.3.1' appcompat_verison = '1.2.0' material_version = '1.2.1' constraintlayout_version = '2.0.2' preferencektx_version = '1.1.1' - firebaseanalyticsktx_version = '17.4.3' - firebasecrashlytics_version = '17.2.2' commonslang3_version = '3.11' junit_version = '4.13.1' diff --git a/core/build.gradle b/core/build.gradle index cd02aeaa75..6bde574fca 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -59,8 +59,10 @@ dependencies { //Logger implementation 'org.slf4j:slf4j-api:1.7.30' //Fabric - implementation "com.google.firebase:firebase-analytics-ktx:$firebaseanalyticsktx_version" - implementation "com.google.firebase:firebase-crashlytics:$firebasecrashlytics_version" + implementation platform('com.google.firebase:firebase-bom:25.12.0') + implementation "com.google.firebase:firebase-analytics-ktx" + implementation "com.google.firebase:firebase-crashlytics-ktx" + implementation "com.google.firebase:firebase-messaging-ktx" //RxBus implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}" diff --git a/core/src/main/java/info/nightscout/androidaps/utils/FabricPrivacy.kt b/core/src/main/java/info/nightscout/androidaps/utils/FabricPrivacy.kt index 744c692541..6597f93698 100644 --- a/core/src/main/java/info/nightscout/androidaps/utils/FabricPrivacy.kt +++ b/core/src/main/java/info/nightscout/androidaps/utils/FabricPrivacy.kt @@ -3,7 +3,9 @@ package info.nightscout.androidaps.utils import android.content.Context import android.os.Bundle import com.google.firebase.analytics.FirebaseAnalytics +import com.google.firebase.analytics.ktx.analytics import com.google.firebase.crashlytics.FirebaseCrashlytics +import com.google.firebase.ktx.Firebase import info.nightscout.androidaps.core.R import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -18,19 +20,32 @@ import javax.inject.Singleton */ @Singleton class FabricPrivacy @Inject constructor( - context: Context, private val aapsLogger: AAPSLogger, private val sp: SP ) { - var firebaseAnalytics: FirebaseAnalytics + val firebaseAnalytics: FirebaseAnalytics = Firebase.analytics init { - firebaseAnalytics = FirebaseAnalytics.getInstance(context) firebaseAnalytics.setAnalyticsCollectionEnabled(!java.lang.Boolean.getBoolean("disableFirebase") && fabricEnabled()) FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(!java.lang.Boolean.getBoolean("disableFirebase") && fabricEnabled()) } + // Analytics logCustom + fun logCustom(name: String, event: Bundle) { + try { + if (fabricEnabled()) { + firebaseAnalytics.logEvent(name, event) + } else { + aapsLogger.debug(LTag.CORE, "Ignoring recently opted-out event: $event") + } + } catch (e: NullPointerException) { + aapsLogger.debug(LTag.CORE, "Ignoring opted-out non-initialized event: $event") + } catch (e: IllegalStateException) { + aapsLogger.debug(LTag.CORE, "Ignoring opted-out non-initialized event: $event") + } + } + // Analytics logCustom fun logCustom(event: Bundle) { try { diff --git a/app/src/main/java/info/nightscout/androidaps/utils/InstanceId.kt b/core/src/main/java/info/nightscout/androidaps/utils/InstanceId.kt similarity index 100% rename from app/src/main/java/info/nightscout/androidaps/utils/InstanceId.kt rename to core/src/main/java/info/nightscout/androidaps/utils/InstanceId.kt diff --git a/omnipod/build.gradle b/omnipod/build.gradle index 083f6014b6..bea836e961 100644 --- a/omnipod/build.gradle +++ b/omnipod/build.gradle @@ -75,12 +75,10 @@ dependencies { implementation "androidx.core:core-ktx:$coreVersion" implementation "androidx.preference:preference-ktx:$preferencektx_version" implementation "androidx.activity:activity-ktx:${activityVersion}" - implementation "androidx.fragment:fragment:${fragmentVersion}" + implementation "androidx.fragment:fragment-ktx:${fragmentktx_version}" implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version" implementation "com.google.android.material:material:$material_version" - implementation "com.google.firebase:firebase-analytics-ktx:$firebaseanalyticsktx_version" - implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}" // Graphview cannot be upgraded diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java index 6e1c85314b..b036d0b02c 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java @@ -933,7 +933,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface, Bundle params = new Bundle(); params.putString("version", BuildConfig.VERSION); - fabricPrivacy.getFirebaseAnalytics().logEvent("OmnipodPumpInit", params); + fabricPrivacy.logCustom("OmnipodPumpInit", params); } @NonNull private PumpEnactResult deliverBolus(final DetailedBolusInfo detailedBolusInfo) {