Merge branch 'dev' into bug_2111_pump_stopped_when_not
This commit is contained in:
commit
9f8df64f45
|
@ -109,7 +109,7 @@ android {
|
|||
targetSdkVersion 28
|
||||
multiDexEnabled true
|
||||
versionCode 1500
|
||||
version "2.4-dev-i"
|
||||
version "2.4-dev-j"
|
||||
buildConfigField "String", "VERSION", '"' + version + '"'
|
||||
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
|
||||
buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"'
|
||||
|
|
|
@ -12,13 +12,4 @@ public class Config {
|
|||
public static final boolean PUMPCONTROL = BuildConfig.FLAVOR.equals("pumpcontrol");
|
||||
|
||||
public static final boolean PUMPDRIVERS = BuildConfig.FLAVOR.equals("full") || BuildConfig.FLAVOR.equals("pumpcontrol");
|
||||
|
||||
public static final boolean ACTION = !NSCLIENT;
|
||||
public static final boolean MDI = !NSCLIENT;
|
||||
public static final boolean OTHERPROFILES = !NSCLIENT;
|
||||
public static final boolean SAFETY = !NSCLIENT;
|
||||
|
||||
public static final boolean SMSCOMMUNICATORENABLED = !NSCLIENT;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.content.pm.PackageManager;
|
|||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.os.PersistableBundle;
|
||||
import android.os.PowerManager;
|
||||
import android.text.SpannableString;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.util.Linkify;
|
||||
|
@ -53,8 +52,8 @@ import info.nightscout.androidaps.logging.L;
|
|||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||
import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerUtilsKt;
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus;
|
||||
import info.nightscout.androidaps.plugins.general.versionChecker.VersionCheckerUtilsKt;
|
||||
import info.nightscout.androidaps.setupwizard.SetupWizardActivity;
|
||||
import info.nightscout.androidaps.tabs.TabPageAdapter;
|
||||
import info.nightscout.androidaps.utils.AndroidPermission;
|
||||
|
@ -70,8 +69,6 @@ public class MainActivity extends NoSplashAppCompatActivity {
|
|||
private static Logger log = LoggerFactory.getLogger(L.CORE);
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
||||
protected PowerManager.WakeLock mWakeLock;
|
||||
|
||||
private ActionBarDrawerToggle actionBarDrawerToggle;
|
||||
|
||||
private MenuItem pluginPreferencesMenuItem;
|
||||
|
@ -154,12 +151,7 @@ public class MainActivity extends NoSplashAppCompatActivity {
|
|||
setupTabs();
|
||||
setupViews();
|
||||
}
|
||||
|
||||
boolean keepScreenOn = Config.NSCLIENT && SP.getBoolean(R.string.key_keep_screen_on, false);
|
||||
if (keepScreenOn)
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
else
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
setWakeLock();
|
||||
}, FabricPrivacy::logException)
|
||||
);
|
||||
disposable.add(RxBus.INSTANCE
|
||||
|
@ -183,33 +175,23 @@ public class MainActivity extends NoSplashAppCompatActivity {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (mWakeLock != null)
|
||||
if (mWakeLock.isHeld())
|
||||
mWakeLock.release();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
disposable.clear();
|
||||
}
|
||||
|
||||
private void setWakeLock() {
|
||||
boolean keepScreenOn = SP.getBoolean(R.string.key_keep_screen_on, false);
|
||||
if (keepScreenOn)
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
else
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
|
||||
public void processPreferenceChange(final EventPreferenceChange ev) {
|
||||
if (ev.isChanged(R.string.key_keep_screen_on)) {
|
||||
boolean keepScreenOn = SP.getBoolean(R.string.key_keep_screen_on, false);
|
||||
final PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||
if (keepScreenOn) {
|
||||
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "AndroidAPS:MainActivity_onEventPreferenceChange");
|
||||
if (!mWakeLock.isHeld())
|
||||
mWakeLock.acquire();
|
||||
} else {
|
||||
if (mWakeLock != null && mWakeLock.isHeld())
|
||||
mWakeLock.release();
|
||||
}
|
||||
}
|
||||
if (ev.isChanged(R.string.key_keep_screen_on))
|
||||
setWakeLock();
|
||||
}
|
||||
|
||||
private void setupViews() {
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.content.IntentFilter;
|
|||
import android.content.res.Resources;
|
||||
import android.os.SystemClock;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.PluralsRes;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
|
@ -49,9 +48,9 @@ import info.nightscout.androidaps.plugins.general.nsclient.receivers.AckAlarmRec
|
|||
import info.nightscout.androidaps.plugins.general.nsclient.receivers.DBAccessReceiver;
|
||||
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
|
||||
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin;
|
||||
import info.nightscout.androidaps.plugins.general.signatureVerifier.SignatureVerifier;
|
||||
import info.nightscout.androidaps.plugins.constraints.signatureVerifier.SignatureVerifierPlugin;
|
||||
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin;
|
||||
import info.nightscout.androidaps.plugins.general.versionChecker.VersionCheckerPlugin;
|
||||
import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerPlugin;
|
||||
import info.nightscout.androidaps.plugins.general.wear.WearPlugin;
|
||||
import info.nightscout.androidaps.plugins.general.xdripStatusline.StatuslinePlugin;
|
||||
import info.nightscout.androidaps.plugins.insulin.InsulinOrefFreePeakPlugin;
|
||||
|
@ -91,7 +90,7 @@ import info.nightscout.androidaps.services.Intents;
|
|||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
|
||||
import static info.nightscout.androidaps.plugins.general.versionChecker.VersionCheckerUtilsKt.triggerCheckVersion;
|
||||
import static info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerUtilsKt.triggerCheckVersion;
|
||||
|
||||
|
||||
public class MainApp extends Application {
|
||||
|
@ -164,7 +163,7 @@ public class MainApp extends Application {
|
|||
// Register all tabs in app here
|
||||
pluginsList.add(OverviewPlugin.INSTANCE);
|
||||
pluginsList.add(IobCobCalculatorPlugin.getPlugin());
|
||||
if (Config.ACTION) pluginsList.add(ActionsPlugin.INSTANCE);
|
||||
if (!Config.NSCLIENT) pluginsList.add(ActionsPlugin.INSTANCE);
|
||||
pluginsList.add(InsulinOrefRapidActingPlugin.getPlugin());
|
||||
pluginsList.add(InsulinOrefUltraRapidActingPlugin.getPlugin());
|
||||
pluginsList.add(InsulinOrefFreePeakPlugin.getPlugin());
|
||||
|
@ -177,25 +176,24 @@ public class MainApp extends Application {
|
|||
if (Config.PUMPDRIVERS) pluginsList.add(DanaRv2Plugin.getPlugin());
|
||||
if (Config.PUMPDRIVERS) pluginsList.add(DanaRSPlugin.getPlugin());
|
||||
if (Config.PUMPDRIVERS) pluginsList.add(LocalInsightPlugin.getPlugin());
|
||||
pluginsList.add(CareportalPlugin.getPlugin());
|
||||
if (Config.PUMPDRIVERS) pluginsList.add(ComboPlugin.getPlugin());
|
||||
if (Config.PUMPDRIVERS && engineeringMode)
|
||||
pluginsList.add(MedtronicPumpPlugin.getPlugin());
|
||||
if (Config.MDI) pluginsList.add(MDIPlugin.getPlugin());
|
||||
if (Config.PUMPDRIVERS) pluginsList.add(MedtronicPumpPlugin.getPlugin());
|
||||
if (!Config.NSCLIENT) pluginsList.add(MDIPlugin.getPlugin());
|
||||
pluginsList.add(VirtualPumpPlugin.getPlugin());
|
||||
pluginsList.add(CareportalPlugin.getPlugin());
|
||||
if (Config.APS) pluginsList.add(LoopPlugin.getPlugin());
|
||||
if (Config.APS) pluginsList.add(OpenAPSMAPlugin.getPlugin());
|
||||
if (Config.APS) pluginsList.add(OpenAPSAMAPlugin.getPlugin());
|
||||
if (Config.APS) pluginsList.add(OpenAPSSMBPlugin.getPlugin());
|
||||
pluginsList.add(NSProfilePlugin.getPlugin());
|
||||
if (Config.OTHERPROFILES) pluginsList.add(SimpleProfilePlugin.getPlugin());
|
||||
if (Config.OTHERPROFILES) pluginsList.add(LocalProfilePlugin.getPlugin());
|
||||
if (!Config.NSCLIENT) pluginsList.add(SimpleProfilePlugin.getPlugin());
|
||||
if (!Config.NSCLIENT) pluginsList.add(LocalProfilePlugin.getPlugin());
|
||||
pluginsList.add(TreatmentsPlugin.getPlugin());
|
||||
if (Config.SAFETY) pluginsList.add(SafetyPlugin.getPlugin());
|
||||
if (Config.SAFETY) pluginsList.add(VersionCheckerPlugin.INSTANCE);
|
||||
if (Config.SAFETY) pluginsList.add(StorageConstraintPlugin.getPlugin());
|
||||
if (Config.SAFETY) pluginsList.add(SignatureVerifier.getPlugin());
|
||||
if (Config.APS) pluginsList.add(ObjectivesPlugin.INSTANCE);
|
||||
if (!Config.NSCLIENT) pluginsList.add(SafetyPlugin.getPlugin());
|
||||
if (!Config.NSCLIENT) pluginsList.add(VersionCheckerPlugin.INSTANCE);
|
||||
if (!Config.NSCLIENT) pluginsList.add(StorageConstraintPlugin.getPlugin());
|
||||
if (!Config.NSCLIENT) pluginsList.add(SignatureVerifierPlugin.getPlugin());
|
||||
if (!Config.APS) pluginsList.add(ObjectivesPlugin.INSTANCE);
|
||||
pluginsList.add(SourceXdripPlugin.getPlugin());
|
||||
pluginsList.add(SourceNSClientPlugin.getPlugin());
|
||||
pluginsList.add(SourceMM640gPlugin.getPlugin());
|
||||
|
@ -204,7 +202,7 @@ public class MainApp extends Application {
|
|||
pluginsList.add(SourcePoctechPlugin.getPlugin());
|
||||
pluginsList.add(SourceTomatoPlugin.getPlugin());
|
||||
pluginsList.add(SourceEversensePlugin.getPlugin());
|
||||
if (Config.SMSCOMMUNICATORENABLED) pluginsList.add(SmsCommunicatorPlugin.getPlugin());
|
||||
if (!Config.NSCLIENT) pluginsList.add(SmsCommunicatorPlugin.getPlugin());
|
||||
pluginsList.add(FoodPlugin.getPlugin());
|
||||
|
||||
pluginsList.add(WearPlugin.initPlugin(this));
|
||||
|
@ -380,19 +378,6 @@ public class MainApp extends Application {
|
|||
return newList;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static <T extends PluginBase> T getSpecificPlugin(Class<T> pluginClass) {
|
||||
if (pluginsList != null) {
|
||||
for (PluginBase p : pluginsList) {
|
||||
if (pluginClass.isAssignableFrom(p.getClass()))
|
||||
return (T) p;
|
||||
}
|
||||
} else {
|
||||
log.error("pluginsList=null");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isEngineeringModeOrRelease() {
|
||||
if (!Config.APS)
|
||||
return true;
|
||||
|
|
|
@ -536,11 +536,11 @@ public class TDDStatsActivity extends NoSplashActivity {
|
|||
|
||||
public static boolean isOldData(List<TDD> historyList) {
|
||||
Object activePump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||
PumpInterface dana = MainApp.getSpecificPlugin(DanaRPlugin.class);
|
||||
PumpInterface danaRS = MainApp.getSpecificPlugin(DanaRSPlugin.class);
|
||||
PumpInterface danaV2 = MainApp.getSpecificPlugin(DanaRv2Plugin.class);
|
||||
PumpInterface danaKorean = MainApp.getSpecificPlugin(DanaRKoreanPlugin.class);
|
||||
PumpInterface insight = MainApp.getSpecificPlugin(LocalInsightPlugin.class);
|
||||
PumpInterface dana = DanaRPlugin.getPlugin();
|
||||
PumpInterface danaRS = DanaRSPlugin.getPlugin();
|
||||
PumpInterface danaV2 = DanaRv2Plugin.getPlugin();
|
||||
PumpInterface danaKorean = DanaRKoreanPlugin.getPlugin();
|
||||
PumpInterface insight = LocalInsightPlugin.getPlugin();
|
||||
|
||||
boolean startsYesterday = activePump == dana || activePump == danaRS || activePump == danaV2 || activePump == danaKorean || activePump == insight;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.general.signatureVerifier;
|
||||
package info.nightscout.androidaps.plugins.constraints.signatureVerifier;
|
||||
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.Signature;
|
||||
|
@ -42,23 +42,23 @@ import info.nightscout.androidaps.utils.SP;
|
|||
* In case someone decides to leak a ready-to-use APK nonetheless, we can still disable it.
|
||||
* Self-compiled APKs with privately held certificates cannot and will not be disabled.
|
||||
*/
|
||||
public class SignatureVerifier extends PluginBase implements ConstraintsInterface {
|
||||
public class SignatureVerifierPlugin extends PluginBase implements ConstraintsInterface {
|
||||
|
||||
private static final String REVOKED_CERTS_URL = "https://raw.githubusercontent.com/MilosKozak/AndroidAPS/master/app/src/main/assets/revoked_certs.txt";
|
||||
private static final long UPDATE_INTERVAL = TimeUnit.DAYS.toMillis(1);
|
||||
|
||||
private static SignatureVerifier plugin = new SignatureVerifier();
|
||||
private static SignatureVerifierPlugin plugin = new SignatureVerifierPlugin();
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(L.CORE);
|
||||
private final Object $lock = new Object[0];
|
||||
private File revokedCertsFile;
|
||||
private List<byte[]> revokedCerts;
|
||||
|
||||
public static SignatureVerifier getPlugin() {
|
||||
public static SignatureVerifierPlugin getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
private SignatureVerifier() {
|
||||
private SignatureVerifierPlugin() {
|
||||
super(new PluginDescription()
|
||||
.mainType(PluginType.CONSTRAINTS)
|
||||
.neverVisible(true)
|
||||
|
@ -124,14 +124,51 @@ public class SignatureVerifier extends PluginBase implements ConstraintsInterfac
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
log.error("Error in SignatureVerifier", e);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
log.error("Error in SignatureVerifier", e);
|
||||
} catch (PackageManager.NameNotFoundException | NoSuchAlgorithmException e) {
|
||||
log.error("Error in SignatureVerifierPlugin", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<String> shortHashes() {
|
||||
List<String> hashes = new ArrayList<>();
|
||||
try {
|
||||
Signature[] signatures = MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), PackageManager.GET_SIGNATURES).signatures;
|
||||
if (signatures != null) {
|
||||
for (Signature signature : signatures) {
|
||||
MessageDigest digest = MessageDigest.getInstance("SHA256");
|
||||
byte[] fingerprint = digest.digest(signature.toByteArray());
|
||||
String hash = Hex.toHexString(fingerprint);
|
||||
log.debug("Found signature: " + hash);
|
||||
log.debug("Found signature (short): " + singleCharMap(fingerprint));
|
||||
hashes.add(singleCharMap(fingerprint));
|
||||
}
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException | NoSuchAlgorithmException e) {
|
||||
log.error("Error in SignatureVerifierPlugin", e);
|
||||
}
|
||||
return hashes;
|
||||
}
|
||||
|
||||
String map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"§$%&/()=?,.-;:_<>|°^`´\\@€*'#+~{}[]¿¡áéíóúàèìòùöäü`ÁÉÍÓÚÀÈÌÒÙÖÄÜßÆÇÊËÎÏԌ۟æçêëîïôœûÿĆČĐŠŽćđšžñΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ\u03A2ΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρςστυφχψωϨϩϪϫϬϭϮϯϰϱϲϳϴϵ϶ϷϸϹϺϻϼϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВГДЕЖЗ";
|
||||
|
||||
private String singleCharMap(byte[] array) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (byte b : array) {
|
||||
sb.append(map.charAt(b & 0xFF));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private String singleCharUnMap(String shortHash) {
|
||||
byte[] array = new byte[shortHash.length()];
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
sb.append(String.format("%02x",(int) map.charAt(map.indexOf(shortHash.charAt(i)))));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private boolean shouldDownloadCerts() {
|
||||
return System.currentTimeMillis() - SP.getLong(R.string.key_last_revoked_certs_check, 0L) >= UPDATE_INTERVAL;
|
||||
}
|
||||
|
@ -153,7 +190,7 @@ public class SignatureVerifier extends PluginBase implements ConstraintsInterfac
|
|||
this.revokedCerts = parseRevokedCertsFile(revokedCerts);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("Error in SignatureVerifier", e);
|
||||
log.error("Error in SignatureVerifierPlugin", e);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.general.versionChecker
|
||||
package info.nightscout.androidaps.plugins.constraints.versionChecker
|
||||
|
||||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.R
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.general.versionChecker
|
||||
package info.nightscout.androidaps.plugins.constraints.versionChecker
|
||||
|
||||
import android.content.Context
|
||||
import android.net.ConnectivityManager
|
|
@ -29,7 +29,7 @@ class AutomationFragment : Fragment() {
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
eventListAdapter = EventListAdapter(AutomationPlugin.automationEvents, fragmentManager)
|
||||
eventListAdapter = EventListAdapter(AutomationPlugin.automationEvents, fragmentManager, activity)
|
||||
automation_eventListView.layoutManager = LinearLayoutManager(context)
|
||||
automation_eventListView.adapter = eventListAdapter
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.general.automation;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -26,14 +27,17 @@ import info.nightscout.androidaps.plugins.general.automation.actions.Action;
|
|||
import info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDialog;
|
||||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationDataChanged;
|
||||
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerConnector;
|
||||
import info.nightscout.androidaps.utils.OKDialog;
|
||||
|
||||
class EventListAdapter extends RecyclerView.Adapter<EventListAdapter.ViewHolder> {
|
||||
private final List<AutomationEvent> mEventList;
|
||||
private final FragmentManager mFragmentManager;
|
||||
private final List<AutomationEvent> eventList;
|
||||
private final FragmentManager fragmentManager;
|
||||
private final Activity activity;
|
||||
|
||||
EventListAdapter(List<AutomationEvent> events, FragmentManager fragmentManager) {
|
||||
this.mEventList = events;
|
||||
this.mFragmentManager = fragmentManager;
|
||||
EventListAdapter(List<AutomationEvent> events, FragmentManager fragmentManager, Activity activity) {
|
||||
this.eventList = events;
|
||||
this.fragmentManager = fragmentManager;
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
@ -52,7 +56,7 @@ class EventListAdapter extends RecyclerView.Adapter<EventListAdapter.ViewHolder>
|
|||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
final AutomationEvent event = mEventList.get(position);
|
||||
final AutomationEvent event = eventList.get(position);
|
||||
holder.eventTitle.setText(event.getTitle());
|
||||
holder.enabled.setChecked(event.isEnabled());
|
||||
holder.iconLayout.removeAllViews();
|
||||
|
@ -82,16 +86,18 @@ class EventListAdapter extends RecyclerView.Adapter<EventListAdapter.ViewHolder>
|
|||
}
|
||||
|
||||
// enabled event
|
||||
holder.enabled.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
event.setEnabled(isChecked);
|
||||
holder.enabled.setOnClickListener(v -> {
|
||||
event.setEnabled((holder.enabled.isChecked()));
|
||||
RxBus.INSTANCE.send(new EventAutomationDataChanged());
|
||||
});
|
||||
|
||||
// remove event
|
||||
holder.iconTrash.setOnClickListener(v -> {
|
||||
mEventList.remove(event);
|
||||
RxBus.INSTANCE.send(new EventAutomationDataChanged());
|
||||
});
|
||||
holder.iconTrash.setOnClickListener(v ->
|
||||
OKDialog.showConfirmation(activity, MainApp.gs(R.string.removerecord) + " " + event.getTitle(), () -> {
|
||||
eventList.remove(event);
|
||||
RxBus.INSTANCE.send(new EventAutomationDataChanged());
|
||||
})
|
||||
);
|
||||
|
||||
// edit event
|
||||
holder.rootLayout.setOnClickListener(v -> {
|
||||
|
@ -101,14 +107,14 @@ class EventListAdapter extends RecyclerView.Adapter<EventListAdapter.ViewHolder>
|
|||
args.putString("event", event.toJSON());
|
||||
args.putInt("position", position);
|
||||
dialog.setArguments(args);
|
||||
if (mFragmentManager != null)
|
||||
dialog.show(mFragmentManager, "EditEventDialog");
|
||||
if (fragmentManager != null)
|
||||
dialog.show(fragmentManager, "EditEventDialog");
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mEventList.size();
|
||||
return eventList.size();
|
||||
}
|
||||
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
|
|
|
@ -122,8 +122,7 @@ public class FoodFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
|
||||
RecyclerViewAdapter adapter = new RecyclerViewAdapter(MainApp
|
||||
.getSpecificPlugin(FoodPlugin.class).getService().getFoodData());
|
||||
RecyclerViewAdapter adapter = new RecyclerViewAdapter(FoodPlugin.getPlugin().getService().getFoodData());
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
loadData();
|
||||
|
@ -151,7 +150,7 @@ public class FoodFragment extends Fragment {
|
|||
}
|
||||
|
||||
void loadData() {
|
||||
unfiltered = MainApp.getSpecificPlugin(FoodPlugin.class).getService().getFoodData();
|
||||
unfiltered = FoodPlugin.getPlugin().getService().getFoodData();
|
||||
}
|
||||
|
||||
void fillCategories() {
|
||||
|
@ -297,7 +296,7 @@ public class FoodFragment extends Fragment {
|
|||
if (_id != null && !_id.equals("")) {
|
||||
NSUpload.removeFoodFromNS(_id);
|
||||
}
|
||||
MainApp.getSpecificPlugin(FoodPlugin.class).getService().delete(food);
|
||||
FoodPlugin.getPlugin().getService().delete(food);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
|
||||
|
|
|
@ -27,7 +27,7 @@ public class AckAlarmReceiver extends BroadcastReceiver {
|
|||
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||
PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
|
||||
AckAlarmReceiver.class.getSimpleName());
|
||||
NSClientPlugin nsClientPlugin = MainApp.getSpecificPlugin(NSClientPlugin.class);
|
||||
NSClientPlugin nsClientPlugin = NSClientPlugin.getPlugin();
|
||||
if (!nsClientPlugin.isEnabled(PluginType.GENERAL)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ public class DBAccessReceiver extends BroadcastReceiver {
|
|||
}
|
||||
|
||||
public boolean shouldUpload() {
|
||||
NSClientPlugin nsClientPlugin = MainApp.getSpecificPlugin(NSClientPlugin.class);
|
||||
NSClientPlugin nsClientPlugin = NSClientPlugin.getPlugin();
|
||||
return nsClientPlugin.isEnabled(PluginType.GENERAL) && !SP.getBoolean(R.string.key_ns_noupload, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -265,10 +265,10 @@ public class NSClientService extends Service {
|
|||
nsAPIhashCode = Hashing.sha1().hashString(nsAPISecret, Charsets.UTF_8).toString();
|
||||
|
||||
RxBus.INSTANCE.send(new EventNSClientStatus("Initializing"));
|
||||
if (!MainApp.getSpecificPlugin(NSClientPlugin.class).isAllowed()) {
|
||||
if (!NSClientPlugin.getPlugin().isAllowed()) {
|
||||
RxBus.INSTANCE.send(new EventNSClientNewLog("NSCLIENT", "not allowed"));
|
||||
RxBus.INSTANCE.send(new EventNSClientStatus("Not allowed"));
|
||||
} else if (MainApp.getSpecificPlugin(NSClientPlugin.class).paused) {
|
||||
} else if (NSClientPlugin.getPlugin().paused) {
|
||||
RxBus.INSTANCE.send(new EventNSClientNewLog("NSCLIENT", "paused"));
|
||||
RxBus.INSTANCE.send(new EventNSClientStatus("Paused"));
|
||||
} else if (!nsEnabled) {
|
||||
|
@ -386,7 +386,7 @@ public class NSClientService extends Service {
|
|||
}
|
||||
|
||||
public void readPreferences() {
|
||||
nsEnabled = MainApp.getSpecificPlugin(NSClientPlugin.class).isEnabled(PluginType.GENERAL);
|
||||
nsEnabled = NSClientPlugin.getPlugin().isEnabled(PluginType.GENERAL);
|
||||
nsURL = SP.getString(R.string.key_nsclientinternal_url, "");
|
||||
nsAPISecret = SP.getString(R.string.key_nsclientinternal_api_secret, "");
|
||||
nsDevice = SP.getString("careportal_enteredby", "");
|
||||
|
|
|
@ -1146,7 +1146,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
}
|
||||
|
||||
// **** Calibration & CGM buttons ****
|
||||
boolean xDripIsBgSource = MainApp.getSpecificPlugin(SourceXdripPlugin.class) != null && MainApp.getSpecificPlugin(SourceXdripPlugin.class).isEnabled(PluginType.BGSOURCE);
|
||||
boolean xDripIsBgSource = SourceXdripPlugin.getPlugin().isEnabled(PluginType.BGSOURCE);
|
||||
boolean dexcomIsSource = SourceDexcomPlugin.INSTANCE.isEnabled(PluginType.BGSOURCE);
|
||||
boolean bgAvailable = DatabaseHelper.actualBg() != null;
|
||||
if (calibrationButton != null) {
|
||||
|
|
|
@ -310,8 +310,8 @@ public class SmsCommunicatorPlugin extends PluginBase {
|
|||
switch (splitted[1].toUpperCase()) {
|
||||
case "DISABLE":
|
||||
case "STOP":
|
||||
LoopPlugin loopPlugin = MainApp.getSpecificPlugin(LoopPlugin.class);
|
||||
if (loopPlugin != null && loopPlugin.isEnabled(PluginType.LOOP)) {
|
||||
LoopPlugin loopPlugin = LoopPlugin.getPlugin();
|
||||
if (loopPlugin.isEnabled(PluginType.LOOP)) {
|
||||
loopPlugin.setPluginEnabled(PluginType.LOOP, false);
|
||||
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, new Callback() {
|
||||
@Override
|
||||
|
@ -329,8 +329,8 @@ public class SmsCommunicatorPlugin extends PluginBase {
|
|||
break;
|
||||
case "ENABLE":
|
||||
case "START":
|
||||
loopPlugin = MainApp.getSpecificPlugin(LoopPlugin.class);
|
||||
if (loopPlugin != null && !loopPlugin.isEnabled(PluginType.LOOP)) {
|
||||
loopPlugin = LoopPlugin.getPlugin();
|
||||
if (!loopPlugin.isEnabled(PluginType.LOOP)) {
|
||||
loopPlugin.setPluginEnabled(PluginType.LOOP, true);
|
||||
sendSMS(new Sms(receivedSms.phoneNumber, R.string.smscommunicator_loophasbeenenabled));
|
||||
RxBus.INSTANCE.send(new EventRefreshOverview("SMS_LOOP_START"));
|
||||
|
@ -340,18 +340,16 @@ public class SmsCommunicatorPlugin extends PluginBase {
|
|||
receivedSms.processed = true;
|
||||
break;
|
||||
case "STATUS":
|
||||
loopPlugin = MainApp.getSpecificPlugin(LoopPlugin.class);
|
||||
if (loopPlugin != null) {
|
||||
if (loopPlugin.isEnabled(PluginType.LOOP)) {
|
||||
if (loopPlugin.isSuspended())
|
||||
reply = String.format(MainApp.gs(R.string.loopsuspendedfor), loopPlugin.minutesToEndOfSuspend());
|
||||
else
|
||||
reply = MainApp.gs(R.string.smscommunicator_loopisenabled);
|
||||
} else {
|
||||
reply = MainApp.gs(R.string.smscommunicator_loopisdisabled);
|
||||
}
|
||||
sendSMS(new Sms(receivedSms.phoneNumber, reply));
|
||||
loopPlugin = LoopPlugin.getPlugin();
|
||||
if (loopPlugin.isEnabled(PluginType.LOOP)) {
|
||||
if (loopPlugin.isSuspended())
|
||||
reply = String.format(MainApp.gs(R.string.loopsuspendedfor), loopPlugin.minutesToEndOfSuspend());
|
||||
else
|
||||
reply = MainApp.gs(R.string.smscommunicator_loopisenabled);
|
||||
} else {
|
||||
reply = MainApp.gs(R.string.smscommunicator_loopisdisabled);
|
||||
}
|
||||
sendSMS(new Sms(receivedSms.phoneNumber, reply));
|
||||
receivedSms.processed = true;
|
||||
break;
|
||||
case "RESUME":
|
||||
|
|
|
@ -437,11 +437,11 @@ public class ActionStringHandler {
|
|||
|
||||
public static boolean isOldData(List<TDD> historyList) {
|
||||
Object activePump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||
PumpInterface dana = MainApp.getSpecificPlugin(DanaRPlugin.class);
|
||||
PumpInterface danaRS = MainApp.getSpecificPlugin(DanaRSPlugin.class);
|
||||
PumpInterface danaV2 = MainApp.getSpecificPlugin(DanaRv2Plugin.class);
|
||||
PumpInterface danaKorean = MainApp.getSpecificPlugin(DanaRKoreanPlugin.class);
|
||||
PumpInterface insight = MainApp.getSpecificPlugin(LocalInsightPlugin.class);
|
||||
PumpInterface dana = DanaRPlugin.getPlugin();
|
||||
PumpInterface danaRS = DanaRSPlugin.getPlugin();
|
||||
PumpInterface danaV2 = DanaRv2Plugin.getPlugin();
|
||||
PumpInterface danaKorean = DanaRKoreanPlugin.getPlugin();
|
||||
PumpInterface insight = LocalInsightPlugin.getPlugin();
|
||||
|
||||
boolean startsYesterday = activePump == dana || activePump == danaRS || activePump == danaV2 || activePump == danaKorean || activePump == insight;
|
||||
|
||||
|
|
|
@ -164,7 +164,8 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
event.isChanged(R.string.key_openapsama_min_5m_carbimpact) ||
|
||||
event.isChanged(R.string.key_absorption_cutoff) ||
|
||||
event.isChanged(R.string.key_openapsama_autosens_max) ||
|
||||
event.isChanged(R.string.key_openapsama_autosens_min)
|
||||
event.isChanged(R.string.key_openapsama_autosens_min) ||
|
||||
event.isChanged(R.string.key_insulin_oref_peak)
|
||||
) {
|
||||
stopCalculation("onEventPreferenceChange");
|
||||
synchronized (dataLock) {
|
||||
|
|
|
@ -51,9 +51,9 @@ public class DanaRUserOptionsActivity extends NoSplashActivity {
|
|||
NumberPicker lowReservoir;
|
||||
Button saveToPumpButton;
|
||||
// This is for Dana pumps only
|
||||
boolean isRS = MainApp.getSpecificPlugin(DanaRSPlugin.class) != null && MainApp.getSpecificPlugin(DanaRSPlugin.class).isEnabled(PluginType.PUMP);
|
||||
boolean isDanaR = MainApp.getSpecificPlugin(DanaRPlugin.class) != null && MainApp.getSpecificPlugin(DanaRPlugin.class).isEnabled(PluginType.PUMP);
|
||||
boolean isDanaRv2 = MainApp.getSpecificPlugin(DanaRv2Plugin.class) != null && MainApp.getSpecificPlugin(DanaRv2Plugin.class).isEnabled(PluginType.PUMP);
|
||||
boolean isRS = DanaRSPlugin.getPlugin().isEnabled(PluginType.PUMP);
|
||||
boolean isDanaR = DanaRPlugin.getPlugin().isEnabled(PluginType.PUMP);
|
||||
boolean isDanaRv2 = DanaRv2Plugin.getPlugin().isEnabled(PluginType.PUMP);
|
||||
|
||||
@Override
|
||||
protected synchronized void onResume() {
|
||||
|
|
|
@ -32,7 +32,7 @@ public class MsgCheckValue extends MessageBase {
|
|||
pump.protocol = intFromBuff(bytes, 1, 1);
|
||||
pump.productCode = intFromBuff(bytes, 2, 1);
|
||||
if (pump.model != DanaRPump.EXPORT_MODEL) {
|
||||
MainApp.getSpecificPlugin(DanaRPlugin.class).disconnect("Wrong Model");
|
||||
DanaRPlugin.getPlugin().disconnect("Wrong Model");
|
||||
log.debug("Wrong model selected");
|
||||
}
|
||||
|
||||
|
|
|
@ -31,19 +31,19 @@ public class MsgInitConnStatusTime extends MessageBase {
|
|||
if (bytes.length - 10 > 7) {
|
||||
Notification notification = new Notification(Notification.WRONG_DRIVER, MainApp.gs(R.string.pumpdrivercorrected), Notification.NORMAL);
|
||||
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||
MainApp.getSpecificPlugin(DanaRPlugin.class).disconnect("Wrong Model");
|
||||
DanaRPlugin.getPlugin().disconnect("Wrong Model");
|
||||
log.error("Wrong model selected. Switching to Korean DanaR");
|
||||
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setPluginEnabled(PluginType.PUMP, true);
|
||||
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setFragmentVisible(PluginType.PUMP, true);
|
||||
MainApp.getSpecificPlugin(DanaRPlugin.class).setPluginEnabled(PluginType.PUMP, false);
|
||||
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentVisible(PluginType.PUMP, false);
|
||||
DanaRKoreanPlugin.getPlugin().setPluginEnabled(PluginType.PUMP, true);
|
||||
DanaRKoreanPlugin.getPlugin().setFragmentVisible(PluginType.PUMP, true);
|
||||
DanaRPlugin.getPlugin().setPluginEnabled(PluginType.PUMP, false);
|
||||
DanaRPlugin.getPlugin().setFragmentVisible(PluginType.PUMP, false);
|
||||
|
||||
DanaRPump.reset(); // mark not initialized
|
||||
|
||||
//If profile coming from pump, switch it as well
|
||||
if (MainApp.getSpecificPlugin(DanaRPlugin.class).isEnabled(PluginType.PROFILE)) {
|
||||
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setPluginEnabled(PluginType.PROFILE, false);
|
||||
(MainApp.getSpecificPlugin(DanaRKoreanPlugin.class)).setPluginEnabled(PluginType.PROFILE, true);
|
||||
if (DanaRPlugin.getPlugin().isEnabled(PluginType.PROFILE)) {
|
||||
(DanaRPlugin.getPlugin()).setPluginEnabled(PluginType.PROFILE, false);
|
||||
(DanaRKoreanPlugin.getPlugin()).setPluginEnabled(PluginType.PROFILE, true);
|
||||
}
|
||||
|
||||
ConfigBuilderPlugin.getPlugin().storeSettings("ChangingDanaDriver");
|
||||
|
|
|
@ -35,17 +35,17 @@ public class MsgInitConnStatusTime_k extends MessageBase {
|
|||
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||
DanaRKoreanPlugin.getPlugin().disconnect("Wrong Model");
|
||||
log.error("Wrong model selected. Switching to export DanaR");
|
||||
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setPluginEnabled(PluginType.PUMP, false);
|
||||
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setFragmentVisible(PluginType.PUMP, false);
|
||||
MainApp.getSpecificPlugin(DanaRPlugin.class).setPluginEnabled(PluginType.PUMP, true);
|
||||
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentVisible(PluginType.PUMP, true);
|
||||
DanaRKoreanPlugin.getPlugin().setPluginEnabled(PluginType.PUMP, false);
|
||||
DanaRKoreanPlugin.getPlugin().setFragmentVisible(PluginType.PUMP, false);
|
||||
DanaRPlugin.getPlugin().setPluginEnabled(PluginType.PUMP, true);
|
||||
DanaRPlugin.getPlugin().setFragmentVisible(PluginType.PUMP, true);
|
||||
|
||||
DanaRPump.reset(); // mark not initialized
|
||||
|
||||
//If profile coming from pump, switch it as well
|
||||
if (MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).isEnabled(PluginType.PROFILE)) {
|
||||
(MainApp.getSpecificPlugin(DanaRKoreanPlugin.class)).setPluginEnabled(PluginType.PROFILE, false);
|
||||
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setPluginEnabled(PluginType.PROFILE, true);
|
||||
if (DanaRKoreanPlugin.getPlugin().isEnabled(PluginType.PROFILE)) {
|
||||
(DanaRKoreanPlugin.getPlugin()).setPluginEnabled(PluginType.PROFILE, false);
|
||||
(DanaRPlugin.getPlugin()).setPluginEnabled(PluginType.PROFILE, true);
|
||||
}
|
||||
|
||||
ConfigBuilderPlugin.getPlugin().storeSettings("ChangingKoreanDanaDriver");
|
||||
|
|
|
@ -249,7 +249,7 @@ public class DanaRSService extends Service {
|
|||
|
||||
public PumpEnactResult loadEvents() {
|
||||
|
||||
if (!MainApp.getSpecificPlugin(DanaRSPlugin.class).isInitialized()) {
|
||||
if (!DanaRSPlugin.getPlugin().isInitialized()) {
|
||||
PumpEnactResult result = new PumpEnactResult().success(false);
|
||||
result.comment = "pump not initialized";
|
||||
return result;
|
||||
|
|
|
@ -45,19 +45,19 @@ public class MsgCheckValue_v2 extends MessageBase {
|
|||
pump.lastConnection = 0;
|
||||
Notification notification = new Notification(Notification.WRONG_DRIVER, MainApp.gs(R.string.pumpdrivercorrected), Notification.NORMAL);
|
||||
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||
MainApp.getSpecificPlugin(DanaRPlugin.class).disconnect("Wrong Model");
|
||||
DanaRPlugin.getPlugin().disconnect("Wrong Model");
|
||||
log.error("Wrong model selected. Switching to Korean DanaR");
|
||||
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setPluginEnabled(PluginType.PUMP, true);
|
||||
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setFragmentVisible(PluginType.PUMP, true);
|
||||
MainApp.getSpecificPlugin(DanaRPlugin.class).setPluginEnabled(PluginType.PUMP, false);
|
||||
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentVisible(PluginType.PUMP, false);
|
||||
DanaRKoreanPlugin.getPlugin().setPluginEnabled(PluginType.PUMP, true);
|
||||
DanaRKoreanPlugin.getPlugin().setFragmentVisible(PluginType.PUMP, true);
|
||||
DanaRPlugin.getPlugin().setPluginEnabled(PluginType.PUMP, false);
|
||||
DanaRPlugin.getPlugin().setFragmentVisible(PluginType.PUMP, false);
|
||||
|
||||
DanaRPump.reset(); // mark not initialized
|
||||
|
||||
//If profile coming from pump, switch it as well
|
||||
if (MainApp.getSpecificPlugin(DanaRPlugin.class).isEnabled(PluginType.PROFILE)) {
|
||||
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setPluginEnabled(PluginType.PROFILE, false);
|
||||
(MainApp.getSpecificPlugin(DanaRKoreanPlugin.class)).setPluginEnabled(PluginType.PROFILE, true);
|
||||
if (DanaRPlugin.getPlugin().isEnabled(PluginType.PROFILE)) {
|
||||
(DanaRPlugin.getPlugin()).setPluginEnabled(PluginType.PROFILE, false);
|
||||
(DanaRKoreanPlugin.getPlugin()).setPluginEnabled(PluginType.PROFILE, true);
|
||||
}
|
||||
|
||||
ConfigBuilderPlugin.getPlugin().storeSettings("ChangingDanaRv2Driver");
|
||||
|
@ -72,15 +72,15 @@ public class MsgCheckValue_v2 extends MessageBase {
|
|||
RxBus.INSTANCE.send(new EventNewNotification(notification));
|
||||
DanaRKoreanPlugin.getPlugin().disconnect("Wrong Model");
|
||||
log.error("Wrong model selected. Switching to non APS DanaR");
|
||||
(MainApp.getSpecificPlugin(DanaRv2Plugin.class)).setPluginEnabled(PluginType.PUMP, false);
|
||||
(MainApp.getSpecificPlugin(DanaRv2Plugin.class)).setFragmentVisible(PluginType.PUMP, false);
|
||||
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setPluginEnabled(PluginType.PUMP, true);
|
||||
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setFragmentVisible(PluginType.PUMP, true);
|
||||
(DanaRv2Plugin.getPlugin()).setPluginEnabled(PluginType.PUMP, false);
|
||||
(DanaRv2Plugin.getPlugin()).setFragmentVisible(PluginType.PUMP, false);
|
||||
(DanaRPlugin.getPlugin()).setPluginEnabled(PluginType.PUMP, true);
|
||||
(DanaRPlugin.getPlugin()).setFragmentVisible(PluginType.PUMP, true);
|
||||
|
||||
//If profile coming from pump, switch it as well
|
||||
if (MainApp.getSpecificPlugin(DanaRv2Plugin.class).isEnabled(PluginType.PROFILE)) {
|
||||
(MainApp.getSpecificPlugin(DanaRv2Plugin.class)).setPluginEnabled(PluginType.PROFILE, false);
|
||||
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setPluginEnabled(PluginType.PROFILE, true);
|
||||
if (DanaRv2Plugin.getPlugin().isEnabled(PluginType.PROFILE)) {
|
||||
(DanaRv2Plugin.getPlugin()).setPluginEnabled(PluginType.PROFILE, false);
|
||||
(DanaRPlugin.getPlugin()).setPluginEnabled(PluginType.PROFILE, true);
|
||||
}
|
||||
|
||||
ConfigBuilderPlugin.getPlugin().storeSettings("ChangingDanaRv2Driver");
|
||||
|
|
|
@ -471,7 +471,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
public PumpEnactResult loadEvents() {
|
||||
DanaRPump danaRPump = DanaRPump.getInstance();
|
||||
|
||||
if (!MainApp.getSpecificPlugin(DanaRv2Plugin.class).isInitialized()) {
|
||||
if (!DanaRv2Plugin.getPlugin().isInitialized()) {
|
||||
PumpEnactResult result = new PumpEnactResult().success(false);
|
||||
result.comment = "pump not initialized";
|
||||
return result;
|
||||
|
|
|
@ -50,8 +50,8 @@ public class CommandSetProfile extends Command {
|
|||
// Send SMS notification if ProfileSwitch is comming from NS
|
||||
ProfileSwitch profileSwitch = TreatmentsPlugin.getPlugin().getProfileSwitchFromHistory(System.currentTimeMillis());
|
||||
if (profileSwitch != null && r.enacted && profileSwitch.source == Source.NIGHTSCOUT) {
|
||||
SmsCommunicatorPlugin smsCommunicatorPlugin = MainApp.getSpecificPlugin(SmsCommunicatorPlugin.class);
|
||||
if (smsCommunicatorPlugin != null && smsCommunicatorPlugin.isEnabled(PluginType.GENERAL)) {
|
||||
SmsCommunicatorPlugin smsCommunicatorPlugin = SmsCommunicatorPlugin.getPlugin();
|
||||
if (smsCommunicatorPlugin.isEnabled(PluginType.GENERAL)) {
|
||||
smsCommunicatorPlugin.sendNotificationToAllNumbers(MainApp.gs(R.string.profile_set_ok));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,10 +8,13 @@ import com.google.firebase.analytics.FirebaseAnalytics;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.BuildConfig;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.constraints.signatureVerifier.SignatureVerifierPlugin;
|
||||
|
||||
/**
|
||||
* Created by jamorham on 21/02/2018.
|
||||
|
@ -112,9 +115,9 @@ public class FabricPrivacy {
|
|||
|
||||
String closedLoopEnabled = MainApp.getConstraintChecker().isClosedLoopAllowed().value() ? "CLOSED_LOOP_ENABLED" : "CLOSED_LOOP_DISABLED";
|
||||
// Size is limited to 36 chars
|
||||
String remote = BuildConfig.REMOTE
|
||||
.replace("https://","")
|
||||
.replace("http://","")
|
||||
String remote = BuildConfig.REMOTE.toLowerCase()
|
||||
.replace("https://", "")
|
||||
.replace("http://", "")
|
||||
.replace(".git", "")
|
||||
.replace(".com/", ":")
|
||||
.replace(".org/", ":")
|
||||
|
@ -125,6 +128,10 @@ public class FabricPrivacy {
|
|||
MainApp.getFirebaseAnalytics().setUserProperty("Version", BuildConfig.VERSION);
|
||||
MainApp.getFirebaseAnalytics().setUserProperty("HEAD", BuildConfig.HEAD);
|
||||
MainApp.getFirebaseAnalytics().setUserProperty("Remote", remote);
|
||||
List<String> hashes = SignatureVerifierPlugin.getPlugin().shortHashes();
|
||||
if (hashes.size() >= 1)
|
||||
MainApp.getFirebaseAnalytics().setUserProperty("Hash", hashes.get(0));
|
||||
|
||||
if (ConfigBuilderPlugin.getPlugin().getActivePump() != null)
|
||||
MainApp.getFirebaseAnalytics().setUserProperty("Pump", ConfigBuilderPlugin.getPlugin().getActivePump().getClass().getSimpleName());
|
||||
if (ConfigBuilderPlugin.getPlugin().getActiveAPS() != null)
|
||||
|
@ -137,7 +144,6 @@ public class FabricPrivacy {
|
|||
MainApp.getFirebaseAnalytics().setUserProperty("Sensitivity", ConfigBuilderPlugin.getPlugin().getActiveSensitivity().getClass().getSimpleName());
|
||||
if (ConfigBuilderPlugin.getPlugin().getActiveInsulin() != null)
|
||||
MainApp.getFirebaseAnalytics().setUserProperty("Insulin", ConfigBuilderPlugin.getPlugin().getActiveInsulin().getClass().getSimpleName());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
android:layout_above="@+id/automation_logView"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginBottom="-100dp" />
|
||||
android:layout_marginBottom="15dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/automation_logView"
|
||||
|
|
|
@ -271,7 +271,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
|
|||
<string name="glucosetype_finger">Doigt</string>
|
||||
<string name="glucosetype_sensor">Capteur</string>
|
||||
<string name="manual">Manuel</string>
|
||||
<string name="careportal_temporarytarget">Cible temporaire</string>
|
||||
<string name="careportal_temporarytarget">Cible temp.</string>
|
||||
<string name="careportal_temporarytargetcancel">Annulation Cible Temporaire</string>
|
||||
<string name="danarprofile">Paramètres du profil DanaR</string>
|
||||
<string name="danarprofile_dia">Durée d\'Action [h] </string>
|
||||
|
@ -772,13 +772,13 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
|
|||
<string name="combo_error_bolus_verification_failed">L\'administration de bolus et la vérification de l\'historique de la pompe ont échoué. Vérifiez la pompe manuellement. Si un bolus a été administré, il sera ajouté aux traitements au cours de la prochaine connexion avec la pompe.</string>
|
||||
<string name="combo_reservoir_level_insufficient_for_bolus">Pas assez d\'insuline dans le réservoir pour le bolus</string>
|
||||
<string name="extendedbolusdeliveryerror">Erreur administration bolus étendu</string>
|
||||
<string name="insightpump_shortname">Vue</string>
|
||||
<string name="insightpump_shortname">AC-I</string>
|
||||
<string name="ago">passé(e)s</string>
|
||||
<string name="format_hours">%1$.2f h</string>
|
||||
<string name="enablesmbalways">Activer en permanence les SMB</string>
|
||||
<string name="enablesmbalways_summary">Activer toujours SMB de manière autonome pour les bolus. Ceci est possible uniquement avec une source de glycémie ayant un très bon filtrage de données comme le G5</string>
|
||||
<string name="enablesmbaftercarbs">Activer SMB après ingestion de glucides</string>
|
||||
<string name="enablesmbaftercarbs_summary">Activer SMB pendant 6h après ingestion de glucides, même s’il y a 0 GI (Glucides Actifs). Ceci est possible uniquement avec une source de glycémie ayant un très bon filtrage de données comme le G5</string>
|
||||
<string name="enablesmbaftercarbs_summary">Activer SMB pendant 6h après ingestion de glucides, même s’il y a 0 GA (Glucides Actifs). Ceci est possible uniquement avec une source de glycémie ayant un très bon filtrage de données comme le G5</string>
|
||||
<string name="enablesmbwithcob">Activer SMB avec les glucides</string>
|
||||
<string name="enablesmbwithcob_summary">Activer SMB tant que des Glucides sont actifs.</string>
|
||||
<string name="enablesmbwithtemptarget">Activer SMB avec les cibles temporaires</string>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<string name="dia_minimumis3h">O valor mínimo é de 3 horas.</string>
|
||||
<string name="dia_minimumis5h">O valor mínimo é de 5 horas.</string>
|
||||
<string name="dia_hint1">https://androidaps.readthedocs.io/en/latest/EN/Configuration/Config-Builder.html?#insulin</string>
|
||||
<string name="dia_meaningisequaltodiapump">O significado é igual ao parâmetro DIA usado na bomba.</string>
|
||||
<string name="hypott_label">Tópico: Alvo-Temp. Hipo</string>
|
||||
<string name="hypott_whenhypott">O que é a razão principal para definir TT hipoglicemia?</string>
|
||||
<string name="hypott_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/temptarget.html</string>
|
||||
|
@ -16,14 +17,23 @@
|
|||
<string name="pumpdisconnect_letknow">Clique em \'Desligar bomba\' para que o AAPS saiba que nenhuma insulina está a ser entregue.</string>
|
||||
<string name="pumpdisconnect_hint1">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#other-settings</string>
|
||||
<string name="objectives_label">Tópico: Definições do AndroidAPS</string>
|
||||
<string name="objectives_howtosave">Quais são as práticas recomendadas para fazer cópia de segurança das configurações?</string>
|
||||
<string name="objectives_exportsettings">Exportá-las localmente a partir do menu Manutenção.</string>
|
||||
<string name="objectives_storeelsewhere">Armazenar ficheiro exportado para outro local como e-mail, Dropbox, Google drive…</string>
|
||||
<string name="objectives_doexportonstart">Exportá-los logo após a instalação do AAPS.</string>
|
||||
<string name="objectives_doexportafterchange">Exportá-los depois de fazer alterações de configuração.</string>
|
||||
<string name="objectives_doexportafterobjective">Exportá-los depois de completar um objectivo.</string>
|
||||
<string name="objectives_doexportafterfirtssettings">Exportá-los quando terminar as configurações iniciais.</string>
|
||||
<string name="objectives_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/ExportImportSettings.html</string>
|
||||
<string name="objectives_hint2">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-emergency-equipment-is-recommended-to-take-with-me</string>
|
||||
<string name="noisycgm_label">Tópico: Leituras Irregulares CGM</string>
|
||||
<string name="noisycgm_whattodo">O que deve ser feito se os dados do CGM são irregulares?</string>
|
||||
<string name="nothing">Nada, AAPS vai lidar com isso.</string>
|
||||
<string name="noisycgm_pause">Desactivar o loop para evitar sobredosagem.</string>
|
||||
<string name="noisycgm_replacesensor">Substituir o sensor CGM.</string>
|
||||
<string name="noisycgm_turnoffphone">Desligue o telefone.</string>
|
||||
<string name="noisycgm_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/Smoothing-Blood-Glucose-Data-in-xDrip.html#smoothing-blood-glucose-data</string>
|
||||
<string name="noisycgm_checksmoothing">Verifique que a app do CGM suaviza os dados da Glicose.</string>
|
||||
<string name="exercise_label">Tópico: Exercício</string>
|
||||
<string name="exercise_setactivitytt">Usando o recurso de alvo-temp.</string>
|
||||
<string name="exercise_switchprofilebelow100">Fazer uma mudança de perfil inferior a 100%.</string>
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
<string name="objectives_useprofileswitch">Definir perfil de 90% por 10 min (pressione longo no nome de perfil na Visão Geral)</string>
|
||||
<string name="objectives_usedisconnectpump">Simular chuveiro. Desligar a bomba de 1h (Pressione longo em Open Loop)</string>
|
||||
<string name="objectives_useloop">Mostrar conteúdo do plugin Loop</string>
|
||||
<string name="objectives_usescale">Utilizar a função de escala premindo longamente gráfico Glic</string>
|
||||
<string name="objectives_button_enter">Inserir</string>
|
||||
<string name="enter_code_obtained_from_developers_to_bypass_the_rest_of_objectives">Insira o código obtido dos programadores para ignorar o resto dos objectivos</string>
|
||||
<string name="codeaccepted">Código aceite</string>
|
||||
<string name="codeinvalid">Código inválido</string>
|
||||
<string name="objectives_exam_objective">Prove seu conhecimento</string>
|
||||
|
|
|
@ -37,6 +37,7 @@ import static org.mockito.ArgumentMatchers.any;
|
|||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.anyLong;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
|
@ -234,17 +235,6 @@ public class AAPSMocker {
|
|||
|
||||
}
|
||||
|
||||
public static DanaRPlugin mockDanaRPlugin() {
|
||||
PowerMockito.mockStatic(DanaRPlugin.class);
|
||||
DanaRPlugin danaRPlugin = mock(DanaRPlugin.class);
|
||||
DanaRv2Plugin danaRv2Plugin = mock(DanaRv2Plugin.class);
|
||||
DanaRKoreanPlugin danaRKoreanPlugin = mock(DanaRKoreanPlugin.class);
|
||||
when(MainApp.getSpecificPlugin(DanaRPlugin.class)).thenReturn(danaRPlugin);
|
||||
when(MainApp.getSpecificPlugin(DanaRv2Plugin.class)).thenReturn(danaRv2Plugin);
|
||||
when(MainApp.getSpecificPlugin(DanaRKoreanPlugin.class)).thenReturn(danaRKoreanPlugin);
|
||||
return danaRPlugin;
|
||||
}
|
||||
|
||||
public static Profile getValidProfile() {
|
||||
try {
|
||||
if (profile == null)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.general.versionChecker
|
||||
package info.nightscout.androidaps.plugins.constraints.versionChecker
|
||||
|
||||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.R
|
|
@ -57,7 +57,7 @@ import static org.powermock.api.mockito.PowerMockito.when;
|
|||
L.class, SP.class, MainApp.class, DateUtil.class, ProfileFunctions.class,
|
||||
TreatmentsPlugin.class, SmsManager.class, IobCobCalculatorPlugin.class,
|
||||
CommandQueue.class, ConfigBuilderPlugin.class, NSUpload.class, ProfileInterface.class,
|
||||
SimpleProfilePlugin.class, XdripCalibrations.class, VirtualPumpPlugin.class
|
||||
SimpleProfilePlugin.class, XdripCalibrations.class, VirtualPumpPlugin.class, LoopPlugin.class
|
||||
})
|
||||
|
||||
public class SmsCommunicatorPluginTest {
|
||||
|
@ -744,8 +744,9 @@ public class SmsCommunicatorPluginTest {
|
|||
smsCommunicatorPlugin = SmsCommunicatorPlugin.getPlugin();
|
||||
smsCommunicatorPlugin.setPluginEnabled(PluginType.GENERAL, true);
|
||||
|
||||
mockStatic(LoopPlugin.class);
|
||||
loopPlugin = mock(LoopPlugin.class);
|
||||
when(MainApp.getSpecificPlugin(LoopPlugin.class)).thenReturn(loopPlugin);
|
||||
when(LoopPlugin.getPlugin()).thenReturn(loopPlugin);
|
||||
|
||||
Mockito.doAnswer(invocation -> {
|
||||
Callback callback = invocation.getArgument(1);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaR.comm;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
|
@ -22,13 +23,6 @@ import static org.junit.Assert.assertEquals;
|
|||
public class MsgInitConnStatusTimeTest {
|
||||
@Test
|
||||
public void runTest() {
|
||||
AAPSMocker.mockMainApp();
|
||||
AAPSMocker.mockApplicationContext();
|
||||
AAPSMocker.mockSP();
|
||||
AAPSMocker.mockL();
|
||||
AAPSMocker.mockConfigBuilder();
|
||||
AAPSMocker.mockCommandQueue();
|
||||
AAPSMocker.mockDanaRPlugin();
|
||||
MsgInitConnStatusTime packet = new MsgInitConnStatusTime();
|
||||
|
||||
// test message decoding
|
||||
|
@ -56,4 +50,13 @@ public class MsgInitConnStatusTimeTest {
|
|||
return ret;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void mock() {
|
||||
AAPSMocker.mockMainApp();
|
||||
AAPSMocker.mockApplicationContext();
|
||||
AAPSMocker.mockSP();
|
||||
AAPSMocker.mockL();
|
||||
AAPSMocker.mockConfigBuilder();
|
||||
AAPSMocker.mockCommandQueue();
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRv2.comm;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
|
@ -20,17 +21,10 @@ import static org.junit.Assert.*;
|
|||
import static org.powermock.api.mockito.PowerMockito.when;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({MainApp.class, SP.class, L.class, DanaRv2Plugin.class, DanaRPlugin.class, ConfigBuilderPlugin.class, CommandQueue.class})
|
||||
@PrepareForTest({MainApp.class, SP.class, L.class, ConfigBuilderPlugin.class, CommandQueue.class})
|
||||
public class MsgCheckValue_v2Test {
|
||||
@Test
|
||||
public void runTest() {
|
||||
AAPSMocker.mockMainApp();
|
||||
AAPSMocker.mockApplicationContext();
|
||||
AAPSMocker.mockSP();
|
||||
AAPSMocker.mockL();
|
||||
AAPSMocker.mockDanaRPlugin();
|
||||
AAPSMocker.mockConfigBuilder();
|
||||
AAPSMocker.mockCommandQueue();
|
||||
Treatment t = new Treatment();
|
||||
MsgCheckValue_v2 packet = new MsgCheckValue_v2();
|
||||
// test message decoding
|
||||
|
@ -55,4 +49,13 @@ public class MsgCheckValue_v2Test {
|
|||
return ret;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void mock() {
|
||||
AAPSMocker.mockMainApp();
|
||||
AAPSMocker.mockApplicationContext();
|
||||
AAPSMocker.mockSP();
|
||||
AAPSMocker.mockL();
|
||||
AAPSMocker.mockConfigBuilder();
|
||||
AAPSMocker.mockCommandQueue();
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRv2.comm;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
|
@ -18,15 +19,10 @@ import static org.junit.Assert.*;
|
|||
*/
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({MainApp.class, SP.class, L.class, DanaRv2Plugin.class, DanaRPlugin.class})
|
||||
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||
public class MsgSetHistoryEntry_v2Test {
|
||||
@Test
|
||||
public void runTest() {
|
||||
AAPSMocker.mockMainApp();
|
||||
AAPSMocker.mockApplicationContext();
|
||||
AAPSMocker.mockSP();
|
||||
AAPSMocker.mockL();
|
||||
AAPSMocker.mockDanaRPlugin();
|
||||
|
||||
MsgSetHistoryEntry_v2 initializerTest = new MsgSetHistoryEntry_v2((byte) 1, System.currentTimeMillis(), 1, 0);
|
||||
MsgSetHistoryEntry_v2 packet = new MsgSetHistoryEntry_v2();
|
||||
|
@ -56,4 +52,11 @@ public class MsgSetHistoryEntry_v2Test {
|
|||
return ret;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void mock() {
|
||||
AAPSMocker.mockMainApp();
|
||||
AAPSMocker.mockApplicationContext();
|
||||
AAPSMocker.mockSP();
|
||||
AAPSMocker.mockL();
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.danaRv2.comm;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
|
@ -19,16 +20,10 @@ import static org.junit.Assert.*;
|
|||
*/
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({MainApp.class, SP.class, L.class, DanaRv2Plugin.class, DanaRPlugin.class})
|
||||
@PrepareForTest({MainApp.class, SP.class, L.class})
|
||||
public class MsgStatusTempBasal_v2Test {
|
||||
@Test
|
||||
public void runTest() {
|
||||
AAPSMocker.mockMainApp();
|
||||
AAPSMocker.mockApplicationContext();
|
||||
AAPSMocker.mockSP();
|
||||
AAPSMocker.mockL();
|
||||
AAPSMocker.mockDanaRPlugin();
|
||||
|
||||
MsgStatusTempBasal_v2 packet = new MsgStatusTempBasal_v2();
|
||||
DanaRPump pump = DanaRPump.getInstance();
|
||||
// test message decoding
|
||||
|
@ -57,4 +52,12 @@ public class MsgStatusTempBasal_v2Test {
|
|||
return ret;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void mock() {
|
||||
AAPSMocker.mockMainApp();
|
||||
AAPSMocker.mockApplicationContext();
|
||||
AAPSMocker.mockSP();
|
||||
AAPSMocker.mockL();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue