From b0ee4717872972abd4bcaeae417b325abc17ddf3 Mon Sep 17 00:00:00 2001 From: Joel Reis Date: Thu, 5 Sep 2019 18:35:45 -1000 Subject: [PATCH] Fix #1488: Changing Private Browsing Only, adjusts theme correctly. --- .../Settings/SettingsViewController.swift | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Client/Frontend/Settings/SettingsViewController.swift b/Client/Frontend/Settings/SettingsViewController.swift index 1b7f2290f14..80478d66984 100644 --- a/Client/Frontend/Settings/SettingsViewController.swift +++ b/Client/Frontend/Settings/SettingsViewController.swift @@ -291,7 +291,24 @@ class SettingsViewController: TableViewController { } }) ] - privacy.rows.append(BoolRow(title: Strings.Private_Browsing_Only, option: Preferences.Privacy.privateBrowsingOnly)) + privacy.rows.append( + BoolRow( + title: Strings.Private_Browsing_Only, + option: Preferences.Privacy.privateBrowsingOnly, + onValueChange: { + Preferences.Privacy.privateBrowsingOnly.value = $0 + + // Need to flush the table, hacky, but works consistenly and well + let superView = self.tableView.superview + self.tableView.removeFromSuperview() + DispatchQueue.main.async { + // Let shield toggle change propagate, otherwise theme may not be set properly + superView?.addSubview(self.tableView) + self.applyTheme(self.theme) + } + } + ) + ) return privacy }()