Restore Omnipod firebase event

This commit is contained in:
Bart Sopers 2020-08-17 23:46:55 +02:00
parent 2b10524217
commit 02e818c92d
2 changed files with 15 additions and 0 deletions

View file

@ -15,6 +15,8 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
// OMNIPOD: for usage in Firebase event during testing phase
buildConfigField "String", "VERSION", '"2.7-omnipod-0.4.1-SNAPSHOT"'
// OMNIPOD: Keep track of what commit from the main repository we're on, these fields aren't actually used anywhere
buildConfigField "String", "DEV_VERSION", '"2.6.7-dev"'
buildConfigField "String", "DEV_VERSION_COMMIT", '"65c8cc98804cfc366239ad2bedb2dd98e3e4f3c2"'
@ -71,6 +73,8 @@ dependencies {
implementation "androidx.activity:activity-ktx:${activityVersion}"
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.google.firebase:firebase-analytics-ktx:17.4.3'
implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}"
// Graphview cannot be upgraded

View file

@ -4,6 +4,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.os.SystemClock;
@ -105,6 +106,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
private int timeChangeRetries = 0;
private Profile currentProfile;
private long nextPodCheck = 0L;
private boolean sentIdToFirebase;
@Inject
public OmnipodPumpPlugin(
@ -561,6 +563,15 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
finishAction("Omnipod Pump");
if (!sentIdToFirebase) {
Bundle params = new Bundle();
params.putString("version", BuildConfig.VERSION);
getFabricPrivacy().getFirebaseAnalytics().logEvent("OmnipodPumpInit", params);
sentIdToFirebase = true;
}
isInitialized = true;
this.firstRun = false;