Skip to content
Closed
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
9 changes: 8 additions & 1 deletion app/src/main/java/com/pinakes/app/data/model/Models.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,14 @@ data class RegisterRequest(
val nome: String,
val cognome: String,
val email: String,
val password: String, // min 8
// Backend (AuthController) requires these too and 422s without them:
// privacy must be accepted, phone + address are mandatory, and the password
// must be confirmed (8-72 chars, upper+lower+digit).
val telefono: String,
val indirizzo: String,
val password: String,
@SerialName("password_confirm") val passwordConfirm: String,
@SerialName("privacy_acceptance") val privacyAcceptance: Boolean,
)

@Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,26 @@ class AuthRepository(
}
}

suspend fun register(nome: String, cognome: String, email: String, password: String): ApiResult<Unit> {
suspend fun register(
nome: String,
cognome: String,
email: String,
telefono: String,
indirizzo: String,
password: String,
passwordConfirm: String,
privacyAcceptance: Boolean,
): ApiResult<Unit> {
val api = network.api()
return apiCall { api.register(RegisterRequest(nome.trim(), cognome.trim(), email.trim(), password)) }
return apiCall {
api.register(
RegisterRequest(
nome.trim(), cognome.trim(), email.trim(),
telefono.trim(), indirizzo.trim(),
password, passwordConfirm, privacyAcceptance,
)
)
}
}

suspend fun forgotPassword(email: String): ApiResult<Unit> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ private fun ProfileContent(
onOpenNotifications: () -> Unit,
onOpenContact: () -> Unit,
) {
// Instance feature flags — gate the messaging/notifications actions so the
// app reflects what the library actually exposes via the Mobile API.
val features by LocalServices.current.features.features.collectAsStateWithLifecycle()
Column(
Modifier
.fillMaxSize()
Expand Down Expand Up @@ -192,8 +195,12 @@ private fun ProfileContent(
// Actions
ActionRow(Icons.Outlined.Edit, stringResource(R.string.profile_action_edit), onClick = onEdit)
ActionRow(Icons.Outlined.Lock, stringResource(R.string.profile_action_change_password), onClick = onChangePassword)
ActionRow(Icons.Outlined.Notifications, stringResource(R.string.profile_action_notifications), onClick = onOpenNotifications)
ActionRow(Icons.Outlined.ChatBubbleOutline, stringResource(R.string.profile_action_message_library), onClick = onOpenContact)
if (features.notifications) {
ActionRow(Icons.Outlined.Notifications, stringResource(R.string.profile_action_notifications), onClick = onOpenNotifications)
}
if (features.messages) {
ActionRow(Icons.Outlined.ChatBubbleOutline, stringResource(R.string.profile_action_message_library), onClick = onOpenContact)
}

Spacer(Modifier.height(Spacing.xl))

Expand Down