Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 81a23493 authored by Will Leshner's avatar Will Leshner
Browse files

Delay showing hub onboarding bottom sheet.

There should be a 1-second delay (after entering hub) before the bottom
sheet appears.

Bug: 392924444
Test: Manually by observing that the bottom sheet appears after a delay.
Flag: com.android.systemui.glanceable_hub_v2

Change-Id: I47b648ee4552656d3660489bfd821dedb952f8af
parent ea55a5ff
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -52,6 +53,8 @@ import com.android.systemui.statusbar.phone.ComponentSystemUIDialog
import com.android.systemui.statusbar.phone.SystemUIDialogFactory
import com.android.systemui.statusbar.phone.createBottomSheet
import javax.inject.Inject
import kotlin.time.Duration.Companion.milliseconds
import kotlinx.coroutines.delay

class HubOnboardingSection
@Inject
@@ -69,12 +72,25 @@ constructor(
            return
        }

        var show by remember { mutableStateOf(false) }

        LaunchedEffect(Unit) {
            delay(SHOW_BOTTOMSHEET_DELAY_MS)
            show = true
        }

        if (show) {
            HubOnboardingBottomSheet(shouldShowBottomSheet = true, dialogFactory = dialogFactory) {
                viewModel.onDismissed()
            }
        }
    }

    companion object {
        val SHOW_BOTTOMSHEET_DELAY_MS = 1000.milliseconds
    }
}

@Composable
private fun HubOnboardingBottomSheet(
    shouldShowBottomSheet: Boolean,