Disable profile switch if not in Engineering mode and on dev branch

This commit is contained in:
Markus M. May 2018-03-15 21:51:43 +01:00
parent e38f10dba0
commit 39aae28101
2 changed files with 11 additions and 2 deletions

View file

@ -201,7 +201,9 @@ public class MainApp extends Application {
} }
}).start(); }).start();
engineeringMode = new File(System.getProperty("EXT_FILES_DIR"),"engineering_mode").canRead(); File engineeringModeSemaphore = new File(System.getProperty("EXT_FILES_DIR"),"engineering_mode");
engineeringMode = engineeringModeSemaphore.exists() && engineeringModeSemaphore.isFile();
devBranch = BuildConfig.VERSION.contains("dev"); devBranch = BuildConfig.VERSION.contains("dev");
if (devBranch && !engineeringMode) { if (devBranch && !engineeringMode) {
@ -374,6 +376,10 @@ public class MainApp extends Application {
return null; return null;
} }
public static boolean isDevModeOrRelease() {
return (devBranch && engineeringMode) || !devBranch;
}
@Override @Override
public void onTerminate() { public void onTerminate() {
super.onTerminate(); super.onTerminate();

View file

@ -127,7 +127,10 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
return; return;
} }
final PumpInterface pump = ConfigBuilderPlugin.getActivePump(); final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
if (!pump.getPumpDescription().isSetBasalProfileCapable || !pump.isInitialized() || pump.isSuspended()) final boolean basalprofileEnabled = MainApp.isDevModeOrRelease()
&& pump.getPumpDescription().isSetBasalProfileCapable;
if (!basalprofileEnabled || !pump.isInitialized() || pump.isSuspended())
profileSwitch.setVisibility(View.GONE); profileSwitch.setVisibility(View.GONE);
else else
profileSwitch.setVisibility(View.VISIBLE); profileSwitch.setVisibility(View.VISIBLE);