From 5ed2e92801443a140e4cc71dae0b924f4854979f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 9 May 2025 09:55:35 +0000 Subject: [PATCH] fix(deps): update lifecycle to v2.9.0 (#4693) * fix(deps): update lifecycle to v2.9.0 * Remove unused code. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Benoit Marty --- gradle/libs.versions.toml | 2 +- .../components/keyboard/Keyboard.kt | 34 ------------------- 2 files changed, 1 insertion(+), 35 deletions(-) delete mode 100644 libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/keyboard/Keyboard.kt 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) -}