Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: show new settings option in release mode #374

Merged
merged 2 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 17 additions & 25 deletions Easydict/Feature/PerferenceWindow/EZSettingViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 0 additions & 9 deletions Easydict/NewApp/NewAppManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}