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: show Guest label for personal users after migration in conversations screen - cherrypick (WPB-14871) 🍒 #3783

Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import com.wire.kalium.logic.feature.user.migration.MigrateFromPersonalToTeamFai
data class TeamMigrationState(
val teamNameTextState: TextFieldState = TextFieldState(),
val shouldShowMigrationLeaveDialog: Boolean = false,
val isMigrating: Boolean = false,
val currentStep: Int = 0,
val username: String = "",
val teamUrl: String = "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ class TeamMigrationViewModel @Inject constructor(
)
}

fun setIsMigratingState(isMigrating: Boolean) {
teamMigrationState = teamMigrationState.copy(isMigrating = isMigrating)
}

fun migrateFromPersonalToTeamAccount(onSuccess: () -> Unit) {
viewModelScope.launch {
migrateFromPersonalToTeam.invoke(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import com.wire.android.ui.theme.WireTheme
fun BottomLineButtons(
isContinueButtonEnabled: Boolean,
modifier: Modifier = Modifier,
isMigrating: Boolean = false,
isBackButtonVisible: Boolean = true,
backButtonContentDescription: String = stringResource(R.string.personal_to_team_migration_back_button_label),
onBack: () -> Unit = { },
Expand All @@ -67,7 +68,12 @@ fun BottomLineButtons(
.fillMaxWidth()
.semantics(true) { contentDescription = backButtonContentDescription },
text = stringResource(R.string.personal_to_team_migration_back_button_label),
onClick = onBack
onClick = onBack,
state = if (isMigrating) {
WireButtonState.Disabled
} else {
WireButtonState.Default
}
)
}

Expand All @@ -77,7 +83,8 @@ fun BottomLineButtons(
.padding(top = dimensions().spacing6x),
text = stringResource(R.string.label_continue),
onClick = onContinue,
state = if (isContinueButtonEnabled) {
loading = isMigrating,
state = if (isContinueButtonEnabled && !isMigrating) {
WireButtonState.Default
} else {
WireButtonState.Disabled
Expand All @@ -91,6 +98,7 @@ fun BottomLineButtons(
private fun BottomLineButtonsPreview() {
WireTheme {
BottomLineButtons(
isMigrating = false,
isContinueButtonEnabled = true
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,14 @@ fun TeamMigrationConfirmationStepScreen(
val state = teamMigrationViewModel.teamMigrationState

TeamMigrationConfirmationStepScreenContent(
isMigrating = state.isMigrating,
onContinueButtonClicked = {
teamMigrationViewModel.setIsMigratingState(true)
teamMigrationViewModel.migrateFromPersonalToTeamAccount(
onSuccess = {
teamMigrationViewModel.setIsMigratingState(false)
navigator.navigate(TeamMigrationDoneStepScreenDestination)
},
}
)
},
onBackPressed = {
Expand Down Expand Up @@ -179,6 +182,7 @@ private fun ErrorDialog(
@Composable
private fun TeamMigrationConfirmationStepScreenContent(
modifier: Modifier = Modifier,
isMigrating: Boolean = false,
onContinueButtonClicked: () -> Unit = { },
onBackPressed: () -> Unit = { }
) {
Expand Down Expand Up @@ -254,6 +258,7 @@ private fun TeamMigrationConfirmationStepScreenContent(
}
val isContinueButtonEnabled = agreedToMigrationTerms.value && acceptedWireTermsOfUse.value
BottomLineButtons(
isMigrating = isMigrating,
isContinueButtonEnabled = isContinueButtonEnabled,
onContinue = onContinueButtonClicked,
backButtonContentDescription = stringResource(R.string.personal_to_team_migration_back_button_confirmation_content_description),
Expand Down
Loading