diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 1da301397..037d2383a 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -1258,9 +1258,10 @@ typedef enum : NSUInteger { } else { OWSAssertDebug(self.thread.contactIdentifier); - if ([self.thread.contactIdentifier isEqualToString:self.tsAccountManager.localNumber]) { + BOOL isNoteToSelf = [self.thread.contactIdentifier isEqualToString:self.tsAccountManager.localNumber]; + if (isNoteToSelf) { name = [[NSAttributedString alloc] - initWithString:NSLocalizedString(@"NOTE_TO_SELF", "Label for 1:1 conversation with yourself.") + initWithString:NSLocalizedString(@"NOTE_TO_SELF", @"Label for 1:1 conversation with yourself.") attributes:@{ NSFontAttributeName : self.headerView.titlePrimaryFont, }]; diff --git a/Signal/src/ViewControllers/HomeView/HomeViewCell.m b/Signal/src/ViewControllers/HomeView/HomeViewCell.m index 64ff742b9..5a86f96c6 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewCell.m +++ b/Signal/src/ViewControllers/HomeView/HomeViewCell.m @@ -53,6 +53,13 @@ NS_ASSUME_NONNULL_BEGIN return SSKEnvironment.shared.typingIndicators; } +- (TSAccountManager *)tsAccountManager +{ + OWSAssertDebug(SSKEnvironment.shared.tsAccountManager); + + return SSKEnvironment.shared.tsAccountManager; +} + #pragma mark - - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(nullable NSString *)reuseIdentifier @@ -510,9 +517,18 @@ NS_ASSUME_NONNULL_BEGIN name = [[NSAttributedString alloc] initWithString:thread.name]; } } else { - name = [self.contactsManager attributedContactOrProfileNameForPhoneIdentifier:thread.contactIdentifier - primaryFont:self.nameFont - secondaryFont:self.nameSecondaryFont]; + BOOL isNoteToSelf = [self.thread.contactIdentifier isEqualToString:self.tsAccountManager.localNumber]; + if (isNoteToSelf) { + name = [[NSAttributedString alloc] + initWithString:NSLocalizedString(@"NOTE_TO_SELF", @"Label for 1:1 conversation with yourself.") + attributes:@{ + NSFontAttributeName : self.nameFont, + }]; + } else { + name = [self.contactsManager attributedContactOrProfileNameForPhoneIdentifier:thread.contactIdentifier + primaryFont:self.nameFont + secondaryFont:self.nameSecondaryFont]; + } } self.nameLabel.attributedText = name; diff --git a/SignalMessaging/Views/ContactCellView.m b/SignalMessaging/Views/ContactCellView.m index 63b00fa47..5d744681b 100644 --- a/SignalMessaging/Views/ContactCellView.m +++ b/SignalMessaging/Views/ContactCellView.m @@ -61,6 +61,13 @@ const CGFloat kContactCellAvatarTextMargin = 12; return SSKEnvironment.shared.primaryStorage; } +- (TSAccountManager *)tsAccountManager +{ + OWSAssertDebug(SSKEnvironment.shared.tsAccountManager); + + return SSKEnvironment.shared.tsAccountManager; +} + #pragma mark - - (void)configure @@ -133,8 +140,17 @@ const CGFloat kContactCellAvatarTextMargin = 12; self.thread = [TSContactThread getThreadWithContactId:recipientId transaction:transaction]; }]; - self.nameLabel.attributedText = - [self.contactsManager formattedFullNameForRecipientId:recipientId font:self.nameLabel.font]; + BOOL isNoteToSelf = [recipientId isEqualToString:self.tsAccountManager.localNumber]; + if (isNoteToSelf) { + self.nameLabel.attributedText = [[NSAttributedString alloc] + initWithString:NSLocalizedString(@"NOTE_TO_SELF", @"Label for 1:1 conversation with yourself.") + attributes:@{ + NSFontAttributeName : self.nameLabel.font, + }]; + } else { + self.nameLabel.attributedText = + [self.contactsManager formattedFullNameForRecipientId:recipientId font:self.nameLabel.font]; + } [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(otherUsersProfileDidChange:) @@ -165,6 +181,12 @@ const CGFloat kContactCellAvatarTextMargin = 12; threadName = [MessageStrings newGroupDefaultTitle]; } + BOOL isNoteToSelf + = (!thread.isGroupThread && [thread.contactIdentifier isEqualToString:self.tsAccountManager.localNumber]); + if (isNoteToSelf) { + threadName = NSLocalizedString(@"NOTE_TO_SELF", @"Label for 1:1 conversation with yourself."); + } + NSAttributedString *attributedText = [[NSAttributedString alloc] initWithString:threadName attributes:@{