IOS-1480 Move AttachmentFilter. IOS-1480
authorDirk Zimmermann <dz@pep.security>
Mon, 18 Feb 2019 13:21:12 +0100
branchIOS-1480
changeset 7683571463e00d89
parent 7682 7b526543c7b0
child 7684 d79e9c6f0b49
IOS-1480 Move AttachmentFilter.
pEpForiOS.xcodeproj/project.pbxproj
pEpForiOS/Models/Filter/AttachmentFilter.swift
     1.1 --- a/pEpForiOS.xcodeproj/project.pbxproj	Mon Feb 18 13:21:12 2019 +0100
     1.2 +++ b/pEpForiOS.xcodeproj/project.pbxproj	Mon Feb 18 13:21:12 2019 +0100
     1.3 @@ -125,7 +125,6 @@
     1.4  		1541D7F01FC81ED900D52A5D /* URL+ExtensionsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1541D7EF1FC81ED900D52A5D /* URL+ExtensionsTest.swift */; };
     1.5  		1541D7F31FC8292D00D52A5D /* URL+MIME.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1541D7F21FC8292D00D52A5D /* URL+MIME.swift */; };
     1.6  		1541D7F51FC82A4900D52A5D /* URL+MIME.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1541D7F41FC82A4900D52A5D /* URL+MIME.swift */; };
     1.7 -		1544BCFE215246F30075C5A0 /* AttachmentFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1544BCFD215246F30075C5A0 /* AttachmentFilter.swift */; };
     1.8  		1544BD0221524C9F0075C5A0 /* AttachmentFilterTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1544BD0121524C9F0075C5A0 /* AttachmentFilterTest.swift */; };
     1.9  		1547509A1FE7C0B4000D8004 /* FetchNumberOfNewMailsOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 154750991FE7C0B4000D8004 /* FetchNumberOfNewMailsOperation.swift */; };
    1.10  		15484B6C2105E26600F9D962 /* LegacyConnectInfoProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15484B6B2105E26600F9D962 /* LegacyConnectInfoProvider.swift */; };
    1.11 @@ -672,7 +671,6 @@
    1.12  		1541D7EF1FC81ED900D52A5D /* URL+ExtensionsTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+ExtensionsTest.swift"; sourceTree = "<group>"; };
    1.13  		1541D7F21FC8292D00D52A5D /* URL+MIME.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+MIME.swift"; sourceTree = "<group>"; };
    1.14  		1541D7F41FC82A4900D52A5D /* URL+MIME.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+MIME.swift"; sourceTree = "<group>"; };
    1.15 -		1544BCFD215246F30075C5A0 /* AttachmentFilter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttachmentFilter.swift; sourceTree = "<group>"; };
    1.16  		1544BD0121524C9F0075C5A0 /* AttachmentFilterTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AttachmentFilterTest.swift; path = pEpForiOSTests/Models/Filter/AttachmentFilterTest.swift; sourceTree = SOURCE_ROOT; };
    1.17  		154750991FE7C0B4000D8004 /* FetchNumberOfNewMailsOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchNumberOfNewMailsOperation.swift; sourceTree = "<group>"; };
    1.18  		15484B6B2105E26600F9D962 /* LegacyConnectInfoProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacyConnectInfoProvider.swift; sourceTree = "<group>"; };
    1.19 @@ -1743,7 +1741,6 @@
    1.20  			isa = PBXGroup;
    1.21  			children = (
    1.22  				1554756B213FE139005A52D0 /* UnifiedFilter.swift */,
    1.23 -				1544BCFD215246F30075C5A0 /* AttachmentFilter.swift */,
    1.24  			);
    1.25  			path = Filter;
    1.26  			sourceTree = "<group>";
    1.27 @@ -3119,7 +3116,6 @@
    1.28  				43CE63C51DE87FB200FAC505 /* Identity+pEp.swift in Sources */,
    1.29  				220DCE2E1E0AB544002FE716 /* MessageCell.swift in Sources */,
    1.30  				8B69E3991E30F80E0022959E /* Appearance.swift in Sources */,
    1.31 -				1544BCFE215246F30075C5A0 /* AttachmentFilter.swift in Sources */,
    1.32  				43F848491EAA09AE00DBE460 /* Weak.swift in Sources */,
    1.33  				B716056020D3ECC900A733D6 /* MoveToFolderTableViewController.swift in Sources */,
    1.34  				4341980520AB037E0062F7F6 /* CGImageSource+Extension.swift in Sources */,
     2.1 --- a/pEpForiOS/Models/Filter/AttachmentFilter.swift	Mon Feb 18 13:21:12 2019 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,48 +0,0 @@
     2.4 -//
     2.5 -//  AttachmentFilter.swift
     2.6 -//  MessageModel
     2.7 -//
     2.8 -//  Created by Xavier Algarra on 02/10/2017.
     2.9 -//  Copyright © 2017 pEp Security S.A. All rights reserved.
    2.10 -//
    2.11 -
    2.12 -import MessageModel
    2.13 -
    2.14 -public class AttachmentFilter: FilterBase {
    2.15 -    public static let unviewableMimeTypes = Set([
    2.16 -        MimeTypeUtil.contentTypeApplicationPGPKeys,
    2.17 -        "application/pgp-signature"]
    2.18 -    )
    2.19 -
    2.20 -    public override var predicates : [NSPredicate] {
    2.21 -        get {
    2.22 -            return [CdMessage.PredicateFactory.hasViewableAttachments()]
    2.23 -        }
    2.24 -    }
    2.25 -
    2.26 -    public override var title: String {
    2.27 -        get {
    2.28 -            return NSLocalizedString("With attachments", comment: "Title for attachments filter")
    2.29 -        }
    2.30 -    }
    2.31 -
    2.32 -    public override func fulfillsFilter(message: Message) -> Bool {
    2.33 -        let viewableAttachments = message.attachments.filter {
    2.34 -            !AttachmentFilter.unviewableMimeTypes.contains($0.mimeType.lowercased())
    2.35 -        }
    2.36 -        return viewableAttachments.count > 0
    2.37 -    }
    2.38 -
    2.39 -    public override var hashValue: Int {
    2.40 -        get {
    2.41 -            return 31
    2.42 -        }
    2.43 -    }
    2.44 -
    2.45 -    public override func isEqual(filter: FilterBase) -> Bool {
    2.46 -        if let _ = filter as? AttachmentFilter {
    2.47 -            return true
    2.48 -        }
    2.49 -        return false
    2.50 -    }
    2.51 -}