mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
6eeb0ec7ac
Copy tweak Added a toast when copying the sessionId or group URL (fixes to the toast UI as well) Fixed the new conversation screen styling Fixed the styling of the various attachment screens Updated the buttons on the attachment screen to behave like the input view buttons Removed the old OWSNavigationBar and OWSNavigationController (logic was buggy and not actually needed in most cases)
72 lines
2.4 KiB
Swift
72 lines
2.4 KiB
Swift
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
|
|
|
import UIKit
|
|
import SignalUtilitiesKit
|
|
import SessionUIKit
|
|
|
|
class MediaGalleryNavigationController: UINavigationController {
|
|
// HACK: Though we don't have an input accessory view, the VC we are presented above (ConversationVC) does.
|
|
// If the app is backgrounded and then foregrounded, when OWSWindowManager calls mainWindow.makeKeyAndVisible
|
|
// the ConversationVC's inputAccessoryView will appear *above* us unless we'd previously become first responder.
|
|
override public var canBecomeFirstResponder: Bool {
|
|
return true
|
|
}
|
|
|
|
// MARK: - UI
|
|
|
|
private lazy var backgroundView: UIView = {
|
|
let result: UIView = UIView()
|
|
result.themeBackgroundColor = .newConversation_background
|
|
|
|
return result
|
|
}()
|
|
|
|
// MARK: - View Lifecycle
|
|
|
|
override var preferredStatusBarStyle: UIStatusBarStyle { return ThemeManager.currentTheme.statusBarStyle }
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
|
|
view.themeBackgroundColor = .newConversation_background
|
|
|
|
// Insert a view to ensure the nav bar colour goes to the top of the screen
|
|
relayoutBackgroundView()
|
|
}
|
|
|
|
override func viewDidAppear(_ animated: Bool) {
|
|
super.viewDidAppear(animated)
|
|
|
|
// If the user's device is already rotated, try to respect that by rotating to landscape now
|
|
UIViewController.attemptRotationToDeviceOrientation()
|
|
}
|
|
|
|
// MARK: - Orientation
|
|
|
|
public override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
|
|
return .allButUpsideDown
|
|
}
|
|
|
|
// MARK: - Functions
|
|
|
|
private func relayoutBackgroundView() {
|
|
guard !backgroundView.isHidden else {
|
|
backgroundView.removeFromSuperview()
|
|
return
|
|
}
|
|
|
|
view.insertSubview(backgroundView, belowSubview: navigationBar)
|
|
|
|
backgroundView.pin(.top, to: .top, of: view)
|
|
backgroundView.pin(.left, to: .left, of: navigationBar)
|
|
backgroundView.pin(.right, to: .right, of: navigationBar)
|
|
backgroundView.pin(.bottom, to: .bottom, of: navigationBar)
|
|
}
|
|
|
|
override func setNavigationBarHidden(_ hidden: Bool, animated: Bool) {
|
|
super.setNavigationBarHidden(hidden, animated: animated)
|
|
|
|
backgroundView.isHidden = hidden
|
|
relayoutBackgroundView()
|
|
}
|
|
}
|