Merge pull request #709 from jamorham/dev

Add Fabric Privacy option
This commit is contained in:
Milos Kozak 2018-02-23 07:30:46 +01:00 committed by GitHub
commit 9d3c69e1b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 230 additions and 125 deletions

View file

@ -72,6 +72,7 @@ import info.nightscout.androidaps.plugins.XDripStatusline.StatuslinePlugin;
import info.nightscout.androidaps.receivers.DataReceiver; import info.nightscout.androidaps.receivers.DataReceiver;
import info.nightscout.androidaps.receivers.KeepAliveReceiver; import info.nightscout.androidaps.receivers.KeepAliveReceiver;
import info.nightscout.androidaps.receivers.NSAlarmReceiver; import info.nightscout.androidaps.receivers.NSAlarmReceiver;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload; import info.nightscout.utils.NSUpload;
import io.fabric.sdk.android.Fabric; import io.fabric.sdk.android.Fabric;
@ -97,18 +98,26 @@ public class MainApp extends Application {
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
Fabric.with(this, new Crashlytics()); sInstance = this;
Fabric.with(this, new Answers()); sResources = getResources();
try {
if (FabricPrivacy.fabricEnabled()) {
Fabric.with(this, new Crashlytics());
Fabric.with(this, new Answers());
Crashlytics.setString("BUILDVERSION", BuildConfig.BUILDVERSION);
}
} catch (Exception e) {
android.util.Log.e("ANDROIDAPS", "Error with Fabric init! " + e);
}
JodaTimeAndroid.init(this); JodaTimeAndroid.init(this);
Crashlytics.setString("BUILDVERSION", BuildConfig.BUILDVERSION);
log.info("Version: " + BuildConfig.VERSION_NAME); log.info("Version: " + BuildConfig.VERSION_NAME);
log.info("BuildVersion: " + BuildConfig.BUILDVERSION); log.info("BuildVersion: " + BuildConfig.BUILDVERSION);
sBus = Config.logEvents ? new LoggingBus(ThreadEnforcer.ANY) : new Bus(ThreadEnforcer.ANY); sBus = Config.logEvents ? new LoggingBus(ThreadEnforcer.ANY) : new Bus(ThreadEnforcer.ANY);
sInstance = this;
sResources = getResources();
registerLocalBroadcastReceiver(); registerLocalBroadcastReceiver();
if (pluginsList == null) { if (pluginsList == null) {
@ -167,15 +176,15 @@ public class MainApp extends Application {
} }
NSUpload.uploadAppStart(); NSUpload.uploadAppStart();
if (Config.NSCLIENT) if (Config.NSCLIENT)
Answers.getInstance().logCustom(new CustomEvent("AppStart-NSClient")); FabricPrivacy.getInstance().logCustom(new CustomEvent("AppStart-NSClient"));
else if (Config.G5UPLOADER) else if (Config.G5UPLOADER)
Answers.getInstance().logCustom(new CustomEvent("AppStart-G5Uploader")); FabricPrivacy.getInstance().logCustom(new CustomEvent("AppStart-G5Uploader"));
else if (Config.PUMPCONTROL) else if (Config.PUMPCONTROL)
Answers.getInstance().logCustom(new CustomEvent("AppStart-PumpControl")); FabricPrivacy.getInstance().logCustom(new CustomEvent("AppStart-PumpControl"));
else if (MainApp.getConfigBuilder().isClosedModeEnabled()) else if (MainApp.getConfigBuilder().isClosedModeEnabled())
Answers.getInstance().logCustom(new CustomEvent("AppStart-ClosedLoop")); FabricPrivacy.getInstance().logCustom(new CustomEvent("AppStart-ClosedLoop"));
else else
Answers.getInstance().logCustom(new CustomEvent("AppStart-OpenLoop")); FabricPrivacy.getInstance().logCustom(new CustomEvent("AppStart-OpenLoop"));
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.data;
import android.support.v4.util.LongSparseArray; import android.support.v4.util.LongSparseArray;
import com.crashlytics.android.Crashlytics;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
@ -25,6 +25,7 @@ import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.ToastUtils; import info.nightscout.utils.ToastUtils;
public class Profile { public class Profile {
@ -57,7 +58,7 @@ public class Profile {
if (units != null) if (units != null)
this.units = units; this.units = units;
else { else {
Crashlytics.log("Profile failover failed too"); FabricPrivacy.log("Profile failover failed too");
this.units = Constants.MGDL; this.units = Constants.MGDL;
} }
} }

View file

@ -9,8 +9,7 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -32,6 +31,7 @@ import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialo
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow; import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
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.utils.FabricPrivacy;
import info.nightscout.utils.SingleClickButton; import info.nightscout.utils.SingleClickButton;
/** /**
@ -83,7 +83,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
updateGUI(); updateGUI();
return view; return view;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
return null; return null;
@ -203,13 +203,13 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
case R.id.actions_extendedbolus_cancel: case R.id.actions_extendedbolus_cancel:
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) { if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) {
ConfigBuilderPlugin.getCommandQueue().cancelExtended(null); ConfigBuilderPlugin.getCommandQueue().cancelExtended(null);
Answers.getInstance().logCustom(new CustomEvent("CancelExtended")); FabricPrivacy.getInstance().logCustom(new CustomEvent("CancelExtended"));
} }
break; break;
case R.id.actions_canceltempbasal: case R.id.actions_canceltempbasal:
if (MainApp.getConfigBuilder().isTempBasalInProgress()) { if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
ConfigBuilderPlugin.getCommandQueue().cancelTempBasal(true, null); ConfigBuilderPlugin.getCommandQueue().cancelTempBasal(true, null);
Answers.getInstance().logCustom(new CustomEvent("CancelTemp")); FabricPrivacy.getInstance().logCustom(new CustomEvent("CancelTemp"));
} }
break; break;
case R.id.actions_settempbasal: case R.id.actions_settempbasal:

View file

@ -14,7 +14,6 @@ import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.Button; import android.widget.Button;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -31,6 +30,7 @@ import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity; import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NumberPicker; import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SP; import info.nightscout.utils.SP;
import info.nightscout.utils.SafeParse; import info.nightscout.utils.SafeParse;
@ -171,7 +171,7 @@ public class FillDialog extends DialogFragment implements OnClickListener {
} }
} }
}); });
Answers.getInstance().logCustom(new CustomEvent("Fill")); FabricPrivacy.getInstance().logCustom(new CustomEvent("Fill"));
} }
} }
}); });

View file

@ -10,7 +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.Answers;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -24,6 +23,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity; import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NumberPicker; import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SafeParse; import info.nightscout.utils.SafeParse;
@ -99,7 +99,7 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
} }
} }
}); });
Answers.getInstance().logCustom(new CustomEvent("ExtendedBolus")); FabricPrivacy.getInstance().logCustom(new CustomEvent("ExtendedBolus"));
} }
}); });
builder.setNegativeButton(getString(R.string.cancel), null); builder.setNegativeButton(getString(R.string.cancel), null);

View file

@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.Actions.dialogs; package info.nightscout.androidaps.plugins.Actions.dialogs;
import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
@ -13,7 +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.Answers;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -28,6 +26,7 @@ import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity; import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NumberPicker; import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SafeParse; import info.nightscout.utils.SafeParse;
@ -162,7 +161,7 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
} else { } else {
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(finalBasal, finalDurationInMinutes, true, callback); ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(finalBasal, finalDurationInMinutes, true, callback);
} }
Answers.getInstance().logCustom(new CustomEvent("TempBasal")); FabricPrivacy.getInstance().logCustom(new CustomEvent("TempBasal"));
} }
}); });
builder.setNegativeButton(getString(R.string.cancel), null); builder.setNegativeButton(getString(R.string.cancel), null);

View file

@ -10,7 +10,6 @@ import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import info.nightscout.androidaps.BuildConfig; import info.nightscout.androidaps.BuildConfig;
@ -24,6 +23,7 @@ import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialo
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.Overview.OverviewFragment; import info.nightscout.androidaps.plugins.Overview.OverviewFragment;
import info.nightscout.utils.FabricPrivacy;
public class CareportalFragment extends SubscriberFragment implements View.OnClickListener { public class CareportalFragment extends SubscriberFragment implements View.OnClickListener {
@ -111,7 +111,7 @@ public class CareportalFragment extends SubscriberFragment implements View.OnCli
updateGUI(); updateGUI();
return view; return view;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
return null; return null;

View file

@ -23,7 +23,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.Answers;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout; import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout;
@ -56,6 +55,7 @@ import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity; import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.NSUpload; import info.nightscout.utils.NSUpload;
import info.nightscout.utils.NumberPicker; import info.nightscout.utils.NumberPicker;
@ -699,14 +699,14 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
log.debug("Creating new TempTarget db record: " + tempTarget.toString()); log.debug("Creating new TempTarget db record: " + tempTarget.toString());
MainApp.getDbHelper().createOrUpdate(tempTarget); MainApp.getDbHelper().createOrUpdate(tempTarget);
NSUpload.uploadCareportalEntryToNS(data); NSUpload.uploadCareportalEntryToNS(data);
Answers.getInstance().logCustom(new CustomEvent("TempTarget")); FabricPrivacy.getInstance().logCustom(new CustomEvent("TempTarget"));
} }
} catch (JSONException e) { } catch (JSONException e) {
log.error("Unhandled exception", e); log.error("Unhandled exception", e);
} }
} else { } else {
NSUpload.uploadCareportalEntryToNS(data); NSUpload.uploadCareportalEntryToNS(data);
Answers.getInstance().logCustom(new CustomEvent("NSTreatment")); FabricPrivacy.getInstance().logCustom(new CustomEvent("NSTreatment"));
} }
} }
}); });
@ -741,7 +741,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
MainApp.bus().post(new EventNewBasalProfile()); MainApp.bus().post(new EventNewBasalProfile());
} }
}); });
Answers.getInstance().logCustom(new CustomEvent("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) {
@ -773,7 +773,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
MainApp.bus().post(new EventNewBasalProfile()); MainApp.bus().post(new EventNewBasalProfile());
} }
}); });
Answers.getInstance().logCustom(new CustomEvent("ProfileSwitch")); FabricPrivacy.getInstance().logCustom(new CustomEvent("ProfileSwitch"));
} else { } else {
log.error("No profile switch existing"); log.error("No profile switch existing");
} }

View file

@ -17,8 +17,7 @@ import android.widget.ListAdapter;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import java.util.ArrayList; import java.util.ArrayList;
@ -40,6 +39,7 @@ import info.nightscout.androidaps.plugins.Insulin.InsulinFastactingPlugin;
import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin; import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin;
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin; import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
import info.nightscout.androidaps.plugins.SensitivityOref0.SensitivityOref0Plugin; import info.nightscout.androidaps.plugins.SensitivityOref0.SensitivityOref0Plugin;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.PasswordProtection; import info.nightscout.utils.PasswordProtection;
@ -131,7 +131,7 @@ public class ConfigBuilderFragment extends Fragment {
} }
return view; return view;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
return null; return null;
@ -242,7 +242,7 @@ public class ConfigBuilderFragment extends Fragment {
MainApp.bus().post(new EventRefreshGui()); MainApp.bus().post(new EventRefreshGui());
MainApp.bus().post(new EventConfigBuilderChange()); MainApp.bus().post(new EventConfigBuilderChange());
getPlugin().logPluginStatus(); getPlugin().logPluginStatus();
Answers.getInstance().logCustom(new CustomEvent("ConfigurationChange")); FabricPrivacy.getInstance().logCustom(new CustomEvent("ConfigurationChange"));
} }
}); });

View file

@ -15,7 +15,6 @@ import android.widget.CheckBox;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -25,6 +24,7 @@ import java.util.List;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.utils.FabricPrivacy;
public class ObjectivesFragment extends Fragment { public class ObjectivesFragment extends Fragment {
private static Logger log = LoggerFactory.getLogger(ObjectivesFragment.class); private static Logger log = LoggerFactory.getLogger(ObjectivesFragment.class);
@ -208,7 +208,7 @@ public class ObjectivesFragment extends Fragment {
return view; return view;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
return null; return null;

View file

@ -18,7 +18,6 @@ import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
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.R;
import info.nightscout.androidaps.db.Food; import info.nightscout.androidaps.db.Food;
import info.nightscout.androidaps.events.EventFoodDatabaseChanged; import info.nightscout.androidaps.events.EventFoodDatabaseChanged;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment; import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload; import info.nightscout.utils.NSUpload;
import info.nightscout.utils.SpinnerHelper; import info.nightscout.utils.SpinnerHelper;
@ -130,7 +130,7 @@ public class FoodFragment extends SubscriberFragment {
filterData(); filterData();
return view; return view;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
return null; return null;

View file

@ -7,11 +7,11 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.utils.FabricPrivacy;
/** /**
* Created by mike on 17.04.2017. * Created by mike on 17.04.2017.
@ -37,7 +37,7 @@ public class InsulinFragment extends Fragment {
return view; return view;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
return null; return null;

View file

@ -9,8 +9,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.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -22,6 +20,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment; import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.Loop.events.EventLoopSetLastRunGui; import info.nightscout.androidaps.plugins.Loop.events.EventLoopSetLastRunGui;
import info.nightscout.androidaps.plugins.Loop.events.EventLoopUpdateGui; import info.nightscout.androidaps.plugins.Loop.events.EventLoopUpdateGui;
import info.nightscout.utils.FabricPrivacy;
public class LoopFragment extends SubscriberFragment implements View.OnClickListener { public class LoopFragment extends SubscriberFragment implements View.OnClickListener {
private static Logger log = LoggerFactory.getLogger(LoopFragment.class); private static Logger log = LoggerFactory.getLogger(LoopFragment.class);
@ -53,7 +52,7 @@ public class LoopFragment extends SubscriberFragment implements View.OnClickList
updateGUI(); updateGUI();
return view; return view;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
return null; return null;
@ -71,7 +70,7 @@ public class LoopFragment extends SubscriberFragment implements View.OnClickList
} }
}); });
thread.start(); thread.start();
Answers.getInstance().logCustom(new CustomEvent("Loop_Run")); FabricPrivacy.getInstance().logCustom(new CustomEvent("Loop_Run"));
break; break;
} }

View file

@ -8,7 +8,6 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationCompat;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -37,6 +36,7 @@ import info.nightscout.androidaps.plugins.Loop.events.EventLoopUpdateGui;
import info.nightscout.androidaps.plugins.Loop.events.EventNewOpenLoopNotification; import info.nightscout.androidaps.plugins.Loop.events.EventNewOpenLoopNotification;
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.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload; import info.nightscout.utils.NSUpload;
import info.nightscout.utils.SP; import info.nightscout.utils.SP;
@ -332,7 +332,7 @@ public class LoopPlugin implements PluginBase {
MainApp.getConfigBuilder().applyAPSRequest(resultAfterConstraints, new Callback() { MainApp.getConfigBuilder().applyAPSRequest(resultAfterConstraints, new Callback() {
@Override @Override
public void run() { public void run() {
Answers.getInstance().logCustom(new CustomEvent("APSRequest")); FabricPrivacy.getInstance().logCustom(new CustomEvent("APSRequest"));
if (result.enacted || result.success) { if (result.enacted || result.success) {
lastRun.setByPump = result; lastRun.setByPump = result;
lastRun.lastEnact = lastRun.lastAPSRun; lastRun.lastEnact = lastRun.lastAPSRun;

View file

@ -18,8 +18,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.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -33,6 +31,7 @@ import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientNewLog; import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientNewLog;
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientRestart; import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientRestart;
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientUpdateGUI; import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientUpdateGUI;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.SP; import info.nightscout.utils.SP;
public class NSClientInternalFragment extends SubscriberFragment implements View.OnClickListener, CompoundButton.OnCheckedChangeListener { public class NSClientInternalFragment extends SubscriberFragment implements View.OnClickListener, CompoundButton.OnCheckedChangeListener {
@ -88,7 +87,7 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
updateGUI(); updateGUI();
return view; return view;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
return null; return null;
@ -99,11 +98,11 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
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());
Answers.getInstance().logCustom(new CustomEvent("NSClientRestart")); FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientRestart"));
break; break;
case R.id.nsclientinternal_delivernow: case R.id.nsclientinternal_delivernow:
NSClientInternalPlugin.getPlugin().resend("GUI"); NSClientInternalPlugin.getPlugin().resend("GUI");
Answers.getInstance().logCustom(new CustomEvent("NSClientDeliverNow")); FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientDeliverNow"));
break; break;
case R.id.nsclientinternal_clearlog: case R.id.nsclientinternal_clearlog:
NSClientInternalPlugin.getPlugin().clearLog(); NSClientInternalPlugin.getPlugin().clearLog();
@ -118,7 +117,7 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
UploadQueue.clearQueue(); UploadQueue.clearQueue();
updateGUI(); updateGUI();
Answers.getInstance().logCustom(new CustomEvent("NSClientClearQueue")); FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientClearQueue"));
} }
}); });
builder.setNegativeButton(getString(R.string.cancel), null); builder.setNegativeButton(getString(R.string.cancel), null);
@ -126,7 +125,7 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
break; break;
case R.id.nsclientinternal_showqueue: case R.id.nsclientinternal_showqueue:
MainApp.bus().post(new EventNSClientNewLog("QUEUE", NSClientInternalPlugin.getPlugin().queue().textList())); MainApp.bus().post(new EventNSClientNewLog("QUEUE", NSClientInternalPlugin.getPlugin().queue().textList()));
Answers.getInstance().logCustom(new CustomEvent("NSClientShowQueue")); FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientShowQueue"));
break; break;
} }
} }
@ -139,7 +138,7 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
NSClientInternalPlugin.getPlugin().paused = isChecked; NSClientInternalPlugin.getPlugin().paused = isChecked;
MainApp.bus().post(new EventPreferenceChange(R.string.key_nsclientinternal_paused)); MainApp.bus().post(new EventPreferenceChange(R.string.key_nsclientinternal_paused));
updateGUI(); updateGUI();
Answers.getInstance().logCustom(new CustomEvent("NSClientPause")); FabricPrivacy.getInstance().logCustom(new CustomEvent("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

@ -9,7 +9,7 @@ import android.os.HandlerThread;
import android.os.IBinder; import android.os.IBinder;
import android.os.PowerManager; import android.os.PowerManager;
import com.crashlytics.android.Crashlytics;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.hash.Hashing; import com.google.common.hash.Hashing;
import com.j256.ormlite.dao.CloseableIterator; import com.j256.ormlite.dao.CloseableIterator;
@ -62,6 +62,7 @@ import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotificati
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.SP; import info.nightscout.utils.SP;
import io.socket.client.IO; import io.socket.client.IO;
import io.socket.client.Socket; import io.socket.client.Socket;
@ -123,7 +124,7 @@ public class NSClientService extends Service {
@Override @Override
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();
mWakeLock.release(); if (mWakeLock.isHeld()) mWakeLock.release();
} }
public class LocalBinder extends Binder { public class LocalBinder extends Binder {
@ -345,14 +346,14 @@ public class NSClientService extends Service {
try { try {
data = (JSONObject) args[0]; data = (JSONObject) args[0];
} catch (Exception e) { } catch (Exception e) {
Crashlytics.log("Wrong Announcement from NS: " + args[0]); FabricPrivacy.log("Wrong Announcement from NS: " + args[0]);
return; return;
} }
if (Config.detailedLog) if (Config.detailedLog)
try { try {
MainApp.bus().post(new EventNSClientNewLog("ANNOUNCEMENT", data.has("message") ? data.getString("message") : "received")); MainApp.bus().post(new EventNSClientNewLog("ANNOUNCEMENT", data.has("message") ? data.getString("message") : "received"));
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
BroadcastAnnouncement.handleAnnouncement(data, getApplicationContext()); BroadcastAnnouncement.handleAnnouncement(data, getApplicationContext());
log.debug(data.toString()); log.debug(data.toString());
@ -381,7 +382,7 @@ public class NSClientService extends Service {
try { try {
data = (JSONObject) args[0]; data = (JSONObject) args[0];
} catch (Exception e) { } catch (Exception e) {
Crashlytics.log("Wrong alarm from NS: " + args[0]); FabricPrivacy.log("Wrong alarm from NS: " + args[0]);
return; return;
} }
BroadcastAlarm.handleAlarm(data, getApplicationContext()); BroadcastAlarm.handleAlarm(data, getApplicationContext());
@ -409,7 +410,7 @@ public class NSClientService extends Service {
try { try {
data = (JSONObject) args[0]; data = (JSONObject) args[0];
} catch (Exception e) { } catch (Exception e) {
Crashlytics.log("Wrong Urgent alarm from NS: " + args[0]); FabricPrivacy.log("Wrong Urgent alarm from NS: " + args[0]);
return; return;
} }
if (Config.detailedLog) if (Config.detailedLog)
@ -434,7 +435,7 @@ public class NSClientService extends Service {
try { try {
data = (JSONObject) args[0]; data = (JSONObject) args[0];
} catch (Exception e) { } catch (Exception e) {
Crashlytics.log("Wrong Urgent alarm from NS: " + args[0]); FabricPrivacy.log("Wrong Urgent alarm from NS: " + args[0]);
return; return;
} }
if (Config.detailedLog) if (Config.detailedLog)
@ -665,7 +666,7 @@ public class NSClientService extends Service {
} }
//MainApp.bus().post(new EventNSClientNewLog("NSCLIENT", "onDataUpdate end"); //MainApp.bus().post(new EventNSClientNewLog("NSCLIENT", "onDataUpdate end");
} finally { } finally {
wakeLock.release(); if (wakeLock.isHeld()) wakeLock.release();
} }
} }

View file

@ -9,8 +9,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.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -24,6 +22,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment; import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui; import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui; import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.JSONFormatter; import info.nightscout.utils.JSONFormatter;
public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnClickListener { public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnClickListener {
@ -63,7 +62,7 @@ public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnCli
updateGUI(); updateGUI();
return view; return view;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
return null; return null;
@ -74,7 +73,7 @@ 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"); OpenAPSAMAPlugin.getPlugin().invoke("OpenAPSAMA button");
Answers.getInstance().logCustom(new CustomEvent("OpenAPS_AMA_Run")); FabricPrivacy.getInstance().logCustom(new CustomEvent("OpenAPS_AMA_Run"));
break; break;
} }

View file

@ -9,8 +9,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.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -22,6 +20,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment; import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui; import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui; import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.JSONFormatter; import info.nightscout.utils.JSONFormatter;
public class OpenAPSMAFragment extends SubscriberFragment implements View.OnClickListener { public class OpenAPSMAFragment extends SubscriberFragment implements View.OnClickListener {
@ -57,7 +56,7 @@ public class OpenAPSMAFragment extends SubscriberFragment implements View.OnClic
updateGUI(); updateGUI();
return view; return view;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
return null; return null;
@ -68,7 +67,7 @@ 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"); OpenAPSMAPlugin.getPlugin().invoke("OpenAPSMA button");
Answers.getInstance().logCustom(new CustomEvent("OpenAPS_MA_Run")); 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.Answers;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -22,6 +21,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment; import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui; import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui; import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.JSONFormatter; import info.nightscout.utils.JSONFormatter;
public class OpenAPSSMBFragment extends SubscriberFragment implements View.OnClickListener { public class OpenAPSSMBFragment extends SubscriberFragment implements View.OnClickListener {
@ -66,7 +66,7 @@ public class OpenAPSSMBFragment extends SubscriberFragment implements View.OnCli
switch (view.getId()) { switch (view.getId()) {
case R.id.openapsma_run: case R.id.openapsma_run:
OpenAPSSMBPlugin.getPlugin().invoke("OpenAPSSMB button"); OpenAPSSMBPlugin.getPlugin().invoke("OpenAPSSMB button");
Answers.getInstance().logCustom(new CustomEvent("OpenAPS_SMB_Run")); FabricPrivacy.getInstance().logCustom(new CustomEvent("OpenAPS_SMB_Run"));
break; break;
} }

View file

@ -11,7 +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.Answers;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -24,6 +23,7 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; 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.utils.FabricPrivacy;
import info.nightscout.utils.NumberPicker; import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SafeParse; import info.nightscout.utils.SafeParse;
import info.nightscout.utils.XdripCalibrations; import info.nightscout.utils.XdripCalibrations;
@ -88,7 +88,7 @@ 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();
Answers.getInstance().logCustom(new CustomEvent("Calibration")); FabricPrivacy.getInstance().logCustom(new CustomEvent("Calibration"));
break; break;
case R.id.cancel: case R.id.cancel:
dismiss(); dismiss();

View file

@ -16,7 +16,6 @@ import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -31,9 +30,9 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.db.CareportalEvent; import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NumberPicker; import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SafeParse; import info.nightscout.utils.SafeParse;
import info.nightscout.utils.ToastUtils; import info.nightscout.utils.ToastUtils;
@ -176,7 +175,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
} else { } else {
MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo); MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
} }
Answers.getInstance().logCustom(new CustomEvent("Bolus")); FabricPrivacy.getInstance().logCustom(new CustomEvent("Bolus"));
} }
} }
} }

View file

@ -25,7 +25,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.Answers;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -59,6 +58,7 @@ import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugi
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventAutosensCalculationFinished; import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventAutosensCalculationFinished;
import info.nightscout.androidaps.plugins.Loop.LoopPlugin; import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.BolusWizard; import info.nightscout.utils.BolusWizard;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
@ -382,7 +382,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
} else { } else {
MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo); MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
} }
Answers.getInstance().logCustom(new CustomEvent("Wizard")); FabricPrivacy.getInstance().logCustom(new CustomEvent("Wizard"));
} }
} }
} }

View file

@ -32,8 +32,7 @@ import android.widget.CompoundButton;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent; 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;
@ -106,6 +105,7 @@ import info.nightscout.androidaps.plugins.Overview.notifications.NotificationSto
import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripPlugin; import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripPlugin;
import info.nightscout.androidaps.plugins.Treatments.fragments.ProfileViewerDialog; import info.nightscout.androidaps.plugins.Treatments.fragments.ProfileViewerDialog;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.BolusWizard; import info.nightscout.utils.BolusWizard;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
@ -342,7 +342,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
return view; return view;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
log.debug("Runtime Exception", e); log.debug("Runtime Exception", e);
} }
@ -698,7 +698,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
scheduleUpdateGUI("onClickAcceptTemp"); scheduleUpdateGUI("onClickAcceptTemp");
} }
}); });
Answers.getInstance().logCustom(new CustomEvent("AcceptTemp")); FabricPrivacy.getInstance().logCustom(new CustomEvent("AcceptTemp"));
} }
}); });
builder.setNegativeButton(getContext().getString(R.string.cancel), null); builder.setNegativeButton(getContext().getString(R.string.cancel), null);
@ -814,7 +814,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
} }
} }
}); });
Answers.getInstance().logCustom(new CustomEvent("QuickWizard")); FabricPrivacy.getInstance().logCustom(new CustomEvent("QuickWizard"));
} }
} }
} }

View file

@ -13,7 +13,6 @@ import android.widget.Button;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
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.plugins.Careportal.OptionsToShow;
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.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NumberPicker; import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SafeParse; import info.nightscout.utils.SafeParse;
import info.nightscout.utils.TimeListEdit; import info.nightscout.utils.TimeListEdit;
@ -140,7 +140,7 @@ public class LocalProfileFragment extends SubscriberFragment {
return layout; return layout;
} catch (Exception e) { } catch (Exception e) {
log.error("Unhandled exception: ", e); log.error("Unhandled exception: ", e);
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
return null; return null;

View file

@ -10,7 +10,6 @@ import android.widget.ArrayAdapter;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import java.util.ArrayList; import java.util.ArrayList;
@ -22,6 +21,7 @@ import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment; import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.ProfileNS.events.EventNSProfileUpdateGUI; import info.nightscout.androidaps.plugins.ProfileNS.events.EventNSProfileUpdateGUI;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
public class NSProfileFragment extends SubscriberFragment implements AdapterView.OnItemSelectedListener { public class NSProfileFragment extends SubscriberFragment implements AdapterView.OnItemSelectedListener {
@ -56,7 +56,7 @@ public class NSProfileFragment extends SubscriberFragment implements AdapterView
updateGUI(); updateGUI();
return layout; return layout;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
return null; return null;

View file

@ -13,7 +13,6 @@ import android.widget.EditText;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -27,6 +26,7 @@ import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialo
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow; import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
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.utils.FabricPrivacy;
import info.nightscout.utils.SafeParse; import info.nightscout.utils.SafeParse;
public class SimpleProfileFragment extends SubscriberFragment { public class SimpleProfileFragment extends SubscriberFragment {
@ -137,7 +137,7 @@ public class SimpleProfileFragment extends SubscriberFragment {
return layout; return layout;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
return null; return null;

View file

@ -15,7 +15,7 @@ import android.widget.Button;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -42,6 +42,7 @@ import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
import info.nightscout.androidaps.queue.events.EventQueueChanged; import info.nightscout.androidaps.queue.events.EventQueueChanged;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.SetWarnColor; import info.nightscout.utils.SetWarnColor;
public class DanaRFragment extends SubscriberFragment { public class DanaRFragment extends SubscriberFragment {
@ -101,7 +102,7 @@ public class DanaRFragment extends SubscriberFragment {
return view; return view;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
return null; return null;

View file

@ -9,7 +9,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -22,6 +22,7 @@ import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightPumpUpdateGui; import info.nightscout.androidaps.plugins.PumpInsight.events.EventInsightPumpUpdateGui;
import info.nightscout.androidaps.plugins.PumpInsight.utils.StatusItem; import info.nightscout.androidaps.plugins.PumpInsight.utils.StatusItem;
import info.nightscout.androidaps.plugins.PumpInsight.utils.ui.StatusItemViewAdapter; import info.nightscout.androidaps.plugins.PumpInsight.utils.ui.StatusItemViewAdapter;
import info.nightscout.utils.FabricPrivacy;
public class InsightPumpFragment extends SubscriberFragment { public class InsightPumpFragment extends SubscriberFragment {
@ -64,7 +65,7 @@ public class InsightPumpFragment extends SubscriberFragment {
return view; return view;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
return null; return null;

View file

@ -10,7 +10,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -22,6 +22,7 @@ import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment; import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.PumpVirtual.events.EventVirtualPumpUpdateGui; import info.nightscout.androidaps.plugins.PumpVirtual.events.EventVirtualPumpUpdateGui;
import info.nightscout.utils.FabricPrivacy;
public class VirtualPumpFragment extends SubscriberFragment { public class VirtualPumpFragment extends SubscriberFragment {
private static Logger log = LoggerFactory.getLogger(VirtualPumpFragment.class); private static Logger log = LoggerFactory.getLogger(VirtualPumpFragment.class);
@ -63,7 +64,7 @@ public class VirtualPumpFragment extends SubscriberFragment {
return view; return view;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
return null; return null;

View file

@ -10,7 +10,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.Crashlytics;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -23,6 +22,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment; import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventSmsCommunicatorUpdateGui; import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventSmsCommunicatorUpdateGui;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.FabricPrivacy;
/** /**
* A simple {@link Fragment} subclass. * A simple {@link Fragment} subclass.
@ -47,7 +47,7 @@ public class SmsCommunicatorFragment extends SubscriberFragment {
updateGUI(); updateGUI();
return view; return view;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
return null; return null;

View file

@ -5,7 +5,6 @@ import android.content.pm.ResolveInfo;
import android.telephony.SmsManager; import android.telephony.SmsManager;
import android.telephony.SmsMessage; import android.telephony.SmsMessage;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -41,6 +40,7 @@ import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventNewSMS;
import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventSmsCommunicatorUpdateGui; import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventSmsCommunicatorUpdateGui;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload; import info.nightscout.utils.NSUpload;
import info.nightscout.utils.SP; import info.nightscout.utils.SP;
import info.nightscout.utils.SafeParse; import info.nightscout.utils.SafeParse;
@ -276,7 +276,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date())); sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
receivedSms.processed = true; receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Bg")); FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Bg"));
break; break;
case "LOOP": case "LOOP":
if (splited.length > 1) if (splited.length > 1)
@ -297,7 +297,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
}); });
} }
receivedSms.processed = true; receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Loop_Stop")); FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Loop_Stop"));
break; break;
case "ENABLE": case "ENABLE":
case "START": case "START":
@ -309,7 +309,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
MainApp.bus().post(new EventRefreshOverview("SMS_LOOP_START")); MainApp.bus().post(new EventRefreshOverview("SMS_LOOP_START"));
} }
receivedSms.processed = true; receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Loop_Start")); FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Loop_Start"));
break; break;
case "STATUS": case "STATUS":
loopPlugin = MainApp.getSpecificPlugin(LoopPlugin.class); loopPlugin = MainApp.getSpecificPlugin(LoopPlugin.class);
@ -325,7 +325,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date())); sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
} }
receivedSms.processed = true; receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Loop_Status")); FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Loop_Status"));
break; break;
case "RESUME": case "RESUME":
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop(); final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
@ -334,7 +334,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
NSUpload.uploadOpenAPSOffline(0); NSUpload.uploadOpenAPSOffline(0);
reply = MainApp.sResources.getString(R.string.smscommunicator_loopresumed); reply = MainApp.sResources.getString(R.string.smscommunicator_loopresumed);
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, new Date())); sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, new Date()));
Answers.getInstance().logCustom(new CustomEvent("SMS_Loop_Resume")); FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Loop_Resume"));
break; break;
case "SUSPEND": case "SUSPEND":
if (splited.length >= 3) if (splited.length >= 3)
@ -351,7 +351,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
resetWaitingMessages(); resetWaitingMessages();
sendSMS(suspendWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode)); sendSMS(suspendWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode));
suspendWaitingForConfirmation.duration = duration; suspendWaitingForConfirmation.duration = duration;
Answers.getInstance().logCustom(new CustomEvent("SMS_Loop_Suspend")); FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Loop_Suspend"));
} else { } else {
reply = MainApp.sResources.getString(R.string.smscommunicator_remotecommandnotallowed); reply = MainApp.sResources.getString(R.string.smscommunicator_remotecommandnotallowed);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date())); sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
@ -370,7 +370,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
reply = "TERATMENTS REFRESH " + q.size() + " receivers"; reply = "TERATMENTS REFRESH " + q.size() + " receivers";
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date())); sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
receivedSms.processed = true; receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Treatments_Refresh")); FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Treatments_Refresh"));
break; break;
} }
break; break;
@ -384,7 +384,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
reply = "NSCLIENT RESTART " + q.size() + " receivers"; reply = "NSCLIENT RESTART " + q.size() + " receivers";
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date())); sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
receivedSms.processed = true; receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Nsclient_Restart")); FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Nsclient_Restart"));
break; break;
} }
break; break;
@ -400,7 +400,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date())); sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
} }
receivedSms.processed = true; receivedSms.processed = true;
Answers.getInstance().logCustom(new CustomEvent("SMS_Danar")); FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Danar"));
break; break;
case "BASAL": case "BASAL":
if (splited.length > 1) { if (splited.length > 1) {
@ -411,7 +411,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
receivedSms.processed = true; receivedSms.processed = true;
resetWaitingMessages(); resetWaitingMessages();
sendSMS(cancelTempBasalWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode)); sendSMS(cancelTempBasalWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode));
Answers.getInstance().logCustom(new CustomEvent("SMS_Basal")); FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Basal"));
} else { } else {
reply = MainApp.sResources.getString(R.string.smscommunicator_remotebasalnotallowed); reply = MainApp.sResources.getString(R.string.smscommunicator_remotebasalnotallowed);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date())); sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
@ -426,7 +426,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
resetWaitingMessages(); resetWaitingMessages();
sendSMS(tempBasalWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode)); sendSMS(tempBasalWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode));
tempBasalWaitingForConfirmation.tempBasal = tempBasal; tempBasalWaitingForConfirmation.tempBasal = tempBasal;
Answers.getInstance().logCustom(new CustomEvent("SMS_Basal")); FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Basal"));
} else { } else {
reply = MainApp.sResources.getString(R.string.smscommunicator_remotebasalnotallowed); reply = MainApp.sResources.getString(R.string.smscommunicator_remotebasalnotallowed);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date())); sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
@ -451,7 +451,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
resetWaitingMessages(); resetWaitingMessages();
sendSMS(bolusWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode)); sendSMS(bolusWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode));
bolusWaitingForConfirmation.bolusRequested = amount; bolusWaitingForConfirmation.bolusRequested = amount;
Answers.getInstance().logCustom(new CustomEvent("SMS_Bolus")); FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Bolus"));
} else { } else {
reply = MainApp.sResources.getString(R.string.smscommunicator_remotebolusnotallowed); reply = MainApp.sResources.getString(R.string.smscommunicator_remotebolusnotallowed);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date())); sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
@ -468,7 +468,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
resetWaitingMessages(); resetWaitingMessages();
sendSMS(calibrationWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode)); sendSMS(calibrationWaitingForConfirmation = new Sms(receivedSms.phoneNumber, reply, new Date(), passCode));
calibrationWaitingForConfirmation.calibrationRequested = amount; calibrationWaitingForConfirmation.calibrationRequested = amount;
Answers.getInstance().logCustom(new CustomEvent("SMS_Cal")); FabricPrivacy.getInstance().logCustom(new CustomEvent("SMS_Cal"));
} else { } else {
reply = MainApp.sResources.getString(R.string.smscommunicator_remotecalibrationnotallowed); reply = MainApp.sResources.getString(R.string.smscommunicator_remotecalibrationnotallowed);
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date())); sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));

View file

@ -12,7 +12,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.Crashlytics;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -29,6 +28,7 @@ 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.NSClientInternal.UploadQueue; import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload; import info.nightscout.utils.NSUpload;
/** /**
@ -63,7 +63,7 @@ public class BGSourceFragment extends SubscriberFragment {
return view; return view;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
return null; return null;

View file

@ -8,7 +8,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -25,6 +25,7 @@ import info.nightscout.androidaps.plugins.Treatments.fragments.TreatmentsExtende
import info.nightscout.androidaps.plugins.Treatments.fragments.TreatmentsProfileSwitchFragment; import info.nightscout.androidaps.plugins.Treatments.fragments.TreatmentsProfileSwitchFragment;
import info.nightscout.androidaps.plugins.Treatments.fragments.TreatmentsTempTargetFragment; import info.nightscout.androidaps.plugins.Treatments.fragments.TreatmentsTempTargetFragment;
import info.nightscout.androidaps.plugins.Treatments.fragments.TreatmentsTemporaryBasalsFragment; import info.nightscout.androidaps.plugins.Treatments.fragments.TreatmentsTemporaryBasalsFragment;
import info.nightscout.utils.FabricPrivacy;
public class TreatmentsFragment extends SubscriberFragment implements View.OnClickListener { public class TreatmentsFragment extends SubscriberFragment implements View.OnClickListener {
private static Logger log = LoggerFactory.getLogger(TreatmentsFragment.class); private static Logger log = LoggerFactory.getLogger(TreatmentsFragment.class);
@ -60,7 +61,7 @@ public class TreatmentsFragment extends SubscriberFragment implements View.OnCli
return view; return view;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); FabricPrivacy.logException(e);
} }
return null; return null;

View file

@ -17,7 +17,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.Answers;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -38,6 +37,7 @@ import info.nightscout.androidaps.events.EventTreatmentChange;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment; import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue; import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.NSUpload; import info.nightscout.utils.NSUpload;
@ -155,7 +155,7 @@ public class TreatmentsBolusFragment extends SubscriberFragment implements View.
MainApp.getDbHelper().delete(treatment); MainApp.getDbHelper().delete(treatment);
} }
updateGUI(); updateGUI();
Answers.getInstance().logCustom(new CustomEvent("RemoveTreatment")); FabricPrivacy.getInstance().logCustom(new CustomEvent("RemoveTreatment"));
} }
}); });
builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null); builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null);

View file

@ -16,7 +16,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.Answers;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -34,6 +33,7 @@ import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue; import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload; import info.nightscout.utils.NSUpload;
import info.nightscout.androidaps.data.Intervals; import info.nightscout.androidaps.data.Intervals;
@ -155,7 +155,7 @@ public class TreatmentsExtendedBolusesFragment extends SubscriberFragment {
UploadQueue.removeID("dbAdd", _id); UploadQueue.removeID("dbAdd", _id);
} }
MainApp.getDbHelper().delete(extendedBolus); MainApp.getDbHelper().delete(extendedBolus);
Answers.getInstance().logCustom(new CustomEvent("RemoveExtendedBolus")); FabricPrivacy.getInstance().logCustom(new CustomEvent("RemoveExtendedBolus"));
} }
}); });
builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null); builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null);

View file

@ -16,7 +16,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.Answers;
import com.crashlytics.android.answers.CustomEvent; import com.crashlytics.android.answers.CustomEvent;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -34,6 +33,7 @@ import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue; import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload; import info.nightscout.utils.NSUpload;
import info.nightscout.androidaps.data.Intervals; import info.nightscout.androidaps.data.Intervals;
@ -172,7 +172,7 @@ public class TreatmentsTemporaryBasalsFragment extends SubscriberFragment {
UploadQueue.removeID("dbAdd", _id); UploadQueue.removeID("dbAdd", _id);
} }
MainApp.getDbHelper().delete(tempBasal); MainApp.getDbHelper().delete(tempBasal);
Answers.getInstance().logCustom(new CustomEvent("RemoveTempBasal")); FabricPrivacy.getInstance().logCustom(new CustomEvent("RemoveTempBasal"));
} }
}); });
builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null); builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null);

View file

@ -0,0 +1,83 @@
package info.nightscout.utils;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
/**
* Created by jamorham on 21/02/2018.
*
* Some users do not wish to be tracked, Fabric Answers and Crashlytics do not provide an easy way
* to disable them and make calls from a potentially invalid singleton reference. This wrapper
* emulates the methods but ignores the request if the instance is null or invalid.
*
*/
public class FabricPrivacy {
private static final String TAG = "FabricPrivacy";
private static volatile FabricPrivacy instance;
public static FabricPrivacy getInstance() {
if (instance == null) {
initSelf();
}
return instance;
}
private static synchronized void initSelf() {
if (instance == null) {
instance = new FabricPrivacy();
}
}
// Crashlytics logException
public static void logException(Throwable throwable) {
try {
final Crashlytics crashlytics = Crashlytics.getInstance();
crashlytics.core.logException(throwable);
} catch (NullPointerException | IllegalStateException e) {
android.util.Log.d(TAG, "Ignoring opted out non-initialized log: " + throwable);
}
}
// Crashlytics log
public static void log(String msg) {
try {
final Crashlytics crashlytics = Crashlytics.getInstance();
crashlytics.core.log(msg);
} catch (NullPointerException | IllegalStateException e) {
android.util.Log.d(TAG, "Ignoring opted out non-initialized log: " + msg);
}
}
// Crashlytics log
public static void log(int priority, String tag, String msg) {
try {
final Crashlytics crashlytics = Crashlytics.getInstance();
crashlytics.core.log(priority, tag, msg);
} catch (NullPointerException | IllegalStateException e) {
android.util.Log.d(TAG, "Ignoring opted out non-initialized log: " + msg);
}
}
public static boolean fabricEnabled() {
return SP.getBoolean("enable_fabric", true);
}
// Answers logCustom
public void logCustom(CustomEvent event) {
try {
final Answers answers = Answers.getInstance();
if (fabricEnabled()) {
answers.logCustom(event);
} else {
android.util.Log.d(TAG, "Ignoring recently opted-out event: " + event.toString());
}
} catch (NullPointerException | IllegalStateException e) {
android.util.Log.d(TAG, "Ignoring opted-out non-initialized event: " + event.toString());
}
}
}

View file

@ -7,7 +7,6 @@ import android.content.DialogInterface;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.widget.TextView; import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;

View file

@ -943,5 +943,8 @@
<string name="ns_create_announcements_from_errors_title">Create announcements from errors</string> <string name="ns_create_announcements_from_errors_title">Create announcements from errors</string>
<string name="ns_create_announcements_from_errors_summary">Create Nightscout announcement for error dialogs and local alerts (also viewable in Careportal under Treatments)</string> <string name="ns_create_announcements_from_errors_summary">Create Nightscout announcement for error dialogs and local alerts (also viewable in Careportal under Treatments)</string>
<string name="dexcomG5_shortname" translatable="false">G5</string> <string name="dexcomG5_shortname" translatable="false">G5</string>
<string name="data_choices">Data Choices</string>
<string name="fabric_upload">Fabric Upload</string>
<string name="allow_automated_crash_reporting">Allow automated crash reporting and feature usage data to be sent to the developers via the fabric.io service.</string>
</resources> </resources>

View file

@ -122,6 +122,15 @@
android:summary="@string/btwatchdog_summary"/> android:summary="@string/btwatchdog_summary"/>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory
android:title="@string/data_choices">
<SwitchPreference
android:defaultValue="true"
android:key="enable_fabric"
android:title="@string/fabric_upload"
android:summary="@string/allow_automated_crash_reporting"/>
</PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

View file

@ -18,6 +18,8 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
jcenter() jcenter()
google()
maven { maven {
url "https://maven.google.com" url "https://maven.google.com"
} }