diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 12576a6ef4..d288dfdcbf 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -14,7 +14,7 @@ core = "1.16.0" datastore = "1.1.6" constraintlayout = "2.2.1" constraintlayout_compose = "1.1.1" -lifecycle = "2.8.7" +lifecycle = "2.9.0" activity = "1.10.1" media3 = "1.6.1" camera = "1.4.2" diff --git a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/keyboard/Keyboard.kt b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/keyboard/Keyboard.kt deleted file mode 100644 index 020f567c1c..0000000000 --- a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/keyboard/Keyboard.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2023, 2024 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.designsystem.components.keyboard - -import androidx.compose.foundation.layout.ExperimentalLayoutApi -import androidx.compose.foundation.layout.WindowInsets -import androidx.compose.foundation.layout.isImeVisible -import androidx.compose.runtime.Composable -import androidx.compose.runtime.State -import androidx.compose.runtime.rememberUpdatedState -import androidx.lifecycle.Lifecycle -import androidx.lifecycle.compose.LocalLifecycleOwner - -/** - * Inspired from https://stackoverflow.com/questions/68847559/how-can-i-detect-keyboard-opening-and-closing-in-jetpack-compose - */ -enum class Keyboard { - Opened, - Closed -} - -// Note: it does not work as expected... -@OptIn(ExperimentalLayoutApi::class) -@Composable -fun keyboardAsState(): State { - val lifecycle = LocalLifecycleOwner.current.lifecycle - val isResumed = lifecycle.currentState == Lifecycle.State.RESUMED - return rememberUpdatedState(if (WindowInsets.isImeVisible && isResumed) Keyboard.Opened else Keyboard.Closed) -}