Skip to content
This repository has been archived by the owner on Jun 7, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1770 from RocketChat/feature/channel_information_…
Browse files Browse the repository at this point in the history
…cells

[NEW] Add Topic, Description & Name of the channel on action controller and improve accessibility
  • Loading branch information
rafaelks committed Jun 14, 2018
2 parents c0089f4 + fc38f6e commit 21b4424
Show file tree
Hide file tree
Showing 15 changed files with 232 additions and 99 deletions.
30 changes: 17 additions & 13 deletions Rocket.Chat.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@
4116CBE520B599D9007E7163 /* StatusTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4116CBE420B599D9007E7163 /* StatusTableViewController.swift */; };
4116CBE720B599E6007E7163 /* StatusViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4116CBE620B599E6007E7163 /* StatusViewModel.swift */; };
411D40C620D2668B001A1035 /* SubscriptionLastMessageSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 411D40C520D2668B001A1035 /* SubscriptionLastMessageSpec.swift */; };
411D40C920D27A5E001A1035 /* ChannelInfoDescriptionCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 411D40C720D27A5E001A1035 /* ChannelInfoDescriptionCell.xib */; };
411D40CA20D27A5E001A1035 /* ChannelInfoDescriptionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 411D40C820D27A5E001A1035 /* ChannelInfoDescriptionCell.swift */; };
411D40CD20D28150001A1035 /* ChannelInfoBasicCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 411D40CB20D2814F001A1035 /* ChannelInfoBasicCell.xib */; };
411D40CE20D28150001A1035 /* ChannelInfoBasicCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 411D40CC20D2814F001A1035 /* ChannelInfoBasicCell.swift */; };
411D76E51F39F05A00B0A8DF /* AuthSettingsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 411D76E41F39F05A00B0A8DF /* AuthSettingsManager.swift */; };
411D76E71F39FA7B00B0A8DF /* AuthSettingsManagerSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 411D76E61F39FA7B00B0A8DF /* AuthSettingsManagerSpec.swift */; };
411EDED51E3102CB00BC7BE3 /* UploadManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 411EDED41E3102CB00BC7BE3 /* UploadManager.swift */; };
Expand Down Expand Up @@ -362,10 +366,7 @@
800E22861F8507E400DA84F1 /* RoomMessagesRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 800E22851F8507E400DA84F1 /* RoomMessagesRequest.swift */; };
800F38ED2019492D0005CB78 /* DeepLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 800F38EC2019492D0005CB78 /* DeepLink.swift */; };
800FCD3E1F72893E00D9A692 /* MembersListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 800FCD3D1F72893E00D9A692 /* MembersListViewController.swift */; };
800FCD4B1F728EC800D9A692 /* ChannelInfoBasicCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 800FCD441F728E6A00D9A692 /* ChannelInfoBasicCell.swift */; };
800FCD4C1F728EC800D9A692 /* ChannelInfoCellProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 800FCD451F728E6A00D9A692 /* ChannelInfoCellProtocol.swift */; };
800FCD4D1F728EC800D9A692 /* ChannelInfoDescriptionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 800FCD461F728E6A00D9A692 /* ChannelInfoDescriptionCell.swift */; };
800FCD4E1F728EC800D9A692 /* ChannelInfoDetailCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 800FCD471F728E6A00D9A692 /* ChannelInfoDetailCell.swift */; };
800FCD4F1F728EC800D9A692 /* ChannelInfoUserCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 800FCD481F728E6A00D9A692 /* ChannelInfoUserCell.swift */; };
800FCD501F728EC800D9A692 /* MemberCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 800FCD491F728E6A00D9A692 /* MemberCell.swift */; };
800FCD511F728EC800D9A692 /* MemberCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 800FCD4A1F728E6A00D9A692 /* MemberCell.xib */; };
Expand Down Expand Up @@ -893,6 +894,10 @@
4116CBE420B599D9007E7163 /* StatusTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusTableViewController.swift; sourceTree = "<group>"; };
4116CBE620B599E6007E7163 /* StatusViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusViewModel.swift; sourceTree = "<group>"; };
411D40C520D2668B001A1035 /* SubscriptionLastMessageSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionLastMessageSpec.swift; sourceTree = "<group>"; };
411D40C720D27A5E001A1035 /* ChannelInfoDescriptionCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ChannelInfoDescriptionCell.xib; sourceTree = "<group>"; };
411D40C820D27A5E001A1035 /* ChannelInfoDescriptionCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChannelInfoDescriptionCell.swift; sourceTree = "<group>"; };
411D40CB20D2814F001A1035 /* ChannelInfoBasicCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ChannelInfoBasicCell.xib; sourceTree = "<group>"; };
411D40CC20D2814F001A1035 /* ChannelInfoBasicCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChannelInfoBasicCell.swift; sourceTree = "<group>"; };
411D76E41F39F05A00B0A8DF /* AuthSettingsManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthSettingsManager.swift; sourceTree = "<group>"; };
411D76E61F39FA7B00B0A8DF /* AuthSettingsManagerSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthSettingsManagerSpec.swift; sourceTree = "<group>"; };
411EDED41E3102CB00BC7BE3 /* UploadManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UploadManager.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1124,10 +1129,7 @@
800E22851F8507E400DA84F1 /* RoomMessagesRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomMessagesRequest.swift; sourceTree = "<group>"; };
800F38EC2019492D0005CB78 /* DeepLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeepLink.swift; sourceTree = "<group>"; };
800FCD3D1F72893E00D9A692 /* MembersListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MembersListViewController.swift; sourceTree = "<group>"; };
800FCD441F728E6A00D9A692 /* ChannelInfoBasicCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelInfoBasicCell.swift; sourceTree = "<group>"; };
800FCD451F728E6A00D9A692 /* ChannelInfoCellProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelInfoCellProtocol.swift; sourceTree = "<group>"; };
800FCD461F728E6A00D9A692 /* ChannelInfoDescriptionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelInfoDescriptionCell.swift; sourceTree = "<group>"; };
800FCD471F728E6A00D9A692 /* ChannelInfoDetailCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelInfoDetailCell.swift; sourceTree = "<group>"; };
800FCD481F728E6A00D9A692 /* ChannelInfoUserCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelInfoUserCell.swift; sourceTree = "<group>"; };
800FCD491F728E6A00D9A692 /* MemberCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemberCell.swift; sourceTree = "<group>"; };
800FCD4A1F728E6A00D9A692 /* MemberCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MemberCell.xib; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2542,12 +2544,13 @@
800FCD431F728E6A00D9A692 /* Info */ = {
isa = PBXGroup;
children = (
800FCD451F728E6A00D9A692 /* ChannelInfoCellProtocol.swift */,
411D40CC20D2814F001A1035 /* ChannelInfoBasicCell.swift */,
411D40CB20D2814F001A1035 /* ChannelInfoBasicCell.xib */,
411D40C820D27A5E001A1035 /* ChannelInfoDescriptionCell.swift */,
411D40C720D27A5E001A1035 /* ChannelInfoDescriptionCell.xib */,
4124FCC41F7A61C5008ED4C3 /* ChannelInfoActionCell.swift */,
4124FCC51F7A61C5008ED4C3 /* ChannelInfoActionCell.xib */,
800FCD441F728E6A00D9A692 /* ChannelInfoBasicCell.swift */,
800FCD451F728E6A00D9A692 /* ChannelInfoCellProtocol.swift */,
800FCD461F728E6A00D9A692 /* ChannelInfoDescriptionCell.swift */,
800FCD471F728E6A00D9A692 /* ChannelInfoDetailCell.swift */,
800FCD481F728E6A00D9A692 /* ChannelInfoUserCell.swift */,
4124FCC71F7A6252008ED4C3 /* ChannelInfoUserCell.xib */,
800FCD491F728E6A00D9A692 /* MemberCell.swift */,
Expand Down Expand Up @@ -3509,6 +3512,7 @@
files = (
412A95D71FD94ED000954AA6 /* ChatMessageVideoView.xib in Resources */,
14F8A25D202E64B200175FDC /* BnW-29@3x.png in Resources */,
411D40CD20D28150001A1035 /* ChannelInfoBasicCell.xib in Resources */,
412A95D71FD94ED000954AA6 /* ChatMessageVideoView.xib in Resources */,
33A5C9CC206A565800FE1C8F /* regional.json in Resources */,
412EF3C62050507C001689A3 /* ReusableViewText.xib in Resources */,
Expand Down Expand Up @@ -3595,6 +3599,7 @@
41CD52D520BEFA3B00336892 /* New Room.storyboard in Resources */,
14F8A25E202E64B200175FDC /* BnW-76@2x.png in Resources */,
419D84FE1DF599CA0021F034 /* ChatHeaderViewStatus.xib in Resources */,
411D40C920D27A5E001A1035 /* ChannelInfoDescriptionCell.xib in Resources */,
4124FCC81F7A6BF5008ED4C3 /* ChannelInfoUserCell.xib in Resources */,
4133EDD11DA2835F005AA783 /* ChatMessageImageView.xib in Resources */,
14F8A280202E659000175FDC /* White-76@2x.png in Resources */,
Expand Down Expand Up @@ -3954,7 +3959,6 @@
77CCB6BE1F8D0597004BBF67 /* DictionaryExtensions.swift in Sources */,
413FB6C61FE17DBC00F010AA /* MessageTextFontAttributes.swift in Sources */,
412A95D61FD94ED000954AA6 /* ChatMessageVideoView.swift in Sources */,
800FCD4B1F728EC800D9A692 /* ChannelInfoBasicCell.swift in Sources */,
8067DAA6206D1883005E3369 /* APIResource.swift in Sources */,
411F7D941F5179A50080E8AD /* ChatChannelHeaderCell.swift in Sources */,
41F167E91DAC4D4300775CCA /* ChatTitleView.swift in Sources */,
Expand Down Expand Up @@ -3996,6 +4000,7 @@
419205491D52EDE6004EEC5F /* UILabelExtension.swift in Sources */,
4162E1551D654A7400AAAE49 /* SocketHandlers.swift in Sources */,
4174CB151D2D99A30086DAC8 /* BaseNavigationController.swift in Sources */,
411D40CE20D28150001A1035 /* ChannelInfoBasicCell.swift in Sources */,
4153E80520504BE700FBC26B /* ReusableViewText.swift in Sources */,
419ECCA61F3CA58A005F224B /* ChatControllerDocuments.swift in Sources */,
14BAFADE20308EE50054A2E6 /* DrawingBrushWidthViewController.swift in Sources */,
Expand Down Expand Up @@ -4087,7 +4092,6 @@
8076FDD6204864E700114F28 /* UserQueries.swift in Sources */,
33FB9D3E20CEF610005AF504 /* SubscriptionsSortingSeparatorView.swift in Sources */,
995F710B20C7822A00B7535F /* AuthTableViewController.swift in Sources */,
800FCD4D1F728EC800D9A692 /* ChannelInfoDescriptionCell.swift in Sources */,
41DD613A203D9E6600B02D8A /* UISplitViewControllerExtensions.swift in Sources */,
41A79C0F1D2F085F00A1968E /* User.swift in Sources */,
8076FDB92048581F00114F28 /* AuthManagerCurrentUser.swift in Sources */,
Expand Down Expand Up @@ -4127,7 +4131,6 @@
414EFF921E54FE69004F001F /* AuthExtensions.swift in Sources */,
33FB9D4220D06492005AF504 /* EditProfileStatusCell.swift in Sources */,
414A1FFA1D46395400093E10 /* SocketManager.swift in Sources */,
800FCD4E1F728EC800D9A692 /* ChannelInfoDetailCell.swift in Sources */,
4151B45C1E2D1E5800F8AA1B /* AuthSettingsModelMapping.swift in Sources */,
806401331FB09EC400990572 /* PermissionModelMapping.swift in Sources */,
33D08E2820BD5EDC008D03EF /* Theme.swift in Sources */,
Expand Down Expand Up @@ -4169,6 +4172,7 @@
8020CCF01FEAB4A7003424F4 /* EmojiPicker.swift in Sources */,
334CFFEE20668DDF003CDB99 /* EmojiCollectionViewCell.swift in Sources */,
415DC7F61F67F5D30039FB4F /* NetworkManager.swift in Sources */,
411D40CA20D27A5E001A1035 /* ChannelInfoDescriptionCell.swift in Sources */,
807371A61F96A4FF00D53ADF /* LoginServiceModelHandler.swift in Sources */,
80D41DFD2092378400034D1F /* StarMessageRequest.swift in Sources */,
33D08E2A20BD5F24008D03EF /* TopTransparentViewController.swift in Sources */,
Expand Down
50 changes: 49 additions & 1 deletion Rocket.Chat/Controllers/Chat/ChannelActionsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,31 @@ class ChannelActionsViewController: BaseViewController {

if subscription.type == .directMessage {
header = [ChannelInfoUserCellData(user: subscription.directMessageUser)]
} else {
let hasDescription = !(subscription.roomDescription?.isEmpty ?? true)
let hasTopic = !(subscription.roomTopic?.isEmpty ?? true)

header = [
ChannelInfoBasicCellData(title: "#\(subscription.name)"),
ChannelInfoDescriptionCellData(
title: localized("chat.info.item.description"),
descriptionText: hasDescription ? subscription.roomDescription : localized("chat.info.item.no_description")
),
ChannelInfoDescriptionCellData(
title: localized("chat.info.item.topic"),
descriptionText: hasTopic ? subscription.roomTopic : localized("chat.info.item.no_topic")
)
]
}

let data = [header, [
ChannelInfoActionCellData(icon: UIImage(named: "Attachments"), title: "Files", action: showFilesList),
shouldListMentions ? ChannelInfoActionCellData(icon: UIImage(named: "Mentions"), title: "Mentions", action: showMentionsList) : nil,
ChannelInfoActionCellData(icon: UIImage(named: "Members"), title: "Members", action: showMembersList),
ChannelInfoActionCellData(icon: UIImage(named: "Star Off"), title: "Starred", action: showStarredList),
ChannelInfoActionCellData(icon: UIImage(named: "Share"), title: "Share", action: shareRoom),
ChannelInfoActionCellData(icon: UIImage(named: "Pinned"), title: "Pinned", action: showPinnedList)
], [
ChannelInfoActionCellData(icon: UIImage(named: "Share"), title: "Share", detail: false, action: shareRoom)
]]

tableViewData = data.compactMap({ $0 })
Expand Down Expand Up @@ -69,6 +85,16 @@ class ChannelActionsViewController: BaseViewController {
nibName: "ChannelInfoActionCell",
bundle: Bundle.main
), forCellReuseIdentifier: ChannelInfoActionCell.identifier)

tableView?.register(UINib(
nibName: "ChannelInfoDescriptionCell",
bundle: Bundle.main
), forCellReuseIdentifier: ChannelInfoDescriptionCell.identifier)

tableView?.register(UINib(
nibName: "ChannelInfoBasicCell",
bundle: Bundle.main
), forCellReuseIdentifier: ChannelInfoBasicCell.identifier)
}

func setupFavoriteButton() {
Expand Down Expand Up @@ -230,6 +256,20 @@ extension ChannelActionsViewController: UITableViewDelegate {
}
}

if let data = data as? ChannelInfoDescriptionCellData {
if let cell = tableView.dequeueReusableCell(withIdentifier: ChannelInfoDescriptionCell.identifier) as? ChannelInfoDescriptionCell {
cell.data = data
return cell
}
}

if let data = data as? ChannelInfoBasicCellData {
if let cell = tableView.dequeueReusableCell(withIdentifier: ChannelInfoBasicCell.identifier) as? ChannelInfoBasicCell {
cell.data = data
return cell
}
}

return UITableViewCell()
}

Expand All @@ -244,6 +284,14 @@ extension ChannelActionsViewController: UITableViewDelegate {
return CGFloat(ChannelInfoUserCell.defaultHeight)
}

if data as? ChannelInfoDescriptionCellData != nil {
return CGFloat(ChannelInfoDescriptionCell.defaultHeight)
}

if data as? ChannelInfoBasicCellData != nil {
return CGFloat(ChannelInfoBasicCell.defaultHeight)
}

return CGFloat(0)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ final class EditProfileTableViewController: BaseTableViewController, MediaPicker
}

