mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-01 11:46:57 +01:00
Cleanup and add changelog
This commit is contained in:
parent
9b02704d5b
commit
3287980109
1
changelog.d/4057.feature
Normal file
1
changelog.d/4057.feature
Normal file
@ -0,0 +1 @@
|
|||||||
|
Improve space invite bottom sheet
|
@ -61,38 +61,35 @@ class SpaceInviteBottomSheetViewModel @AssistedInject constructor(
|
|||||||
peopleYouKnow = Success(peopleYouKnow)
|
peopleYouKnow = Success(peopleYouKnow)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
refreshInviteSummaryIfNeeded(roomSummary)
|
if (roomSummary.membership == Membership.INVITE) {
|
||||||
|
getLatestRoomSummary(roomSummary)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun refreshInviteSummaryIfNeeded(roomSummary: RoomSummary) {
|
/**
|
||||||
if (roomSummary.membership == Membership.INVITE) {
|
* Try to request the room summary api to get more info
|
||||||
// we can try to query the room summary api to get more info?
|
*/
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
private fun getLatestRoomSummary(roomSummary: RoomSummary) {
|
||||||
when (val peekResult = tryOrNull { session.peekRoom(roomSummary.roomId) }) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
is PeekResult.Success -> {
|
val peekResult = tryOrNull { session.peekRoom(roomSummary.roomId) } as? PeekResult.Success ?: return@launch
|
||||||
setState {
|
setState {
|
||||||
copy(
|
copy(
|
||||||
summary = Success(
|
summary = Success(
|
||||||
roomSummary.copy(
|
roomSummary.copy(
|
||||||
joinedMembersCount = peekResult.numJoinedMembers,
|
joinedMembersCount = peekResult.numJoinedMembers,
|
||||||
// it's also possible that the name/avatar did change since the invite..
|
// it's also possible that the name/avatar did change since the invite..
|
||||||
// if it's null keep the old one as summary API might not be available
|
// if it's null keep the old one as summary API might not be available
|
||||||
// and peek result could be null for other reasons (not peekable)
|
// and peek result could be null for other reasons (not peekable)
|
||||||
avatarUrl = peekResult.avatarUrl ?: roomSummary.avatarUrl,
|
avatarUrl = peekResult.avatarUrl ?: roomSummary.avatarUrl,
|
||||||
displayName = peekResult.name ?: roomSummary.displayName,
|
displayName = peekResult.name ?: roomSummary.displayName,
|
||||||
topic = peekResult.topic ?: roomSummary.topic
|
topic = peekResult.topic ?: roomSummary.topic
|
||||||
// maybe use someMembers field later?
|
// maybe use someMembers field later?
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
// nop
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user