bugfixing
Some checks failed
Code Analysis and Production Deploy / analyze (push) Failing after 8m1s
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Has been skipped

This commit is contained in:
Torsten Schulz (local)
2026-06-09 09:59:32 +02:00
parent 7aa7970f2e
commit a98def915e
7 changed files with 40 additions and 7 deletions

View File

@@ -39,7 +39,7 @@ data class SpielplanResponse(
data class SeasonDto(val slug: String = "", val label: String = "")
data class MannschaftenSeasonsResponse(
val success: Boolean = false,
val seasons: List<SeasonDto> = emptyList(),
val seasons: List<String> = emptyList(),
val currentSeason: String = "",
val defaultSeason: String = "",
)

View File

@@ -278,6 +278,7 @@ fun NavGraph(
de.harheimertc.ui.screens.memberarea.MemberAreaScreen(
navController = navController,
showBackNavigation = !persistentNavigation,
navigationState = navigationState,
)
}
composable(Destinations.Members.route) {

View File

@@ -65,7 +65,7 @@ class NavigationViewModel @Inject constructor(
teams = teams.await(),
hasGalleryImages = gallery.await(),
loggedIn = hasStoredSession || status.isLoggedIn,
roles = (status.roles + status.user?.roles.orEmpty()).toSet(),
roles = status.navigationRoles(),
connectionNote = null,
)
}
@@ -77,7 +77,7 @@ class NavigationViewModel @Inject constructor(
val hasStoredSession = !authRepository.getToken().isNullOrBlank()
_state.value = _state.value.copy(
loggedIn = hasStoredSession || status.isLoggedIn,
roles = (status.roles + status.user?.roles.orEmpty()).toSet(),
roles = status.navigationRoles(),
connectionNote = _state.value.connectionNote,
)
}
@@ -95,3 +95,9 @@ class NavigationViewModel @Inject constructor(
}
}
}
private fun de.harheimertc.data.AuthStatusResponse.navigationRoles(): Set<String> = buildSet {
addAll(roles)
role?.takeIf { it.isNotBlank() }?.let(::add)
addAll(user?.roles.orEmpty())
}

View File

@@ -56,10 +56,17 @@ class MannschaftenViewModel @Inject constructor(
repository.fetchSeasons()
.onSuccess { response ->
val currentSeason = getCurrentSeasonSlug()
val seasons = response.seasons.ifEmpty { listOf(SeasonDto(slug = response.currentSeason.ifBlank { currentSeason }, label = formatSeasonLabel(response.currentSeason.ifBlank { currentSeason }))) }
val seasons = response.seasons
.map { season -> SeasonDto(slug = season, label = formatSeasonLabel(season)) }
.ifEmpty {
val fallbackSeason = response.currentSeason.ifBlank { currentSeason }
listOf(SeasonDto(slug = fallbackSeason, label = formatSeasonLabel(fallbackSeason)))
}
val serverCurrentSeason = response.currentSeason.ifBlank { currentSeason }
val selectedSeason = when {
response.defaultSeason.isNotBlank() -> response.defaultSeason
seasons.any { it.slug == currentSeason } -> currentSeason
seasons.any { it.slug == serverCurrentSeason } -> serverCurrentSeason
response.defaultSeason.isNotBlank() -> response.defaultSeason
seasons.isNotEmpty() -> seasons.first().slug
else -> currentSeason
}

View File

@@ -26,9 +26,11 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import de.harheimertc.BuildConfig
import de.harheimertc.data.BirthdayDto
import de.harheimertc.ui.components.LoadingState
import de.harheimertc.ui.navigation.Destinations
import de.harheimertc.ui.navigation.NavigationUiState
import de.harheimertc.ui.theme.Accent100
import de.harheimertc.ui.theme.Accent500
import de.harheimertc.ui.theme.Accent700
@@ -40,6 +42,7 @@ import de.harheimertc.ui.theme.Primary600
fun MemberAreaScreen(
navController: NavController,
showBackNavigation: Boolean,
navigationState: NavigationUiState = NavigationUiState(),
viewModel: MemberAreaViewModel = hiltViewModel(),
) {
val state by viewModel.state.collectAsState()
@@ -63,6 +66,12 @@ fun MemberAreaScreen(
MemberAreaCardGrid(navController)
}
if (navigationState.isAdmin) {
item {
ServerInfoCard()
}
}
item {
BirthdayCard(
birthdays = state.birthdays,
@@ -74,6 +83,16 @@ fun MemberAreaScreen(
}
}
@Composable
private fun ServerInfoCard() {
Surface(color = Primary100, shape = RoundedCornerShape(14.dp), shadowElevation = 2.dp) {
Column(Modifier.fillMaxWidth().padding(18.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
Text("Serververbindung", style = MaterialTheme.typography.titleLarge, color = Accent900)
Text(BuildConfig.API_BASE_URL.trimEnd('/'), color = Primary600, fontWeight = FontWeight.SemiBold)
}
}
}
@Composable
private fun MemberAreaCardGrid(navController: NavController) {
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {

View File

@@ -8,8 +8,8 @@ LOCAL_API_BASE_URL=https://harheimertc.tsschulz.de/
PRODUCTION_API_BASE_URL=https://harheimertc.de/
# Android app versioning for Play Store uploads
ANDROID_VERSION_CODE=21
ANDROID_VERSION_NAME=0.9.16
ANDROID_VERSION_CODE=23
ANDROID_VERSION_NAME=0.9.18
# Temporary hotfix: disable R8 minification for release to avoid Retrofit generic signature stripping.
RELEASE_MINIFY_ENABLED=false