Merge jamoto/engineering-mode
This commit is contained in:
commit
e38f10dba0
4 changed files with 20 additions and 1 deletions
|
@ -400,6 +400,8 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||||
builder.setIcon(R.mipmap.blueowl);
|
builder.setIcon(R.mipmap.blueowl);
|
||||||
String message = "Build: " + BuildConfig.BUILDVERSION + "\n";
|
String message = "Build: " + BuildConfig.BUILDVERSION + "\n";
|
||||||
message += MainApp.sResources.getString(R.string.configbuilder_nightscoutversion_label) + " " + ConfigBuilderPlugin.nightscoutVersionName;
|
message += MainApp.sResources.getString(R.string.configbuilder_nightscoutversion_label) + " " + ConfigBuilderPlugin.nightscoutVersionName;
|
||||||
|
if (MainApp.engineeringMode)
|
||||||
|
message += MainApp.gs(R.string.engineering_mode_enabled);
|
||||||
builder.setMessage(message);
|
builder.setMessage(message);
|
||||||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
|
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
|
||||||
AlertDialog alertDialog = builder.create();
|
AlertDialog alertDialog = builder.create();
|
||||||
|
|
|
@ -20,6 +20,7 @@ import net.danlew.android.joda.JodaTimeAndroid;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Services.Intents;
|
import info.nightscout.androidaps.Services.Intents;
|
||||||
|
@ -46,6 +47,8 @@ import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSMA.OpenAPSMAPlugin;
|
import info.nightscout.androidaps.plugins.OpenAPSMA.OpenAPSMAPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSSMB.OpenAPSSMBPlugin;
|
import info.nightscout.androidaps.plugins.OpenAPSSMB.OpenAPSSMBPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
|
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||||
import info.nightscout.androidaps.plugins.Persistentnotification.PersistentNotificationPlugin;
|
import info.nightscout.androidaps.plugins.Persistentnotification.PersistentNotificationPlugin;
|
||||||
import info.nightscout.androidaps.plugins.ProfileLocal.LocalProfilePlugin;
|
import info.nightscout.androidaps.plugins.ProfileLocal.LocalProfilePlugin;
|
||||||
import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin;
|
import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin;
|
||||||
|
@ -95,6 +98,9 @@ public class MainApp extends Application {
|
||||||
private static AckAlarmReceiver ackAlarmReciever = new AckAlarmReceiver();
|
private static AckAlarmReceiver ackAlarmReciever = new AckAlarmReceiver();
|
||||||
private LocalBroadcastManager lbm;
|
private LocalBroadcastManager lbm;
|
||||||
|
|
||||||
|
public static boolean devBranch;
|
||||||
|
public static boolean engineeringMode;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
@ -139,7 +145,7 @@ public class MainApp extends Application {
|
||||||
if (Config.DANAR) pluginsList.add(DanaRv2Plugin.getPlugin());
|
if (Config.DANAR) pluginsList.add(DanaRv2Plugin.getPlugin());
|
||||||
if (Config.DANAR) pluginsList.add(DanaRSPlugin.getPlugin());
|
if (Config.DANAR) pluginsList.add(DanaRSPlugin.getPlugin());
|
||||||
pluginsList.add(CareportalPlugin.getPlugin());
|
pluginsList.add(CareportalPlugin.getPlugin());
|
||||||
// if (Config.DANAR) pluginsList.add(InsightPumpPlugin.getPlugin()); // <-- Enable Insight plugin here
|
if (Config.DANAR && engineeringMode) pluginsList.add(InsightPumpPlugin.getPlugin()); // <-- Enable Insight plugin here
|
||||||
if (Config.MDI) pluginsList.add(MDIPlugin.getPlugin());
|
if (Config.MDI) pluginsList.add(MDIPlugin.getPlugin());
|
||||||
if (Config.VIRTUALPUMP) pluginsList.add(VirtualPumpPlugin.getPlugin());
|
if (Config.VIRTUALPUMP) pluginsList.add(VirtualPumpPlugin.getPlugin());
|
||||||
if (Config.APS) pluginsList.add(LoopPlugin.getPlugin());
|
if (Config.APS) pluginsList.add(LoopPlugin.getPlugin());
|
||||||
|
@ -195,6 +201,13 @@ public class MainApp extends Application {
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
|
|
||||||
|
engineeringMode = new File(System.getProperty("EXT_FILES_DIR"),"engineering_mode").canRead();
|
||||||
|
devBranch = BuildConfig.VERSION.contains("dev");
|
||||||
|
|
||||||
|
if (devBranch && !engineeringMode) {
|
||||||
|
Notification n = new Notification(Notification.TOAST_ALARM, gs(R.string.closed_loop_disabled_on_dev_branch), Notification.NORMAL);
|
||||||
|
bus().post(new EventNewNotification(n));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerLocalBroadcastReceiver() {
|
private void registerLocalBroadcastReceiver() {
|
||||||
|
|
|
@ -102,6 +102,7 @@ public class SafetyPlugin implements PluginBase, ConstraintsInterface {
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public boolean isClosedModeEnabled() {
|
public boolean isClosedModeEnabled() {
|
||||||
|
if (MainApp.devBranch && !MainApp.engineeringMode) return false;
|
||||||
String mode = SP.getString("aps_mode", "open");
|
String mode = SP.getString("aps_mode", "open");
|
||||||
return mode.equals("closed") && BuildConfig.CLOSEDLOOP;
|
return mode.equals("closed") && BuildConfig.CLOSEDLOOP;
|
||||||
}
|
}
|
||||||
|
|
|
@ -971,6 +971,7 @@
|
||||||
<string name="fabric_upload">Fabric Upload</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>
|
<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>
|
||||||
<string name="g5appnotdetected">Please update your G5 app to supported version</string>
|
<string name="g5appnotdetected">Please update your G5 app to supported version</string>
|
||||||
|
|
||||||
<string name="suspendloopfor30min">Suspend for 30 min</string>
|
<string name="suspendloopfor30min">Suspend for 30 min</string>
|
||||||
<string name="start_activity_tt">Start Activity TT</string>
|
<string name="start_activity_tt">Start Activity TT</string>
|
||||||
<string name="start_eating_soon_tt">Start Eating soon TT</string>
|
<string name="start_eating_soon_tt">Start Eating soon TT</string>
|
||||||
|
@ -981,5 +982,7 @@
|
||||||
<string name="bolusrecordedonly">Bolus will be recorded only</string>
|
<string name="bolusrecordedonly">Bolus will be recorded only</string>
|
||||||
<string name="ns_autobackfill">Autobackfill missig BGs from NS</string>
|
<string name="ns_autobackfill">Autobackfill missig BGs from NS</string>
|
||||||
<string name="key_ns_autobackfill" translatable="false">ns_autobackfill</string>
|
<string name="key_ns_autobackfill" translatable="false">ns_autobackfill</string>
|
||||||
|
<string name="closed_loop_disabled_on_dev_branch">Running dev version. Closed loop is disabled</string>
|
||||||
|
<string name="engineering_mode_enabled">Engineering mode enabled</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue