-
Notifications
You must be signed in to change notification settings - Fork 498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read receipts details #1341
Read receipts details #1341
Conversation
…ers. If the user doesn't have an avatar, the placeholder is placed.
…to read-receipts-details
|
||
@interface ReadReceiptsViewController : UIViewController | ||
|
||
+ (void)openInViewController:(UIViewController *)viewController withRestClient:(MXRestClient *)restClient withRoomMembers:(NSArray <MXRoomMember *> *)roomMembers placeholders:(NSArray <UIImage *> *)placeholders receiptDescriptions:(NSArray <NSString *> *)receiptDescriptions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
withRestClient
and withRoomMembers
*/ | ||
|
||
#import <UIKit/UIKit.h> | ||
#import <MatrixKit/MatrixKit.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to use forward declaration rather than import everything
[self configureViews]; | ||
[self configureReceiptsTableView]; | ||
[self addOverlayViewGesture]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest you to put code from this functions into viewDidLoad
and separate code with comments. These functions are really short and it looks like an overhead to create function for 2 lines of code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feedback
@@ -19,6 +19,6 @@ | |||
|
|||
@interface ReadReceiptsViewController : UIViewController | |||
|
|||
+ (void)openInViewController:(UIViewController *)viewController withRestClient:(MXRestClient *)restClient withRoomMembers:(NSArray <MXRoomMember *> *)roomMembers placeholders:(NSArray <UIImage *> *)placeholders receiptDescriptions:(NSArray <NSString *> *)receiptDescriptions; | |||
+ (void)openInViewController:(UIViewController *)viewController withRestClient:(MXRestClient *)restClient session:(MXSession *)session withRoomMembers:(NSArray <MXRoomMember *> *)roomMembers placeholders:(NSArray <UIImage *> *)placeholders receipts:(NSArray <MXReceiptData *> *)receipts; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer split this operation in 2:
- one to create and return a new
ReadReceiptsViewController
object:
+ (instancetype)readReceiptsViewControllerBasedOnReceiptSendersContainer:(MXKReceiptSendersContainer*)receiptSendersContainer andSession:(MXSession *)session;
Note: the REST client will be deduced from the provided session. The receiptSendersContainer instance will provide all the other inputs.
- another to handle its display:
- (void)showInViewController:(UIViewController*)viewController;
@@ -0,0 +1,88 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please increase the margin of the container view with its superview
NSString *avatarUrl = self.roomMembers[indexPath.row].avatarUrl; | ||
if (self.restClient && avatarUrl) | ||
{ | ||
CGFloat side = CGRectGetWidth(cell.imageView.frame); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use cell. avatarImageView instead of cell.imageView, shouldn't you?
Riot/Model/Room/RoomDataSource.m
Outdated
@@ -148,7 +149,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N | |||
// Some vertical whitespaces are added in message text view (see RoomBubbleCellData class) to insert correctly multiple receipts. | |||
bubbleCell.bubbleOverlayContainer.backgroundColor = [UIColor clearColor]; | |||
bubbleCell.bubbleOverlayContainer.alpha = 1; | |||
bubbleCell.bubbleOverlayContainer.userInteractionEnabled = NO; | |||
bubbleCell.bubbleOverlayContainer.userInteractionEnabled = YES; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, I agree we have to enable the user interaction here on bubble overlay to catch the tap on RR container.
Unfortunately this change will break the message selection in the room history for the bubbles with RR. Don't worry about this, I will take this in charge.
…content view instead of the overlay container to not disturb tag gesture handling. element-hq#59
Read Receipts Details - RoomDataSource
Riot/Model/Room/RoomDataSource.m
Outdated
@@ -17,6 +17,7 @@ | |||
|
|||
#import "RoomDataSource.h" | |||
|
|||
#import "AppDelegate.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to import AppDelegate here?
#import <UIKit/UIKit.h> | ||
#import <MatrixKit/MatrixKit.h> | ||
|
||
@interface ReadReceiptsViewController : UIViewController |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please inherit of MXKViewController instead of UIViewController
|
||
@interface ReadReceiptsViewController : UIViewController | ||
|
||
+ (void)openInViewController:(UIViewController *)viewController withRestClient:(MXRestClient *)restClient session:(MXSession *)session withRoomMembers:(NSArray <MXRoomMember *> *)roomMembers placeholders:(NSArray <UIImage *> *)placeholders receipts:(NSArray <MXReceiptData *> *)receipts; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reduce the number of parameters by passing directly the MXKReceiptSendersContainer instance
- (void)configureViews | ||
{ | ||
self.containerView.layer.cornerRadius = 20; | ||
self.titleLabel.text = @"Read Receipts List"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Define a new key-value in Vector.strings to handle translation of this title.
Then use the macro:
NSLocalizedStringFromTable(@"xxx", @"Vector", nil)
, where xxx is your key.
if (indexPath.row < self.receipts.count) | ||
{ | ||
NSString *receiptDescription = [(MXKEventFormatter*)self.session.roomSummaryUpdateDelegate dateStringFromTimestamp:self.receipts[indexPath.row].ts withTime:YES]; | ||
cell.receiptDescriptionLabel.text = receiptDescription; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may use attributed string to include the prefix "Read:" in this description.
(see https://github.com/vector-im/riot-ios/blob/master/Riot/Model/Contact/ContactsDataSource.m#L658 for an example of NSMutableAttributedString use)
…Vector.strings for translation
…an/riot-ios into read-receipts-details
… now sending the container itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just few remarks
Please sign off
@@ -2405,7 +2414,7 @@ | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
shellPath = /bin/sh; | |||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; | |||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please find the reason of this change on shellScript. Which pod version are you using? FYI we use 1.2.1.
Discard this change from your PR if this is simple for you. Don't waste time on this, I can handle it on my side.
|
||
#pragma mark - Public | ||
|
||
+ (void)openInViewController:(UIViewController *)viewController fromContainer:(MXKReceiptSendersContainer *)receiptSendersContainer withsession:(MXSession *)session |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo withSession instead of withsession
} | ||
if (indexPath.row < self.receipts.count) | ||
{ | ||
NSString *receiptReadText = [NSBundle mxk_localizedStringForKey:@"receipt_status_read"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use NSLocalizedStringFromTable(@"receipt_status_read", @"Vector", nil) when you will have moved the key-value receipt_status_read=xxx
in Vector.strings
{ | ||
NSString *receiptReadText = [NSBundle mxk_localizedStringForKey:@"receipt_status_read"]; | ||
NSString *receiptTimeText = [(MXKEventFormatter*)self.session.roomSummaryUpdateDelegate dateStringFromTimestamp:self.receipts[indexPath.row].ts withTime:YES]; | ||
cell.receiptDescriptionLabel.text = receiptTimeText; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line, you don't have to set cell.receiptDescriptionLabel.text
.
…. Signed-off-by: Aram Sargsyan [email protected]
No description provided.