mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 23:05:20 +00:00
Fix room UI and membership tracking issues
- Add lock icon to room header for password management - Change "leave" to "leave room" for clarity - Fix bug where non-members appeared in room member list - Only process room messages if user has joined the room - Initialize room data structures on app launch - Prevent auto-join when just mentioning a room
This commit is contained in:
@@ -259,11 +259,35 @@ struct ContentView: View {
|
||||
|
||||
Spacer()
|
||||
|
||||
// Password button for room creator
|
||||
if viewModel.roomCreators[currentRoom] == viewModel.meshService.myPeerID || viewModel.roomCreators[currentRoom] == nil {
|
||||
Button(action: {
|
||||
// Toggle password protection
|
||||
if viewModel.passwordProtectedRooms.contains(currentRoom) {
|
||||
viewModel.removeRoomPassword(for: currentRoom)
|
||||
} else {
|
||||
// Show password input
|
||||
showPasswordInput = true
|
||||
passwordInputRoom = currentRoom
|
||||
}
|
||||
}) {
|
||||
Image(systemName: viewModel.passwordProtectedRooms.contains(currentRoom) ? "lock.open" : "lock")
|
||||
.font(.system(size: 14))
|
||||
.foregroundColor(secondaryTextColor)
|
||||
.padding(6)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 4)
|
||||
.stroke(secondaryTextColor.opacity(0.5), lineWidth: 1)
|
||||
)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
|
||||
// Leave room button
|
||||
Button(action: {
|
||||
viewModel.leaveRoom(currentRoom)
|
||||
}) {
|
||||
Text("leave")
|
||||
Text("leave room")
|
||||
.font(.system(size: 12, design: .monospaced))
|
||||
.foregroundColor(Color.red)
|
||||
.padding(.horizontal, 8)
|
||||
@@ -611,7 +635,7 @@ struct ContentView: View {
|
||||
Button(action: {
|
||||
viewModel.leaveRoom(room)
|
||||
}) {
|
||||
Text("leave")
|
||||
Text("leave room")
|
||||
.font(.system(size: 10, design: .monospaced))
|
||||
.foregroundColor(secondaryTextColor)
|
||||
.padding(.horizontal, 8)
|
||||
|
||||
Reference in New Issue
Block a user