Merge pull request #1406 from Andries-Smit/fix/add-missing-protection
Fix add missing protection
This commit is contained in:
commit
d533c12c84
6 changed files with 382 additions and 300 deletions
|
@ -157,10 +157,20 @@ class ActionsFragment : DaggerFragment() {
|
||||||
cannulaOrPatch = view.findViewById(R.id.cannula_or_patch)
|
cannulaOrPatch = view.findViewById(R.id.cannula_or_patch)
|
||||||
|
|
||||||
profileSwitch?.setOnClickListener {
|
profileSwitch?.setOnClickListener {
|
||||||
ProfileSwitchDialog().show(childFragmentManager, "ProfileSwitchDialog")
|
activity?.let { activity ->
|
||||||
|
protectionCheck.queryProtection(
|
||||||
|
activity,
|
||||||
|
ProtectionCheck.Protection.BOLUS,
|
||||||
|
UIRunnable { ProfileSwitchDialog().show(childFragmentManager, "ProfileSwitchDialog")})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tempTarget?.setOnClickListener {
|
tempTarget?.setOnClickListener {
|
||||||
TempTargetDialog().show(childFragmentManager, "Actions")
|
activity?.let { activity ->
|
||||||
|
protectionCheck.queryProtection(
|
||||||
|
activity,
|
||||||
|
ProtectionCheck.Protection.BOLUS,
|
||||||
|
UIRunnable { TempTargetDialog().show(childFragmentManager, "Actions") })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
extendedBolus?.setOnClickListener {
|
extendedBolus?.setOnClickListener {
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
|
@ -187,7 +197,12 @@ class ActionsFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setTempBasal?.setOnClickListener {
|
setTempBasal?.setOnClickListener {
|
||||||
TempBasalDialog().show(childFragmentManager, "Actions")
|
activity?.let { activity ->
|
||||||
|
protectionCheck.queryProtection(
|
||||||
|
activity,
|
||||||
|
ProtectionCheck.Protection.BOLUS,
|
||||||
|
UIRunnable { TempBasalDialog().show(childFragmentManager, "Actions") })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cancelTempBasal?.setOnClickListener {
|
cancelTempBasal?.setOnClickListener {
|
||||||
if (iobCobCalculator.getTempBasalIncludingConvertedExtended(dateUtil.now()) != null) {
|
if (iobCobCalculator.getTempBasalIncludingConvertedExtended(dateUtil.now()) != null) {
|
||||||
|
|
|
@ -27,6 +27,7 @@ import info.nightscout.androidaps.plugins.general.overview.OverviewData
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.DashHistoryDatabase
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.DashHistoryDatabase
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.database.ErosHistoryDatabase
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.database.ErosHistoryDatabase
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import io.reactivex.rxjava3.core.Completable.fromAction
|
import io.reactivex.rxjava3.core.Completable.fromAction
|
||||||
|
@ -48,6 +49,7 @@ class MaintenanceFragment : DaggerFragment() {
|
||||||
@Inject lateinit var diaconnDatabase: DiaconnHistoryDatabase
|
@Inject lateinit var diaconnDatabase: DiaconnHistoryDatabase
|
||||||
@Inject lateinit var erosDatabase: ErosHistoryDatabase
|
@Inject lateinit var erosDatabase: ErosHistoryDatabase
|
||||||
@Inject lateinit var dashDatabase: DashHistoryDatabase
|
@Inject lateinit var dashDatabase: DashHistoryDatabase
|
||||||
|
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||||
@Inject lateinit var uel: UserEntryLogger
|
@Inject lateinit var uel: UserEntryLogger
|
||||||
@Inject lateinit var dataSyncSelector: DataSyncSelector
|
@Inject lateinit var dataSyncSelector: DataSyncSelector
|
||||||
@Inject lateinit var pumpSync: PumpSync
|
@Inject lateinit var pumpSync: PumpSync
|
||||||
|
@ -128,6 +130,23 @@ class MaintenanceFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (protectionCheck.isLocked(ProtectionCheck.Protection.PREFERENCES)) {
|
||||||
|
binding.mainLayout.visibility = View.GONE
|
||||||
|
} else {
|
||||||
|
binding.unlock.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.unlock.setOnClickListener {
|
||||||
|
activity?.let { activity ->
|
||||||
|
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.PREFERENCES, {
|
||||||
|
activity.runOnUiThread {
|
||||||
|
binding.mainLayout.visibility = View.VISIBLE
|
||||||
|
binding.unlock.visibility = View.GONE
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
|
|
|
@ -29,6 +29,7 @@ import info.nightscout.androidaps.utils.DecimalFormatter
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.HardLimits
|
import info.nightscout.androidaps.utils.HardLimits
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import info.nightscout.androidaps.utils.ui.TimeListEdit
|
import info.nightscout.androidaps.utils.ui.TimeListEdit
|
||||||
|
@ -49,6 +50,7 @@ class LocalProfileFragment : DaggerFragment() {
|
||||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||||
@Inject lateinit var localProfilePlugin: LocalProfilePlugin
|
@Inject lateinit var localProfilePlugin: LocalProfilePlugin
|
||||||
@Inject lateinit var hardLimits: HardLimits
|
@Inject lateinit var hardLimits: HardLimits
|
||||||
|
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
@Inject lateinit var uel: UserEntryLogger
|
@Inject lateinit var uel: UserEntryLogger
|
||||||
|
@ -88,8 +90,7 @@ class LocalProfileFragment : DaggerFragment() {
|
||||||
|
|
||||||
private var _binding: LocalprofileFragmentBinding? = null
|
private var _binding: LocalprofileFragmentBinding? = null
|
||||||
|
|
||||||
// This property is only valid between onCreateView and
|
// This property is only valid between onCreateView and onDestroyView.
|
||||||
// onDestroyView.
|
|
||||||
private val binding get() = _binding!!
|
private val binding get() = _binding!!
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||||
|
@ -124,6 +125,23 @@ class LocalProfileFragment : DaggerFragment() {
|
||||||
binding.target.visibility = View.VISIBLE
|
binding.target.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
binding.dia.editText?.id?.let { binding.diaLabel.labelFor = it }
|
binding.dia.editText?.id?.let { binding.diaLabel.labelFor = it }
|
||||||
|
|
||||||
|
if (protectionCheck.isLocked(ProtectionCheck.Protection.PREFERENCES)) {
|
||||||
|
binding.mainLayout.visibility = View.GONE
|
||||||
|
} else {
|
||||||
|
binding.unlock.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.unlock.setOnClickListener {
|
||||||
|
activity?.let { activity ->
|
||||||
|
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.PREFERENCES, {
|
||||||
|
activity.runOnUiThread {
|
||||||
|
binding.mainLayout.visibility = View.VISIBLE
|
||||||
|
binding.unlock.visibility = View.GONE
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun build() {
|
fun build() {
|
||||||
|
|
|
@ -10,6 +10,20 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/unlock"
|
||||||
|
style="@style/GrayButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:text="@string/unlock_settings" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/main_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -361,6 +375,8 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,16 @@
|
||||||
android:paddingTop="2dp"
|
android:paddingTop="2dp"
|
||||||
tools:context=".plugins.general.maintenance.MaintenanceFragment">
|
tools:context=".plugins.general.maintenance.MaintenanceFragment">
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/unlock"
|
||||||
|
style="@style/GrayButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:text="@string/unlock_settings" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/main_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
|
@ -40,6 +40,7 @@ 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.buildHelper.BuildHelper
|
||||||
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
|
@ -64,6 +65,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
@Inject lateinit var omnipodDashPumpPlugin: OmnipodDashPumpPlugin
|
@Inject lateinit var omnipodDashPumpPlugin: OmnipodDashPumpPlugin
|
||||||
@Inject lateinit var podStateManager: OmnipodDashPodStateManager
|
@Inject lateinit var podStateManager: OmnipodDashPodStateManager
|
||||||
@Inject lateinit var sp: SP
|
@Inject lateinit var sp: SP
|
||||||
|
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
@Inject lateinit var pumpSync: PumpSync
|
@Inject lateinit var pumpSync: PumpSync
|
||||||
|
@ -93,8 +95,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
private var _podInfoBinding: OmnipodCommonOverviewPodInfoBinding? = null
|
private var _podInfoBinding: OmnipodCommonOverviewPodInfoBinding? = null
|
||||||
private var _buttonBinding: OmnipodCommonOverviewButtonsBinding? = null
|
private var _buttonBinding: OmnipodCommonOverviewButtonsBinding? = null
|
||||||
|
|
||||||
// These properties are only valid between onCreateView and
|
// These properties are only valid between onCreateView and onDestroyView.
|
||||||
// onDestroyView.
|
|
||||||
val binding get() = _binding!!
|
val binding get() = _binding!!
|
||||||
private val bluetoothStatusBinding get() = _bluetoothStatusBinding!!
|
private val bluetoothStatusBinding get() = _bluetoothStatusBinding!!
|
||||||
private val podInfoBinding get() = _podInfoBinding!!
|
private val podInfoBinding get() = _podInfoBinding!!
|
||||||
|
@ -112,8 +113,12 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
buttonBinding.buttonPodManagement.setOnClickListener {
|
buttonBinding.buttonPodManagement.setOnClickListener {
|
||||||
// TODO add protection
|
activity?.let { activity ->
|
||||||
startActivity(Intent(context, DashPodManagementActivity::class.java))
|
protectionCheck.queryProtection(
|
||||||
|
activity,
|
||||||
|
ProtectionCheck.Protection.PREFERENCES,
|
||||||
|
UIRunnable { startActivity(Intent(context, DashPodManagementActivity::class.java)) })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buttonBinding.buttonResumeDelivery.setOnClickListener {
|
buttonBinding.buttonResumeDelivery.setOnClickListener {
|
||||||
|
|
Loading…
Reference in a new issue