Skip to content

Commit

Permalink
removed skip check invitiation code for testing (#46)
Browse files Browse the repository at this point in the history
# Removed skipping of the invitation code check

## ♻️ Current situation & Problem
#34 

## ⚙️ Release Notes 

- removed skipping of the invitation code check 

## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).

---------

Signed-off-by: Basler182 <[email protected]>
Co-authored-by: Paul Schmiedmayer <[email protected]>
  • Loading branch information
Basler182 and PSchmiedmayer authored Jun 21, 2024
1 parent 9965c5a commit 1f3a66f
Showing 1 changed file with 20 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,37 @@ class InvitationCodeViewModel @Inject internal constructor(
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()
}
}
}
Expand Down

0 comments on commit 1f3a66f

Please sign in to comment.