Fix leftover merge conflicts

pull/333/head
Niels Andriesse 5 years ago
parent 7acb6c9ac3
commit 57f7bc88eb

@ -360,43 +360,8 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIViewC
message = "Because you are the creator of this group it will be deleted for everyone. This cannot be undone." message = "Because you are the creator of this group it will be deleted for everyone. This cannot be undone."
} }
let alert = UIAlertController(title: NSLocalizedString("CONVERSATION_DELETE_CONFIRMATION_ALERT_TITLE", comment: ""), message: message, preferredStyle: .alert) let alert = UIAlertController(title: NSLocalizedString("CONVERSATION_DELETE_CONFIRMATION_ALERT_TITLE", comment: ""), message: message, preferredStyle: .alert)
<<<<<<< HEAD
alert.addAction(UIAlertAction(title: NSLocalizedString("TXT_DELETE_TITLE", comment: ""), style: .destructive) { [weak self] _ in alert.addAction(UIAlertAction(title: NSLocalizedString("TXT_DELETE_TITLE", comment: ""), style: .destructive) { [weak self] _ in
self?.delete(thread) self?.delete(thread)
=======
alert.addAction(UIAlertAction(title: NSLocalizedString("TXT_DELETE_TITLE", comment: ""), style: .destructive) { _ in
Storage.write { transaction in
Storage.shared.cancelPendingMessageSendJobs(for: thread.uniqueId!, using: transaction)
if let openGroup = openGroup {
var messageIDs: Set<String> = []
thread.enumerateInteractions(with: transaction) { interaction, _ in
messageIDs.insert(interaction.uniqueId!)
}
OWSPrimaryStorage.shared().updateMessageIDCollectionByPruningMessagesWithIDs(messageIDs, in: transaction)
transaction.removeObject(forKey: "\(openGroup.server).\(openGroup.channel)", inCollection: Storage.lastMessageServerIDCollection)
transaction.removeObject(forKey: "\(openGroup.server).\(openGroup.channel)", inCollection: Storage.lastDeletionServerIDCollection)
let _ = OpenGroupAPI.leave(openGroup.channel, on: openGroup.server)
thread.removeAllThreadInteractions(with: transaction)
thread.remove(with: transaction)
} else if let thread = thread as? TSGroupThread, thread.isClosedGroup == true {
let groupID = thread.groupModel.groupId
let groupPublicKey = LKGroupUtilities.getDecodedGroupID(groupID)
do {
try MessageSender.leave(groupPublicKey, using: transaction)
} catch {
// TODO: Handle
}
Storage.write { transaction in
thread.removeAllThreadInteractions(with: transaction)
thread.remove(with: transaction)
}
} else {
thread.removeAllThreadInteractions(with: transaction)
thread.remove(with: transaction)
}
}
NotificationCenter.default.post(name: .threadDeleted, object: nil, userInfo: [ "threadId" : thread.uniqueId! ])
>>>>>>> dev
}) })
alert.addAction(UIAlertAction(title: NSLocalizedString("TXT_CANCEL_TITLE", comment: ""), style: .default) { _ in }) alert.addAction(UIAlertAction(title: NSLocalizedString("TXT_CANCEL_TITLE", comment: ""), style: .default) { _ in })
guard let self = self else { return } guard let self = self else { return }

@ -98,15 +98,9 @@ public final class AttachmentDownloadJob : NSObject, Job, NSCoding { // NSObject
return handleFailure(error) return handleFailure(error)
} }
OWSFileSystem.deleteFile(temporaryFilePath.absoluteString) OWSFileSystem.deleteFile(temporaryFilePath.absoluteString)
<<<<<<< HEAD
storage.write(with: { transaction in
storage.persist(stream, associatedWith: self.tsMessageID, using: transaction)
}, completion: { })
=======
storage.write { transaction in storage.write { transaction in
storage.persist(stream, associatedWith: self.tsIncomingMessageID, using: transaction) storage.persist(stream, associatedWith: self.tsMessageID, using: transaction)
} }
>>>>>>> dev
}.catch(on: DispatchQueue.global()) { error in }.catch(on: DispatchQueue.global()) { error in
handleFailure(error) handleFailure(error)
} }

@ -339,17 +339,12 @@ public final class MessageSender : NSObject {
} }
// MARK: Success & Failure Handling // MARK: Success & Failure Handling
<<<<<<< HEAD
public static func handleSuccessfulMessageSend(_ message: Message, to destination: Message.Destination, isSyncMessage: Bool = false, using transaction: Any) { public static func handleSuccessfulMessageSend(_ message: Message, to destination: Message.Destination, isSyncMessage: Bool = false, using transaction: Any) {
Storage.shared.addReceivedMessageTimestamp(message.sentTimestamp!, using: transaction) // To later ignore self-sends in a multi device context
guard let tsMessage = TSOutgoingMessage.find(withTimestamp: message.sentTimestamp!) else { return }
tsMessage.openGroupServerMessageID = message.openGroupServerMessageID ?? 0
=======
public static func handleSuccessfulMessageSend(_ message: Message, to destination: Message.Destination, using transaction: Any) {
>>>>>>> dev
let storage = SNMessagingKitConfiguration.shared.storage let storage = SNMessagingKitConfiguration.shared.storage
let transaction = transaction as! YapDatabaseReadWriteTransaction let transaction = transaction as! YapDatabaseReadWriteTransaction
guard let tsMessage = TSOutgoingMessage.find(withTimestamp: message.sentTimestamp!) else { return } guard let tsMessage = TSOutgoingMessage.find(withTimestamp: message.sentTimestamp!) else { return }
// Ignore future self-sends
Storage.shared.addReceivedMessageTimestamp(message.sentTimestamp!, using: transaction)
// Track the open group server message ID // Track the open group server message ID
tsMessage.openGroupServerMessageID = message.openGroupServerMessageID ?? 0 tsMessage.openGroupServerMessageID = message.openGroupServerMessageID ?? 0
tsMessage.save(with: transaction) tsMessage.save(with: transaction)

Loading…
Cancel
Save