refactor: Move nudge persistence into GeneralSettings

Consolidate the nudge availability DataStoreValue with the rest of the persisted settings instead of carrying it in a separate Hilt module + DataStore file. Matches the existing convention where compat-style flags (offloaded filtering, indirect callbacks, etc.) live alongside theme/notification settings.

NudgeCapabilityStore keeps the verdict-mapping behavior; only the source of the persisted value changes.
This commit is contained in:
Matthias Urhahn
2026-05-07 14:10:16 +02:00
committed by Matthias Urhahn
parent 0e6848d886
commit 83ef111599
4 changed files with 19 additions and 38 deletions
@@ -1,6 +1,9 @@
package eu.darken.capod.common.bluetooth
import eu.darken.capod.main.core.GeneralSettings
import io.kotest.matchers.shouldBe
import io.mockk.every
import io.mockk.mockk
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.resetMain
@@ -18,11 +21,15 @@ class NudgeCapabilityStoreTest : BaseTest() {
private val testDispatcher = UnconfinedTestDispatcher()
private lateinit var fakePersisted: FakeDataStoreValue<NudgeAvailability>
private lateinit var generalSettings: GeneralSettings
@BeforeEach
fun setup() {
Dispatchers.setMain(testDispatcher)
fakePersisted = FakeDataStoreValue(NudgeAvailability.UNKNOWN)
generalSettings = mockk<GeneralSettings>().also {
every { it.nudgeAvailability } returns fakePersisted.mock
}
}
@AfterEach
@@ -31,7 +38,7 @@ class NudgeCapabilityStoreTest : BaseTest() {
}
private fun createStore() = NudgeCapabilityStore(
persistedValue = fakePersisted.mock,
generalSettings = generalSettings,
appScope = kotlinx.coroutines.CoroutineScope(testDispatcher),
dispatcherProvider = TestDispatcherProvider(testDispatcher),
)