Answers -> Analytics migration

This commit is contained in:
Milos Kozak 2019-04-05 00:32:26 +02:00
parent fbd9e3e501
commit 3636480c61
29 changed files with 152 additions and 233 deletions

View file

@ -54,6 +54,7 @@ import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus
import info.nightscout.androidaps.setupwizard.SetupWizardActivity; import info.nightscout.androidaps.setupwizard.SetupWizardActivity;
import info.nightscout.androidaps.tabs.TabPageAdapter; import info.nightscout.androidaps.tabs.TabPageAdapter;
import info.nightscout.androidaps.utils.AndroidPermission; import info.nightscout.androidaps.utils.AndroidPermission;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.LocaleHelper; import info.nightscout.androidaps.utils.LocaleHelper;
import info.nightscout.androidaps.utils.OKDialog; import info.nightscout.androidaps.utils.OKDialog;
import info.nightscout.androidaps.utils.PasswordProtection; import info.nightscout.androidaps.utils.PasswordProtection;
@ -115,6 +116,7 @@ public class MainActivity extends AppCompatActivity {
} }
}); });
VersionChecker.check(); VersionChecker.check();
FabricPrivacy.setUserStats();
} }
private void checkPluginPreferences(ViewPager viewPager) { private void checkPluginPreferences(ViewPager viewPager) {

View file

@ -9,7 +9,7 @@ import android.support.annotation.PluralsRes;
import android.support.v4.content.LocalBroadcastManager; import android.support.v4.content.LocalBroadcastManager;
import com.crashlytics.android.Crashlytics; import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers; import com.google.firebase.analytics.FirebaseAnalytics;
import com.j256.ormlite.android.apptools.OpenHelperManager; import com.j256.ormlite.android.apptools.OpenHelperManager;
import com.squareup.otto.Bus; import com.squareup.otto.Bus;
import com.squareup.otto.LoggingBus; import com.squareup.otto.LoggingBus;
@ -97,6 +97,8 @@ public class MainApp extends Application {
private static MainApp sInstance; private static MainApp sInstance;
public static Resources sResources; public static Resources sResources;
private static FirebaseAnalytics mFirebaseAnalytics;
private static DatabaseHelper sDatabaseHelper = null; private static DatabaseHelper sDatabaseHelper = null;
private static ConstraintChecker sConstraintsChecker = null; private static ConstraintChecker sConstraintsChecker = null;
@ -123,13 +125,14 @@ public class MainApp extends Application {
try { try {
if (FabricPrivacy.fabricEnabled()) { if (FabricPrivacy.fabricEnabled()) {
Fabric.with(this, new Crashlytics()); Fabric.with(this, new Crashlytics());
Fabric.with(this, new Answers());
Crashlytics.setString("BUILDVERSION", BuildConfig.BUILDVERSION); Crashlytics.setString("BUILDVERSION", BuildConfig.BUILDVERSION);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("Error with Fabric init! " + e); log.error("Error with Fabric init! " + e);
} }
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
JodaTimeAndroid.init(this); JodaTimeAndroid.init(this);
log.info("Version: " + BuildConfig.VERSION_NAME); log.info("Version: " + BuildConfig.VERSION_NAME);
@ -307,6 +310,10 @@ public class MainApp extends Application {
} }
} }
public static FirebaseAnalytics getFirebaseAnalytics() {
return mFirebaseAnalytics;
}
public static ConstraintChecker getConstraintChecker() { public static ConstraintChecker getConstraintChecker() {
return sConstraintsChecker; return sConstraintsChecker;
} }

View file

@ -10,7 +10,6 @@ import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import butterknife.BindView; import butterknife.BindView;
@ -19,9 +18,9 @@ import butterknife.OnClick;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.interfaces.Constraint;
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopSetLastRunGui; import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopSetLastRunGui;
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui; import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui;
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.FabricPrivacy;
public class LoopFragment extends SubscriberFragment { public class LoopFragment extends SubscriberFragment {
@ -62,7 +61,6 @@ public class LoopFragment extends SubscriberFragment {
void onRunClick() { void onRunClick() {
lastRunView.setText(MainApp.gs(R.string.executing)); lastRunView.setText(MainApp.gs(R.string.executing));
new Thread(() -> LoopPlugin.getPlugin().invoke("Loop button", true)).start(); new Thread(() -> LoopPlugin.getPlugin().invoke("Loop button", true)).start();
FabricPrivacy.getInstance().logCustom(new CustomEvent("Loop_Run"));
} }
@Subscribe @Subscribe
@ -75,7 +73,11 @@ public class LoopFragment extends SubscriberFragment {
clearGUI(); clearGUI();
final Activity activity = getActivity(); final Activity activity = getActivity();
if (activity != null) if (activity != null)
activity.runOnUiThread(() -> { synchronized (LoopFragment.this) { if (lastRunView != null) lastRunView.setText(ev.text); } }); activity.runOnUiThread(() -> {
synchronized (LoopFragment.this) {
if (lastRunView != null) lastRunView.setText(ev.text);
}
});
} }

View file

@ -13,7 +13,6 @@ import android.os.SystemClock;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationCompat;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -33,6 +32,7 @@ import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.events.EventAcceptOpenLoopChange;
import info.nightscout.androidaps.events.EventNewBG; import info.nightscout.androidaps.events.EventNewBG;
import info.nightscout.androidaps.events.EventTempTargetChange; import info.nightscout.androidaps.events.EventTempTargetChange;
import info.nightscout.androidaps.interfaces.APSInterface; import info.nightscout.androidaps.interfaces.APSInterface;
@ -44,18 +44,17 @@ import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.interfaces.TreatmentsInterface; import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopSetLastRunGui; import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopSetLastRunGui;
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui; import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui;
import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotification; import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotification;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload; import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.plugins.general.wear.ActionStringHandler;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin; import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.plugins.general.wear.ActionStringHandler;
import info.nightscout.androidaps.events.EventAcceptOpenLoopChange;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.queue.commands.Command; import info.nightscout.androidaps.queue.commands.Command;
import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.FabricPrivacy;
@ -179,11 +178,9 @@ public class LoopPlugin extends PluginBase {
@Subscribe @Subscribe
public void onStatusEvent(final EventTempTargetChange ev) { public void onStatusEvent(final EventTempTargetChange ev) {
new Thread(() -> invoke("EventTempTargetChange", true)).start(); new Thread(() -> invoke("EventTempTargetChange", true)).start();
FabricPrivacy.getInstance().logCustom(new CustomEvent("TT_Loop_Run"));
} }
public void suspendTo(long endTime) { public void suspendTo(long endTime) {
loopSuspendedTill = endTime; loopSuspendedTill = endTime;
isSuperBolus = false; isSuperBolus = false;
@ -376,7 +373,7 @@ public class LoopPlugin extends PluginBase {
if (resultAfterConstraints.bolusRequested) if (resultAfterConstraints.bolusRequested)
lastRun.smbSetByPump = waiting; lastRun.smbSetByPump = waiting;
MainApp.bus().post(new EventLoopUpdateGui()); MainApp.bus().post(new EventLoopUpdateGui());
FabricPrivacy.getInstance().logCustom(new CustomEvent("APSRequest")); FabricPrivacy.getInstance().logCustom("APSRequest");
applyTBRRequest(resultAfterConstraints, profile, new Callback() { applyTBRRequest(resultAfterConstraints, profile, new Callback() {
@Override @Override
public void run() { public void run() {
@ -395,7 +392,6 @@ public class LoopPlugin extends PluginBase {
SystemClock.sleep(1000); SystemClock.sleep(1000);
LoopPlugin.getPlugin().invoke("tempBasalFallback", allowNotification, true); LoopPlugin.getPlugin().invoke("tempBasalFallback", allowNotification, true);
}).start(); }).start();
FabricPrivacy.getInstance().logCustom(new CustomEvent("Loop_Run_TempBasalFallback"));
} }
MainApp.bus().post(new EventLoopUpdateGui()); MainApp.bus().post(new EventLoopUpdateGui());
} }
@ -482,7 +478,7 @@ public class LoopPlugin extends PluginBase {
MainApp.bus().post(new EventAcceptOpenLoopChange()); MainApp.bus().post(new EventAcceptOpenLoopChange());
} }
}); });
FabricPrivacy.getInstance().logCustom(new CustomEvent("AcceptTemp")); FabricPrivacy.getInstance().logCustom("AcceptTemp");
} }
/** /**

View file

@ -8,7 +8,6 @@ import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import org.json.JSONArray; import org.json.JSONArray;
@ -19,11 +18,10 @@ import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateGui; import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateGui;
import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateResultGui; import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateResultGui;
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.JSONFormatter; import info.nightscout.androidaps.utils.JSONFormatter;
public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnClickListener { public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnClickListener {
@ -68,7 +66,6 @@ public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnCli
switch (view.getId()) { switch (view.getId()) {
case R.id.openapsma_run: case R.id.openapsma_run:
OpenAPSAMAPlugin.getPlugin().invoke("OpenAPSAMA button", false); OpenAPSAMAPlugin.getPlugin().invoke("OpenAPSAMA button", false);
FabricPrivacy.getInstance().logCustom(new CustomEvent("OpenAPS_AMA_Run"));
break; break;
} }

View file

@ -8,13 +8,12 @@ import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateGui; import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateGui;
import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateResultGui; import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateResultGui;
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.JSONFormatter; import info.nightscout.androidaps.utils.JSONFormatter;
@ -61,7 +60,6 @@ public class OpenAPSMAFragment extends SubscriberFragment implements View.OnClic
switch (view.getId()) { switch (view.getId()) {
case R.id.openapsma_run: case R.id.openapsma_run:
OpenAPSMAPlugin.getPlugin().invoke("OpenAPSMA button", false); OpenAPSMAPlugin.getPlugin().invoke("OpenAPSMA button", false);
FabricPrivacy.getInstance().logCustom(new CustomEvent("OpenAPS_MA_Run"));
break; break;
} }

View file

@ -8,7 +8,6 @@ import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import org.json.JSONArray; import org.json.JSONArray;
@ -22,11 +21,10 @@ import butterknife.OnClick;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateGui; import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateGui;
import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateResultGui; import info.nightscout.androidaps.plugins.aps.openAPSMA.events.EventOpenAPSUpdateResultGui;
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.JSONFormatter; import info.nightscout.androidaps.utils.JSONFormatter;
public class OpenAPSSMBFragment extends SubscriberFragment { public class OpenAPSSMBFragment extends SubscriberFragment {
@ -69,7 +67,6 @@ public class OpenAPSSMBFragment extends SubscriberFragment {
@OnClick(R.id.openapsma_run) @OnClick(R.id.openapsma_run)
public void onRunClick() { public void onRunClick() {
OpenAPSSMBPlugin.getPlugin().invoke("OpenAPSSMB button", false); OpenAPSSMBPlugin.getPlugin().invoke("OpenAPSSMB button", false);
FabricPrivacy.getInstance().logCustom(new CustomEvent("OpenAPS_SMB_Run"));
} }
@Subscribe @Subscribe

View file

@ -16,8 +16,6 @@ import android.widget.RadioButton;
import android.widget.ScrollView; import android.widget.ScrollView;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.CustomEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -26,8 +24,8 @@ import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import butterknife.Unbinder; import butterknife.Unbinder;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.activities.PreferencesActivity;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.activities.PreferencesActivity;
import info.nightscout.androidaps.events.EventConfigBuilderChange; import info.nightscout.androidaps.events.EventConfigBuilderChange;
import info.nightscout.androidaps.events.EventRefreshGui; import info.nightscout.androidaps.events.EventRefreshGui;
import info.nightscout.androidaps.interfaces.APSInterface; import info.nightscout.androidaps.interfaces.APSInterface;
@ -42,7 +40,6 @@ import info.nightscout.androidaps.interfaces.SensitivityInterface;
import info.nightscout.androidaps.plugins.common.SubscriberFragment; import info.nightscout.androidaps.plugins.common.SubscriberFragment;
import info.nightscout.androidaps.plugins.insulin.InsulinOrefRapidActingPlugin; import info.nightscout.androidaps.plugins.insulin.InsulinOrefRapidActingPlugin;
import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin; import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin;
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin; import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref0Plugin; import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref0Plugin;
import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.FabricPrivacy;
@ -276,7 +273,6 @@ public class ConfigBuilderFragment extends SubscriberFragment {
MainApp.bus().post(new EventRefreshGui()); MainApp.bus().post(new EventRefreshGui());
MainApp.bus().post(new EventConfigBuilderChange()); MainApp.bus().post(new EventConfigBuilderChange());
ConfigBuilderPlugin.getPlugin().logPluginStatus(); ConfigBuilderPlugin.getPlugin().logPluginStatus();
FabricPrivacy.getInstance().logCustom(new CustomEvent("ConfigurationChange"));
} }
public void cancel(){ public void cancel(){

View file

@ -1,9 +1,10 @@
package info.nightscout.androidaps.plugins.configBuilder; package info.nightscout.androidaps.plugins.configBuilder;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import com.crashlytics.android.answers.CustomEvent; import com.google.firebase.analytics.FirebaseAnalytics;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -129,12 +130,12 @@ public class ProfileFunctions {
} }
} }
if (activeTreatments.getProfileSwitchesFromHistory().size() > 0) { if (activeTreatments.getProfileSwitchesFromHistory().size() > 0) {
FabricPrivacy.getInstance().logCustom(new CustomEvent("CatchedError") Bundle bundle = new Bundle();
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION) bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "CatchedError");
.putCustomAttribute("version", BuildConfig.VERSION) bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, BuildConfig.BUILDVERSION);
.putCustomAttribute("time", time) bundle.putString(FirebaseAnalytics.Param.START_DATE, String.valueOf(time));
.putCustomAttribute("getProfileSwitchesFromHistory", activeTreatments.getProfileSwitchesFromHistory().toString()) bundle.putString(FirebaseAnalytics.Param.VALUE, activeTreatments.getProfileSwitchesFromHistory().toString());
); FabricPrivacy.getInstance().logCustom(bundle);
} }
log.error("getProfile at the end: returning null"); log.error("getProfile at the end: returning null");
return null; return null;
@ -157,7 +158,6 @@ public class ProfileFunctions {
public static void doProfileSwitch(final ProfileStore profileStore, final String profileName, final int duration, final int percentage, final int timeshift) { public static void doProfileSwitch(final ProfileStore profileStore, final String profileName, final int duration, final int percentage, final int timeshift) {
ProfileSwitch profileSwitch = prepareProfileSwitch(profileStore, profileName, duration, percentage, timeshift, System.currentTimeMillis()); ProfileSwitch profileSwitch = prepareProfileSwitch(profileStore, profileName, duration, percentage, timeshift, System.currentTimeMillis());
TreatmentsPlugin.getPlugin().addToHistoryProfileSwitch(profileSwitch); TreatmentsPlugin.getPlugin().addToHistoryProfileSwitch(profileSwitch);
FabricPrivacy.getInstance().logCustom(new CustomEvent("ProfileSwitch"));
} }
public static void doProfileSwitch(final int duration, final int percentage, final int timeshift) { public static void doProfileSwitch(final int duration, final int percentage, final int timeshift) {
@ -174,7 +174,6 @@ public class ProfileFunctions {
profileSwitch.timeshift = timeshift; profileSwitch.timeshift = timeshift;
profileSwitch.percentage = percentage; profileSwitch.percentage = percentage;
TreatmentsPlugin.getPlugin().addToHistoryProfileSwitch(profileSwitch); TreatmentsPlugin.getPlugin().addToHistoryProfileSwitch(profileSwitch);
FabricPrivacy.getInstance().logCustom(new CustomEvent("ProfileSwitch"));
} else { } else {
log.error("No profile switch existing"); log.error("No profile switch existing");
} }

View file

@ -12,7 +12,6 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import java.util.ArrayList; import java.util.ArrayList;
@ -21,9 +20,9 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.activities.HistoryBrowseActivity;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.activities.HistoryBrowseActivity;
import info.nightscout.androidaps.activities.TDDStatsActivity; import info.nightscout.androidaps.activities.TDDStatsActivity;
import info.nightscout.androidaps.db.ExtendedBolus; import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.db.TemporaryBasal;
@ -35,7 +34,6 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.common.SubscriberFragment; import info.nightscout.androidaps.plugins.common.SubscriberFragment;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions; import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.actions.ActionsPlugin;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction; import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction;
import info.nightscout.androidaps.plugins.general.actions.dialogs.FillDialog; import info.nightscout.androidaps.plugins.general.actions.dialogs.FillDialog;
import info.nightscout.androidaps.plugins.general.actions.dialogs.NewExtendedBolusDialog; import info.nightscout.androidaps.plugins.general.actions.dialogs.NewExtendedBolusDialog;
@ -70,7 +68,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
SingleClickButton tddStats; SingleClickButton tddStats;
SingleClickButton history; SingleClickButton history;
private Map<String,CustomAction> pumpCustomActions = new HashMap<>(); private Map<String, CustomAction> pumpCustomActions = new HashMap<>();
private List<SingleClickButton> pumpCustomButtons = new ArrayList<>(); private List<SingleClickButton> pumpCustomButtons = new ArrayList<>();
public ActionsFragment() { public ActionsFragment() {
@ -222,7 +220,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
View.OnClickListener pumpCustomActionsListener = v -> { View.OnClickListener pumpCustomActionsListener = v -> {
SingleClickButton btn = (SingleClickButton)v; SingleClickButton btn = (SingleClickButton) v;
CustomAction customAction = this.pumpCustomActions.get(btn.getText().toString()); CustomAction customAction = this.pumpCustomActions.get(btn.getText().toString());
@ -243,7 +241,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
List<CustomAction> customActions = activePump.getCustomActions(); List<CustomAction> customActions = activePump.getCustomActions();
if (customActions != null && customActions.size()>0) { if (customActions != null && customActions.size() > 0) {
LinearLayout ll = actionsFragmentView.findViewById(R.id.action_buttons_layout); LinearLayout ll = actionsFragmentView.findViewById(R.id.action_buttons_layout);
@ -275,7 +273,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
private void removePumpCustomActions() { private void removePumpCustomActions() {
if (pumpCustomActions.size()==0) if (pumpCustomActions.size() == 0)
return; return;
LinearLayout ll = actionsFragmentView.findViewById(R.id.action_buttons_layout); LinearLayout ll = actionsFragmentView.findViewById(R.id.action_buttons_layout);
@ -314,13 +312,11 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
case R.id.actions_extendedbolus_cancel: case R.id.actions_extendedbolus_cancel:
if (TreatmentsPlugin.getPlugin().isInHistoryExtendedBoluslInProgress()) { if (TreatmentsPlugin.getPlugin().isInHistoryExtendedBoluslInProgress()) {
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelExtended(null); ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelExtended(null);
FabricPrivacy.getInstance().logCustom(new CustomEvent("CancelExtended"));
} }
break; break;
case R.id.actions_canceltempbasal: case R.id.actions_canceltempbasal:
if (TreatmentsPlugin.getPlugin().isTempBasalInProgress()) { if (TreatmentsPlugin.getPlugin().isTempBasalInProgress()) {
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, null); ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, null);
FabricPrivacy.getInstance().logCustom(new CustomEvent("CancelTemp"));
} }
break; break;
case R.id.actions_settempbasal: case R.id.actions_settempbasal:

View file

@ -19,7 +19,6 @@ import android.widget.CheckBox;
import android.widget.EditText; import android.widget.EditText;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import com.crashlytics.android.answers.CustomEvent;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -35,11 +34,10 @@ import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.interfaces.Constraint;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.plugins.general.overview.Dialogs.ErrorHelperActivity; import info.nightscout.androidaps.plugins.general.overview.Dialogs.ErrorHelperActivity;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.utils.DecimalFormatter; import info.nightscout.androidaps.utils.DecimalFormatter;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.utils.NumberPicker; import info.nightscout.androidaps.utils.NumberPicker;
import info.nightscout.androidaps.utils.SP; import info.nightscout.androidaps.utils.SP;
import info.nightscout.androidaps.utils.SafeParse; import info.nightscout.androidaps.utils.SafeParse;
@ -190,7 +188,7 @@ public class FillDialog extends DialogFragment implements OnClickListener {
} }
if (pumpSiteChangeCheckbox.isChecked()) if (pumpSiteChangeCheckbox.isChecked())
confirmMessage.add("" + "<font color='" + MainApp.gc(R.color.actionsConfirm) + "'>" + MainApp.gs(R.string.record_pump_site_change) + "</font>"); confirmMessage.add("" + "<font color='" + MainApp.gc(R.color.actionsConfirm) + "'>" + MainApp.gs(R.string.record_pump_site_change) + "</font>");
if (insulinCartridgeChangeCheckbox.isChecked()) if (insulinCartridgeChangeCheckbox.isChecked())
confirmMessage.add("" + "<font color='" + MainApp.gc(R.color.actionsConfirm) + "'>" + MainApp.gs(R.string.record_insulin_cartridge_change) + "</font>"); confirmMessage.add("" + "<font color='" + MainApp.gc(R.color.actionsConfirm) + "'>" + MainApp.gs(R.string.record_insulin_cartridge_change) + "</font>");
@ -236,7 +234,6 @@ public class FillDialog extends DialogFragment implements OnClickListener {
} }
} }
}); });
FabricPrivacy.getInstance().logCustom(new CustomEvent("Fill"));
} }
if (pumpSiteChangeCheckbox.isChecked()) if (pumpSiteChangeCheckbox.isChecked())
NSUpload.uploadEvent(CareportalEvent.SITECHANGE, now(), notes); NSUpload.uploadEvent(CareportalEvent.SITECHANGE, now(), notes);

View file

@ -10,8 +10,6 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -23,7 +21,6 @@ import info.nightscout.androidaps.interfaces.Constraint;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.general.overview.Dialogs.ErrorHelperActivity; import info.nightscout.androidaps.plugins.general.overview.Dialogs.ErrorHelperActivity;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.NumberPicker; import info.nightscout.androidaps.utils.NumberPicker;
import info.nightscout.androidaps.utils.SafeParse; import info.nightscout.androidaps.utils.SafeParse;
@ -99,7 +96,6 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
} }
} }
}); });
FabricPrivacy.getInstance().logCustom(new CustomEvent("ExtendedBolus"));
} }
}); });
builder.setNegativeButton(MainApp.gs(R.string.cancel), null); builder.setNegativeButton(MainApp.gs(R.string.cancel), null);

View file

@ -12,8 +12,6 @@ import android.widget.LinearLayout;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.RadioGroup; import android.widget.RadioGroup;
import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -28,7 +26,6 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions; import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.overview.Dialogs.ErrorHelperActivity; import info.nightscout.androidaps.plugins.general.overview.Dialogs.ErrorHelperActivity;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.NumberPicker; import info.nightscout.androidaps.utils.NumberPicker;
import info.nightscout.androidaps.utils.SafeParse; import info.nightscout.androidaps.utils.SafeParse;
@ -167,7 +164,6 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
} else { } else {
ConfigBuilderPlugin.getPlugin().getCommandQueue().tempBasalAbsolute(finalBasal, finalDurationInMinutes, true, profile, callback); ConfigBuilderPlugin.getPlugin().getCommandQueue().tempBasalAbsolute(finalBasal, finalDurationInMinutes, true, profile, callback);
} }
FabricPrivacy.getInstance().logCustom(new CustomEvent("TempBasal"));
} }
}); });
builder.setNegativeButton(MainApp.gs(R.string.cancel), null); builder.setNegativeButton(MainApp.gs(R.string.cancel), null);

View file

@ -20,7 +20,6 @@ import android.widget.RadioButton;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.CustomEvent;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout; import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout;
@ -48,14 +47,13 @@ import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.ProfileSwitch; import info.nightscout.androidaps.db.ProfileSwitch;
import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TempTarget; import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.plugins.general.careportal.OptionsToShow;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions; import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.careportal.OptionsToShow;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload; import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.DefaultValueHelper; import info.nightscout.androidaps.utils.DefaultValueHelper;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.HardLimits; import info.nightscout.androidaps.utils.HardLimits;
import info.nightscout.androidaps.utils.JsonHelper; import info.nightscout.androidaps.utils.JsonHelper;
import info.nightscout.androidaps.utils.NumberPicker; import info.nightscout.androidaps.utils.NumberPicker;
@ -742,7 +740,6 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
tempTarget.low(0).high(0); tempTarget.low(0).high(0);
} }
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget); TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget);
FabricPrivacy.getInstance().logCustom(new CustomEvent("TempTarget"));
} }
} else { } else {
if (JsonHelper.safeGetString(data, "eventType").equals(CareportalEvent.PROFILESWITCH)) { if (JsonHelper.safeGetString(data, "eventType").equals(CareportalEvent.PROFILESWITCH)) {
@ -758,7 +755,6 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
} else { } else {
NSUpload.uploadCareportalEntryToNS(data); NSUpload.uploadCareportalEntryToNS(data);
} }
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSTreatment"));
} }
} }

View file

@ -17,7 +17,6 @@ import android.widget.CompoundButton;
import android.widget.ScrollView; import android.widget.ScrollView;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
@ -91,11 +90,11 @@ public class NSClientFragment extends SubscriberFragment implements View.OnClick
switch (view.getId()) { switch (view.getId()) {
case R.id.nsclientinternal_restart: case R.id.nsclientinternal_restart:
MainApp.bus().post(new EventNSClientRestart()); MainApp.bus().post(new EventNSClientRestart());
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientRestart")); FabricPrivacy.getInstance().logCustom("NSClientRestart");
break; break;
case R.id.nsclientinternal_delivernow: case R.id.nsclientinternal_delivernow:
NSClientPlugin.getPlugin().resend("GUI"); NSClientPlugin.getPlugin().resend("GUI");
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientDeliverNow")); FabricPrivacy.getInstance().logCustom("NSClientDeliverNow");
break; break;
case R.id.nsclientinternal_clearlog: case R.id.nsclientinternal_clearlog:
NSClientPlugin.getPlugin().clearLog(); NSClientPlugin.getPlugin().clearLog();
@ -110,7 +109,7 @@ public class NSClientFragment extends SubscriberFragment implements View.OnClick
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
UploadQueue.clearQueue(); UploadQueue.clearQueue();
updateGUI(); updateGUI();
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientClearQueue")); FabricPrivacy.getInstance().logCustom("NSClientClearQueue");
} }
}); });
builder.setNegativeButton(MainApp.gs(R.string.cancel), null); builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
@ -118,7 +117,6 @@ public class NSClientFragment extends SubscriberFragment implements View.OnClick
break; break;
case R.id.nsclientinternal_showqueue: case R.id.nsclientinternal_showqueue:
MainApp.bus().post(new EventNSClientNewLog("QUEUE", NSClientPlugin.getPlugin().queue().textList())); MainApp.bus().post(new EventNSClientNewLog("QUEUE", NSClientPlugin.getPlugin().queue().textList()));
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientShowQueue"));
break; break;
} }
} }
@ -129,7 +127,7 @@ public class NSClientFragment extends SubscriberFragment implements View.OnClick
case R.id.nsclientinternal_paused: case R.id.nsclientinternal_paused:
NSClientPlugin.getPlugin().pause(isChecked); NSClientPlugin.getPlugin().pause(isChecked);
updateGUI(); updateGUI();
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientPause")); FabricPrivacy.getInstance().logCustom("NSClientPause");
break; break;
case R.id.nsclientinternal_autoscroll: case R.id.nsclientinternal_autoscroll:
SP.putBoolean(R.string.key_nsclientinternal_autoscroll, isChecked); SP.putBoolean(R.string.key_nsclientinternal_autoscroll, isChecked);

View file

@ -11,8 +11,6 @@ import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -23,7 +21,6 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.GlucoseStatus; import info.nightscout.androidaps.data.GlucoseStatus;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions; import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.NumberPicker; import info.nightscout.androidaps.utils.NumberPicker;
import info.nightscout.androidaps.utils.SafeParse; import info.nightscout.androidaps.utils.SafeParse;
import info.nightscout.androidaps.utils.XdripCalibrations; import info.nightscout.androidaps.utils.XdripCalibrations;
@ -88,7 +85,6 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis
final Double bg = SafeParse.stringToDouble(bgNumber.getText()); final Double bg = SafeParse.stringToDouble(bgNumber.getText());
XdripCalibrations.confirmAndSendCalibration(bg, context); XdripCalibrations.confirmAndSendCalibration(bg, context);
dismiss(); dismiss();
FabricPrivacy.getInstance().logCustom(new CustomEvent("Calibration"));
break; break;
case R.id.cancel: case R.id.cancel:
dismiss(); dismiss();

View file

@ -20,7 +20,6 @@ import android.widget.CheckBox;
import android.widget.EditText; import android.widget.EditText;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import com.crashlytics.android.answers.CustomEvent;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -46,7 +45,6 @@ import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.DecimalFormatter; import info.nightscout.androidaps.utils.DecimalFormatter;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.NumberPicker; import info.nightscout.androidaps.utils.NumberPicker;
import info.nightscout.androidaps.utils.SP; import info.nightscout.androidaps.utils.SP;
import info.nightscout.androidaps.utils.SafeParse; import info.nightscout.androidaps.utils.SafeParse;
@ -170,8 +168,8 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener
insulinDialogState.putBoolean("recordOnlyCheckbox", recordOnlyCheckbox.isChecked()); insulinDialogState.putBoolean("recordOnlyCheckbox", recordOnlyCheckbox.isChecked());
insulinDialogState.putDouble("editTime", editTime.getValue()); insulinDialogState.putDouble("editTime", editTime.getValue());
insulinDialogState.putDouble("editInsulin", editInsulin.getValue()); insulinDialogState.putDouble("editInsulin", editInsulin.getValue());
insulinDialogState.putString("notesEdit",notesEdit.getText().toString()); insulinDialogState.putString("notesEdit", notesEdit.getText().toString());
log.debug("Instance state saved:"+insulinDialogState.toString()); log.debug("Instance state saved:" + insulinDialogState.toString());
super.onSaveInstanceState(insulinDialogState); super.onSaveInstanceState(insulinDialogState);
} }
@ -227,7 +225,7 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener
} }
} }
if (Math.abs(insulinAfterConstraints - insulin) > pump.getPumpDescription().pumpType.determineCorrectBolusSize(insulinAfterConstraints)) if (Math.abs(insulinAfterConstraints - insulin) > pump.getPumpDescription().pumpType.determineCorrectBolusSize(insulinAfterConstraints))
actions.add("<font color='" + MainApp.gc(R.color.warning) + "'>" + MainApp.gs(R.string.bolusconstraintapplied) + "</font>"); actions.add("<font color='" + MainApp.gc(R.color.warning) + "'>" + MainApp.gs(R.string.bolusconstraintapplied) + "</font>");
int eatingSoonTTDuration = SP.getInt(R.string.key_eatingsoon_duration, Constants.defaultEatingSoonTTDuration); int eatingSoonTTDuration = SP.getInt(R.string.key_eatingsoon_duration, Constants.defaultEatingSoonTTDuration);
@ -306,7 +304,6 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener
} }
} }
}); });
FabricPrivacy.getInstance().logCustom(new CustomEvent("Bolus"));
} }
} }
} }

View file

@ -17,8 +17,6 @@ import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.CheckBox; import android.widget.CheckBox;
import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -36,7 +34,6 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.utils.DecimalFormatter; import info.nightscout.androidaps.utils.DecimalFormatter;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.NumberPicker; import info.nightscout.androidaps.utils.NumberPicker;
import info.nightscout.androidaps.utils.SafeParse; import info.nightscout.androidaps.utils.SafeParse;
import info.nightscout.androidaps.utils.ToastUtils; import info.nightscout.androidaps.utils.ToastUtils;
@ -194,7 +191,6 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
} else { } else {
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false); TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false);
} }
FabricPrivacy.getInstance().logCustom(new CustomEvent("Bolus"));
} }
} }
} }

View file

@ -26,7 +26,6 @@ import android.widget.LinearLayout;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import org.json.JSONException; import org.json.JSONException;
@ -66,7 +65,6 @@ import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.utils.BolusWizard; import info.nightscout.androidaps.utils.BolusWizard;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.DecimalFormatter; import info.nightscout.androidaps.utils.DecimalFormatter;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.NumberPicker; import info.nightscout.androidaps.utils.NumberPicker;
import info.nightscout.androidaps.utils.SP; import info.nightscout.androidaps.utils.SP;
import info.nightscout.androidaps.utils.SafeParse; import info.nightscout.androidaps.utils.SafeParse;
@ -398,7 +396,6 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
} else { } else {
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false); TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false);
} }
FabricPrivacy.getInstance().logCustom(new CustomEvent("Wizard"));
} }
} }
} }

View file

@ -34,7 +34,6 @@ import android.widget.ImageButton;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.CustomEvent;
import com.jjoe64.graphview.GraphView; import com.jjoe64.graphview.GraphView;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -83,19 +82,14 @@ import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.interfaces.PumpDescription; import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.general.careportal.CareportalFragment;
import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog;
import info.nightscout.androidaps.plugins.general.careportal.OptionsToShow;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensData;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.CobInfo;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress;
import info.nightscout.androidaps.plugins.aps.loop.APSResult; import info.nightscout.androidaps.plugins.aps.loop.APSResult;
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin; import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotification; import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotification;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.careportal.CareportalFragment;
import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog;
import info.nightscout.androidaps.plugins.general.careportal.OptionsToShow;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload; import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus; import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus;
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus; import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus;
@ -109,18 +103,22 @@ import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizar
import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData; import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData;
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationRecyclerViewAdapter; import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationRecyclerViewAdapter;
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationStore; import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationStore;
import info.nightscout.androidaps.plugins.general.wear.ActionStringHandler;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensData;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.CobInfo;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress;
import info.nightscout.androidaps.plugins.source.SourceDexcomG5Plugin; import info.nightscout.androidaps.plugins.source.SourceDexcomG5Plugin;
import info.nightscout.androidaps.plugins.source.SourceDexcomG6Plugin; import info.nightscout.androidaps.plugins.source.SourceDexcomG6Plugin;
import info.nightscout.androidaps.plugins.source.SourceXdripPlugin; import info.nightscout.androidaps.plugins.source.SourceXdripPlugin;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.plugins.treatments.fragments.ProfileViewerDialog; import info.nightscout.androidaps.plugins.treatments.fragments.ProfileViewerDialog;
import info.nightscout.androidaps.plugins.general.wear.ActionStringHandler;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.utils.BolusWizard; import info.nightscout.androidaps.utils.BolusWizard;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.DecimalFormatter; import info.nightscout.androidaps.utils.DecimalFormatter;
import info.nightscout.androidaps.utils.DefaultValueHelper; import info.nightscout.androidaps.utils.DefaultValueHelper;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.OKDialog; import info.nightscout.androidaps.utils.OKDialog;
import info.nightscout.androidaps.utils.Profiler; import info.nightscout.androidaps.utils.Profiler;
import info.nightscout.androidaps.utils.SP; import info.nightscout.androidaps.utils.SP;
@ -268,15 +266,15 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sage = (TextView) view.findViewById(R.id.careportal_sensorage); sage = (TextView) view.findViewById(R.id.careportal_sensorage);
pbage = (TextView) view.findViewById(R.id.careportal_pbage); pbage = (TextView) view.findViewById(R.id.careportal_pbage);
iageView = (TextView) view.findViewById(R.id.overview_insulinage); iageView = (TextView) view.findViewById(R.id.overview_insulinage);
cageView = (TextView) view.findViewById(R.id.overview_canulaage); cageView = (TextView) view.findViewById(R.id.overview_canulaage);
reservoirView = (TextView) view.findViewById(R.id.overview_reservoirlevel); reservoirView = (TextView) view.findViewById(R.id.overview_reservoirlevel);
sageView = (TextView) view.findViewById(R.id.overview_sensorage); sageView = (TextView) view.findViewById(R.id.overview_sensorage);
batteryView = (TextView) view.findViewById(R.id.overview_batterylevel); batteryView = (TextView) view.findViewById(R.id.overview_batterylevel);
statuslightsLayout = (LinearLayout) view.findViewById(R.id.overview_statuslights); statuslightsLayout = (LinearLayout) view.findViewById(R.id.overview_statuslights);
bgGraph = (GraphView) view.findViewById(R.id.overview_bggraph); bgGraph = (GraphView) view.findViewById(R.id.overview_bggraph);
iobGraph = (GraphView) view.findViewById(R.id.overview_iobgraph); iobGraph = (GraphView) view.findViewById(R.id.overview_iobgraph);
treatmentButton = (SingleClickButton) view.findViewById(R.id.overview_treatmentbutton); treatmentButton = (SingleClickButton) view.findViewById(R.id.overview_treatmentbutton);
treatmentButton.setOnClickListener(this); treatmentButton.setOnClickListener(this);
@ -475,7 +473,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
menu.add(MainApp.gs(R.string.suspendloopfor2h)); menu.add(MainApp.gs(R.string.suspendloopfor2h));
menu.add(MainApp.gs(R.string.suspendloopfor3h)); menu.add(MainApp.gs(R.string.suspendloopfor3h));
menu.add(MainApp.gs(R.string.suspendloopfor10h)); menu.add(MainApp.gs(R.string.suspendloopfor10h));
} else { } else {
if (!loopPlugin.isDisconnected()) { if (!loopPlugin.isDisconnected()) {
menu.add(MainApp.gs(R.string.resume)); menu.add(MainApp.gs(R.string.resume));
} }
@ -488,7 +486,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
if (!loopPlugin.isDisconnected()) { if (!loopPlugin.isDisconnected()) {
showSuspendtPump(menu, pumpDescription); showSuspendtPump(menu, pumpDescription);
} else { } else {
menu.add(MainApp.gs(R.string.reconnect)); menu.add(MainApp.gs(R.string.reconnect));
} }
@ -892,7 +890,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
} else { } else {
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false); TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false);
} }
FabricPrivacy.getInstance().logCustom(new CustomEvent("QuickWizard"));
} }
} }
}); });

View file

@ -5,8 +5,6 @@ import android.os.PowerManager;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.v4.util.LongSparseArray; import android.support.v4.util.LongSparseArray;
import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -16,7 +14,6 @@ import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.List; import java.util.List;
import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
@ -26,13 +23,13 @@ import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.TempTarget; import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.events.Event; import info.nightscout.androidaps.events.Event;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.aps.openAPSSMB.SMBDefaults;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions; import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress;
import info.nightscout.androidaps.plugins.aps.openAPSSMB.SMBDefaults;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification; import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress;
import info.nightscout.androidaps.plugins.treatments.Treatment; import info.nightscout.androidaps.plugins.treatments.Treatment;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
@ -224,13 +221,6 @@ public class IobCobOref1Thread extends Thread {
} catch (Exception e) { } catch (Exception e) {
log.error("Unhandled exception", e); log.error("Unhandled exception", e);
FabricPrivacy.logException(e); FabricPrivacy.logException(e);
FabricPrivacy.getInstance().logCustom(new CustomEvent("CatchedError")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION)
.putCustomAttribute("autosensDataTable", iobCobCalculatorPlugin.getAutosensDataTable().toString())
.putCustomAttribute("for_data", ">>>>> bucketed_data.size()=" + bucketed_data.size() + " i=" + i + "hourAgoData=" + hourAgoData.toString())
.putCustomAttribute("past", past)
);
log.debug(autosensDataTable.toString()); log.debug(autosensDataTable.toString());
log.debug(bucketed_data.toString()); log.debug(bucketed_data.toString());
log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString()); log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString());

View file

@ -5,8 +5,6 @@ import android.os.PowerManager;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.v4.util.LongSparseArray; import android.support.v4.util.LongSparseArray;
import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -14,7 +12,6 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
@ -24,13 +21,13 @@ import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.events.Event; import info.nightscout.androidaps.events.Event;
import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.aps.openAPSSMB.SMBDefaults;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions; import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress;
import info.nightscout.androidaps.plugins.aps.openAPSSMB.SMBDefaults;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification; import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin; import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin; import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin;
import info.nightscout.androidaps.plugins.treatments.Treatment; import info.nightscout.androidaps.plugins.treatments.Treatment;
@ -223,13 +220,6 @@ public class IobCobThread extends Thread {
} catch (Exception e) { } catch (Exception e) {
log.error("Unhandled exception", e); log.error("Unhandled exception", e);
FabricPrivacy.logException(e); FabricPrivacy.logException(e);
FabricPrivacy.getInstance().logCustom(new CustomEvent("CatchedError")
.putCustomAttribute("buildversion", BuildConfig.BUILDVERSION)
.putCustomAttribute("version", BuildConfig.VERSION)
.putCustomAttribute("autosensDataTable", iobCobCalculatorPlugin.getAutosensDataTable().toString())
.putCustomAttribute("for_data", ">>>>> bucketed_data.size()=" + bucketed_data.size() + " i=" + i + "hourAgoData=" + hourAgoData.toString())
.putCustomAttribute("past", past)
);
log.debug(autosensDataTable.toString()); log.debug(autosensDataTable.toString());
log.debug(bucketed_data.toString()); log.debug(bucketed_data.toString());
log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString()); log.debug(IobCobCalculatorPlugin.getPlugin().getBgReadings().toString());

View file

@ -1,9 +1,10 @@
package info.nightscout.androidaps.plugins.treatments; package info.nightscout.androidaps.plugins.treatments;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import com.crashlytics.android.answers.CustomEvent; import com.google.firebase.analytics.FirebaseAnalytics;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -41,16 +42,16 @@ import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions; import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensData; import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
import info.nightscout.androidaps.plugins.general.overview.Dialogs.ErrorHelperActivity; import info.nightscout.androidaps.plugins.general.overview.Dialogs.ErrorHelperActivity;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification; import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensData;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin; import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin; import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.utils.SP; import info.nightscout.androidaps.utils.SP;
import info.nightscout.androidaps.utils.T; import info.nightscout.androidaps.utils.T;
@ -184,7 +185,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
InsulinInterface insulinInterface = ConfigBuilderPlugin.getPlugin().getActiveInsulin(); InsulinInterface insulinInterface = ConfigBuilderPlugin.getPlugin().getActiveInsulin();
if (insulinInterface == null) if (insulinInterface == null)
return total; return total;
double dia = profile.getDia(); double dia = profile.getDia();
@ -259,7 +260,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
if (t > absorptionTime_ago && t <= now) { if (t > absorptionTime_ago && t <= now) {
if (treatment.carbs >= 1) { if (treatment.carbs >= 1) {
result.carbs += treatment.carbs; result.carbs += treatment.carbs;
if(t > result.lastCarbTime) if (t > result.lastCarbTime)
result.lastCarbTime = t; result.lastCarbTime = t;
} }
} }
@ -312,7 +313,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
} }
} }
if (L.isEnabled(L.DATATREATMENTS)) if (L.isEnabled(L.DATATREATMENTS))
log.debug("Last bolus time: " + new Date(last).toLocaleString()); log.debug("Last bolus time: " + new Date(last).toLocaleString());
return last; return last;
} }
@ -341,7 +342,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
@Subscribe @Subscribe
public void onStatusEvent(final EventReloadTreatmentData ev) { public void onStatusEvent(final EventReloadTreatmentData ev) {
if (L.isEnabled(L.DATATREATMENTS)) if (L.isEnabled(L.DATATREATMENTS))
log.debug("EventReloadTreatmentData"); log.debug("EventReloadTreatmentData");
initializeTreatmentData(); initializeTreatmentData();
initializeExtendedBolusData(); initializeExtendedBolusData();
updateTotalIOBTreatments(); updateTotalIOBTreatments();
@ -352,7 +353,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
@SuppressWarnings("unused") @SuppressWarnings("unused")
public void onStatusEvent(final EventReloadTempBasalData ev) { public void onStatusEvent(final EventReloadTempBasalData ev) {
if (L.isEnabled(L.DATATREATMENTS)) if (L.isEnabled(L.DATATREATMENTS))
log.debug("EventReloadTempBasalData"); log.debug("EventReloadTempBasalData");
initializeTempBasalData(); initializeTempBasalData();
updateTotalIOBTempBasals(); updateTotalIOBTempBasals();
} }
@ -372,14 +373,14 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
InsulinInterface insulinInterface = ConfigBuilderPlugin.getPlugin().getActiveInsulin(); InsulinInterface insulinInterface = ConfigBuilderPlugin.getPlugin().getActiveInsulin();
if (insulinInterface == null) if (insulinInterface == null)
return total; return total;
synchronized (tempBasals) { synchronized (tempBasals) {
for (Integer pos = 0; pos < tempBasals.size(); pos++) { for (Integer pos = 0; pos < tempBasals.size(); pos++) {
TemporaryBasal t = tempBasals.get(pos); TemporaryBasal t = tempBasals.get(pos);
if (t.date > time) continue; if (t.date > time) continue;
IobTotal calc; IobTotal calc;
if(truncate && t.end() > truncateTime){ if (truncate && t.end() > truncateTime) {
TemporaryBasal dummyTemp = new TemporaryBasal(); TemporaryBasal dummyTemp = new TemporaryBasal();
dummyTemp.copyFrom(t); dummyTemp.copyFrom(t);
dummyTemp.cutEndTo(truncateTime); dummyTemp.cutEndTo(truncateTime);
@ -398,7 +399,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
ExtendedBolus e = extendedBoluses.get(pos); ExtendedBolus e = extendedBoluses.get(pos);
if (e.date > time) continue; if (e.date > time) continue;
IobTotal calc; IobTotal calc;
if(truncate && e.end() > truncateTime){ if (truncate && e.end() > truncateTime) {
ExtendedBolus dummyExt = new ExtendedBolus(); ExtendedBolus dummyExt = new ExtendedBolus();
dummyExt.copyFrom(e); dummyExt.copyFrom(e);
dummyExt.cutEndTo(truncateTime); dummyExt.cutEndTo(truncateTime);
@ -535,9 +536,10 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MainApp.instance().startActivity(i); MainApp.instance().startActivity(i);
CustomEvent customEvent = new CustomEvent("TreatmentClash"); Bundle bundle = new Bundle();
customEvent.putCustomAttribute("status", status); bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "TreatmentClash");
FabricPrivacy.getInstance().logCustom(customEvent); bundle.putString(FirebaseAnalytics.Param.VALUE, status);
FabricPrivacy.getInstance().logCustom(bundle);
} }
return newRecordCreated; return newRecordCreated;

View file

@ -18,7 +18,6 @@ import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import java.util.List; import java.util.List;
@ -40,7 +39,6 @@ import info.nightscout.androidaps.plugins.treatments.dialogs.WizardInfoDialog;
import info.nightscout.androidaps.services.Intents; import info.nightscout.androidaps.services.Intents;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.DecimalFormatter; import info.nightscout.androidaps.utils.DecimalFormatter;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.SP; import info.nightscout.androidaps.utils.SP;
import static info.nightscout.androidaps.utils.DateUtil.now; import static info.nightscout.androidaps.utils.DateUtil.now;
@ -165,7 +163,6 @@ public class TreatmentsBolusFragment extends SubscriberFragment implements View.
TreatmentsPlugin.getPlugin().getService().delete(treatment); TreatmentsPlugin.getPlugin().getService().delete(treatment);
} }
updateGUI(); updateGUI();
FabricPrivacy.getInstance().logCustom(new CustomEvent("RemoveTreatment"));
} }
}); });
builder.setNegativeButton(MainApp.gs(R.string.cancel), null); builder.setNegativeButton(MainApp.gs(R.string.cancel), null);

View file

@ -15,7 +15,6 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
@ -32,7 +31,6 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutos
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.DecimalFormatter; import info.nightscout.androidaps.utils.DecimalFormatter;
import info.nightscout.androidaps.utils.FabricPrivacy;
public class TreatmentsExtendedBolusesFragment extends SubscriberFragment { public class TreatmentsExtendedBolusesFragment extends SubscriberFragment {
@ -150,7 +148,6 @@ public class TreatmentsExtendedBolusesFragment extends SubscriberFragment {
UploadQueue.removeID("dbAdd", _id); UploadQueue.removeID("dbAdd", _id);
} }
MainApp.getDbHelper().delete(extendedBolus); MainApp.getDbHelper().delete(extendedBolus);
FabricPrivacy.getInstance().logCustom(new CustomEvent("RemoveExtendedBolus"));
} }
}); });
builder.setNegativeButton(MainApp.gs(R.string.cancel), null); builder.setNegativeButton(MainApp.gs(R.string.cancel), null);

View file

@ -15,7 +15,6 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
@ -34,7 +33,6 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutos
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.DecimalFormatter; import info.nightscout.androidaps.utils.DecimalFormatter;
import info.nightscout.androidaps.utils.FabricPrivacy;
public class TreatmentsTemporaryBasalsFragment extends SubscriberFragment { public class TreatmentsTemporaryBasalsFragment extends SubscriberFragment {
@ -175,7 +173,6 @@ public class TreatmentsTemporaryBasalsFragment extends SubscriberFragment {
UploadQueue.removeID("dbAdd", _id); UploadQueue.removeID("dbAdd", _id);
} }
MainApp.getDbHelper().delete(tempBasal); MainApp.getDbHelper().delete(tempBasal);
FabricPrivacy.getInstance().logCustom(new CustomEvent("RemoveTempBasal"));
}); });
builder.setNegativeButton(MainApp.gs(R.string.cancel), null); builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
builder.show(); builder.show();

View file

@ -7,8 +7,6 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.PowerManager; import android.os.PowerManager;
import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -52,7 +50,6 @@ public class KeepAliveReceiver extends BroadcastReceiver {
LocalAlertUtils.shortenSnoozeInterval(); LocalAlertUtils.shortenSnoozeInterval();
LocalAlertUtils.checkStaleBGAlert(); LocalAlertUtils.checkStaleBGAlert();
checkPump(); checkPump();
FabricPrivacy.uploadDailyStats();
if (L.isEnabled(L.CORE)) if (L.isEnabled(L.CORE))
log.debug("KeepAlive received"); log.debug("KeepAlive received");
@ -87,7 +84,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
} }
if (lastRun != 0 && System.currentTimeMillis() - lastRun > T.mins(10).msecs()) { if (lastRun != 0 && System.currentTimeMillis() - lastRun > T.mins(10).msecs()) {
log.error("KeepAlive fail"); log.error("KeepAlive fail");
FabricPrivacy.getInstance().logCustom(new CustomEvent("KeepAliveFail")); FabricPrivacy.getInstance().logCustom("KeepAliveFail");
} }
lastRun = System.currentTimeMillis(); lastRun = System.currentTimeMillis();
} }

View file

@ -1,16 +1,17 @@
package info.nightscout.androidaps.utils; package info.nightscout.androidaps.utils;
import android.os.Bundle;
import com.crashlytics.android.Crashlytics; import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers; import com.google.firebase.analytics.FirebaseAnalytics;
import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.BuildConfig; import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import java.util.Date;
/** /**
* Created by jamorham on 21/02/2018. * Created by jamorham on 21/02/2018.
@ -21,8 +22,8 @@ import java.util.Date;
*/ */
public class FabricPrivacy { public class FabricPrivacy {
private static Logger log = LoggerFactory.getLogger(L.CORE);
private static final String TAG = "FabricPrivacy";
private static volatile FabricPrivacy instance; private static volatile FabricPrivacy instance;
@ -45,7 +46,8 @@ public class FabricPrivacy {
final Crashlytics crashlytics = Crashlytics.getInstance(); final Crashlytics crashlytics = Crashlytics.getInstance();
crashlytics.core.logException(throwable); crashlytics.core.logException(throwable);
} catch (NullPointerException | IllegalStateException e) { } catch (NullPointerException | IllegalStateException e) {
android.util.Log.d(TAG, "Ignoring opted out non-initialized log: " + throwable); if (L.isEnabled(L.CORE))
log.debug("Ignoring opted out non-initialized log: " + throwable);
} }
} }
@ -55,7 +57,8 @@ public class FabricPrivacy {
final Crashlytics crashlytics = Crashlytics.getInstance(); final Crashlytics crashlytics = Crashlytics.getInstance();
crashlytics.core.log(msg); crashlytics.core.log(msg);
} catch (NullPointerException | IllegalStateException e) { } catch (NullPointerException | IllegalStateException e) {
android.util.Log.d(TAG, "Ignoring opted out non-initialized log: " + msg); if (L.isEnabled(L.CORE))
log.debug("Ignoring opted out non-initialized log: " + msg);
} }
} }
@ -65,7 +68,8 @@ public class FabricPrivacy {
final Crashlytics crashlytics = Crashlytics.getInstance(); final Crashlytics crashlytics = Crashlytics.getInstance();
crashlytics.core.log(priority, tag, msg); crashlytics.core.log(priority, tag, msg);
} catch (NullPointerException | IllegalStateException e) { } catch (NullPointerException | IllegalStateException e) {
android.util.Log.d(TAG, "Ignoring opted out non-initialized log: " + msg); if (L.isEnabled(L.CORE))
log.debug("Ignoring opted out non-initialized log: " + msg);
} }
} }
@ -73,68 +77,58 @@ public class FabricPrivacy {
return SP.getBoolean("enable_fabric", true); return SP.getBoolean("enable_fabric", true);
} }
// Answers logCustom // Analytics logCustom
public void logCustom(CustomEvent event) { public void logCustom(Bundle event) {
try { try {
final Answers answers = Answers.getInstance();
if (fabricEnabled()) { if (fabricEnabled()) {
answers.logCustom(event); MainApp.getFirebaseAnalytics().logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, event);
} else { } else {
android.util.Log.d(TAG, "Ignoring recently opted-out event: " + event.toString()); if (L.isEnabled(L.CORE))
log.debug("Ignoring recently opted-out event: " + event.toString());
} }
} catch (NullPointerException | IllegalStateException e) { } catch (NullPointerException | IllegalStateException e) {
android.util.Log.d(TAG, "Ignoring opted-out non-initialized event: " + event.toString()); if (L.isEnabled(L.CORE))
log.debug("Ignoring opted-out non-initialized event: " + event.toString());
} }
} }
public static void uploadDailyStats() { // Analytics logCustom
public void logCustom(String event) {
try {
if (fabricEnabled()) {
MainApp.getFirebaseAnalytics().logEvent(event, new Bundle());
} else {
if (L.isEnabled(L.CORE))
log.debug("Ignoring recently opted-out event: " + event);
}
} catch (NullPointerException | IllegalStateException e) {
if (L.isEnabled(L.CORE))
log.debug("Ignoring opted-out non-initialized event: " + event);
}
}
public static void setUserStats() {
if (!fabricEnabled()) return; if (!fabricEnabled()) return;
long lastUploadDay = SP.getLong(MainApp.gs(R.string.key_plugin_stats_report_timestamp), 0L); String closedLoopEnabled = MainApp.getConstraintChecker().isClosedLoopAllowed().value() ? "CLOSED_LOOP_ENABLED" : "CLOSED_LOOP_DISABLED";
Date date = new Date(); MainApp.getFirebaseAnalytics().setUserProperty("Mode", BuildConfig.APPLICATION_ID + "-" + closedLoopEnabled);
date.setHours(0); MainApp.getFirebaseAnalytics().setUserProperty("Language", LocaleHelper.getLanguage(MainApp.instance()));
date.setMinutes(0); MainApp.getFirebaseAnalytics().setUserProperty("Version", BuildConfig.VERSION);
date.setSeconds(0); MainApp.getFirebaseAnalytics().setUserProperty("HEAD", BuildConfig.HEAD);
long today = date.getTime() - date.getTime() % 1000; if (ConfigBuilderPlugin.getPlugin().getActivePump() != null)
MainApp.getFirebaseAnalytics().setUserProperty("Pump", ConfigBuilderPlugin.getPlugin().getActivePump().getClass().getSimpleName());
if (ConfigBuilderPlugin.getPlugin().getActiveAPS() != null)
MainApp.getFirebaseAnalytics().setUserProperty("Aps", ConfigBuilderPlugin.getPlugin().getActiveAPS().getClass().getSimpleName());
if (ConfigBuilderPlugin.getPlugin().getActiveBgSource() != null)
MainApp.getFirebaseAnalytics().setUserProperty("BgSource", ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().getSimpleName());
if (ConfigBuilderPlugin.getPlugin().getActiveProfileInterface() != null)
MainApp.getFirebaseAnalytics().setUserProperty("Profile", ConfigBuilderPlugin.getPlugin().getActiveProfileInterface().getClass().getSimpleName());
if (ConfigBuilderPlugin.getPlugin().getActiveSensitivity() != null)
MainApp.getFirebaseAnalytics().setUserProperty("Sensitivity", ConfigBuilderPlugin.getPlugin().getActiveSensitivity().getClass().getSimpleName());
if (ConfigBuilderPlugin.getPlugin().getActiveInsulin() != null)
MainApp.getFirebaseAnalytics().setUserProperty("Insulin", ConfigBuilderPlugin.getPlugin().getActiveInsulin().getClass().getSimpleName());
if (today > lastUploadDay) {
uploadAppUsageType();
uploadPluginStats();
SP.putLong(MainApp.gs(R.string.key_plugin_stats_report_timestamp), today);
}
}
private static void uploadPluginStats() {
CustomEvent pluginStats = new CustomEvent("PluginStats");
pluginStats.putCustomAttribute("version", BuildConfig.VERSION);
pluginStats.putCustomAttribute("HEAD", BuildConfig.HEAD);
pluginStats.putCustomAttribute("language", SP.getString(R.string.key_language,"default"));
for (PluginBase plugin : MainApp.getPluginsList()) {
if (plugin.isEnabled(plugin.getType()) && !plugin.pluginDescription.alwaysEnabled) {
// Fabric allows no more than 20 attributes attached to an event. By reporting disabled plugins as
// well, we would exceed that threshold, so only report what is enabled
// TODO >2.0: consider reworking this to upload an event per enabled plugin instead.
pluginStats.putCustomAttribute(plugin.getClass().getSimpleName(), "enabled");
}
}
getInstance().logCustom(pluginStats);
}
private static void uploadAppUsageType() {
CustomEvent type = new CustomEvent("AppUsageType");
if (Config.NSCLIENT)
type.putCustomAttribute("type", "NSClient");
else if (Config.PUMPCONTROL)
type.putCustomAttribute("type", "PumpControl");
else if (MainApp.getConstraintChecker().isClosedLoopAllowed().value())
type.putCustomAttribute("type", "ClosedLoop");
else
type.putCustomAttribute("type", "OpenLoop");
getInstance().logCustom(type);
} }
} }

View file

@ -1216,7 +1216,6 @@
<string name="error_adding_treatment_message">A treatment (insulin: %1$.2f, carbs: %2$d, at: %3$s) could not be added to treatments. Please check and manually add a record as appropriate.</string> <string name="error_adding_treatment_message">A treatment (insulin: %1$.2f, carbs: %2$d, at: %3$s) could not be added to treatments. Please check and manually add a record as appropriate.</string>
<string name="generated_ecarbs_note">eCarbs: %1$d g (%2$d h), delay: %3$d m</string> <string name="generated_ecarbs_note">eCarbs: %1$d g (%2$d h), delay: %3$d m</string>
<string name="key_plugin_stats_report_timestamp" translatable="false">key_plugin_stats_report_timestamp</string>
<string name="openaps_noasdata">No autosens data available</string> <string name="openaps_noasdata">No autosens data available</string>
<string name="nav_logsettings">Log settings</string> <string name="nav_logsettings">Log settings</string>
<string name="resettodefaults">Reset to defaults</string> <string name="resettodefaults">Reset to defaults</string>