From a68e290aabf1dba3f869165e93d8e7025a39a149 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 23 Apr 2024 10:22:33 +0200 Subject: [PATCH 1/2] Ensure that Konsist tests are run. --- tools/quality/check.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/quality/check.sh b/tools/quality/check.sh index be323f6884..86eeb84b58 100755 --- a/tools/quality/check.sh +++ b/tools/quality/check.sh @@ -25,8 +25,8 @@ set -e # First run the quickest script ./tools/check/check_code_quality.sh -# Check ktlint first -./gradlew ktlintCheck +# Check ktlint and Konsist first +./gradlew runQualityChecks # Build, test and check the project, with warning as errors # It also check that the minimal app is compiling. From 1ffa6c541ee9106279102a61b5fa90b366d45e57 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 23 Apr 2024 18:36:32 +0200 Subject: [PATCH 2/2] Iterate on `loadingNode` to render the same way JoinedRoomFlowNode / Loading will render. --- .../android/appnav/room/RoomFlowNode.kt | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/appnav/src/main/kotlin/io/element/android/appnav/room/RoomFlowNode.kt b/appnav/src/main/kotlin/io/element/android/appnav/room/RoomFlowNode.kt index 6d6405c0e8..b0c0b5298a 100644 --- a/appnav/src/main/kotlin/io/element/android/appnav/room/RoomFlowNode.kt +++ b/appnav/src/main/kotlin/io/element/android/appnav/room/RoomFlowNode.kt @@ -17,10 +17,9 @@ package io.element.android.appnav.room import android.os.Parcelable -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.lifecycle.lifecycleScope import com.bumble.appyx.core.modality.BuildContext @@ -36,7 +35,11 @@ import dagger.assisted.AssistedInject import io.element.android.anvilannotations.ContributesNode import io.element.android.appnav.room.joined.JoinedRoomFlowNode import io.element.android.appnav.room.joined.JoinedRoomLoadedFlowNode +import io.element.android.appnav.room.joined.LoadingRoomNodeView +import io.element.android.appnav.room.joined.LoadingRoomState import io.element.android.features.joinroom.api.JoinRoomEntryPoint +import io.element.android.features.networkmonitor.api.NetworkMonitor +import io.element.android.features.networkmonitor.api.NetworkStatus import io.element.android.features.roomaliasesolver.api.RoomAliasResolverEntryPoint import io.element.android.features.roomdirectory.api.RoomDescription import io.element.android.libraries.architecture.BackstackView @@ -44,7 +47,6 @@ import io.element.android.libraries.architecture.BaseFlowNode import io.element.android.libraries.architecture.NodeInputs import io.element.android.libraries.architecture.createNode import io.element.android.libraries.architecture.inputs -import io.element.android.libraries.designsystem.theme.components.CircularProgressIndicator import io.element.android.libraries.di.SessionScope import io.element.android.libraries.matrix.api.MatrixClient import io.element.android.libraries.matrix.api.core.RoomAlias @@ -69,6 +71,7 @@ class RoomFlowNode @AssistedInject constructor( private val roomMembershipObserver: RoomMembershipObserver, private val joinRoomEntryPoint: JoinRoomEntryPoint, private val roomAliasResolverEntryPoint: RoomAliasResolverEntryPoint, + private val networkMonitor: NetworkMonitor, ) : BaseFlowNode( backstack = BackStack( initialElement = NavTarget.Loading, @@ -172,10 +175,14 @@ class RoomFlowNode @AssistedInject constructor( } } - private fun loadingNode(buildContext: BuildContext) = node(buildContext) { - Box(modifier = it.fillMaxSize(), contentAlignment = Alignment.Center) { - CircularProgressIndicator() - } + private fun loadingNode(buildContext: BuildContext) = node(buildContext) { modifier -> + val networkStatus by networkMonitor.connectivity.collectAsState() + LoadingRoomNodeView( + state = LoadingRoomState.Loading, + hasNetworkConnection = networkStatus == NetworkStatus.Online, + onBackClicked = { navigateUp() }, + modifier = modifier, + ) } @Composable