File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
app/src/main/java/to/bitkit/ui/components Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ package to.bitkit.ui.components
33import androidx.compose.runtime.Composable
44import androidx.compose.runtime.LaunchedEffect
55import androidx.compose.runtime.getValue
6+ import androidx.compose.runtime.mutableStateOf
7+ import androidx.compose.runtime.remember
68import androidx.compose.ui.platform.LocalContext
79import androidx.lifecycle.compose.collectAsStateWithLifecycle
810import to.bitkit.R
@@ -17,7 +19,15 @@ fun IsOnlineTracker(
1719 val context = LocalContext .current
1820 val connectivityState by app.isOnline.collectAsStateWithLifecycle(initialValue = ConnectivityState .CONNECTED )
1921
22+ val (isFirstEmission, setIsFirstEmission) = remember { mutableStateOf(true ) }
23+
2024 LaunchedEffect (connectivityState) {
25+ // Skip the first emission to prevent toast on startup
26+ if (isFirstEmission) {
27+ setIsFirstEmission(true )
28+ return @LaunchedEffect
29+ }
30+
2131 when (connectivityState) {
2232 ConnectivityState .CONNECTED -> {
2333 app.toast(
You can’t perform that action at this time.
0 commit comments