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

removed skip check invitiation code for testing #46

Merged
merged 4 commits into from
Jun 21, 2024
Merged
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
Basler182 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,37 @@
private val invitationAuthManager: InvitationAuthManager,
invitationCodeRepository: InvitationCodeRepository,
) : ViewModel() {

private val _uiState =
MutableStateFlow(InvitationCodeUiState(invitationCode = "", error = null))
val uiState = _uiState.asStateFlow()

private val screenData = invitationCodeRepository.getScreenData()

init {
_uiState.update {
it.copy(
private val _uiState =
MutableStateFlow(
InvitationCodeUiState(
title = screenData.title,
description = screenData.description
description = screenData.description,
error = null,
)
}
}
)
val uiState = _uiState.asStateFlow()

fun onAction(action: Action) {
_uiState.update {
when (action) {
is Action.UpdateInvitationCode -> {
val newValue = action.invitationCode
it.copy(invitationCode = newValue)
when (action) {
is Action.UpdateInvitationCode -> {
_uiState.update {
it.copy(invitationCode = action.invitationCode)
}
}

is Action.ClearError -> {
is Action.ClearError -> {
_uiState.update {
it.copy(error = null)
}
}

Action.AlreadyHasAccountPressed -> {
screenData.gotAnAccountAction()
it
}
Action.AlreadyHasAccountPressed -> {
screenData.gotAnAccountAction()
}

Action.RedeemInvitationCode -> {
screenData.redeemAction()
redeemInvitationCode()
it
}
Action.RedeemInvitationCode -> {
redeemInvitationCode()

Check warning on line 47 in modules/onboarding/src/main/kotlin/edu/stanford/spezi/module/onboarding/invitation/InvitationCodeViewModel.kt

View check run for this annotation

Codecov / codecov/patch

modules/onboarding/src/main/kotlin/edu/stanford/spezi/module/onboarding/invitation/InvitationCodeViewModel.kt#L46-L47

Added lines #L46 - L47 were not covered by tests
}
}
}
Expand Down
Loading