From 557292c9918b97b0dc1d1a39fba64eafb4232afc Mon Sep 17 00:00:00 2001 From: Tisfeng Date: Wed, 31 Jan 2024 22:32:57 +0800 Subject: [PATCH] perf: show new settings option in release mode (#374) --- .../EZSettingViewController.m | 42 ++++++++----------- Easydict/NewApp/NewAppManager.swift | 9 ---- 2 files changed, 17 insertions(+), 34 deletions(-) diff --git a/Easydict/Feature/PerferenceWindow/EZSettingViewController.m b/Easydict/Feature/PerferenceWindow/EZSettingViewController.m index 38d2aec42..415295202 100644 --- a/Easydict/Feature/PerferenceWindow/EZSettingViewController.m +++ b/Easydict/Feature/PerferenceWindow/EZSettingViewController.m @@ -495,16 +495,14 @@ - (void)setupUI { self.hideMenuBarIconButton = [NSButton checkboxWithTitle:hideMenuBarIcon target:self action:@selector(hideMenuBarIconButtonClicked:)]; [self.contentView addSubview:self.hideMenuBarIconButton]; - if (EasydictNewAppManager.shared.showEnableToggleUI) { - NSTextField *betaNewAppLabel = [NSTextField labelWithString:NSLocalizedString(@"beta_new_app", nil)]; - betaNewAppLabel.font = font; - [self.contentView addSubview:betaNewAppLabel]; - self.betaNewAppLabel = betaNewAppLabel; - - NSString *enableBetaNewApp = NSLocalizedString(@"enable_beta_new_app", nil); - self.enableBetaNewAppButton = [NSButton checkboxWithTitle:enableBetaNewApp target:self action:@selector(enableBetaNewAppButtonClicked:)]; - [self.contentView addSubview:self.enableBetaNewAppButton]; - } + NSTextField *betaNewAppLabel = [NSTextField labelWithString:NSLocalizedString(@"beta_new_app", nil)]; + betaNewAppLabel.font = font; + [self.contentView addSubview:betaNewAppLabel]; + self.betaNewAppLabel = betaNewAppLabel; + + NSString *enableBetaNewApp = NSLocalizedString(@"enable_beta_new_app", nil); + self.enableBetaNewAppButton = [NSButton checkboxWithTitle:enableBetaNewApp target:self action:@selector(enableBetaNewAppButtonClicked:)]; + [self.contentView addSubview:self.enableBetaNewAppButton]; NSTextField *fontSizeLabel = [NSTextField labelWithString:NSLocalizedString(@"font_size", nil)]; fontSizeLabel.font = font; @@ -866,23 +864,17 @@ - (void)updateViewConstraints { make.centerY.equalTo(self.menuBarIconLabel); }]; - if (EasydictNewAppManager.shared.showEnableToggleUI) { - [self.betaNewAppLabel mas_remakeConstraints:^(MASConstraintMaker *make) { - make.right.equalTo(self.autoGetSelectedTextLabel); - make.top.equalTo(self.hideMenuBarIconButton.mas_bottom).offset(self.verticalPadding); - }]; - [self.enableBetaNewAppButton mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(self.betaNewAppLabel.mas_right).offset(self.horizontalPadding); - make.centerY.equalTo(self.betaNewAppLabel); - }]; - } + [self.betaNewAppLabel mas_remakeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self.autoGetSelectedTextLabel); + make.top.equalTo(self.hideMenuBarIconButton.mas_bottom).offset(self.verticalPadding); + }]; + [self.enableBetaNewAppButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.betaNewAppLabel.mas_right).offset(self.horizontalPadding); + make.centerY.equalTo(self.betaNewAppLabel); + }]; self.topmostView = self.inputLabel; - if (EasydictNewAppManager.shared.showEnableToggleUI) { - self.bottommostView = self.enableBetaNewAppButton; - } else { - self.bottommostView = self.hideMenuBarIconButton; - } + self.bottommostView = self.enableBetaNewAppButton; if ([EZLanguageManager.shared isSystemChineseFirstLanguage]) { self.leftmostView = self.adjustQueryIconPostionLabel; diff --git a/Easydict/NewApp/NewAppManager.swift b/Easydict/NewApp/NewAppManager.swift index 5b54187f0..8b3d9a8dc 100644 --- a/Easydict/NewApp/NewAppManager.swift +++ b/Easydict/NewApp/NewAppManager.swift @@ -22,13 +22,4 @@ public final class NewAppManager: NSObject { public var enable: Bool { UserDefaults.standard.bool(forKey: Self.enableKey) } - - @objc - public var showEnableToggleUI: Bool { - #if DEBUG - true - #else - false - #endif - } }