From 13d3dafe567197b18d539d2774baaf2b50e528ac Mon Sep 17 00:00:00 2001 From: hannes <hannes@gfzdfuz.de> Date: Wed, 12 May 2021 15:27:32 +0200 Subject: [PATCH] renamed some stuff to fit current naming scheme --- .../Categories/Chat/Children/Chat_PeopleRow.swift | 2 +- .../Categories/Chat/Children/chat/Bubble.swift | 2 +- .../categorized/Helpers/Search/SearchFilters.swift | 10 +++++----- .../Helpers/UI/SupportingViews/newMailRow.swift | 6 ++---- enzevalos_iphone/persistentData/MailRecord.swift | 4 ++++ .../persistentData/PersistentDataProvider.swift | 7 +++---- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/enzevalos_iphone/SwiftUI/Inbox/categorized/Categories/Chat/Children/Chat_PeopleRow.swift b/enzevalos_iphone/SwiftUI/Inbox/categorized/Categories/Chat/Children/Chat_PeopleRow.swift index c2e159b7..7ca8c62f 100644 --- a/enzevalos_iphone/SwiftUI/Inbox/categorized/Categories/Chat/Children/Chat_PeopleRow.swift +++ b/enzevalos_iphone/SwiftUI/Inbox/categorized/Categories/Chat/Children/Chat_PeopleRow.swift @@ -39,7 +39,7 @@ struct Chat_PeopleRow: View { } private var profile : some View { - chat.partner.myImage + chat.partner.avatar .resizable() .frame(width: 50, height: 50) } diff --git a/enzevalos_iphone/SwiftUI/Inbox/categorized/Categories/Chat/Children/chat/Bubble.swift b/enzevalos_iphone/SwiftUI/Inbox/categorized/Categories/Chat/Children/chat/Bubble.swift index 44e1c368..6cfac529 100644 --- a/enzevalos_iphone/SwiftUI/Inbox/categorized/Categories/Chat/Children/chat/Bubble.swift +++ b/enzevalos_iphone/SwiftUI/Inbox/categorized/Categories/Chat/Children/chat/Bubble.swift @@ -16,7 +16,7 @@ struct ChatMessageView : View { var body: some View { HStack(alignment: .bottom, spacing: 15) { if !checkedChatMessage.sender.isUser{ - checkedChatMessage.sender.myImage + checkedChatMessage.sender.avatar .resizable() .frame(width: 40, height: 40, alignment: .center) .cornerRadius(20) diff --git a/enzevalos_iphone/SwiftUI/Inbox/categorized/Helpers/Search/SearchFilters.swift b/enzevalos_iphone/SwiftUI/Inbox/categorized/Helpers/Search/SearchFilters.swift index 9babd737..e4119277 100644 --- a/enzevalos_iphone/SwiftUI/Inbox/categorized/Helpers/Search/SearchFilters.swift +++ b/enzevalos_iphone/SwiftUI/Inbox/categorized/Helpers/Search/SearchFilters.swift @@ -13,15 +13,15 @@ class SearchFilters { ///search in sender names static let Sender:SearchFilter.Filter={eMail, searchText in - containsSearchTerms(content: eMail.sender.displayname, searchText: searchText) || - containsSearchTerms(content: eMail.sender.email, searchText: searchText) || - eMail.addresses.filter({containsSearchTerms(content: $0.mailAddress, searchText: searchText)}).count > 0 + containsSearchTerms(content: eMail.sender.displayname, searchTerm: searchText) || + containsSearchTerms(content: eMail.sender.email, searchTerm: searchText) || + eMail.addresses.filter({containsSearchTerms(content: $0.email, searchTerm: searchText)}).count > 0 } ///search the subjects -static let Subject:SearchFilter.Filter={eMail, searchText in containsSearchTerms(content: eMail.subject, searchText: searchText)} + static let Subject:SearchFilter.Filter={eMail, searchText in containsSearchTerms(content: eMail.subject, searchTerm: searchText)} -static let Body:SearchFilter.Filter={eMail, searchText in containsSearchTerms(content: eMail.subject, searchText: searchText)} + static let Body:SearchFilter.Filter={eMail, searchText in containsSearchTerms(content: eMail.subject, searchTerm: searchText)} static let AllStandarts:SearchFilter.Filter={eMail, searchText in Sender(eMail,searchText) || Subject(eMail,searchText) || Body(eMail,searchText) diff --git a/enzevalos_iphone/SwiftUI/Inbox/categorized/Helpers/UI/SupportingViews/newMailRow.swift b/enzevalos_iphone/SwiftUI/Inbox/categorized/Helpers/UI/SupportingViews/newMailRow.swift index 0d1ddcf6..77530712 100644 --- a/enzevalos_iphone/SwiftUI/Inbox/categorized/Helpers/UI/SupportingViews/newMailRow.swift +++ b/enzevalos_iphone/SwiftUI/Inbox/categorized/Helpers/UI/SupportingViews/newMailRow.swift @@ -31,13 +31,11 @@ struct SimpleMailRow: View { } private var icon: some View{ - mail.sender.myImage + mail.sender.avatar .sizeTo(30) .openOnTap(tag:1){ ContactView( - contact: mail.sender, - fromMail: mail, - derivedFromKey: true + contact: mail.sender ) } diff --git a/enzevalos_iphone/persistentData/MailRecord.swift b/enzevalos_iphone/persistentData/MailRecord.swift index fcca5026..0b2a366c 100644 --- a/enzevalos_iphone/persistentData/MailRecord.swift +++ b/enzevalos_iphone/persistentData/MailRecord.swift @@ -276,3 +276,7 @@ extension MailRecord { } } + +extension MailRecord { + var isSingle : Bool { addresses.count <= 2 } +} diff --git a/enzevalos_iphone/persistentData/PersistentDataProvider.swift b/enzevalos_iphone/persistentData/PersistentDataProvider.swift index 7186709c..f953d869 100644 --- a/enzevalos_iphone/persistentData/PersistentDataProvider.swift +++ b/enzevalos_iphone/persistentData/PersistentDataProvider.swift @@ -436,12 +436,11 @@ class PersistentDataProvider { let taskContext = self.newTaskContext() let sortDescriptors = [NSSortDescriptor(key: "date", ascending: true)] if let unclassifiedMailRecords = self.generateFetchResultController( - enitityName: MailRecord.entityName, + entityName: MailRecord.entityName, sortDescriptors: sortDescriptors, predicate: predicate, propertiesToFetch: nil, fetchLimit: PersistentDataProvider.FETCHLIMIT, - inViewContext: false, context: taskContext ).fetchedObjects as? [MailRecord]{ taskContext.performAndWait { @@ -732,7 +731,7 @@ class PersistentDataProvider { func generateNoMailsController()->NSFetchedResultsController<MailRecord> { let sortDescriptors = [NSSortDescriptor(key: "date", ascending: true)] - return generateFetchResultController(enitityName: MailRecord.entityName, sortDescriptors: sortDescriptors, predicate: nil, propertiesToFetch: nil, fetchLimit: PersistentDataProvider.FETCHLIMIT, inViewContext: true, context: nil) + return generateFetchResultController(entityName: MailRecord.entityName, sortDescriptors: sortDescriptors, predicate: nil, propertiesToFetch: nil, fetchLimit: PersistentDataProvider.FETCHLIMIT, context: nil) } func generateFetchedMailsInFolderAndCategoryResultsController(folderpath: String, category:String, andPredicate:NSPredicate=NSPredicate(value: true), important:Bool = false) -> NSFetchedResultsController<MailRecord> { @@ -762,7 +761,7 @@ class PersistentDataProvider { //it also has to be in this folder (folders have higher rank than categories) let predicate = NSCompoundPredicate(type: .and, subpredicates: [inCategoryPredicate,inFolderPredicate,andPredicate]) - return generateFetchResultController(enitityName: MailRecord.entityName, sortDescriptors: sortDescriptors, predicate: predicate, propertiesToFetch: nil, fetchLimit: PersistentDataProvider.FETCHLIMIT, inViewContext: true, context: nil) + return generateFetchResultController(entityName: MailRecord.entityName, sortDescriptors: sortDescriptors, predicate: predicate, propertiesToFetch: nil, fetchLimit: PersistentDataProvider.FETCHLIMIT, context: nil) } -- GitLab