Revision 9a71f7ed ChatSecure/Classes/Controllers/FileTransferManager.swift
| ChatSecure/Classes/Controllers/FileTransferManager.swift | ||
|---|---|---|
| 512 | 512 |
/** creates downloadmessages and then downloads if needed. parent message should already be saved! @warn Do not call from within an existing db transaction! */ |
| 513 | 513 |
@objc public func createAndDownloadItemsIfNeeded(message: OTRMessageProtocol, readConnection: YapDatabaseConnection, force: Bool) {
|
| 514 | 514 |
DispatchQueue.global(qos: .default).async {
|
| 515 |
if message.messageMediaItemKey != nil || message.messageText?.characters.count == 0 || message.downloadableURLs.count == 0 {
|
|
| 515 |
if message.messageMediaItemKey != nil || message.messageText?.count == 0 || message.downloadableURLs.count == 0 {
|
|
| 516 | 516 |
//DDLogVerbose("Download of message not needed \(message.messageKey)")
|
| 517 | 517 |
return |
| 518 | 518 |
} |
| ... | ... | |
| 828 | 828 |
} |
| 829 | 829 |
var urls: [URL] = [] |
| 830 | 830 |
var ranges: [NSRange] = [] |
| 831 |
let matches = detector.matches(in: self, options: NSRegularExpression.MatchingOptions(rawValue: 0), range: NSMakeRange(0, self.characters.count))
|
|
| 831 |
let matches = detector.matches(in: self, options: NSRegularExpression.MatchingOptions(rawValue: 0), range: NSMakeRange(0, self.count)) |
|
| 832 | 832 |
for match in matches where match.resultType == .link {
|
| 833 | 833 |
if let url = match.url {
|
| 834 | 834 |
urls.append(url) |
| ... | ... | |
| 849 | 849 |
let (_, ranges) = urlRanges |
| 850 | 850 |
guard ranges.count == 1, |
| 851 | 851 |
let range = ranges.first, |
| 852 |
range.length == self.characters.count else {
|
|
| 852 |
range.length == self.count else {
|
|
| 853 | 853 |
return false |
| 854 | 854 |
} |
| 855 | 855 |
return true |
Also available in: Unified diff