Align the message state indicators with the behavior on Android and desktop.

// FREEBIE
This commit is contained in:
Matthew Chen 2017-03-14 17:01:12 -03:00
parent 1820fdbde8
commit 442546fba8
10 changed files with 84 additions and 26 deletions

View File

@ -9,6 +9,9 @@
/* Begin PBXBuildFile section */
340757C21E5602D6001F15DD /* AttachmentSharing.m in Sources */ = {isa = PBXBuildFile; fileRef = 340757C11E5602D6001F15DD /* AttachmentSharing.m */; };
341BB7491DB727EE001E2975 /* JSQMediaItem+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = 341BB7481DB727EE001E2975 /* JSQMediaItem+OWS.m */; };
34330A5A1E7875FB00DF2FB9 /* fontawesome-webfont.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 34330A591E7875FB00DF2FB9 /* fontawesome-webfont.ttf */; };
34330A5C1E787A9800DF2FB9 /* dripicons-v2.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 34330A5B1E787A9800DF2FB9 /* dripicons-v2.ttf */; };
34330A5E1E787BD800DF2FB9 /* ElegantIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 34330A5D1E787BD800DF2FB9 /* ElegantIcons.ttf */; };
344F2F671E57A932000D9322 /* UIViewController+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = 344F2F661E57A932000D9322 /* UIViewController+OWS.m */; };
34535D821E256BE9008A4747 /* UIView+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = 34535D811E256BE9008A4747 /* UIView+OWS.m */; };
348A08421E6A044E0057E290 /* MessagesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 348A08411E6A044E0057E290 /* MessagesViewController.xib */; };
@ -625,6 +628,9 @@
340757C11E5602D6001F15DD /* AttachmentSharing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AttachmentSharing.m; sourceTree = "<group>"; };
341BB7471DB727EE001E2975 /* JSQMediaItem+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JSQMediaItem+OWS.h"; sourceTree = "<group>"; };
341BB7481DB727EE001E2975 /* JSQMediaItem+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "JSQMediaItem+OWS.m"; sourceTree = "<group>"; };
34330A591E7875FB00DF2FB9 /* fontawesome-webfont.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "fontawesome-webfont.ttf"; sourceTree = "<group>"; };
34330A5B1E787A9800DF2FB9 /* dripicons-v2.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "dripicons-v2.ttf"; sourceTree = "<group>"; };
34330A5D1E787BD800DF2FB9 /* ElegantIcons.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = ElegantIcons.ttf; sourceTree = "<group>"; };
344F2F651E57A932000D9322 /* UIViewController+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIViewController+OWS.h"; path = "util/UIViewController+OWS.h"; sourceTree = "<group>"; };
344F2F661E57A932000D9322 /* UIViewController+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIViewController+OWS.m"; path = "util/UIViewController+OWS.m"; sourceTree = "<group>"; };
34535D801E256BE9008A4747 /* UIView+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+OWS.h"; sourceTree = "<group>"; };
@ -1345,6 +1351,16 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
34330A581E7875FB00DF2FB9 /* Fonts */ = {
isa = PBXGroup;
children = (
34330A5B1E787A9800DF2FB9 /* dripicons-v2.ttf */,
34330A5D1E787BD800DF2FB9 /* ElegantIcons.ttf */,
34330A591E7875FB00DF2FB9 /* fontawesome-webfont.ttf */,
);
path = Fonts;
sourceTree = "<group>";
};
4505C2BD1E648E6E00CEBF41 /* ExperienceUpgrades */ = {
isa = PBXGroup;
children = (
@ -2536,6 +2552,7 @@
isa = PBXGroup;
children = (
B657DDC91911A40500F45B0C /* Signal.entitlements */,
34330A581E7875FB00DF2FB9 /* Fonts */,
B633C4FD1A1D190B0059AC12 /* Images */,
B67EBF5C19194AC60084CCFD /* Settings.bundle */,
76EB03C118170B33006006FC /* src */,
@ -2914,6 +2931,7 @@
E94066151DFC5B7B00B15392 /* ContactsPicker.xib in Resources */,
AD41D7B61A6F6F0600241130 /* play_button@2x.png in Resources */,
AD83FF3F1A73426500B5C81A /* audio_pause_button_blue.png in Resources */,
34330A5A1E7875FB00DF2FB9 /* fontawesome-webfont.ttf in Resources */,
348A08421E6A044E0057E290 /* MessagesViewController.xib in Resources */,
45E1F3A31DEF1DF000852CF1 /* NoSignalContactsView.xib in Resources */,
A5509ECA1A69AB8B00ABA4BC /* Main.storyboard in Resources */,
@ -2922,6 +2940,7 @@
AD83FF421A73426500B5C81A /* audio_play_button.png in Resources */,
45F2B1981D9CA207000D2C69 /* OWSOutgoingMessageCollectionViewCell.xib in Resources */,
45C681C41D305C9E0050903A /* OWSCallCollectionViewCell.xib in Resources */,
34330A5C1E787A9800DF2FB9 /* dripicons-v2.ttf in Resources */,
B633C5C41A1D190B0059AC12 /* mute_on@2x.png in Resources */,
B633C5CE1A1D190B0059AC12 /* quit@2x.png in Resources */,
AD83FF441A73426500B5C81A /* audio_pause_button.png in Resources */,
@ -2960,6 +2979,7 @@
B10C9B5F1A7049EC00ECA2BF /* pause_icon.png in Resources */,
AD83FF471A73428300B5C81A /* audio_play_button_blue.png in Resources */,
348A08441E6A1D2C0057E290 /* OWSMessagesToolbarContentView.xib in Resources */,
34330A5E1E787BD800DF2FB9 /* ElegantIcons.ttf in Resources */,
AD83FF451A73426500B5C81A /* audio_pause_button@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;

BIN
Signal/Fonts/ElegantIcons.ttf Executable file

Binary file not shown.

BIN
Signal/Fonts/dripicons-v2.ttf Executable file

Binary file not shown.

Binary file not shown.

View File

@ -110,5 +110,11 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UIAppFonts</key>
<array>
<string>dripicons-v2.ttf</string>
<string>ElegantIcons.ttf</string>
<string>fontawesome-webfont.ttf</string>
</array>
</dict>
</plist>

View File

@ -1,9 +1,5 @@
//
// TSMessageAdapter.h
// Signal
//
// Created by Frederic Jacobs on 24/11/14.
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "OWSMessageData.h"
@ -25,8 +21,9 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic) TSInteraction *interaction;
@property (readonly) TSInfoMessageType infoMessageType;
@property (nonatomic, readonly) CGFloat mediaViewAlpha;
@property (nonatomic, readonly) BOOL isOutgoingAndDelivered;
@property (nonatomic, readonly) BOOL isMediaBeingSent;
@property (nonatomic, readonly) BOOL isOutgoingAndSent;
@property (nonatomic, readonly) BOOL isOutgoingAndDelivered;
@end

View File

@ -351,6 +351,17 @@
return NO;
}
- (BOOL)isOutgoingAndSent
{
if ([self.interaction isKindOfClass:[TSOutgoingMessage class]]) {
TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)self.interaction;
if (outgoingMessage.messageState == TSOutgoingMessageStateSent) {
return YES;
}
}
return NO;
}
- (BOOL)isOutgoingAndDelivered
{
if ([self.interaction isKindOfClass:[TSOutgoingMessage class]]) {

View File

@ -1,9 +1,5 @@
//
// UIFont+OWS.h
// Signal
//
// Created by Dylan Bourgeois on 25/11/14.
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import <UIKit/UIKit.h>
@ -20,8 +16,13 @@
+ (UIFont *)ows_boldFontWithSize:(CGFloat)size;
#pragma mark - Icon Fonts
#pragma mark Dynamic Type
+ (UIFont *)ows_fontAwesomeFont:(CGFloat)size;
+ (UIFont *)ows_dripIconsFont:(CGFloat)size;
+ (UIFont *)ows_elegantIconsFont:(CGFloat)size;
#pragma mark - Dynamic Type
+ (UIFont *)ows_dynamicTypeBodyFont;
+ (UIFont *)ows_dynamicTypeTitle2Font;

View File

@ -1,9 +1,5 @@
//
// UIFont+OWS.m
// Signal
//
// Created by Dylan Bourgeois on 25/11/14.
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "UIFont+OWS.h"
@ -47,7 +43,24 @@
return [UIFont boldSystemFontOfSize:size];
}
#pragma mark Dynamic Type
#pragma mark - Icon Fonts
+ (UIFont *)ows_fontAwesomeFont:(CGFloat)size
{
return [UIFont fontWithName:@"FontAwesome" size:size];
}
+ (UIFont *)ows_dripIconsFont:(CGFloat)size
{
return [UIFont fontWithName:@"dripicons-v2" size:size];
}
+ (UIFont *)ows_elegantIconsFont:(CGFloat)size
{
return [UIFont fontWithName:@"ElegantIcons" size:size];
}
#pragma mark - Dynamic Type
+ (UIFont *)ows_dynamicTypeBodyFont {
return [UIFont preferredFontForTextStyle:UIFontTextStyleBody];

View File

@ -1277,25 +1277,35 @@ typedef enum : NSUInteger {
TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)message.interaction;
if (outgoingMessage.messageState == TSOutgoingMessageStateUnsent) {
return [[NSAttributedString alloc] initWithString:NSLocalizedString(@"FAILED_SENDING_TEXT", nil)];
} else if (message.isOutgoingAndDelivered) {
NSAttributedString *deliveredString =
[[NSAttributedString alloc] initWithString:NSLocalizedString(@"DELIVERED_MESSAGE_TEXT", @"")];
} else if (message.isOutgoingAndDelivered ||
message.isOutgoingAndSent) {
// Show a checkmark icon.
NSAttributedString *result =
// Show an "..." ellisis icon.
[[NSAttributedString alloc] initWithString:@"N"
attributes:@{
NSFontAttributeName: [UIFont ows_elegantIconsFont:10.f],
}];
// Show when it's the last message in the thread
if (indexPath.item == [self.collectionView numberOfItemsInSection:indexPath.section] - 1) {
[self updateLastDeliveredMessage:message];
return deliveredString;
return result;
}
// Or when the next message is *not* an outgoing delivered message.
TSMessageAdapter *nextMessage = [self nextOutgoingMessage:indexPath];
if (!nextMessage.isOutgoingAndDelivered) {
[self updateLastDeliveredMessage:message];
return deliveredString;
return result;
}
} else if (message.isMediaBeingSent) {
return [[NSAttributedString alloc] initWithString:NSLocalizedString(@"UPLOADING_MESSAGE_TEXT",
@"message footer while attachment is uploading")];
NSAttributedString *result =
[[NSAttributedString alloc] initWithString:@"/"
attributes:@{
NSFontAttributeName: [UIFont ows_dripIconsFont:14.f],
}];
return result;
}
} else if (message.messageType == TSIncomingMessageAdapter && [self.thread isKindOfClass:[TSGroupThread class]]) {
TSIncomingMessage *incomingMessage = (TSIncomingMessage *)message.interaction;