From 148261a1ee66e067d68795e8bea3c075b092cd99 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Thu, 26 Jan 2023 23:28:56 +0000 Subject: [PATCH] ios: allow to reply in another chat without losing draft --- apps/ios/Shared/Views/Chat/ChatView.swift | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/apps/ios/Shared/Views/Chat/ChatView.swift b/apps/ios/Shared/Views/Chat/ChatView.swift index 96d0874f0e..e78589313f 100644 --- a/apps/ios/Shared/Views/Chat/ChatView.swift +++ b/apps/ios/Shared/Views/Chat/ChatView.swift @@ -76,20 +76,12 @@ struct ChatView: View { .onChange(of: chatModel.chatId) { _ in if chatModel.chatId == nil { dismiss() } } - .onChange(of: "\(composeState.empty) \(composeState.noPreview) \(composeState.message)") { _ in - if !composeState.empty { - chatModel.draft = composeState - chatModel.draftChatId = chat.id - } else if chatModel.draftChatId == chat.id { - chatModel.draft = nil - chatModel.draftChatId = nil - } - } .onDisappear { if chatModel.chatId == cInfo.id { chatModel.chatId = nil - if chatModel.draftChatId == cInfo.id { + if !composeState.empty { chatModel.draft = composeState + chatModel.draftChatId = chat.id } DispatchQueue.main.asyncAfter(deadline: .now() + 0.35) { if chatModel.chatId == nil {