updated ui for macos and ios
This commit is contained in:
1 parent
df7ab24677
commit
e3fcee3351
10 files changed
+619
-576
No files matched your search
@@ -8,21 +8,10 @@ struct NewChatView: View {
|
||||
@State private var addToRoster = true
|
||||
|
||||
var body: some View {
|
||||
#if os(iOS)
|
||||
NavigationStack {
|
||||
Form {
|
||||
Section("Контакт") {
|
||||
TextField("user@example.org", text: $jid)
|
||||
.disableAutocorrection(true)
|
||||
#if os(iOS)
|
||||
.keyboardType(.emailAddress)
|
||||
#endif
|
||||
TextField("Имя (необязательно)", text: $name)
|
||||
}
|
||||
Section {
|
||||
Toggle("Добавить в roster", isOn: $addToRoster)
|
||||
} footer: {
|
||||
Text("Начать чат можно с любым полным JID. Для шифрования у контакта должно быть опубликовано хотя бы одно OMEMO-устройство.")
|
||||
}
|
||||
formcontent()
|
||||
}
|
||||
.navigationTitle("Новый чат")
|
||||
.toolbar {
|
||||
@@ -43,8 +32,48 @@ struct NewChatView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
#if os(macOS)
|
||||
.frame(minWidth: 380, minHeight: 300)
|
||||
#else
|
||||
List {
|
||||
formcontent()
|
||||
HStack {
|
||||
Button("Отмена") { dismiss() }
|
||||
.buttonStyle(.glass)
|
||||
.controlSize(.large)
|
||||
.tint(.secondary)
|
||||
Spacer()
|
||||
Button("Начать") {
|
||||
model.openConversation(
|
||||
jid: jid,
|
||||
name: name.isEmpty ? nil : name,
|
||||
addToRoster: addToRoster
|
||||
)
|
||||
if model.errorMessage == nil { dismiss() }
|
||||
}
|
||||
.fontWeight(.semibold)
|
||||
.disabled(jid.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)
|
||||
.buttonStyle(.glassProminent)
|
||||
.controlSize(.large)
|
||||
}
|
||||
}
|
||||
.navigationTitle("Новый чат")
|
||||
.frame(minWidth: 380, minHeight: 220)
|
||||
#endif
|
||||
}
|
||||
@ViewBuilder
|
||||
private func formcontent() -> some View {
|
||||
Section("Контакт") {
|
||||
TextField("user@example.org", text: $jid)
|
||||
.disableAutocorrection(true)
|
||||
#if os(iOS)
|
||||
.keyboardType(.emailAddress)
|
||||
#endif
|
||||
TextField("Имя (необязательно)", text: $name)
|
||||
}
|
||||
Section {
|
||||
Toggle("Добавить в roster", isOn: $addToRoster)
|
||||
.toggleStyle(.switch)
|
||||
} footer: {
|
||||
Text("Начать чат можно с любым полным JID. Для шифрования у контакта должно быть опубликовано хотя бы одно OMEMO-устройство.")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user