mirror of https://github.com/oxen-io/session-ios
add missing method to FakeContactsManager, convert to Swift to avoid missing
protocol methods in the future.pull/1/head
parent
ca58bb00f7
commit
24f57cedda
@ -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
|
||||
}
|
||||
}
|
@ -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
|
Loading…
Reference in New Issue