session-ios/SignalServiceKit/src/TestUtils/FakeContactsManager.swift
2019-09-24 14:20:22 +10:00

45 lines
1.3 KiB
Swift

//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
import Contacts
@objc(OWSFakeContactsManager)
public class FakeContactsManager: NSObject, ContactsManagerProtocol {
public func displayName(forPhoneIdentifier recipientId: String?) -> String {
return "Fake name"
}
public func displayName(forPhoneIdentifier recipientId: String?, transaction: YapDatabaseReadTransaction) -> String {
return self.displayName(forPhoneIdentifier: recipientId)
}
public func signalAccounts() -> [SignalAccount] {
return []
}
public func isSystemContact(_ recipientId: String) -> Bool {
return true
}
public func isSystemContact(withSignalAccount recipientId: String) -> Bool {
return true
}
public func compare(signalAccount left: SignalAccount, with right: SignalAccount) -> ComparisonResult {
// If this method ends up being used by the tests, we should provide a better implementation.
assertionFailure("TODO")
return ComparisonResult.orderedAscending
}
public func cnContact(withId contactId: String?) -> CNContact? {
return nil
}
public func avatarData(forCNContactId contactId: String?) -> Data? {
return nil
}
public func avatarImage(forCNContactId contactId: String?) -> UIImage? {
return nil
}
}