Don't show Session ID in conversation title view

pull/261/head
nielsandriesse 5 years ago
parent 3a20e37896
commit 724d3c4497

@ -159,47 +159,38 @@ final class ConversationTitleView : UIView {
@objc func updateSubtitleForCurrentStatus() {
DispatchQueue.main.async {
self.subtitleLabel.isHidden = false
switch self.currentStatus {
case .calculatingPoW: self.subtitleLabel.text = NSLocalizedString("Encrypting message", comment: "")
case .routing: self.subtitleLabel.text = NSLocalizedString("Tracing a path", comment: "")
case .messageSending: self.subtitleLabel.text = NSLocalizedString("Sending message", comment: "")
case .messageSent: self.subtitleLabel.text = NSLocalizedString("Message sent securely", comment: "")
case .messageFailed: self.subtitleLabel.text = NSLocalizedString("Message failed to send", comment: "")
case nil:
let subtitle = NSMutableAttributedString()
if let muteEndDate = self.thread.mutedUntilDate, self.thread.isMuted {
subtitle.append(NSAttributedString(string: "\u{e067} ", attributes: [ .font : UIFont.ows_elegantIconsFont(10), .foregroundColor : Colors.unimportant ]))
let dateFormatter = DateFormatter()
dateFormatter.locale = Locale.current
dateFormatter.timeStyle = .medium
dateFormatter.dateStyle = .medium
subtitle.append(NSAttributedString(string: "Muted until " + dateFormatter.string(from: muteEndDate)))
} else if let thread = self.thread as? TSGroupThread, !thread.isRSSFeed {
let storage = OWSPrimaryStorage.shared()
var userCount: Int?
if thread.groupModel.groupType == .closedGroup {
userCount = GroupUtilities.getClosedGroupMemberCount(thread)
} else if thread.groupModel.groupType == .openGroup {
storage.dbReadConnection.read { transaction in
if let publicChat = LokiDatabaseUtilities.getPublicChat(for: self.thread.uniqueId!, in: transaction) {
userCount = storage.getUserCount(for: publicChat, in: transaction)
}
let subtitle = NSMutableAttributedString()
if let muteEndDate = self.thread.mutedUntilDate, self.thread.isMuted {
subtitle.append(NSAttributedString(string: "\u{e067} ", attributes: [ .font : UIFont.ows_elegantIconsFont(10), .foregroundColor : Colors.unimportant ]))
let dateFormatter = DateFormatter()
dateFormatter.locale = Locale.current
dateFormatter.timeStyle = .medium
dateFormatter.dateStyle = .medium
subtitle.append(NSAttributedString(string: "Muted until " + dateFormatter.string(from: muteEndDate)))
} else if let thread = self.thread as? TSGroupThread, !thread.isRSSFeed {
let storage = OWSPrimaryStorage.shared()
var userCount: Int?
if thread.groupModel.groupType == .closedGroup {
userCount = GroupUtilities.getClosedGroupMemberCount(thread)
} else if thread.groupModel.groupType == .openGroup {
storage.dbReadConnection.read { transaction in
if let publicChat = LokiDatabaseUtilities.getPublicChat(for: self.thread.uniqueId!, in: transaction) {
userCount = storage.getUserCount(for: publicChat, in: transaction)
}
}
if let userCount = userCount {
subtitle.append(NSAttributedString(string: "\(userCount) members"))
} else if let hexEncodedPublicKey = (self.thread as? TSContactThread)?.contactIdentifier(), ECKeyPair.isValidHexEncodedPublicKey(candidate: hexEncodedPublicKey) {
subtitle.append(NSAttributedString(string: hexEncodedPublicKey))
} else {
self.subtitleLabel.isHidden = true
}
}
if let userCount = userCount {
subtitle.append(NSAttributedString(string: "\(userCount) members"))
} else if let hexEncodedPublicKey = (self.thread as? TSContactThread)?.contactIdentifier(), ECKeyPair.isValidHexEncodedPublicKey(candidate: hexEncodedPublicKey) {
subtitle.append(NSAttributedString(string: hexEncodedPublicKey))
} else {
self.subtitleLabel.isHidden = true
}
self.subtitleLabel.attributedText = subtitle
}
else {
self.subtitleLabel.isHidden = true
}
self.subtitleLabel.attributedText = subtitle
self.titleLabel.font = .boldSystemFont(ofSize: self.subtitleLabel.isHidden ? Values.veryLargeFontSize : Values.mediumFontSize)
}
}

@ -15,7 +15,7 @@ public final class Values : NSObject {
@objc public static let smallFontSize = isIPhone5OrSmaller ? CGFloat(13) : CGFloat(15)
@objc public static let mediumFontSize = isIPhone5OrSmaller ? CGFloat(15) : CGFloat(17)
@objc public static let largeFontSize = isIPhone5OrSmaller ? CGFloat(20) : CGFloat(22)
@objc public static let veryLargeFontSize = isIPhone5OrSmaller ? CGFloat(25) : CGFloat(27)
@objc public static let veryLargeFontSize = isIPhone5OrSmaller ? CGFloat(24) : CGFloat(26)
@objc public static let massiveFontSize = CGFloat(50)
// MARK: - Element Sizes

Loading…
Cancel
Save