Cleanup and avoid duplicate
This commit is contained in:
parent
893ebd9690
commit
ed4676bb6c
|
@ -111,7 +111,7 @@ internal class DefaultStateService @AssistedInject constructor(@Assisted private
|
|||
eventType = EventType.STATE_ROOM_CANONICAL_ALIAS,
|
||||
body = RoomCanonicalAliasContent(
|
||||
canonicalAlias = alias,
|
||||
alternativeAliases = altAliases
|
||||
alternativeAliases = altAliases.distinct()
|
||||
).toContent(),
|
||||
callback = callback,
|
||||
stateKey = null
|
||||
|
|
|
@ -155,8 +155,7 @@ class RoomAliasViewModel @AssistedInject constructor(@Assisted initialState: Roo
|
|||
private fun handleSetNewAlias(action: RoomAliasAction.SetNewAlias) {
|
||||
setState {
|
||||
copy(
|
||||
newAlias = action.aliasLocalPart,
|
||||
asyncNewAliasRequest = Uninitialized
|
||||
newAlias = action.aliasLocalPart
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -195,7 +194,12 @@ class RoomAliasViewModel @AssistedInject constructor(@Assisted initialState: Roo
|
|||
postLoading(true)
|
||||
room.updateCanonicalAlias(canonicalAlias, alternativeAliases, object : MatrixCallback<Unit> {
|
||||
override fun onSuccess(data: Unit) {
|
||||
postLoading(false)
|
||||
setState {
|
||||
copy(
|
||||
isLoading = false,
|
||||
newAlias = ""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(failure: Throwable) {
|
||||
|
@ -228,6 +232,7 @@ class RoomAliasViewModel @AssistedInject constructor(@Assisted initialState: Roo
|
|||
setState {
|
||||
copy(
|
||||
isLoading = false,
|
||||
newLocalAlias = "",
|
||||
asyncNewLocalAliasRequest = Uninitialized
|
||||
)
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ data class RoomAliasViewState(
|
|||
val canonicalAlias: String? = null,
|
||||
val alternativeAliases: List<String> = emptyList(),
|
||||
val newAlias: String = "",
|
||||
val asyncNewAliasRequest: Async<Unit> = Uninitialized,
|
||||
val localAliases: Async<List<String>> = Uninitialized,
|
||||
val newLocalAlias: String = "",
|
||||
val asyncNewLocalAliasRequest: Async<Unit> = Uninitialized
|
||||
|
|
Loading…
Reference in New Issue