Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #8535: Fix toggling night mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ns-vasilev committed Dec 17, 2023
1 parent a9f0557 commit 5a6580a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,7 @@ extension BrowserViewController {
browserViewController.dismiss(animated: true)
browserViewController.tabToolbarDidPressShare()
}
NightModeMenuButton(dismiss: {
browserViewController.dismiss(animated: true)
})
NightModeMenuButton()
MenuItemButton(icon: Image(braveSystemName: "leo.browser.bookmark-add"), title: Strings.addToMenuItem) {
browserViewController.dismiss(animated: true) {
browserViewController.openAddBookmark()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import Preferences
struct NightModeMenuButton: View {
@ObservedObject private var nightMode = Preferences.General.nightModeEnabled

var dismiss: () -> Void

var body: some View {
HStack {
MenuItemHeaderView(
Expand All @@ -24,16 +22,12 @@ struct NightModeMenuButton: View {
Toggle("", isOn: $nightMode.value)
.labelsHidden()
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
.onChange(of: nightMode.value) { _ in
dismiss()
}
}
.padding(.horizontal, 14)
.frame(maxWidth: .infinity, minHeight: 48.0)
.background(
Button(action: {
Preferences.General.nightModeEnabled.value.toggle()
dismiss()
}) {
Color.clear
}
Expand Down

0 comments on commit 5a6580a

Please sign in to comment.