@ -49,6 +49,13 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
result . addTarget ( self , action : #selector ( copyPublicKey ) , for : UIControl . Event . touchUpInside )
return result
} ( )
private lazy var settingButtonsStackView : UIStackView = {
let result = UIStackView ( )
result . axis = . vertical
result . alignment = . fill
return result
} ( )
// MARK: L i f e c y c l e
override func viewDidLoad ( ) {
@ -110,9 +117,9 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
topStackView . layoutMargins = UIEdgeInsets ( top : 0 , left : Values . largeSpacing , bottom : 0 , right : Values . largeSpacing )
topStackView . isLayoutMarginsRelativeArrangement = true
// S e t u p s e t t i n g b u t t o n s s t a c k v i e w
let settingButtonsStackView = UIStackView ( arrangedSubviews : getSettingButtons ( ) )
settingButtonsStackView . axis = . vertical
settingButtonsStackView . alignment = . fill
getSettingButtons ( ) . forEach { settingButton in
settingButtonsStackView . addArrangedSubview ( settingButton )
}
// S e t u p s t a c k v i e w
let stackView = UIStackView ( arrangedSubviews : [ topStackView , settingButtonsStackView ] )
stackView . axis = . vertical
@ -288,6 +295,17 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
} , requiresSync : true )
}
}
@objc override internal func handleAppModeChangedNotification ( _ notification : Notification ) {
super . handleAppModeChangedNotification ( notification )
settingButtonsStackView . arrangedSubviews . forEach { settingButton in
settingButtonsStackView . removeArrangedSubview ( settingButton )
settingButton . removeFromSuperview ( )
}
getSettingButtons ( ) . forEach { settingButton in
settingButtonsStackView . addArrangedSubview ( settingButton ) // R e - d o s e t t i n g b u t t o n s
}
}
// MARK: I n t e r a c t i o n
@objc private func close ( ) {
@ -297,6 +315,7 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
@objc private func switchAppMode ( ) {
let newAppMode : AppMode = isLightMode ? . dark : . light
AppModeManager . shared . setCurrentAppMode ( to : newAppMode )
NotificationCenter . default . post ( name : . appModeChanged , object : nil )
}
@objc private func showQRCode ( ) {