Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Mail validation screen #254

Draft
wants to merge 43 commits into
base: main
Choose a base branch
from
Draft

feat: Mail validation screen #254

wants to merge 43 commits into from

Conversation

LunarX
Copy link
Contributor

@LunarX LunarX commented Dec 16, 2024

Adds the screen to validate the email.

Is still missing:

  • Save token for this email address in DB for future uses (we're waiting on KMP version to be updated)
  • resendEmailCode because (we're waiting on KMP version to be update)
  • Unknown errors snackbar

Depends on: Infomaniak/multiplatform-SwissTransfer#133

@LunarX LunarX added the enhancement New feature or request label Dec 16, 2024
@LunarX LunarX requested a review from a team December 16, 2024 08:38
@LunarX LunarX self-assigned this Dec 16, 2024
@LunarX LunarX force-pushed the mail-validation-ui branch from 4fe805d to 2f92daf Compare December 16, 2024 10:39
@LunarX LunarX force-pushed the mail-validation-ui branch from 022ae9c to c6954b0 Compare December 16, 2024 14:14
@LunarX LunarX marked this pull request as ready for review December 16, 2024 14:41
@LunarX LunarX marked this pull request as draft December 16, 2024 14:48
@LunarX LunarX force-pushed the mail-validation-ui branch from 34d7fe5 to e731a5a Compare December 17, 2024 08:18
@LunarX LunarX marked this pull request as ready for review December 17, 2024 08:18
@LunarX LunarX force-pushed the mail-validation-ui branch from eda972c to 0a5806a Compare December 17, 2024 14:23
@LunarX LunarX requested a review from tevincent December 17, 2024 14:24
# Conflicts:
#	app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/ImportFilesViewModel.kt
#	app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt
horizontalAlignment = layoutStyle.horizontalAlignment,
) {
Text(
text = stringResource(id = R.string.validateMailTitle),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to specify id here ?

Copy link
Contributor

@tevincent tevincent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capture d’écran 2024-12-18 à 08 24 09

Is it me or the padding between the two buttons and the bottom button with the bottom of the screen is not the same ? Is that intended ?

_uiState.value = ValidateEmailUiState.Loading

runCatching {
uploadRepository.verifyEmailCode(VerifyEmailCodeBody(otpCode, email))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're using the uploadManager here, maybe we can add a method in uploadManager to call the verifyEmailCode ? uploadManager is used as a common access point for the repository and the controller of uploads so it might be cleaner ?

And if we're a doing that on KMP, we can directly save the token in DB, instead of doing that line 57. Let me know if it'll cause any issue with iOS, as we discussed yesterday as it might interfere with what they did on the native iOS side of things.

Also, we're using the manager to do uploadManager.resendEmailCode(email) so it might be good to do the same thing for everything else.

errorColor: Color = MaterialTheme.colorScheme.error,
activeBorderThickness: Dp = 2.dp,
inactiveBorderThickness: Dp = 1.dp,
shape: RoundedCornerShape = RoundedCornerShape(8.dp),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
shape: RoundedCornerShape = RoundedCornerShape(8.dp),
shape: RoundedCornerShape = CustomShapes.SMALL,

import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewLightAndDark

private val VALID_CHARACTERS = setOf('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a CharRange ?

private val VALID_CHARACTERS = '0' .. '9'

I tried and it seems to work. Instead of specifying all characters from 0 to 9.

# Conflicts:
#	app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/ImportFilesViewModel.kt
@LunarX LunarX marked this pull request as draft December 18, 2024 09:11
# Conflicts:
#	app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/ImportFilesViewModel.kt
@LunarX LunarX force-pushed the mail-validation-ui branch from 8cde32f to 3084096 Compare December 18, 2024 15:21
# Conflicts:
#	app/src/main/java/com/infomaniak/swisstransfer/ui/navigation/NavigationDestination.kt
#	app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/ImportFilesViewModel.kt
#	app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/TransferSendManager.kt
#	app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt
@LunarX LunarX force-pushed the mail-validation-ui branch from 40e505e to 6ecf5a5 Compare December 20, 2024 16:06
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants