diff --git a/Riot.xcodeproj/project.pbxproj b/Riot.xcodeproj/project.pbxproj index 37cf5cc68..1f9313f02 100644 --- a/Riot.xcodeproj/project.pbxproj +++ b/Riot.xcodeproj/project.pbxproj @@ -896,6 +896,10 @@ ECFBD5E0250B684E00DD5F5A /* ChooseAvatarTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECFBD5DE250B684E00DD5F5A /* ChooseAvatarTableViewCell.swift */; }; ECFBD5E1250B684E00DD5F5A /* ChooseAvatarTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = ECFBD5DF250B684E00DD5F5A /* ChooseAvatarTableViewCell.xib */; }; ECFBD5E3250B6CAB00DD5F5A /* ChooseAvatarTableViewCellVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECFBD5E2250B6CAB00DD5F5A /* ChooseAvatarTableViewCellVM.swift */; }; + ECFBD5EA250F97FC00DD5F5A /* RoomCreationCollapsedBubbleCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = ECFBD5E4250F97FC00DD5F5A /* RoomCreationCollapsedBubbleCell.xib */; }; + ECFBD5EB250F97FC00DD5F5A /* RoomCreationWithPaginationCollapsedBubbleCell.m in Sources */ = {isa = PBXBuildFile; fileRef = ECFBD5E5250F97FC00DD5F5A /* RoomCreationWithPaginationCollapsedBubbleCell.m */; }; + ECFBD5EC250F97FC00DD5F5A /* RoomCreationWithPaginationCollapsedBubbleCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = ECFBD5E8250F97FC00DD5F5A /* RoomCreationWithPaginationCollapsedBubbleCell.xib */; }; + ECFBD5ED250F97FC00DD5F5A /* RoomCreationCollapsedBubbleCell.m in Sources */ = {isa = PBXBuildFile; fileRef = ECFBD5E9250F97FC00DD5F5A /* RoomCreationCollapsedBubbleCell.m */; }; F05927C91FDED836009F2A68 /* MXGroup+Riot.m in Sources */ = {isa = PBXBuildFile; fileRef = F05927C71FDED835009F2A68 /* MXGroup+Riot.m */; }; F083BD1E1E7009ED00A9B29C /* LegacyAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = F083BB0D1E7009EC00A9B29C /* LegacyAppDelegate.m */; }; F083BDE61E7009ED00A9B29C /* busy.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = F083BBDB1E7009EC00A9B29C /* busy.mp3 */; }; @@ -2067,6 +2071,12 @@ ECFBD5DE250B684E00DD5F5A /* ChooseAvatarTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChooseAvatarTableViewCell.swift; sourceTree = ""; }; ECFBD5DF250B684E00DD5F5A /* ChooseAvatarTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ChooseAvatarTableViewCell.xib; sourceTree = ""; }; ECFBD5E2250B6CAB00DD5F5A /* ChooseAvatarTableViewCellVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChooseAvatarTableViewCellVM.swift; sourceTree = ""; }; + ECFBD5E4250F97FC00DD5F5A /* RoomCreationCollapsedBubbleCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RoomCreationCollapsedBubbleCell.xib; sourceTree = ""; }; + ECFBD5E5250F97FC00DD5F5A /* RoomCreationWithPaginationCollapsedBubbleCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RoomCreationWithPaginationCollapsedBubbleCell.m; sourceTree = ""; }; + ECFBD5E6250F97FC00DD5F5A /* RoomCreationCollapsedBubbleCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoomCreationCollapsedBubbleCell.h; sourceTree = ""; }; + ECFBD5E7250F97FC00DD5F5A /* RoomCreationWithPaginationCollapsedBubbleCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoomCreationWithPaginationCollapsedBubbleCell.h; sourceTree = ""; }; + ECFBD5E8250F97FC00DD5F5A /* RoomCreationWithPaginationCollapsedBubbleCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RoomCreationWithPaginationCollapsedBubbleCell.xib; sourceTree = ""; }; + ECFBD5E9250F97FC00DD5F5A /* RoomCreationCollapsedBubbleCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RoomCreationCollapsedBubbleCell.m; sourceTree = ""; }; F05927C71FDED835009F2A68 /* MXGroup+Riot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MXGroup+Riot.m"; sourceTree = ""; }; F05927C81FDED835009F2A68 /* MXGroup+Riot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MXGroup+Riot.h"; sourceTree = ""; }; F083BB031E7005FD00A9B29C /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -4095,6 +4105,12 @@ B1B5583F20EF768E00210D55 /* BubbleCells */ = { isa = PBXGroup; children = ( + ECFBD5E6250F97FC00DD5F5A /* RoomCreationCollapsedBubbleCell.h */, + ECFBD5E9250F97FC00DD5F5A /* RoomCreationCollapsedBubbleCell.m */, + ECFBD5E4250F97FC00DD5F5A /* RoomCreationCollapsedBubbleCell.xib */, + ECFBD5E7250F97FC00DD5F5A /* RoomCreationWithPaginationCollapsedBubbleCell.h */, + ECFBD5E5250F97FC00DD5F5A /* RoomCreationWithPaginationCollapsedBubbleCell.m */, + ECFBD5E8250F97FC00DD5F5A /* RoomCreationWithPaginationCollapsedBubbleCell.xib */, B108932623ABE82C00802670 /* BaseBubbleCell */, B1B4E9B524D46EB3004D5C33 /* SizableCell */, B1A12C65239ABBDB00AA2B86 /* KeyVerification */, @@ -5553,6 +5569,7 @@ 329E746622CD02EA006F9797 /* BubbleReactionActionViewCell.xib in Resources */, B1B558E320EF768F00210D55 /* RoomEmptyBubbleCell.xib in Resources */, EC711B8F24A63B37008F830C /* SecretsRecoveryWithKeyViewController.storyboard in Resources */, + ECFBD5EC250F97FC00DD5F5A /* RoomCreationWithPaginationCollapsedBubbleCell.xib in Resources */, B1E5368F21FB7258001F3AFF /* KeyBackupRecoverFromPassphraseViewController.storyboard in Resources */, B1B5590420EF768F00210D55 /* RoomOutgoingAttachmentBubbleCell.xib in Resources */, B1B558F120EF768F00210D55 /* RoomIncomingAttachmentWithPaginationTitleBubbleCell.xib in Resources */, @@ -5569,6 +5586,7 @@ B1550FCA2420E8F500CE097B /* QRCodeReaderViewController.storyboard in Resources */, B1B5579C20EF575B00210D55 /* ForgotPasswordInputsView.xib in Resources */, F083BE011E7009ED00A9B29C /* third_party_licenses.html in Resources */, + ECFBD5EA250F97FC00DD5F5A /* RoomCreationCollapsedBubbleCell.xib in Resources */, ECF57A89250A687B004BBF9D /* TextViewTableViewCell.xib in Resources */, EC3B066A24AC6ADE000DF9BF /* CrossSigningSetupBannerCell.xib in Resources */, B1098BFC21ECFE65000DDA48 /* PasswordStrengthView.xib in Resources */, @@ -6368,6 +6386,7 @@ B1B557D820EF5EA900210D55 /* RoomActivitiesView.m in Sources */, B1B9DEE922EB34EF0065E677 /* ReactionHistoryViewController.swift in Sources */, B1B5596620EF9E9B00210D55 /* RoomTableViewCell.m in Sources */, + ECFBD5EB250F97FC00DD5F5A /* RoomCreationWithPaginationCollapsedBubbleCell.m in Sources */, EC711B7D24A63B37008F830C /* SecretsSetupRecoveryPassphraseViewModel.swift in Sources */, EC711B8024A63B37008F830C /* SecretsSetupRecoveryPassphraseViewState.swift in Sources */, B1C45A89232A8C2600165425 /* SettingsIdentityServerViewController.swift in Sources */, @@ -6558,6 +6577,7 @@ ECAE7AE724EC15F7002FA813 /* Section.swift in Sources */, B1B5591020EF782800210D55 /* TableViewCellWithPhoneNumberTextField.m in Sources */, B1CE83E52422817200D07506 /* KeyVerificationVerifyBySASViewModel.swift in Sources */, + ECFBD5ED250F97FC00DD5F5A /* RoomCreationCollapsedBubbleCell.m in Sources */, B1DB4F06223015080065DBFA /* Character.swift in Sources */, EC1CA87724C82D0E00DE9EBF /* MemoryStore.swift in Sources */, B1B9DEEE22EB34EF0065E677 /* ReactionHistoryViewAction.swift in Sources */, diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index 48740ed35..6f045c3a7 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -95,6 +95,8 @@ #import "RoomMembershipCollapsedWithPaginationTitleBubbleCell.h" #import "RoomMembershipExpandedBubbleCell.h" #import "RoomMembershipExpandedWithPaginationTitleBubbleCell.h" +#import "RoomCreationWithPaginationCollapsedBubbleCell.h" +#import "RoomCreationCollapsedBubbleCell.h" #import "RoomSelectedStickerBubbleCell.h" #import "RoomPredecessorBubbleCell.h" @@ -363,6 +365,9 @@ [self.bubblesTableView registerClass:KeyVerificationConclusionBubbleCell.class forCellReuseIdentifier:KeyVerificationConclusionBubbleCell.defaultReuseIdentifier]; [self.bubblesTableView registerClass:KeyVerificationConclusionWithPaginationTitleBubbleCell.class forCellReuseIdentifier:KeyVerificationConclusionWithPaginationTitleBubbleCell.defaultReuseIdentifier]; + [self.bubblesTableView registerClass:RoomCreationCollapsedBubbleCell.class forCellReuseIdentifier:RoomCreationCollapsedBubbleCell.defaultReuseIdentifier]; + [self.bubblesTableView registerClass:RoomCreationWithPaginationCollapsedBubbleCell.class forCellReuseIdentifier:RoomCreationWithPaginationCollapsedBubbleCell.defaultReuseIdentifier]; + // Prepare expanded header expandedHeader = [ExpandedRoomTitleView roomTitleView]; @@ -2164,28 +2169,7 @@ } else if (bubbleData.tag == RoomBubbleCellDataTagRoomCreateConfiguration) { - if (bubbleData.collapsed) - { - if (bubbleData.nextCollapsableCellData) - { - cellViewClass = bubbleData.isPaginationFirstBubble ? RoomMembershipCollapsedWithPaginationTitleBubbleCell.class : RoomMembershipCollapsedBubbleCell.class; - } - else - { - // Use a normal membership cell for a single membership event - cellViewClass = bubbleData.isPaginationFirstBubble ? RoomMembershipWithPaginationTitleBubbleCell.class : RoomMembershipBubbleCell.class; - } - } - else if (bubbleData.collapsedAttributedTextMessage) - { - // The cell (and its series) is not collapsed but this cell is the first - // of the series. So, use the cell with the "collapse" button. - cellViewClass = bubbleData.isPaginationFirstBubble ? RoomMembershipExpandedWithPaginationTitleBubbleCell.class : RoomMembershipExpandedBubbleCell.class; - } - else - { - cellViewClass = bubbleData.isPaginationFirstBubble ? RoomMembershipWithPaginationTitleBubbleCell.class : RoomMembershipBubbleCell.class; - } + cellViewClass = bubbleData.isPaginationFirstBubble ? RoomCreationWithPaginationCollapsedBubbleCell.class : RoomCreationCollapsedBubbleCell.class; } else if (bubbleData.isIncoming) { diff --git a/Riot/Modules/Room/Views/BubbleCells/RoomCreationCollapsedBubbleCell.h b/Riot/Modules/Room/Views/BubbleCells/RoomCreationCollapsedBubbleCell.h new file mode 100644 index 000000000..4861f206b --- /dev/null +++ b/Riot/Modules/Room/Views/BubbleCells/RoomCreationCollapsedBubbleCell.h @@ -0,0 +1,24 @@ +/* + 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 "RoomIncomingTextMsgBubbleCell.h" + +/** + `RoomCreationCollapsedBubbleCell` displays a sum-up of collapsed room creation cells. + */ +@interface RoomCreationCollapsedBubbleCell : RoomIncomingTextMsgBubbleCell + +@end diff --git a/Riot/Modules/Room/Views/BubbleCells/RoomCreationCollapsedBubbleCell.m b/Riot/Modules/Room/Views/BubbleCells/RoomCreationCollapsedBubbleCell.m new file mode 100644 index 000000000..e47be90ff --- /dev/null +++ b/Riot/Modules/Room/Views/BubbleCells/RoomCreationCollapsedBubbleCell.m @@ -0,0 +1,34 @@ +/* + Copyright 2017 Vector Creations Ltd + Copyright 2018 New Vector 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 "RoomCreationCollapsedBubbleCell.h" + +#import "ThemeService.h" +#import "Riot-Swift.h" + +#import "RoomBubbleCellData.h" + +@implementation RoomCreationCollapsedBubbleCell + +- (void)customizeTableViewCellRendering +{ + [super customizeTableViewCellRendering]; + + self.messageTextView.tintColor = ThemeService.shared.theme.tintColor; +} + +@end diff --git a/Riot/Modules/Room/Views/BubbleCells/RoomCreationCollapsedBubbleCell.xib b/Riot/Modules/Room/Views/BubbleCells/RoomCreationCollapsedBubbleCell.xib new file mode 100644 index 000000000..00485ecf3 --- /dev/null +++ b/Riot/Modules/Room/Views/BubbleCells/RoomCreationCollapsedBubbleCell.xib @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Riot/Modules/Room/Views/BubbleCells/RoomCreationWithPaginationCollapsedBubbleCell.h b/Riot/Modules/Room/Views/BubbleCells/RoomCreationWithPaginationCollapsedBubbleCell.h new file mode 100644 index 000000000..2899f96b8 --- /dev/null +++ b/Riot/Modules/Room/Views/BubbleCells/RoomCreationWithPaginationCollapsedBubbleCell.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" + +/** + `RoomCreationWithPaginationCollapsedBubbleCell` displays a room creation event with a pagination title. + */ +@interface RoomCreationWithPaginationCollapsedBubbleCell : RoomMembershipBubbleCell + +@property (weak, nonatomic) IBOutlet UIView *paginationTitleView; +@property (weak, nonatomic) IBOutlet UILabel *paginationLabel; +@property (weak, nonatomic) IBOutlet UIView *paginationSeparatorView; + +@end diff --git a/Riot/Modules/Room/Views/BubbleCells/RoomCreationWithPaginationCollapsedBubbleCell.m b/Riot/Modules/Room/Views/BubbleCells/RoomCreationWithPaginationCollapsedBubbleCell.m new file mode 100644 index 000000000..290473b11 --- /dev/null +++ b/Riot/Modules/Room/Views/BubbleCells/RoomCreationWithPaginationCollapsedBubbleCell.m @@ -0,0 +1,44 @@ +/* + 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 "RoomCreationWithPaginationCollapsedBubbleCell.h" + +#import "ThemeService.h" +#import "Riot-Swift.h" + +#import "RoomBubbleCellData.h" + +@implementation RoomCreationWithPaginationCollapsedBubbleCell + +- (void)customizeTableViewCellRendering +{ + [super customizeTableViewCellRendering]; + + self.paginationLabel.textColor = ThemeService.shared.theme.tintColor; + self.paginationSeparatorView.backgroundColor = ThemeService.shared.theme.tintColor; +} + +- (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/Modules/Room/Views/BubbleCells/RoomCreationWithPaginationCollapsedBubbleCell.xib b/Riot/Modules/Room/Views/BubbleCells/RoomCreationWithPaginationCollapsedBubbleCell.xib new file mode 100644 index 000000000..9d5eb65fe --- /dev/null +++ b/Riot/Modules/Room/Views/BubbleCells/RoomCreationWithPaginationCollapsedBubbleCell.xib @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +