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() { @objc func updateSubtitleForCurrentStatus() {
DispatchQueue.main.async { DispatchQueue.main.async {
self.subtitleLabel.isHidden = false self.subtitleLabel.isHidden = false
switch self.currentStatus { let subtitle = NSMutableAttributedString()
case .calculatingPoW: self.subtitleLabel.text = NSLocalizedString("Encrypting message", comment: "") if let muteEndDate = self.thread.mutedUntilDate, self.thread.isMuted {
case .routing: self.subtitleLabel.text = NSLocalizedString("Tracing a path", comment: "") subtitle.append(NSAttributedString(string: "\u{e067} ", attributes: [ .font : UIFont.ows_elegantIconsFont(10), .foregroundColor : Colors.unimportant ]))
case .messageSending: self.subtitleLabel.text = NSLocalizedString("Sending message", comment: "") let dateFormatter = DateFormatter()
case .messageSent: self.subtitleLabel.text = NSLocalizedString("Message sent securely", comment: "") dateFormatter.locale = Locale.current
case .messageFailed: self.subtitleLabel.text = NSLocalizedString("Message failed to send", comment: "") dateFormatter.timeStyle = .medium
case nil: dateFormatter.dateStyle = .medium
let subtitle = NSMutableAttributedString() subtitle.append(NSAttributedString(string: "Muted until " + dateFormatter.string(from: muteEndDate)))
if let muteEndDate = self.thread.mutedUntilDate, self.thread.isMuted { } else if let thread = self.thread as? TSGroupThread, !thread.isRSSFeed {
subtitle.append(NSAttributedString(string: "\u{e067} ", attributes: [ .font : UIFont.ows_elegantIconsFont(10), .foregroundColor : Colors.unimportant ])) let storage = OWSPrimaryStorage.shared()
let dateFormatter = DateFormatter() var userCount: Int?
dateFormatter.locale = Locale.current if thread.groupModel.groupType == .closedGroup {
dateFormatter.timeStyle = .medium userCount = GroupUtilities.getClosedGroupMemberCount(thread)
dateFormatter.dateStyle = .medium } else if thread.groupModel.groupType == .openGroup {
subtitle.append(NSAttributedString(string: "Muted until " + dateFormatter.string(from: muteEndDate))) storage.dbReadConnection.read { transaction in
} else if let thread = self.thread as? TSGroupThread, !thread.isRSSFeed { if let publicChat = LokiDatabaseUtilities.getPublicChat(for: self.thread.uniqueId!, in: transaction) {
let storage = OWSPrimaryStorage.shared() userCount = storage.getUserCount(for: publicChat, in: transaction)
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")) if let userCount = userCount {
} else if let hexEncodedPublicKey = (self.thread as? TSContactThread)?.contactIdentifier(), ECKeyPair.isValidHexEncodedPublicKey(candidate: hexEncodedPublicKey) { subtitle.append(NSAttributedString(string: "\(userCount) members"))
subtitle.append(NSAttributedString(string: hexEncodedPublicKey))
} else {
self.subtitleLabel.isHidden = true
}
} else if let hexEncodedPublicKey = (self.thread as? TSContactThread)?.contactIdentifier(), ECKeyPair.isValidHexEncodedPublicKey(candidate: hexEncodedPublicKey) { } else if let hexEncodedPublicKey = (self.thread as? TSContactThread)?.contactIdentifier(), ECKeyPair.isValidHexEncodedPublicKey(candidate: hexEncodedPublicKey) {
subtitle.append(NSAttributedString(string: hexEncodedPublicKey)) subtitle.append(NSAttributedString(string: hexEncodedPublicKey))
} else { } else {
self.subtitleLabel.isHidden = true 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) 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 smallFontSize = isIPhone5OrSmaller ? CGFloat(13) : CGFloat(15)
@objc public static let mediumFontSize = isIPhone5OrSmaller ? CGFloat(15) : CGFloat(17) @objc public static let mediumFontSize = isIPhone5OrSmaller ? CGFloat(15) : CGFloat(17)
@objc public static let largeFontSize = isIPhone5OrSmaller ? CGFloat(20) : CGFloat(22) @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) @objc public static let massiveFontSize = CGFloat(50)
// MARK: - Element Sizes // MARK: - Element Sizes

Loading…
Cancel
Save