Cleanup FetchPushForegroundService (#6577)
* Rename `PushHandlingWakeLock` to `FetchPushForegroundServiceManager`. Move the start/stop logic from `FetchPushForegroundService.Companion` to it. * Add more tests using Robolectric. * Remove `FeatureFlags.SyncNotificationsWithWorkManager` and associated code: this should have been removed in one of the previous refactors, since we don't have the 2 ways to sync notifications anymore, everything uses the `WorkManager` --------- Co-authored-by: Benoit Marty <benoit@matrix.org>
This commit is contained in:
parent
8853f160e2
commit
f80a140cf9
17 changed files with 329 additions and 215 deletions
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2026 Element Creations Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.push.test.push
|
||||
|
||||
import io.element.android.libraries.push.api.push.FetchPushForegroundServiceManager
|
||||
|
||||
class FakeFetchPushForegroundServiceManager(
|
||||
private val lock: () -> Boolean = { true },
|
||||
private val unlock: () -> Boolean = { true },
|
||||
) : FetchPushForegroundServiceManager {
|
||||
override fun start(): Boolean {
|
||||
return lock.invoke()
|
||||
}
|
||||
|
||||
override suspend fun stop(): Boolean {
|
||||
return unlock.invoke()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2026 Element Creations Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.push.test.push
|
||||
|
||||
import io.element.android.libraries.push.api.push.PushHandlingWakeLock
|
||||
import kotlin.time.Duration
|
||||
|
||||
class FakePushHandlingWakeLock(
|
||||
private val lock: (time: Duration) -> Unit = {},
|
||||
private val unlock: () -> Unit = {},
|
||||
) : PushHandlingWakeLock {
|
||||
override fun lock(time: Duration) {
|
||||
lock.invoke(time)
|
||||
}
|
||||
|
||||
override suspend fun unlock() {
|
||||
unlock.invoke()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue