telegram ui style
This commit is contained in:
1 parent
7db327c588
commit
f7e22364fd
9 files changed
+300
-113
No files matched your search
@@ -435,12 +435,12 @@
|
|||||||
D8C81B9255E9886FB86E0785 /* InlineVideoPlayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InlineVideoPlayer.swift; sourceTree = "<group>"; };
|
D8C81B9255E9886FB86E0785 /* InlineVideoPlayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InlineVideoPlayer.swift; sourceTree = "<group>"; };
|
||||||
D9BBE412EAF54DFE968B2E54 /* ArchiveSyncCheckpoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArchiveSyncCheckpoint.swift; sourceTree = "<group>"; };
|
D9BBE412EAF54DFE968B2E54 /* ArchiveSyncCheckpoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArchiveSyncCheckpoint.swift; sourceTree = "<group>"; };
|
||||||
D9FCE089ABBF05EF9F55D451 /* VideoNoteRecordingLifecycleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoNoteRecordingLifecycleTests.swift; sourceTree = "<group>"; };
|
D9FCE089ABBF05EF9F55D451 /* VideoNoteRecordingLifecycleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoNoteRecordingLifecycleTests.swift; sourceTree = "<group>"; };
|
||||||
DF8C531E464C9C4EDE2648C6 /* Luma.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = Luma.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
DF8C531E464C9C4EDE2648C6 /* Luma.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Luma.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
E619B2C85B0DD2E80653D6D3 /* VideoNoteRecordingCompletionPolicy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoNoteRecordingCompletionPolicy.swift; sourceTree = "<group>"; };
|
E619B2C85B0DD2E80653D6D3 /* VideoNoteRecordingCompletionPolicy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoNoteRecordingCompletionPolicy.swift; sourceTree = "<group>"; };
|
||||||
E6A5C32B4DACD56DA733A0DB /* ServerInformation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerInformation.swift; sourceTree = "<group>"; };
|
E6A5C32B4DACD56DA733A0DB /* ServerInformation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerInformation.swift; sourceTree = "<group>"; };
|
||||||
E9F226A1F8D82B39630F9CEB /* LumaRoomStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LumaRoomStore.swift; sourceTree = "<group>"; };
|
E9F226A1F8D82B39630F9CEB /* LumaRoomStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LumaRoomStore.swift; sourceTree = "<group>"; };
|
||||||
EA1D94FE541121DAE9DCE3B0 /* LegacyArchiveImporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacyArchiveImporter.swift; sourceTree = "<group>"; };
|
EA1D94FE541121DAE9DCE3B0 /* LegacyArchiveImporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacyArchiveImporter.swift; sourceTree = "<group>"; };
|
||||||
EA54340DD785335237158BEF /* LumaMac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LumaMac.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
EA54340DD785335237158BEF /* LumaMac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; name = LumaMac.app; path = Luma.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
F0A35C9A7B52458996513382 /* WatchVoiceRecorder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchVoiceRecorder.swift; sourceTree = "<group>"; };
|
F0A35C9A7B52458996513382 /* WatchVoiceRecorder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchVoiceRecorder.swift; sourceTree = "<group>"; };
|
||||||
F207C1B20DE3780F1754F81D /* ConnectionBanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectionBanner.swift; sourceTree = "<group>"; };
|
F207C1B20DE3780F1754F81D /* ConnectionBanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectionBanner.swift; sourceTree = "<group>"; };
|
||||||
F26F91180E43DE9C135B68C1 /* EmojiCatalog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiCatalog.swift; sourceTree = "<group>"; };
|
F26F91180E43DE9C135B68C1 /* EmojiCatalog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiCatalog.swift; sourceTree = "<group>"; };
|
||||||
@@ -1295,7 +1295,7 @@
|
|||||||
DEVELOPMENT_TEAM = K3AS449A74;
|
DEVELOPMENT_TEAM = K3AS449A74;
|
||||||
INFOPLIST_FILE = "Config/Luma-Info.plist";
|
INFOPLIST_FILE = "Config/Luma-Info.plist";
|
||||||
INFOPLIST_KEY_CFBundleIconName = AppIcon;
|
INFOPLIST_KEY_CFBundleIconName = AppIcon;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
@@ -1554,7 +1554,7 @@
|
|||||||
DEVELOPMENT_TEAM = K3AS449A74;
|
DEVELOPMENT_TEAM = K3AS449A74;
|
||||||
INFOPLIST_FILE = "Config/Luma-Info.plist";
|
INFOPLIST_FILE = "Config/Luma-Info.plist";
|
||||||
INFOPLIST_KEY_CFBundleIconName = AppIcon;
|
INFOPLIST_KEY_CFBundleIconName = AppIcon;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
|
|||||||
@@ -2,53 +2,60 @@ import SwiftUI
|
|||||||
|
|
||||||
struct ConnectionBanner: View {
|
struct ConnectionBanner: View {
|
||||||
@ObservedObject var model: AppModel
|
@ObservedObject var model: AppModel
|
||||||
|
var text: String
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
switch model.connectionStatus {
|
switch model.connectionStatus {
|
||||||
case .connected:
|
case .connected:
|
||||||
if model.isArchiveSyncing || !model.isOMEMOReady {
|
if model.isArchiveSyncing || !model.isOMEMOReady {
|
||||||
banner(
|
banner(
|
||||||
icon: model.isArchiveSyncing ? "arrow.triangle.2.circlepath" : "lock.rotation",
|
// text: model.isArchiveSyncing ? "Синхронизация истории…" : "Публикация ключей OMEMO…",
|
||||||
text: model.isArchiveSyncing ? "Синхронизация истории…" : "Публикация ключей OMEMO…",
|
text: "Обновление",
|
||||||
color: .blue,
|
color: .clear,
|
||||||
progress: true
|
progress: true
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
Text(text)
|
||||||
|
.font(.headline)
|
||||||
}
|
}
|
||||||
case .connecting:
|
case .connecting:
|
||||||
banner(icon: "antenna.radiowaves.left.and.right", text: "Подключение…", color: .orange, progress: true)
|
// banner(icon: "antenna.radiowaves.left.and.right", text: "Подключение…", color: .clear, progress: true)
|
||||||
case .disconnected(let reason):
|
banner(text: "Подключение", color: .clear, progress: true)
|
||||||
HStack(spacing: 8) {
|
case .disconnected:
|
||||||
Image(systemName: "wifi.exclamationmark")
|
banner(text: "Ожидание сети", color: .clear, progress: true)
|
||||||
Text(reason ?? "Нет соединения")
|
// HStack(spacing: 8) {
|
||||||
.lineLimit(1)
|
// Image(systemName: "wifi.exclamationmark")
|
||||||
Spacer()
|
// Text(reason ?? "Нет соединения")
|
||||||
Button("Повторить") { Task { await model.reconnect() } }
|
// .lineLimit(1)
|
||||||
.buttonStyle(.borderless)
|
// Spacer()
|
||||||
.fontWeight(.semibold)
|
// Button { Task { await model.reconnect() } } label: {
|
||||||
}
|
// Label("Обновить", systemImage: "arrow.clockwise")
|
||||||
.font(.caption)
|
// }
|
||||||
.foregroundStyle(.white)
|
// .buttonStyle(.borderless)
|
||||||
.padding(.horizontal, 12)
|
// .fontWeight(.semibold)
|
||||||
.padding(.vertical, 8)
|
// }
|
||||||
.background(Color.red.opacity(0.88))
|
// .font(.caption)
|
||||||
|
// .foregroundStyle(.white)
|
||||||
|
// .padding(.horizontal, 12)
|
||||||
|
// .padding(.vertical, 8)
|
||||||
|
//// .background(Color.red.opacity(0.88))
|
||||||
|
// .background(Color.clear)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func banner(icon: String, text: String, color: Color, progress: Bool) -> some View {
|
private func banner(text: String, color: Color, progress: Bool) -> some View {
|
||||||
HStack(spacing: 8) {
|
HStack(spacing: 8) {
|
||||||
if progress {
|
if progress {
|
||||||
ProgressView().controlSize(.mini).tint(.white)
|
ProgressView().controlSize(.mini).tint(.white)
|
||||||
} else {
|
|
||||||
Image(systemName: icon)
|
|
||||||
}
|
}
|
||||||
Text(text)
|
Text(text)
|
||||||
Spacer()
|
// Spacer()
|
||||||
}
|
}
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
.foregroundStyle(.white)
|
.foregroundStyle(.white)
|
||||||
.padding(.horizontal, 12)
|
// .padding(.horizontal, 12)
|
||||||
.padding(.vertical, 8)
|
// .padding(.vertical, 8)
|
||||||
.background(color.opacity(0.88))
|
// .background(color.opacity(0.88))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +53,10 @@ private struct SearchField: View {
|
|||||||
}
|
}
|
||||||
.padding(.horizontal, 10)
|
.padding(.horizontal, 10)
|
||||||
.padding(.vertical, 7)
|
.padding(.vertical, 7)
|
||||||
.background(Color.secondary.opacity(0.14), in: RoundedRectangle(cornerRadius: 10))
|
.background(
|
||||||
|
Color.secondary.opacity(0.14),
|
||||||
|
in: RoundedRectangle(cornerRadius: 10)
|
||||||
|
)
|
||||||
.padding(.horizontal, 12)
|
.padding(.horizontal, 12)
|
||||||
.padding(.vertical, 6)
|
.padding(.vertical, 6)
|
||||||
}
|
}
|
||||||
@@ -111,7 +114,8 @@ private struct MainTabBarView: View {
|
|||||||
.tabItem {
|
.tabItem {
|
||||||
Label(
|
Label(
|
||||||
tab.title,
|
tab.title,
|
||||||
systemImage: selectedTab == tab ? tab.selectedIcon : tab.icon
|
systemImage: selectedTab == tab
|
||||||
|
? tab.selectedIcon : tab.icon
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.tag(tab)
|
.tag(tab)
|
||||||
@@ -145,6 +149,7 @@ private struct ChatsTab: View {
|
|||||||
@State private var showingNewChat = false
|
@State private var showingNewChat = false
|
||||||
@State private var showingNewGroup = false
|
@State private var showingNewGroup = false
|
||||||
@State private var pendingGroupDeletion: Conversation?
|
@State private var pendingGroupDeletion: Conversation?
|
||||||
|
@FocusState private var searchFocused: Bool
|
||||||
|
|
||||||
/// SwiftData-backed chat list. The query orders by last activity;
|
/// SwiftData-backed chat list. The query orders by last activity;
|
||||||
/// `filteredConversations` applies the pinned-first ordering that
|
/// `filteredConversations` applies the pinned-first ordering that
|
||||||
@@ -152,7 +157,7 @@ private struct ChatsTab: View {
|
|||||||
/// so pinning cannot be a `SortDescriptor`).
|
/// so pinning cannot be a `SortDescriptor`).
|
||||||
@Query(
|
@Query(
|
||||||
sort: [
|
sort: [
|
||||||
SortDescriptor(\Conversation.lastActivity, order: .reverse),
|
SortDescriptor(\Conversation.lastActivity, order: .reverse)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
private var conversations: [Conversation]
|
private var conversations: [Conversation]
|
||||||
@@ -160,19 +165,30 @@ private struct ChatsTab: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
SearchField(text: $searchText, prompt: "Поиск чатов")
|
|
||||||
ConnectionBanner(model: model)
|
|
||||||
chatList
|
chatList
|
||||||
}
|
}
|
||||||
.navigationTitle("Чаты")
|
.navigationTitle("")
|
||||||
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
|
.searchable(
|
||||||
|
text: $searchText,
|
||||||
|
placement: .navigationBarDrawer(displayMode: .always),
|
||||||
|
prompt: "Поиск чатов"
|
||||||
|
)
|
||||||
.toolbar {
|
.toolbar {
|
||||||
|
ToolbarItem(placement: .principal) {
|
||||||
|
ConnectionBanner(model: model, text: "Чаты")
|
||||||
|
}
|
||||||
ToolbarItemGroup(placement: .primaryAction) {
|
ToolbarItemGroup(placement: .primaryAction) {
|
||||||
Button { showingNewGroup = true } label: {
|
Button {
|
||||||
|
showingNewGroup = true
|
||||||
|
} label: {
|
||||||
Image(systemName: "person.3.fill")
|
Image(systemName: "person.3.fill")
|
||||||
}
|
}
|
||||||
.accessibilityLabel("Новый групповой чат")
|
.accessibilityLabel("Новый групповой чат")
|
||||||
.help("Новый групповой чат")
|
.help("Новый групповой чат")
|
||||||
Button { showingNewChat = true } label: {
|
Button {
|
||||||
|
showingNewChat = true
|
||||||
|
} label: {
|
||||||
Image(systemName: "square.and.pencil")
|
Image(systemName: "square.and.pencil")
|
||||||
}
|
}
|
||||||
.accessibilityLabel("Новый личный чат")
|
.accessibilityLabel("Новый личный чат")
|
||||||
@@ -200,13 +216,18 @@ private struct ChatsTab: View {
|
|||||||
}
|
}
|
||||||
Button("Отмена", role: .cancel) { pendingGroupDeletion = nil }
|
Button("Отмена", role: .cancel) { pendingGroupDeletion = nil }
|
||||||
} message: {
|
} message: {
|
||||||
Text("Чат и его история будут удалены с этого устройства. Luma выйдет из комнаты, если вы в ней.")
|
Text(
|
||||||
}
|
"Чат и его история будут удалены с этого устройства. Luma выйдет из комнаты, если вы в ней."
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private var filteredConversations: [Conversation] {
|
private var filteredConversations: [Conversation] {
|
||||||
let source = searchText.isEmpty ? conversations : conversations.filter(matchesSearch)
|
let source =
|
||||||
|
searchText.isEmpty
|
||||||
|
? conversations : conversations.filter(matchesSearch)
|
||||||
return source.sorted(by: conversationSort)
|
return source.sorted(by: conversationSort)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,15 +237,21 @@ private struct ChatsTab: View {
|
|||||||
NavigationLink {
|
NavigationLink {
|
||||||
ChatView(model: model, conversation: conversation)
|
ChatView(model: model, conversation: conversation)
|
||||||
.id(conversation.jid)
|
.id(conversation.jid)
|
||||||
.onAppear { model.selectConversation(id: conversation.jid) }
|
.onAppear {
|
||||||
|
model.selectConversation(id: conversation.jid)
|
||||||
|
}
|
||||||
} label: {
|
} label: {
|
||||||
ConversationRow(
|
ConversationRow(
|
||||||
conversation: conversation,
|
conversation: conversation,
|
||||||
imageData: model.avatarData(for: conversation.jid),
|
imageData: model.avatarData(for: conversation.jid),
|
||||||
isEncrypted: model.encryptionEnabled(for: conversation.jid)
|
isEncrypted: model.encryptionEnabled(
|
||||||
|
for: conversation.jid
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.listRowInsets(EdgeInsets(top: 6, leading: 12, bottom: 6, trailing: 12))
|
.listRowInsets(
|
||||||
|
EdgeInsets(top: 6, leading: 12, bottom: 6, trailing: 12)
|
||||||
|
)
|
||||||
.swipeActions(edge: .trailing, allowsFullSwipe: false) {
|
.swipeActions(edge: .trailing, allowsFullSwipe: false) {
|
||||||
if conversation.isGroup {
|
if conversation.isGroup {
|
||||||
Button(role: .destructive) {
|
Button(role: .destructive) {
|
||||||
@@ -241,7 +268,8 @@ private struct ChatsTab: View {
|
|||||||
if filteredConversations.isEmpty {
|
if filteredConversations.isEmpty {
|
||||||
ContentUnavailableView(
|
ContentUnavailableView(
|
||||||
searchText.isEmpty ? "Нет чатов" : "Ничего не найдено",
|
searchText.isEmpty ? "Нет чатов" : "Ничего не найдено",
|
||||||
systemImage: searchText.isEmpty ? "bubble.left" : "magnifyingglass",
|
systemImage: searchText.isEmpty
|
||||||
|
? "bubble.left" : "magnifyingglass",
|
||||||
description: Text(
|
description: Text(
|
||||||
searchText.isEmpty
|
searchText.isEmpty
|
||||||
? "Создайте личный или групповой чат."
|
? "Создайте личный или групповой чат."
|
||||||
@@ -252,9 +280,13 @@ private struct ChatsTab: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func conversationSort(_ lhs: Conversation, _ rhs: Conversation) -> Bool {
|
private func conversationSort(_ lhs: Conversation, _ rhs: Conversation)
|
||||||
|
-> Bool
|
||||||
|
{
|
||||||
if lhs.isPinned != rhs.isPinned { return lhs.isPinned }
|
if lhs.isPinned != rhs.isPinned { return lhs.isPinned }
|
||||||
if lhs.lastActivity != rhs.lastActivity { return lhs.lastActivity > rhs.lastActivity }
|
if lhs.lastActivity != rhs.lastActivity {
|
||||||
|
return lhs.lastActivity > rhs.lastActivity
|
||||||
|
}
|
||||||
return lhs.displayName.localizedCaseInsensitiveCompare(rhs.displayName)
|
return lhs.displayName.localizedCaseInsensitiveCompare(rhs.displayName)
|
||||||
== .orderedAscending
|
== .orderedAscending
|
||||||
}
|
}
|
||||||
@@ -273,7 +305,7 @@ private struct ContactsTab: View {
|
|||||||
|
|
||||||
@Query(
|
@Query(
|
||||||
sort: [
|
sort: [
|
||||||
SortDescriptor(\Conversation.lastActivity, order: .reverse),
|
SortDescriptor(\Conversation.lastActivity, order: .reverse)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
private var conversations: [Conversation]
|
private var conversations: [Conversation]
|
||||||
@@ -281,11 +313,20 @@ private struct ContactsTab: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
SearchField(text: $searchText, prompt: "Поиск контактов")
|
|
||||||
ConnectionBanner(model: model)
|
|
||||||
contactsList
|
contactsList
|
||||||
}
|
}
|
||||||
.navigationTitle("Контакты")
|
.navigationTitle("")
|
||||||
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
|
.searchable(
|
||||||
|
text: $searchText,
|
||||||
|
placement: .navigationBarDrawer(displayMode: .always),
|
||||||
|
prompt: "Поиск контактов"
|
||||||
|
)
|
||||||
|
.toolbar {
|
||||||
|
ToolbarItem(placement: .principal) {
|
||||||
|
ConnectionBanner(model: model, text: "Контакты")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,10 +336,15 @@ private struct ContactsTab: View {
|
|||||||
Section {
|
Section {
|
||||||
ForEach(filteredRosterContacts) { conversation in
|
ForEach(filteredRosterContacts) { conversation in
|
||||||
contactLink(conversation)
|
contactLink(conversation)
|
||||||
.listRowInsets(EdgeInsets(top: 7, leading: 12, bottom: 7, trailing: 12))
|
.listRowInsets(
|
||||||
|
EdgeInsets(
|
||||||
|
top: 7,
|
||||||
|
leading: 12,
|
||||||
|
bottom: 7,
|
||||||
|
trailing: 12
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
} header: {
|
|
||||||
Label("Люди из roster", systemImage: "person.2.fill")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,10 +352,15 @@ private struct ContactsTab: View {
|
|||||||
Section {
|
Section {
|
||||||
ForEach(filteredGroupContacts) { conversation in
|
ForEach(filteredGroupContacts) { conversation in
|
||||||
contactLink(conversation)
|
contactLink(conversation)
|
||||||
.listRowInsets(EdgeInsets(top: 7, leading: 12, bottom: 7, trailing: 12))
|
.listRowInsets(
|
||||||
|
EdgeInsets(
|
||||||
|
top: 7,
|
||||||
|
leading: 12,
|
||||||
|
bottom: 7,
|
||||||
|
trailing: 12
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
} header: {
|
|
||||||
Label("Групповые чаты", systemImage: "person.3.fill")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -318,7 +369,8 @@ private struct ContactsTab: View {
|
|||||||
if filteredRosterContacts.isEmpty && filteredGroupContacts.isEmpty {
|
if filteredRosterContacts.isEmpty && filteredGroupContacts.isEmpty {
|
||||||
ContentUnavailableView(
|
ContentUnavailableView(
|
||||||
searchText.isEmpty ? "Нет контактов" : "Ничего не найдено",
|
searchText.isEmpty ? "Нет контактов" : "Ничего не найдено",
|
||||||
systemImage: searchText.isEmpty ? "person.2" : "magnifyingglass",
|
systemImage: searchText.isEmpty
|
||||||
|
? "person.2" : "magnifyingglass",
|
||||||
description: Text(contactListDescription),
|
description: Text(contactListDescription),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -354,7 +406,8 @@ private struct ContactsTab: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var hasStoredContacts: Bool {
|
private var hasStoredContacts: Bool {
|
||||||
!model.rosterContactJIDs.isEmpty || conversations.contains { $0.isGroup }
|
!model.rosterContactJIDs.isEmpty
|
||||||
|
|| conversations.contains { $0.isGroup }
|
||||||
}
|
}
|
||||||
|
|
||||||
private var contactListDescription: String {
|
private var contactListDescription: String {
|
||||||
@@ -362,7 +415,8 @@ private struct ContactsTab: View {
|
|||||||
return "Попробуйте другой JID или имя."
|
return "Попробуйте другой JID или имя."
|
||||||
}
|
}
|
||||||
if !hasStoredContacts, model.connectionStatus != .connected {
|
if !hasStoredContacts, model.connectionStatus != .connected {
|
||||||
return "Подключитесь к серверу, чтобы загрузить roster Prosody и групповые комнаты."
|
return
|
||||||
|
"Подключитесь к серверу, чтобы загрузить roster Prosody и групповые комнаты."
|
||||||
}
|
}
|
||||||
return "Добавьте человека в roster или создайте групповой чат."
|
return "Добавьте человека в roster или создайте групповой чат."
|
||||||
}
|
}
|
||||||
@@ -373,7 +427,8 @@ private struct ContactsTab: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func contactSort(_ lhs: Conversation, _ rhs: Conversation) -> Bool {
|
private func contactSort(_ lhs: Conversation, _ rhs: Conversation) -> Bool {
|
||||||
lhs.displayName.localizedCaseInsensitiveCompare(rhs.displayName) == .orderedAscending
|
lhs.displayName.localizedCaseInsensitiveCompare(rhs.displayName)
|
||||||
|
== .orderedAscending
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,7 +444,9 @@ private struct CallsTab: View {
|
|||||||
ContentUnavailableView(
|
ContentUnavailableView(
|
||||||
"Нет звонков",
|
"Нет звонков",
|
||||||
systemImage: "phone",
|
systemImage: "phone",
|
||||||
description: Text("История звонков появится здесь после первого вызова.")
|
description: Text(
|
||||||
|
"История звонков появится здесь после первого вызова."
|
||||||
|
)
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
List(model.callHistoryMessages) { message in
|
List(model.callHistoryMessages) { message in
|
||||||
@@ -397,22 +454,58 @@ private struct CallsTab: View {
|
|||||||
$0.jid == message.conversationID
|
$0.jid == message.conversationID
|
||||||
}) {
|
}) {
|
||||||
NavigationLink {
|
NavigationLink {
|
||||||
ChatView(model: model, conversation: conversation)
|
ChatView(
|
||||||
|
model: model,
|
||||||
|
conversation: conversation
|
||||||
|
)
|
||||||
.id(conversation.jid)
|
.id(conversation.jid)
|
||||||
.onAppear { model.selectConversation(id: conversation.jid) }
|
.onAppear {
|
||||||
} label: {
|
model.selectConversation(
|
||||||
CallHistoryRow(model: model, message: message, conversation: conversation)
|
id: conversation.jid
|
||||||
|
)
|
||||||
}
|
}
|
||||||
.listRowInsets(EdgeInsets(top: 7, leading: 12, bottom: 7, trailing: 12))
|
} label: {
|
||||||
|
CallHistoryRow(
|
||||||
|
model: model,
|
||||||
|
message: message,
|
||||||
|
conversation: conversation
|
||||||
|
)
|
||||||
|
}
|
||||||
|
.listRowInsets(
|
||||||
|
EdgeInsets(
|
||||||
|
top: 7,
|
||||||
|
leading: 12,
|
||||||
|
bottom: 7,
|
||||||
|
trailing: 12
|
||||||
|
)
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
CallHistoryRow(model: model, message: message, conversation: nil)
|
CallHistoryRow(
|
||||||
.listRowInsets(EdgeInsets(top: 7, leading: 12, bottom: 7, trailing: 12))
|
model: model,
|
||||||
|
message: message,
|
||||||
|
conversation: nil
|
||||||
|
)
|
||||||
|
.listRowInsets(
|
||||||
|
EdgeInsets(
|
||||||
|
top: 7,
|
||||||
|
leading: 12,
|
||||||
|
bottom: 7,
|
||||||
|
trailing: 12
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.listStyle(.plain)
|
.listStyle(.plain)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.navigationTitle("Звонки")
|
.navigationTitle("")
|
||||||
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
|
.toolbar {
|
||||||
|
ToolbarItem(placement: .principal) {
|
||||||
|
Text("Звонки")
|
||||||
|
.font(.headline)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -424,10 +517,16 @@ private struct CallHistoryRow: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
HStack(spacing: 12) {
|
HStack(spacing: 12) {
|
||||||
Image(systemName: message.callHistory?.isVideo == true ? "video.fill" : "phone.fill")
|
Image(
|
||||||
|
systemName: message.callHistory?.isVideo == true
|
||||||
|
? "video.fill" : "phone.fill"
|
||||||
|
)
|
||||||
.font(.system(size: 17, weight: .semibold))
|
.font(.system(size: 17, weight: .semibold))
|
||||||
.foregroundStyle(message.direction == .incoming && message.callHistory?.outcome == .missed
|
.foregroundStyle(
|
||||||
? Color.red : Color.accentColor)
|
message.direction == .incoming
|
||||||
|
&& message.callHistory?.outcome == .missed
|
||||||
|
? Color.red : Color.accentColor
|
||||||
|
)
|
||||||
.frame(width: 34, height: 34)
|
.frame(width: 34, height: 34)
|
||||||
.background(Color.secondary.opacity(0.12), in: Circle())
|
.background(Color.secondary.opacity(0.12), in: Circle())
|
||||||
|
|
||||||
@@ -456,7 +555,11 @@ private struct ContactRow: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
HStack(spacing: 12) {
|
HStack(spacing: 12) {
|
||||||
AvatarView(conversation: conversation, imageData: imageData, size: 42)
|
AvatarView(
|
||||||
|
conversation: conversation,
|
||||||
|
imageData: imageData,
|
||||||
|
size: 42
|
||||||
|
)
|
||||||
|
|
||||||
VStack(alignment: .leading, spacing: 3) {
|
VStack(alignment: .leading, spacing: 3) {
|
||||||
HStack(spacing: 6) {
|
HStack(spacing: 6) {
|
||||||
@@ -487,9 +590,9 @@ private struct ContactRow: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Spacer(minLength: 8)
|
Spacer(minLength: 8)
|
||||||
Image(systemName: "chevron.right")
|
// Image(systemName: "chevron.right")
|
||||||
.font(.caption.bold())
|
// .font(.caption.bold())
|
||||||
.foregroundStyle(.tertiary)
|
// .foregroundStyle(.tertiary)
|
||||||
}
|
}
|
||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
}
|
}
|
||||||
@@ -553,7 +656,7 @@ private struct MainSplitView: View {
|
|||||||
/// `SortDescriptor`.
|
/// `SortDescriptor`.
|
||||||
@Query(
|
@Query(
|
||||||
sort: [
|
sort: [
|
||||||
SortDescriptor(\Conversation.lastActivity, order: .reverse),
|
SortDescriptor(\Conversation.lastActivity, order: .reverse)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
private var conversations: [Conversation]
|
private var conversations: [Conversation]
|
||||||
@@ -561,7 +664,11 @@ private struct MainSplitView: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationSplitView {
|
NavigationSplitView {
|
||||||
sidebar
|
sidebar
|
||||||
.navigationSplitViewColumnWidth(min: 240, ideal: 290, max: 380)
|
.navigationSplitViewColumnWidth(
|
||||||
|
min: 240,
|
||||||
|
ideal: 290,
|
||||||
|
max: 380
|
||||||
|
)
|
||||||
} detail: {
|
} detail: {
|
||||||
detailPane
|
detailPane
|
||||||
}
|
}
|
||||||
@@ -569,12 +676,16 @@ private struct MainSplitView: View {
|
|||||||
.toolbar {
|
.toolbar {
|
||||||
if mode != .settings {
|
if mode != .settings {
|
||||||
ToolbarItemGroup(placement: .primaryAction) {
|
ToolbarItemGroup(placement: .primaryAction) {
|
||||||
Button { showingNewGroup = true } label: {
|
Button {
|
||||||
|
showingNewGroup = true
|
||||||
|
} label: {
|
||||||
Image(systemName: "person.3.fill")
|
Image(systemName: "person.3.fill")
|
||||||
}
|
}
|
||||||
.accessibilityLabel("Новый групповой чат")
|
.accessibilityLabel("Новый групповой чат")
|
||||||
.help("Новый групповой чат")
|
.help("Новый групповой чат")
|
||||||
Button { showingNewChat = true } label: {
|
Button {
|
||||||
|
showingNewChat = true
|
||||||
|
} label: {
|
||||||
Image(systemName: "square.and.pencil")
|
Image(systemName: "square.and.pencil")
|
||||||
}
|
}
|
||||||
.accessibilityLabel("Новый личный чат")
|
.accessibilityLabel("Новый личный чат")
|
||||||
@@ -603,7 +714,9 @@ private struct MainSplitView: View {
|
|||||||
}
|
}
|
||||||
Button("Отмена", role: .cancel) { pendingGroupDeletion = nil }
|
Button("Отмена", role: .cancel) { pendingGroupDeletion = nil }
|
||||||
} message: {
|
} message: {
|
||||||
Text("Чат и его история будут удалены с этого устройства. Luma выйдет из комнаты, если вы в ней.")
|
Text(
|
||||||
|
"Чат и его история будут удалены с этого устройства. Luma выйдет из комнаты, если вы в ней."
|
||||||
|
)
|
||||||
}
|
}
|
||||||
.onAppear {
|
.onAppear {
|
||||||
ensureSelection()
|
ensureSelection()
|
||||||
@@ -635,7 +748,10 @@ private struct MainSplitView: View {
|
|||||||
.accessibilityLabel("Меню")
|
.accessibilityLabel("Меню")
|
||||||
|
|
||||||
if mode != .settings {
|
if mode != .settings {
|
||||||
SearchField(text: $searchText, prompt: mode.searchPrompt)
|
SearchField(
|
||||||
|
text: $searchText,
|
||||||
|
prompt: mode.searchPrompt
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 10)
|
.padding(.horizontal, 10)
|
||||||
@@ -666,19 +782,28 @@ private struct MainSplitView: View {
|
|||||||
if mode == .chats && filteredChats.isEmpty {
|
if mode == .chats && filteredChats.isEmpty {
|
||||||
ContentUnavailableView(
|
ContentUnavailableView(
|
||||||
searchText.isEmpty ? "Нет чатов" : "Ничего не найдено",
|
searchText.isEmpty ? "Нет чатов" : "Ничего не найдено",
|
||||||
systemImage: searchText.isEmpty ? "bubble.left" : "magnifyingglass",
|
systemImage: searchText.isEmpty
|
||||||
description: Text(searchText.isEmpty
|
? "bubble.left" : "magnifyingglass",
|
||||||
|
description: Text(
|
||||||
|
searchText.isEmpty
|
||||||
? "Создайте личный или групповой чат."
|
? "Создайте личный или групповой чат."
|
||||||
: "Попробуйте другой JID или имя.")
|
: "Попробуйте другой JID или имя."
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if mode == .contacts && filteredRoster.isEmpty && filteredGroups.isEmpty {
|
if mode == .contacts && filteredRoster.isEmpty
|
||||||
|
&& filteredGroups.isEmpty
|
||||||
|
{
|
||||||
ContentUnavailableView(
|
ContentUnavailableView(
|
||||||
searchText.isEmpty ? "Нет контактов" : "Ничего не найдено",
|
searchText.isEmpty
|
||||||
systemImage: searchText.isEmpty ? "person.2" : "magnifyingglass",
|
? "Нет контактов" : "Ничего не найдено",
|
||||||
description: Text(searchText.isEmpty
|
systemImage: searchText.isEmpty
|
||||||
|
? "person.2" : "magnifyingglass",
|
||||||
|
description: Text(
|
||||||
|
searchText.isEmpty
|
||||||
? "Подключитесь к серверу, чтобы загрузить roster, или создайте групповой чат."
|
? "Подключитесь к серверу, чтобы загрузить roster, или создайте групповой чат."
|
||||||
: "Попробуйте другой JID или имя.")
|
: "Попробуйте другой JID или имя."
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -708,7 +833,10 @@ private struct MainSplitView: View {
|
|||||||
if !filteredRoster.isEmpty {
|
if !filteredRoster.isEmpty {
|
||||||
Section("Люди из roster") {
|
Section("Люди из roster") {
|
||||||
ForEach(filteredRoster) { conversation in
|
ForEach(filteredRoster) { conversation in
|
||||||
ContactRow(conversation: conversation, imageData: model.avatarData(for: conversation.jid))
|
ContactRow(
|
||||||
|
conversation: conversation,
|
||||||
|
imageData: model.avatarData(for: conversation.jid)
|
||||||
|
)
|
||||||
.tag(conversation.jid)
|
.tag(conversation.jid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -716,7 +844,10 @@ private struct MainSplitView: View {
|
|||||||
if !filteredGroups.isEmpty {
|
if !filteredGroups.isEmpty {
|
||||||
Section("Групповые чаты") {
|
Section("Групповые чаты") {
|
||||||
ForEach(filteredGroups) { conversation in
|
ForEach(filteredGroups) { conversation in
|
||||||
ContactRow(conversation: conversation, imageData: model.avatarData(for: conversation.jid))
|
ContactRow(
|
||||||
|
conversation: conversation,
|
||||||
|
imageData: model.avatarData(for: conversation.jid)
|
||||||
|
)
|
||||||
.tag(conversation.jid)
|
.tag(conversation.jid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -726,11 +857,21 @@ private struct MainSplitView: View {
|
|||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private var callRows: some View {
|
private var callRows: some View {
|
||||||
ForEach(filteredCalls) { message in
|
ForEach(filteredCalls) { message in
|
||||||
if let conversation = conversations.first(where: { $0.jid == message.conversationID }) {
|
if let conversation = conversations.first(where: {
|
||||||
CallHistoryRow(model: model, message: message, conversation: conversation)
|
$0.jid == message.conversationID
|
||||||
|
}) {
|
||||||
|
CallHistoryRow(
|
||||||
|
model: model,
|
||||||
|
message: message,
|
||||||
|
conversation: conversation
|
||||||
|
)
|
||||||
.tag(message.clientID)
|
.tag(message.clientID)
|
||||||
} else {
|
} else {
|
||||||
CallHistoryRow(model: model, message: message, conversation: nil)
|
CallHistoryRow(
|
||||||
|
model: model,
|
||||||
|
message: message,
|
||||||
|
conversation: nil
|
||||||
|
)
|
||||||
.tag(message.clientID)
|
.tag(message.clientID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -744,7 +885,9 @@ private struct MainSplitView: View {
|
|||||||
NavigationStack {
|
NavigationStack {
|
||||||
SettingsView(model: model, presentedAsTab: true)
|
SettingsView(model: model, presentedAsTab: true)
|
||||||
}
|
}
|
||||||
} else if let conversation = selectedConversation ?? defaultConversation {
|
} else if let conversation = selectedConversation
|
||||||
|
?? defaultConversation
|
||||||
|
{
|
||||||
ChatView(model: model, conversation: conversation)
|
ChatView(model: model, conversation: conversation)
|
||||||
.id(conversation.jid)
|
.id(conversation.jid)
|
||||||
.onAppear {
|
.onAppear {
|
||||||
@@ -771,10 +914,16 @@ private struct MainSplitView: View {
|
|||||||
private var selectedConversation: Conversation? {
|
private var selectedConversation: Conversation? {
|
||||||
guard let selectedJID else { return nil }
|
guard let selectedJID else { return nil }
|
||||||
if mode == .calls {
|
if mode == .calls {
|
||||||
guard let message = model.callHistoryMessages.first(where: { $0.clientID == selectedJID }) else {
|
guard
|
||||||
|
let message = model.callHistoryMessages.first(where: {
|
||||||
|
$0.clientID == selectedJID
|
||||||
|
})
|
||||||
|
else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return conversations.first(where: { $0.jid == message.conversationID })
|
return conversations.first(where: {
|
||||||
|
$0.jid == message.conversationID
|
||||||
|
})
|
||||||
}
|
}
|
||||||
return conversations.first(where: { $0.jid == selectedJID })
|
return conversations.first(where: { $0.jid == selectedJID })
|
||||||
}
|
}
|
||||||
@@ -794,20 +943,30 @@ private struct MainSplitView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func matchesChat(_ conversation: Conversation) -> Bool {
|
private func matchesChat(_ conversation: Conversation) -> Bool {
|
||||||
conversation.displayName.localizedCaseInsensitiveContains(searchText)
|
conversation.displayName.localizedCaseInsensitiveContains(
|
||||||
|
searchText
|
||||||
|
)
|
||||||
|| conversation.jid.localizedCaseInsensitiveContains(searchText)
|
|| conversation.jid.localizedCaseInsensitiveContains(searchText)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func conversationSort(_ lhs: Conversation, _ rhs: Conversation) -> Bool {
|
private func conversationSort(_ lhs: Conversation, _ rhs: Conversation)
|
||||||
|
-> Bool
|
||||||
|
{
|
||||||
if lhs.isPinned != rhs.isPinned { return lhs.isPinned }
|
if lhs.isPinned != rhs.isPinned { return lhs.isPinned }
|
||||||
if lhs.lastActivity != rhs.lastActivity { return lhs.lastActivity > rhs.lastActivity }
|
if lhs.lastActivity != rhs.lastActivity {
|
||||||
return lhs.displayName.localizedCaseInsensitiveCompare(rhs.displayName)
|
return lhs.lastActivity > rhs.lastActivity
|
||||||
|
}
|
||||||
|
return lhs.displayName.localizedCaseInsensitiveCompare(
|
||||||
|
rhs.displayName
|
||||||
|
)
|
||||||
== .orderedAscending
|
== .orderedAscending
|
||||||
}
|
}
|
||||||
|
|
||||||
private var filteredRoster: [Conversation] {
|
private var filteredRoster: [Conversation] {
|
||||||
conversations
|
conversations
|
||||||
.filter { !$0.isGroup && model.rosterContactJIDs.contains($0.jid) }
|
.filter {
|
||||||
|
!$0.isGroup && model.rosterContactJIDs.contains($0.jid)
|
||||||
|
}
|
||||||
.filter { searchText.isEmpty || matchesChat($0) }
|
.filter { searchText.isEmpty || matchesChat($0) }
|
||||||
.sorted(by: contactSort)
|
.sorted(by: contactSort)
|
||||||
}
|
}
|
||||||
@@ -819,15 +978,22 @@ private struct MainSplitView: View {
|
|||||||
.sorted(by: contactSort)
|
.sorted(by: contactSort)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func contactSort(_ lhs: Conversation, _ rhs: Conversation) -> Bool {
|
private func contactSort(_ lhs: Conversation, _ rhs: Conversation)
|
||||||
lhs.displayName.localizedCaseInsensitiveCompare(rhs.displayName) == .orderedAscending
|
-> Bool
|
||||||
|
{
|
||||||
|
lhs.displayName.localizedCaseInsensitiveCompare(rhs.displayName)
|
||||||
|
== .orderedAscending
|
||||||
}
|
}
|
||||||
|
|
||||||
private var filteredCalls: [ChatMessage] {
|
private var filteredCalls: [ChatMessage] {
|
||||||
guard !searchText.isEmpty else { return model.callHistoryMessages }
|
guard !searchText.isEmpty else { return model.callHistoryMessages }
|
||||||
return model.callHistoryMessages.filter { message in
|
return model.callHistoryMessages.filter { message in
|
||||||
message.conversationID.localizedCaseInsensitiveContains(searchText)
|
message.conversationID.localizedCaseInsensitiveContains(
|
||||||
|| (conversations.first(where: { $0.jid == message.conversationID })?.displayName
|
searchText
|
||||||
|
)
|
||||||
|
|| (conversations.first(where: {
|
||||||
|
$0.jid == message.conversationID
|
||||||
|
})?.displayName
|
||||||
.localizedCaseInsensitiveContains(searchText) ?? false)
|
.localizedCaseInsensitiveContains(searchText) ?? false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ struct NewChatView: View {
|
|||||||
Section("Контакт") {
|
Section("Контакт") {
|
||||||
TextField("user@example.org", text: $jid)
|
TextField("user@example.org", text: $jid)
|
||||||
.disableAutocorrection(true)
|
.disableAutocorrection(true)
|
||||||
|
#if os(iOS)
|
||||||
|
.keyboardType(.emailAddress)
|
||||||
|
#endif
|
||||||
TextField("Имя (необязательно)", text: $name)
|
TextField("Имя (необязательно)", text: $name)
|
||||||
}
|
}
|
||||||
Section {
|
Section {
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ struct NewGroupView: View {
|
|||||||
VStack(alignment: .leading, spacing: 12) {
|
VStack(alignment: .leading, spacing: 12) {
|
||||||
TextField("room@conference.example.org", text: $roomJID)
|
TextField("room@conference.example.org", text: $roomJID)
|
||||||
.disableAutocorrection(true)
|
.disableAutocorrection(true)
|
||||||
|
#if os(iOS)
|
||||||
|
.keyboardType(.emailAddress)
|
||||||
|
#endif
|
||||||
TextField("Название (необязательно)", text: $name)
|
TextField("Название (необязательно)", text: $name)
|
||||||
TextField("Ваш псевдоним", text: $nickname)
|
TextField("Ваш псевдоним", text: $nickname)
|
||||||
}
|
}
|
||||||
@@ -31,6 +34,9 @@ struct NewGroupView: View {
|
|||||||
VStack(alignment: .leading, spacing: 8) {
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
TextField("alice@example.org, bob@example.org", text: $invitees, axis: .vertical)
|
TextField("alice@example.org, bob@example.org", text: $invitees, axis: .vertical)
|
||||||
.lineLimit(2...5)
|
.lineLimit(2...5)
|
||||||
|
#if os(iOS)
|
||||||
|
.keyboardType(.emailAddress)
|
||||||
|
#endif
|
||||||
Text("Укажите JID через запятую или с новой строки. Если комнаты ещё нет, Prosody создаст её с настройками по умолчанию.")
|
Text("Укажите JID через запятую или с новой строки. Если комнаты ещё нет, Prosody создаст её с настройками по умолчанию.")
|
||||||
.font(.footnote)
|
.font(.footnote)
|
||||||
.foregroundStyle(.secondary)
|
.foregroundStyle(.secondary)
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ struct ServerInfoView: View {
|
|||||||
.font(.caption)
|
.font(.caption)
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
.listRowBackground(Color.clear)
|
.listRowBackground(Color.gray.opacity(0.16))
|
||||||
}
|
}
|
||||||
|
|
||||||
private func connectionRows() -> some View {
|
private func connectionRows() -> some View {
|
||||||
@@ -271,7 +271,7 @@ private extension ServerInformation.CapabilityStatus {
|
|||||||
var color: Color {
|
var color: Color {
|
||||||
switch self {
|
switch self {
|
||||||
case .success: return Color.green.opacity(0.16)
|
case .success: return Color.green.opacity(0.16)
|
||||||
case .normal: return Color.clear
|
case .normal: return Color.gray.opacity(0.16)
|
||||||
case .warning: return Color.orange.opacity(0.16)
|
case .warning: return Color.orange.opacity(0.16)
|
||||||
case .error: return Color.red.opacity(0.16)
|
case .error: return Color.red.opacity(0.16)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,8 +153,13 @@ struct SettingsView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.navigationTitle("Настройки")
|
.navigationTitle("")
|
||||||
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
.toolbar {
|
.toolbar {
|
||||||
|
ToolbarItem(placement: .principal) {
|
||||||
|
Text("Настройки")
|
||||||
|
.font(.headline)
|
||||||
|
}
|
||||||
if !presentedAsTab {
|
if !presentedAsTab {
|
||||||
ToolbarItem(placement: .confirmationAction) {
|
ToolbarItem(placement: .confirmationAction) {
|
||||||
Button("Готово") { dismiss() }
|
Button("Готово") { dismiss() }
|
||||||
|
|||||||
@@ -388,7 +388,7 @@ final class LumaOMEMO2Module: AbstractPEPModule, XmppModule {
|
|||||||
|
|
||||||
public func decode(message: Message, from: BareJID, serverMsgId: String? = nil) -> DecryptionResult<Message, SignalError> {
|
public func decode(message: Message, from: BareJID, serverMsgId: String? = nil) -> DecryptionResult<Message, SignalError> {
|
||||||
guard context != nil else { return .failure(.unknown) }
|
guard context != nil else { return .failure(.unknown) }
|
||||||
guard let encryptedEl = message.findChild(name: "encrypted", xmlns: Self.XMLNS),
|
guard let encryptedEl = message.firstChild(name: "encrypted", xmlns: Self.XMLNS),
|
||||||
let headerEl = encryptedEl.findChild(name: "header"),
|
let headerEl = encryptedEl.findChild(name: "header"),
|
||||||
let sid = UInt32(headerEl.getAttribute("sid") ?? "")
|
let sid = UInt32(headerEl.getAttribute("sid") ?? "")
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ final class LumaSaslFailureModule: XmppModuleBase, XmppModule {
|
|||||||
|
|
||||||
func process(stanza: Stanza) throws {
|
func process(stanza: Stanza) throws {
|
||||||
let condition = stanza.findChild()?.name
|
let condition = stanza.findChild()?.name
|
||||||
let text = stanza.findChild(name: "text")?.value
|
let text = stanza.firstChild(name: "text")?.value
|
||||||
lock.lock()
|
lock.lock()
|
||||||
stored = Failure(condition: condition, text: text)
|
stored = Failure(condition: condition, text: text)
|
||||||
lock.unlock()
|
lock.unlock()
|
||||||
|
|||||||
Reference in new issue
Block a user