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

Celtiore8cd5c2d8b84c
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 aded4686..1ab78ffd 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
@@ -5,16 +5,15 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
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.shape.RoundedCornerShape
-import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import androidx.compose.material3.CircularProgressIndicator
+import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.runtime.Composable
-import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.compose.runtime.LaunchedEffect
-import androidx.lifecycle.compose.collectAsStateWithLifecycle
-import androidx.compose.runtime.collectAsState
-import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@@ -24,8 +23,8 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
import androidx.lifecycle.ViewModel
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewModelScope
-import androidx.compose.material3.CircularProgressIndicator
import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.Surface
import androidx.tv.material3.SurfaceDefaults
@@ -35,6 +34,7 @@ import com.streamvault.app.ui.components.shell.StatusPill
import com.streamvault.app.ui.design.AppColors
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
@@ -90,6 +90,7 @@ fun WelcomeScreen(
viewModel: WelcomeViewModel = hiltViewModel()
) {
val hasProviders by viewModel.hasProviders.collectAsStateWithLifecycle()
+ val syncProgress by viewModel.syncProgress.collectAsStateWithLifecycle()
LaunchedEffect(hasProviders) {
when (hasProviders) {
@@ -125,25 +126,87 @@ fun WelcomeScreen(
modifier = Modifier.padding(horizontal = 36.dp, vertical = 28.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
+ val progress = syncProgress
+ val pillLabel = if (progress != null) {
+ stringResource(sectionLabelRes(progress.section))
+ } else {
+ stringResource(R.string.app_name)
+ }
+ val pillColor = if (progress != null) {
+ sectionColor(progress.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 (progress == 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 (progress != null && progress.currentLabel.isNotBlank()) {
+ progress.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 (progress != null) {
+ Spacer(modifier = Modifier.height(14.dp))
+ if (progress.total > 0) {
+ LinearProgressIndicator(
+ progress = { progress.current.toFloat() / progress.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,
+ progress.itemsIndexed
+ ),
+ style = MaterialTheme.typography.labelLarge,
+ color = AppColors.TextSecondary
+ )
+ }
}
}
}
}
+
+@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 c1c79ca5..bc5fbe8f 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 de l\'écran de droite 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 fdf19d48..45a11f97 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -17,6 +17,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>