add missing method to FakeContactsManager, convert to Swift to avoid missing

protocol methods in the future.
pull/1/head
Michael Kirk 7 years ago
parent ca58bb00f7
commit 24f57cedda

@ -4,6 +4,7 @@
// Anything used by Swift outside of the framework must be imported.
#import <Reachability/Reachability.h>
#import <SignalServiceKit/ContactsManagerProtocol.h>
#import <SignalServiceKit/OWSFileSystem.h>
#import <SignalServiceKit/OWSOperation.h>
#import <SignalServiceKit/OWSSyncManagerProtocol.h>

@ -0,0 +1,44 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
@objc(OWSFakeContactsManager)
class FakeContactsManager: NSObject, ContactsManagerProtocol {
func displayName(forPhoneIdentifier recipientId: String?) -> String {
return "Fake name"
}
func displayName(forPhoneIdentifier recipientId: String?, transaction: YapDatabaseReadTransaction) -> String {
return self.displayName(forPhoneIdentifier: recipientId)
}
func signalAccounts() -> [SignalAccount] {
return []
}
func isSystemContact(_ recipientId: String) -> Bool {
return true
}
func isSystemContact(withSignalAccount recipientId: String) -> Bool {
return true
}
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
}
func cnContact(withId contactId: String?) -> CNContact? {
return nil
}
func avatarData(forCNContactId contactId: String?) -> Data? {
return nil
}
func avatarImage(forCNContactId contactId: String?) -> UIImage? {
return nil
}
}

@ -10,7 +10,6 @@
#import "OWSBlockingManager.h"
#import "OWSDisappearingMessagesJob.h"
#import "OWSFakeCallMessageHandler.h"
#import "OWSFakeContactsManager.h"
#import "OWSFakeContactsUpdater.h"
#import "OWSFakeMessageSender.h"
#import "OWSFakeNetworkManager.h"

@ -1,17 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "ContactsManagerProtocol.h"
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
@interface OWSFakeContactsManager : NSObject <ContactsManagerProtocol>
@end
#endif
NS_ASSUME_NONNULL_END

@ -1,71 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "OWSFakeContactsManager.h"
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
@implementation OWSFakeContactsManager
- (NSString *)displayNameForPhoneIdentifier:(NSString *_Nullable)phoneNumber
{
return @"Fake name";
}
- (NSArray<SignalAccount *> *)signalAccounts
{
return @[];
}
- (BOOL)isSystemContact:(NSString *)recipientId
{
return YES;
}
- (BOOL)isSystemContactWithSignalAccount:(NSString *)recipientId
{
return YES;
}
- (NSComparisonResult)compareSignalAccount:(SignalAccount *)left
withSignalAccount:(SignalAccount *)right NS_SWIFT_NAME(compare(signalAccount:with:))
{
// If this method ends up being used by the tests, we should provide a better implementation.
OWSAbstractMethod();
return NSOrderedAscending;
}
+ (BOOL)name:(NSString *_Nonnull)nameString matchesQuery:(NSString *_Nonnull)queryString
{
return YES;
}
- (UIImage *_Nullable)imageForPhoneIdentifier:(NSString *_Nullable)phoneNumber
{
return nil;
}
- (nullable CNContact *)cnContactWithId:(nullable NSString *)contactId
{
return nil;
}
- (nullable NSData *)avatarDataForCNContactId:(nullable NSString *)contactId
{
return nil;
}
- (nullable UIImage *)avatarImageForCNContactId:(nullable NSString *)contactId
{
return nil;
}
@end
#endif
NS_ASSUME_NONNULL_END

@ -5,7 +5,6 @@
#import "OWSDisappearingMessagesJob.h"
#import "OWSDisappearingMessagesConfiguration.h"
#import "OWSDisappearingMessagesFinder.h"
#import "OWSFakeContactsManager.h"
#import "OWSPrimaryStorage.h"
#import "SSKBaseTestObjC.h"
#import "TSContactThread.h"

@ -6,7 +6,6 @@
#import "ContactsUpdater.h"
#import "MockSSKEnvironment.h"
#import "OWSFakeCallMessageHandler.h"
#import "OWSFakeContactsManager.h"
#import "OWSFakeMessageSender.h"
#import "OWSFakeNetworkManager.h"
#import "OWSIdentityManager.h"

@ -6,7 +6,6 @@
#import "NSError+MessageSending.h"
#import "OWSDisappearingMessagesConfiguration.h"
#import "OWSError.h"
#import "OWSFakeContactsManager.h"
#import "OWSFakeNetworkManager.h"
#import "OWSPrimaryStorage.h"
#import "OWSUploadOperation.h"

Loading…
Cancel
Save