mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-10-31 16:22:49 +00:00
Show a loading indicator on the placeholders which can stay on screen forever
emptyNode() renders nothing at all, which is fine for a placeholder that is left within a few frames, but makes the application look frozen when the wait can last, or never end. Add a delayBeforeShowingContent parameter to emptyNode(): when it is finite, a progress indicator and a "Loading…" label fade in after that delay, reusing the existing DelayedVisibility helper. It defaults to Duration.INFINITE, so the splash screen keeps rendering an empty canvas. Use a one second delay on the two placeholders which are not guaranteed to be left: the FTUE one, rendered while waiting for the session verified status, and the LoggedInFlowNode one, rendered while the FTUE state is unknown. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+5
-1
@@ -37,6 +37,7 @@ import kotlinx.coroutines.flow.filterIsInstance
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
@ContributesNode(SessionScope::class)
|
||||
@AssistedInject
|
||||
@@ -84,7 +85,10 @@ class FtueFlowNode(
|
||||
override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node {
|
||||
return when (navTarget) {
|
||||
NavTarget.Placeholder -> {
|
||||
emptyNode(buildContext)
|
||||
// Rendered while waiting for the initial state (see FtueStep.WaitingForInitialState).
|
||||
// This can last for a while, or forever if the sync service never manages to run, so
|
||||
// render a loading state rather than nothing at all.
|
||||
emptyNode(buildContext, delayBeforeShowingContent = 500.milliseconds)
|
||||
}
|
||||
is NavTarget.SessionVerification -> {
|
||||
val callback = object : FtueSessionVerificationFlowNode.Callback {
|
||||
|
||||
Reference in New Issue
Block a user