another.im-ios/AnotherIM/View/Main/Conversation/ConversationSettingsScreen.swift

53 lines
1.6 KiB
Swift
Raw Permalink Normal View History

2024-09-19 16:50:48 +00:00
import Combine
import Foundation
import Martin
import SwiftUI
struct ConversationSettingsScreen: View {
@Environment(\.router) var router
2024-10-15 11:39:23 +00:00
@EnvironmentObject var settingsStore: ChatSettingsStore
2024-09-19 16:50:48 +00:00
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,
2024-09-20 15:32:10 +00:00
controlType: .switcher(isOn: Binding(
get: { settingsStore.chat?.encrypted ?? false },
set: { new in
2024-09-30 13:24:38 +00:00
settingsStore.setSecured(new)
2024-09-20 15:32:10 +00:00
}
))
2024-09-19 16:50:48 +00:00
)
}
}
}
}
}
private func centerText() -> String {
// TODO: make center text depend on conversation type in future (chat, group chat, channel, etc.)
L10n.Conversation.Settings.Title.chat
}
}