Use default avatars for contact shares in contact view.
This commit is contained in:
parent
66989b8db7
commit
dcf7a05986
|
@ -202,9 +202,26 @@ class ContactViewController: OWSViewController, CNContactViewControllerDelegate
|
|||
|
||||
// TODO: Use actual avatar.
|
||||
let avatarSize = CGFloat(100)
|
||||
let avatarView = UIView.container()
|
||||
avatarView.backgroundColor = UIColor.ows_materialBlue
|
||||
avatarView.layer.cornerRadius = avatarSize * 0.5
|
||||
|
||||
let avatarView = AvatarImageView()
|
||||
// TODO: What's the best colorSeed value to use?
|
||||
let avatarBuilder = OWSContactAvatarBuilder(nonSignalName: contact.displayName,
|
||||
colorSeed: contact.displayName,
|
||||
diameter: UInt(avatarSize),
|
||||
contactsManager: contactsManager)
|
||||
// [[OWSContactAvatarBuilder alloc] initWithNonSignalName:self.contactShare.displayName
|
||||
// colorSeed:self.contactShare.displayName
|
||||
// diameter:(NSUInteger)self.iconSize
|
||||
// contactsManager:[Environment current].contactsManager];
|
||||
avatarView.image = avatarBuilder.build()
|
||||
// [avatarView autoSetDimension:ALDimensionWidth toSize:self.iconSize];
|
||||
// [avatarView autoSetDimension:ALDimensionHeight toSize:self.iconSize];
|
||||
// [avatarView setCompressionResistanceHigh];
|
||||
// [avatarView setContentHuggingHigh];
|
||||
|
||||
// let avatarView = UIView.container()
|
||||
// avatarView.backgroundColor = UIColor.ows_materialBlue
|
||||
// avatarView.layer.cornerRadius = avatarSize * 0.5
|
||||
topView.addSubview(avatarView)
|
||||
avatarView.autoPin(toTopLayoutGuideOf: self, withInset: 20)
|
||||
avatarView.autoHCenterInSuperview()
|
||||
|
|
|
@ -105,6 +105,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
[contentView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:self.vMargin];
|
||||
[contentView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:self.vMargin];
|
||||
|
||||
// TODO: Use the contact's avatar if present and downloaded.
|
||||
AvatarImageView *avatarView = [AvatarImageView new];
|
||||
// TODO: What's the best colorSeed value to use?
|
||||
OWSAvatarBuilder *avatarBuilder =
|
||||
|
|
|
@ -424,6 +424,9 @@
|
|||
/* navbar title for contact picker when sharing a contact */
|
||||
"CONTACT_PICKER_TITLE" = "Select Contact";
|
||||
|
||||
/* Indicates that a contact has no name. */
|
||||
"CONTACT_WITHOUT_NAME" = "Unnamed Contact";
|
||||
|
||||
/* title for conversation settings screen */
|
||||
"CONVERSATION_SETTINGS" = "Conversation Settings";
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
@property (nonatomic, nullable) NSString *namePrefix;
|
||||
@property (nonatomic, nullable) NSString *middleName;
|
||||
@property (nonatomic, nullable) NSString *organizationName;
|
||||
@property (nonatomic, nullable) NSString *displayName;
|
||||
@property (nonatomic) NSString *displayName;
|
||||
|
||||
@property (nonatomic) NSArray<OWSContactPhoneNumber *> *phoneNumbers;
|
||||
@property (nonatomic) NSArray<OWSContactEmail *> *emails;
|
||||
|
|
|
@ -109,7 +109,7 @@ NSString *NSStringForContactAddressType(OWSContactAddressType value);
|
|||
@property (nonatomic, readonly, nullable) NSString *namePrefix;
|
||||
@property (nonatomic, readonly, nullable) NSString *middleName;
|
||||
@property (nonatomic, readonly, nullable) NSString *organizationName;
|
||||
@property (nonatomic, readonly, nullable) NSString *displayName;
|
||||
@property (nonatomic, readonly) NSString *displayName;
|
||||
|
||||
@property (nonatomic, readonly) NSArray<OWSContactPhoneNumber *> *phoneNumbers;
|
||||
@property (nonatomic, readonly) NSArray<OWSContactEmail *> *emails;
|
||||
|
|
|
@ -288,7 +288,7 @@ NSString *NSStringForContactAddressType(OWSContactAddressType value)
|
|||
@property (nonatomic, nullable) NSString *namePrefix;
|
||||
@property (nonatomic, nullable) NSString *middleName;
|
||||
@property (nonatomic, nullable) NSString *organizationName;
|
||||
@property (nonatomic, nullable) NSString *displayName;
|
||||
@property (nonatomic) NSString *displayName;
|
||||
|
||||
@property (nonatomic) NSArray<OWSContactPhoneNumber *> *phoneNumbers;
|
||||
@property (nonatomic) NSArray<OWSContactEmail *> *emails;
|
||||
|
@ -360,10 +360,14 @@ NSString *NSStringForContactAddressType(OWSContactAddressType value)
|
|||
return hasValue;
|
||||
}
|
||||
|
||||
- (nullable NSString *)displayName
|
||||
- (NSString *)displayName
|
||||
{
|
||||
[self ensureDisplayName];
|
||||
|
||||
if (_displayName.length < 1) {
|
||||
OWSProdLogAndFail(@"%@ could not derive a valid display name.", self.logTag);
|
||||
return NSLocalizedString(@"CONTACT_WITHOUT_NAME", @"Indicates that a contact has no name.");
|
||||
}
|
||||
return _displayName;
|
||||
}
|
||||
|
||||
|
@ -377,9 +381,6 @@ NSString *NSStringForContactAddressType(OWSContactAddressType value)
|
|||
// Fall back to using the organization name.
|
||||
_displayName = self.organizationName;
|
||||
}
|
||||
if (_displayName.length < 1) {
|
||||
OWSProdLogAndFail(@"%@ could not derive a valid display name.", self.logTag);
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)debugDescription
|
||||
|
|
Loading…
Reference in New Issue