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.KeepAliveReceiver;
import info.nightscout.androidaps.receivers.NSAlarmReceiver;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload;
import io.fabric.sdk.android.Fabric;
@ -97,18 +98,26 @@ public class MainApp extends Application {
@Override
public void onCreate() {
super.onCreate();
Fabric.with(this, new Crashlytics());
Fabric.with(this, new Answers());
sInstance = this;
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);
Crashlytics.setString("BUILDVERSION", BuildConfig.BUILDVERSION);
log.info("Version: " + BuildConfig.VERSION_NAME);
log.info("BuildVersion: " + BuildConfig.BUILDVERSION);
sBus = Config.logEvents ? new LoggingBus(ThreadEnforcer.ANY) : new Bus(ThreadEnforcer.ANY);
sInstance = this;
sResources = getResources();
registerLocalBroadcastReceiver();
if (pluginsList == null) {
@ -167,15 +176,15 @@ public class MainApp extends Application {
}
NSUpload.uploadAppStart();
if (Config.NSCLIENT)
Answers.getInstance().logCustom(new CustomEvent("AppStart-NSClient"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("AppStart-NSClient"));
else if (Config.G5UPLOADER)
Answers.getInstance().logCustom(new CustomEvent("AppStart-G5Uploader"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("AppStart-G5Uploader"));
else if (Config.PUMPCONTROL)
Answers.getInstance().logCustom(new CustomEvent("AppStart-PumpControl"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("AppStart-PumpControl"));
else if (MainApp.getConfigBuilder().isClosedModeEnabled())
Answers.getInstance().logCustom(new CustomEvent("AppStart-ClosedLoop"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("AppStart-ClosedLoop"));
else
Answers.getInstance().logCustom(new CustomEvent("AppStart-OpenLoop"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("AppStart-OpenLoop"));
new Thread(new Runnable() {
@Override

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.data;
import android.support.v4.util.LongSparseArray;
import com.crashlytics.android.Crashlytics;
import org.json.JSONArray;
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.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.ToastUtils;
public class Profile {
@ -57,7 +58,7 @@ public class Profile {
if (units != null)
this.units = units;
else {
Crashlytics.log("Profile failover failed too");
FabricPrivacy.log("Profile failover failed too");
this.units = Constants.MGDL;
}
}

View file

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

View file

@ -14,7 +14,6 @@ import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
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.queue.Callback;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SP;
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.ViewGroup;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
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.Overview.Dialogs.ErrorHelperActivity;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NumberPicker;
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);

View file

@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.Actions.dialogs;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
@ -13,7 +12,6 @@ import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
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.Overview.Dialogs.ErrorHelperActivity;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SafeParse;
@ -162,7 +161,7 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
} else {
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);

View file

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

View file

@ -23,7 +23,6 @@ import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
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.Overview.Dialogs.ErrorHelperActivity;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.NSUpload;
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());
MainApp.getDbHelper().createOrUpdate(tempTarget);
NSUpload.uploadCareportalEntryToNS(data);
Answers.getInstance().logCustom(new CustomEvent("TempTarget"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("TempTarget"));
}
} catch (JSONException e) {
log.error("Unhandled exception", e);
}
} else {
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());
}
});
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) {
@ -773,7 +773,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
MainApp.bus().post(new EventNewBasalProfile());
}
});
Answers.getInstance().logCustom(new CustomEvent("ProfileSwitch"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("ProfileSwitch"));
} else {
log.error("No profile switch existing");
}

View file

