Skip to content

Commit

Permalink
Merge pull request element-hq#2741 from element-hq/feature/bma/remove…
Browse files Browse the repository at this point in the history
…RoomFlowNodeLoading

Iterate on `loadingNode` to render the same way JoinRoomView will render
  • Loading branch information
bmarty authored Apr 25, 2024
2 parents 492b012 + 1ffa6c5 commit 9a780cd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -36,15 +35,18 @@ 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
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
Expand All @@ -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<RoomFlowNode.NavTarget>(
backstack = BackStack(
initialElement = NavTarget.Loading,
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tools/quality/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 9a780cd

Please sign in to comment.