From 76745bee5b979ce1cffa7f4904095ecb1bad028b Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 9 Jul 2018 17:00:41 -0600 Subject: [PATCH 1/3] failed background color to spec --- Signal/src/ViewControllers/DebugUI/DebugUIMessages.m | 6 +++--- SignalMessaging/utils/ConversationStyle.swift | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m index dbea7315f..c98ea9c46 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m +++ b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m @@ -1328,7 +1328,7 @@ NS_ASSUME_NONNULL_BEGIN [self fakeOutgoingPngAction:thread actionLabel:@"Fake Outgoing 'Outgoing Unsent' Png" imageSize:CGSizeMake(200.f, 200.f) - backgroundColor:[conversationStyle bubbleColorOutgoingUnsent] + backgroundColor:[conversationStyle bubbleColorOutgoingFailed] textColor:[UIColor whiteColor] imageLabel:@"W" messageState:TSOutgoingMessageStateFailed @@ -1336,7 +1336,7 @@ NS_ASSUME_NONNULL_BEGIN [self fakeOutgoingPngAction:thread actionLabel:@"Fake Outgoing 'Outgoing Unsent' Png" imageSize:CGSizeMake(200.f, 200.f) - backgroundColor:[conversationStyle bubbleColorOutgoingUnsent] + backgroundColor:[conversationStyle bubbleColorOutgoingFailed] textColor:[UIColor whiteColor] imageLabel:@"W" messageState:TSOutgoingMessageStateSending @@ -1344,7 +1344,7 @@ NS_ASSUME_NONNULL_BEGIN [self fakeOutgoingPngAction:thread actionLabel:@"Fake Outgoing 'Outgoing Unsent' Png" imageSize:CGSizeMake(200.f, 200.f) - backgroundColor:[conversationStyle bubbleColorOutgoingUnsent] + backgroundColor:[conversationStyle bubbleColorOutgoingFailed] textColor:[UIColor whiteColor] imageLabel:@"W" messageState:TSOutgoingMessageStateSent diff --git a/SignalMessaging/utils/ConversationStyle.swift b/SignalMessaging/utils/ConversationStyle.swift index 89929e4ba..0a55b85c6 100644 --- a/SignalMessaging/utils/ConversationStyle.swift +++ b/SignalMessaging/utils/ConversationStyle.swift @@ -137,7 +137,7 @@ public class ConversationStyle: NSObject { private static let defaultBubbleColorIncoming = UIColor.ows_messageBubbleLightGray @objc - public let bubbleColorOutgoingUnsent = UIColor.ows_light10 + public let bubbleColorOutgoingFailed = UIColor.ows_darkSkyBlue @objc public let bubbleColorOutgoingSending = UIColor.ows_fadedBlue @@ -155,7 +155,7 @@ public class ConversationStyle: NSObject { } else if let outgoingMessage = message as? TSOutgoingMessage { switch outgoingMessage.messageState { case .failed: - return bubbleColorOutgoingUnsent + return bubbleColorOutgoingFailed case .sending: return bubbleColorOutgoingSending default: From d5e15b2a0d0de6750f10f9ee6d0eeeeb7317255b Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 9 Jul 2018 17:00:49 -0600 Subject: [PATCH 2/3] FAILED label capitalized to spec --- .../ConversationView/Cells/OWSMessageFooterView.m | 7 +++++-- Signal/src/util/DateUtil.m | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m index a125c4dc0..5d491663c 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m @@ -164,12 +164,15 @@ NS_ASSUME_NONNULL_BEGIN [self configureFonts]; + NSString *timestampLabelText; if ([self isFailedOutgoingMessage:viewItem]) { - self.timestampLabel.text + timestampLabelText = NSLocalizedString(@"MESSAGE_STATUS_SEND_FAILED", @"Label indicating that a message failed to send."); } else { - self.timestampLabel.text = [DateUtil formatMessageTimestamp:viewItem.interaction.timestamp]; + timestampLabelText = [DateUtil formatMessageTimestamp:viewItem.interaction.timestamp]; } + + self.timestampLabel.text = timestampLabelText.localizedUppercaseString; } - (CGSize)measureWithConversationViewItem:(ConversationViewItem *)viewItem diff --git a/Signal/src/util/DateUtil.m b/Signal/src/util/DateUtil.m index bda7dcaec..38e1bb47e 100644 --- a/Signal/src/util/DateUtil.m +++ b/Signal/src/util/DateUtil.m @@ -302,7 +302,7 @@ static NSString *const DATE_FORMAT_WEEKDAY = @"EEEE"; @"hours in the past. Embeds {{The number of hours}}."), hoursString]; } - return result.uppercaseString; + return result; } + (BOOL)isTimestampFromLastHour:(uint64_t)timestamp From 10ac7be03af04fa6476adf24f0ba23c70a28c5ca Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Tue, 10 Jul 2018 10:09:31 -0600 Subject: [PATCH 3/3] prefer localizedUppercaseString for user facing text // FREEBIE --- .../ConversationView/Cells/AttachmentUploadView.m | 2 +- .../ConversationView/Cells/OWSAudioMessageView.m | 2 +- .../ConversationView/Cells/OWSGenericAttachmentView.m | 4 ++-- .../ViewControllers/ConversationView/Cells/OWSMessageCell.m | 2 +- .../ConversationView/Cells/OWSUnreadIndicatorCell.m | 2 +- .../Registration/RegistrationViewController.m | 2 +- Signal/src/util/DateUtil.m | 6 +++--- SignalMessaging/contacts/SelectRecipientViewController.m | 2 +- SignalMessaging/utils/OWSContactAvatarBuilder.m | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/Cells/AttachmentUploadView.m b/Signal/src/ViewControllers/ConversationView/Cells/AttachmentUploadView.m index bb6785950..cf28de377 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/AttachmentUploadView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/AttachmentUploadView.m @@ -80,7 +80,7 @@ NS_ASSUME_NONNULL_BEGIN self.progressLabel = [UILabel new]; self.progressLabel.text = NSLocalizedString( @"MESSAGE_METADATA_VIEW_MESSAGE_STATUS_UPLOADING", @"Status label for messages which are uploading.") - .uppercaseString; + .localizedUppercaseString; self.progressLabel.textColor = UIColor.whiteColor; self.progressLabel.font = [UIFont ows_dynamicTypeCaption1Font]; self.progressLabel.textAlignment = NSTextAlignmentCenter; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m index 029cdb0a4..e167b21c5 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m @@ -194,7 +194,7 @@ NS_ASSUME_NONNULL_BEGIN } NSString *topText = [[filename stringByDeletingPathExtension] ows_stripped]; if (topText.length < 1) { - topText = [MIMETypeUtil fileExtensionForMIMEType:self.attachmentStream.contentType].uppercaseString; + topText = [MIMETypeUtil fileExtensionForMIMEType:self.attachmentStream.contentType].localizedUppercaseString; } if (topText.length < 1) { topText = NSLocalizedString(@"GENERIC_ATTACHMENT_LABEL", @"A label for generic attachments."); diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSGenericAttachmentView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSGenericAttachmentView.m index 78907a2ca..a43991249 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSGenericAttachmentView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSGenericAttachmentView.m @@ -113,7 +113,7 @@ NS_ASSUME_NONNULL_BEGIN } UILabel *fileTypeLabel = [UILabel new]; - fileTypeLabel.text = fileExtension.uppercaseString; + fileTypeLabel.text = fileExtension.localizedUppercaseString; fileTypeLabel.textColor = [UIColor ows_light90Color]; fileTypeLabel.lineBreakMode = NSLineBreakByTruncatingTail; fileTypeLabel.font = [UIFont ows_dynamicTypeCaption1Font].ows_mediumWeight; @@ -132,7 +132,7 @@ NS_ASSUME_NONNULL_BEGIN NSString *topText = [self.attachmentStream.sourceFilename ows_stripped]; if (topText.length < 1) { - topText = [MIMETypeUtil fileExtensionForMIMEType:self.attachmentStream.contentType].uppercaseString; + topText = [MIMETypeUtil fileExtensionForMIMEType:self.attachmentStream.contentType].localizedUppercaseString; } if (topText.length < 1) { topText = NSLocalizedString(@"GENERIC_ATTACHMENT_LABEL", @"A label for generic attachments."); diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m index 6aa0fe4f7..515a3142c 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageCell.m @@ -276,7 +276,7 @@ NS_ASSUME_NONNULL_BEGIN NSString *timeString = [dateHeaderTimeFormatter stringFromDate:date]; NSAttributedString *attributedText = [NSAttributedString new]; - attributedText = [attributedText rtlSafeAppend:dateString.uppercaseString + attributedText = [attributedText rtlSafeAppend:dateString.localizedUppercaseString attributes:@{ NSFontAttributeName : self.dateHeaderFont, NSForegroundColorAttributeName : [UIColor lightGrayColor], diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSUnreadIndicatorCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSUnreadIndicatorCell.m index 5bd612c45..9b9c9c066 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSUnreadIndicatorCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSUnreadIndicatorCell.m @@ -115,7 +115,7 @@ NS_ASSUME_NONNULL_BEGIN - (NSString *)titleForInteraction:(TSUnreadIndicatorInteraction *)interaction { return NSLocalizedString(@"MESSAGES_VIEW_UNREAD_INDICATOR", @"Indicator that separates read from unread messages.") - .uppercaseString; + .localizedUppercaseString; } - (NSString *)subtitleForInteraction:(TSUnreadIndicatorInteraction *)interaction diff --git a/Signal/src/ViewControllers/Registration/RegistrationViewController.m b/Signal/src/ViewControllers/Registration/RegistrationViewController.m index dd957f5d7..2cc779ca5 100644 --- a/Signal/src/ViewControllers/Registration/RegistrationViewController.m +++ b/Signal/src/ViewControllers/Registration/RegistrationViewController.m @@ -373,7 +373,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi _countryCode = countryCode; _callingCode = callingCode; - NSString *title = [NSString stringWithFormat:@"%@ (%@)", callingCode, countryCode.uppercaseString]; + NSString *title = [NSString stringWithFormat:@"%@ (%@)", callingCode, countryCode.localizedUppercaseString]; self.countryCodeLabel.text = title; [self.countryCodeLabel setNeedsLayout]; diff --git a/Signal/src/util/DateUtil.m b/Signal/src/util/DateUtil.m index 38e1bb47e..28aece134 100644 --- a/Signal/src/util/DateUtil.m +++ b/Signal/src/util/DateUtil.m @@ -203,7 +203,7 @@ static NSString *const DATE_FORMAT_WEEKDAY = @"EEEE"; dateTimeString = [[DateUtil timeFormatter] stringFromDate:date]; } - return dateTimeString.uppercaseString; + return dateTimeString.localizedUppercaseString; } + (NSString *)formatTimestampAsTime:(uint64_t)timestamp @@ -216,7 +216,7 @@ static NSString *const DATE_FORMAT_WEEKDAY = @"EEEE"; OWSAssert(date); NSString *dateTimeString = [[DateUtil timeFormatter] stringFromDate:date]; - return dateTimeString.uppercaseString; + return dateTimeString.localizedUppercaseString; } + (NSDateFormatter *)otherYearMessageFormatter @@ -320,7 +320,7 @@ static NSString *const DATE_FORMAT_WEEKDAY = @"EEEE"; + (NSString *)exemplaryNowTimeFormat { - return NSLocalizedString(@"DATE_NOW", @"The present; the current time.").uppercaseString; + return NSLocalizedString(@"DATE_NOW", @"The present; the current time.").localizedUppercaseString; } + (NSString *)exemplaryMinutesTimeFormat diff --git a/SignalMessaging/contacts/SelectRecipientViewController.m b/SignalMessaging/contacts/SelectRecipientViewController.m index bcb494a70..506f8e44e 100644 --- a/SignalMessaging/contacts/SelectRecipientViewController.m +++ b/SignalMessaging/contacts/SelectRecipientViewController.m @@ -243,7 +243,7 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien _callingCode = callingCode; NSString *titleFormat = (CurrentAppContext().isRTL ? @"(%2$@) %1$@" : @"%1$@ (%2$@)"); - NSString *title = [NSString stringWithFormat:titleFormat, callingCode, countryCode.uppercaseString]; + NSString *title = [NSString stringWithFormat:titleFormat, callingCode, countryCode.localizedUppercaseString]; [self.countryCodeButton setTitle:title forState:UIControlStateNormal]; [self.countryCodeButton layoutSubviews]; diff --git a/SignalMessaging/utils/OWSContactAvatarBuilder.m b/SignalMessaging/utils/OWSContactAvatarBuilder.m index add15038f..c190f5145 100644 --- a/SignalMessaging/utils/OWSContactAvatarBuilder.m +++ b/SignalMessaging/utils/OWSContactAvatarBuilder.m @@ -111,7 +111,7 @@ NS_ASSUME_NONNULL_BEGIN NSString *trimmedWord = [word stringByTrimmingCharactersInSet:excludeAlphanumeric]; if (trimmedWord.length > 0) { NSString *firstLetter = [trimmedWord substringToIndex:1]; - [initials appendString:[firstLetter uppercaseString]]; + [initials appendString:firstLetter.localizedUppercaseString]; } }