Share login-required content; use shared composable in Android dialog
This commit is contained in:
@@ -144,6 +144,7 @@ import app.klottr.ui.FoundContent // Delat innehåll för “Hittat”
|
||||
import app.klottr.ui.FoundDetailContent // Delad detalj-UI (CMP)
|
||||
import app.klottr.ui.KlottrAboutContent
|
||||
import app.klottr.ui.KlottrHomeContent // Ny: delat mittinnehåll
|
||||
import app.klottr.ui.LoginRequiredContent
|
||||
import app.klottr.ui.NearbyContent // Delat material-fritt innehåll för Närliggande
|
||||
import app.klottr.ui.MapPanelShell
|
||||
import app.klottr.ui.SettingsContent // Delad material-fri UI för inställningar
|
||||
@@ -351,7 +352,7 @@ fun AboutDialog(onDismiss: () -> Unit) {
|
||||
"Version ${BuildConfig.VERSION_NAME} (${BuildConfig.BUILD_TYPE}) • build $versionCode",
|
||||
"Byggd ${BuildConfig.BUILD_TIME_UTC}",
|
||||
"Utvecklad av Fabian Norlin.",
|
||||
"IOS-ansvarig: Olov Hedman."
|
||||
"IOS-ansvarig: Olof Hedman.",
|
||||
"Mejlkontakt: utv@ointressant.se"
|
||||
),
|
||||
lineStyle = MaterialTheme.typography.bodyMedium.copy(
|
||||
@@ -364,8 +365,6 @@ fun AboutDialog(onDismiss: () -> Unit) {
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
private fun KlottrApp(
|
||||
@@ -1232,7 +1231,14 @@ private fun KlottrApp(
|
||||
AlertDialog(
|
||||
onDismissRequest = { showLoginRequired = false },
|
||||
title = { Text("Inloggning krävs") },
|
||||
text = { Text("Du måste logga in för att kunna klottra.") },
|
||||
text = {
|
||||
LoginRequiredContent(
|
||||
message = "Du måste logga in för att kunna klottra.",
|
||||
textStyle = MaterialTheme.typography.bodyMedium.copy(
|
||||
color = MaterialTheme.colorScheme.onSurface // Följer dag/natt
|
||||
)
|
||||
)
|
||||
},
|
||||
confirmButton = {
|
||||
Button(onClick = {
|
||||
showLoginRequired = false
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package app.klottr.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.text.BasicText
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* Material-fri textkropp för "inloggning krävs".
|
||||
* Android/iOS sätter färg/typografi via textStyle.
|
||||
*/
|
||||
@Composable
|
||||
fun LoginRequiredContent(
|
||||
message: String,
|
||||
textStyle: TextStyle,
|
||||
noteLines: List<String> = emptyList()
|
||||
) {
|
||||
Column {
|
||||
BasicText(message, style = textStyle)
|
||||
if (noteLines.isNotEmpty()) {
|
||||
Spacer(Modifier.height(8.dp))
|
||||
noteLines.forEachIndexed { i, s ->
|
||||
if (i > 0) Spacer(Modifier.height(4.dp))
|
||||
BasicText(s, style = textStyle)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user