Update leave strings

This commit is contained in:
ismailgulek
2020-09-24 13:00:50 +03:00
parent 2feba65be4
commit d69b2184cb
8 changed files with 63 additions and 9 deletions
@@ -39,6 +39,7 @@ final class RoomInfoListViewController: UIViewController {
private var theme: Theme!
private var errorPresenter: MXKErrorPresentation!
private var activityPresenter: ActivityIndicatorPresenter!
private var isRoomDirect: Bool = false
private lazy var closeButton: CloseButton = {
let button = CloseButton()
@@ -55,7 +56,9 @@ final class RoomInfoListViewController: UIViewController {
}()
private lazy var leaveAlertController: UIAlertController = {
let controller = UIAlertController(title: VectorL10n.roomParticipantsLeavePromptTitle, message: VectorL10n.roomParticipantsLeavePromptMsg, preferredStyle: .alert)
let title = self.isRoomDirect ? VectorL10n.dmRoomParticipantsLeavePromptTitle : VectorL10n.roomParticipantsLeavePromptTitle
let message = self.isRoomDirect ? VectorL10n.dmRoomParticipantsLeavePromptMsg : VectorL10n.roomParticipantsLeavePromptMsg
let controller = UIAlertController(title: title, message: message, preferredStyle: .alert)
controller.addAction(UIAlertAction(title: VectorL10n.cancel, style: .cancel, handler: nil))
controller.addAction(UIAlertAction(title: VectorL10n.leave, style: .default, handler: { [weak self] (action) in
@@ -127,6 +130,7 @@ final class RoomInfoListViewController: UIViewController {
// MARK: - Private
private func updateSections(with viewData: RoomInfoListViewData) {
isRoomDirect = viewData.isDirect
basicInfoView.configure(withViewData: viewData.basicInfoViewData)
var tmpSections: [Section] = []
@@ -156,7 +160,10 @@ final class RoomInfoListViewController: UIViewController {
rowUploads],
footer: nil)
let rowLeave = Row(type: .destructive, icon: Asset.Images.roomActionLeave.image, text: VectorL10n.roomParticipantsLeavePromptTitle, accessoryType: .none) {
let leaveTitle = viewData.isDirect ?
VectorL10n.dmRoomParticipantsLeavePromptTitle :
VectorL10n.roomParticipantsLeavePromptTitle
let rowLeave = Row(type: .destructive, icon: Asset.Images.roomActionLeave.image, text: leaveTitle, accessoryType: .none) {
self.present(self.leaveAlertController, animated: true, completion: nil)
}
let sectionLeave = Section(header: nil,
@@ -22,5 +22,6 @@ import Foundation
struct RoomInfoListViewData {
let numberOfMembers: Int
let isEncrypted: Bool
let isDirect: Bool
let basicInfoViewData: RoomInfoBasicViewData
}
@@ -45,6 +45,7 @@ final class RoomInfoListViewModel: NSObject, RoomInfoListViewModelType {
return RoomInfoListViewData(numberOfMembers: Int(room.summary.membersCount.joined),
isEncrypted: room.summary.isEncrypted,
isDirect: room.isDirect,
basicInfoViewData: basicInfoViewData)
}