mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-28 22:18:29 +00:00
mobile: message actions (reply, share, copy) (#431)
* ios: add context menu to messages * ios: UI for replies with quotes * fix: scrolling crashing in chat * ios: UI for message replies with quotes * android: UI for message replies * android: messages with quotes * android: update imports * android: refactor ChatItemView * remove comments
This commit is contained in:
@@ -22,6 +22,7 @@ enum ChatCommand {
|
||||
case apiGetChats
|
||||
case apiGetChat(type: ChatType, id: Int64)
|
||||
case apiSendMessage(type: ChatType, id: Int64, msg: MsgContent)
|
||||
case apiSendMessageQuote(type: ChatType, id: Int64, itemId: Int64, msg: MsgContent)
|
||||
case getUserSMPServers
|
||||
case setUserSMPServers(smpServers: [String])
|
||||
case addContact
|
||||
@@ -45,6 +46,7 @@ enum ChatCommand {
|
||||
case .apiGetChats: return "/_get chats"
|
||||
case let .apiGetChat(type, id): return "/_get chat \(ref(type, id)) count=100"
|
||||
case let .apiSendMessage(type, id, mc): return "/_send \(ref(type, id)) \(mc.cmdString)"
|
||||
case let .apiSendMessageQuote(type, id, itemId, mc): return "/_send_quote \(ref(type, id)) \(itemId) \(mc.cmdString)"
|
||||
case .getUserSMPServers: return "/smp_servers"
|
||||
case let .setUserSMPServers(smpServers): return "/smp_servers \(smpServersStr(smpServers: smpServers))"
|
||||
case .addContact: return "/connect"
|
||||
@@ -71,6 +73,7 @@ enum ChatCommand {
|
||||
case .apiGetChats: return "apiGetChats"
|
||||
case .apiGetChat: return "apiGetChat"
|
||||
case .apiSendMessage: return "apiSendMessage"
|
||||
case .apiSendMessageQuote: return "apiSendMessageQuote"
|
||||
case .getUserSMPServers: return "getUserSMPServers"
|
||||
case .setUserSMPServers: return "setUserSMPServers"
|
||||
case .addContact: return "addContact"
|
||||
@@ -362,9 +365,14 @@ func apiGetChat(type: ChatType, id: Int64) async throws -> Chat {
|
||||
throw r
|
||||
}
|
||||
|
||||
func apiSendMessage(type: ChatType, id: Int64, msg: MsgContent) async throws -> ChatItem {
|
||||
func apiSendMessage(type: ChatType, id: Int64, quotedItemId: Int64?, msg: MsgContent) async throws -> ChatItem {
|
||||
let chatModel = ChatModel.shared
|
||||
let cmd = ChatCommand.apiSendMessage(type: type, id: id, msg: msg)
|
||||
let cmd: ChatCommand
|
||||
if let itemId = quotedItemId {
|
||||
cmd = .apiSendMessageQuote(type: type, id: id, itemId: itemId, msg: msg)
|
||||
} else {
|
||||
cmd = .apiSendMessage(type: type, id: id, msg: msg)
|
||||
}
|
||||
let r: ChatResponse
|
||||
if type == .direct {
|
||||
var cItem: ChatItem!
|
||||
|
||||
Reference in New Issue
Block a user