diff --git a/Riot.xcodeproj/project.pbxproj b/Riot.xcodeproj/project.pbxproj index c033f8fe8..aaf3685d5 100644 --- a/Riot.xcodeproj/project.pbxproj +++ b/Riot.xcodeproj/project.pbxproj @@ -16,6 +16,8 @@ 325E1C151E8D03950018D91E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 325E1C131E8D03950018D91E /* LaunchScreen.storyboard */; }; 32AE61E41F0A971B007255F4 /* RoomMembershipBubbleCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 32AE61E21F0A971B007255F4 /* RoomMembershipBubbleCell.m */; }; 32AE61E51F0A971B007255F4 /* RoomMembershipBubbleCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 32AE61E31F0A971B007255F4 /* RoomMembershipBubbleCell.xib */; }; + 32AE61E91F0CE099007255F4 /* RoomMembershipBubbleCellWithPaginationTitleBubbleCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 32AE61E71F0CE099007255F4 /* RoomMembershipBubbleCellWithPaginationTitleBubbleCell.m */; }; + 32AE61EA1F0CE099007255F4 /* RoomMembershipBubbleCellWithPaginationTitleBubbleCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 32AE61E81F0CE099007255F4 /* RoomMembershipBubbleCellWithPaginationTitleBubbleCell.xib */; }; 32D392181EB9B7AB009A2BAF /* DirectoryServerDetailTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 32D392161EB9B7AB009A2BAF /* DirectoryServerDetailTableViewCell.m */; }; 32D392191EB9B7AB009A2BAF /* DirectoryServerDetailTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 32D392171EB9B7AB009A2BAF /* DirectoryServerDetailTableViewCell.xib */; }; 32FD0A3D1EB0CD9B0072B066 /* BugReportViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 32FD0A3B1EB0CD9B0072B066 /* BugReportViewController.m */; }; @@ -488,6 +490,9 @@ 32AE61E11F0A971B007255F4 /* RoomMembershipBubbleCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoomMembershipBubbleCell.h; sourceTree = ""; }; 32AE61E21F0A971B007255F4 /* RoomMembershipBubbleCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RoomMembershipBubbleCell.m; sourceTree = ""; }; 32AE61E31F0A971B007255F4 /* RoomMembershipBubbleCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RoomMembershipBubbleCell.xib; sourceTree = ""; }; + 32AE61E61F0CE099007255F4 /* RoomMembershipBubbleCellWithPaginationTitleBubbleCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoomMembershipBubbleCellWithPaginationTitleBubbleCell.h; sourceTree = ""; }; + 32AE61E71F0CE099007255F4 /* RoomMembershipBubbleCellWithPaginationTitleBubbleCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RoomMembershipBubbleCellWithPaginationTitleBubbleCell.m; sourceTree = ""; }; + 32AE61E81F0CE099007255F4 /* RoomMembershipBubbleCellWithPaginationTitleBubbleCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RoomMembershipBubbleCellWithPaginationTitleBubbleCell.xib; sourceTree = ""; }; 32D392151EB9B7AB009A2BAF /* DirectoryServerDetailTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryServerDetailTableViewCell.h; sourceTree = ""; }; 32D392161EB9B7AB009A2BAF /* DirectoryServerDetailTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DirectoryServerDetailTableViewCell.m; sourceTree = ""; }; 32D392171EB9B7AB009A2BAF /* DirectoryServerDetailTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DirectoryServerDetailTableViewCell.xib; sourceTree = ""; }; @@ -1697,6 +1702,9 @@ 32AE61E11F0A971B007255F4 /* RoomMembershipBubbleCell.h */, 32AE61E21F0A971B007255F4 /* RoomMembershipBubbleCell.m */, 32AE61E31F0A971B007255F4 /* RoomMembershipBubbleCell.xib */, + 32AE61E61F0CE099007255F4 /* RoomMembershipBubbleCellWithPaginationTitleBubbleCell.h */, + 32AE61E71F0CE099007255F4 /* RoomMembershipBubbleCellWithPaginationTitleBubbleCell.m */, + 32AE61E81F0CE099007255F4 /* RoomMembershipBubbleCellWithPaginationTitleBubbleCell.xib */, F083BCA81E7009EC00A9B29C /* RoomIncomingAttachmentBubbleCell.h */, F083BCA91E7009EC00A9B29C /* RoomIncomingAttachmentBubbleCell.m */, F083BCAA1E7009EC00A9B29C /* RoomIncomingAttachmentBubbleCell.xib */, @@ -2236,6 +2244,7 @@ F083BD2C1E7009ED00A9B29C /* animatedLogo-4.png in Resources */, F083BD7E1E7009ED00A9B29C /* error@2x.png in Resources */, F083BE931E7009ED00A9B29C /* SimpleRoomTitleView.xib in Resources */, + 32AE61EA1F0CE099007255F4 /* RoomMembershipBubbleCellWithPaginationTitleBubbleCell.xib in Resources */, F083BD951E7009ED00A9B29C /* leave.png in Resources */, F083BE2C1E7009ED00A9B29C /* AuthInputsView.xib in Resources */, F083BD6B1E7009ED00A9B29C /* disclosure_icon.png in Resources */, @@ -2510,6 +2519,7 @@ F083BE5C1E7009ED00A9B29C /* RoomIncomingAttachmentWithoutSenderInfoBubbleCell.m in Sources */, F0E05A061E9682E9004B83FB /* ContactsDataSource.m in Sources */, F083BE401E7009ED00A9B29C /* RoomIncomingEncryptedTextMsgBubbleCell.m in Sources */, + 32AE61E91F0CE099007255F4 /* RoomMembershipBubbleCellWithPaginationTitleBubbleCell.m in Sources */, F083BDFD1E7009ED00A9B29C /* PublicRoomsDirectoryDataSource.m in Sources */, F083BE191E7009ED00A9B29C /* RecentsViewController.m in Sources */, F083BE351E7009ED00A9B29C /* MediaAlbumTableCell.m in Sources */, diff --git a/Riot/ViewController/RoomViewController.m b/Riot/ViewController/RoomViewController.m index 84d5136bc..4d617e183 100644 --- a/Riot/ViewController/RoomViewController.m +++ b/Riot/ViewController/RoomViewController.m @@ -86,6 +86,7 @@ #import "RoomOutgoingEncryptedAttachmentWithPaginationTitleBubbleCell.h" #import "RoomMembershipBubbleCell.h" +#import "RoomMembershipBubbleCellWithPaginationTitleBubbleCell.h" #import "MXKRoomBubbleTableViewCell+Riot.h" @@ -281,6 +282,7 @@ [self.bubblesTableView registerClass:RoomEmptyBubbleCell.class forCellReuseIdentifier:RoomEmptyBubbleCell.defaultReuseIdentifier]; [self.bubblesTableView registerClass:RoomMembershipBubbleCell.class forCellReuseIdentifier:RoomMembershipBubbleCell.defaultReuseIdentifier]; + [self.bubblesTableView registerClass:RoomMembershipBubbleCellWithPaginationTitleBubbleCell.class forCellReuseIdentifier:RoomMembershipBubbleCellWithPaginationTitleBubbleCell.defaultReuseIdentifier]; // Prepare jump to last unread banner self.jumpToLastUnreadLabel.attributedText = [[NSAttributedString alloc] initWithString:NSLocalizedStringFromTable(@"room_jump_to_first_unread", @"Vector", nil) attributes:@{NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle), NSUnderlineColorAttributeName: kRiotTextColorBlack, NSForegroundColorAttributeName: kRiotTextColorBlack}]; @@ -1547,7 +1549,14 @@ } else if (bubbleData.tag == RoomBubbleCellDataTagMembership) { - cellViewClass = RoomMembershipBubbleCell.class; + if (bubbleData.isPaginationFirstBubble) + { + cellViewClass = RoomMembershipBubbleCellWithPaginationTitleBubbleCell.class; + } + else + { + cellViewClass = RoomMembershipBubbleCell.class; + } } else if (bubbleData.isIncoming) { diff --git a/Riot/Views/RoomBubbleList/RoomMembershipBubbleCell.h b/Riot/Views/RoomBubbleList/RoomMembershipBubbleCell.h index 35d6ef120..dd526cb3b 100644 --- a/Riot/Views/RoomBubbleList/RoomMembershipBubbleCell.h +++ b/Riot/Views/RoomBubbleList/RoomMembershipBubbleCell.h @@ -17,7 +17,7 @@ #import "RoomIncomingTextMsgBubbleCell.h" /** - `RoomMembershipBubbleCell` displays incoming message bubbles with sender's avatar only (no sender's name). + `RoomMembershipBubbleCell` displays a membership event. */ @interface RoomMembershipBubbleCell : RoomIncomingTextMsgBubbleCell diff --git a/Riot/Views/RoomBubbleList/RoomMembershipBubbleCell.m b/Riot/Views/RoomBubbleList/RoomMembershipBubbleCell.m index 078435310..3649a85d5 100644 --- a/Riot/Views/RoomBubbleList/RoomMembershipBubbleCell.m +++ b/Riot/Views/RoomBubbleList/RoomMembershipBubbleCell.m @@ -20,7 +20,11 @@ #import "RoomBubbleCellData.h" -static CGFloat xibPictureViewTopConstraintConstant; +@interface RoomMembershipBubbleCell () +{ + CGFloat xibPictureViewTopConstraintConstant; +} +@end @implementation RoomMembershipBubbleCell @@ -30,11 +34,8 @@ static CGFloat xibPictureViewTopConstraintConstant; self.messageTextView.tintColor = kRiotColorGreen; - // Get original xib value once - if (xibPictureViewTopConstraintConstant == 0) - { - xibPictureViewTopConstraintConstant = self.pictureViewTopConstraint.constant; - } + // Get original xib values + xibPictureViewTopConstraintConstant = self.pictureViewTopConstraint.constant; } - (void)prepareForReuse diff --git a/Riot/Views/RoomBubbleList/RoomMembershipBubbleCellWithPaginationTitleBubbleCell.h b/Riot/Views/RoomBubbleList/RoomMembershipBubbleCellWithPaginationTitleBubbleCell.h new file mode 100644 index 000000000..ec82683d6 --- /dev/null +++ b/Riot/Views/RoomBubbleList/RoomMembershipBubbleCellWithPaginationTitleBubbleCell.h @@ -0,0 +1,28 @@ +/* + Copyright 2017 Vector Creations Ltd + + 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 "RoomMembershipBubbleCell.h" + +/** + `RoomMembershipBubbleCellWithPaginationTitleBubbleCell` displays a membership event with a pagination title. + */ +@interface RoomMembershipBubbleCellWithPaginationTitleBubbleCell : RoomMembershipBubbleCell + +@property (weak, nonatomic) IBOutlet UIView *paginationTitleView; +@property (weak, nonatomic) IBOutlet UILabel *paginationLabel; +@property (weak, nonatomic) IBOutlet UIView *paginationSeparatorView; + +@end diff --git a/Riot/Views/RoomBubbleList/RoomMembershipBubbleCellWithPaginationTitleBubbleCell.m b/Riot/Views/RoomBubbleList/RoomMembershipBubbleCellWithPaginationTitleBubbleCell.m new file mode 100644 index 000000000..0e8b91116 --- /dev/null +++ b/Riot/Views/RoomBubbleList/RoomMembershipBubbleCellWithPaginationTitleBubbleCell.m @@ -0,0 +1,43 @@ +/* + Copyright 2017 Vector Creations Ltd + + 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 "RoomMembershipBubbleCellWithPaginationTitleBubbleCell.h" + +#import "RiotDesignValues.h" + +#import "RoomBubbleCellData.h" + +@implementation RoomMembershipBubbleCellWithPaginationTitleBubbleCell + +- (void)awakeFromNib +{ + [super awakeFromNib]; + + self.paginationLabel.textColor = kRiotColorGreen; + self.paginationSeparatorView.backgroundColor = kRiotColorGreen; +} + +- (void)render:(MXKCellData *)cellData +{ + [super render:cellData]; + + if (bubbleData) + { + self.paginationLabel.text = [[bubbleData.eventFormatter dateStringFromDate:bubbleData.date withTime:NO] uppercaseString]; + } +} + +@end diff --git a/Riot/Views/RoomBubbleList/RoomMembershipBubbleCellWithPaginationTitleBubbleCell.xib b/Riot/Views/RoomBubbleList/RoomMembershipBubbleCellWithPaginationTitleBubbleCell.xib new file mode 100644 index 000000000..1b3775b3c --- /dev/null +++ b/Riot/Views/RoomBubbleList/RoomMembershipBubbleCellWithPaginationTitleBubbleCell.xib @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +