mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 21:48:50 +03:00
forwarding to the profile picture flow when display name changing isn't supported but pictures are when personalising the profile
This commit is contained in:
parent
b5778bd6c5
commit
4b9b177104
2 changed files with 27 additions and 1 deletions
|
@ -933,7 +933,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
||||||
withPersonalisationState {
|
withPersonalisationState {
|
||||||
when {
|
when {
|
||||||
it.supportsChangingDisplayName -> _viewEvents.post(OnboardingViewEvents.OnChooseDisplayName)
|
it.supportsChangingDisplayName -> _viewEvents.post(OnboardingViewEvents.OnChooseDisplayName)
|
||||||
it.supportsChangingProfilePicture -> _viewEvents.post(OnboardingViewEvents.OnChooseDisplayName)
|
it.supportsChangingProfilePicture -> _viewEvents.post(OnboardingViewEvents.OnChooseProfilePicture)
|
||||||
else -> {
|
else -> {
|
||||||
throw IllegalStateException("It should not be possible to personalize without supporting display name or avatar changing")
|
throw IllegalStateException("It should not be possible to personalize without supporting display name or avatar changing")
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,32 @@ class OnboardingViewModelTest {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `given supports changing display name when handling PersonalizeProfile then emits contents choose display name`() = runBlockingTest {
|
||||||
|
val initialState = initialState.copy(personalizationState = PersonalizationState(supportsChangingDisplayName = true, supportsChangingProfilePicture = false))
|
||||||
|
viewModel = createViewModel(initialState)
|
||||||
|
val test = viewModel.test(this)
|
||||||
|
|
||||||
|
viewModel.handle(OnboardingAction.PersonalizeProfile)
|
||||||
|
|
||||||
|
test
|
||||||
|
.assertEvents(OnboardingViewEvents.OnChooseDisplayName)
|
||||||
|
.finish()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `given only supports changing profile picture when handling PersonalizeProfile then emits contents choose profile picture`() = runBlockingTest {
|
||||||
|
val initialState = initialState.copy(personalizationState = PersonalizationState(supportsChangingDisplayName = false, supportsChangingProfilePicture = true))
|
||||||
|
viewModel = createViewModel(initialState)
|
||||||
|
val test = viewModel.test(this)
|
||||||
|
|
||||||
|
viewModel.handle(OnboardingAction.PersonalizeProfile)
|
||||||
|
|
||||||
|
test
|
||||||
|
.assertEvents(OnboardingViewEvents.OnChooseProfilePicture)
|
||||||
|
.finish()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `given homeserver does not support personalisation when registering account then updates state and emits account created event`() = runBlockingTest {
|
fun `given homeserver does not support personalisation when registering account then updates state and emits account created event`() = runBlockingTest {
|
||||||
fakeSession.fakeHomeServerCapabilitiesService.givenCapabilities(HomeServerCapabilities(canChangeDisplayName = false, canChangeAvatar = false))
|
fakeSession.fakeHomeServerCapabilitiesService.givenCapabilities(HomeServerCapabilities(canChangeDisplayName = false, canChangeAvatar = false))
|
||||||
|
|
Loading…
Reference in a new issue