Fix message duplication bug

This commit is contained in:
nielsandriesse 2020-12-01 11:40:37 +11:00
parent b49e50ff19
commit 5f2ec37db7
6 changed files with 10 additions and 8 deletions

View File

@ -63,7 +63,6 @@ NS_ASSUME_NONNULL_BEGIN
{
OWSAssertDebug(signalAccount);
ContactsViewHelper *helper = self.contactsViewHelper;
return ![SSKEnvironment.shared.blockingManager isRecipientIdBlocked:signalAccount.recipientId];
}

View File

@ -1073,7 +1073,6 @@ static const int kYapDatabaseRangeMaxLength = 25000;
};
NSMutableSet<NSString *> *interactionIds = [NSMutableSet new];
BOOL canLoadMoreItems = self.messageMapping.canLoadMore;
[self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
NSMutableArray<TSInteraction *> *interactions = [NSMutableArray new];

View File

@ -82,7 +82,9 @@ extension Storage {
}
public func resumeMessageSendJobIfNeeded(_ messageSendJobID: String) {
getMessageSendJob(for: messageSendJobID)?.execute()
guard let job = getMessageSendJob(for: messageSendJobID) else { return }
job.delegate = JobQueue.shared
job.execute()
}
public func isJobCanceled(_ job: Job) -> Bool {

View File

@ -97,6 +97,7 @@ public final class JobQueue : NSObject, JobDelegate {
@objc private func retry(_ timer: Timer) {
guard let job = timer.userInfo as? Job else { return }
SNLog("Retrying \(type(of: job)).")
job.delegate = self
job.execute()
}
}

View File

@ -48,7 +48,8 @@ public final class OpenGroupPoller : NSObject {
public func objc_pollForNewMessages() -> AnyPromise {
AnyPromise.from(pollForNewMessages())
}
@discardableResult
public func pollForNewMessages() -> Promise<Void> {
guard !self.isPolling else { return Promise.value(()) }
self.isPolling = true

View File

@ -299,7 +299,7 @@ public class ProxiedContentAssetRequest: NSObject {
try assetData.write(to: NSURL.fileURL(withPath: filePath), options: .atomicWrite)
let asset = ProxiedContentAsset(assetDescription: assetDescription, filePath: filePath)
return asset
} catch let error as NSError {
} catch {
return nil
}
}
@ -366,7 +366,7 @@ public class ProxiedContentAsset: NSObject {
do {
let fileManager = FileManager.default
try fileManager.removeItem(atPath: filePathCopy)
} catch let error as NSError {
} catch {
}
}
@ -801,7 +801,7 @@ open class ProxiedContentDownloader: NSObject, URLSessionTaskDelegate, URLSessio
segmentRequestDidFail(assetRequest: assetRequest, assetSegment: assetSegment)
return
}
if let error = error {
if error != nil {
segmentRequestDidFail(assetRequest: assetRequest, assetSegment: assetSegment)
return
}
@ -848,7 +848,7 @@ open class ProxiedContentDownloader: NSObject, URLSessionTaskDelegate, URLSessio
// Don't back up ProxiedContent downloads.
OWSFileSystem.protectFileOrFolder(atPath: dirPath)
} catch let error as NSError {
} catch {
downloadFolderPath = tempDirPath
}
}