Skip to content

Commit

Permalink
feat(personal-to-team): remove password field from confirmation step …
Browse files Browse the repository at this point in the history
…(WPB-11268) (#3607)
  • Loading branch information
ohassine authored Nov 8, 2024
1 parent 121fb3e commit 63b0890
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ import androidx.compose.foundation.text.input.TextFieldState

data class TeamMigrationState(
val teamNameTextState: TextFieldState = TextFieldState(),
val passwordTextState: TextFieldState = TextFieldState(),
val shouldShowMigrationLeaveDialog: Boolean = false
)
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.text.input.TextFieldState
import androidx.compose.foundation.text.input.rememberTextFieldState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
Expand All @@ -37,8 +34,6 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.SpanStyle
Expand All @@ -52,15 +47,13 @@ import com.wire.android.navigation.style.SlideNavigationAnimation
import com.wire.android.ui.common.WireCheckbox
import com.wire.android.ui.common.colorsScheme
import com.wire.android.ui.common.dimensions
import com.wire.android.ui.common.textfield.DefaultPassword
import com.wire.android.ui.common.textfield.WirePasswordTextField
import com.wire.android.ui.destinations.TeamMigrationDoneStepScreenDestination
import com.wire.android.ui.theme.WireTheme
import com.wire.android.ui.theme.wireTypography
import com.wire.android.ui.userprofile.teammigration.common.BottomLineButtons
import com.wire.android.ui.userprofile.teammigration.common.BulletList
import com.wire.android.ui.userprofile.teammigration.PersonalToTeamMigrationNavGraph
import com.wire.android.ui.userprofile.teammigration.TeamMigrationViewModel
import com.wire.android.ui.userprofile.teammigration.common.BottomLineButtons
import com.wire.android.ui.userprofile.teammigration.common.BulletList
import com.wire.android.util.CustomTabsHelper
import com.wire.android.util.ui.PreviewMultipleThemes

Expand All @@ -81,8 +74,7 @@ fun TeamMigrationConfirmationStepScreen(
},
onBackPressed = {
navigator.popBackStack()
},
passwordTextState = teamMigrationViewModel.teamMigrationState.passwordTextState
}
)
LaunchedEffect(Unit) {
teamMigrationViewModel.sendPersonalTeamCreationFlowStartedEvent(3)
Expand All @@ -91,7 +83,6 @@ fun TeamMigrationConfirmationStepScreen(

@Composable
private fun TeamMigrationConfirmationStepScreenContent(
passwordTextState: TextFieldState,
modifier: Modifier = Modifier,
onContinueButtonClicked: () -> Unit = { },
onBackPressed: () -> Unit = { }
Expand Down Expand Up @@ -144,16 +135,9 @@ private fun TeamMigrationConfirmationStepScreenContent(
)
BulletList(messages)

PasswordInput(
modifier = Modifier
.fillMaxWidth()
.padding(
top = dimensions().spacing56x,
bottom = dimensions().spacing56x
),
passwordState = passwordTextState,
)
Row {
Row(
modifier = Modifier.padding(top = dimensions().spacing48x)
) {
WireCheckbox(
checked = agreedToMigrationTerms.value,
onCheckedChange = { agreedToMigrationTerms.value = it }
Expand All @@ -173,8 +157,7 @@ private fun TeamMigrationConfirmationStepScreenContent(
WireTermsOfUseWithLink()
}
}
val isContinueButtonEnabled =
passwordTextState.text.isNotEmpty() && agreedToMigrationTerms.value && acceptedWireTermsOfUse.value
val isContinueButtonEnabled = agreedToMigrationTerms.value && acceptedWireTermsOfUse.value
BottomLineButtons(
isContinueButtonEnabled = isContinueButtonEnabled,
onContinue = onContinueButtonClicked,
Expand Down Expand Up @@ -211,33 +194,10 @@ private fun RowScope.WireTermsOfUseWithLink() {
)
}

@Composable
private fun PasswordInput(
passwordState: TextFieldState,
modifier: Modifier = Modifier
) {
val keyboardController = LocalSoftwareKeyboardController.current

WirePasswordTextField(
textState = passwordState,
labelText = stringResource(R.string.personal_to_team_migration_confirmation_step_password_field_label),
keyboardOptions = KeyboardOptions.DefaultPassword,
placeholderText = stringResource(R.string.personal_to_team_migration_confirmation_step_password_field_placeholder),
onKeyboardAction = {
keyboardController?.hide()
},
modifier = modifier
.testTag("passwordFieldTeamMigration"),
testTag = "passwordFieldTeamMigration"
)
}

@PreviewMultipleThemes
@Composable
private fun TeamMigrationConfirmationStepPreview() {
WireTheme {
TeamMigrationConfirmationStepScreenContent(
passwordTextState = rememberTextFieldState()
)
TeamMigrationConfirmationStepScreenContent()
}
}
2 changes: 0 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1604,8 +1604,6 @@ In group conversations, the group admin can overwrite this setting.</string>
<string name="personal_to_team_migration_confirmation_step_terms">I agree to the migration terms and understand that this change is irreversible.</string>
<string name="personal_to_team_migration_confirmation_step_wire_terms_of_use_accept_label">I accept</string>
<string name="personal_to_team_migration_confirmation_step_wire_terms_of_use_label">Wire\’s Terms of Use.</string>
<string name="personal_to_team_migration_confirmation_step_password_field_label">Password of your personal account</string>
<string name="personal_to_team_migration_confirmation_step_password_field_placeholder">Enter password</string>

<string name="personal_to_team_migration_done_step">Congratulations %1$s!</string>
<string name="personal_to_team_migration_done_step_now_team_member_label">You\’re now the owner of the team %1$s.</string>
Expand Down

0 comments on commit 63b0890

Please sign in to comment.