|
|
|
@ -23,22 +23,25 @@ struct ContentView: View {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private var showLoginSheet: Binding<Bool> { |
|
|
|
|
Binding { |
|
|
|
|
!connection.authenticated |
|
|
|
|
} set: { _ in |
|
|
|
|
// swallow |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ViewBuilder |
|
|
|
|
private var content: some View { |
|
|
|
|
if !connection.authenticated { |
|
|
|
|
LoginView { info in |
|
|
|
|
Task { |
|
|
|
|
await connection.connect(info: info) |
|
|
|
|
} |
|
|
|
|
NavigationView { |
|
|
|
|
ConversationListWrapper(selectedConversation: $selectedConversation) |
|
|
|
|
selectedConversation.map { |
|
|
|
|
ConversationViewWrapper(conversation: $0) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
NavigationView { |
|
|
|
|
ConversationListWrapper(selectedConversation: $selectedConversation) |
|
|
|
|
selectedConversation.map { |
|
|
|
|
ConversationViewWrapper(conversation: $0) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.sheet(isPresented: showLoginSheet) { |
|
|
|
|
loginOverlay |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|