|
|
|
@ -1309,7 +1309,7 @@ extension ConversationVC:
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func handleReplyButtonTapped(for cellViewModel: MessageViewModel) {
|
|
|
|
|
reply(cellViewModel)
|
|
|
|
|
reply(cellViewModel, completion: nil)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func startThread(
|
|
|
|
@ -1883,7 +1883,7 @@ extension ConversationVC:
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func retry(_ cellViewModel: MessageViewModel) {
|
|
|
|
|
func retry(_ cellViewModel: MessageViewModel, completion: (() -> Void)?) {
|
|
|
|
|
guard cellViewModel.id != MessageViewModel.optimisticUpdateId else {
|
|
|
|
|
guard
|
|
|
|
|
let optimisticMessageId: UUID = cellViewModel.optimisticMessageId,
|
|
|
|
@ -1895,7 +1895,10 @@ extension ConversationVC:
|
|
|
|
|
title: "theError".localized(),
|
|
|
|
|
body: .text("shareExtensionDatabaseError".localized()),
|
|
|
|
|
cancelTitle: "okay".localized(),
|
|
|
|
|
cancelStyle: .alert_text
|
|
|
|
|
cancelStyle: .alert_text,
|
|
|
|
|
afterClosed: {
|
|
|
|
|
completion?()
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@ -1905,6 +1908,7 @@ extension ConversationVC:
|
|
|
|
|
|
|
|
|
|
// Try to send the optimistic message again
|
|
|
|
|
sendMessage(optimisticData: optimisticMessageData)
|
|
|
|
|
completion?()
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1953,9 +1957,11 @@ extension ConversationVC:
|
|
|
|
|
using: dependencies
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
completion?()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func reply(_ cellViewModel: MessageViewModel) {
|
|
|
|
|
func reply(_ cellViewModel: MessageViewModel, completion: (() -> Void)?) {
|
|
|
|
|
let maybeQuoteDraft: QuotedReplyModel? = QuotedReplyModel.quotedReplyForSending(
|
|
|
|
|
threadId: self.viewModel.threadData.threadId,
|
|
|
|
|
authorId: cellViewModel.authorId,
|
|
|
|
@ -1976,9 +1982,10 @@ extension ConversationVC:
|
|
|
|
|
isOutgoing: (cellViewModel.variant == .standardOutgoing)
|
|
|
|
|
)
|
|
|
|
|
_ = snInputView.becomeFirstResponder()
|
|
|
|
|
completion?()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func copy(_ cellViewModel: MessageViewModel) {
|
|
|
|
|
func copy(_ cellViewModel: MessageViewModel, completion: (() -> Void)?) {
|
|
|
|
|
switch cellViewModel.cellType {
|
|
|
|
|
case .typingIndicator, .dateHeader, .unreadMarker: break
|
|
|
|
|
|
|
|
|
@ -2014,9 +2021,11 @@ extension ConversationVC:
|
|
|
|
|
inset: Values.largeSpacing + (self?.inputAccessoryView?.frame.height ?? 0)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
completion?()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func copySessionID(_ cellViewModel: MessageViewModel) {
|
|
|
|
|
func copySessionID(_ cellViewModel: MessageViewModel, completion: (() -> Void)?) {
|
|
|
|
|
guard cellViewModel.variant == .standardIncoming else { return }
|
|
|
|
|
|
|
|
|
|
UIPasteboard.general.string = cellViewModel.authorId
|
|
|
|
@ -2028,6 +2037,8 @@ extension ConversationVC:
|
|
|
|
|
inset: Values.largeSpacing + (self?.inputAccessoryView?.frame.height ?? 0)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
completion?()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func delete(_ cellViewModel: MessageViewModel, completion: (() -> Void)?) {
|
|
|
|
@ -2114,12 +2125,12 @@ extension ConversationVC:
|
|
|
|
|
inset: (self?.inputAccessoryView?.frame.height ?? Values.mediumSpacing) + Values.smallSpacing
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
completion?()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
afterClosed: { [weak self] in
|
|
|
|
|
completion?()
|
|
|
|
|
self?.becomeFirstResponder()
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
@ -2132,7 +2143,7 @@ extension ConversationVC:
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func save(_ cellViewModel: MessageViewModel) {
|
|
|
|
|
func save(_ cellViewModel: MessageViewModel, completion: (() -> Void)?) {
|
|
|
|
|
guard cellViewModel.cellType == .mediaMessage else { return }
|
|
|
|
|
|
|
|
|
|
let mediaAttachments: [(Attachment, String)] = (cellViewModel.attachments ?? [])
|
|
|
|
@ -2191,6 +2202,8 @@ extension ConversationVC:
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
completion?()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ban(_ cellViewModel: MessageViewModel, completion: (() -> Void)?) {
|
|
|
|
@ -2226,23 +2239,22 @@ extension ConversationVC:
|
|
|
|
|
.receive(on: DispatchQueue.main, using: dependencies)
|
|
|
|
|
.sinkUntilComplete(
|
|
|
|
|
receiveCompletion: { result in
|
|
|
|
|
switch result {
|
|
|
|
|
case .finished:
|
|
|
|
|
DispatchQueue.main.async { [weak self] in
|
|
|
|
|
DispatchQueue.main.async { [weak self] in
|
|
|
|
|
switch result {
|
|
|
|
|
case .finished:
|
|
|
|
|
self?.viewModel.showToast(
|
|
|
|
|
text: "banUserBanned".localized(),
|
|
|
|
|
backgroundColor: .backgroundSecondary,
|
|
|
|
|
inset: (self?.inputAccessoryView?.frame.height ?? Values.mediumSpacing) + Values.smallSpacing
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
case .failure:
|
|
|
|
|
DispatchQueue.main.async { [weak self] in
|
|
|
|
|
case .failure:
|
|
|
|
|
self?.viewModel.showToast(
|
|
|
|
|
text: "banErrorFailed".localized(),
|
|
|
|
|
backgroundColor: .backgroundSecondary,
|
|
|
|
|
inset: (self?.inputAccessoryView?.frame.height ?? Values.mediumSpacing) + Values.smallSpacing
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
completion?()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
@ -2291,23 +2303,22 @@ extension ConversationVC:
|
|
|
|
|
.receive(on: DispatchQueue.main, using: dependencies)
|
|
|
|
|
.sinkUntilComplete(
|
|
|
|
|
receiveCompletion: { result in
|
|
|
|
|
switch result {
|
|
|
|
|
case .finished:
|
|
|
|
|
DispatchQueue.main.async { [weak self] in
|
|
|
|
|
DispatchQueue.main.async { [weak self] in
|
|
|
|
|
switch result {
|
|
|
|
|
case .finished:
|
|
|
|
|
self?.viewModel.showToast(
|
|
|
|
|
text: "banUserBanned".localized(),
|
|
|
|
|
backgroundColor: .backgroundSecondary,
|
|
|
|
|
inset: (self?.inputAccessoryView?.frame.height ?? Values.mediumSpacing) + Values.smallSpacing
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
case .failure:
|
|
|
|
|
DispatchQueue.main.async { [weak self] in
|
|
|
|
|
case .failure:
|
|
|
|
|
self?.viewModel.showToast(
|
|
|
|
|
text: "banErrorFailed".localized(),
|
|
|
|
|
backgroundColor: .backgroundSecondary,
|
|
|
|
|
inset: (self?.inputAccessoryView?.frame.height ?? Values.mediumSpacing) + Values.smallSpacing
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
completion?()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
@ -2315,7 +2326,6 @@ extension ConversationVC:
|
|
|
|
|
self?.becomeFirstResponder()
|
|
|
|
|
},
|
|
|
|
|
afterClosed: { [weak self] in
|
|
|
|
|
completion?()
|
|
|
|
|
self?.becomeFirstResponder()
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|