feat(ios): iPhone channel drill-down, fix chat compose box, unify chat+activity
- Channels tab is now a drill-down on iPhone: ChannelBrowserView lists top-level
channels; ChannelDetailView shows the people in a channel, its sub-channels, and
an explicit Join button (with password prompt). iPad split view unchanged.
- Extract self-contained UserRow (context menu + sheets) from UserListView so admin
actions are reused in the drill-down.
- Fix off-screen chat compose box: pin VoiceControlsView via per-tab
.safeAreaInset(edge: .bottom) instead of a floating overlay, so it reserves layout
space above the tab bar (keeping the compose box visible, cooperating with keyboard
avoidance) without covering the tab bar buttons.
- Collapse Activity into Chat like macOS/Windows: ChatView renders a merged,
time-sorted timeline of messages + activity (activity rows in gray); remove the
Activity tab and ActivityLogView.
- Label the RPSystemBroadcastPickerView inner UIButton for VoiceOver
("Share/Stop sharing screen audio") instead of relying on an outer SwiftUI label.
This commit is contained in:
121
clients/apple/iOS/VoiceCatiOS/Views/UserRow.swift
Normal file
121
clients/apple/iOS/VoiceCatiOS/Views/UserRow.swift
Normal file
@@ -0,0 +1,121 @@
|
||||
import SwiftUI
|
||||
import VoiceCatCore
|
||||
|
||||
/// A single user row with its admin context menu and the sheets those actions present.
|
||||
/// Self-contained (owns its own sheet state) so it can be reused both by the iPad
|
||||
/// `UserListView` middle column and by the iPhone `ChannelDetailView` drill-down.
|
||||
struct UserRow: View {
|
||||
let user: User
|
||||
@Bindable var session: SessionState
|
||||
|
||||
@State private var activeSheet: ActiveSheet?
|
||||
|
||||
private enum ActiveSheet: Identifiable {
|
||||
case tuning, ban, move, permissions
|
||||
var id: Int { hashValue }
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
UserRowView(user: user, isSelf: user.id == session.selfUserId)
|
||||
.contextMenu { contextMenu }
|
||||
.sheet(item: $activeSheet) { sheet in
|
||||
switch sheet {
|
||||
case .tuning: PerUserTuningView(user: user, session: session)
|
||||
case .ban: BanUserView(user: user, session: session)
|
||||
case .move: MoveUserView(user: user, session: session)
|
||||
case .permissions: PermissionsView(user: user, session: session)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var contextMenu: some View {
|
||||
if user.id != session.selfUserId {
|
||||
Button {
|
||||
activeSheet = .tuning
|
||||
} label: {
|
||||
Label("Volume / NR", systemImage: "speaker.wave.2")
|
||||
}
|
||||
if session.permissions.canKick || session.permissions.isAdmin {
|
||||
Divider()
|
||||
Button {
|
||||
session.kickUser(user.id, reason: "")
|
||||
} label: {
|
||||
Label("Kick", systemImage: "person.fill.xmark")
|
||||
}
|
||||
if session.permissions.canBan || session.permissions.isAdmin {
|
||||
Button(role: .destructive) {
|
||||
activeSheet = .ban
|
||||
} label: {
|
||||
Label("Ban…", systemImage: "nosign")
|
||||
}
|
||||
}
|
||||
}
|
||||
if session.permissions.canMoveUsers || session.permissions.isAdmin {
|
||||
Button {
|
||||
activeSheet = .move
|
||||
} label: {
|
||||
Label("Move to channel…", systemImage: "arrow.right.circle")
|
||||
}
|
||||
}
|
||||
if session.permissions.isAdmin {
|
||||
Divider()
|
||||
let muted = user.serverMuted
|
||||
Button {
|
||||
session.setServerMute(user.id, muted: !muted, deafened: user.serverDeafened)
|
||||
} label: {
|
||||
Label(muted ? "Unmute" : "Server Mute", systemImage: muted ? "mic" : "mic.slash")
|
||||
}
|
||||
Button {
|
||||
activeSheet = .permissions
|
||||
} label: {
|
||||
Label("Permissions…", systemImage: "lock.shield")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct UserRowView: View {
|
||||
let user: User
|
||||
let isSelf: Bool
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 10) {
|
||||
Image(systemName: user.selfMicMuted || user.serverMuted ? "mic.slash.fill" : "mic.fill")
|
||||
.foregroundStyle(user.selfMicMuted || user.serverMuted ? .red : .green)
|
||||
.imageScale(.small)
|
||||
.accessibilityHidden(true)
|
||||
VStack(alignment: .leading, spacing: 1) {
|
||||
HStack(spacing: 4) {
|
||||
Text(user.nickname)
|
||||
.fontWeight(isSelf ? .semibold : .regular)
|
||||
if isSelf {
|
||||
Text("(you)")
|
||||
.font(.caption2)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
if user.isGuest {
|
||||
Text("guest")
|
||||
.font(.caption2)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
}
|
||||
if user.serverMuted || user.serverDeafened {
|
||||
Text(user.serverDeafened ? "server deafened" : "server muted")
|
||||
.font(.caption2)
|
||||
.foregroundStyle(.orange)
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
if user.selfDeafened {
|
||||
Image(systemName: "headphones.slash")
|
||||
.imageScale(.small)
|
||||
.foregroundStyle(.secondary)
|
||||
.accessibilityHidden(true)
|
||||
}
|
||||
}
|
||||
.accessibilityElement(children: .combine)
|
||||
.accessibilityLabel("\(user.nickname)\(isSelf ? ", you" : "")\(user.isGuest ? ", guest" : "")\(user.selfMicMuted ? ", muted" : "")\(user.serverMuted ? ", server muted" : "")")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user