-
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
Changes from 10 commits
6243eec
ab5c0e6
ee47992
6b9465f
f32ccae
e688c61
6f08b14
74455c0
d736006
6b25f8f
9bb1897
ea3ae98
e17622b
f287dc4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ | |
objects = { | ||
|
||
/* Begin PBXBuildFile section */ | ||
24B5103E1EFA7083004C6AD2 /* ReadReceiptsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 24B5103D1EFA7083004C6AD2 /* ReadReceiptsViewController.m */; }; | ||
24B510401EFA88CC004C6AD2 /* ReadReceiptsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 24B5103F1EFA88CC004C6AD2 /* ReadReceiptsViewController.xib */; }; | ||
3205ED7D1E976C8A003D65FA /* DirectoryServerPickerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3205ED7C1E976C8A003D65FA /* DirectoryServerPickerViewController.m */; }; | ||
3205ED841E97725E003D65FA /* DirectoryServerTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3205ED821E97725E003D65FA /* DirectoryServerTableViewCell.m */; }; | ||
3205ED851E97725E003D65FA /* DirectoryServerTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3205ED831E97725E003D65FA /* DirectoryServerTableViewCell.xib */; }; | ||
|
@@ -471,6 +473,9 @@ | |
|
||
/* Begin PBXFileReference section */ | ||
1129C74A281B080432B1A1A1 /* Pods-Riot.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Riot.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Riot/Pods-Riot.debug.xcconfig"; sourceTree = "<group>"; }; | ||
24B5103C1EFA7083004C6AD2 /* ReadReceiptsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadReceiptsViewController.h; sourceTree = "<group>"; }; | ||
24B5103D1EFA7083004C6AD2 /* ReadReceiptsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ReadReceiptsViewController.m; sourceTree = "<group>"; }; | ||
24B5103F1EFA88CC004C6AD2 /* ReadReceiptsViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ReadReceiptsViewController.xib; sourceTree = "<group>"; }; | ||
3205ED7B1E976C8A003D65FA /* DirectoryServerPickerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryServerPickerViewController.h; sourceTree = "<group>"; }; | ||
3205ED7C1E976C8A003D65FA /* DirectoryServerPickerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DirectoryServerPickerViewController.m; sourceTree = "<group>"; }; | ||
3205ED811E97725E003D65FA /* DirectoryServerTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryServerTableViewCell.h; sourceTree = "<group>"; }; | ||
|
@@ -1585,6 +1590,9 @@ | |
F083BC541E7009EC00A9B29C /* StartChatViewController.xib */, | ||
F083BC551E7009EC00A9B29C /* UsersDevicesViewController.h */, | ||
F083BC561E7009EC00A9B29C /* UsersDevicesViewController.m */, | ||
24B5103C1EFA7083004C6AD2 /* ReadReceiptsViewController.h */, | ||
24B5103D1EFA7083004C6AD2 /* ReadReceiptsViewController.m */, | ||
24B5103F1EFA88CC004C6AD2 /* ReadReceiptsViewController.xib */, | ||
); | ||
path = ViewController; | ||
sourceTree = "<group>"; | ||
|
@@ -2041,6 +2049,7 @@ | |
F083BD881E7009ED00A9B29C /* [email protected] in Resources */, | ||
F083BDAB1E7009ED00A9B29C /* [email protected] in Resources */, | ||
F083BE4D1E7009ED00A9B29C /* RoomOutgoingEncryptedAttachmentWithoutSenderInfoBubbleCell.xib in Resources */, | ||
24B510401EFA88CC004C6AD2 /* ReadReceiptsViewController.xib in Resources */, | ||
F083BDC81E7009ED00A9B29C /* search_icon.png in Resources */, | ||
F083BDE91E7009ED00A9B29C /* ring.mp3 in Resources */, | ||
F083BE431E7009ED00A9B29C /* RoomIncomingEncryptedTextMsgWithoutSenderInfoBubbleCell.xib in Resources */, | ||
|
@@ -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"; | ||
showEnvVarsInLog = 0; | ||
}; | ||
/* End PBXShellScriptBuildPhase section */ | ||
|
@@ -2457,6 +2466,7 @@ | |
F083BE761E7009ED00A9B29C /* RoomOutgoingTextMsgWithPaginationTitleBubbleCell.m in Sources */, | ||
F083BE5A1E7009ED00A9B29C /* RoomIncomingAttachmentBubbleCell.m in Sources */, | ||
F083BE541E7009ED00A9B29C /* RoomOutgoingEncryptedTextMsgWithoutSenderNameBubbleCell.m in Sources */, | ||
24B5103E1EFA7083004C6AD2 /* ReadReceiptsViewController.m in Sources */, | ||
F083BE621E7009ED00A9B29C /* RoomIncomingTextMsgWithoutSenderInfoBubbleCell.m in Sources */, | ||
F083BE881E7009ED00A9B29C /* RoomMemberTitleView.m in Sources */, | ||
F083BE701E7009ED00A9B29C /* RoomOutgoingTextMsgBubbleCell.m in Sources */, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
|
||
#import "RoomDataSource.h" | ||
|
||
#import "AppDelegate.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need to import AppDelegate here? |
||
#import "EventFormatter.h" | ||
#import "RoomBubbleCellData.h" | ||
|
||
|
@@ -144,13 +145,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N | |
// Ignore the read receipts on the bubble without actual display. | ||
if ((self.showBubbleReceipts && cellData.hasReadReceipts) || self.showReadMarker) | ||
{ | ||
// Read receipts container are inserted here on the right side into the overlay container. | ||
// Read receipts container are inserted here on the right side into the content view. | ||
// 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.hidden = NO; | ||
|
||
NSInteger index = bubbleComponents.count; | ||
CGFloat bottomPositionY = bubbleCell.frame.size.height; | ||
while (index--) | ||
|
@@ -199,10 +195,26 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N | |
avatarsContainer.tag = index; | ||
|
||
[avatarsContainer refreshReceiptSenders:roomMembers withPlaceHolders:placeholders andAlignment:ReadReceiptAlignmentRight]; | ||
avatarsContainer.readReceipts = receipts; | ||
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:cell action:@selector(onReceiptContainerTap:)]; | ||
[tapRecognizer setNumberOfTapsRequired:1]; | ||
[tapRecognizer setNumberOfTouchesRequired:1]; | ||
[avatarsContainer addGestureRecognizer:tapRecognizer]; | ||
avatarsContainer.userInteractionEnabled = YES; | ||
|
||
avatarsContainer.translatesAutoresizingMaskIntoConstraints = NO; | ||
avatarsContainer.accessibilityIdentifier = @"readReceiptsContainer"; | ||
[bubbleCell.bubbleOverlayContainer addSubview:avatarsContainer]; | ||
|
||
// Add this read receipts container in the content view | ||
if (!bubbleCell.tmpSubviews) | ||
{ | ||
bubbleCell.tmpSubviews = [NSMutableArray arrayWithArray:@[avatarsContainer]]; | ||
} | ||
else | ||
{ | ||
[bubbleCell.tmpSubviews addObject:avatarsContainer]; | ||
} | ||
[bubbleCell.contentView addSubview:avatarsContainer]; | ||
|
||
// Force receipts container size | ||
NSLayoutConstraint *widthConstraint = [NSLayoutConstraint constraintWithItem:avatarsContainer | ||
|
@@ -224,14 +236,14 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N | |
NSLayoutConstraint *trailingConstraint = [NSLayoutConstraint constraintWithItem:avatarsContainer | ||
attribute:NSLayoutAttributeTrailing | ||
relatedBy:NSLayoutRelationEqual | ||
toItem:bubbleCell.bubbleOverlayContainer | ||
toItem:avatarsContainer.superview | ||
attribute:NSLayoutAttributeTrailing | ||
multiplier:1.0 | ||
constant:-6]; | ||
NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:avatarsContainer | ||
attribute:NSLayoutAttributeTop | ||
relatedBy:NSLayoutRelationEqual | ||
toItem:bubbleCell.bubbleOverlayContainer | ||
toItem:avatarsContainer.superview | ||
attribute:NSLayoutAttributeTop | ||
multiplier:1.0 | ||
constant:bottomPositionY - 13]; | ||
|
@@ -244,6 +256,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N | |
// Check whether the read marker must be displayed here. | ||
if (self.showReadMarker) | ||
{ | ||
// The read marker is added into the overlay container. | ||
// CAUTION: Keep disabled the user interaction on this container to not disturb tap gesture handling. | ||
bubbleCell.bubbleOverlayContainer.backgroundColor = [UIColor clearColor]; | ||
bubbleCell.bubbleOverlayContainer.alpha = 1; | ||
bubbleCell.bubbleOverlayContainer.userInteractionEnabled = NO; | ||
bubbleCell.bubbleOverlayContainer.hidden = NO; | ||
|
||
if ([component.event.eventId isEqualToString:self.room.accountData.readMarkerEventId]) | ||
{ | ||
bubbleCell.readMarkerView = [[UIView alloc] initWithFrame:CGRectMake(0, bottomPositionY - 2, bubbleCell.bubbleOverlayContainer.frame.size.width, 2)]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
Copyright 2017 Aram Sargsyan | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
#import <UIKit/UIKit.h> | ||
#import <MatrixKit/MatrixKit.h> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer to use forward declaration rather than import everything |
||
|
||
@interface ReadReceiptsViewController : UIViewController | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please inherit of MXKViewController instead of 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 commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer split this operation in 2:
Note: the REST client will be deduced from the provided session. The receiptSendersContainer instance will provide all the other inputs.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reduce the number of parameters by passing directly the MXKReceiptSendersContainer instance |
||
|
||
@end |
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.