mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-15 02:36:12 -04:00
Prevent return@apply duplicates
Signed-off-by: Ricky Cheung <rcheung844@gmail.com>
This commit is contained in:
committed by
Matthias Urhahn
parent
fbcd595b45
commit
051677e7dd
@@ -79,26 +79,25 @@ class MonitorNotifications @Inject constructor(
|
||||
// Options here should be mutually exclusive, and are prioritized by their order of importance
|
||||
// Some options are omitted here, as they will conflict with other options
|
||||
// TODO: Implement a settings pane to allow user to customize this
|
||||
device.apply {
|
||||
when (device) {
|
||||
// Pods charging state
|
||||
// This goes first as pods should not be worn if it is still charging
|
||||
if (this is HasChargeDetection && isHeadsetBeingCharged) {
|
||||
contentTitleRes = eu.darken.capod.common.R.string.pods_charging_label
|
||||
return@apply
|
||||
is HasChargeDetection -> {
|
||||
if (device.isHeadsetBeingCharged)
|
||||
contentTitleRes = eu.darken.capod.common.R.string.pods_charging_label
|
||||
}
|
||||
|
||||
// Pods wear state
|
||||
if (this is HasEarDetection) {
|
||||
contentTitleRes = if (isBeingWorn) eu.darken.capod.common.R.string.headset_being_worn_label
|
||||
else eu.darken.capod.common.R.string.headset_not_being_worn_label
|
||||
return@apply
|
||||
is HasEarDetection -> {
|
||||
contentTitleRes = if (device.isBeingWorn) eu.darken.capod.common.R.string.headset_being_worn_label
|
||||
else eu.darken.capod.common.R.string.headset_not_being_worn_label
|
||||
}
|
||||
|
||||
// Case charge state
|
||||
// This is under pods wear state as we don't want it conflicting with it
|
||||
if (this is HasCase && isCaseCharging) {
|
||||
contentTitleRes = eu.darken.capod.common.R.string.pods_charging_label
|
||||
return@apply
|
||||
is HasCase -> {
|
||||
if (device.isCaseCharging)
|
||||
contentTitleRes = eu.darken.capod.common.R.string.pods_charging_label
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user