From 107a1ff9c0aff3da042e0307e74095b50d0651b9 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Tue, 24 Apr 2018 14:47:08 -0400 Subject: [PATCH] Clean up system contacts fetch. --- .../contacts/SystemContactsFetcher.swift | 33 ++----------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/SignalMessaging/contacts/SystemContactsFetcher.swift b/SignalMessaging/contacts/SystemContactsFetcher.swift index 2f701c959..b4c750fca 100644 --- a/SignalMessaging/contacts/SystemContactsFetcher.swift +++ b/SignalMessaging/contacts/SystemContactsFetcher.swift @@ -113,35 +113,6 @@ public enum ContactStoreAuthorizationStatus { authorized } -class ContactStoreAdapter: ContactStoreAdaptee { - - let adaptee: ContactStoreAdaptee - - init() { - self.adaptee = ContactsFrameworkContactStoreAdaptee() - } - - var supportsContactEditing: Bool { - return self.adaptee.supportsContactEditing - } - - var authorizationStatus: ContactStoreAuthorizationStatus { - return self.adaptee.authorizationStatus - } - - func requestAccess(completionHandler: @escaping (Bool, Error?) -> Void) { - return self.adaptee.requestAccess(completionHandler: completionHandler) - } - - func fetchContacts() -> Result<[Contact], Error> { - return self.adaptee.fetchContacts() - } - - func startObservingChanges(changeHandler: @escaping () -> Void) { - self.adaptee.startObservingChanges(changeHandler: changeHandler) - } -} - @objc public protocol SystemContactsFetcherDelegate: class { func systemContactsFetcher(_ systemContactsFetcher: SystemContactsFetcher, updatedContacts contacts: [Contact], isUserRequested: Bool) } @@ -152,7 +123,7 @@ public class SystemContactsFetcher: NSObject { private let TAG = "[SystemContactsFetcher]" var lastContactUpdateHash: Int? var lastDelegateNotificationDate: Date? - let contactStoreAdapter: ContactStoreAdapter + let contactStoreAdapter: ContactsFrameworkContactStoreAdaptee @objc public weak var delegate: SystemContactsFetcherDelegate? @@ -176,7 +147,7 @@ public class SystemContactsFetcher: NSObject { private var hasSetupObservation = false override init() { - self.contactStoreAdapter = ContactStoreAdapter() + self.contactStoreAdapter = ContactsFrameworkContactStoreAdaptee() super.init()