Deal with legacy display names

pull/261/head
nielsandriesse 5 years ago
parent 17d433beb3
commit 3712510caf

@ -72,7 +72,7 @@ final class ConversationTitleView : UIView {
let stackView = UIStackView(arrangedSubviews: [ profilePictureView, labelStackView ])
stackView.axis = .horizontal
stackView.alignment = .center
stackView.spacing = Values.smallSpacing
stackView.spacing = 12
addSubview(stackView)
stackView.pin(to: self)
}

@ -1037,7 +1037,14 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
}];
if (userProfile != nil) {
return userProfile.profileName;
NSString *result = userProfile.profileName;
NSString *shortID = [recipientID substringWithRange:NSMakeRange(recipientID.length - 8, 8)];
NSString *suffix = [NSString stringWithFormat:@" (...%@)", shortID];
if ([result hasSuffix:suffix]) {
return [result substringToIndex:result.length - suffix.length];
} else {
return result;
}
}
__block NSString *result;
@ -1046,7 +1053,13 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
result = [self profileNameForRecipientWithID:recipientID transaction:transaction];
} error:nil];
return result;
NSString *shortID = [recipientID substringWithRange:NSMakeRange(recipientID.length - 8, 8)];
NSString *suffix = [NSString stringWithFormat:@" (...%@)", shortID];
if ([result hasSuffix:suffix]) {
return [result substringToIndex:result.length - suffix.length];
} else {
return result;
}
}
- (nullable NSString *)profileNameForRecipientWithID:(NSString *)recipientID transaction:(YapDatabaseReadWriteTransaction *)transaction

Loading…
Cancel
Save