allow NS_UPLOAD_ONLY in engineering mode only
This commit is contained in:
parent
3714d594d0
commit
ba282f098e
|
@ -4,9 +4,18 @@
|
||||||
<JetCodeStyleSettings>
|
<JetCodeStyleSettings>
|
||||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||||
<value>
|
<value>
|
||||||
<package name="java.util" withSubpackages="false" static="false" />
|
<package name="java.util" alias="false" withSubpackages="false" />
|
||||||
<package name="kotlinx.android.synthetic" withSubpackages="true" static="false" />
|
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
||||||
<package name="io.ktor" withSubpackages="true" static="false" />
|
<package name="io.ktor" alias="false" withSubpackages="true" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="PACKAGES_IMPORT_LAYOUT">
|
||||||
|
<value>
|
||||||
|
<package name="" alias="false" withSubpackages="true" />
|
||||||
|
<package name="java" alias="false" withSubpackages="true" />
|
||||||
|
<package name="javax" alias="false" withSubpackages="true" />
|
||||||
|
<package name="kotlin" alias="false" withSubpackages="true" />
|
||||||
|
<package name="" alias="true" withSubpackages="true" />
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
<option name="ALIGN_IN_COLUMNS_CASE_BRANCH" value="true" />
|
<option name="ALIGN_IN_COLUMNS_CASE_BRANCH" value="true" />
|
||||||
|
|
|
@ -44,6 +44,7 @@ import info.nightscout.androidaps.plugins.general.nsclient.services.NSClientServ
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper;
|
import info.nightscout.androidaps.utils.HtmlHelper;
|
||||||
import info.nightscout.androidaps.utils.ToastUtils;
|
import info.nightscout.androidaps.utils.ToastUtils;
|
||||||
|
import info.nightscout.androidaps.utils.buildHelper.BuildHelper;
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||||
import io.reactivex.disposables.CompositeDisposable;
|
import io.reactivex.disposables.CompositeDisposable;
|
||||||
|
@ -60,6 +61,7 @@ public class NSClientPlugin extends PluginBase {
|
||||||
private final FabricPrivacy fabricPrivacy;
|
private final FabricPrivacy fabricPrivacy;
|
||||||
private final SP sp;
|
private final SP sp;
|
||||||
private final Config config;
|
private final Config config;
|
||||||
|
private final BuildHelper buildHelper;
|
||||||
|
|
||||||
public Handler handler;
|
public Handler handler;
|
||||||
|
|
||||||
|
@ -85,7 +87,8 @@ public class NSClientPlugin extends PluginBase {
|
||||||
FabricPrivacy fabricPrivacy,
|
FabricPrivacy fabricPrivacy,
|
||||||
SP sp,
|
SP sp,
|
||||||
NsClientReceiverDelegate nsClientReceiverDelegate,
|
NsClientReceiverDelegate nsClientReceiverDelegate,
|
||||||
Config config
|
Config config,
|
||||||
|
BuildHelper buildHelper
|
||||||
) {
|
) {
|
||||||
super(new PluginDescription()
|
super(new PluginDescription()
|
||||||
.mainType(PluginType.GENERAL)
|
.mainType(PluginType.GENERAL)
|
||||||
|
@ -106,6 +109,7 @@ public class NSClientPlugin extends PluginBase {
|
||||||
this.sp = sp;
|
this.sp = sp;
|
||||||
this.nsClientReceiverDelegate = nsClientReceiverDelegate;
|
this.nsClientReceiverDelegate = nsClientReceiverDelegate;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
this.buildHelper = buildHelper;
|
||||||
|
|
||||||
if (config.getNSCLIENT()) {
|
if (config.getNSCLIENT()) {
|
||||||
getPluginDescription().alwaysEnabled(true).visibleByDefault(true);
|
getPluginDescription().alwaysEnabled(true).visibleByDefault(true);
|
||||||
|
@ -207,6 +211,10 @@ public class NSClientPlugin extends PluginBase {
|
||||||
}
|
}
|
||||||
SwitchPreference key_ns_sync_use_absolute = preferenceFragment.findPreference(resourceHelper.gs(R.string.key_ns_sync_use_absolute));
|
SwitchPreference key_ns_sync_use_absolute = preferenceFragment.findPreference(resourceHelper.gs(R.string.key_ns_sync_use_absolute));
|
||||||
if (key_ns_sync_use_absolute != null) key_ns_sync_use_absolute.setVisible(false);
|
if (key_ns_sync_use_absolute != null) key_ns_sync_use_absolute.setVisible(false);
|
||||||
|
} else {
|
||||||
|
// APS or pumpcontrol mode
|
||||||
|
SwitchPreference key_ns_upload_only = preferenceFragment.findPreference(resourceHelper.gs(R.string.key_ns_upload_only));
|
||||||
|
key_ns_upload_only.setVisible(buildHelper.isEngineeringMode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsBolusFr
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
|
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
|
@ -45,6 +46,7 @@ class TreatmentsBolusFragment : DaggerFragment() {
|
||||||
@Inject lateinit var nsUpload: NSUpload
|
@Inject lateinit var nsUpload: NSUpload
|
||||||
@Inject lateinit var uploadQueue: UploadQueue
|
@Inject lateinit var uploadQueue: UploadQueue
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
|
@Inject lateinit var buildHelper: BuildHelper
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
|
@ -79,7 +81,7 @@ class TreatmentsBolusFragment : DaggerFragment() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val nsUploadOnly = sp.getBoolean(R.string.key_ns_upload_only, true)
|
val nsUploadOnly = sp.getBoolean(R.string.key_ns_upload_only, true) && buildHelper.isEngineeringMode()
|
||||||
if (nsUploadOnly) treatments_reshreshfromnightscout.visibility = View.GONE
|
if (nsUploadOnly) treatments_reshreshfromnightscout.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.cardview.widget.CardView
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
|
@ -21,8 +20,9 @@ import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientR
|
||||||
import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsCareportalFragment.RecyclerViewAdapter.CareportalEventsViewHolder
|
import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsCareportalFragment.RecyclerViewAdapter.CareportalEventsViewHolder
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
|
||||||
import info.nightscout.androidaps.utils.Translator
|
import info.nightscout.androidaps.utils.Translator
|
||||||
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
|
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
|
@ -41,6 +41,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
|
||||||
@Inject lateinit var nsUpload: NSUpload
|
@Inject lateinit var nsUpload: NSUpload
|
||||||
@Inject lateinit var uploadQueue: UploadQueue
|
@Inject lateinit var uploadQueue: UploadQueue
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
|
@Inject lateinit var buildHelper: BuildHelper
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
|
@ -78,7 +79,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val nsUploadOnly = sp.getBoolean(R.string.key_ns_upload_only, true)
|
val nsUploadOnly = sp.getBoolean(R.string.key_ns_upload_only, true) && buildHelper.isEngineeringMode()
|
||||||
if (nsUploadOnly) careportal_refreshfromnightscout.visibility = View.GONE
|
if (nsUploadOnly) careportal_refreshfromnightscout.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +122,6 @@ class TreatmentsCareportalFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class CareportalEventsViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
inner class CareportalEventsViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||||
var cv: CardView = itemView.findViewById(R.id.careportal_cardview)
|
|
||||||
var date: TextView = itemView.findViewById(R.id.careportal_date)
|
var date: TextView = itemView.findViewById(R.id.careportal_date)
|
||||||
var duration: TextView = itemView.findViewById(R.id.careportal_duration)
|
var duration: TextView = itemView.findViewById(R.id.careportal_duration)
|
||||||
var type: TextView = itemView.findViewById(R.id.careportal_type)
|
var type: TextView = itemView.findViewById(R.id.careportal_type)
|
||||||
|
|
|
@ -26,6 +26,7 @@ import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.T
|
import info.nightscout.androidaps.utils.T
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
|
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
|
||||||
import info.nightscout.androidaps.utils.extensions.toVisibility
|
import info.nightscout.androidaps.utils.extensions.toVisibility
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||||
|
@ -45,6 +46,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
|
||||||
@Inject lateinit var nsUpload: NSUpload
|
@Inject lateinit var nsUpload: NSUpload
|
||||||
@Inject lateinit var uploadQueue: UploadQueue
|
@Inject lateinit var uploadQueue: UploadQueue
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
|
@Inject lateinit var buildHelper: BuildHelper
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?): View? {
|
savedInstanceState: Bundle?): View? {
|
||||||
|
@ -59,13 +61,13 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
|
||||||
|
|
||||||
profileswitch_refreshfromnightscout.setOnClickListener {
|
profileswitch_refreshfromnightscout.setOnClickListener {
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.refresheventsfromnightscout) + "?", Runnable {
|
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.refresheventsfromnightscout) + "?") {
|
||||||
MainApp.getDbHelper().resetProfileSwitch()
|
MainApp.getDbHelper().resetProfileSwitch()
|
||||||
rxBus.send(EventNSClientRestart())
|
rxBus.send(EventNSClientRestart())
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sp.getBoolean(R.string.key_ns_upload_only, true)) profileswitch_refreshfromnightscout.visibility = View.GONE
|
if (sp.getBoolean(R.string.key_ns_upload_only, true) && buildHelper.isEngineeringMode()) profileswitch_refreshfromnightscout.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
|
|
|
@ -32,6 +32,7 @@ import info.nightscout.androidaps.utils.DateUtil;
|
||||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog;
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog;
|
||||||
|
import info.nightscout.androidaps.utils.buildHelper.BuildHelper;
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
|
@ -51,6 +52,7 @@ public class TreatmentsTempTargetFragment extends DaggerFragment {
|
||||||
@Inject UploadQueue uploadQueue;
|
@Inject UploadQueue uploadQueue;
|
||||||
@Inject FabricPrivacy fabricPrivacy;
|
@Inject FabricPrivacy fabricPrivacy;
|
||||||
@Inject DateUtil dateUtil;
|
@Inject DateUtil dateUtil;
|
||||||
|
@Inject BuildHelper buildHelper;
|
||||||
|
|
||||||
private final CompositeDisposable disposable = new CompositeDisposable();
|
private final CompositeDisposable disposable = new CompositeDisposable();
|
||||||
|
|
||||||
|
@ -180,7 +182,7 @@ public class TreatmentsTempTargetFragment extends DaggerFragment {
|
||||||
rxBus.send(new EventNSClientRestart());
|
rxBus.send(new EventNSClientRestart());
|
||||||
}));
|
}));
|
||||||
|
|
||||||
boolean nsUploadOnly = sp.getBoolean(R.string.key_ns_upload_only, true);
|
boolean nsUploadOnly = sp.getBoolean(R.string.key_ns_upload_only, true) && buildHelper.isEngineeringMode();
|
||||||
if (nsUploadOnly)
|
if (nsUploadOnly)
|
||||||
refreshFromNS.setVisibility(View.GONE);
|
refreshFromNS.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ import info.nightscout.androidaps.plugins.source.TomatoPlugin;
|
||||||
import info.nightscout.androidaps.plugins.source.XdripPlugin;
|
import info.nightscout.androidaps.plugins.source.XdripPlugin;
|
||||||
import info.nightscout.androidaps.receivers.DataReceiver;
|
import info.nightscout.androidaps.receivers.DataReceiver;
|
||||||
import info.nightscout.androidaps.utils.JsonHelper;
|
import info.nightscout.androidaps.utils.JsonHelper;
|
||||||
|
import info.nightscout.androidaps.utils.buildHelper.BuildHelper;
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,6 +58,7 @@ public class DataService extends DaggerIntentService {
|
||||||
@Inject NSProfilePlugin nsProfilePlugin;
|
@Inject NSProfilePlugin nsProfilePlugin;
|
||||||
@Inject ActivePluginProvider activePlugin;
|
@Inject ActivePluginProvider activePlugin;
|
||||||
@Inject Config config;
|
@Inject Config config;
|
||||||
|
@Inject BuildHelper buildHelper;
|
||||||
|
|
||||||
public DataService() {
|
public DataService() {
|
||||||
super("DataService");
|
super("DataService");
|
||||||
|
@ -69,7 +71,7 @@ public class DataService extends DaggerIntentService {
|
||||||
aapsLogger.debug(LTag.DATASERVICE, "onHandleIntent " + BundleLogger.log(intent.getExtras()));
|
aapsLogger.debug(LTag.DATASERVICE, "onHandleIntent " + BundleLogger.log(intent.getExtras()));
|
||||||
|
|
||||||
|
|
||||||
boolean acceptNSData = !sp.getBoolean(R.string.key_ns_upload_only, true) || config.getNSCLIENT();
|
boolean acceptNSData = !sp.getBoolean(R.string.key_ns_upload_only, true) && buildHelper.isEngineeringMode() || config.getNSCLIENT();
|
||||||
|
|
||||||
final String action = intent.getAction();
|
final String action = intent.getAction();
|
||||||
if (Intents.ACTION_NEW_BG_ESTIMATE.equals(action)) {
|
if (Intents.ACTION_NEW_BG_ESTIMATE.equals(action)) {
|
||||||
|
|
Loading…
Reference in a new issue