session-ios/SignalUtilitiesKit/Utilities/UIViewController+Utilities.swift
Morgan Pretty e6b941ea8a Fixed a number of tweaks and bugs with message requests
Removed the "Back" text from the back buttons
Removed the inset on the 'Path' settings button so the text remains horizontally centered
Hid the settings button from message request threads
Fixed an issue where the back button would remain visible in a conversation when the search field was visible
Fixed an issue where the tintColor of the conversation search field didn't match the global search field
Fixed an issue where sending an attachment response to a message request wouldn't approve the message request
Updated the size and positioning of the message request 'Clear All' button to match the DM 'Next' button
Updated the message request 'Clear All' button to start visible (so it's visible during the push animation) since that's the most likely state it'll be in
Updated the 'Message Requests' cell to use the pinned background colour
Updated the fallback for contact thread names to be a middle-truncated string (4 characters either side)
2022-02-28 17:23:34 +11:00

37 lines
1.5 KiB
Swift

import SessionUIKit
@objc(LKViewControllerUtilities)
public final class ViewControllerUtilities : NSObject {
private override init() { }
@objc(setUpDefaultSessionStyleForVC:withTitle:customBackButton:)
public static func setUpDefaultSessionStyle(for vc: UIViewController, title: String?, hasCustomBackButton: Bool) {
// Set gradient background
vc.view.backgroundColor = .clear
let gradient = Gradients.defaultBackground
vc.view.setGradient(gradient)
// Set navigation bar background color
if let navigationBar = vc.navigationController?.navigationBar {
navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
navigationBar.shadowImage = UIImage()
navigationBar.isTranslucent = false
navigationBar.barTintColor = Colors.navigationBarBackground
}
// Customize title
if let title = title {
let titleLabel = UILabel()
titleLabel.text = title
titleLabel.textColor = Colors.text
titleLabel.font = .boldSystemFont(ofSize: Values.veryLargeFontSize)
vc.navigationItem.titleView = titleLabel
}
// Set up back button
if hasCustomBackButton {
let backButton = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)
backButton.tintColor = Colors.text
vc.navigationItem.backBarButtonItem = backButton
}
}
}