func updateUserStatus() {
statusValueLabel.text = AuthManager.currentUser()?.status.rawValue.capitalized
statusValueLabel.text = viewModel.userStatus
}

// MARK: State Management
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import Foundation

final class EditProfileViewModel {

internal let title = localized("myaccount.settings.profile.title")
internal let editingTitle = localized("myaccount.settings.editing_profile.title")
internal let saveButtonTitle = localized("myaccount.settings.profile.actions.save")
Expand All @@ -19,4 +20,18 @@ final class EditProfileViewModel {
internal let emailPlaceholder = localized("myaccount.settings.profile.email_placeholder")
internal let statusTitle = localized("myaccount.settings.profile.status.title")
internal let changeYourPasswordTitle = localized("myaccount.settings.profile.actions.change_password")

internal var userStatus: String {
guard let user = AuthManager.currentUser() else {
return localized("user_menu.invisible")
}

switch user.status {
case .online: return localized("status.online")
case .offline: return localized("status.invisible")
case .busy: return localized("status.busy")
case .away: return localized("status.away")
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ extension SubscriptionsViewController: UISearchBarDelegate {

searchState = .searchingLocally
searchResult = subscriptions
organizeSubscriptionsGrouped()

tableView.reloadData()

Expand All @@ -374,6 +375,7 @@ extension SubscriptionsViewController: UISearchBarDelegate {

self?.searchState = .searchingRemotely
self?.searchResult = result
self?.organizeSubscriptionsGrouped()
self?.tableView.reloadData()
}
}
Expand Down
2 changes: 1 addition & 1 deletion Rocket.Chat/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>177</string>
<string>180</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
Expand Down
2 changes: 1 addition & 1 deletion Rocket.Chat/Storyboards/Chat.storyboard
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="9TE-I5-CEe">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="9TE-I5-CEe">
<device id="retina4_0" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
Expand Down

0 comments on commit 21b4424

Please sign in to comment.