Skip to content

StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.

feat(app): WelcomeScreen affiche progression dynamique + strings i18n EN/FR

Celtiore63761945b42f
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/welcome/WelcomeScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/welcome/WelcomeScreen.kt
index 5634b53d..a9896602 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/welcome/WelcomeScreen.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/welcome/WelcomeScreen.kt
@@ -10,9 +10,11 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.CircularProgressIndicator
+import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
@@ -38,6 +40,7 @@ import com.streamvault.app.ui.design.AppColors
import com.streamvault.app.ui.interaction.TvButton
import com.streamvault.data.sync.SyncProgressBus
import com.streamvault.domain.repository.ProviderRepository
+import com.streamvault.domain.sync.Section
import com.streamvault.domain.sync.SyncProgress
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
@@ -93,6 +96,7 @@ fun WelcomeScreen(
viewModel: WelcomeViewModel = hiltViewModel()
) {
val hasProviders by viewModel.hasProviders.collectAsStateWithLifecycle()
+ val syncProgress by viewModel.syncProgress.collectAsStateWithLifecycle()
LaunchedEffect(hasProviders) {
when (hasProviders) {
@@ -127,6 +131,7 @@ fun WelcomeScreen(
)
else -> WelcomeLoadingCard(
+ syncProgress = syncProgress,
modifier = Modifier
.align(Alignment.Center)
.padding(32.dp)
@@ -136,7 +141,10 @@ fun WelcomeScreen(
}
@Composable
-private fun WelcomeLoadingCard(modifier: Modifier = Modifier) {
+private fun WelcomeLoadingCard(
+ syncProgress: SyncProgress?,
+ modifier: Modifier = Modifier
+) {
Surface(
modifier = modifier,
shape = RoundedCornerShape(28.dp),
@@ -146,24 +154,72 @@ private fun WelcomeLoadingCard(modifier: Modifier = Modifier) {
modifier = Modifier.padding(horizontal = 36.dp, vertical = 28.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
+ val pillLabel = if (syncProgress != null) {
+ stringResource(sectionLabelRes(syncProgress.section))
+ } else {
+ stringResource(R.string.app_name)
+ }
+ val pillColor = if (syncProgress != null) {
+ sectionColor(syncProgress.section)
+ } else {
+ AppColors.BrandMuted
+ }
StatusPill(
- label = stringResource(R.string.app_name),
- containerColor = AppColors.BrandMuted
+ label = pillLabel,
+ containerColor = pillColor
)
Spacer(modifier = Modifier.height(18.dp))
- CircularProgressIndicator(color = AppColors.Brand)
- Spacer(modifier = Modifier.height(18.dp))
+ // D13 — spinner masqué dès qu'on a une progression structurée.
+ if (syncProgress == null) {
+ CircularProgressIndicator(color = AppColors.Brand)
+ Spacer(modifier = Modifier.height(18.dp))
+ }
Text(
text = stringResource(R.string.welcome_loading_title),
style = MaterialTheme.typography.titleLarge,
color = AppColors.TextPrimary
)
Spacer(modifier = Modifier.height(6.dp))
+ val subtitle = if (syncProgress != null && syncProgress.currentLabel.isNotBlank()) {
+ syncProgress.currentLabel
+ } else {
+ stringResource(R.string.welcome_loading_subtitle)
+ }
Text(
- text = stringResource(R.string.welcome_loading_subtitle),
+ text = subtitle,
style = MaterialTheme.typography.bodyLarge,
color = AppColors.TextSecondary
)
+ if (syncProgress != null) {
+ Spacer(modifier = Modifier.height(14.dp))
+ if (syncProgress.total > 0) {
+ LinearProgressIndicator(
+ progress = { syncProgress.current.toFloat() / syncProgress.total.toFloat() },
+ modifier = Modifier
+ .fillMaxWidth()
+ .width(260.dp),
+ color = AppColors.Brand,
+ trackColor = AppColors.BrandMuted
+ )
+ } else {
+ LinearProgressIndicator(
+ modifier = Modifier
+ .fillMaxWidth()
+ .width(260.dp),
+ color = AppColors.Brand,
+ trackColor = AppColors.BrandMuted
+ )
+ }
+ Spacer(modifier = Modifier.height(10.dp))
+ Text(
+ text = stringResource(
+ R.string.sync_items_indexed_format,
+ syncProgress.itemsIndexed
+ ),
+ style = MaterialTheme.typography.labelLarge,
+ color = AppColors.TextSecondary
+ )
+ }
}
}
}
@@ -228,3 +284,16 @@ private fun WelcomeStartCard(
}
}
}
+
+@Composable
+private fun sectionColor(section: Section): Color = when (section) {
+ Section.LIVE -> AppColors.Brand
+ Section.VOD -> AppColors.Success
+ Section.SERIES -> AppColors.Warning
+}
+
+private fun sectionLabelRes(section: Section): Int = when (section) {
+ Section.LIVE -> R.string.sync_section_live
+ Section.VOD -> R.string.sync_section_vod
+ Section.SERIES -> R.string.sync_section_series
+}
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index b2709007..2eb411a1 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -13,6 +13,10 @@
<string name="welcome_version">v1.0.3</string>
<string name="welcome_loading_title">Préparation de votre bibliothèque</string>
<string name="welcome_loading_subtitle">Ouverture du bon écran pour cet appareil.</string>
+ <string name="sync_section_live">Live</string>
+ <string name="sync_section_vod">VOD</string>
+ <string name="sync_section_series">Séries</string>
+ <string name="sync_items_indexed_format">%1$d éléments indexés</string>
<string name="welcome_tagline">IPTV premium pour le salon</string>
<string name="welcome_subtitle">Profitez des chaînes en direct, du visionnage de rattrapage, des films et des séries avec une expérience Android TV propriétaire.</string>
<string name="welcome_feature_live">Navigation en direct rapide avec mise au point à distance</string>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 277a598a..a6dd63bb 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -19,6 +19,10 @@
<string name="welcome_version">v1.0.3</string>
<string name="welcome_loading_title">Preparing your library</string>
<string name="welcome_loading_subtitle">Opening the right screen for this device.</string>
+ <string name="sync_section_live">Live</string>
+ <string name="sync_section_vod">VOD</string>
+ <string name="sync_section_series">Series</string>
+ <string name="sync_items_indexed_format">%1$d items indexed</string>
<string name="welcome_tagline">Premium IPTV for the living room</string>
<string name="welcome_subtitle">Lean back into live channels, catch-up viewing, movies, and series with a first-party Android TV experience.</string>
<string name="welcome_feature_live">Fast live browsing with remote-first focus</string>