mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
31 lines
1.3 KiB
Swift
31 lines
1.3 KiB
Swift
|
|
@objc(LKViewControllerUtilities)
|
|
public final class ViewControllerUtilities : NSObject {
|
|
|
|
private override init() { }
|
|
|
|
@objc(setUpDefaultSessionStyleForVC:withTitle:)
|
|
public static func setUpDefaultSessionStyle(for vc: UIViewController, title: String) {
|
|
// Set gradient background
|
|
vc.view.backgroundColor = .clear
|
|
let gradient = Gradients.defaultLokiBackground
|
|
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
|
|
let titleLabel = UILabel()
|
|
titleLabel.text = title
|
|
titleLabel.textColor = Colors.text
|
|
titleLabel.font = .boldSystemFont(ofSize: Values.veryLargeFontSize)
|
|
vc.navigationItem.titleView = titleLabel
|
|
// Set up back button
|
|
let backButton = UIBarButtonItem(title: "Back", style: .plain, target: nil, action: nil)
|
|
backButton.tintColor = Colors.text
|
|
vc.navigationItem.backBarButtonItem = backButton
|
|
}
|
|
}
|