From 6583efdf1dcc81af42ef1c5a5df33c135213c5a3 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Sun, 27 Mar 2022 13:44:21 -0400 Subject: [PATCH] Remove condition causing infinite looping in unit tests --- Clocker/Overall App/Themer.swift | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Clocker/Overall App/Themer.swift b/Clocker/Overall App/Themer.swift index 8dd347e..a0f90dc 100644 --- a/Clocker/Overall App/Themer.swift +++ b/Clocker/Overall App/Themer.swift @@ -50,11 +50,8 @@ class Themer: NSObject { object: nil) if #available(macOS 10.14, *) { - effectiveApperanceObserver = NSApp.observe(\.effectiveAppearance) { [weak self] _, _ in - if let sSelf = self { - sSelf.setAppAppearance() - NotificationCenter.default.post(name: .themeDidChangeNotification, object: nil) - } + effectiveApperanceObserver = NSApp.observe(\.effectiveAppearance) { _, _ in + NotificationCenter.default.post(name: .themeDidChangeNotification, object: nil) } } } @@ -452,7 +449,9 @@ extension Themer { } else if themeIndex == .system { appAppearance = retrieveCurrentSystem() == .dark ? NSAppearance(named: .darkAqua) : NSAppearance(named: .aqua) } - NSApp.appearance = appAppearance + if NSApp.appearance != appAppearance { + NSApp.appearance = appAppearance + } } }