mirror of
https://github.com/Steffo99/twom.git
synced 2024-11-21 15:44:26 +00:00
Add progress indicator to MemberListItem
This commit is contained in:
parent
b0e337f44b
commit
6d7880b615
1 changed files with 13 additions and 5 deletions
|
@ -6,6 +6,7 @@ import androidx.compose.foundation.combinedClickable
|
|||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.DropdownMenu
|
||||
import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.Icon
|
||||
|
@ -71,6 +72,7 @@ fun MemberListItem(
|
|||
|
||||
val rsvp = observeRSVP(room = room, member = member) ?: return
|
||||
|
||||
var running by rememberSaveable { mutableStateOf(false) }
|
||||
var expanded by rememberSaveable { mutableStateOf(false) }
|
||||
|
||||
val alpha = if (rsvp.answer == RSVPAnswer.PENDING) 0.4f else 1.0f
|
||||
|
@ -99,11 +101,15 @@ fun MemberListItem(
|
|||
.size(40.dp)
|
||||
.clip(MaterialTheme.shapes.extraLarge)
|
||||
) {
|
||||
if (running) {
|
||||
CircularProgressIndicator()
|
||||
} else {
|
||||
AvatarUser(
|
||||
user = user,
|
||||
alpha = alpha,
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
trailingContent = {
|
||||
Icon(
|
||||
|
@ -139,13 +145,15 @@ fun MemberListItem(
|
|||
val userId = member.userId
|
||||
|
||||
Log.d("Room", "Uninviting `$userId`...")
|
||||
running = true
|
||||
|
||||
// FIXME: Errors for this aren't displayed as I don't have any idea of where to place the relevant text on the UI, but also are so unlikely to occour that it should be ok to disregard it
|
||||
try {
|
||||
room.membershipService().remove(userId)
|
||||
} catch (e: Throwable) {
|
||||
Log.e("Room", "Failed to uninvite `$userId`: $e")
|
||||
return@SendUninvite
|
||||
} finally {
|
||||
running = false
|
||||
}
|
||||
|
||||
Log.d("Room", "Successfully uninvited `$userId`!")
|
||||
|
|
Loading…
Reference in a new issue