Skip to content

Commit

Permalink
Merge branch 'dev' into modify_menu_bar_icon
Browse files Browse the repository at this point in the history
  • Loading branch information
tisfeng authored Jan 31, 2024
2 parents 7a22a2a + 557292c commit d38a939
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 34 deletions.
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
}
}

0 comments on commit d38a939

Please sign in to comment.