Display active radios in Android member rows
This commit is contained in:
1 parent
9c3a2d96e3
commit
3637552f2b
2 files changed
+16
-3
No files matched your search
+11
-3
@@ -312,18 +312,26 @@ void chat_core_request_member_list_trampoline(void* arg) {
|
||||
|
||||
uint8_t* members = NULL;
|
||||
int count = 0;
|
||||
if (chat_core_get_member_list(inst, ch_id, &members, &count) != 0 || !members) return;
|
||||
if (chat_core_get_member_list(inst, ch_id, &members, &count) != 0) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CHAT_SYNC, "chat_member: cannot build list ch=%s", ch_id); return;
|
||||
}
|
||||
|
||||
size_t ch_len = strlen(ch_id);
|
||||
size_t evt_sz = 1 + ch_len + 2 + (size_t)count * CHAT_MEMBER_DISPLAY_SIZE;
|
||||
uint8_t* evt = u_malloc(evt_sz);
|
||||
if (!evt) { u_free(members); return; }
|
||||
if (!evt) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CHAT_SYNC, "chat_member: list event allocation failed ch=%s count=%d", ch_id, count);
|
||||
u_free(members); return;
|
||||
}
|
||||
|
||||
uint16_t u16cnt = (uint16_t)count;
|
||||
evt[0] = (uint8_t)ch_len;
|
||||
memcpy(evt + 1, ch_id, ch_len);
|
||||
memcpy(evt + 1 + ch_len, &u16cnt, 2);
|
||||
memcpy(evt + 1 + ch_len + 2, members, (size_t)count * CHAT_MEMBER_DISPLAY_SIZE);
|
||||
if (count) memcpy(evt + 1 + ch_len + 2, members, (size_t)count * CHAT_MEMBER_DISPLAY_SIZE);
|
||||
int radios = 0;
|
||||
for (int i = 0; i < count; i++) radios += !!(members[i * CHAT_MEMBER_DISPLAY_SIZE + 10] & CHAT_MEMBER_FLAG_RADIO);
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_CHAT_SYNC, "chat_member: list ch=%s count=%d radios=%d", ch_id, count, radios);
|
||||
chat_event_post(inst, CHAT_EVT_MEMBER_LIST, evt, (int)evt_sz);
|
||||
|
||||
u_free(evt);
|
||||
|
||||
@@ -47,6 +47,7 @@ import com.utun.chat.data.MemberAddr
|
||||
import com.utun.chat.data.MemberLinks
|
||||
import com.utun.chat.data.LinkStatus
|
||||
import com.utun.chat.data.LocalSocketState
|
||||
import com.utun.chat.ui.components.PortableRadioIcon
|
||||
import com.utun.chat.viewmodel.ChatViewModel
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@@ -205,6 +206,10 @@ private fun MemberListItem(
|
||||
Icon(Icons.Filled.Storage, stringResource(R.string.storage), tint = MaterialTheme.colorScheme.primary, modifier = Modifier.size(16.dp))
|
||||
Spacer(Modifier.width(4.dp))
|
||||
}
|
||||
if (member.radioActive) {
|
||||
PortableRadioIcon(stringResource(R.string.radio_active), Modifier.size(16.dp))
|
||||
Spacer(Modifier.width(4.dp))
|
||||
}
|
||||
if (!member.isVerified) {
|
||||
Icon(Icons.Filled.Close, stringResource(R.string.not_verified), tint = Color.Red, modifier = Modifier.size(16.dp))
|
||||
Spacer(Modifier.width(4.dp))
|
||||
|
||||
Reference in new issue
Block a user