productFlavors

This commit is contained in:
Milos Kozak 2016-07-15 23:53:14 +02:00
parent ce7cddc1da
commit 9bd807ea0d
3 changed files with 35 additions and 9 deletions

View file

@ -32,6 +32,32 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
} }
productFlavors {
careportal {
buildConfigField "boolean", "APS", "false"
buildConfigField "boolean", "PUMPDRIVERS", "false"
buildConfigField "boolean", "OBJECTIVES", "false"
buildConfigField "boolean", "CLOSEDLOOP", "false"
}
openloop {
buildConfigField "boolean", "APS", "true"
buildConfigField "boolean", "PUMPDRIVERS", "true"
buildConfigField "boolean", "OBJECTIVES", "false"
buildConfigField "boolean", "CLOSEDLOOP", "false"
}
full {
buildConfigField "boolean", "APS", "true"
buildConfigField "boolean", "PUMPDRIVERS", "true"
buildConfigField "boolean", "OBJECTIVES", "true"
buildConfigField "boolean", "CLOSEDLOOP", "true"
}
full_noobjectives {
buildConfigField "boolean", "APS", "true"
buildConfigField "boolean", "PUMPDRIVERS", "true"
buildConfigField "boolean", "OBJECTIVES", "false"
buildConfigField "boolean", "CLOSEDLOOP", "true"
}
}
} }
dependencies { dependencies {

View file

@ -5,19 +5,18 @@ package info.nightscout.androidaps;
*/ */
public class Config { public class Config {
// MAIN FUCTIONALITY // MAIN FUCTIONALITY
public static final boolean APS = true; public static final boolean APS = BuildConfig.APS;
// PLUGINS // PLUGINS
public static final boolean LOWSUSPEDENABLED = APS && true; public static final boolean LOWSUSPEDENABLED = APS;
public static final boolean OPENAPSMAENABLED = APS && true; public static final boolean OPENAPSMAENABLED = APS;
public static final boolean LOOPENABLED = APS && true; public static final boolean LOOPENABLED = APS;
public static final boolean OBJECTIVESENABLED = APS && true; public static final boolean OBJECTIVESENABLED = APS && BuildConfig.OBJECTIVES;
public static final boolean CAREPORTALENABLED = true; public static final boolean CAREPORTALENABLED = true;
public static final boolean SMSCOMMUNICATORENABLED = true; public static final boolean SMSCOMMUNICATORENABLED = true;
public static final boolean DANAR = true; public static final boolean DANAR = true && BuildConfig.PUMPDRIVERS;
public static final boolean MM640G = false && BuildConfig.PUMPDRIVERS;
public static final boolean MM640G = true;
public static final boolean detailedLog = true; public static final boolean detailedLog = true;
public static final boolean logFunctionCalls = true; public static final boolean logFunctionCalls = true;

View file

@ -8,6 +8,7 @@ import android.support.v4.app.Fragment;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
@ -74,7 +75,7 @@ public class SafetyFragment extends Fragment implements PluginBase, ConstraintsI
public boolean isClosedModeEnabled() { public boolean isClosedModeEnabled() {
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext()); SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
String mode = SP.getString("aps_mode", "open"); String mode = SP.getString("aps_mode", "open");
return mode.equals("closed"); return mode.equals("closed") && BuildConfig.CLOSEDLOOP;
} }
@Override @Override