diff --git a/app/src/main/kotlin/nl/eduid/screens/accountlinked/AccountLinkedScreen.kt b/app/src/main/kotlin/nl/eduid/screens/accountlinked/AccountLinkedScreen.kt index e25aa1a2..8e01d253 100644 --- a/app/src/main/kotlin/nl/eduid/screens/accountlinked/AccountLinkedScreen.kt +++ b/app/src/main/kotlin/nl/eduid/screens/accountlinked/AccountLinkedScreen.kt @@ -23,6 +23,7 @@ import nl.eduid.screens.personalinfo.PersonalInfo import nl.eduid.screens.personalinfo.PersonalInfoViewModel import nl.eduid.ui.AlertDialogWithSingleButton import nl.eduid.ui.EduIdTopAppBar +import nl.eduid.ui.InfoField import nl.eduid.ui.InfoTab import nl.eduid.ui.PrimaryButton import nl.eduid.ui.theme.EduidAppAndroidTheme @@ -97,22 +98,17 @@ private fun AccountLinkedContent( } else { Spacer(Modifier.height(12.dp)) } - InfoTab( - header = stringResource(R.string.infotab_fullname), + InfoField( title = personalInfo.name, subtitle = if (personalInfo.nameProvider == null) { - stringResource( - R.string.infotab_providedby_you - ) + stringResource(R.string.infotab_providedby_you) } else { - stringResource( - R.string.infotab_providedby, personalInfo.nameProvider - ) + stringResource(R.string.infotab_providedby, personalInfo.nameProvider) }, - onClick = { }, - endIcon = R.drawable.shield_tick_blue + endIcon = R.drawable.shield_tick_blue, + label = stringResource(R.string.infotab_fullname) ) - + Spacer(Modifier.height(16.dp)) personalInfo.institutionAccounts.forEachIndexed { index, account -> InfoTab( header = if (index < 1) stringResource(R.string.infotab_role_institution) else "", diff --git a/app/src/main/kotlin/nl/eduid/screens/editname/EditNameScreen.kt b/app/src/main/kotlin/nl/eduid/screens/editname/EditNameScreen.kt index f0aabf85..5c6bae68 100644 --- a/app/src/main/kotlin/nl/eduid/screens/editname/EditNameScreen.kt +++ b/app/src/main/kotlin/nl/eduid/screens/editname/EditNameScreen.kt @@ -31,6 +31,7 @@ import nl.eduid.screens.firsttimedialog.LinkAccountContract import nl.eduid.screens.personalinfo.PersonalInfo import nl.eduid.screens.personalinfo.PersonalInfoViewModel import nl.eduid.ui.EduIdTopAppBar +import nl.eduid.ui.InfoField import nl.eduid.ui.InfoTab import nl.eduid.ui.theme.ButtonGreen import nl.eduid.ui.theme.EduidAppAndroidTheme @@ -44,11 +45,10 @@ fun EditNameScreen( onBackClicked = goBack, ) { var isGettingLinkUrl by rememberSaveable { mutableStateOf(false) } - val launcher = - rememberLauncherForActivityResult(contract = LinkAccountContract(), onResult = { - /**We don't have to explicitly handle the result intent. The deep linking will - * automatically open the [AccountLinkedScreen()] and ensure the backstack is correct.*/ - }) + val launcher = rememberLauncherForActivityResult(contract = LinkAccountContract(), onResult = { + /**We don't have to explicitly handle the result intent. The deep linking will + * automatically open the [AccountLinkedScreen()] and ensure the backstack is correct.*/ + }) if (isGettingLinkUrl && viewModel.uiState.haveValidLinkIntent()) { LaunchedEffect(key1 = viewModel) { @@ -91,9 +91,7 @@ private fun EditNameContent( Text( style = MaterialTheme.typography.titleLarge.copy( color = ButtonGreen - ), - text = stringResource(R.string.edit_name_subtitle), - modifier = Modifier.fillMaxWidth() + ), text = stringResource(R.string.edit_name_subtitle), modifier = Modifier.fillMaxWidth() ) if (isLoading) { Spacer(modifier = Modifier.height(8.dp)) @@ -118,10 +116,9 @@ private fun EditNameContent( ), ) } - InfoTab( + InfoField( title = personalInfo.name, subtitle = stringResource(R.string.infotab_providedby_you), - onClick = { /**Not going anywhere from here*/ }, endIcon = R.drawable.edit_icon ) @@ -132,8 +129,7 @@ private fun EditNameContent( if (personalInfo.nameProvider != null) { Row(verticalAlignment = Alignment.CenterVertically) { Image( - painter = painterResource(R.drawable.ic_verified_badge), - contentDescription = null + painter = painterResource(R.drawable.ic_verified_badge), contentDescription = null ) Spacer( modifier = Modifier.width(8.dp) @@ -177,8 +173,7 @@ private fun EditNameContent( private fun Preview_LinkAccountCard() { EduidAppAndroidTheme { EditNameContent( - isLoading = false, - personalInfo = PersonalInfo.demoData() + isLoading = false, personalInfo = PersonalInfo.demoData() ) } } \ No newline at end of file diff --git a/app/src/main/kotlin/nl/eduid/screens/personalinfo/PersonalInfoScreen.kt b/app/src/main/kotlin/nl/eduid/screens/personalinfo/PersonalInfoScreen.kt index e10016cc..5f5ddbca 100644 --- a/app/src/main/kotlin/nl/eduid/screens/personalinfo/PersonalInfoScreen.kt +++ b/app/src/main/kotlin/nl/eduid/screens/personalinfo/PersonalInfoScreen.kt @@ -38,6 +38,7 @@ import nl.eduid.R import nl.eduid.screens.firsttimedialog.LinkAccountContract import nl.eduid.ui.AlertDialogWithSingleButton import nl.eduid.ui.EduIdTopAppBar +import nl.eduid.ui.InfoField import nl.eduid.ui.InfoTab import nl.eduid.ui.getDateTimeString import nl.eduid.ui.theme.ButtonGreen @@ -138,33 +139,30 @@ fun PersonalInfoScreenContent( Spacer(modifier = Modifier.height(16.dp)) } Spacer(Modifier.height(12.dp)) - InfoTab( - header = stringResource(R.string.infotab_name), + InfoField( title = personalInfo.name, subtitle = if (personalInfo.nameProvider == null) { - stringResource( - R.string.infotab_providedby_you - ) + stringResource(R.string.infotab_providedby_you) } else { - stringResource( - R.string.infotab_providedby, personalInfo.nameProvider - ) + stringResource(R.string.infotab_providedby, personalInfo.nameProvider) }, onClick = onNameClicked, endIcon = if (personalInfo.nameProvider == null) { R.drawable.edit_icon } else { R.drawable.shield_tick_blue - } + }, + label = stringResource(R.string.infotab_name) ) - InfoTab( - header = stringResource(R.string.infotab_email), + Spacer(Modifier.height(16.dp)) + InfoField( title = personalInfo.email, subtitle = stringResource(R.string.infotab_providedby_you), onClick = onEmailClicked, - endIcon = R.drawable.edit_icon + endIcon = R.drawable.edit_icon, + label = stringResource(R.string.infotab_email), ) - + Spacer(Modifier.height(16.dp)) personalInfo.institutionAccounts.forEachIndexed { index, account -> InfoTab( header = if (index < 1) stringResource(R.string.infotab_role_institution) else "", diff --git a/app/src/main/kotlin/nl/eduid/screens/security/SecurityScreen.kt b/app/src/main/kotlin/nl/eduid/screens/security/SecurityScreen.kt index 5ba60077..3b710b7c 100644 --- a/app/src/main/kotlin/nl/eduid/screens/security/SecurityScreen.kt +++ b/app/src/main/kotlin/nl/eduid/screens/security/SecurityScreen.kt @@ -1,8 +1,16 @@ package nl.eduid.screens.security -import androidx.compose.foundation.* -import androidx.compose.foundation.layout.* -import androidx.compose.material3.* +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.CircularProgressIndicator +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.livedata.observeAsState @@ -14,7 +22,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import nl.eduid.R import nl.eduid.ui.EduIdTopAppBar -import nl.eduid.ui.InfoTab +import nl.eduid.ui.InfoField import nl.eduid.ui.theme.ButtonGreen import nl.eduid.ui.theme.EduidAppAndroidTheme @@ -76,29 +84,36 @@ fun SecurityScreenContent( .align(alignment = Alignment.CenterHorizontally) ) } else { - InfoTab( - header = stringResource(R.string.security_sign_in_methods), + InfoField( title = stringResource(R.string.security_2fa_key), subtitle = stringResource(R.string.security_provided_by_eduid), onClick = on2FaClicked, - endIcon = R.drawable.shield_tick_blue + endIcon = R.drawable.shield_tick_blue, + label = stringResource(R.string.security_sign_in_methods) ) - InfoTab( + Spacer(Modifier.height(16.dp)) + InfoField( title = stringResource(R.string.security_send_a_magic_link_to), subtitle = securityInfo.email, onClick = onEditEmailClicked, endIcon = R.drawable.edit_icon ) - InfoTab( + Spacer(Modifier.height(16.dp)) + InfoField( title = if (securityInfo.hasPassword) { stringResource(R.string.security_change_password) } else { stringResource(R.string.security_add_a_password) }, - subtitle = "", + subtitle = if (securityInfo.hasPassword) { + "****" + } else { + "" + }, onClick = onConfigurePasswordClicked, endIcon = R.drawable.edit_icon ) + Spacer(Modifier.height(16.dp)) } } diff --git a/app/src/main/kotlin/nl/eduid/screens/twofactorkey/TwoFactorKeyViewModel.kt b/app/src/main/kotlin/nl/eduid/screens/twofactorkey/TwoFactorKeyViewModel.kt index b1c50d7a..9c5af4fc 100644 --- a/app/src/main/kotlin/nl/eduid/screens/twofactorkey/TwoFactorKeyViewModel.kt +++ b/app/src/main/kotlin/nl/eduid/screens/twofactorkey/TwoFactorKeyViewModel.kt @@ -6,6 +6,8 @@ import androidx.lifecycle.map import androidx.lifecycle.viewModelScope import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.onStart +import kotlinx.coroutines.launch +import org.tiqr.data.model.Identity import org.tiqr.data.model.IdentityWithProvider import org.tiqr.data.repository.IdentityRepository import javax.inject.Inject @@ -31,4 +33,8 @@ class TwoFactorKeyViewModel @Inject constructor( biometricFlag = twoFaDetails.identity.biometricInUse, ) } + + fun upgradeBiometric(identity: Identity, use: Boolean) = viewModelScope.launch { + + } } \ No newline at end of file diff --git a/app/src/main/kotlin/nl/eduid/ui/InfoTab.kt b/app/src/main/kotlin/nl/eduid/ui/InfoTab.kt index f359dab3..4f9a9ec0 100644 --- a/app/src/main/kotlin/nl/eduid/ui/InfoTab.kt +++ b/app/src/main/kotlin/nl/eduid/ui/InfoTab.kt @@ -61,39 +61,58 @@ fun InfoField( title: String, subtitle: String, onClick: () -> Unit = {}, - @DrawableRes endIcon: Int = 0, -) = Row(modifier = Modifier - .clip(RoundedCornerShape(6.dp)) - .border( - width = 3.dp, color = BlueButton - ) - .sizeIn(minHeight = 72.dp) - .padding(start = 18.dp, end = 18.dp, top = 12.dp, bottom = 12.dp) - .fillMaxWidth() - .clickable { - onClick() - }) { - Column { + label: String = "", + @DrawableRes endIcon: Int = R.drawable.edit_icon, +) = Column(modifier = Modifier.fillMaxWidth()) { + if (label.isNotBlank()) { Text( - text = title.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() }, + text = label, style = MaterialTheme.typography.bodyLarge.copy( - textAlign = TextAlign.Start, fontWeight = FontWeight.Bold, lineHeight = 20.sp - ), - ) - Spacer(Modifier.height(4.dp)) - Text( - text = subtitle, - style = MaterialTheme.typography.bodySmall.copy( textAlign = TextAlign.Start, - color = TextGrayScale, + fontWeight = FontWeight.SemiBold, ), ) + Spacer(Modifier.height(6.dp)) + } + Row(verticalAlignment = Alignment.CenterVertically, + modifier = Modifier + .clip(RoundedCornerShape(6.dp)) + .border( + width = 3.dp, color = BlueButton + ) + .sizeIn(minHeight = 72.dp) + .padding(start = 18.dp, end = 18.dp, top = 12.dp, bottom = 12.dp) + .fillMaxWidth() + .clickable { + onClick() + }) { + Column( + modifier = Modifier + .fillMaxWidth() + .weight(1f) + ) { + Text( + text = title.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() }, + style = MaterialTheme.typography.bodyLarge.copy( + textAlign = TextAlign.Start, fontWeight = FontWeight.Bold, lineHeight = 20.sp + ), + ) + Spacer(Modifier.height(4.dp)) + Text( + text = subtitle, + style = MaterialTheme.typography.bodySmall.copy( + textAlign = TextAlign.Start, + color = TextGrayScale, + ), + ) + } + Image( + painter = painterResource(endIcon), + contentDescription = "", + modifier = Modifier.padding(start = 12.dp), + alignment = Alignment.Center + ) } - Image( - painter = painterResource(endIcon), - contentDescription = "", - modifier = Modifier.padding(start = 12.dp) - ) } @Composable @@ -523,35 +542,10 @@ private fun twoFaBlock( } } - -@Preview -@Composable -private fun PreviewInfoTab() { - EduidAppAndroidTheme { - InfoTab( - header = "Header", - title = "OK a very long long long long long long long long long long", - subtitle = "OK long long long long long long long long long long long long", - onClick = { }, - endIcon = R.drawable.shield_tick_blue, - institutionInfo = PersonalInfo.InstitutionAccount( - role = "Long string here", - roleProvider = "Long string here", - institution = "Long string here", - affiliationString = "Long string here", - createdStamp = 1231321321321, - expiryStamp = 12313213131313, - id = "123", - ), - startIconLargeUrl = "https://static.surfconext.nl/media/sp/eduid.png" - ) - } -} - @Preview @Composable private fun PreviewInfoField() = EduidAppAndroidTheme { InfoField( - title = "Vetinari", subtitle = "Lord" + title = "Vetinari", subtitle = "Lord", label = "Full Name" ) }