Skip to content

Commit 9457c67

Browse files
committed
refactor(android): tweak SoundcoreEqualizerScreen shouldOverride logic
Remove the hardcoded list of devices, since it's too easy to forget to update the list. Until there is a false positive device, it's fine to just use the heuristic.
1 parent fbb608e commit 9457c67

1 file changed

Lines changed: 6 additions & 31 deletions

File tree

android/app/src/main/java/com/oppzippy/openscq30/ui/devicesettings/screens/categoryoverrides/SoundcoreEqualizerScreen.kt

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -61,39 +61,11 @@ private const val SETTING_ID_PRESET_EQUALIZER_PROFILE = "presetEqualizerProfile"
6161
private const val SETTING_ID_CUSTOM_EQUALIZER_PROFILE = "customEqualizerProfile"
6262
private const val SETTING_ID_VOLUME_ADJUSTMENTS = "volumeAdjustments"
6363

64-
// Since this screen is very specific to a particular set of settings in the Equalizer category, it's safest to enable
65-
// it per-device and otherwise fall back to the generic display.
66-
private val enabledDevices = hashSetOf(
67-
"SoundcoreA3004",
68-
"SoundcoreA3027",
69-
"SoundcoreA3028",
70-
"SoundcoreA3029",
71-
"SoundcoreA3030",
72-
"SoundcoreA3031",
73-
"SoundcoreA3033",
74-
"SoundcoreA3035",
75-
"SoundcoreA3040",
76-
"SoundcoreA3926",
77-
"SoundcoreA3930",
78-
"SoundcoreA3931",
79-
"SoundcoreA3933",
80-
"SoundcoreA3936",
81-
"SoundcoreA3945",
82-
"SoundcoreA3951",
83-
"SoundcoreA3939",
84-
"SoundcoreA3935",
85-
"SoundcoreA3955",
86-
"SoundcoreA3959",
87-
"SoundcoreA3947",
88-
"SoundcoreA3948",
89-
"SoundcoreA3949",
90-
)
91-
9264
object SoundcoreEqualizerScreen : CategoryOverride {
9365
// Be overly cautious and ensure all settings are as expected. It's better to not use this override when we should
9466
// rather than the other way around.
9567
override fun shouldOverride(deviceModel: String, settings: List<Pair<String, Setting>>): Boolean {
96-
if (deviceModel !in enabledDevices) return false
68+
if (!deviceModel.startsWith("Soundcore")) return false
9769
if (settings.size != 3) return false
9870

9971
val preset = getSettingById<Setting.OptionalSelectSetting>(
@@ -112,7 +84,10 @@ object SoundcoreEqualizerScreen : CategoryOverride {
11284
) {
11385
return false
11486
}
115-
return volumeAdjustments.setting.bandHz == listOf(
87+
return volumeAdjustments.setting.fractionDigits == 1.toShort() &&
88+
volumeAdjustments.setting.min == (-120).toShort() &&
89+
volumeAdjustments.setting.max == 134.toShort() &&
90+
volumeAdjustments.setting.bandHz == listOf(
11691
100.toUShort(),
11792
200.toUShort(),
11893
400.toUShort(),
@@ -121,7 +96,7 @@ object SoundcoreEqualizerScreen : CategoryOverride {
12196
3200.toUShort(),
12297
6400.toUShort(),
12398
12800.toUShort(),
124-
) && volumeAdjustments.setting.fractionDigits == 1.toShort()
99+
)
125100
}
126101

127102
@Composable

0 commit comments

Comments
 (0)