diff --git a/.github/workflows/call-check-changelog.yml b/.github/workflows/call-check-changelog.yml index baf1514a14..4030169d9c 100644 --- a/.github/workflows/call-check-changelog.yml +++ b/.github/workflows/call-check-changelog.yml @@ -7,12 +7,12 @@ jobs: name: "Checking that changelog has changed" runs-on: ubuntu-latest steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: submodules: 'recursive' - name: Get change status for CHANGELOG.md id: changed-changelog - uses: tj-actions/changed-files@40853de9f8ce2d6cfdc73c1b96f14e22ba44aec4 # v45.0.0 + uses: tj-actions/changed-files@c3a1bb2c992d77180ae65be6ae6c166cf40f857c # v45.0.3 with: files: CHANGELOG.md - name: Failed if changelog not changed diff --git a/.github/workflows/call-configuration-change.yml b/.github/workflows/call-configuration-change.yml index cbb23e87a3..8de822e52a 100644 --- a/.github/workflows/call-configuration-change.yml +++ b/.github/workflows/call-configuration-change.yml @@ -9,12 +9,12 @@ jobs: outputs: GRADLE_FILES_CHANGED: ${{ steps.gradle-related-changed.outputs.any_changed }} steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: submodules: 'recursive' - name: Check that gradle files changed id: gradle-related-changed - uses: tj-actions/changed-files@40853de9f8ce2d6cfdc73c1b96f14e22ba44aec4 # v45.0.0 + uses: tj-actions/changed-files@c3a1bb2c992d77180ae65be6ae6c166cf40f857c # v45.0.3 with: files: | **.gradle.kts @@ -30,11 +30,11 @@ jobs: matrix: target: [ "Release", "Debug", "Internal" ] steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: submodules: 'recursive' - name: Set up JDK 1.17 - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 + uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/call-create-baseline.yml b/.github/workflows/call-create-baseline.yml index aaad7ca82e..dc6ea629cb 100644 --- a/.github/workflows/call-create-baseline.yml +++ b/.github/workflows/call-create-baseline.yml @@ -25,12 +25,12 @@ jobs: BASELINE_FILE_PATH: ${{ steps.create_baseline_file_path.outputs.BASELINE_FILE_PATH }} steps: - name: Checkout Git repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: submodules: 'recursive' - name: Set up JDK 17 - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 + uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 with: distribution: 'adopt' java-version: 17 @@ -84,7 +84,7 @@ jobs: run: | ./gradlew ${{ steps.create_baseline_task.outputs.BASELINE_TASK }} - - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 + - uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 name: "Upload baseline file" with: name: ${{ steps.create_baseline_file_id.outputs.BASELINE_FILE_ID }} diff --git a/.github/workflows/call-validate-gradle-wrapper.yml b/.github/workflows/call-validate-gradle-wrapper.yml index 7b8b8d2b4d..61caf17a22 100644 --- a/.github/workflows/call-validate-gradle-wrapper.yml +++ b/.github/workflows/call-validate-gradle-wrapper.yml @@ -7,5 +7,5 @@ jobs: name: "Validate gradle wrapper" runs-on: ubuntu-latest steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 - uses: gradle/wrapper-validation-action@f9c9c575b8b21b6485636a91ffecd10e558c62f6 # v3 \ No newline at end of file diff --git a/.github/workflows/internal.yml b/.github/workflows/internal.yml index bcf2c5d2af..4ef1762a83 100644 --- a/.github/workflows/internal.yml +++ b/.github/workflows/internal.yml @@ -17,11 +17,11 @@ jobs: runs-on: ubuntu-latest needs: [ validate_gradle_wrapper ] steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: submodules: 'recursive' - name: Set up JDK 1.17 - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 + uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 with: distribution: 'temurin' java-version: '17' @@ -70,16 +70,16 @@ jobs: matrix: target: [ "gh_gms", "gh_nogms", "googleplay" ] steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: submodules: 'recursive' - - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 + - uses: actions/download-artifact@d0ce8fd1167ed839810201de977912a090ab10a7 name: "Download ${{ needs.create_internal_baseline.outputs.BUILD_VARIANT_NAME }} baseline file" with: name: ${{ needs.create_internal_baseline.outputs.BASELINE_FILE_ID }} path: ${{ needs.create_internal_baseline.outputs.BASELINE_FILE_PATH }} - name: Set up JDK 1.17 - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 + uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 with: distribution: 'temurin' java-version: '17' @@ -130,7 +130,7 @@ jobs: cp instances/android/app/build/outputs/mapping/internal/mapping.txt artifacts/mapping-${{ matrix.target }}.txt echo "path=artifacts/" >> $GITHUB_OUTPUT - name: Upload Artifacts - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4 + uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4 with: name: artifacts-${{ matrix.target }} path: ${{ steps.artifacts_copy.outputs.path }} @@ -139,11 +139,11 @@ jobs: runs-on: ubuntu-latest needs: build_number steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: submodules: 'recursive' - name: Set up JDK 1.17 - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 + uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 with: distribution: 'temurin' java-version: '17' @@ -192,7 +192,7 @@ jobs: cp instances/wearable/build/outputs/mapping/internal/mapping.txt artifacts/mapping-wearos.txt echo "path=artifacts/" >> $GITHUB_OUTPUT - name: Upload Artifacts - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4 + uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4 with: name: artifacts-wearos path: ${{ steps.artifacts_copy.outputs.path }} @@ -201,7 +201,7 @@ jobs: runs-on: ubuntu-latest needs: [ build_internal_release, build_internal_release_gms_wearos, build_number ] steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: submodules: 'recursive' - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4 diff --git a/.github/workflows/internal_release.yml b/.github/workflows/internal_release.yml index 5f585a363d..008fac59ab 100644 --- a/.github/workflows/internal_release.yml +++ b/.github/workflows/internal_release.yml @@ -49,16 +49,16 @@ jobs: matrix: target: [ "gh_gms", "gh_nogms", "googleplay" ] steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: submodules: 'recursive' - - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 + - uses: actions/download-artifact@d0ce8fd1167ed839810201de977912a090ab10a7 name: "Download ${{ needs.create_internal_baseline.outputs.BUILD_VARIANT_NAME }} baseline file" with: name: ${{ needs.create_internal_baseline.outputs.BASELINE_FILE_ID }} path: ${{ needs.create_internal_baseline.outputs.BASELINE_FILE_PATH }} - name: Set up JDK 1.17 - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 + uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 with: distribution: 'temurin' java-version: '17' @@ -109,7 +109,7 @@ jobs: cp instances/android/app/build/outputs/mapping/internal/mapping.txt artifacts/mapping-${{ matrix.target }}.txt echo "path=artifacts/" >> $GITHUB_OUTPUT - name: Upload Artifacts - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4 + uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4 with: name: artifacts-${{ matrix.target }} path: ${{ steps.artifacts_copy.outputs.path }} @@ -118,11 +118,11 @@ jobs: runs-on: ubuntu-latest needs: build_number steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: submodules: 'recursive' - name: Set up JDK 1.17 - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 + uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 with: distribution: 'temurin' java-version: '17' @@ -171,7 +171,7 @@ jobs: cp instances/wearable/build/outputs/mapping/internal/mapping.txt artifacts/mapping-wearos.txt echo "path=artifacts/" >> $GITHUB_OUTPUT - name: Upload Artifacts - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4 + uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4 with: name: artifacts-wearos path: ${{ steps.artifacts_copy.outputs.path }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 857fdfd715..6aff7fe34f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -49,11 +49,11 @@ jobs: matrix: target: [ "testDebugUnitTest", "desktopTest" ] steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: submodules: 'recursive' - name: Set up JDK 1.17 - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 + uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 with: distribution: 'temurin' java-version: '17' @@ -69,11 +69,11 @@ jobs: matrix: target: [ "detektMain", "lint" ] steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: submodules: 'recursive' - name: Set up JDK 1.17 - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 + uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e51f6d7c6b..60d1e0957b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,15 +50,15 @@ jobs: matrix: target: [ "gh_gms", "gh_nogms", "googleplay" ] steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: submodules: 'recursive' - name: Set up JDK 1.17 - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 + uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 with: distribution: 'temurin' java-version: '17' - - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 + - uses: actions/download-artifact@d0ce8fd1167ed839810201de977912a090ab10a7 name: "Download ${{ needs.create_release_baseline.outputs.BUILD_VARIANT_NAME }} baseline file" with: name: ${{ needs.create_release_baseline.outputs.BASELINE_FILE_ID }} @@ -110,7 +110,7 @@ jobs: cp instances/android/app/build/outputs/mapping/release/mapping.txt artifacts/mapping-${{ matrix.target }}.txt echo "path=artifacts/" >> $GITHUB_OUTPUT - name: Upload Artifacts - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4 + uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4 with: name: artifacts-${{ matrix.target }} path: ${{ steps.artifacts_copy.outputs.path }} @@ -119,11 +119,11 @@ jobs: runs-on: ubuntu-latest needs: build_number steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: submodules: 'recursive' - name: Set up JDK 1.17 - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 + uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 with: distribution: 'temurin' java-version: '17' @@ -172,7 +172,7 @@ jobs: cp instances/wearable/build/outputs/mapping/release/mapping.txt artifacts/mapping-wearos.txt echo "path=artifacts/" >> $GITHUB_OUTPUT - name: Upload Artifacts - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4 + uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4 with: name: artifacts-wearos path: ${{ steps.artifacts_copy.outputs.path }} @@ -182,7 +182,7 @@ jobs: if: ${{ github.ref == 'refs/heads/master' }} needs: [ build_release, build_release_gms_wearos, build_number ] steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: submodules: 'recursive' - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4 @@ -266,7 +266,7 @@ jobs: needs: [ build_release ] if: ${{ github.ref == 'refs/heads/master' }} steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: submodules: 'recursive' - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4 @@ -289,7 +289,7 @@ jobs: needs: [ build_release_gms_wearos ] if: ${{ github.ref == 'refs/heads/master' }} steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: submodules: 'recursive' - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4 diff --git a/components/archive/impl/src/main/java/com/flipperdevices/archive/impl/composable/category/ComposableCategoryCard.kt b/components/archive/impl/src/main/java/com/flipperdevices/archive/impl/composable/category/ComposableCategoryCard.kt index fb74b554ee..3c90cd688c 100644 --- a/components/archive/impl/src/main/java/com/flipperdevices/archive/impl/composable/category/ComposableCategoryCard.kt +++ b/components/archive/impl/src/main/java/com/flipperdevices/archive/impl/composable/category/ComposableCategoryCard.kt @@ -18,8 +18,8 @@ import kotlinx.collections.immutable.ImmutableList fun ComposableCategoryCard( categories: ImmutableList, deletedCategory: CategoryItem, - modifier: Modifier = Modifier, onOpenCategory: (CategoryType) -> Unit, + modifier: Modifier = Modifier ) { Card( modifier = modifier.padding(top = 14.dp, start = 14.dp, end = 14.dp, bottom = 2.dp) diff --git a/components/archive/impl/src/main/java/com/flipperdevices/archive/impl/composable/category/ComposableCategoryItem.kt b/components/archive/impl/src/main/java/com/flipperdevices/archive/impl/composable/category/ComposableCategoryItem.kt index 30438f5848..4e6b91a027 100644 --- a/components/archive/impl/src/main/java/com/flipperdevices/archive/impl/composable/category/ComposableCategoryItem.kt +++ b/components/archive/impl/src/main/java/com/flipperdevices/archive/impl/composable/category/ComposableCategoryItem.kt @@ -23,8 +23,8 @@ import com.flipperdevices.core.ui.res.R as DesignSystem @Composable fun ComposableCategoryItem( categoryItem: CategoryItem, - modifier: Modifier = Modifier, onOpenCategory: (CategoryType) -> Unit, + modifier: Modifier = Modifier ) { Row( modifier = modifier diff --git a/components/archive/impl/src/main/java/com/flipperdevices/archive/impl/composable/key/ComposableKeySmall.kt b/components/archive/impl/src/main/java/com/flipperdevices/archive/impl/composable/key/ComposableKeySmall.kt index f6d358ec31..89e2950b4d 100644 --- a/components/archive/impl/src/main/java/com/flipperdevices/archive/impl/composable/key/ComposableKeySmall.kt +++ b/components/archive/impl/src/main/java/com/flipperdevices/archive/impl/composable/key/ComposableKeySmall.kt @@ -20,8 +20,8 @@ import com.flipperdevices.core.ui.theme.LocalTypography fun ComposableKeySmall( keyPath: FlipperKeyPath, synchronizationContent: @Composable () -> Unit, - modifier: Modifier = Modifier, - onOpenKey: () -> Unit + onOpenKey: () -> Unit, + modifier: Modifier = Modifier ) { Card( modifier = modifier.padding(horizontal = 7.dp, vertical = 6.dp) diff --git a/components/bridge/impl/src/main/java/com/flipperdevices/bridge/impl/manager/service/request/FlipperRequestApiImpl.kt b/components/bridge/impl/src/main/java/com/flipperdevices/bridge/impl/manager/service/request/FlipperRequestApiImpl.kt index 21b1865379..3573075404 100644 --- a/components/bridge/impl/src/main/java/com/flipperdevices/bridge/impl/manager/service/request/FlipperRequestApiImpl.kt +++ b/components/bridge/impl/src/main/java/com/flipperdevices/bridge/impl/manager/service/request/FlipperRequestApiImpl.kt @@ -202,8 +202,8 @@ class FlipperRequestApiImpl @Inject constructor( ): Flipper.Main = suspendCancellableCoroutine { cont -> requestListeners[uniqueId] = { requestListeners.remove(uniqueId) - cont.resume(it) { throwable -> - error(throwable) { "Error on resume execution of $uniqueId command. Answer is $it" } + cont.resume(it) { cause, _, _ -> + error(cause) { "Error on resume execution of $uniqueId command. Answer is $it" } } } diff --git a/components/bridge/impl/src/test/java/com/flipperdevices/bridge/impl/manager/overflow/FlipperSerialOverflowThrottlerTest.kt b/components/bridge/impl/src/test/java/com/flipperdevices/bridge/impl/manager/overflow/FlipperSerialOverflowThrottlerTest.kt index dcf7cf1a47..0c4ce84959 100644 --- a/components/bridge/impl/src/test/java/com/flipperdevices/bridge/impl/manager/overflow/FlipperSerialOverflowThrottlerTest.kt +++ b/components/bridge/impl/src/test/java/com/flipperdevices/bridge/impl/manager/overflow/FlipperSerialOverflowThrottlerTest.kt @@ -11,7 +11,7 @@ import com.google.protobuf.ByteString import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.cancel import kotlinx.coroutines.test.TestScope -import kotlinx.coroutines.test.runBlockingTest +import kotlinx.coroutines.test.runTest import no.nordicsemi.android.ble.data.Data import org.junit.Assert import org.junit.Before @@ -58,7 +58,7 @@ class FlipperSerialOverflowThrottlerTest { } @Test - fun `Send request fitting in buffer size`() = runBlockingTest { + fun `Send request fitting in buffer size`() = runTest { val testRequest = main { systemPingRequest = pingRequest { } }.wrapToRequest() val bufferSize = testRequest.data.toDelimitedBytes().size @@ -70,7 +70,7 @@ class FlipperSerialOverflowThrottlerTest { } @Test - fun `Send request if we fit in buffer`() = runBlockingTest { + fun `Send request if we fit in buffer`() = runTest { val testRequest = main { systemPingRequest = pingRequest { data = ByteString.EMPTY } }.wrapToRequest() @@ -87,7 +87,7 @@ class FlipperSerialOverflowThrottlerTest { } @Test - fun `Send request larger than buffer`() = runBlockingTest { + fun `Send request larger than buffer`() = runTest { val testRequest = main { storageWriteRequest = writeRequest { file = file { diff --git a/components/bridge/service/impl/src/main/java/com/flipperdevices/bridge/service/impl/provider/FlipperServiceProviderImpl.kt b/components/bridge/service/impl/src/main/java/com/flipperdevices/bridge/service/impl/provider/FlipperServiceProviderImpl.kt index 1c9cedf527..4c3074df0c 100644 --- a/components/bridge/service/impl/src/main/java/com/flipperdevices/bridge/service/impl/provider/FlipperServiceProviderImpl.kt +++ b/components/bridge/service/impl/src/main/java/com/flipperdevices/bridge/service/impl/provider/FlipperServiceProviderImpl.kt @@ -20,7 +20,6 @@ import com.flipperdevices.core.log.error import com.flipperdevices.core.log.info import com.flipperdevices.core.preference.pb.Settings import com.squareup.anvil.annotations.ContributesBinding -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.suspendCancellableCoroutine import javax.inject.Inject import javax.inject.Singleton @@ -84,10 +83,9 @@ class FlipperServiceProviderImpl @Inject constructor( lateinit var consumer: FlipperBleServiceConsumer consumer = object : FlipperBleServiceConsumer { override fun onServiceApiReady(serviceApi: FlipperServiceApi) { - @OptIn(ExperimentalCoroutinesApi::class) - continuation.resume(serviceApi, onCancellation = { + continuation.resume(serviceApi) { _, _, _ -> disconnectInternal(consumer) - }) + } disconnectInternal(consumer) } } diff --git a/components/core/markdown/src/main/java/com/flipperdevices/core/markdown/AnnotatedStringKtx.kt b/components/core/markdown/src/main/java/com/flipperdevices/core/markdown/AnnotatedStringKtx.kt index 6d7e14fe28..9bdcd09b97 100644 --- a/components/core/markdown/src/main/java/com/flipperdevices/core/markdown/AnnotatedStringKtx.kt +++ b/components/core/markdown/src/main/java/com/flipperdevices/core/markdown/AnnotatedStringKtx.kt @@ -1,13 +1,12 @@ package com.flipperdevices.core.markdown import androidx.annotation.StringRes -import androidx.compose.foundation.text.ClickableText import androidx.compose.material.LocalTextStyle +import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.platform.LocalUriHandler import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.TextStyle @@ -38,29 +37,12 @@ fun ClickableUrlText( @StringRes markdownResId: Int, modifier: Modifier = Modifier, style: TextStyle = TextStyle.Default -) { - ClickableUrlText( - annotatedStringFromMarkdown(markdownResId), - modifier, - style - ) -} - -@Composable -fun ClickableUrlText( - text: AnnotatedString, - modifier: Modifier = Modifier, - style: TextStyle = TextStyle.Default ) { val textStyle = LocalTextStyle.current.merge(style) - val uriHandler = LocalUriHandler.current - ClickableText( + + Text( + text = annotatedStringFromMarkdown(markdownResId), modifier = modifier, - text = text, - style = textStyle, - onClick = { index -> - text.getStringAnnotations(ANNOTATED_STRING_TAG_URL, index, index) - .firstOrNull()?.let { url -> uriHandler.openUri(url.item) } - } + style = textStyle ) } diff --git a/components/core/markdown/src/main/java/com/flipperdevices/core/markdown/AnnotatedStringRenderer.kt b/components/core/markdown/src/main/java/com/flipperdevices/core/markdown/AnnotatedStringRenderer.kt index 2ca915b4f5..69c8596190 100644 --- a/components/core/markdown/src/main/java/com/flipperdevices/core/markdown/AnnotatedStringRenderer.kt +++ b/components/core/markdown/src/main/java/com/flipperdevices/core/markdown/AnnotatedStringRenderer.kt @@ -3,6 +3,7 @@ package com.flipperdevices.core.markdown import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Shadow import androidx.compose.ui.text.AnnotatedString +import androidx.compose.ui.text.LinkAnnotation import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontStyle @@ -22,8 +23,6 @@ import com.vladsch.flexmark.ast.StrongEmphasis import com.vladsch.flexmark.ast.Text import com.vladsch.flexmark.util.ast.Node -const val ANNOTATED_STRING_TAG_URL = "URL" - /** * Now support only: * 1) Bold (** tag) @@ -56,6 +55,7 @@ class AnnotatedStringRenderer( child = child.next } } + is BulletList -> { var child = node.firstChild while (child != null) { @@ -65,6 +65,7 @@ class AnnotatedStringRenderer( child = child.next } } + else -> renderChildren(node, builder) } } @@ -87,9 +88,8 @@ class AnnotatedStringRenderer( textDecoration = TextDecoration.Underline ) - addStringAnnotation( - tag = ANNOTATED_STRING_TAG_URL, - annotation = url.toString(), + addLink( + url = LinkAnnotation.Url(url.toString()), start = startIndex, end = endIndex ) diff --git a/components/core/markdown/src/test/java/com/flipperdevices/core/markdown/AnnotatedStringGeneratorTest.kt b/components/core/markdown/src/test/java/com/flipperdevices/core/markdown/AnnotatedStringGeneratorTest.kt index bbfbd63302..d299e92033 100644 --- a/components/core/markdown/src/test/java/com/flipperdevices/core/markdown/AnnotatedStringGeneratorTest.kt +++ b/components/core/markdown/src/test/java/com/flipperdevices/core/markdown/AnnotatedStringGeneratorTest.kt @@ -1,6 +1,7 @@ package com.flipperdevices.core.markdown import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.LinkAnnotation import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextDecoration @@ -57,12 +58,11 @@ class AnnotatedStringGeneratorTest { annotatedString.subSequence(spanStyle.start, spanStyle.end).toString() ) - val stringAnnotation = annotatedString.getStringAnnotations( - ANNOTATED_STRING_TAG_URL, + val linkAnnotation = annotatedString.getLinkAnnotations( 0, annotatedString.length ) - assertEquals(1, stringAnnotation.size) - assertEquals("https://google.com", stringAnnotation.first().item) + assertEquals(1, linkAnnotation.size) + assertEquals("https://google.com", (linkAnnotation.first().item as LinkAnnotation.Url).url) } } diff --git a/components/core/ui/hexkeyboard/build.gradle.kts b/components/core/ui/hexkeyboard/build.gradle.kts index 21ba08347b..1a26c81bc5 100644 --- a/components/core/ui/hexkeyboard/build.gradle.kts +++ b/components/core/ui/hexkeyboard/build.gradle.kts @@ -1,19 +1,16 @@ plugins { - id("flipper.android-compose") + id("flipper.multiplatform-compose") + id("flipper.multiplatform-dependencies") } android.namespace = "com.flipperdevices.core.ui.hexkeyboard" -dependencies { +commonDependencies { implementation(projects.components.core.ui.ktx) implementation(projects.components.core.data) implementation(libs.kotlin.immutable.collections) // Compose - implementation(libs.compose.ui) - implementation(libs.compose.tooling) - implementation(libs.compose.foundation) - implementation(libs.compose.material) implementation(libs.compose.constraint) } diff --git a/components/core/ui/hexkeyboard/src/main/kotlin/com/flipperdevices/core/ui/hexkeyboard/ComposableHexKeyboard.kt b/components/core/ui/hexkeyboard/src/commonMain/kotlin/com/flipperdevices/core/ui/hexkeyboard/ComposableHexKeyboard.kt similarity index 95% rename from components/core/ui/hexkeyboard/src/main/kotlin/com/flipperdevices/core/ui/hexkeyboard/ComposableHexKeyboard.kt rename to components/core/ui/hexkeyboard/src/commonMain/kotlin/com/flipperdevices/core/ui/hexkeyboard/ComposableHexKeyboard.kt index d3db57883d..2f1f9e2b4b 100644 --- a/components/core/ui/hexkeyboard/src/main/kotlin/com/flipperdevices/core/ui/hexkeyboard/ComposableHexKeyboard.kt +++ b/components/core/ui/hexkeyboard/src/commonMain/kotlin/com/flipperdevices/core/ui/hexkeyboard/ComposableHexKeyboard.kt @@ -15,7 +15,6 @@ import androidx.compose.material.MaterialTheme import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.ArrowBack -import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.compositionLocalOf @@ -24,13 +23,13 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.constraintlayout.compose.ConstrainedLayoutReference import androidx.constraintlayout.compose.ConstraintLayout import com.flipperdevices.core.data.PredefinedEnumMap import com.flipperdevices.core.ui.ktx.clickableRipple +import org.jetbrains.compose.ui.tooling.preview.Preview /** * Fields for composition local @@ -98,10 +97,7 @@ internal fun ComposableKey( } } -@Preview( - showBackground = true, - showSystemUi = true -) +@Preview() @Composable private fun ComposableHexKeyboardPreview() { ComposableHexKeyboard( diff --git a/components/core/ui/hexkeyboard/src/main/kotlin/com/flipperdevices/core/ui/hexkeyboard/ComposableKeys.kt b/components/core/ui/hexkeyboard/src/commonMain/kotlin/com/flipperdevices/core/ui/hexkeyboard/ComposableKeys.kt similarity index 100% rename from components/core/ui/hexkeyboard/src/main/kotlin/com/flipperdevices/core/ui/hexkeyboard/ComposableKeys.kt rename to components/core/ui/hexkeyboard/src/commonMain/kotlin/com/flipperdevices/core/ui/hexkeyboard/ComposableKeys.kt diff --git a/components/core/ui/hexkeyboard/src/main/kotlin/com/flipperdevices/core/ui/hexkeyboard/HexKey.kt b/components/core/ui/hexkeyboard/src/commonMain/kotlin/com/flipperdevices/core/ui/hexkeyboard/HexKey.kt similarity index 100% rename from components/core/ui/hexkeyboard/src/main/kotlin/com/flipperdevices/core/ui/hexkeyboard/HexKey.kt rename to components/core/ui/hexkeyboard/src/commonMain/kotlin/com/flipperdevices/core/ui/hexkeyboard/HexKey.kt diff --git a/components/core/ui/ktx/src/commonMain/kotlin/com/flipperdevices/core/ui/ktx/ClickableKtx.kt b/components/core/ui/ktx/src/commonMain/kotlin/com/flipperdevices/core/ui/ktx/ClickableKtx.kt index a102bc3eca..ef2ae5b1bf 100644 --- a/components/core/ui/ktx/src/commonMain/kotlin/com/flipperdevices/core/ui/ktx/ClickableKtx.kt +++ b/components/core/ui/ktx/src/commonMain/kotlin/com/flipperdevices/core/ui/ktx/ClickableKtx.kt @@ -2,23 +2,20 @@ package com.flipperdevices.core.ui.ktx import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource -import androidx.compose.material.ripple.rememberRipple +import androidx.compose.material.ripple +import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier -import androidx.compose.ui.composed -@Suppress("ModifierComposed") // MOB-1039 +@Composable +@Suppress("ModifierComposable") fun Modifier.clickableRipple( bounded: Boolean = true, enabled: Boolean = true, onClick: () -> Unit -) = composed { - this.then( - clickable( - interactionSource = remember { MutableInteractionSource() }, - indication = rememberRipple(bounded = bounded), - onClick = onClick, - enabled = enabled - ) - ) -} +) = clickable( + interactionSource = remember { MutableInteractionSource() }, + indication = ripple(bounded), + onClick = onClick, + enabled = enabled +) diff --git a/components/core/ui/searchbar/src/main/java/com/flipperdevices/core/ui/searchbar/ComposableSearchTextField.kt b/components/core/ui/searchbar/src/main/java/com/flipperdevices/core/ui/searchbar/ComposableSearchTextField.kt index 29fccf0f3c..7857d8938e 100644 --- a/components/core/ui/searchbar/src/main/java/com/flipperdevices/core/ui/searchbar/ComposableSearchTextField.kt +++ b/components/core/ui/searchbar/src/main/java/com/flipperdevices/core/ui/searchbar/ComposableSearchTextField.kt @@ -64,8 +64,8 @@ private fun SearchTextBox( ), singleLine = true, keyboardOptions = KeyboardOptions( - imeAction = ImeAction.Search, - autoCorrect = false + autoCorrectEnabled = false, + imeAction = ImeAction.Search ), keyboardActions = KeyboardActions(onSearch = { focusManager.clearFocus() diff --git a/components/core/ui/theme/src/commonMain/kotlin/com/flipperdevices/core/ui/theme/FlipperTheme.kt b/components/core/ui/theme/src/commonMain/kotlin/com/flipperdevices/core/ui/theme/FlipperTheme.kt index efb176217b..0d7ee36281 100644 --- a/components/core/ui/theme/src/commonMain/kotlin/com/flipperdevices/core/ui/theme/FlipperTheme.kt +++ b/components/core/ui/theme/src/commonMain/kotlin/com/flipperdevices/core/ui/theme/FlipperTheme.kt @@ -1,9 +1,5 @@ package com.flipperdevices.core.ui.theme -import androidx.compose.foundation.Indication -import androidx.compose.foundation.IndicationInstance -import androidx.compose.foundation.LocalIndication -import androidx.compose.foundation.interaction.InteractionSource import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.selection.LocalTextSelectionColors @@ -16,7 +12,6 @@ import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.collectAsState import androidx.compose.runtime.compositionLocalOf import androidx.compose.runtime.getValue -import androidx.compose.ui.graphics.drawscope.ContentDrawScope import androidx.compose.ui.unit.dp import com.flipperdevices.core.ui.theme.composable.FlipperPallet import com.flipperdevices.core.ui.theme.composable.FlipperTypography @@ -72,7 +67,6 @@ private fun FlipperTheme( LocalTypography provides getTypography(), LocalContentColor provides colors.contentColorFor(backgroundColor = pallet.background), LocalTextSelectionColors provides pallet.toTextSelectionColors(), - LocalIndication provides NoIndication, content = content ) } @@ -90,19 +84,3 @@ fun FlipperThemeInternal( isLight = !isSystemInDarkTheme() ) } - -/** - * Standardization of the indication for all clickable modifiers - **/ -private object NoIndication : Indication { - private object NoIndicationInstance : IndicationInstance { - override fun ContentDrawScope.drawIndication() { - drawContent() - } - } - - @Composable - override fun rememberUpdatedInstance(interactionSource: InteractionSource): IndicationInstance { - return NoIndicationInstance - } -} diff --git a/components/faphub/screenshotspreview/impl/src/main/kotlin/com/flipperdevices/faphub/screenshotspreview/impl/composable/content/ComposableFullScreenshotAppBar.kt b/components/faphub/screenshotspreview/impl/src/main/kotlin/com/flipperdevices/faphub/screenshotspreview/impl/composable/content/ComposableFullScreenshotAppBar.kt index 13f6c6e260..cac5509a29 100644 --- a/components/faphub/screenshotspreview/impl/src/main/kotlin/com/flipperdevices/faphub/screenshotspreview/impl/composable/content/ComposableFullScreenshotAppBar.kt +++ b/components/faphub/screenshotspreview/impl/src/main/kotlin/com/flipperdevices/faphub/screenshotspreview/impl/composable/content/ComposableFullScreenshotAppBar.kt @@ -91,7 +91,7 @@ internal fun ComposableFullScreenshotAppBar( @Preview @Composable -private fun FullScreenshotAppBar() { +private fun PreviewFullScreenshotAppBar() { FlipperThemeInternal { ComposableFullScreenshotAppBar( onBack = {}, diff --git a/components/filemanager/impl/src/main/java/com/flipperdevices/filemanager/impl/composable/bar/ComposableEllipsizeStartText.kt b/components/filemanager/impl/src/main/java/com/flipperdevices/filemanager/impl/composable/bar/ComposableEllipsizeStartText.kt index cfa429338d..bddbabd4c3 100644 --- a/components/filemanager/impl/src/main/java/com/flipperdevices/filemanager/impl/composable/bar/ComposableEllipsizeStartText.kt +++ b/components/filemanager/impl/src/main/java/com/flipperdevices/filemanager/impl/composable/bar/ComposableEllipsizeStartText.kt @@ -4,8 +4,6 @@ import androidx.compose.foundation.layout.BoxWithConstraints import androidx.compose.foundation.layout.BoxWithConstraintsScope import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.text.InternalFoundationTextApi -import androidx.compose.foundation.text.TextDelegate import androidx.compose.material.LocalTextStyle import androidx.compose.material.Text import androidx.compose.runtime.Composable @@ -15,6 +13,7 @@ import androidx.compose.ui.platform.LocalFontFamilyResolver import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.rememberTextMeasurer import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview @@ -46,26 +45,24 @@ fun ComposableEllipsizeStartText( } } -@OptIn(InternalFoundationTextApi::class) @Composable private fun BoxWithConstraintsScope.shouldShrink( text: String, textStyle: TextStyle ): Boolean { + val textMeasurer = rememberTextMeasurer() + // Represent line without index and paddings - val textDelegate = TextDelegate( + val textLayoutResult = textMeasurer.measure( AnnotatedString(text), textStyle, maxLines = 1, softWrap = false, overflow = TextOverflow.Visible, density = LocalDensity.current, - fontFamilyResolver = LocalFontFamilyResolver.current - ) - - val textLayoutResult = textDelegate.layout( - constraints, - LocalLayoutDirection.current + fontFamilyResolver = LocalFontFamilyResolver.current, + constraints = constraints, + layoutDirection = LocalLayoutDirection.current ) return textLayoutResult.hasVisualOverflow diff --git a/components/inappnotification/impl/src/main/java/com/flipperdevices/inappnotification/impl/composable/type/ComposableInAppNotificationSelfUpdateError.kt b/components/inappnotification/impl/src/main/java/com/flipperdevices/inappnotification/impl/composable/type/ComposableInAppNotificationSelfUpdateError.kt index 844c1d5afb..2f077940d0 100644 --- a/components/inappnotification/impl/src/main/java/com/flipperdevices/inappnotification/impl/composable/type/ComposableInAppNotificationSelfUpdateError.kt +++ b/components/inappnotification/impl/src/main/java/com/flipperdevices/inappnotification/impl/composable/type/ComposableInAppNotificationSelfUpdateError.kt @@ -32,7 +32,7 @@ internal fun ComposableInAppNotificationSelfUpdateError() { fontScale = 2.0f ) @Composable -private fun ComposableInAppNotificationSelfUpdateErrorPreviewX2Font() { +private fun PreviewComposableInAppNotificationSelfUpdateErrorPreviewX2Font() { FlipperThemeInternal { ComposableInAppNotificationSelfUpdateError() } @@ -42,7 +42,7 @@ private fun ComposableInAppNotificationSelfUpdateErrorPreviewX2Font() { fontScale = 1.5f ) @Composable -private fun ComposableInAppNotificationSelfUpdateErrorPreviewX15Font() { +private fun PreviewComposableInAppNotificationSelfUpdateErrorPreviewX15Font() { FlipperThemeInternal { ComposableInAppNotificationSelfUpdateError() } @@ -50,7 +50,7 @@ private fun ComposableInAppNotificationSelfUpdateErrorPreviewX15Font() { @Preview @Composable -private fun ComposableInAppNotificationSelfUpdateErrorPreview() { +private fun PreviewComposableInAppNotificationSelfUpdateErrorPreview() { FlipperThemeInternal { ComposableInAppNotificationSelfUpdateError() } diff --git a/components/inappnotification/impl/src/main/java/com/flipperdevices/inappnotification/impl/composable/type/ComposableInAppNotificationSelfUpdateStarted.kt b/components/inappnotification/impl/src/main/java/com/flipperdevices/inappnotification/impl/composable/type/ComposableInAppNotificationSelfUpdateStarted.kt index 8fa86cb515..cd65f026bc 100644 --- a/components/inappnotification/impl/src/main/java/com/flipperdevices/inappnotification/impl/composable/type/ComposableInAppNotificationSelfUpdateStarted.kt +++ b/components/inappnotification/impl/src/main/java/com/flipperdevices/inappnotification/impl/composable/type/ComposableInAppNotificationSelfUpdateStarted.kt @@ -34,7 +34,7 @@ internal fun ComposableInAppNotificationSelfUpdateStarted() { fontScale = 2.0f ) @Composable -private fun ComposableInAppNotificationSelfUpdateStartedPreviewX2Font() { +private fun PreviewComposableInAppNotificationSelfUpdateStartedPreviewX2Font() { FlipperThemeInternal { ComposableInAppNotificationSelfUpdateStarted() } @@ -44,7 +44,7 @@ private fun ComposableInAppNotificationSelfUpdateStartedPreviewX2Font() { fontScale = 1.5f ) @Composable -private fun ComposableInAppNotificationSelfUpdateStartedPreviewX15Font() { +private fun PreviewComposableInAppNotificationSelfUpdateStartedPreviewX15Font() { FlipperThemeInternal { ComposableInAppNotificationSelfUpdateStarted() } @@ -52,7 +52,7 @@ private fun ComposableInAppNotificationSelfUpdateStartedPreviewX15Font() { @Preview @Composable -private fun ComposableInAppNotificationSelfUpdateStartedPreview() { +private fun PreviewComposableInAppNotificationSelfUpdateStartedPreview() { FlipperThemeInternal { ComposableInAppNotificationSelfUpdateStarted() } diff --git a/components/infrared/impl/src/main/kotlin/com/flipperdevices/infrared/impl/composable/components/ComposableInfraredAppBar.kt b/components/infrared/impl/src/main/kotlin/com/flipperdevices/infrared/impl/composable/components/ComposableInfraredAppBar.kt index 25f9d44671..a16f1daa7b 100644 --- a/components/infrared/impl/src/main/kotlin/com/flipperdevices/infrared/impl/composable/components/ComposableInfraredAppBar.kt +++ b/components/infrared/impl/src/main/kotlin/com/flipperdevices/infrared/impl/composable/components/ComposableInfraredAppBar.kt @@ -42,7 +42,7 @@ internal fun ComposableInfraredAppBar( @Preview @Composable -private fun InfraredAppBar() { +private fun PreviewInfraredAppBar() { FlipperThemeInternal { ComposableInfraredAppBar( onBack = {}, diff --git a/components/newfilemanager/impl/src/androidMain/kotlin/com/flipperdevices/newfilemanager/impl/composable/bar/ComposableEllipsizeStartText.kt b/components/newfilemanager/impl/src/androidMain/kotlin/com/flipperdevices/newfilemanager/impl/composable/bar/ComposableEllipsizeStartText.kt index f82ab1b538..d37909327a 100644 --- a/components/newfilemanager/impl/src/androidMain/kotlin/com/flipperdevices/newfilemanager/impl/composable/bar/ComposableEllipsizeStartText.kt +++ b/components/newfilemanager/impl/src/androidMain/kotlin/com/flipperdevices/newfilemanager/impl/composable/bar/ComposableEllipsizeStartText.kt @@ -4,8 +4,6 @@ import androidx.compose.foundation.layout.BoxWithConstraints import androidx.compose.foundation.layout.BoxWithConstraintsScope import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.text.InternalFoundationTextApi -import androidx.compose.foundation.text.TextDelegate import androidx.compose.material.LocalTextStyle import androidx.compose.material.Text import androidx.compose.runtime.Composable @@ -15,6 +13,7 @@ import androidx.compose.ui.platform.LocalFontFamilyResolver import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.rememberTextMeasurer import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview @@ -46,26 +45,24 @@ fun ComposableEllipsizeStartText( } } -@OptIn(InternalFoundationTextApi::class) @Composable private fun BoxWithConstraintsScope.shouldShrink( text: String, textStyle: TextStyle ): Boolean { + val textMeasurer = rememberTextMeasurer() + // Represent line without index and paddings - val textDelegate = TextDelegate( + val textLayoutResult = textMeasurer.measure( AnnotatedString(text), textStyle, maxLines = 1, softWrap = false, overflow = TextOverflow.Visible, density = LocalDensity.current, - fontFamilyResolver = LocalFontFamilyResolver.current - ) - - val textLayoutResult = textDelegate.layout( - constraints, - LocalLayoutDirection.current + fontFamilyResolver = LocalFontFamilyResolver.current, + constraints = constraints, + layoutDirection = LocalLayoutDirection.current ) return textLayoutResult.hasVisualOverflow diff --git a/components/nfceditor/impl/src/main/java/com/flipperdevices/nfceditor/impl/composable/ComposableScaleFactorCalculate.kt b/components/nfceditor/impl/src/main/java/com/flipperdevices/nfceditor/impl/composable/ComposableScaleFactorCalculate.kt index 7cbe3c80b2..a844b86c25 100644 --- a/components/nfceditor/impl/src/main/java/com/flipperdevices/nfceditor/impl/composable/ComposableScaleFactorCalculate.kt +++ b/components/nfceditor/impl/src/main/java/com/flipperdevices/nfceditor/impl/composable/ComposableScaleFactorCalculate.kt @@ -1,14 +1,13 @@ package com.flipperdevices.nfceditor.impl.composable import androidx.compose.foundation.layout.BoxWithConstraintsScope -import androidx.compose.foundation.text.InternalFoundationTextApi -import androidx.compose.foundation.text.TextDelegate import androidx.compose.material.LocalTextStyle import androidx.compose.runtime.Composable import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalFontFamilyResolver import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.text.AnnotatedString +import androidx.compose.ui.text.rememberTextMeasurer import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import kotlin.math.roundToInt @@ -42,23 +41,10 @@ fun BoxWithConstraintsScope.calculateScaleFactor(maxIndexCount: Int): Float { } } -@OptIn(InternalFoundationTextApi::class) @Composable private fun BoxWithConstraintsScope.shouldShrink(maxIndexCount: Int, scaleFactor: Float): Boolean { val textStyle = LocalTextStyle.current - - // Represent line without index and paddings - val textDelegate = TextDelegate( - AnnotatedString("00".repeat(NFC_LINE_BYTE_COUNT)), - textStyle.copy( - fontSize = textStyle.fontSize * scaleFactor - ), - maxLines = 1, - softWrap = false, - overflow = TextOverflow.Visible, - density = LocalDensity.current, - fontFamilyResolver = LocalFontFamilyResolver.current - ) + val textMeasurer = rememberTextMeasurer() val otherWidthsDpWithoutScaleFactor = (maxIndexCount * WIDTH_LINE_INDEX_DP) + (PADDING_CELL_DP * 2 * NFC_LINE_BYTE_COUNT) @@ -72,10 +58,17 @@ private fun BoxWithConstraintsScope.shouldShrink(maxIndexCount: Int, scaleFactor maxWidth = Integer.max(0, constraints.maxWidth - otherWidthsPx.roundToInt()) ) - val textLayoutResult = textDelegate.layout( - textConstraints, - LocalLayoutDirection.current - ) - - return textLayoutResult.hasVisualOverflow + return textMeasurer.measure( + AnnotatedString("00".repeat(NFC_LINE_BYTE_COUNT)), + textStyle.copy( + fontSize = textStyle.fontSize * scaleFactor + ), + maxLines = 1, + softWrap = false, + overflow = TextOverflow.Visible, + density = LocalDensity.current, + fontFamilyResolver = LocalFontFamilyResolver.current, + constraints = textConstraints, + layoutDirection = LocalLayoutDirection.current + ).hasVisualOverflow } diff --git a/components/screenstreaming/impl/src/main/java/com/flipperdevices/screenstreaming/impl/composable/controls/ComposableButtonAnimation.kt b/components/screenstreaming/impl/src/main/java/com/flipperdevices/screenstreaming/impl/composable/controls/ComposableButtonAnimation.kt index 998bbe8ab3..8e6e1066cd 100644 --- a/components/screenstreaming/impl/src/main/java/com/flipperdevices/screenstreaming/impl/composable/controls/ComposableButtonAnimation.kt +++ b/components/screenstreaming/impl/src/main/java/com/flipperdevices/screenstreaming/impl/composable/controls/ComposableButtonAnimation.kt @@ -41,8 +41,7 @@ internal fun ComposableFlipperButtonAnimation( ) { val button = buttons[it] Image( - modifier = Modifier - .animateItemPlacement() + modifier = Modifier.animateItem(fadeInSpec = null, fadeOutSpec = null) .size(24.dp), painter = painterResource( if (MaterialTheme.colors.isLight) { diff --git a/components/screenstreaming/impl/src/main/java/com/flipperdevices/screenstreaming/impl/composable/controls/ComposableFlipperControls.kt b/components/screenstreaming/impl/src/main/java/com/flipperdevices/screenstreaming/impl/composable/controls/ComposableFlipperControls.kt index 07554bb24c..038d8affa7 100644 --- a/components/screenstreaming/impl/src/main/java/com/flipperdevices/screenstreaming/impl/composable/controls/ComposableFlipperControls.kt +++ b/components/screenstreaming/impl/src/main/java/com/flipperdevices/screenstreaming/impl/composable/controls/ComposableFlipperControls.kt @@ -11,7 +11,7 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape -import androidx.compose.material.ripple.rememberRipple +import androidx.compose.material.ripple import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Alignment @@ -64,7 +64,7 @@ private fun ComposableFlipperBackButton( .background(LocalPallet.current.accent) .combinedClickable( interactionSource = remember { MutableInteractionSource() }, - indication = rememberRipple(), + indication = ripple(), onClick = { onPress() }, onLongClick = { onLongPress() } ), diff --git a/components/screenstreaming/impl/src/main/java/com/flipperdevices/screenstreaming/impl/composable/controls/ComposableFlipperDPad.kt b/components/screenstreaming/impl/src/main/java/com/flipperdevices/screenstreaming/impl/composable/controls/ComposableFlipperDPad.kt index dcdbd6d077..620d155c34 100644 --- a/components/screenstreaming/impl/src/main/java/com/flipperdevices/screenstreaming/impl/composable/controls/ComposableFlipperDPad.kt +++ b/components/screenstreaming/impl/src/main/java/com/flipperdevices/screenstreaming/impl/composable/controls/ComposableFlipperDPad.kt @@ -14,7 +14,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape -import androidx.compose.material.ripple.rememberRipple +import androidx.compose.material.ripple import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Alignment @@ -131,7 +131,7 @@ private fun ControlButton( .fillMaxSize() .combinedClickable( interactionSource = remember { MutableInteractionSource() }, - indication = rememberRipple(), + indication = ripple(), onClick = { onPressButton(button) }, onLongClick = { onLongPressButton(button) } ), diff --git a/components/wearable/sync/wear/impl/src/main/java/com/flipperdevices/wearable/sync/wear/impl/composable/ComposableKeysList.kt b/components/wearable/sync/wear/impl/src/main/java/com/flipperdevices/wearable/sync/wear/impl/composable/ComposableKeysList.kt index cf0cc3c66f..048b980a37 100644 --- a/components/wearable/sync/wear/impl/src/main/java/com/flipperdevices/wearable/sync/wear/impl/composable/ComposableKeysList.kt +++ b/components/wearable/sync/wear/impl/src/main/java/com/flipperdevices/wearable/sync/wear/impl/composable/ComposableKeysList.kt @@ -58,11 +58,6 @@ private fun ComposableKeysListLoading() { } @Composable -@Preview( - showSystemUi = true, - showBackground = true, - device = WearDevices.LARGE_ROUND -) private fun ComposableKeysListEmpty() { ComposableWearOsScrollableColumn { Image( @@ -106,3 +101,13 @@ private fun ComposableKeysListInternal( } } } + +@Preview( + showSystemUi = true, + showBackground = true, + device = WearDevices.LARGE_ROUND +) +@Composable +private fun PreviewComposableKeysListEmpty() { + ComposableKeysListLoading() +} diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml index 3569737889..2b62684633 100755 --- a/config/detekt/detekt.yml +++ b/config/detekt/detekt.yml @@ -766,6 +766,7 @@ Compose: active: true PreviewNaming: active: true + previewNamingStrategy: anywhere PreviewPublic: active: true RememberMissing: @@ -780,6 +781,9 @@ Compose: active: false ModifierNotUsedAtRoot: active: true + LambdaParameterEventTrailing: + active: false + DecomposeRule: PushForbiddenRule: diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 06230a9928..db5e261e13 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,32 +1,32 @@ [versions] # You also need to bump the version of ksp kotlin-general = "2.0.20" # https://kotlinlang.org/docs/releases.html#release-details -kotlin-immutable-collections = "0.3.7" # https://github.com/Kotlin/kotlinx.collections.immutable/releases +kotlin-immutable-collections = "0.3.8" # https://github.com/Kotlin/kotlinx.collections.immutable/releases kotlin-datetime = "0.6.1" # https://github.com/Kotlin/kotlinx-datetime/releases -kotlinx = "1.8.1" # https://github.com/Kotlin/kotlinx.coroutines/releases -ksp = "2.0.20-1.0.24" # https://github.com/google/ksp/releases +kotlinx = "1.9.0" # https://github.com/Kotlin/kotlinx.coroutines/releases +ksp = "2.0.20-1.0.25" # https://github.com/google/ksp/releases anvil = "2.5.0-beta11" # https://github.com/square/anvil/releases anvil-utils = "0.2.1-beta01" # https://github.com/IlyaGulya/anvil-utils/releases -android-gradle = "8.6.0" # https://developer.android.com/studio/releases/gradle-plugin -protobuf = "4.28.0" # https://github.com/protocolbuffers/protobuf/releases +android-gradle = "8.7.0" # https://developer.android.com/studio/releases/gradle-plugin +protobuf = "4.28.2" # https://github.com/protocolbuffers/protobuf/releases protobuf-gradle = "0.9.4" # https://github.com/google/protobuf-gradle-plugin/releases -compose-material = "1.6.8" # https://developer.android.com/jetpack/androidx/releases/compose#versions -compose-foundation = "1.6.8" # https://developer.android.com/jetpack/androidx/releases/compose#versions -compose-ui = "1.6.8" # https://developer.android.com/jetpack/androidx/releases/compose#versions -compose-wear = "1.3.1" # https://developer.android.com/jetpack/androidx/releases/wear-compose +compose-material = "1.7.3" # https://developer.android.com/jetpack/androidx/releases/compose#versions +compose-foundation = "1.7.3" # https://developer.android.com/jetpack/androidx/releases/compose#versions +compose-ui = "1.7.3" # https://developer.android.com/jetpack/androidx/releases/compose#versions +compose-wear = "1.4.0" # https://developer.android.com/jetpack/androidx/releases/wear-compose compose-wear-preview = "1.0.0" # https://mvnrepository.com/artifact/androidx.wear/wear-tooling-preview -compose-accompanist = "0.34.0" # https://github.com/google/accompanist/releases +compose-accompanist = "0.36.0" # https://github.com/google/accompanist/releases compose-placeholder = "2.0.0" # https://github.com/fornewid/placeholder/releases -compose-constraint = "1.0.1" # https://developer.android.com/jetpack/compose/layouts/constraintlayout +compose-constraint = "0.4.0" # https://github.com/Lavmee/constraintlayout-compose-multiplatform/releases compose-paging = "3.3.2" # https://developer.android.com/jetpack/androidx/releases/paging compose-drag-drop = "0.9.6" # https://github.com/aclassen/ComposeReorderable/releases -compose-multiplatform = "1.6.11" # https://github.com/JetBrains/compose-multiplatform/releases +compose-multiplatform = "1.7.0-rc01" # https://github.com/JetBrains/compose-multiplatform/releases # 0.6.17 requires androidx.navigation:navigation-compose:2.8.0-beta0 # androidx.navigation:navigation-compose:2.8.0-beta0 requires Android API 35 # Android API 35 not supported by roboelectric horologist = "0.6.17" # https://github.com/google/horologist/releases # Until fix https://github.com/Kotlin/kotlinx.serialization/issues/2803 -serialization-json = "1.7.1" # https://github.com/Kotlin/kotlinx.serialization/releases +serialization-json = "1.7.3" # https://github.com/Kotlin/kotlinx.serialization/releases wear = "1.3.0" # https://developer.android.com/jetpack/androidx/releases/wear wear-gms = "18.2.0" # https://mvnrepository.com/artifact/com.google.android.gms/play-services-wearable?repo=google wear-interaction-phone = "1.1.0-alpha04" # https://developer.android.com/jetpack/androidx/releases/wear @@ -39,9 +39,9 @@ sentry-runtime = "7.14.0" # https://github.com/getsentry/sentry-java/releases sentry-gradle = "4.11.0" # https://github.com/getsentry/sentry-android-gradle-plugin/releases zip4j = "2.11.5" # https://github.com/srikanth-lingala/zip4j/releases ktx = "1.13.1" # https://developer.android.com/jetpack/androidx/releases/core -ktx-activity = "1.9.1" # https://developer.android.com/jetpack/androidx/releases/activity +ktx-activity = "1.9.2" # https://developer.android.com/jetpack/androidx/releases/activity ktx-testing = "1.2.1" # https://developer.android.com/jetpack/androidx/releases/test -lifecycle = "2.8.4" # https://developer.android.com/jetpack/androidx/releases/lifecycle +lifecycle = "2.8.6" # https://developer.android.com/jetpack/androidx/releases/lifecycle fastutil = "8.5.14" # https://github.com/vigna/fastutil/tags ble = "2.8.0" # https://github.com/NordicSemiconductor/Android-BLE-Library/releases ble-scan = "1.6.0" # https://github.com/NordicSemiconductor/Android-Scanner-Compat-Library/releases @@ -49,7 +49,7 @@ ble-kotlin = "1.1.0" # https://github.com/NordicSemiconductor/Kotlin-BLE-Library # don't update to 2.x, unless the ble-kotlin is also updated. PR: https://github.com/arcao/slf4j-timber/pull/12 slf4j = "1.7.36" # https://github.com/qos-ch/slf4j/tags slf4j-timber = "3.1" # https://github.com/arcao/slf4j-timber -lottie = "6.5.1" # https://github.com/airbnb/lottie/blob/master/android-compose.md +lottie = "6.5.2" # https://github.com/airbnb/lottie/blob/master/android-compose.md material = "1.12.0" # https://github.com/material-components/material-components-android/releases splashscreen = "1.1.0-rc01" # https://developer.android.com/jetpack/androidx/releases/core annotations = "1.8.2" # https://developer.android.com/jetpack/androidx/releases/annotation @@ -58,18 +58,18 @@ androidx-core = "1.13.1" # https://developer.android.com/jetpack/androidx/releas datastore = "1.1.1" # https://developer.android.com/topic/libraries/architecture/datastore # https://github.com/vsch/flexmark-java/issues/442 flexmark = "0.42.14" # https://github.com/vsch/flexmark-java/tags -markdown = "0.25.0" # https://github.com/mikepenz/multiplatform-markdown-renderer/releases +markdown = "0.26.0" # https://github.com/mikepenz/multiplatform-markdown-renderer/releases ktor = "2.3.12" # https://ktor.io/ apache-compress = "1.27.1" # https://commons.apache.org/proper/commons-compress/ apache-codec = "1.17.1" # https://mvnrepository.com/artifact/commons-codec/commons-codec -countly = "24.7.2" # https://github.com/Countly/countly-sdk-android/releases +countly = "24.7.4" # https://github.com/Countly/countly-sdk-android/releases grgit-gradle = "8d818b74b9" work = "2.9.1" # https://developer.android.com/jetpack/androidx/releases/work coil = "2.7.0" # https://github.com/coil-kt/coil/releases play-core = "2.1.0" # https://developer.android.com/guide/playcore#java-kotlin-in-app-update decompose = "3.1.0" # https://github.com/arkivanov/Decompose/releases essenty = "2.1.0" # https://github.com/arkivanov/Essenty/releases -zoomable = "1.6.1" #https://github.com/usuiat/Zoomable +zoomable = "1.6.2" #https://github.com/usuiat/Zoomable # Testing junit = "4.13.2" # https://github.com/junit-team/junit4/releases mockito = "5.4.0" # https://github.com/mockito/mockito/releases @@ -79,26 +79,26 @@ mockk = "1.13.12" # https://mockk.io/ # Testing UI espresso-core = "3.6.1" # https://github.com/android/android-test uiautomator = "2.3.0" # https://developer.android.com/training/testing/other-components/ui-automator#set-ui -benchmark-macro-junit4 = "1.3.0" # https://developer.android.com/jetpack/androidx/releases/benchmark -baselineprofile = "1.3.0" # https://developer.android.com/topic/performance/baselineprofiles/overview#recommended-versions -profileinstaller = "1.3.1" # https://developer.android.com/topic/performance/baselineprofiles/overview#recommended-versions +benchmark-macro-junit4 = "1.3.2" # https://developer.android.com/jetpack/androidx/releases/benchmark +baselineprofile = "1.3.2" # https://developer.android.com/topic/performance/baselineprofiles/overview#recommended-versions +profileinstaller = "1.4.1" # https://developer.android.com/topic/performance/baselineprofiles/overview#recommended-versions # Linters -detekt = "1.23.6" # https://detekt.dev/docs/gettingstarted/gradle/ +detekt = "1.23.7" # https://detekt.dev/docs/gettingstarted/gradle/ detekt-ruleset-compiler = "0.0.4" # https://github.com/BraisGabin/detekt-compiler-rules/releases detekt-ruleset-ktlint = "0.50.0" # https://github.com/pinterest/ktlint/releases -detekt-ruleset-compose = "0.4.11" # https://github.com/mrmans0n/compose-rules/releases +detekt-ruleset-compose = "0.4.15" # https://github.com/mrmans0n/compose-rules/releases detekt-ruleset-decompose = "1.0.1" # https://github.com/LionZXY/detekt-decompose-rule/releases # Firebase google-gms-gradle = "4.4.2" # https://developers.google.com/android/guides/google-services-plugin -google-gms-firebase = "24.0.1" # https://firebase.google.com/docs/android/setup#kotlin:~:text=com.google.firebase%3Afirebase%2Dmessaging +google-gms-firebase = "24.0.2" # https://firebase.google.com/docs/android/setup#kotlin:~:text=com.google.firebase%3Afirebase%2Dmessaging # Build Config -buildkonfig = "5.4.0" +buildkonfig = "5.5.0" -wire = "5.0.0" -okio = "3.9.0" +wire = "5.1.0" +okio = "3.9.1" [libraries] # Gradle - Core @@ -157,7 +157,7 @@ compose-pager = { module = "com.google.accompanist:accompanist-pager", version.r compose-pager-indicators = { module = "com.google.accompanist:accompanist-pager-indicators", version.ref = "compose-accompanist" } compose-placeholder = { module = "io.github.fornewid:placeholder-foundation", version.ref = "compose-placeholder" } compose-swipetorefresh = { module = "com.google.accompanist:accompanist-swiperefresh", version.ref = "compose-accompanist" } -compose-constraint = { module = "androidx.constraintlayout:constraintlayout-compose", version.ref = "compose-constraint" } +compose-constraint = { module = "tech.annexflow.compose:constraintlayout-compose-multiplatform", version.ref = "compose-constraint" } compose-paging = { module = "androidx.paging:paging-compose", version.ref = "compose-paging" } compose-drag-drop = { module = "org.burnoutcrew.composereorderable:reorderable", version.ref = "compose-drag-drop" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 66cd5a0e49..79eb9d003f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME