Fix message duplication bug
This commit is contained in:
parent
b49e50ff19
commit
5f2ec37db7
|
@ -63,7 +63,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
{
|
{
|
||||||
OWSAssertDebug(signalAccount);
|
OWSAssertDebug(signalAccount);
|
||||||
|
|
||||||
ContactsViewHelper *helper = self.contactsViewHelper;
|
|
||||||
return ![SSKEnvironment.shared.blockingManager isRecipientIdBlocked:signalAccount.recipientId];
|
return ![SSKEnvironment.shared.blockingManager isRecipientIdBlocked:signalAccount.recipientId];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1073,7 +1073,6 @@ static const int kYapDatabaseRangeMaxLength = 25000;
|
||||||
};
|
};
|
||||||
|
|
||||||
NSMutableSet<NSString *> *interactionIds = [NSMutableSet new];
|
NSMutableSet<NSString *> *interactionIds = [NSMutableSet new];
|
||||||
BOOL canLoadMoreItems = self.messageMapping.canLoadMore;
|
|
||||||
[self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
[self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||||
NSMutableArray<TSInteraction *> *interactions = [NSMutableArray new];
|
NSMutableArray<TSInteraction *> *interactions = [NSMutableArray new];
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,9 @@ extension Storage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public func resumeMessageSendJobIfNeeded(_ messageSendJobID: String) {
|
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 {
|
public func isJobCanceled(_ job: Job) -> Bool {
|
||||||
|
|
|
@ -97,6 +97,7 @@ public final class JobQueue : NSObject, JobDelegate {
|
||||||
@objc private func retry(_ timer: Timer) {
|
@objc private func retry(_ timer: Timer) {
|
||||||
guard let job = timer.userInfo as? Job else { return }
|
guard let job = timer.userInfo as? Job else { return }
|
||||||
SNLog("Retrying \(type(of: job)).")
|
SNLog("Retrying \(type(of: job)).")
|
||||||
|
job.delegate = self
|
||||||
job.execute()
|
job.execute()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,8 @@ public final class OpenGroupPoller : NSObject {
|
||||||
public func objc_pollForNewMessages() -> AnyPromise {
|
public func objc_pollForNewMessages() -> AnyPromise {
|
||||||
AnyPromise.from(pollForNewMessages())
|
AnyPromise.from(pollForNewMessages())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
public func pollForNewMessages() -> Promise<Void> {
|
public func pollForNewMessages() -> Promise<Void> {
|
||||||
guard !self.isPolling else { return Promise.value(()) }
|
guard !self.isPolling else { return Promise.value(()) }
|
||||||
self.isPolling = true
|
self.isPolling = true
|
||||||
|
|
|
@ -299,7 +299,7 @@ public class ProxiedContentAssetRequest: NSObject {
|
||||||
try assetData.write(to: NSURL.fileURL(withPath: filePath), options: .atomicWrite)
|
try assetData.write(to: NSURL.fileURL(withPath: filePath), options: .atomicWrite)
|
||||||
let asset = ProxiedContentAsset(assetDescription: assetDescription, filePath: filePath)
|
let asset = ProxiedContentAsset(assetDescription: assetDescription, filePath: filePath)
|
||||||
return asset
|
return asset
|
||||||
} catch let error as NSError {
|
} catch {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,7 @@ public class ProxiedContentAsset: NSObject {
|
||||||
do {
|
do {
|
||||||
let fileManager = FileManager.default
|
let fileManager = FileManager.default
|
||||||
try fileManager.removeItem(atPath: filePathCopy)
|
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)
|
segmentRequestDidFail(assetRequest: assetRequest, assetSegment: assetSegment)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if let error = error {
|
if error != nil {
|
||||||
segmentRequestDidFail(assetRequest: assetRequest, assetSegment: assetSegment)
|
segmentRequestDidFail(assetRequest: assetRequest, assetSegment: assetSegment)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -848,7 +848,7 @@ open class ProxiedContentDownloader: NSObject, URLSessionTaskDelegate, URLSessio
|
||||||
|
|
||||||
// Don't back up ProxiedContent downloads.
|
// Don't back up ProxiedContent downloads.
|
||||||
OWSFileSystem.protectFileOrFolder(atPath: dirPath)
|
OWSFileSystem.protectFileOrFolder(atPath: dirPath)
|
||||||
} catch let error as NSError {
|
} catch {
|
||||||
downloadFolderPath = tempDirPath
|
downloadFolderPath = tempDirPath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue