bugfixing
This commit is contained in:
Binary file not shown.
@@ -39,7 +39,7 @@ data class SpielplanResponse(
|
|||||||
data class SeasonDto(val slug: String = "", val label: String = "")
|
data class SeasonDto(val slug: String = "", val label: String = "")
|
||||||
data class MannschaftenSeasonsResponse(
|
data class MannschaftenSeasonsResponse(
|
||||||
val success: Boolean = false,
|
val success: Boolean = false,
|
||||||
val seasons: List<SeasonDto> = emptyList(),
|
val seasons: List<String> = emptyList(),
|
||||||
val currentSeason: String = "",
|
val currentSeason: String = "",
|
||||||
val defaultSeason: String = "",
|
val defaultSeason: String = "",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -278,6 +278,7 @@ fun NavGraph(
|
|||||||
de.harheimertc.ui.screens.memberarea.MemberAreaScreen(
|
de.harheimertc.ui.screens.memberarea.MemberAreaScreen(
|
||||||
navController = navController,
|
navController = navController,
|
||||||
showBackNavigation = !persistentNavigation,
|
showBackNavigation = !persistentNavigation,
|
||||||
|
navigationState = navigationState,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
composable(Destinations.Members.route) {
|
composable(Destinations.Members.route) {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class NavigationViewModel @Inject constructor(
|
|||||||
teams = teams.await(),
|
teams = teams.await(),
|
||||||
hasGalleryImages = gallery.await(),
|
hasGalleryImages = gallery.await(),
|
||||||
loggedIn = hasStoredSession || status.isLoggedIn,
|
loggedIn = hasStoredSession || status.isLoggedIn,
|
||||||
roles = (status.roles + status.user?.roles.orEmpty()).toSet(),
|
roles = status.navigationRoles(),
|
||||||
connectionNote = null,
|
connectionNote = null,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ class NavigationViewModel @Inject constructor(
|
|||||||
val hasStoredSession = !authRepository.getToken().isNullOrBlank()
|
val hasStoredSession = !authRepository.getToken().isNullOrBlank()
|
||||||
_state.value = _state.value.copy(
|
_state.value = _state.value.copy(
|
||||||
loggedIn = hasStoredSession || status.isLoggedIn,
|
loggedIn = hasStoredSession || status.isLoggedIn,
|
||||||
roles = (status.roles + status.user?.roles.orEmpty()).toSet(),
|
roles = status.navigationRoles(),
|
||||||
connectionNote = _state.value.connectionNote,
|
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())
|
||||||
|
}
|
||||||
|
|||||||
@@ -56,10 +56,17 @@ class MannschaftenViewModel @Inject constructor(
|
|||||||
repository.fetchSeasons()
|
repository.fetchSeasons()
|
||||||
.onSuccess { response ->
|
.onSuccess { response ->
|
||||||
val currentSeason = getCurrentSeasonSlug()
|
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 {
|
val selectedSeason = when {
|
||||||
response.defaultSeason.isNotBlank() -> response.defaultSeason
|
|
||||||
seasons.any { it.slug == currentSeason } -> currentSeason
|
seasons.any { it.slug == currentSeason } -> currentSeason
|
||||||
|
seasons.any { it.slug == serverCurrentSeason } -> serverCurrentSeason
|
||||||
|
response.defaultSeason.isNotBlank() -> response.defaultSeason
|
||||||
seasons.isNotEmpty() -> seasons.first().slug
|
seasons.isNotEmpty() -> seasons.first().slug
|
||||||
else -> currentSeason
|
else -> currentSeason
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,11 @@ import androidx.compose.ui.text.font.FontWeight
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
|
import de.harheimertc.BuildConfig
|
||||||
import de.harheimertc.data.BirthdayDto
|
import de.harheimertc.data.BirthdayDto
|
||||||
import de.harheimertc.ui.components.LoadingState
|
import de.harheimertc.ui.components.LoadingState
|
||||||
import de.harheimertc.ui.navigation.Destinations
|
import de.harheimertc.ui.navigation.Destinations
|
||||||
|
import de.harheimertc.ui.navigation.NavigationUiState
|
||||||
import de.harheimertc.ui.theme.Accent100
|
import de.harheimertc.ui.theme.Accent100
|
||||||
import de.harheimertc.ui.theme.Accent500
|
import de.harheimertc.ui.theme.Accent500
|
||||||
import de.harheimertc.ui.theme.Accent700
|
import de.harheimertc.ui.theme.Accent700
|
||||||
@@ -40,6 +42,7 @@ import de.harheimertc.ui.theme.Primary600
|
|||||||
fun MemberAreaScreen(
|
fun MemberAreaScreen(
|
||||||
navController: NavController,
|
navController: NavController,
|
||||||
showBackNavigation: Boolean,
|
showBackNavigation: Boolean,
|
||||||
|
navigationState: NavigationUiState = NavigationUiState(),
|
||||||
viewModel: MemberAreaViewModel = hiltViewModel(),
|
viewModel: MemberAreaViewModel = hiltViewModel(),
|
||||||
) {
|
) {
|
||||||
val state by viewModel.state.collectAsState()
|
val state by viewModel.state.collectAsState()
|
||||||
@@ -63,6 +66,12 @@ fun MemberAreaScreen(
|
|||||||
MemberAreaCardGrid(navController)
|
MemberAreaCardGrid(navController)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (navigationState.isAdmin) {
|
||||||
|
item {
|
||||||
|
ServerInfoCard()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
item {
|
item {
|
||||||
BirthdayCard(
|
BirthdayCard(
|
||||||
birthdays = state.birthdays,
|
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
|
@Composable
|
||||||
private fun MemberAreaCardGrid(navController: NavController) {
|
private fun MemberAreaCardGrid(navController: NavController) {
|
||||||
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
|
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ LOCAL_API_BASE_URL=https://harheimertc.tsschulz.de/
|
|||||||
PRODUCTION_API_BASE_URL=https://harheimertc.de/
|
PRODUCTION_API_BASE_URL=https://harheimertc.de/
|
||||||
|
|
||||||
# Android app versioning for Play Store uploads
|
# Android app versioning for Play Store uploads
|
||||||
ANDROID_VERSION_CODE=21
|
ANDROID_VERSION_CODE=23
|
||||||
ANDROID_VERSION_NAME=0.9.16
|
ANDROID_VERSION_NAME=0.9.18
|
||||||
|
|
||||||
# Temporary hotfix: disable R8 minification for release to avoid Retrofit generic signature stripping.
|
# Temporary hotfix: disable R8 minification for release to avoid Retrofit generic signature stripping.
|
||||||
RELEASE_MINIFY_ENABLED=false
|
RELEASE_MINIFY_ENABLED=false
|
||||||
|
|||||||
Reference in New Issue
Block a user