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();
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");
if (devBranch && !engineeringMode) {
@ -374,6 +376,10 @@ public class MainApp extends Application {
return null;
}
public static boolean isDevModeOrRelease() {
return (devBranch && engineeringMode) || !devBranch;
}
@Override
public void onTerminate() {
super.onTerminate();

View file

@ -127,7 +127,10 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
return;
}
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);
else
profileSwitch.setVisibility(View.VISIBLE);