1.33 app start logging optional
This commit is contained in:
parent
2413fae0a9
commit
402768cb87
6 changed files with 35 additions and 25 deletions
|
@ -44,7 +44,7 @@ android {
|
|||
minSdkVersion 21
|
||||
targetSdkVersion 23
|
||||
versionCode 1100
|
||||
version "1.32"
|
||||
version "1.33"
|
||||
buildConfigField "String", "VERSION", '"' + version + '"'
|
||||
buildConfigField "String", "BUILDVERSION", generateGitBuild()
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import android.preference.PreferenceFragment;
|
|||
import android.preference.PreferenceGroup;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||
import info.nightscout.androidaps.events.EventRefreshGui;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
|
@ -50,14 +49,14 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
|||
updatePrefSummary(myPreferenceFragment.getPreference(key));
|
||||
}
|
||||
|
||||
private static void updatePrefSummary(Preference pref) {
|
||||
private static void updatePrefSummary(Preference pref) {
|
||||
if (pref instanceof ListPreference || pref instanceof BluetoothDevicePreference) {
|
||||
ListPreference listPref = (ListPreference) pref;
|
||||
pref.setSummary(listPref.getEntry());
|
||||
}
|
||||
if (pref instanceof EditTextPreference) {
|
||||
EditTextPreference editTextPref = (EditTextPreference) pref;
|
||||
if (pref.getKey().contains("password")|| pref.getKey().contains("secret")) {
|
||||
if (pref.getKey().contains("password") || pref.getKey().contains("secret")) {
|
||||
pref.setSummary("******");
|
||||
} else if (editTextPref.getText() != null && !editTextPref.getText().equals("")) {
|
||||
((EditTextPreference) pref).setDialogMessage(editTextPref.getDialogMessage());
|
||||
|
@ -119,11 +118,11 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
|||
}
|
||||
VirtualPumpPlugin virtualPumpPlugin = (VirtualPumpPlugin) MainApp.getSpecificPlugin(VirtualPumpPlugin.class);
|
||||
if (virtualPumpPlugin != null && virtualPumpPlugin.isEnabled(PluginBase.PUMP)) {
|
||||
addPreferencesFromResource(R.xml.pref_virtualpump);
|
||||
addPreferencesFromResource(R.xml.pref_virtualpump);
|
||||
}
|
||||
NSClientInternalPlugin nsClientInternalPlugin = (NSClientInternalPlugin) MainApp.getSpecificPlugin(NSClientInternalPlugin.class);
|
||||
if (nsClientInternalPlugin != null && nsClientInternalPlugin.isEnabled(PluginBase.GENERAL)) {
|
||||
addPreferencesFromResource(R.xml.pref_nsclientinternal);
|
||||
addPreferencesFromResource(R.xml.pref_nsclientinternal);
|
||||
}
|
||||
if (Config.SMSCOMMUNICATORENABLED)
|
||||
addPreferencesFromResource(R.xml.pref_smscommunicator);
|
||||
|
@ -131,7 +130,6 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
|||
addPreferencesFromResource(R.xml.pref_others);
|
||||
addPreferencesFromResource(R.xml.pref_advanced);
|
||||
}
|
||||
initSummary(getPreferenceScreen());
|
||||
|
||||
if (Config.WEAR) {
|
||||
WearPlugin wearPlugin = (WearPlugin) MainApp.getSpecificPlugin(WearPlugin.class);
|
||||
|
@ -139,9 +137,11 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
|||
addPreferencesFromResource(R.xml.pref_wear);
|
||||
}
|
||||
}
|
||||
|
||||
initSummary(getPreferenceScreen());
|
||||
}
|
||||
|
||||
public Preference getPreference (String key) {
|
||||
public Preference getPreference(String key) {
|
||||
return findPreference(key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ import info.nightscout.androidaps.plugins.NSClientInternal.data.DbLogger;
|
|||
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSProfile;
|
||||
import info.nightscout.utils.BatteryLevel;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.SP;
|
||||
|
||||
/**
|
||||
* Created by mike on 05.08.2016.
|
||||
|
@ -1128,24 +1129,26 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
}
|
||||
|
||||
public void uploadAppStart() {
|
||||
Context context = MainApp.instance().getApplicationContext();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("action", "dbAdd");
|
||||
bundle.putString("collection", "treatments");
|
||||
JSONObject data = new JSONObject();
|
||||
try {
|
||||
data.put("eventType", "Note");
|
||||
data.put("created_at", DateUtil.toISOString(new Date()));
|
||||
data.put("notes", MainApp.sResources.getString(R.string.androidaps_start));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
if (SP.getBoolean(R.string.key_ns_logappstartedevent, true)) {
|
||||
Context context = MainApp.instance().getApplicationContext();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("action", "dbAdd");
|
||||
bundle.putString("collection", "treatments");
|
||||
JSONObject data = new JSONObject();
|
||||
try {
|
||||
data.put("eventType", "Note");
|
||||
data.put("created_at", DateUtil.toISOString(new Date()));
|
||||
data.put("notes", MainApp.sResources.getString(R.string.androidaps_start));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
bundle.putString("data", data.toString());
|
||||
Intent intent = new Intent(Intents.ACTION_DATABASE);
|
||||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
context.sendBroadcast(intent);
|
||||
DbLogger.dbAdd(intent, data.toString(), ConfigBuilderPlugin.class);
|
||||
}
|
||||
bundle.putString("data", data.toString());
|
||||
Intent intent = new Intent(Intents.ACTION_DATABASE);
|
||||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
context.sendBroadcast(intent);
|
||||
DbLogger.dbAdd(intent, data.toString(), ConfigBuilderPlugin.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -531,4 +531,5 @@
|
|||
<string name="smscommunicator_remotecommandnotallowed">Vzdálení příkaz není povolen</string>
|
||||
<string name="smscommunicator_suspendreplywithcode" formatted="false">K pozastavení smyčky na %d minut odpověz SMS s kódem %s</string>
|
||||
<string name="smscommunicator_wrongduration">Chybná doba trvání</string>
|
||||
<string name="ns_logappstartedevent">Logovat spuštění aplikace do NS</string>
|
||||
</resources>
|
||||
|
|
|
@ -581,4 +581,6 @@
|
|||
<string name="treatments_wizard_bgtrend_label">15min trend</string>
|
||||
<string name="treatments_wizard_cob_label">COB</string>
|
||||
<string name="treatments_wizard_sb_label">Superbolus</string>
|
||||
<string name="ns_logappstartedevent">Log app start to NS</string>
|
||||
<string name="key_ns_logappstartedevent" translatable="false">ns_logappstartedevent</string>
|
||||
</resources>
|
||||
|
|
|
@ -21,6 +21,10 @@
|
|||
android:defaultValue=""
|
||||
android:inputType="textPassword">
|
||||
</EditTextPreference>
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/key_ns_logappstartedevent"
|
||||
android:title="@string/ns_logappstartedevent" />
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
Loading…
Reference in a new issue