Fix Objectives processing

This commit is contained in:
Milos Kozak 2021-10-18 20:10:18 +02:00
parent 52ffc8d7ff
commit 3f8e56d50e
3 changed files with 4 additions and 2 deletions

View file

@ -412,6 +412,7 @@ class LoopDialog : DaggerDialogFragment() {
loopPlugin.goToZeroTemp(T.hours(1).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP) loopPlugin.goToZeroTemp(T.hours(1).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
rxBus.send(EventRefreshOverview("suspend_menu")) rxBus.send(EventRefreshOverview("suspend_menu"))
} }
sp.putBoolean(R.string.key_objectiveusedisconnect, true)
return true return true
} }

View file

@ -185,6 +185,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
ValueWithUnit.Percent(percent), ValueWithUnit.Percent(percent),
ValueWithUnit.Hour(timeShift).takeIf { timeShift != 0 }, ValueWithUnit.Hour(timeShift).takeIf { timeShift != 0 },
ValueWithUnit.Minute(duration).takeIf { duration != 0 }) ValueWithUnit.Minute(duration).takeIf { duration != 0 })
if (percent == 90 && duration == 10) sp.putBoolean(R.string.key_objectiveuseprofileswitch, true)
if (isTT) { if (isTT) {
disposable += repository.runTransactionForResult( disposable += repository.runTransactionForResult(
InsertAndCancelCurrentTemporaryTargetTransaction( InsertAndCancelCurrentTemporaryTargetTransaction(

View file

@ -86,10 +86,10 @@ abstract class Objective(injector: HasAndroidInjector, spName: String, @StringRe
abstract fun isCompleted(): Boolean abstract fun isCompleted(): Boolean
open fun isCompleted(trueTime: Long): Boolean = isCompleted open fun isCompleted(trueTime: Long): Boolean = isCompleted()
open val progress: String open val progress: String
get() = resourceHelper.gs(if (isCompleted) R.string.completed_well_done else R.string.not_completed_yet) get() = resourceHelper.gs(if (isCompleted()) R.string.completed_well_done else R.string.not_completed_yet)
fun hint(hint: Hint): Task { fun hint(hint: Hint): Task {
hints.add(hint) hints.add(hint)