mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Fix wakelock not stopping early when notifications are disabled (#6424)
If notifications for a device are disabled when there is no connection with the HS, the push registration will still exist, so the device can still receive push notifications. In that cases, we were running into an issue where the wakelock for push notifications was started immediately after receiving a push but was never stopped and it ran for 3 minutes until its timeout, keeping the device awake for no reason. This patch changes `DefaultPushHandler` so if we don't need the wakelock it returns `false` and we can stop the wakelock early.
This commit is contained in:
committed by
GitHub
parent
3a7faa8b76
commit
f1708f6366
+3
-3
@@ -13,11 +13,11 @@ import io.element.android.libraries.pushproviders.api.PushHandler
|
||||
import io.element.android.tests.testutils.lambda.lambdaError
|
||||
|
||||
class FakePushHandler(
|
||||
private val handleResult: (PushData, String) -> Unit = { _, _ -> lambdaError() },
|
||||
private val handleResult: (PushData, String) -> Boolean = { _, _ -> lambdaError() },
|
||||
private val handleInvalidResult: (String, String) -> Unit = { _, _ -> lambdaError() },
|
||||
) : PushHandler {
|
||||
override suspend fun handle(pushData: PushData, providerInfo: String) {
|
||||
handleResult(pushData, providerInfo)
|
||||
override suspend fun handle(pushData: PushData, providerInfo: String): Boolean {
|
||||
return handleResult(pushData, providerInfo)
|
||||
}
|
||||
|
||||
override suspend fun handleInvalid(providerInfo: String, data: String) {
|
||||
|
||||
Reference in New Issue
Block a user