Archive/Inbox: Unread layout and other enhancements
- Add lastAction indicator for errors and info in TSThreadViews - Enable unarchiving and deletion from archive. - Unread message layout
This commit is contained in:
parent
7080755787
commit
32f1cb3755
|
@ -485,6 +485,8 @@
|
|||
FC3BD97C1A2CD385005B96BB /* signal_dotted@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FC3BD97A1A2CD385005B96BB /* signal_dotted@2x.png */; };
|
||||
FC4FA0261A1B9DC600DA100A /* SignalsNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = FC4FA0251A1B9DC600DA100A /* SignalsNavigationController.m */; };
|
||||
FC4FA0331A1D46AE00DA100A /* InitialViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FC4FA0321A1D46AE00DA100A /* InitialViewController.m */; };
|
||||
FC5CDF391A3393DD00B47253 /* error_white@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FC5CDF371A3393DD00B47253 /* error_white@2x.png */; };
|
||||
FC5CDF3A1A3393DD00B47253 /* warning_white@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FC5CDF381A3393DD00B47253 /* warning_white@2x.png */; };
|
||||
FCA52AE61A2B676C00CCADFA /* call_canceled@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FCA52ADE1A2B676C00CCADFA /* call_canceled@2x.png */; };
|
||||
FCA52AE71A2B676C00CCADFA /* call_failed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FCA52ADF1A2B676C00CCADFA /* call_failed@2x.png */; };
|
||||
FCA52AE81A2B676C00CCADFA /* call_incoming@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FCA52AE01A2B676C00CCADFA /* call_incoming@2x.png */; };
|
||||
|
@ -1151,6 +1153,8 @@
|
|||
FC4FA0251A1B9DC600DA100A /* SignalsNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SignalsNavigationController.m; sourceTree = "<group>"; };
|
||||
FC4FA0311A1D46AE00DA100A /* InitialViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InitialViewController.h; sourceTree = "<group>"; };
|
||||
FC4FA0321A1D46AE00DA100A /* InitialViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InitialViewController.m; sourceTree = "<group>"; };
|
||||
FC5CDF371A3393DD00B47253 /* error_white@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "error_white@2x.png"; sourceTree = "<group>"; };
|
||||
FC5CDF381A3393DD00B47253 /* warning_white@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "warning_white@2x.png"; sourceTree = "<group>"; };
|
||||
FCA52ADE1A2B676C00CCADFA /* call_canceled@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "call_canceled@2x.png"; sourceTree = "<group>"; };
|
||||
FCA52ADF1A2B676C00CCADFA /* call_failed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "call_failed@2x.png"; sourceTree = "<group>"; };
|
||||
FCA52AE01A2B676C00CCADFA /* call_incoming@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "call_incoming@2x.png"; sourceTree = "<group>"; };
|
||||
|
@ -2107,6 +2111,7 @@
|
|||
B633C5161A1D190B0059AC12 /* delete_history@2x.png */,
|
||||
B633C5151A1D190B0059AC12 /* delete@2x.png */,
|
||||
B633C51B1A1D190B0059AC12 /* endcall@2x.png */,
|
||||
FC5CDF371A3393DD00B47253 /* error_white@2x.png */,
|
||||
FC1F90BF1A22342B004F8253 /* group_photo@2x.png */,
|
||||
B633C5321A1D190B0059AC12 /* keypad@2x.png */,
|
||||
B633C5341A1D190B0059AC12 /* lock_white@2x.png */,
|
||||
|
@ -2131,6 +2136,7 @@
|
|||
FC1F90C51A223991004F8253 /* signals_tab@2x.png */,
|
||||
B633C5641A1D190B0059AC12 /* speaker_off@2x.png */,
|
||||
B633C5651A1D190B0059AC12 /* speaker_on@2x.png */,
|
||||
FC5CDF381A3393DD00B47253 /* warning_white@2x.png */,
|
||||
);
|
||||
path = Images;
|
||||
sourceTree = "<group>";
|
||||
|
@ -2834,6 +2840,7 @@
|
|||
FC15B7BF1A1F80F200F59801 /* defaultConctact_light@2x.png in Resources */,
|
||||
E14874F918A06951002CC4F3 /* CountryCodeTableViewCell.xib in Resources */,
|
||||
B633C5871A1D190B0059AC12 /* call_dark@2x.png in Resources */,
|
||||
FC5CDF391A3393DD00B47253 /* error_white@2x.png in Resources */,
|
||||
B633C5851A1D190B0059AC12 /* blue-archive@2x.png in Resources */,
|
||||
B633C5D21A1D190B0059AC12 /* savephoto@2x.png in Resources */,
|
||||
B633C5921A1D190B0059AC12 /* contacts_tab@2x.png in Resources */,
|
||||
|
@ -2849,6 +2856,7 @@
|
|||
FC1F90C61A223991004F8253 /* settings_tab@2x.png in Resources */,
|
||||
FCA52AEA1A2B676C00CCADFA /* call_outgoing@2x.png in Resources */,
|
||||
B633C5B61A1D190B0059AC12 /* lock_white@2x.png in Resources */,
|
||||
FC5CDF3A1A3393DD00B47253 /* warning_white@2x.png in Resources */,
|
||||
B633C5DF1A1D190B0059AC12 /* signal@2x.png in Resources */,
|
||||
B633C5831A1D190B0059AC12 /* backspace.png in Resources */,
|
||||
E1370BE018A0686600826894 /* busy.mp3 in Resources */,
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 7.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.1 KiB |
|
@ -2402,9 +2402,6 @@ Licensed under the GPLv3</string>
|
|||
<fontDescription key="fontDescription" name="HelveticaNeue-Thin" family="Helvetica Neue" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<variation key="heightClass=regular-widthClass=compact" misplaced="YES">
|
||||
<rect key="frame" x="58" y="47" width="285" height="21"/>
|
||||
</variation>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
|
@ -2476,9 +2473,6 @@ Licensed under the GPLv3</string>
|
|||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<variation key="heightClass=regular-widthClass=compact" misplaced="YES">
|
||||
<rect key="frame" x="15" y="21" width="307" height="21"/>
|
||||
</variation>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
|
@ -2609,9 +2603,6 @@ Licensed under the GPLv3</string>
|
|||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<variation key="heightClass=regular-widthClass=compact" misplaced="YES">
|
||||
<rect key="frame" x="15" y="21" width="307" height="21"/>
|
||||
</variation>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
|
|
|
@ -26,7 +26,11 @@ typedef NS_ENUM(NSInteger, TSLastActionType) {
|
|||
TSLastActionMessageSent,
|
||||
TSLastActionMessageDelivered,
|
||||
|
||||
TSLastActionMessageIncoming
|
||||
TSLastActionMessageIncomingRead,
|
||||
TSLastActionMessageIncomingUnread,
|
||||
|
||||
TSLastActionInfoMessage,
|
||||
TSLastActionErrorMessage
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -69,6 +73,6 @@ typedef NS_ENUM(NSInteger, TSLastActionType) {
|
|||
|
||||
- (TSLastActionType)lastAction;
|
||||
|
||||
- (int)unreadMessages;
|
||||
- (BOOL)hasUnreadMessages;
|
||||
|
||||
@end
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#import "TSCall.h"
|
||||
#import "TSOutgoingMessage.h"
|
||||
#import "TSIncomingMessage.h"
|
||||
#import "TSInfoMessage.h"
|
||||
#import "TSErrorMessage.h"
|
||||
|
||||
@implementation TSThread
|
||||
|
||||
|
@ -125,14 +127,27 @@
|
|||
}
|
||||
|
||||
} else if ([interaction isKindOfClass:[TSIncomingMessage class]]) {
|
||||
return TSLastActionNone;
|
||||
return self.hasUnreadMessages ? TSLastActionMessageIncomingUnread : TSLastActionMessageIncomingRead ;
|
||||
} else if ([interaction isKindOfClass:[TSErrorMessage class]]) {
|
||||
return TSLastActionErrorMessage;
|
||||
} else if ([interaction isKindOfClass:[TSInfoMessage class]]) {
|
||||
return TSLastActionInfoMessage;
|
||||
} else {
|
||||
return TSLastActionNone;
|
||||
}
|
||||
}
|
||||
|
||||
- (int)unreadMessages{
|
||||
return 0;
|
||||
- (BOOL)hasUnreadMessages{
|
||||
__block TSInteraction * interaction;
|
||||
__block BOOL hasUnread = NO;
|
||||
[[TSStorageManager sharedManager].dbConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||
interaction = [TSInteraction fetchObjectWithUniqueID:[TSInteraction stringFromTimeStamp:_lastMessageId] transaction:transaction];
|
||||
if ([interaction isKindOfClass:[TSIncomingMessage class]]){
|
||||
hasUnread = ![(TSIncomingMessage*)interaction wasRead];
|
||||
}
|
||||
}];
|
||||
|
||||
return hasUnread;
|
||||
}
|
||||
|
||||
- (NSString *)name{
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
+ (UIFont*) ows_regularFontWithSize:(CGFloat)size;
|
||||
|
||||
+ (UIFont*) ows_mediumFontWithSize:(CGFloat)size;
|
||||
|
||||
+ (UIFont*) ows_boldFontWithSize:(CGFloat)size;
|
||||
|
||||
@end
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
static NSString *const kHelveticaNeueThin = @"HelveticaNeue-Thin";
|
||||
static NSString *const kHelveticaNeueLight = @"HelveticaNeue-Light";
|
||||
static NSString *const kHelveticaNeueRegular = @"HelveticaNeue-Regular";
|
||||
static NSString *const kHelveticaNeueMedium = @"HelveticaNeue-Medium";
|
||||
static NSString *const kHelveticaNeueBold = @"HelveticaNeue-Bold";
|
||||
|
||||
#import "UIFont+OWS.h"
|
||||
|
@ -30,6 +31,11 @@ static NSString *const kHelveticaNeueBold = @"HelveticaNeue-Bold";
|
|||
return [UIFont fontWithName:kHelveticaNeueRegular size:size];
|
||||
}
|
||||
|
||||
+ (UIFont*) ows_mediumFontWithSize:(CGFloat)size
|
||||
{
|
||||
return [UIFont fontWithName:kHelveticaNeueMedium size:size];
|
||||
}
|
||||
|
||||
+ (UIFont*) ows_boldFontWithSize:(CGFloat)size
|
||||
{
|
||||
return [UIFont fontWithName:kHelveticaNeueBold size:size];
|
||||
|
|
|
@ -8,10 +8,11 @@
|
|||
|
||||
#import "InboxTableViewCell.h"
|
||||
#import "Util.h"
|
||||
#import "UIImage+JSQMessages.h"
|
||||
|
||||
#define ARCHIVE_IMAGE_VIEW_WIDTH 22.0f
|
||||
#define DELETE_IMAGE_VIEW_WIDTH 19.0f
|
||||
#define TIME_LABEL_SIZE 10
|
||||
#define TIME_LABEL_SIZE 11
|
||||
#define DATE_LABEL_SIZE 13
|
||||
|
||||
|
||||
|
@ -28,10 +29,11 @@
|
|||
CGRectGetHeight(_scrollView.frame));
|
||||
|
||||
[UIUtil applyRoundedBorderToImageView:&_contactPictureView];
|
||||
|
||||
|
||||
_scrollView.contentOffset = CGPointMake(CGRectGetWidth(_archiveView.frame), 0);
|
||||
_deleteImageView.image = [_deleteImageView.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
||||
_archiveImageView.image = [_archiveImageView.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
||||
_lastActionImageView.image = [_lastActionImageView.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
||||
|
||||
}
|
||||
return self;
|
||||
|
@ -55,10 +57,9 @@
|
|||
{
|
||||
switch (state) {
|
||||
case kArchiveState:
|
||||
_scrollView.userInteractionEnabled=NO;
|
||||
_archiveImageView.image = [[UIImage imageNamed:@"reply"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
||||
break;
|
||||
case kInboxState:
|
||||
_scrollView.userInteractionEnabled=YES;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -101,15 +102,41 @@
|
|||
case TSLastActionMessageDelivered:
|
||||
_lastActionImageView.image = [UIImage imageNamed:@"checkmark_light"];
|
||||
break;
|
||||
case TSLastActionMessageIncoming:
|
||||
case TSLastActionMessageIncomingRead:
|
||||
_lastActionImageView.image = nil;
|
||||
break;
|
||||
case TSLastActionMessageIncomingUnread:
|
||||
[self updateCellForUnreadMessage];
|
||||
_lastActionImageView.image = nil;
|
||||
break;
|
||||
case TSLastActionInfoMessage:
|
||||
_lastActionImageView.image = [UIImage imageNamed:@"warning_white"];
|
||||
break;
|
||||
case TSLastActionErrorMessage:
|
||||
_lastActionImageView.image = [UIImage imageNamed:@"error_white"];
|
||||
break;
|
||||
default:
|
||||
_lastActionImageView.image = nil;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)updateCellForUnreadMessage
|
||||
{
|
||||
_nameLabel.font = [UIFont ows_mediumFontWithSize:17.0f];
|
||||
_snippetLabel.textColor = [UIColor blackColor];
|
||||
_timeLabel.textColor = [UIColor ows_blueColor];
|
||||
[_contactPictureView.layer setBorderWidth:1.0f];
|
||||
[_contactPictureView.layer setBorderColor:[[UIColor ows_blueColor] CGColor]];
|
||||
|
||||
}
|
||||
|
||||
-(void)updateCellForReadMessage
|
||||
{
|
||||
_nameLabel.font = [UIFont ows_lightFontWithSize:17.0f];
|
||||
_snippetLabel.textColor = [UIColor lightGrayColor];
|
||||
}
|
||||
|
||||
#pragma mark - Date formatting
|
||||
|
||||
- (NSAttributedString *)dateAttributedString:(NSDate *)date {
|
||||
|
@ -137,31 +164,32 @@
|
|||
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
||||
|
||||
if (_scrollView.contentOffset.x < 0) {
|
||||
_archiveImageView.image = [UIImage imageNamed:@"blue-archive"];
|
||||
_archiveImageView.image = [_archiveImageView.image jsq_imageMaskedWithColor:[UIColor ows_blueColor]];
|
||||
_archiveImageView.bounds = CGRectMake(_archiveImageView.bounds.origin.x,
|
||||
_archiveImageView.bounds.origin.y,
|
||||
ARCHIVE_IMAGE_VIEW_WIDTH,
|
||||
_archiveImageView.bounds.size.height);
|
||||
} else {
|
||||
|
||||
_archiveImageView.image = [_archiveImageView.image jsq_imageMaskedWithColor:[UIColor ows_darkGrayColor]];
|
||||
double ratio = (_archiveView.frame.size.width/2.0f - _scrollView.contentOffset.x) / (_archiveView.frame.size.width/2.0f);
|
||||
double newWidth = ARCHIVE_IMAGE_VIEW_WIDTH/2.0f + (ARCHIVE_IMAGE_VIEW_WIDTH * ratio)/2.0f;
|
||||
_archiveImageView.bounds = CGRectMake(_archiveImageView.bounds.origin.x,
|
||||
_archiveImageView.bounds.origin.y,
|
||||
(CGFloat)newWidth,
|
||||
_archiveImageView.bounds.size.height);
|
||||
_archiveImageView.tintColor = UIColor.whiteColor;
|
||||
|
||||
}
|
||||
|
||||
if (scrollView.contentOffset.x > CGRectGetWidth(_archiveView.frame)*2) {
|
||||
_deleteImageView.image = [UIImage imageNamed:@"red-delete"];
|
||||
_deleteImageView.image = [_deleteImageView.image jsq_imageMaskedWithColor:[UIColor ows_redColor]];
|
||||
_deleteImageView.bounds = CGRectMake(_deleteImageView.bounds.origin.x,
|
||||
_deleteImageView.bounds.origin.y,
|
||||
DELETE_IMAGE_VIEW_WIDTH,
|
||||
_deleteImageView.bounds.size.height);
|
||||
} else {
|
||||
|
||||
_deleteImageView.image = [_deleteImageView.image jsq_imageMaskedWithColor:[UIColor ows_darkGrayColor]];
|
||||
double ratio = _scrollView.contentOffset.x / (CGRectGetWidth(_deleteView.frame)*2);
|
||||
double newWidth = DELETE_IMAGE_VIEW_WIDTH/2.0f + (DELETE_IMAGE_VIEW_WIDTH * ratio)/2.0f;
|
||||
|
||||
|
@ -169,7 +197,6 @@
|
|||
_deleteImageView.bounds.origin.y,
|
||||
(CGFloat)newWidth,
|
||||
_deleteImageView.bounds.size.height);
|
||||
_deleteImageView.tintColor = UIColor.whiteColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -66,10 +66,11 @@
|
|||
<color key="textColor" red="0.13725490200000001" green="0.1215686275" blue="0.12549019610000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</label>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="reply.png" translatesAutoresizingMaskIntoConstraints="NO" id="BV6-Tp-SmZ">
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="reply.png" translatesAutoresizingMaskIntoConstraints="NO" id="BV6-Tp-SmZ">
|
||||
<rect key="frame" x="457" y="35" width="20" height="20"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="20" id="FZI-2j-0TT"/>
|
||||
<constraint firstAttribute="height" constant="20" id="Skf-jE-LB3"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dGa-iy-WtH" userLabel="Archive View">
|
||||
|
|
|
@ -140,7 +140,7 @@ static NSString *const kSegueIndentifier = @"showSegue";
|
|||
- (void)tableViewCellTappedArchive:(InboxTableViewCell*)cell {
|
||||
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
|
||||
TSThread *thread = [self threadForIndexPath:indexPath];
|
||||
thread.archivalDate = [NSDate date];
|
||||
thread.archivalDate = _inboxArchiveSwitch.selectedSegmentIndex == 0 ? [NSDate date] : nil ;
|
||||
|
||||
[self.editingDbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
[thread saveWithTransaction:transaction];
|
||||
|
|
Loading…
Reference in New Issue