Clean up conversation settings screen

pull/26/head
Niels Andriesse 7 years ago
parent d9a728922f
commit 30c02207d3

@ -172,10 +172,8 @@ const CGFloat kIconViewLength = 24;
- (NSString *)threadName - (NSString *)threadName
{ {
NSString *threadName = self.thread.name; NSString *threadName = self.thread.name;
if (self.thread.contactIdentifier && if (self.thread.contactIdentifier) {
[threadName isEqualToString:self.thread.contactIdentifier]) { return [self.contactsManager profileNameForRecipientId:self.thread.contactIdentifier];
threadName =
[PhoneNumber bestEffortFormatPartialUserSpecifiedTextToLookLikeAPhoneNumber:self.thread.contactIdentifier];
} else if (threadName.length == 0 && [self isGroupThread]) { } else if (threadName.length == 0 && [self isGroupThread]) {
threadName = [MessageStrings newGroupDefaultTitle]; threadName = [MessageStrings newGroupDefaultTitle];
} }
@ -929,49 +927,54 @@ const CGFloat kIconViewLength = 24;
if (![self isGroupThread]) { if (![self isGroupThread]) {
const CGFloat kSubtitlePointSize = 12.f; const CGFloat kSubtitlePointSize = 12.f;
void (^addSubtitle)(NSAttributedString *) = ^(NSAttributedString *subtitle) { void (^addSubtitle)(NSString *) = ^(NSString *subtitle) {
UILabel *subtitleLabel = [UILabel new]; UILabel *subtitleLabel = [UILabel new];
subtitleLabel.textColor = [Theme secondaryColor]; subtitleLabel.textColor = [Theme secondaryColor];
subtitleLabel.font = [UIFont ows_regularFontWithSize:kSubtitlePointSize]; subtitleLabel.font = [UIFont ows_regularFontWithSize:kSubtitlePointSize];
subtitleLabel.attributedText = subtitle; subtitleLabel.text = subtitle;
subtitleLabel.lineBreakMode = NSLineBreakByTruncatingTail; subtitleLabel.lineBreakMode = NSLineBreakByTruncatingTail;
[threadNameView addSubview:subtitleLabel]; [threadNameView addSubview:subtitleLabel];
[subtitleLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:lastTitleView]; [subtitleLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:lastTitleView];
[subtitleLabel autoPinLeadingToSuperviewMargin]; [subtitleLabel autoPinLeadingToSuperviewMargin];
[subtitleLabel autoPinTrailingToSuperviewMargin];
lastTitleView = subtitleLabel; lastTitleView = subtitleLabel;
}; };
NSString *recipientId = self.thread.contactIdentifier; NSString *recipientId = self.thread.contactIdentifier;
addSubtitle(recipientId);
BOOL hasName = ![self.thread.name isEqualToString:recipientId]; // Loki: Original code
if (hasName) { // ========
NSAttributedString *subtitle = [[NSAttributedString alloc] // BOOL hasName = ![self.thread.name isEqualToString:recipientId];
initWithString:[PhoneNumber // if (hasName) {
bestEffortFormatPartialUserSpecifiedTextToLookLikeAPhoneNumber:recipientId]]; // NSAttributedString *subtitle = [[NSAttributedString alloc]
addSubtitle(subtitle); // initWithString:[PhoneNumber
} else { // bestEffortFormatPartialUserSpecifiedTextToLookLikeAPhoneNumber:recipientId]];
NSString *_Nullable profileName = [self.contactsManager formattedProfileNameForRecipientId:recipientId]; // addSubtitle(subtitle);
if (profileName) { // } else {
addSubtitle([[NSAttributedString alloc] initWithString:profileName]); // NSString *_Nullable profileName = [self.contactsManager formattedProfileNameForRecipientId:recipientId];
} // if (profileName) {
} // addSubtitle([[NSAttributedString alloc] initWithString:profileName]);
// }
BOOL isVerified = [[OWSIdentityManager sharedManager] verificationStateForRecipientId:recipientId] // }
== OWSVerificationStateVerified; //
if (isVerified) { // BOOL isVerified = [[OWSIdentityManager sharedManager] verificationStateForRecipientId:recipientId]
NSMutableAttributedString *subtitle = [NSMutableAttributedString new]; // == OWSVerificationStateVerified;
// "checkmark" // if (isVerified) {
[subtitle appendAttributedString:[[NSAttributedString alloc] // NSMutableAttributedString *subtitle = [NSMutableAttributedString new];
initWithString:LocalizationNotNeeded(@"\uf00c ") // // "checkmark"
attributes:@{ // [subtitle appendAttributedString:[[NSAttributedString alloc]
NSFontAttributeName : // initWithString:LocalizationNotNeeded(@"\uf00c ")
[UIFont ows_fontAwesomeFont:kSubtitlePointSize], // attributes:@{
}]]; // NSFontAttributeName :
[subtitle appendAttributedString:[[NSAttributedString alloc] // [UIFont ows_fontAwesomeFont:kSubtitlePointSize],
initWithString:NSLocalizedString(@"PRIVACY_IDENTITY_IS_VERIFIED_BADGE", // }]];
@"Badge indicating that the user is verified.")]]; // [subtitle appendAttributedString:[[NSAttributedString alloc]
addSubtitle(subtitle); // initWithString:NSLocalizedString(@"PRIVACY_IDENTITY_IS_VERIFIED_BADGE",
} // @"Badge indicating that the user is verified.")]];
// addSubtitle(subtitle);
// }
// ========
} }
[lastTitleView autoPinEdgeToSuperviewEdge:ALEdgeBottom]; [lastTitleView autoPinEdgeToSuperviewEdge:ALEdgeBottom];

Loading…
Cancel
Save