From deb012600dd220de1bea2fc20ecd2ff443c9f243 Mon Sep 17 00:00:00 2001 From: darken Date: Thu, 4 Sep 2025 11:32:21 +0200 Subject: [PATCH] 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. --- .../eu/darken/capod/main/core/GeneralSettings.kt | 3 --- .../darken/capod/pods/core/apple/AppleFactory.kt | 1 - .../capod/main/ui/overview/OverviewFragmentVM.kt | 13 ++----------- .../general/debug/DebugSettingsFragmentVM.kt | 16 ---------------- app/src/main/res/values/strings.xml | 2 -- app/src/main/res/xml/preferences_general.xml | 6 ------ 6 files changed, 2 insertions(+), 39 deletions(-) diff --git a/app-common/src/main/java/eu/darken/capod/main/core/GeneralSettings.kt b/app-common/src/main/java/eu/darken/capod/main/core/GeneralSettings.kt index f8c25125..f8da841d 100644 --- a/app-common/src/main/java/eu/darken/capod/main/core/GeneralSettings.kt +++ b/app-common/src/main/java/eu/darken/capod/main/core/GeneralSettings.kt @@ -35,8 +35,6 @@ class GeneralSettings @Inject constructor( 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 mainDeviceAddress = preferences.createFlowPreference("core.maindevice.address", null) @@ -66,7 +64,6 @@ class GeneralSettings @Inject constructor( useExtraMonitorNotification, keepConnectedNotificationAfterDisconnect, scannerMode, - showAll, minimumSignalQuality, mainDeviceAddress, isOffloadedFilteringDisabled, diff --git a/app-common/src/main/java/eu/darken/capod/pods/core/apple/AppleFactory.kt b/app-common/src/main/java/eu/darken/capod/pods/core/apple/AppleFactory.kt index 6692c8a8..e6a492c0 100644 --- a/app-common/src/main/java/eu/darken/capod/pods/core/apple/AppleFactory.kt +++ b/app-common/src/main/java/eu/darken/capod/pods/core/apple/AppleFactory.kt @@ -83,7 +83,6 @@ class AppleFactory @Inject constructor( val factory = podFactories.firstOrNull { it.isResponsible(proximityMessage) } - return@withLock (factory ?: unknownAppleFactory).create( scanResult = scanResult, payload = payload, diff --git a/app/src/main/java/eu/darken/capod/main/ui/overview/OverviewFragmentVM.kt b/app/src/main/java/eu/darken/capod/main/ui/overview/OverviewFragmentVM.kt index a0f0e525..7287371c 100644 --- a/app/src/main/java/eu/darken/capod/main/ui/overview/OverviewFragmentVM.kt +++ b/app/src/main/java/eu/darken/capod/main/ui/overview/OverviewFragmentVM.kt @@ -104,15 +104,7 @@ class OverviewFragmentVM @Inject constructor( return@flatMapLatest flowOf(emptyList()) } - generalSettings.showAll.flow.flatMapLatest { showAll -> - if (showAll) { - podMonitor.devices - } else { - podMonitor.mainDevice.map { mainDevice -> - mainDevice?.let { listOf(it) } ?: emptyList() - } - } - } + podMonitor.devices } .catch { errorEvents.postValue(it) } .throttleLatest(1000) @@ -122,10 +114,9 @@ class OverviewFragmentVM @Inject constructor( permissionTool.missingPermissions, pods, debugSettings.isDebugModeEnabled.flow, - generalSettings.showAll.flow, bluetoothManager.isBluetoothEnabled, podMonitor.mainDevice, - ) { _, permissions, pods, isDebugMode, showAll, isBluetoothEnabled, mainPod -> + ) { _, permissions, pods, isDebugMode, isBluetoothEnabled, mainPod -> val items = mutableListOf() permissions diff --git a/app/src/main/java/eu/darken/capod/main/ui/settings/general/debug/DebugSettingsFragmentVM.kt b/app/src/main/java/eu/darken/capod/main/ui/settings/general/debug/DebugSettingsFragmentVM.kt index 564fc984..f439616c 100644 --- a/app/src/main/java/eu/darken/capod/main/ui/settings/general/debug/DebugSettingsFragmentVM.kt +++ b/app/src/main/java/eu/darken/capod/main/ui/settings/general/debug/DebugSettingsFragmentVM.kt @@ -4,12 +4,9 @@ import androidx.lifecycle.SavedStateHandle import dagger.hilt.android.lifecycle.HiltViewModel import eu.darken.capod.common.coroutine.DispatcherProvider 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.uix.ViewModel3 import eu.darken.capod.main.core.GeneralSettings -import kotlinx.coroutines.flow.distinctUntilChanged -import kotlinx.coroutines.flow.onEach import javax.inject.Inject @HiltViewModel @@ -20,19 +17,6 @@ class DebugSettingsFragmentVM @Inject constructor( private val debugSettings: DebugSettings, ) : 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 { private val TAG = logTag("Settings", "Debug", "VM") } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d2090969..30deb005 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -26,8 +26,6 @@ Should the Bluetooth Low Energy data scanner prioritize performance or conserve energy? Auto pause Pause audio when removing the device from your ear. - Show all devices - Show other people\'s devices that are near you. Auto play Start audio playback when device is worn. Fake data diff --git a/app/src/main/res/xml/preferences_general.xml b/app/src/main/res/xml/preferences_general.xml index 33e30f42..4713b752 100644 --- a/app/src/main/res/xml/preferences_general.xml +++ b/app/src/main/res/xml/preferences_general.xml @@ -14,12 +14,6 @@ android:summary="@string/settings_scanner_mode_description" android:title="@string/settings_scanner_mode_label" /> - -