From a0fa838b89c675edb1a60de89ac45137f9829bde Mon Sep 17 00:00:00 2001 From: merenyimiklos Date: Fri, 9 Oct 2026 12:24:52 +0200 Subject: [PATCH 1/3] feat: display app build version and simplify TopBar UI * Add `appVersionLabel()` expect/actual composable function for Android and iOS platforms. * Display build version text at the bottom of `SettingsScreen`. * Simplify `TopBar` layout by removing user profile info, V3 badge, and dropdown selector elements. --- .../hu/petrik/filcapp/Platform.android.kt | 16 ++++ .../kotlin/hu/petrik/filcapp/Platform.kt | 3 + .../hu/petrik/filcapp/components/TopBar.kt | 87 +++---------------- .../petrik/filcapp/screens/SettingsScreen.kt | 9 ++ .../kotlin/hu/petrik/filcapp/Platform.ios.kt | 8 ++ 5 files changed, 46 insertions(+), 77 deletions(-) diff --git a/composeApp/src/androidMain/kotlin/hu/petrik/filcapp/Platform.android.kt b/composeApp/src/androidMain/kotlin/hu/petrik/filcapp/Platform.android.kt index 963d71c..f1b89ad 100644 --- a/composeApp/src/androidMain/kotlin/hu/petrik/filcapp/Platform.android.kt +++ b/composeApp/src/androidMain/kotlin/hu/petrik/filcapp/Platform.android.kt @@ -7,3 +7,19 @@ class AndroidPlatform : Platform { } actual fun getPlatform(): Platform = AndroidPlatform() + +@androidx.compose.runtime.Composable +actual fun appVersionLabel(): String { + val context = androidx.compose.ui.platform.LocalContext.current + val info = rememberPackageInfo(context) + @Suppress("DEPRECATION") + val code = if (android.os.Build.VERSION.SDK_INT >= 28) info.longVersionCode else info.versionCode.toLong() + return "${info.versionName ?: "?"} ($code)" +} + +@androidx.compose.runtime.Composable +private fun rememberPackageInfo(context: android.content.Context): android.content.pm.PackageInfo = + androidx.compose.runtime.remember(context.packageName) { + @Suppress("DEPRECATION") + context.packageManager.getPackageInfo(context.packageName, 0) + } diff --git a/composeApp/src/commonMain/kotlin/hu/petrik/filcapp/Platform.kt b/composeApp/src/commonMain/kotlin/hu/petrik/filcapp/Platform.kt index a39ad18..c6f4d57 100644 --- a/composeApp/src/commonMain/kotlin/hu/petrik/filcapp/Platform.kt +++ b/composeApp/src/commonMain/kotlin/hu/petrik/filcapp/Platform.kt @@ -5,3 +5,6 @@ interface Platform { } expect fun getPlatform(): Platform + +@androidx.compose.runtime.Composable +expect fun appVersionLabel(): String diff --git a/composeApp/src/commonMain/kotlin/hu/petrik/filcapp/components/TopBar.kt b/composeApp/src/commonMain/kotlin/hu/petrik/filcapp/components/TopBar.kt index f320fdc..fae34b7 100644 --- a/composeApp/src/commonMain/kotlin/hu/petrik/filcapp/components/TopBar.kt +++ b/composeApp/src/commonMain/kotlin/hu/petrik/filcapp/components/TopBar.kt @@ -14,9 +14,7 @@ import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.statusBars import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.foundation.shape.CircleShape -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.KeyboardArrowDown import androidx.compose.material.icons.filled.NotificationsNone import androidx.compose.material.icons.filled.School import androidx.compose.material3.HorizontalDivider @@ -29,25 +27,17 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import hu.petrik.filcapp.auth.AuthState @Composable fun TopBar(onProfileClick: () -> Unit = {}) { val user = AuthState.user - val profile = AuthState.profile - val displayName = user?.nickname?.takeIf { it.isNotBlank() } ?: user?.preferredName ?: "Petrik" - val profileLabel = - profile?.teacher?.short?.takeIf { it.isNotBlank() } - ?: profile?.cohort?.short?.takeIf { it.isNotBlank() } - ?: profile?.cohort?.name.orEmpty() - Surface( modifier = Modifier @@ -66,76 +56,19 @@ fun TopBar(onProfileClick: () -> Unit = {}) { horizontalArrangement = Arrangement.spacedBy(10.dp), verticalAlignment = Alignment.CenterVertically, ) { - Row( - horizontalArrangement = Arrangement.spacedBy(8.dp), - verticalAlignment = Alignment.CenterVertically, + Surface( + modifier = Modifier.size(34.dp), + shape = CircleShape, + color = MaterialTheme.colorScheme.tertiary.copy(alpha = 0.14f), ) { - Surface( - modifier = Modifier.size(34.dp), - shape = CircleShape, - color = MaterialTheme.colorScheme.tertiary.copy(alpha = 0.14f), - ) { - Box(contentAlignment = Alignment.Center) { - Icon( - imageVector = Icons.Default.School, - contentDescription = null, - modifier = Modifier.size(19.dp), - tint = MaterialTheme.colorScheme.tertiary, - ) - } - } - - Surface( - shape = RoundedCornerShape(999.dp), - color = MaterialTheme.colorScheme.primary.copy(alpha = 0.14f), - ) { - Text( - text = "V3", - modifier = Modifier.padding(horizontal = 10.dp, vertical = 6.dp), - style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.primary, - fontWeight = FontWeight.Bold, + Box(contentAlignment = Alignment.Center) { + Icon( + imageVector = Icons.Default.School, + contentDescription = null, + modifier = Modifier.size(19.dp), + tint = MaterialTheme.colorScheme.tertiary, ) } - - Surface( - shape = RoundedCornerShape(14.dp), - color = MaterialTheme.colorScheme.surface, - tonalElevation = 1.dp, - shadowElevation = 0.dp, - ) { - Row( - modifier = Modifier.padding(start = 12.dp, end = 8.dp, top = 8.dp, bottom = 8.dp), - horizontalArrangement = Arrangement.spacedBy(4.dp), - verticalAlignment = Alignment.CenterVertically, - ) { - Text( - text = displayName, - style = MaterialTheme.typography.titleMedium, - color = MaterialTheme.colorScheme.onSurface, - fontWeight = FontWeight.Bold, - maxLines = 1, - overflow = TextOverflow.Ellipsis, - ) - - if (profileLabel.isNotBlank()) { - Text( - text = "· $profileLabel", - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - maxLines = 1, - overflow = TextOverflow.Ellipsis, - ) - } - - Icon( - imageVector = Icons.Default.KeyboardArrowDown, - contentDescription = null, - modifier = Modifier.size(15.dp), - tint = MaterialTheme.colorScheme.onSurfaceVariant, - ) - } - } } Spacer(Modifier.weight(1f)) diff --git a/composeApp/src/commonMain/kotlin/hu/petrik/filcapp/screens/SettingsScreen.kt b/composeApp/src/commonMain/kotlin/hu/petrik/filcapp/screens/SettingsScreen.kt index 45a1fb7..7815a83 100644 --- a/composeApp/src/commonMain/kotlin/hu/petrik/filcapp/screens/SettingsScreen.kt +++ b/composeApp/src/commonMain/kotlin/hu/petrik/filcapp/screens/SettingsScreen.kt @@ -63,10 +63,12 @@ import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.rememberVectorPainter import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import cafe.adriel.voyager.navigator.tab.Tab import cafe.adriel.voyager.navigator.tab.TabOptions +import hu.petrik.filcapp.appVersionLabel import hu.petrik.filcapp.auth.AuthManager import hu.petrik.filcapp.auth.AuthState import hu.petrik.filcapp.components.SearchableSelection @@ -298,6 +300,13 @@ fun SettingsScreen() { ) Spacer(Modifier.height(8.dp)) + Text( + text = "Mergen · " + tr("Build verzió", "Build version") + " " + appVersionLabel(), + modifier = Modifier.fillMaxWidth().padding(bottom = 8.dp), + style = MaterialTheme.typography.labelSmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + textAlign = TextAlign.Center, + ) } } } diff --git a/composeApp/src/iosMain/kotlin/hu/petrik/filcapp/Platform.ios.kt b/composeApp/src/iosMain/kotlin/hu/petrik/filcapp/Platform.ios.kt index 358fb47..b8bf9b0 100644 --- a/composeApp/src/iosMain/kotlin/hu/petrik/filcapp/Platform.ios.kt +++ b/composeApp/src/iosMain/kotlin/hu/petrik/filcapp/Platform.ios.kt @@ -7,3 +7,11 @@ class IOSPlatform : Platform { } actual fun getPlatform(): Platform = IOSPlatform() + +@androidx.compose.runtime.Composable +actual fun appVersionLabel(): String { + val bundle = platform.Foundation.NSBundle.mainBundle + val version = bundle.objectForInfoDictionaryKey("CFBundleShortVersionString") as? String ?: "?" + val build = bundle.objectForInfoDictionaryKey("CFBundleVersion") as? String ?: "?" + return "$version ($build)" +} From 9b42a3f74d1fb18191b5b2eb9eb988b76d131f97 Mon Sep 17 00:00:00 2001 From: merenyimiklos Date: Fri, 9 Oct 2026 12:30:05 +0200 Subject: [PATCH 2/3] style: add empty line in appVersionLabel --- .../src/androidMain/kotlin/hu/petrik/filcapp/Platform.android.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/composeApp/src/androidMain/kotlin/hu/petrik/filcapp/Platform.android.kt b/composeApp/src/androidMain/kotlin/hu/petrik/filcapp/Platform.android.kt index f1b89ad..efcbed6 100644 --- a/composeApp/src/androidMain/kotlin/hu/petrik/filcapp/Platform.android.kt +++ b/composeApp/src/androidMain/kotlin/hu/petrik/filcapp/Platform.android.kt @@ -12,6 +12,7 @@ actual fun getPlatform(): Platform = AndroidPlatform() actual fun appVersionLabel(): String { val context = androidx.compose.ui.platform.LocalContext.current val info = rememberPackageInfo(context) + @Suppress("DEPRECATION") val code = if (android.os.Build.VERSION.SDK_INT >= 28) info.longVersionCode else info.versionCode.toLong() return "${info.versionName ?: "?"} ($code)" From a17a8e6b34dd6dd6c20e9600902304b607cc65ab Mon Sep 17 00:00:00 2001 From: merenyimiklos Date: Fri, 9 Oct 2026 12:32:10 +0200 Subject: [PATCH 3/3] fix: adjust navigation bar insets and Android system bar colors * Move `WindowInsets.navigationBars` padding from `Surface` to the inner `Row` layout in `App.kt`. * Update Android system navigation bar background colors for dark theme (`RGB(24, 24, 27)`) and light theme (`Color.WHITE`) in `PlatformSystemBars.android.kt`. --- .../hu/petrik/filcapp/theme/PlatformSystemBars.android.kt | 4 ++-- composeApp/src/commonMain/kotlin/hu/petrik/filcapp/App.kt | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/composeApp/src/androidMain/kotlin/hu/petrik/filcapp/theme/PlatformSystemBars.android.kt b/composeApp/src/androidMain/kotlin/hu/petrik/filcapp/theme/PlatformSystemBars.android.kt index efdcf29..2743528 100644 --- a/composeApp/src/androidMain/kotlin/hu/petrik/filcapp/theme/PlatformSystemBars.android.kt +++ b/composeApp/src/androidMain/kotlin/hu/petrik/filcapp/theme/PlatformSystemBars.android.kt @@ -34,9 +34,9 @@ actual fun ApplyPlatformSystemBars(darkTheme: Boolean) { @Suppress("DEPRECATION") activity.window.navigationBarColor = if (darkTheme) { - Color.rgb(11, 17, 32) + Color.rgb(24, 24, 27) } else { - Color.rgb(246, 247, 251) + Color.WHITE } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { diff --git a/composeApp/src/commonMain/kotlin/hu/petrik/filcapp/App.kt b/composeApp/src/commonMain/kotlin/hu/petrik/filcapp/App.kt index 63906a5..75ac07f 100644 --- a/composeApp/src/commonMain/kotlin/hu/petrik/filcapp/App.kt +++ b/composeApp/src/commonMain/kotlin/hu/petrik/filcapp/App.kt @@ -210,10 +210,7 @@ private fun FigmaBottomNavigation( onMore: () -> Unit, ) { Surface( - modifier = - Modifier - .fillMaxWidth() - .windowInsetsPadding(WindowInsets.navigationBars), + modifier = Modifier.fillMaxWidth(), color = MaterialTheme.colorScheme.surface, shadowElevation = 12.dp, ) { @@ -221,6 +218,7 @@ private fun FigmaBottomNavigation( modifier = Modifier .fillMaxWidth() + .windowInsetsPadding(WindowInsets.navigationBars) .height(64.dp) .padding(horizontal = 8.dp), verticalAlignment = Alignment.CenterVertically,