diff --git a/apps/ios/Shared/Model/ChatModel.swift b/apps/ios/Shared/Model/ChatModel.swift index 8c3d0368e1..7ce430ca5e 100644 --- a/apps/ios/Shared/Model/ChatModel.swift +++ b/apps/ios/Shared/Model/ChatModel.swift @@ -583,6 +583,14 @@ final class Chat: ObservableObject, Identifiable { self.chatStats = chatStats } + func copy(chatInfo: ChatInfo? = nil, chatItems: [ChatItem]? = nil, chatStats: ChatStats? = nil) -> Chat { + Chat( + chatInfo: chatInfo ?? self.chatInfo, + chatItems: chatItems ?? self.chatItems, + chatStats: chatStats ?? self.chatStats + ) + } + var userCanSend: Bool { switch chatInfo { case .direct: return true diff --git a/apps/ios/Shared/Model/SimpleXAPI.swift b/apps/ios/Shared/Model/SimpleXAPI.swift index 16eddca9ac..263b02e37a 100644 --- a/apps/ios/Shared/Model/SimpleXAPI.swift +++ b/apps/ios/Shared/Model/SimpleXAPI.swift @@ -884,7 +884,9 @@ func markChatRead(_ chat: Chat, aboveItem: ChatItem? = nil) async { let itemRange = (minItemId, aboveItem?.id ?? chat.chatItems.last?.id ?? minItemId) let cInfo = chat.chatInfo try await apiChatRead(type: cInfo.chatType, id: cInfo.apiId, itemRange: itemRange) - await MainActor.run { ChatModel.shared.markChatItemsRead(cInfo, aboveItem: aboveItem) } + await MainActor.run { + withAnimation { ChatModel.shared.markChatItemsRead(cInfo, aboveItem: aboveItem) } + } } if chat.chatStats.unreadChat { await markChatUnread(chat, unreadChat: false) @@ -898,7 +900,9 @@ func markChatUnread(_ chat: Chat, unreadChat: Bool = true) async { do { let cInfo = chat.chatInfo try await apiChatUnread(type: cInfo.chatType, id: cInfo.apiId, unreadChat: unreadChat) - await MainActor.run { ChatModel.shared.markChatUnread(cInfo, unreadChat: unreadChat) } + await MainActor.run { + withAnimation { ChatModel.shared.markChatUnread(cInfo, unreadChat: unreadChat) } + } } catch { logger.error("markChatUnread apiChatUnread error: \(responseError(error))") } diff --git a/apps/ios/Shared/Views/Chat/ChatView.swift b/apps/ios/Shared/Views/Chat/ChatView.swift index 5d464e1774..8a43434289 100644 --- a/apps/ios/Shared/Views/Chat/ChatView.swift +++ b/apps/ios/Shared/Views/Chat/ChatView.swift @@ -897,9 +897,20 @@ struct ChatView: View { } func toggleNotifications(_ chat: Chat, enableNtfs: Bool) { + var chatSettings = chat.chatInfo.chatSettings ?? ChatSettings.defaults + chatSettings.enableNtfs = enableNtfs + updateChatSettings(chat, chatSettings: chatSettings) +} + +func toggleChatFavorite(_ chat: Chat, favorite: Bool) { + var chatSettings = chat.chatInfo.chatSettings ?? ChatSettings.defaults + chatSettings.favorite = favorite + updateChatSettings(chat, chatSettings: chatSettings) +} + +func updateChatSettings(_ chat: Chat, chatSettings: ChatSettings) { Task { do { - let chatSettings = ChatSettings(enableNtfs: enableNtfs) try await apiSetChatSettings(type: chat.chatInfo.chatType, id: chat.chatInfo.apiId, chatSettings: chatSettings) await MainActor.run { switch chat.chatInfo { diff --git a/apps/ios/Shared/Views/ChatList/ChatListNavLink.swift b/apps/ios/Shared/Views/ChatList/ChatListNavLink.swift index 5733568c07..b41c632866 100644 --- a/apps/ios/Shared/Views/ChatList/ChatListNavLink.swift +++ b/apps/ios/Shared/Views/ChatList/ChatListNavLink.swift @@ -27,7 +27,7 @@ private let rowHeights: [DynamicTypeSize: CGFloat] = [ struct ChatListNavLink: View { @EnvironmentObject var chatModel: ChatModel @Environment(\.dynamicTypeSize) private var dynamicTypeSize - @State var chat: Chat + @ObservedObject var chat: Chat @State private var showContactRequestDialog = false @State private var showJoinGroupDialog = false @State private var showContactConnectionInfo = false @@ -57,6 +57,8 @@ struct ChatListNavLink: View { ) .swipeActions(edge: .leading, allowsFullSwipe: true) { markReadButton() + toggleFavoriteButton() + toggleNtfsButton(chat) } .swipeActions(edge: .trailing, allowsFullSwipe: true) { if !chat.chatItems.isEmpty { @@ -126,6 +128,8 @@ struct ChatListNavLink: View { .frame(height: rowHeights[dynamicTypeSize]) .swipeActions(edge: .leading, allowsFullSwipe: true) { markReadButton() + toggleFavoriteButton() + toggleNtfsButton(chat) } .swipeActions(edge: .trailing, allowsFullSwipe: true) { if !chat.chatItems.isEmpty { @@ -134,8 +138,6 @@ struct ChatListNavLink: View { if (groupInfo.membership.memberCurrent) { leaveGroupChatButton(groupInfo) } - } - .swipeActions(edge: .trailing) { if groupInfo.canDelete { deleteGroupChatButton(groupInfo) } @@ -171,6 +173,24 @@ struct ChatListNavLink: View { } + @ViewBuilder private func toggleFavoriteButton() -> some View { + if chat.chatInfo.chatSettings?.favorite == true { + Button { + toggleChatFavorite(chat, favorite: false) + } label: { + Label("Unfav.", systemImage: "star.slash") + } + .tint(.green) + } else { + Button { + toggleChatFavorite(chat, favorite: true) + } label: { + Label("Favorite", systemImage: "star.fill") + } + .tint(.green) + } + } + private func clearChatButton() -> some View { Button { AlertManager.shared.showAlert(clearChatAlert()) diff --git a/apps/ios/Shared/Views/ChatList/ChatListView.swift b/apps/ios/Shared/Views/ChatList/ChatListView.swift index c372acdd24..90ff8433ea 100644 --- a/apps/ios/Shared/Views/ChatList/ChatListView.swift +++ b/apps/ios/Shared/Views/ChatList/ChatListView.swift @@ -14,7 +14,8 @@ struct ChatListView: View { @Binding var showSettings: Bool @State private var searchText = "" @State private var showAddChat = false - @State var userPickerVisible = false + @State private var userPickerVisible = false + @AppStorage(DEFAULT_SHOW_UNREAD_AND_FAVORITES) private var showUnreadAndFavorites = false var body: some View { ZStack(alignment: .topLeading) { @@ -56,7 +57,6 @@ struct ChatListView: View { .onDisappear() { withAnimation { userPickerVisible = false } } .offset(x: -8) .listStyle(.plain) - .navigationTitle("Your chats") .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .navigationBarLeading) { @@ -84,17 +84,19 @@ struct ChatListView: View { } } ToolbarItem(placement: .principal) { - if (chatModel.incognito) { - HStack { - if (chatModel.chats.count > 8) { - Text("Your chats").font(.headline) - Spacer().frame(width: 16) - } - Image(systemName: "theatermasks").frame(maxWidth: 24, maxHeight: 24, alignment: .center).foregroundColor(.indigo) + HStack(spacing: 4) { + if (chatModel.incognito) { + Image(systemName: "theatermasks") + .foregroundColor(.indigo) + .padding(.trailing, 8) + } + Text("Chats") + .font(.headline) + if chatModel.chats.count > 0 { + toggleFilterButton() } - } else { - Text("Your chats").font(.headline) } + .frame(maxWidth: .infinity, alignment: .center) } ToolbarItem(placement: .navigationBarTrailing) { switch chatModel.chatRunning { @@ -106,6 +108,15 @@ struct ChatListView: View { } } + private func toggleFilterButton() -> some View { + Button { + showUnreadAndFavorites = !showUnreadAndFavorites + } label: { + Image(systemName: "line.3.horizontal.decrease.circle" + (showUnreadAndFavorites ? ".fill" : "")) + .foregroundColor(.accentColor) + } + } + private var chatList: some View { List { ForEach(filteredChats(), id: \.viewId) { chat in @@ -181,10 +192,12 @@ struct ChatListView: View { private func filteredChats() -> [Chat] { let s = searchText.trimmingCharacters(in: .whitespaces).localizedLowercase - return s == "" + return s == "" && !showUnreadAndFavorites ? chatModel.chats : chatModel.chats.filter { chat in - let contains = chat.chatInfo.chatViewName.localizedLowercase.contains(s) + let contains = s == "" + ? ((chat.chatInfo.chatSettings?.favorite ?? false) || chat.chatStats.unreadCount > 0 || chat.chatStats.unreadChat) + : chat.chatInfo.chatViewName.localizedLowercase.contains(s) switch chat.chatInfo { case let .direct(contact): return contains diff --git a/apps/ios/Shared/Views/ChatList/ChatPreviewView.swift b/apps/ios/Shared/Views/ChatList/ChatPreviewView.swift index c4d28c3440..7f2493dc26 100644 --- a/apps/ios/Shared/Views/ChatList/ChatPreviewView.swift +++ b/apps/ios/Shared/Views/ChatList/ChatPreviewView.swift @@ -126,6 +126,13 @@ struct ChatPreviewView: View { } else if !chat.chatInfo.ntfsEnabled { Image(systemName: "speaker.slash.fill") .foregroundColor(.secondary) + } else if chat.chatInfo.chatSettings?.favorite ?? false { + Image(systemName: "star.fill") + .resizable() + .scaledToFill() + .frame(width: 18, height: 18) + .padding(.trailing, 1) + .foregroundColor(.secondary.opacity(0.65)) } } } diff --git a/apps/ios/Shared/Views/UserSettings/SettingsView.swift b/apps/ios/Shared/Views/UserSettings/SettingsView.swift index 8533060c84..35b584ff93 100644 --- a/apps/ios/Shared/Views/UserSettings/SettingsView.swift +++ b/apps/ios/Shared/Views/UserSettings/SettingsView.swift @@ -49,6 +49,7 @@ let DEFAULT_SHOW_MUTE_PROFILE_ALERT = "showMuteProfileAlert" let DEFAULT_WHATS_NEW_VERSION = "defaultWhatsNewVersion" let DEFAULT_ONBOARDING_STAGE = "onboardingStage" let DEFAULT_CUSTOM_DISAPPEARING_MESSAGE_TIME = "customDisappearingMessageTime" +let DEFAULT_SHOW_UNREAD_AND_FAVORITES = "showUnreadAndFavorites" let appDefaults: [String: Any] = [ DEFAULT_SHOW_LA_NOTICE: false, @@ -78,6 +79,7 @@ let appDefaults: [String: Any] = [ DEFAULT_SHOW_MUTE_PROFILE_ALERT: true, DEFAULT_ONBOARDING_STAGE: OnboardingStage.onboardingComplete.rawValue, DEFAULT_CUSTOM_DISAPPEARING_MESSAGE_TIME: 300, + DEFAULT_SHOW_UNREAD_AND_FAVORITES: false ] enum SimpleXLinkMode: String, Identifiable { diff --git a/apps/ios/SimpleX Localizations/cs.xcloc/Localized Contents/cs.xliff b/apps/ios/SimpleX Localizations/cs.xcloc/Localized Contents/cs.xliff index 03eb28ac25..9f76e25910 100644 --- a/apps/ios/SimpleX Localizations/cs.xcloc/Localized Contents/cs.xliff +++ b/apps/ios/SimpleX Localizations/cs.xcloc/Localized Contents/cs.xliff @@ -2040,6 +2040,10 @@ Rychle a bez čekání, než bude odesílatel online! No comment provided by engineer. + + Favorite + No comment provided by engineer. + File will be deleted from servers. Soubor bude smazán ze serverů. @@ -4415,6 +4419,10 @@ Před zapnutím této funkce budete vyzváni k dokončení ověření. Neočekávaný stav přenášení No comment provided by engineer. + + Unfav. + No comment provided by engineer. + Unhide Odkrýt @@ -4972,11 +4980,6 @@ Chcete-li se připojit, požádejte svůj kontakt o vytvoření dalšího odkazu Vaše chat profily No comment provided by engineer. - - Your chats - Vaše konverzace - No comment provided by engineer. - Your contact needs to be online for the connection to complete. You can cancel this connection and remove the contact (and try later with a new link). diff --git a/apps/ios/SimpleX Localizations/de.xcloc/Localized Contents/de.xliff b/apps/ios/SimpleX Localizations/de.xcloc/Localized Contents/de.xliff index 1d863cc197..f6f9fec92f 100644 --- a/apps/ios/SimpleX Localizations/de.xcloc/Localized Contents/de.xliff +++ b/apps/ios/SimpleX Localizations/de.xcloc/Localized Contents/de.xliff @@ -2040,6 +2040,10 @@ Schnell und ohne warten auf den Absender, bis er online ist! No comment provided by engineer. + + Favorite + No comment provided by engineer. + File will be deleted from servers. Die Datei wird von den Servern gelöscht. @@ -4415,6 +4419,10 @@ Sie werden aufgefordert, die Authentifizierung abzuschließen, bevor diese Funkt Unerwarteter Migrationsstatus No comment provided by engineer. + + Unfav. + No comment provided by engineer. + Unhide Verbergen aufheben @@ -4972,11 +4980,6 @@ Bitten Sie Ihren Kontakt darum einen weiteren Verbindungs-Link zu erzeugen, um s Meine Chat-Profile No comment provided by engineer. - - Your chats - Meine Chats - No comment provided by engineer. - Your contact needs to be online for the connection to complete. You can cancel this connection and remove the contact (and try later with a new link). diff --git a/apps/ios/SimpleX Localizations/en.xcloc/Localized Contents/en.xliff b/apps/ios/SimpleX Localizations/en.xcloc/Localized Contents/en.xliff index af65f8fb08..c565923c41 100644 --- a/apps/ios/SimpleX Localizations/en.xcloc/Localized Contents/en.xliff +++ b/apps/ios/SimpleX Localizations/en.xcloc/Localized Contents/en.xliff @@ -2040,6 +2040,11 @@ Fast and no wait until the sender is online! No comment provided by engineer. + + Favorite + Favorite + No comment provided by engineer. + File will be deleted from servers. File will be deleted from servers. @@ -4416,6 +4421,11 @@ You will be prompted to complete authentication before this feature is enabled.< Unexpected migration state No comment provided by engineer. + + Unfav. + Unfav. + No comment provided by engineer. + Unhide Unhide @@ -4973,11 +4983,6 @@ To connect, please ask your contact to create another connection link and check Your chat profiles No comment provided by engineer. - - Your chats - Your chats - No comment provided by engineer. - Your contact needs to be online for the connection to complete. You can cancel this connection and remove the contact (and try later with a new link). diff --git a/apps/ios/SimpleX Localizations/es.xcloc/Localized Contents/es.xliff b/apps/ios/SimpleX Localizations/es.xcloc/Localized Contents/es.xliff index c0e6caf3ff..d0d5e1af28 100644 --- a/apps/ios/SimpleX Localizations/es.xcloc/Localized Contents/es.xliff +++ b/apps/ios/SimpleX Localizations/es.xcloc/Localized Contents/es.xliff @@ -2040,6 +2040,10 @@ ¡Rápido y sin necesidad de esperar a que el remitente esté en línea! No comment provided by engineer. + + Favorite + No comment provided by engineer. + File will be deleted from servers. El archivo será eliminado de los servidores. @@ -4415,6 +4419,10 @@ Se te pedirá que completes la autenticación antes de activar esta función.Estado de migración inesperado No comment provided by engineer. + + Unfav. + No comment provided by engineer. + Unhide Mostrar @@ -4973,11 +4981,6 @@ Para conectarte, pide a tu contacto que cree otro enlace de conexión y comprueb Mis perfiles No comment provided by engineer. - - Your chats - Mis chats - No comment provided by engineer. - Your contact needs to be online for the connection to complete. You can cancel this connection and remove the contact (and try later with a new link). diff --git a/apps/ios/SimpleX Localizations/fr.xcloc/Localized Contents/fr.xliff b/apps/ios/SimpleX Localizations/fr.xcloc/Localized Contents/fr.xliff index ae457b029d..c7f123f6ed 100644 --- a/apps/ios/SimpleX Localizations/fr.xcloc/Localized Contents/fr.xliff +++ b/apps/ios/SimpleX Localizations/fr.xcloc/Localized Contents/fr.xliff @@ -2040,6 +2040,10 @@ Rapide et ne nécessitant pas d'attendre que l'expéditeur soit en ligne ! No comment provided by engineer. + + Favorite + No comment provided by engineer. + File will be deleted from servers. Le fichier sera supprimé des serveurs. @@ -4415,6 +4419,10 @@ Vous serez invité à confirmer l'authentification avant que cette fonction ne s État de la migration inattendu No comment provided by engineer. + + Unfav. + No comment provided by engineer. + Unhide Dévoiler @@ -4972,11 +4980,6 @@ Pour vous connecter, veuillez demander à votre contact de créer un autre lien Vos profils de chat No comment provided by engineer. - - Your chats - Vos chats - No comment provided by engineer. - Your contact needs to be online for the connection to complete. You can cancel this connection and remove the contact (and try later with a new link). diff --git a/apps/ios/SimpleX Localizations/it.xcloc/Localized Contents/it.xliff b/apps/ios/SimpleX Localizations/it.xcloc/Localized Contents/it.xliff index e72bdd3626..2d42aa1f45 100644 --- a/apps/ios/SimpleX Localizations/it.xcloc/Localized Contents/it.xliff +++ b/apps/ios/SimpleX Localizations/it.xcloc/Localized Contents/it.xliff @@ -2040,6 +2040,10 @@ Veloce e senza aspettare che il mittente sia in linea! No comment provided by engineer. + + Favorite + No comment provided by engineer. + File will be deleted from servers. Il file verrà eliminato dai server. @@ -4415,6 +4419,10 @@ Ti verrà chiesto di completare l'autenticazione prima di attivare questa funzio Stato di migrazione imprevisto No comment provided by engineer. + + Unfav. + No comment provided by engineer. + Unhide Svela @@ -4972,11 +4980,6 @@ Per connetterti, chiedi al tuo contatto di creare un altro link di connessione e I tuoi profili di chat No comment provided by engineer. - - Your chats - Le tue chat - No comment provided by engineer. - Your contact needs to be online for the connection to complete. You can cancel this connection and remove the contact (and try later with a new link). diff --git a/apps/ios/SimpleX Localizations/ja.xcloc/Localized Contents/ja.xliff b/apps/ios/SimpleX Localizations/ja.xcloc/Localized Contents/ja.xliff index 2e22257d01..ba69f538a4 100644 --- a/apps/ios/SimpleX Localizations/ja.xcloc/Localized Contents/ja.xliff +++ b/apps/ios/SimpleX Localizations/ja.xcloc/Localized Contents/ja.xliff @@ -2039,6 +2039,10 @@ 送信者がオンラインになるまでの待ち時間がなく、速い! No comment provided by engineer. + + Favorite + No comment provided by engineer. + File will be deleted from servers. ファイルはサーバーから削除されます。 @@ -4413,6 +4417,10 @@ You will be prompted to complete authentication before this feature is enabled.< 予期しない移行状態 No comment provided by engineer. + + Unfav. + No comment provided by engineer. + Unhide 表示にする @@ -4970,11 +4978,6 @@ To connect, please ask your contact to create another connection link and check あなたのチャットプロフィール No comment provided by engineer. - - Your chats - あなたのチャット - No comment provided by engineer. - Your contact needs to be online for the connection to complete. You can cancel this connection and remove the contact (and try later with a new link). diff --git a/apps/ios/SimpleX Localizations/nl.xcloc/Localized Contents/nl.xliff b/apps/ios/SimpleX Localizations/nl.xcloc/Localized Contents/nl.xliff index d6b98e7c79..b60943c264 100644 --- a/apps/ios/SimpleX Localizations/nl.xcloc/Localized Contents/nl.xliff +++ b/apps/ios/SimpleX Localizations/nl.xcloc/Localized Contents/nl.xliff @@ -2040,6 +2040,10 @@ Snel en niet wachten tot de afzender online is! No comment provided by engineer. + + Favorite + No comment provided by engineer. + File will be deleted from servers. Het bestand wordt van de servers verwijderd. @@ -4415,6 +4419,10 @@ U wordt gevraagd de authenticatie te voltooien voordat deze functie wordt ingesc Onverwachte migratiestatus No comment provided by engineer. + + Unfav. + No comment provided by engineer. + Unhide zichtbaar maken @@ -4972,11 +4980,6 @@ Om verbinding te maken, vraagt u uw contactpersoon om een andere verbinding link Uw chat profielen No comment provided by engineer. - - Your chats - Jouw gesprekken - No comment provided by engineer. - Your contact needs to be online for the connection to complete. You can cancel this connection and remove the contact (and try later with a new link). diff --git a/apps/ios/SimpleX Localizations/pl.xcloc/Localized Contents/pl.xliff b/apps/ios/SimpleX Localizations/pl.xcloc/Localized Contents/pl.xliff index 8e41d51764..d1a3bb0058 100644 --- a/apps/ios/SimpleX Localizations/pl.xcloc/Localized Contents/pl.xliff +++ b/apps/ios/SimpleX Localizations/pl.xcloc/Localized Contents/pl.xliff @@ -2040,6 +2040,10 @@ Szybko i bez czekania aż nadawca będzie online! No comment provided by engineer. + + Favorite + No comment provided by engineer. + File will be deleted from servers. Plik zostanie usunięty z serwerów. @@ -4415,6 +4419,10 @@ Przed włączeniem tej funkcji zostanie wyświetlony monit uwierzytelniania.Nieoczekiwany stan migracji No comment provided by engineer. + + Unfav. + No comment provided by engineer. + Unhide Odkryj @@ -4972,11 +4980,6 @@ Aby się połączyć, poproś Twój kontakt o utworzenie kolejnego linku połąc Twoje profile czatu No comment provided by engineer. - - Your chats - Twoje czaty - No comment provided by engineer. - Your contact needs to be online for the connection to complete. You can cancel this connection and remove the contact (and try later with a new link). diff --git a/apps/ios/SimpleX Localizations/ru.xcloc/Localized Contents/ru.xliff b/apps/ios/SimpleX Localizations/ru.xcloc/Localized Contents/ru.xliff index 34749b9e5f..42c7c2d566 100644 --- a/apps/ios/SimpleX Localizations/ru.xcloc/Localized Contents/ru.xliff +++ b/apps/ios/SimpleX Localizations/ru.xcloc/Localized Contents/ru.xliff @@ -2040,6 +2040,10 @@ Быстрые и не нужно ждать, когда отправитель онлайн! No comment provided by engineer. + + Favorite + No comment provided by engineer. + File will be deleted from servers. Файл будет удалён с серверов. @@ -4415,6 +4419,10 @@ You will be prompted to complete authentication before this feature is enabled.< Неожиданная ошибка при перемещении данных чата No comment provided by engineer. + + Unfav. + No comment provided by engineer. + Unhide Раскрыть @@ -4972,11 +4980,6 @@ To connect, please ask your contact to create another connection link and check Ваши профили чата No comment provided by engineer. - - Your chats - Ваши чаты - No comment provided by engineer. - Your contact needs to be online for the connection to complete. You can cancel this connection and remove the contact (and try later with a new link). diff --git a/apps/ios/SimpleX Localizations/zh-Hans.xcloc/Localized Contents/zh-Hans.xliff b/apps/ios/SimpleX Localizations/zh-Hans.xcloc/Localized Contents/zh-Hans.xliff index 8c8c7aa2f0..b02ca176d9 100644 --- a/apps/ios/SimpleX Localizations/zh-Hans.xcloc/Localized Contents/zh-Hans.xliff +++ b/apps/ios/SimpleX Localizations/zh-Hans.xcloc/Localized Contents/zh-Hans.xliff @@ -2040,6 +2040,10 @@ 快速且无需等待发件人在线! No comment provided by engineer. + + Favorite + No comment provided by engineer. + File will be deleted from servers. 文件将从服务器中删除。 @@ -4415,6 +4419,10 @@ You will be prompted to complete authentication before this feature is enabled.< 未预料的迁移状态 No comment provided by engineer. + + Unfav. + No comment provided by engineer. + Unhide 取消隐藏 @@ -4972,11 +4980,6 @@ To connect, please ask your contact to create another connection link and check 您的聊天资料 No comment provided by engineer. - - Your chats - 您的聊天 - No comment provided by engineer. - Your contact needs to be online for the connection to complete. You can cancel this connection and remove the contact (and try later with a new link). diff --git a/apps/ios/SimpleXChat/APITypes.swift b/apps/ios/SimpleXChat/APITypes.swift index 7e590a40fa..af23f7d676 100644 --- a/apps/ios/SimpleXChat/APITypes.swift +++ b/apps/ios/SimpleXChat/APITypes.swift @@ -1072,12 +1072,14 @@ public struct KeepAliveOpts: Codable, Equatable { public struct ChatSettings: Codable { public var enableNtfs: Bool + public var favorite: Bool? = false - public init(enableNtfs: Bool) { + public init(enableNtfs: Bool, favorite: Bool?) { self.enableNtfs = enableNtfs + self.favorite = favorite } - public static let defaults: ChatSettings = ChatSettings(enableNtfs: true) + public static let defaults: ChatSettings = ChatSettings(enableNtfs: true, favorite: false) } public struct ConnectionStats: Codable { diff --git a/apps/ios/SimpleXChat/ChatTypes.swift b/apps/ios/SimpleXChat/ChatTypes.swift index 1fe081d0d8..ca60f31c87 100644 --- a/apps/ios/SimpleXChat/ChatTypes.swift +++ b/apps/ios/SimpleXChat/ChatTypes.swift @@ -1240,10 +1240,14 @@ public enum ChatInfo: Identifiable, Decodable, NamedChat { } public var ntfsEnabled: Bool { + self.chatSettings?.enableNtfs ?? false + } + + public var chatSettings: ChatSettings? { switch self { - case let .direct(contact): return contact.chatSettings.enableNtfs - case let .group(groupInfo): return groupInfo.chatSettings.enableNtfs - default: return false + case let .direct(contact): return contact.chatSettings + case let .group(groupInfo): return groupInfo.chatSettings + default: return nil } } diff --git a/apps/ios/cs.lproj/Localizable.strings b/apps/ios/cs.lproj/Localizable.strings index 0939e9db5a..4c60fe872b 100644 --- a/apps/ios/cs.lproj/Localizable.strings +++ b/apps/ios/cs.lproj/Localizable.strings @@ -3343,9 +3343,6 @@ /* No comment provided by engineer. */ "Your chat profiles" = "Vaše chat profily"; -/* No comment provided by engineer. */ -"Your chats" = "Vaše konverzace"; - /* No comment provided by engineer. */ "Your contact needs to be online for the connection to complete.\nYou can cancel this connection and remove the contact (and try later with a new link)." = "K dokončení připojení, musí být váš kontakt online.\nToto připojení můžete zrušit a kontakt odebrat (a zkusit to později s novým odkazem)."; diff --git a/apps/ios/de.lproj/Localizable.strings b/apps/ios/de.lproj/Localizable.strings index cef8b62936..7315656937 100644 --- a/apps/ios/de.lproj/Localizable.strings +++ b/apps/ios/de.lproj/Localizable.strings @@ -3343,9 +3343,6 @@ /* No comment provided by engineer. */ "Your chat profiles" = "Meine Chat-Profile"; -/* No comment provided by engineer. */ -"Your chats" = "Meine Chats"; - /* No comment provided by engineer. */ "Your contact needs to be online for the connection to complete.\nYou can cancel this connection and remove the contact (and try later with a new link)." = "Damit die Verbindung hergestellt werden kann, muss Ihr Kontakt online sein.\nSie können diese Verbindung abbrechen und den Kontakt entfernen (und es später nochmals mit einem neuen Link versuchen)."; diff --git a/apps/ios/es.lproj/Localizable.strings b/apps/ios/es.lproj/Localizable.strings index 48288bc63c..f68347c3ce 100644 --- a/apps/ios/es.lproj/Localizable.strings +++ b/apps/ios/es.lproj/Localizable.strings @@ -3343,9 +3343,6 @@ /* No comment provided by engineer. */ "Your chat profiles" = "Mis perfiles"; -/* No comment provided by engineer. */ -"Your chats" = "Mis chats"; - /* No comment provided by engineer. */ "Your contact needs to be online for the connection to complete.\nYou can cancel this connection and remove the contact (and try later with a new link)." = "Tu contacto debe estar en línea para que se complete la conexión.\nPuedes cancelar esta conexión y eliminar el contacto (e intentarlo más tarde con un enlace nuevo)."; diff --git a/apps/ios/fr.lproj/Localizable.strings b/apps/ios/fr.lproj/Localizable.strings index b9cc5f8e10..d70e0a2846 100644 --- a/apps/ios/fr.lproj/Localizable.strings +++ b/apps/ios/fr.lproj/Localizable.strings @@ -3343,9 +3343,6 @@ /* No comment provided by engineer. */ "Your chat profiles" = "Vos profils de chat"; -/* No comment provided by engineer. */ -"Your chats" = "Vos chats"; - /* No comment provided by engineer. */ "Your contact needs to be online for the connection to complete.\nYou can cancel this connection and remove the contact (and try later with a new link)." = "Votre contact a besoin d'être en ligne pour completer la connexion.\nVous pouvez annuler la connexion et supprimer le contact (et réessayer plus tard avec un autre lien)."; diff --git a/apps/ios/it.lproj/Localizable.strings b/apps/ios/it.lproj/Localizable.strings index fcd888ebbf..b6f9c8dae1 100644 --- a/apps/ios/it.lproj/Localizable.strings +++ b/apps/ios/it.lproj/Localizable.strings @@ -3340,9 +3340,6 @@ /* No comment provided by engineer. */ "Your chat profiles" = "I tuoi profili di chat"; -/* No comment provided by engineer. */ -"Your chats" = "Le tue chat"; - /* No comment provided by engineer. */ "Your contact needs to be online for the connection to complete.\nYou can cancel this connection and remove the contact (and try later with a new link)." = "Il tuo contatto deve essere in linea per completare la connessione.\nPuoi annullare questa connessione e rimuovere il contatto (e riprovare più tardi con un link nuovo)."; diff --git a/apps/ios/ja.lproj/Localizable.strings b/apps/ios/ja.lproj/Localizable.strings index e1768da252..2377e5c8e8 100644 --- a/apps/ios/ja.lproj/Localizable.strings +++ b/apps/ios/ja.lproj/Localizable.strings @@ -3334,9 +3334,6 @@ /* No comment provided by engineer. */ "Your chat profiles" = "あなたのチャットプロフィール"; -/* No comment provided by engineer. */ -"Your chats" = "あなたのチャット"; - /* No comment provided by engineer. */ "Your contact needs to be online for the connection to complete.\nYou can cancel this connection and remove the contact (and try later with a new link)." = "接続を完了するには、連絡相手がオンラインになる必要があります。\nこの接続をキャンセルして、連絡先を削除をすることもできます (後でやり直すこともできます)。"; diff --git a/apps/ios/nl.lproj/Localizable.strings b/apps/ios/nl.lproj/Localizable.strings index 8c01806437..a75cda064c 100644 --- a/apps/ios/nl.lproj/Localizable.strings +++ b/apps/ios/nl.lproj/Localizable.strings @@ -3343,9 +3343,6 @@ /* No comment provided by engineer. */ "Your chat profiles" = "Uw chat profielen"; -/* No comment provided by engineer. */ -"Your chats" = "Jouw gesprekken"; - /* No comment provided by engineer. */ "Your contact needs to be online for the connection to complete.\nYou can cancel this connection and remove the contact (and try later with a new link)." = "Uw contactpersoon moet online zijn om de verbinding te voltooien.\nU kunt deze verbinding verbreken en het contact verwijderen (en later proberen met een nieuwe link)."; diff --git a/apps/ios/pl.lproj/Localizable.strings b/apps/ios/pl.lproj/Localizable.strings index 27540849e3..ebfe72ec92 100644 --- a/apps/ios/pl.lproj/Localizable.strings +++ b/apps/ios/pl.lproj/Localizable.strings @@ -3343,9 +3343,6 @@ /* No comment provided by engineer. */ "Your chat profiles" = "Twoje profile czatu"; -/* No comment provided by engineer. */ -"Your chats" = "Twoje czaty"; - /* No comment provided by engineer. */ "Your contact needs to be online for the connection to complete.\nYou can cancel this connection and remove the contact (and try later with a new link)." = "Twój kontakt musi być online, aby połączenie zostało zakończone.\nMożesz anulować to połączenie i usunąć kontakt (i spróbować później z nowym linkiem)."; diff --git a/apps/ios/ru.lproj/Localizable.strings b/apps/ios/ru.lproj/Localizable.strings index 360d363f0e..a49ede32cc 100644 --- a/apps/ios/ru.lproj/Localizable.strings +++ b/apps/ios/ru.lproj/Localizable.strings @@ -3340,9 +3340,6 @@ /* No comment provided by engineer. */ "Your chat profiles" = "Ваши профили чата"; -/* No comment provided by engineer. */ -"Your chats" = "Ваши чаты"; - /* No comment provided by engineer. */ "Your contact needs to be online for the connection to complete.\nYou can cancel this connection and remove the contact (and try later with a new link)." = "Ваш контакт должен быть в сети чтобы установить соединение.\nВы можете отменить соединение и удалить контакт (и попробовать позже с другой ссылкой)."; diff --git a/apps/ios/zh-Hans.lproj/Localizable.strings b/apps/ios/zh-Hans.lproj/Localizable.strings index 3276265636..33dd6ef34c 100644 --- a/apps/ios/zh-Hans.lproj/Localizable.strings +++ b/apps/ios/zh-Hans.lproj/Localizable.strings @@ -3343,9 +3343,6 @@ /* No comment provided by engineer. */ "Your chat profiles" = "您的聊天资料"; -/* No comment provided by engineer. */ -"Your chats" = "您的聊天"; - /* No comment provided by engineer. */ "Your contact needs to be online for the connection to complete.\nYou can cancel this connection and remove the contact (and try later with a new link)." = "您的联系人需要在线才能完成连接。\n您可以取消此连接并删除联系人(然后尝试使用新链接)。";