Merge pull request #137 from smuething/protect-pod-management

Add protection to Pod management activity
This commit is contained in:
bartsopers 2020-08-16 21:10:14 +02:00 committed by GitHub
commit a30ca700f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,8 +38,10 @@ import info.nightscout.androidaps.utils.LocalAlertUtils
import info.nightscout.androidaps.utils.T import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.WarnColors import info.nightscout.androidaps.utils.WarnColors
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.sharedPreferences.SP import info.nightscout.androidaps.utils.sharedPreferences.SP
import info.nightscout.androidaps.utils.ui.UIRunnable
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable import io.reactivex.disposables.Disposable
@ -67,6 +69,7 @@ class OmnipodFragment : DaggerFragment() {
@Inject lateinit var omnipodUtil: OmnipodUtil @Inject lateinit var omnipodUtil: OmnipodUtil
@Inject lateinit var rileyLinkServiceData: RileyLinkServiceData @Inject lateinit var rileyLinkServiceData: RileyLinkServiceData
@Inject lateinit var localAlertUtils: LocalAlertUtils @Inject lateinit var localAlertUtils: LocalAlertUtils
@Inject lateinit var protectionCheck: ProtectionCheck
private var disposable: CompositeDisposable = CompositeDisposable() private var disposable: CompositeDisposable = CompositeDisposable()
@ -93,7 +96,12 @@ class OmnipodFragment : DaggerFragment() {
omnipod_pod_mgmt.setOnClickListener { omnipod_pod_mgmt.setOnClickListener {
if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() == true) { if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() == true) {
startActivity(Intent(context, PodManagementActivity::class.java)) activity?.let { activity ->
protectionCheck.queryProtection(
activity,ProtectionCheck.Protection.PREFERENCES,
UIRunnable(Runnable{startActivity(Intent(context, PodManagementActivity::class.java))})
)
}
} else { } else {
displayNotConfiguredDialog() displayNotConfiguredDialog()
} }