Add a banner to ask the user to disable battery optimization when Event cannot be resolved from Push.

This commit is contained in:
Benoit Marty 2025-06-06 17:59:52 +02:00
parent 11c2467577
commit 7deed4cc86
22 changed files with 583 additions and 11 deletions

View file

@ -0,0 +1,16 @@
/*
* Copyright 2025 New Vector 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.api.battery
import android.app.Activity
data class BatteryOptimizationState(
val shouldDisplayBanner: Boolean,
val dismiss: () -> Unit,
val openSettings: (Activity?) -> Unit,
)

View file

@ -0,0 +1,20 @@
/*
* Copyright 2025 New Vector 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.api.battery
import android.app.Activity
fun aBatteryOptimizationState(
shouldDisplayBanner: Boolean = false,
dismiss: () -> Unit = {},
openSettings: (Activity?) -> Unit = {},
) = BatteryOptimizationState(
shouldDisplayBanner = shouldDisplayBanner,
dismiss = dismiss,
openSettings = openSettings,
)