mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Clean
This commit is contained in:
parent
3e5a0be7d8
commit
9299883caa
2 changed files with 19 additions and 8 deletions
|
@ -1,5 +1,4 @@
|
|||
import NVActivityIndicatorView
|
||||
import SwiftCSV
|
||||
|
||||
final class PathVC : BaseVC {
|
||||
|
||||
|
|
|
@ -240,16 +240,27 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
|
|||
let closeButton = UIBarButtonItem(image: #imageLiteral(resourceName: "X"), style: .plain, target: self, action: #selector(close))
|
||||
closeButton.tintColor = Colors.text
|
||||
navigationItem.leftBarButtonItem = closeButton
|
||||
let qrCodeButton = UIBarButtonItem(image: #imageLiteral(resourceName: "QRCode"), style: .plain, target: self, action: #selector(showQRCode))
|
||||
qrCodeButton.tintColor = Colors.text
|
||||
var rightBarButtonItems: [UIBarButtonItem] = [ qrCodeButton ]
|
||||
if #available(iOS 13, *) { // Pre iOS 13 the user can't switch actively but the app still responds to system changes
|
||||
let appModeIcon = isDarkMode ? #imageLiteral(resourceName: "ic_dark_theme_on") : #imageLiteral(resourceName: "ic_dark_theme_off")
|
||||
let appModeButton = UIBarButtonItem(image: appModeIcon, style: .plain, target: self, action: #selector(switchAppMode))
|
||||
let appModeIcon = isDarkMode ? #imageLiteral(resourceName: "ic_dark_theme_on").withTintColor(.white) : #imageLiteral(resourceName: "ic_dark_theme_off").withTintColor(.black)
|
||||
let appModeButton = UIButton()
|
||||
appModeButton.setImage(appModeIcon, for: UIControl.State.normal)
|
||||
appModeButton.tintColor = Colors.text
|
||||
rightBarButtonItems.append(appModeButton)
|
||||
appModeButton.addTarget(self, action: #selector(switchAppMode), for: UIControl.Event.touchUpInside)
|
||||
let qrCodeIcon = isDarkMode ? #imageLiteral(resourceName: "QRCode").withTintColor(.white) : #imageLiteral(resourceName: "QRCode").withTintColor(.black)
|
||||
let qrCodeButton = UIButton()
|
||||
qrCodeButton.setImage(qrCodeIcon, for: UIControl.State.normal)
|
||||
qrCodeButton.tintColor = Colors.text
|
||||
qrCodeButton.addTarget(self, action: #selector(showQRCode), for: UIControl.Event.touchUpInside)
|
||||
let stackView = UIStackView(arrangedSubviews: [ appModeButton, qrCodeButton ])
|
||||
stackView.axis = .horizontal
|
||||
stackView.spacing = Values.mediumSpacing
|
||||
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: stackView)
|
||||
} else {
|
||||
let qrCodeIcon = isDarkMode ? #imageLiteral(resourceName: "QRCode").asTintedImage(color: .white) : #imageLiteral(resourceName: "QRCode").asTintedImage(color: .black)
|
||||
let qrCodeButton = UIBarButtonItem(image: qrCodeIcon, style: .plain, target: self, action: #selector(showQRCode))
|
||||
qrCodeButton.tintColor = Colors.text
|
||||
navigationItem.rightBarButtonItem = qrCodeButton
|
||||
}
|
||||
navigationItem.rightBarButtonItems = rightBarButtonItems
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,6 +309,7 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
|
|||
|
||||
@objc override internal func handleAppModeChangedNotification(_ notification: Notification) {
|
||||
super.handleAppModeChangedNotification(notification)
|
||||
updateNavigationBarButtons()
|
||||
settingButtonsStackView.arrangedSubviews.forEach { settingButton in
|
||||
settingButtonsStackView.removeArrangedSubview(settingButton)
|
||||
settingButton.removeFromSuperview()
|
||||
|
|
Loading…
Reference in a new issue