cleanup
This commit is contained in:
parent
d939f7ba99
commit
1ff6aa7bbf
14 changed files with 14 additions and 19 deletions
|
@ -56,7 +56,6 @@ import info.nightscout.interfaces.constraints.ConstraintsChecker
|
||||||
import info.nightscout.interfaces.logging.UserEntryLogger
|
import info.nightscout.interfaces.logging.UserEntryLogger
|
||||||
import info.nightscout.interfaces.maintenance.PrefFileListProvider
|
import info.nightscout.interfaces.maintenance.PrefFileListProvider
|
||||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||||
import info.nightscout.interfaces.plugin.PluginBase
|
|
||||||
import info.nightscout.interfaces.profile.ProfileFunction
|
import info.nightscout.interfaces.profile.ProfileFunction
|
||||||
import info.nightscout.interfaces.protection.ProtectionCheck
|
import info.nightscout.interfaces.protection.ProtectionCheck
|
||||||
import info.nightscout.interfaces.smsCommunicator.SmsCommunicator
|
import info.nightscout.interfaces.smsCommunicator.SmsCommunicator
|
||||||
|
@ -283,7 +282,7 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
|
||||||
private fun start() {
|
private fun start() {
|
||||||
binding.splash.visibility = View.GONE
|
binding.splash.visibility = View.GONE
|
||||||
//Check here if loop plugin is disabled. Else check via constraints
|
//Check here if loop plugin is disabled. Else check via constraints
|
||||||
if (!(loop as PluginBase).isEnabled()) versionCheckerUtils.triggerCheckVersion()
|
if (!loop.isEnabled()) versionCheckerUtils.triggerCheckVersion()
|
||||||
setUserStats()
|
setUserStats()
|
||||||
setupViews()
|
setupViews()
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.interfaces.iob
|
package info.nightscout.interfaces.iob
|
||||||
|
|
||||||
/** All COB up to now, including carbs not yet processed by IobCob calculation. */
|
/** All COB up to now, including carbs not yet processed by IobCob calculation. */
|
||||||
class CobInfo(val timestamp: Long, val displayCob: Double?, val futureCarbs: Double)
|
data class CobInfo(val timestamp: Long, val displayCob: Double?, val futureCarbs: Double)
|
|
@ -5,4 +5,5 @@ interface SmsCommunicator {
|
||||||
var messages: ArrayList<Sms>
|
var messages: ArrayList<Sms>
|
||||||
fun sendNotificationToAllNumbers(text: String): Boolean
|
fun sendNotificationToAllNumbers(text: String): Boolean
|
||||||
fun sendSMS(sms: Sms): Boolean
|
fun sendSMS(sms: Sms): Boolean
|
||||||
|
fun isEnabled(): Boolean
|
||||||
}
|
}
|
|
@ -27,7 +27,6 @@ import info.nightscout.interfaces.iob.GlucoseStatusProvider
|
||||||
import info.nightscout.interfaces.iob.IobCobCalculator
|
import info.nightscout.interfaces.iob.IobCobCalculator
|
||||||
import info.nightscout.interfaces.logging.UserEntryLogger
|
import info.nightscout.interfaces.logging.UserEntryLogger
|
||||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||||
import info.nightscout.interfaces.plugin.PluginBase
|
|
||||||
import info.nightscout.interfaces.profile.Profile
|
import info.nightscout.interfaces.profile.Profile
|
||||||
import info.nightscout.interfaces.profile.ProfileFunction
|
import info.nightscout.interfaces.profile.ProfileFunction
|
||||||
import info.nightscout.interfaces.pump.DetailedBolusInfo
|
import info.nightscout.interfaces.pump.DetailedBolusInfo
|
||||||
|
@ -455,7 +454,7 @@ class BolusWizard @Inject constructor(
|
||||||
if (insulinAfterConstraints > 0 || carbs > 0) {
|
if (insulinAfterConstraints > 0 || carbs > 0) {
|
||||||
if (useSuperBolus) {
|
if (useSuperBolus) {
|
||||||
uel.log(Action.SUPERBOLUS_TBR, Sources.WizardDialog)
|
uel.log(Action.SUPERBOLUS_TBR, Sources.WizardDialog)
|
||||||
if ((loop as PluginBase).isEnabled()) {
|
if (loop.isEnabled()) {
|
||||||
loop.goToZeroTemp(2 * 60, profile, OfflineEvent.Reason.SUPER_BOLUS)
|
loop.goToZeroTemp(2 * 60, profile, OfflineEvent.Reason.SUPER_BOLUS)
|
||||||
rxBus.send(EventRefreshOverview("WizardDialog"))
|
rxBus.send(EventRefreshOverview("WizardDialog"))
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ import info.nightscout.interfaces.db.PersistenceLayer
|
||||||
import info.nightscout.interfaces.iob.GlucoseStatusProvider
|
import info.nightscout.interfaces.iob.GlucoseStatusProvider
|
||||||
import info.nightscout.interfaces.iob.InMemoryGlucoseValue
|
import info.nightscout.interfaces.iob.InMemoryGlucoseValue
|
||||||
import info.nightscout.interfaces.iob.IobCobCalculator
|
import info.nightscout.interfaces.iob.IobCobCalculator
|
||||||
import info.nightscout.interfaces.plugin.PluginBase
|
|
||||||
import info.nightscout.interfaces.profile.Profile
|
import info.nightscout.interfaces.profile.Profile
|
||||||
import info.nightscout.interfaces.profile.ProfileFunction
|
import info.nightscout.interfaces.profile.ProfileFunction
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
import info.nightscout.rx.logging.AAPSLogger
|
||||||
|
@ -141,7 +140,7 @@ class QuickWizardEntry @Inject constructor(private val injector: HasAndroidInjec
|
||||||
if (useSuperBolus() == YES && sp.getBoolean(info.nightscout.core.utils.R.string.key_usesuperbolus, false)) {
|
if (useSuperBolus() == YES && sp.getBoolean(info.nightscout.core.utils.R.string.key_usesuperbolus, false)) {
|
||||||
superBolus = true
|
superBolus = true
|
||||||
}
|
}
|
||||||
if ((loop as PluginBase).isEnabled() && loop.isSuperBolus) superBolus = false
|
if (loop.isEnabled() && loop.isSuperBolus) superBolus = false
|
||||||
// Trend
|
// Trend
|
||||||
val glucoseStatus = glucoseStatusProvider.glucoseStatusData
|
val glucoseStatus = glucoseStatusProvider.glucoseStatusData
|
||||||
var trend = false
|
var trend = false
|
||||||
|
|
|
@ -5,7 +5,6 @@ import info.nightscout.database.ValueWrapper
|
||||||
import info.nightscout.database.impl.AppRepository
|
import info.nightscout.database.impl.AppRepository
|
||||||
import info.nightscout.interfaces.Config
|
import info.nightscout.interfaces.Config
|
||||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||||
import info.nightscout.interfaces.plugin.PluginBase
|
|
||||||
import info.nightscout.interfaces.profile.Profile
|
import info.nightscout.interfaces.profile.Profile
|
||||||
import info.nightscout.interfaces.pump.PumpEnactResult
|
import info.nightscout.interfaces.pump.PumpEnactResult
|
||||||
import info.nightscout.interfaces.queue.Callback
|
import info.nightscout.interfaces.queue.Callback
|
||||||
|
@ -42,7 +41,7 @@ class CommandSetProfile constructor(
|
||||||
// Send SMS notification if ProfileSwitch is coming from NS
|
// Send SMS notification if ProfileSwitch is coming from NS
|
||||||
val profileSwitch = repository.getEffectiveProfileSwitchActiveAt(dateUtil.now()).blockingGet()
|
val profileSwitch = repository.getEffectiveProfileSwitchActiveAt(dateUtil.now()).blockingGet()
|
||||||
if (profileSwitch is ValueWrapper.Existing && r.enacted && hasNsId && !config.NSCLIENT) {
|
if (profileSwitch is ValueWrapper.Existing && r.enacted && hasNsId && !config.NSCLIENT) {
|
||||||
if ((smsCommunicator as PluginBase).isEnabled())
|
if (smsCommunicator.isEnabled())
|
||||||
smsCommunicator.sendNotificationToAllNumbers(rh.gs(info.nightscout.core.ui.R.string.profile_set_ok))
|
smsCommunicator.sendNotificationToAllNumbers(rh.gs(info.nightscout.core.ui.R.string.profile_set_ok))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ class ActionLoopDisable(injector: HasAndroidInjector) : Action(injector) {
|
||||||
@DrawableRes override fun icon(): Int = R.drawable.ic_stop_24dp
|
@DrawableRes override fun icon(): Int = R.drawable.ic_stop_24dp
|
||||||
|
|
||||||
override fun doAction(callback: Callback) {
|
override fun doAction(callback: Callback) {
|
||||||
if ((loopPlugin as PluginBase).isEnabled()) {
|
if (loopPlugin.isEnabled()) {
|
||||||
(loopPlugin as PluginBase).setPluginEnabled(PluginType.LOOP, false)
|
(loopPlugin as PluginBase).setPluginEnabled(PluginType.LOOP, false)
|
||||||
configBuilder.storeSettings("ActionLoopDisable")
|
configBuilder.storeSettings("ActionLoopDisable")
|
||||||
uel.log(UserEntry.Action.LOOP_DISABLED, Sources.Automation, title)
|
uel.log(UserEntry.Action.LOOP_DISABLED, Sources.Automation, title)
|
||||||
|
|
|
@ -28,7 +28,7 @@ class ActionLoopEnable(injector: HasAndroidInjector) : Action(injector) {
|
||||||
@DrawableRes override fun icon(): Int = R.drawable.ic_play_circle_outline_24dp
|
@DrawableRes override fun icon(): Int = R.drawable.ic_play_circle_outline_24dp
|
||||||
|
|
||||||
override fun doAction(callback: Callback) {
|
override fun doAction(callback: Callback) {
|
||||||
if (!(loopPlugin as PluginBase).isEnabled()) {
|
if (!loopPlugin.isEnabled()) {
|
||||||
(loopPlugin as PluginBase).setPluginEnabled(PluginType.LOOP, true)
|
(loopPlugin as PluginBase).setPluginEnabled(PluginType.LOOP, true)
|
||||||
configBuilder.storeSettings("ActionLoopEnable")
|
configBuilder.storeSettings("ActionLoopEnable")
|
||||||
rxBus.send(EventRefreshOverview("ActionLoopEnable"))
|
rxBus.send(EventRefreshOverview("ActionLoopEnable"))
|
||||||
|
|
|
@ -20,7 +20,6 @@ import info.nightscout.interfaces.AndroidPermission
|
||||||
import info.nightscout.interfaces.Config
|
import info.nightscout.interfaces.Config
|
||||||
import info.nightscout.interfaces.notifications.Notification
|
import info.nightscout.interfaces.notifications.Notification
|
||||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||||
import info.nightscout.interfaces.plugin.PluginBase
|
|
||||||
import info.nightscout.interfaces.smsCommunicator.SmsCommunicator
|
import info.nightscout.interfaces.smsCommunicator.SmsCommunicator
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -86,7 +85,7 @@ class AndroidPermissionImpl @Inject constructor(
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
override fun notifyForSMSPermissions(activity: FragmentActivity, smsCommunicator: SmsCommunicator) {
|
override fun notifyForSMSPermissions(activity: FragmentActivity, smsCommunicator: SmsCommunicator) {
|
||||||
if ((smsCommunicator as PluginBase).isEnabled()) {
|
if (smsCommunicator.isEnabled()) {
|
||||||
if (permissionNotGranted(activity, Manifest.permission.RECEIVE_SMS))
|
if (permissionNotGranted(activity, Manifest.permission.RECEIVE_SMS))
|
||||||
activePlugin.activeOverview.addNotification(
|
activePlugin.activeOverview.addNotification(
|
||||||
id = Notification.PERMISSION_SMS,
|
id = Notification.PERMISSION_SMS,
|
||||||
|
|
|
@ -13,7 +13,6 @@ import info.nightscout.configuration.maintenance.PrefsFileContract
|
||||||
import info.nightscout.core.ui.dialogs.OKDialog
|
import info.nightscout.core.ui.dialogs.OKDialog
|
||||||
import info.nightscout.core.ui.locale.LocaleHelper
|
import info.nightscout.core.ui.locale.LocaleHelper
|
||||||
import info.nightscout.interfaces.maintenance.ImportExportPrefs
|
import info.nightscout.interfaces.maintenance.ImportExportPrefs
|
||||||
import info.nightscout.interfaces.permissions.OptimizationPermissionContract
|
|
||||||
import info.nightscout.rx.bus.RxBus
|
import info.nightscout.rx.bus.RxBus
|
||||||
import info.nightscout.rx.events.EventThemeSwitch
|
import info.nightscout.rx.events.EventThemeSwitch
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
import info.nightscout.rx.logging.AAPSLogger
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.interfaces.permissions
|
package info.nightscout.configuration.activities
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
|
@ -1038,7 +1038,7 @@ class DataHandlerMobile @Inject constructor(
|
||||||
get() {
|
get() {
|
||||||
var ret = ""
|
var ret = ""
|
||||||
// decide if enabled/disabled closed/open; what Plugin as APS?
|
// decide if enabled/disabled closed/open; what Plugin as APS?
|
||||||
if ((loop as PluginBase).isEnabled()) {
|
if (loop.isEnabled()) {
|
||||||
ret += if (constraintChecker.isClosedLoopAllowed().value()) {
|
ret += if (constraintChecker.isClosedLoopAllowed().value()) {
|
||||||
rh.gs(R.string.loop_status_closed) + "\n"
|
rh.gs(R.string.loop_status_closed) + "\n"
|
||||||
} else {
|
} else {
|
||||||
|
@ -1137,7 +1137,7 @@ class DataHandlerMobile @Inject constructor(
|
||||||
private fun generateStatusString(profile: Profile?): String {
|
private fun generateStatusString(profile: Profile?): String {
|
||||||
var status = ""
|
var status = ""
|
||||||
profile ?: return rh.gs(info.nightscout.core.ui.R.string.noprofile)
|
profile ?: return rh.gs(info.nightscout.core.ui.R.string.noprofile)
|
||||||
if (!(loop as PluginBase).isEnabled()) status += rh.gs(R.string.disabled_loop) + "\n"
|
if (!loop.isEnabled()) status += rh.gs(R.string.disabled_loop) + "\n"
|
||||||
return status
|
return status
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,7 @@ class LoopDialog : DaggerDialogFragment() {
|
||||||
binding.overviewReconnect.visibility = View.VISIBLE
|
binding.overviewReconnect.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
!(loop as PluginBase).isEnabled() -> {
|
!loop.isEnabled() -> {
|
||||||
binding.overviewLoop.visibility = View.VISIBLE
|
binding.overviewLoop.visibility = View.VISIBLE
|
||||||
binding.overviewEnable.visibility = View.VISIBLE
|
binding.overviewEnable.visibility = View.VISIBLE
|
||||||
binding.overviewDisable.visibility = View.GONE
|
binding.overviewDisable.visibility = View.GONE
|
||||||
|
|
Loading…
Reference in a new issue