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
+11
-1
@@ -9,11 +9,21 @@
|
||||
package io.element.android.libraries.pushproviders.api
|
||||
|
||||
interface PushHandler {
|
||||
/**
|
||||
* Handle a push received from the provider.
|
||||
*
|
||||
* @param pushData the data of the push, containing the client secret and the push content.
|
||||
* @param providerInfo an identifier of the provider that sent the push, for logging and debugging purposes.
|
||||
* @return `true` if the push was handled successfully and is now enqueued for processing, false otherwise.
|
||||
*/
|
||||
suspend fun handle(
|
||||
pushData: PushData,
|
||||
providerInfo: String,
|
||||
)
|
||||
): Boolean
|
||||
|
||||
/**
|
||||
* Handle an invalid push received from the provider.
|
||||
*/
|
||||
suspend fun handleInvalid(
|
||||
providerInfo: String,
|
||||
data: String,
|
||||
|
||||
Reference in New Issue
Block a user