Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ plugins {
alias(libs.plugins.detekt) apply false
alias(libs.plugins.google.services) apply false
alias(libs.plugins.firebase.crashlytics) apply false
alias(libs.plugins.sqldelight) apply false
}

val detektVersion: String? = libs.versions.detekt.get()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Archive
import androidx.compose.material.icons.filled.CalendarToday
import androidx.compose.material.icons.filled.CheckCircle
import androidx.compose.material.icons.filled.Error
import androidx.compose.material.icons.filled.Group
import androidx.compose.material.icons.filled.Schedule
import androidx.compose.material3.CircularProgressIndicator
Expand All @@ -46,8 +45,11 @@ import androidx.lifecycle.viewmodel.compose.viewModel
import com.google.accompanist.swiperefresh.SwipeRefresh
import com.google.accompanist.swiperefresh.rememberSwipeRefreshState
import androidx.compose.material3.MaterialTheme
import androidx.compose.ui.res.stringResource
import friends.mobile.R
import friends.mobile.designsystem.theme.DesignTheme
import friends.mobile.designsystem.components.ButtonFactory
import friends.mobile.designsystem.components.ErrorBanner
import friends.mobile.feature.archive.presentation.ArchiveEventsViewModel
import friends.mobile.feature.archive.presentation.ArchiveViewAction
import friends.mobile.feature.archive.presentation.ArchiveViewState
Expand All @@ -69,7 +71,7 @@ fun ArchiveEventsView(
Scaffold(
topBar = {
TopAppBar(
title = { Text("Archive", style = DesignTheme.Typography.heading) }
title = { Text(stringResource(R.string.archive_title), style = DesignTheme.Typography.heading) }
)
}
) { innerPadding ->
Expand All @@ -83,31 +85,15 @@ fun ArchiveEventsView(
}

errorMessage != null -> {
Column(
Box(
modifier = Modifier
.fillMaxSize()
.padding(DesignTheme.Spacing.lg),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
contentAlignment = Alignment.Center,
) {
Icon(
imageVector = Icons.Default.Error,
contentDescription = null,
modifier = Modifier.size(48.dp),
tint = MaterialTheme.colorScheme.error
)
Spacer(modifier = Modifier.height(DesignTheme.Spacing.md))
Text(
text = errorMessage,
style = DesignTheme.Typography.body,
color = MaterialTheme.colorScheme.error,
textAlign = TextAlign.Center
)
Spacer(modifier = Modifier.height(DesignTheme.Spacing.md))
ButtonFactory.Primary(
text = "Retry",
onClick = { viewModel.obtainEvent(ArchiveViewAction.OnRefresh) },
modifier = Modifier.fillMaxWidth()
ErrorBanner(
message = errorMessage,
onRetry = { viewModel.obtainEvent(ArchiveViewAction.OnRefresh) }
)
}
}
Expand All @@ -126,7 +112,7 @@ fun ArchiveEventsView(
)
Spacer(modifier = Modifier.height(DesignTheme.Spacing.sm))
Text(
text = "No archived events",
text = stringResource(R.string.archive_empty),
style = DesignTheme.Typography.body,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
Expand Down Expand Up @@ -216,7 +202,7 @@ private fun CompletedBadge() {
tint = MaterialTheme.colorScheme.onSurfaceVariant,
)
Text(
text = "Completed",
text = stringResource(R.string.archive_badge_completed),
style = DesignTheme.Typography.bodySmallest.copy(fontWeight = FontWeight.SemiBold),
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.ui.text.input.KeyboardType
Expand Down Expand Up @@ -139,7 +140,7 @@ private fun LoginForm(
FormTextField(
value = username,
onValueChange = onUsernameChanged,
placeholder = "Username",
placeholder = stringResource(R.string.label_username),
modifier = Modifier.fillMaxWidth(),
keyboardOptions = KeyboardOptions(
capitalization = KeyboardCapitalization.None,
Expand All @@ -150,7 +151,7 @@ private fun LoginForm(
FormSecureField(
value = password,
onValueChange = onPasswordChanged,
placeholder = "Password",
placeholder = stringResource(R.string.label_password),
modifier = Modifier.fillMaxWidth(),
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password)
)
Expand All @@ -163,7 +164,7 @@ private fun LoginForm(

item {
ButtonFactory.Primary(
text = "Login",
text = stringResource(R.string.auth_login),
onClick = onLoginClick,
modifier = Modifier
.fillMaxWidth()
Expand All @@ -180,12 +181,12 @@ private fun LoginForm(
modifier = Modifier.fillMaxWidth()
) {
Text(
text = "Don't have an account?",
text = stringResource(R.string.auth_no_account),
style = DesignTheme.Typography.caption,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
Text(
text = "Sign up",
text = stringResource(R.string.auth_sign_up),
modifier = Modifier.clickable { onRegisterClick() },
style = DesignTheme.Typography.captionSemibold,
color = MaterialTheme.colorScheme.primary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.compose.ui.res.stringResource
import friends.mobile.R
import friends.mobile.designsystem.components.ButtonFactory
import friends.mobile.designsystem.components.FormErrorMessage
import friends.mobile.designsystem.components.FormSecureField
Expand Down Expand Up @@ -89,14 +91,14 @@ fun RegisterBottomSheet(
horizontalArrangement = Arrangement.SpaceBetween
) {
Text(
text = "Create Account",
text = stringResource(R.string.auth_create_account),
style = DesignTheme.Typography.heading,
color = MaterialTheme.colorScheme.onSurface
)
IconButton(onClick = onDismiss) {
Icon(
imageVector = Icons.Default.Cancel,
contentDescription = "Close",
contentDescription = stringResource(R.string.close),
tint = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.5f)
)
}
Expand All @@ -116,7 +118,7 @@ fun RegisterBottomSheet(
username = it
viewModel.obtainEvent(RegisterEvent.OnUsernameChanged(it))
},
placeholder = "Username",
placeholder = stringResource(R.string.label_username),
modifier = Modifier.fillMaxWidth(),
keyboardOptions = KeyboardOptions(
capitalization = KeyboardCapitalization.None,
Expand All @@ -130,7 +132,7 @@ fun RegisterBottomSheet(
password = it
viewModel.obtainEvent(RegisterEvent.OnPasswordChanged(it))
},
placeholder = "Password",
placeholder = stringResource(R.string.label_password),
modifier = Modifier.fillMaxWidth(),
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password)
)
Expand All @@ -143,7 +145,7 @@ fun RegisterBottomSheet(

item {
ButtonFactory.Primary(
text = "Create Account",
text = stringResource(R.string.auth_create_account),
onClick = { viewModel.obtainEvent(RegisterEvent.OnRegisterClick) },
modifier = Modifier
.fillMaxWidth()
Expand All @@ -162,13 +164,13 @@ fun RegisterBottomSheet(
.padding(horizontal = DesignTheme.Spacing.xl)
) {
Text(
text = "Already have an account?",
text = stringResource(R.string.auth_already_have_account),
style = DesignTheme.Typography.caption,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
Spacer(modifier = Modifier.width(DesignTheme.Spacing.xs))
Text(
text = "Login",
text = stringResource(R.string.auth_login),
modifier = Modifier.clickable { onDismiss() },
style = DesignTheme.Typography.captionSemibold,
color = MaterialTheme.colorScheme.primary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ package friends.mobile.auth

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import friends.mobile.designsystem.components.ErrorBanner
import friends.mobile.designsystem.theme.DesignTheme
import friends.mobile.feature.auth.presentation.RootEvent
import friends.mobile.feature.auth.presentation.RootViewModel
import friends.mobile.feature.auth.presentation.RootViewState
Expand All @@ -27,6 +31,18 @@ fun RootScreen(
}
}
is RootViewState.Error -> {
Box(
modifier = Modifier
.fillMaxSize()
.padding(DesignTheme.Spacing.lg),
contentAlignment = Alignment.Center,
) {
ErrorBanner(
message = currentState.message,
modifier = Modifier.fillMaxWidth(),
onRetry = { viewModel.obtainEvent(RootEvent.OnRetry) }
)
}
}
is RootViewState.Content -> {
val session = currentState.session
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.compose.ui.res.stringResource
import friends.mobile.R
import friends.mobile.designsystem.components.ButtonFactory
import friends.mobile.designsystem.components.ErrorBanner
import friends.mobile.designsystem.theme.DesignTheme
Expand Down Expand Up @@ -99,7 +101,15 @@ private fun WeekdayLabels() {
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(4.dp)
) {
val weekdays = listOf("S", "M", "T", "W", "T", "F", "S")
val weekdays = listOf(
stringResource(R.string.calendar_weekday_sun),
stringResource(R.string.calendar_weekday_mon),
stringResource(R.string.calendar_weekday_tue),
stringResource(R.string.calendar_weekday_wed),
stringResource(R.string.calendar_weekday_thu),
stringResource(R.string.calendar_weekday_fri),
stringResource(R.string.calendar_weekday_sat),
)
weekdays.forEach { day ->
Text(
text = day,
Expand Down Expand Up @@ -181,7 +191,7 @@ private fun EmptyContent() {
tint = MaterialTheme.colorScheme.onSurfaceVariant
)
Text(
text = "No busy days recorded",
text = stringResource(R.string.calendar_no_busy_days),
style = DesignTheme.Typography.body,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
Expand All @@ -190,12 +200,9 @@ private fun EmptyContent() {

@Composable
private fun ErrorContent(message: String, onRetry: () -> Unit) {
Column(
ErrorBanner(
message = message,
modifier = Modifier.fillMaxWidth().padding(vertical = DesignTheme.Spacing.lg),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(DesignTheme.Spacing.md)
) {
ErrorBanner(message = message, modifier = Modifier.fillMaxWidth())
ButtonFactory.Primary(text = "Retry", onClick = onRetry, modifier = Modifier.fillMaxWidth())
}
onRetry = onRetry
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.material3.MaterialTheme
import androidx.compose.ui.res.stringResource
import friends.mobile.R
import friends.mobile.designsystem.theme.DesignTheme

object ButtonFactory {
Expand Down Expand Up @@ -62,7 +64,7 @@ object ButtonFactory {
color = Color.White,
strokeWidth = 2.dp
)
Text("Loading...", style = DesignTheme.Typography.button)
Text(stringResource(R.string.loading), style = DesignTheme.Typography.button)
}
} else {
Row(
Expand Down Expand Up @@ -205,7 +207,7 @@ object ButtonFactory {
color = Color.White,
strokeWidth = 2.dp
)
Text("Removing...", style = DesignTheme.Typography.button)
Text(stringResource(R.string.loading_removing), style = DesignTheme.Typography.button)
}
} else {
Text(text, style = DesignTheme.Typography.button)
Expand Down
Loading
Loading