remove isAlwaysPowered

This commit is contained in:
andrekir
2022-03-28 09:11:06 -03:00
parent 879bd574c1
commit a6fb214852
3 changed files with 0 additions and 33 deletions

View File

@@ -20,7 +20,6 @@ import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@@ -154,17 +153,6 @@ class UIViewModel @Inject constructor(
}
}
var isAlwaysPowered: Boolean?
get() = radioConfig.value?.preferences?.isAlwaysPowered
set(value) {
val config = radioConfig.value
if (value != null && config != null) {
val builder = config.toBuilder()
builder.preferencesBuilder.isAlwaysPowered = value
setRadioConfig(builder.build())
}
}
var region: RadioConfigProtos.RegionCode
get() = meshService?.region?.let { RadioConfigProtos.RegionCode.forNumber(it) }
?: RadioConfigProtos.RegionCode.Unset

View File

@@ -44,7 +44,6 @@ class AdvancedSettingsFragment : ScreenFragment("Advanced Settings"), Logging {
binding.positionBroadcastSwitch.isChecked = !model.locationShareDisabled
binding.lsSleepView.isEnabled = model.isPowerSaving ?: false
binding.lsSleepSwitch.isChecked = model.isPowerSaving ?: false
binding.isAlwaysPoweredSwitch.isChecked = model.isAlwaysPowered ?: false
}
model.isConnected.observe(viewLifecycleOwner) { connectionState ->
@@ -53,7 +52,6 @@ class AdvancedSettingsFragment : ScreenFragment("Advanced Settings"), Logging {
binding.lsSleepView.isEnabled = connected && model.isPowerSaving ?: false
binding.positionBroadcastSwitch.isEnabled = connected
binding.lsSleepSwitch.isEnabled = connected
binding.isAlwaysPoweredSwitch.isEnabled = connected
}
binding.positionBroadcastPeriodEditText.on(EditorInfo.IME_ACTION_DONE) {
@@ -108,12 +106,5 @@ class AdvancedSettingsFragment : ScreenFragment("Advanced Settings"), Logging {
debug("User changed isPowerSaving to $isChecked")
}
}
binding.isAlwaysPoweredSwitch.setOnCheckedChangeListener { view, isChecked ->
if (view.isPressed) {
model.isAlwaysPowered = isChecked
debug("User changed isAlwaysPowered to $isChecked")
}
}
}
}