53 lines
1.6 KiB
Swift
53 lines
1.6 KiB
Swift
import Combine
|
|
import Foundation
|
|
import Martin
|
|
import SwiftUI
|
|
|
|
struct ConversationSettingsScreen: View {
|
|
@Environment(\.router) var router
|
|
@EnvironmentObject var settingsStore: ChatSettingsStore
|
|
|
|
var body: some View {
|
|
ZStack {
|
|
// Background color
|
|
Color.Material.Background.light
|
|
.ignoresSafeArea()
|
|
|
|
// Content
|
|
VStack(spacing: 0) {
|
|
// Header
|
|
SharedNavigationBar(
|
|
leftButton: .init(
|
|
image: Image(systemName: "chevron.left"),
|
|
action: {
|
|
router.dismissScreen()
|
|
}
|
|
),
|
|
centerText: .init(text: centerText())
|
|
)
|
|
|
|
// Settings list
|
|
ScrollView {
|
|
LazyVStack(spacing: 0) {
|
|
SharedListRow(
|
|
iconType: .none,
|
|
text: L10n.Conversation.Settings.enableOmemo,
|
|
controlType: .switcher(isOn: Binding(
|
|
get: { settingsStore.chat?.encrypted ?? false },
|
|
set: { new in
|
|
settingsStore.setSecured(new)
|
|
}
|
|
))
|
|
)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private func centerText() -> String {
|
|
// TODO: make center text depend on conversation type in future (chat, group chat, channel, etc.)
|
|
L10n.Conversation.Settings.Title.chat
|
|
}
|
|
}
|