From bb2a822f3f3ccc39ae6bb8ac80950bcf2283b577 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 8 Sep 2017 15:55:06 -0400 Subject: [PATCH] Clean up the data source class. // FREEBIE --- Signal/src/Models/SignalAttachment.swift | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Signal/src/Models/SignalAttachment.swift b/Signal/src/Models/SignalAttachment.swift index 4725781a5e..7d6417ce75 100644 --- a/Signal/src/Models/SignalAttachment.swift +++ b/Signal/src/Models/SignalAttachment.swift @@ -228,15 +228,6 @@ class SignalAttachment: NSObject { return fileExtension } - // Returns the file extension for this attachment or nil if no file extension - // can be identified. - var fileExtensionNonNil: String { - if let fileExtension = fileExtension { - return fileExtension - } - return "" - } - // Returns the set of UTIs that correspond to valid _input_ image formats // for Signal attachments. // @@ -299,6 +290,9 @@ class SignalAttachment: NSObject { public var isValidImage: Bool { if let dataPath = dataSource.dataPathIfOnDisk() { + // if ows_isValidImage is given a file path, it will + // avoid loading most of the data into memory, which + // is considerably more performant, so try to do that. return NSData.ows_isValidImage(atPath:dataPath) }