Remove "Show all devices" setting and always show all devices.

This commit removes the "Show all devices" toggle from General Settings. The app will now always display all nearby Bluetooth devices in the overview, simplifying the UI and device discovery.

The corresponding preference `core.showall.enabled` and its usage have been removed. The debug setting `showUnfiltered` no longer affects this behavior.
This commit is contained in:
darken
2025-09-29 13:36:21 +02:00
parent 15371e01ef
commit deb012600d
6 changed files with 2 additions and 39 deletions
@@ -35,8 +35,6 @@ class GeneralSettings @Inject constructor(
val scannerMode = preferences.createFlowPreference("core.scanner.mode", ScannerMode.BALANCED, moshi) val scannerMode = preferences.createFlowPreference("core.scanner.mode", ScannerMode.BALANCED, moshi)
val showAll = preferences.createFlowPreference("core.showall.enabled", true)
val minimumSignalQuality = preferences.createFlowPreference("core.signal.minimum", 0.20f) val minimumSignalQuality = preferences.createFlowPreference("core.signal.minimum", 0.20f)
val mainDeviceAddress = preferences.createFlowPreference<BluetoothAddress?>("core.maindevice.address", null) val mainDeviceAddress = preferences.createFlowPreference<BluetoothAddress?>("core.maindevice.address", null)
@@ -66,7 +64,6 @@ class GeneralSettings @Inject constructor(
useExtraMonitorNotification, useExtraMonitorNotification,
keepConnectedNotificationAfterDisconnect, keepConnectedNotificationAfterDisconnect,
scannerMode, scannerMode,
showAll,
minimumSignalQuality, minimumSignalQuality,
mainDeviceAddress, mainDeviceAddress,
isOffloadedFilteringDisabled, isOffloadedFilteringDisabled,
@@ -83,7 +83,6 @@ class AppleFactory @Inject constructor(
val factory = podFactories.firstOrNull { it.isResponsible(proximityMessage) } val factory = podFactories.firstOrNull { it.isResponsible(proximityMessage) }
return@withLock (factory ?: unknownAppleFactory).create( return@withLock (factory ?: unknownAppleFactory).create(
scanResult = scanResult, scanResult = scanResult,
payload = payload, payload = payload,
@@ -104,15 +104,7 @@ class OverviewFragmentVM @Inject constructor(
return@flatMapLatest flowOf(emptyList()) return@flatMapLatest flowOf(emptyList())
} }
generalSettings.showAll.flow.flatMapLatest { showAll -> podMonitor.devices
if (showAll) {
podMonitor.devices
} else {
podMonitor.mainDevice.map { mainDevice ->
mainDevice?.let { listOf(it) } ?: emptyList()
}
}
}
} }
.catch { errorEvents.postValue(it) } .catch { errorEvents.postValue(it) }
.throttleLatest(1000) .throttleLatest(1000)
@@ -122,10 +114,9 @@ class OverviewFragmentVM @Inject constructor(
permissionTool.missingPermissions, permissionTool.missingPermissions,
pods, pods,
debugSettings.isDebugModeEnabled.flow, debugSettings.isDebugModeEnabled.flow,
generalSettings.showAll.flow,
bluetoothManager.isBluetoothEnabled, bluetoothManager.isBluetoothEnabled,
podMonitor.mainDevice, podMonitor.mainDevice,
) { _, permissions, pods, isDebugMode, showAll, isBluetoothEnabled, mainPod -> ) { _, permissions, pods, isDebugMode, isBluetoothEnabled, mainPod ->
val items = mutableListOf<OverviewAdapter.Item>() val items = mutableListOf<OverviewAdapter.Item>()
permissions permissions
@@ -4,12 +4,9 @@ import androidx.lifecycle.SavedStateHandle
import dagger.hilt.android.lifecycle.HiltViewModel import dagger.hilt.android.lifecycle.HiltViewModel
import eu.darken.capod.common.coroutine.DispatcherProvider import eu.darken.capod.common.coroutine.DispatcherProvider
import eu.darken.capod.common.debug.DebugSettings import eu.darken.capod.common.debug.DebugSettings
import eu.darken.capod.common.debug.logging.log
import eu.darken.capod.common.debug.logging.logTag import eu.darken.capod.common.debug.logging.logTag
import eu.darken.capod.common.uix.ViewModel3 import eu.darken.capod.common.uix.ViewModel3
import eu.darken.capod.main.core.GeneralSettings import eu.darken.capod.main.core.GeneralSettings
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.onEach
import javax.inject.Inject import javax.inject.Inject
@HiltViewModel @HiltViewModel
@@ -20,19 +17,6 @@ class DebugSettingsFragmentVM @Inject constructor(
private val debugSettings: DebugSettings, private val debugSettings: DebugSettings,
) : ViewModel3(dispatcherProvider) { ) : ViewModel3(dispatcherProvider) {
init {
debugSettings.showUnfiltered.flow
.distinctUntilChanged()
.onEach { showUnfiltered ->
if (showUnfiltered) {
log(TAG) { "Enabling 'show all' due to debug setting 'show unfiltered' enabled" }
generalSettings.showAll.value = true
}
}
.launchInViewModel()
}
companion object { companion object {
private val TAG = logTag("Settings", "Debug", "VM") private val TAG = logTag("Settings", "Debug", "VM")
} }
-2
View File
@@ -26,8 +26,6 @@
<string name="settings_scanner_mode_description">Should the Bluetooth Low Energy data scanner prioritize performance or conserve energy?</string> <string name="settings_scanner_mode_description">Should the Bluetooth Low Energy data scanner prioritize performance or conserve energy?</string>
<string name="settings_autopause_label">Auto pause</string> <string name="settings_autopause_label">Auto pause</string>
<string name="settings_autopause_description">Pause audio when removing the device from your ear.</string> <string name="settings_autopause_description">Pause audio when removing the device from your ear.</string>
<string name="settings_showall_label">Show all devices</string>
<string name="settings_showall_description">Show other people\'s devices that are near you.</string>
<string name="settings_autopplay_label">Auto play</string> <string name="settings_autopplay_label">Auto play</string>
<string name="settings_autoplay_description">Start audio playback when device is worn.</string> <string name="settings_autoplay_description">Start audio playback when device is worn.</string>
<string name="settings_fake_data_label">Fake data</string> <string name="settings_fake_data_label">Fake data</string>
@@ -14,12 +14,6 @@
android:summary="@string/settings_scanner_mode_description" android:summary="@string/settings_scanner_mode_description"
android:title="@string/settings_scanner_mode_label" /> android:title="@string/settings_scanner_mode_label" />
<eu.darken.capod.common.preferences.MaterialSwitchPreference
android:icon="@drawable/ic_baseline_devices_other_24"
android:key="core.showall.enabled"
android:summary="@string/settings_showall_description"
android:title="@string/settings_showall_label" />
<PreferenceCategory android:title="@string/settings_category_yourdevice_label"> <PreferenceCategory android:title="@string/settings_category_yourdevice_label">
<eu.darken.capod.common.preferences.PercentSliderPreference <eu.darken.capod.common.preferences.PercentSliderPreference