@ -17,8 +17,7 @@ import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
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.PumpVirtual.VirtualPumpPlugin;
import info.nightscout.androidaps.plugins.SensitivityOref0.SensitivityOref0Plugin;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.PasswordProtection;
@ -131,7 +131,7 @@ public class ConfigBuilderFragment extends Fragment {
}
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;
@ -242,7 +242,7 @@ public class ConfigBuilderFragment extends Fragment {
MainApp.bus().post(new EventRefreshGui());
MainApp.bus().post(new EventConfigBuilderChange());
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.TextView;
import com.crashlytics.android.Crashlytics;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -25,6 +24,7 @@ import java.util.List;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.utils.FabricPrivacy;
public class ObjectivesFragment extends Fragment {
private static Logger log = LoggerFactory.getLogger(ObjectivesFragment.class);
@ -208,7 +208,7 @@ public class ObjectivesFragment extends Fragment {
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

@ -18,7 +18,6 @@ import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
import org.slf4j.Logger;
@ -33,6 +32,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.db.Food;
import info.nightscout.androidaps.events.EventFoodDatabaseChanged;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload;
import info.nightscout.utils.SpinnerHelper;
@ -130,7 +130,7 @@ public class FoodFragment extends SubscriberFragment {
filterData();
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

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

View file

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

View file

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

View file

@ -18,8 +18,6 @@ import android.widget.CompoundButton;
import android.widget.ScrollView;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
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.EventNSClientRestart;
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientUpdateGUI;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.SP;
public class NSClientInternalFragment extends SubscriberFragment implements View.OnClickListener, CompoundButton.OnCheckedChangeListener {
@ -88,7 +87,7 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
updateGUI();
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;
@ -99,11 +98,11 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
switch (view.getId()) {
case R.id.nsclientinternal_restart:
MainApp.bus().post(new EventNSClientRestart());
Answers.getInstance().logCustom(new CustomEvent("NSClientRestart"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientRestart"));
break;
case R.id.nsclientinternal_delivernow:
NSClientInternalPlugin.getPlugin().resend("GUI");
Answers.getInstance().logCustom(new CustomEvent("NSClientDeliverNow"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientDeliverNow"));
break;
case R.id.nsclientinternal_clearlog:
NSClientInternalPlugin.getPlugin().clearLog();
@ -118,7 +117,7 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
public void onClick(DialogInterface dialog, int id) {
UploadQueue.clearQueue();
updateGUI();
Answers.getInstance().logCustom(new CustomEvent("NSClientClearQueue"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientClearQueue"));
}
});
builder.setNegativeButton(getString(R.string.cancel), null);
@ -126,7 +125,7 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
break;
case R.id.nsclientinternal_showqueue:
MainApp.bus().post(new EventNSClientNewLog("QUEUE", NSClientInternalPlugin.getPlugin().queue().textList()));
Answers.getInstance().logCustom(new CustomEvent("NSClientShowQueue"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientShowQueue"));
break;
}
}
@ -139,7 +138,7 @@ public class NSClientInternalFragment extends SubscriberFragment implements View
NSClientInternalPlugin.getPlugin().paused = isChecked;
MainApp.bus().post(new EventPreferenceChange(R.string.key_nsclientinternal_paused));
updateGUI();
Answers.getInstance().logCustom(new CustomEvent("NSClientPause"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("NSClientPause"));
break;
case R.id.nsclientinternal_autoscroll:
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.PowerManager;
import com.crashlytics.android.Crashlytics;
import com.google.common.base.Charsets;
import com.google.common.hash.Hashing;
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.notifications.Notification;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.SP;
import io.socket.client.IO;
import io.socket.client.Socket;
@ -123,7 +124,7 @@ public class NSClientService extends Service {
@Override
public void onDestroy() {
super.onDestroy();
mWakeLock.release();
if (mWakeLock.isHeld()) mWakeLock.release();
}
public class LocalBinder extends Binder {
@ -345,14 +346,14 @@ public class NSClientService extends Service {
try {
data = (JSONObject) args[0];
} catch (Exception e) {
Crashlytics.log("Wrong Announcement from NS: " + args[0]);
FabricPrivacy.log("Wrong Announcement from NS: " + args[0]);
return;
}
if (Config.detailedLog)
try {
MainApp.bus().post(new EventNSClientNewLog("ANNOUNCEMENT", data.has("message") ? data.getString("message") : "received"));
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
BroadcastAnnouncement.handleAnnouncement(data, getApplicationContext());
log.debug(data.toString());
@ -381,7 +382,7 @@ public class NSClientService extends Service {
try {
data = (JSONObject) args[0];
} catch (Exception e) {
Crashlytics.log("Wrong alarm from NS: " + args[0]);
FabricPrivacy.log("Wrong alarm from NS: " + args[0]);
return;
}
BroadcastAlarm.handleAlarm(data, getApplicationContext());
@ -409,7 +410,7 @@ public class NSClientService extends Service {
try {
data = (JSONObject) args[0];
} catch (Exception e) {
Crashlytics.log("Wrong Urgent alarm from NS: " + args[0]);
FabricPrivacy.log("Wrong Urgent alarm from NS: " + args[0]);
return;
}
if (Config.detailedLog)
@ -434,7 +435,7 @@ public class NSClientService extends Service {
try {
data = (JSONObject) args[0];
} catch (Exception e) {
Crashlytics.log("Wrong Urgent alarm from NS: " + args[0]);
FabricPrivacy.log("Wrong Urgent alarm from NS: " + args[0]);
return;
}
if (Config.detailedLog)
@ -665,7 +666,7 @@ public class NSClientService extends Service {
}
//MainApp.bus().post(new EventNSClientNewLog("NSCLIENT", "onDataUpdate end");
} 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.TextView;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
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.OpenAPSMA.events.EventOpenAPSUpdateGui;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.JSONFormatter;
public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnClickListener {
@ -63,7 +62,7 @@ public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnCli
updateGUI();
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;
@ -74,7 +73,7 @@ public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnCli
switch (view.getId()) {
case R.id.openapsma_run:
OpenAPSAMAPlugin.getPlugin().invoke("OpenAPSAMA button");
Answers.getInstance().logCustom(new CustomEvent("OpenAPS_AMA_Run"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("OpenAPS_AMA_Run"));
break;
}

View file

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

View file

@ -8,7 +8,6 @@ import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
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.OpenAPSMA.events.EventOpenAPSUpdateGui;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.JSONFormatter;
public class OpenAPSSMBFragment extends SubscriberFragment implements View.OnClickListener {
@ -66,7 +66,7 @@ public class OpenAPSSMBFragment extends SubscriberFragment implements View.OnCli
switch (view.getId()) {
case R.id.openapsma_run:
OpenAPSSMBPlugin.getPlugin().invoke("OpenAPSSMB button");
Answers.getInstance().logCustom(new CustomEvent("OpenAPS_SMB_Run"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("OpenAPS_SMB_Run"));
break;
}

View file

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

View file

@ -16,7 +16,6 @@ import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import org.slf4j.Logger;
@ -31,9 +30,9 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SafeParse;
import info.nightscout.utils.ToastUtils;
@ -176,7 +175,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
} else {
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.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
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.Loop.LoopPlugin;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.BolusWizard;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
@ -382,7 +382,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
} else {
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.TextView;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.jjoe64.graphview.GraphView;
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.Treatments.fragments.ProfileViewerDialog;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.BolusWizard;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
@ -342,7 +342,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
log.debug("Runtime Exception", e);
}
@ -698,7 +698,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
scheduleUpdateGUI("onClickAcceptTemp");
}
});
Answers.getInstance().logCustom(new CustomEvent("AcceptTemp"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("AcceptTemp"));
}
});
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.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
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.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.SafeParse;
import info.nightscout.utils.TimeListEdit;
@ -140,7 +140,7 @@ public class LocalProfileFragment extends SubscriberFragment {
return layout;
} catch (Exception e) {
log.error("Unhandled exception: ", e);
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

@ -10,7 +10,6 @@ import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
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.ProfileNS.events.EventNSProfileUpdateGUI;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
public class NSProfileFragment extends SubscriberFragment implements AdapterView.OnItemSelectedListener {
@ -56,7 +56,7 @@ public class NSProfileFragment extends SubscriberFragment implements AdapterView
updateGUI();
return layout;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

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

View file

@ -15,7 +15,7 @@ import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
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.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.SetWarnColor;
public class DanaRFragment extends SubscriberFragment {
@ -101,7 +102,7 @@ public class DanaRFragment extends SubscriberFragment {
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

@ -9,7 +9,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
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.utils.StatusItem;
import info.nightscout.androidaps.plugins.PumpInsight.utils.ui.StatusItemViewAdapter;
import info.nightscout.utils.FabricPrivacy;
public class InsightPumpFragment extends SubscriberFragment {
@ -64,7 +65,7 @@ public class InsightPumpFragment extends SubscriberFragment {
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

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

View file

@ -10,7 +10,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
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.SmsCommunicator.events.EventSmsCommunicatorUpdateGui;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.FabricPrivacy;
/**
* A simple {@link Fragment} subclass.
@ -47,7 +47,7 @@ public class SmsCommunicatorFragment extends SubscriberFragment {
updateGUI();
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

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

View file

@ -12,7 +12,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
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.NSClientInternal.UploadQueue;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload;
/**
@ -63,7 +63,7 @@ public class BGSourceFragment extends SubscriberFragment {
return view;
} catch (Exception e) {
Crashlytics.logException(e);
FabricPrivacy.logException(e);
}
return null;

View file

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

View file

@ -17,7 +17,6 @@ import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
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.NSClientInternal.UploadQueue;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.NSUpload;
@ -155,7 +155,7 @@ public class TreatmentsBolusFragment extends SubscriberFragment implements View.
MainApp.getDbHelper().delete(treatment);
}
updateGUI();
Answers.getInstance().logCustom(new CustomEvent("RemoveTreatment"));
FabricPrivacy.getInstance().logCustom(new CustomEvent("RemoveTreatment"));
}
});
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.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
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.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload;
import info.nightscout.androidaps.data.Intervals;
@ -155,7 +155,7 @@ public class TreatmentsExtendedBolusesFragment extends SubscriberFragment {
UploadQueue.removeID("dbAdd", _id);
}
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);

View file

@ -16,7 +16,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
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.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.FabricPrivacy;
import info.nightscout.utils.NSUpload;
import info.nightscout.androidaps.data.Intervals;
@ -172,7 +172,7 @@ public class TreatmentsTemporaryBasalsFragment extends SubscriberFragment {
UploadQueue.removeID("dbAdd", _id);
}
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);

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.widget.TextView;
import com.crashlytics.android.Crashlytics;
import java.io.BufferedReader;
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_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="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>

View file

@ -122,6 +122,15 @@
android:summary="@string/btwatchdog_summary"/>
</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>
</PreferenceCategory>
</PreferenceScreen>

View file

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