Skip to content

Commit

Permalink
Change minimum deployments to 13.0 (#562)
Browse files Browse the repository at this point in the history
* feat: change podfile platform osx version

* feat: remove enableBetaNewApp defaults

* feat: remove @available(macOS 13, *)

* feat: remove @available(macOS 13, *)

* feat: remove MASPreferences MASShortcut

* feat: remove MASShortcut MASPreferences

* remove: setting and preference window

* feat: remove unused code

* fix: compatibility to close the setting page

* fix: remove unused code

* fix: remove macOS 13

* Update Easydict/objc/ViewController/Window/WindowManager/EZWindowManager.m

Co-authored-by: Tisfeng <[email protected]>

* Update Easydict/objc/ViewController/Window/WindowManager/EZWindowManager.m

Co-authored-by: Tisfeng <[email protected]>

* perf: remove unuse kEnableBetaNewAppKey

* fix: localization strings fix

* fix: remove unused code

* fix: localizable strings

* style: format code

* perf: remove unsed code

* style: format code

---------

Co-authored-by: Tisfeng <[email protected]>
  • Loading branch information
AkaShark and tisfeng authored May 25, 2024
1 parent 4d9eb5a commit f241cc5
Show file tree
Hide file tree
Showing 166 changed files with 1,212 additions and 9,990 deletions.
124 changes: 14 additions & 110 deletions Easydict.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion Easydict.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"originHash" : "3fbe4aaa777ce32c89a8c0750e2e78cb417a4bf7e5ece00eb7338b15ca5d7f65",
"pins" : [
{
"identity" : "abseil-cpp-binary",
Expand Down
8 changes: 1 addition & 7 deletions Easydict/App/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

#import "AppDelegate.h"
#import "EZShortcut.h"
#import "MMCrash.h"
#import "AppDelegate+EZURLScheme.h"

Expand All @@ -26,12 +25,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
[EZLog setupCrashLogService];
[EZLog logAppInfo];

if (!Configuration.shared.enableBetaNewApp) {
[EZMenuItemManager.shared setup];
[EZShortcut setup];
} else {
[Shortcut setupShortcut];
}
[Shortcut setupShortcut];

[EZWindowManager.shared showMainWindowIfNeeded];

Expand Down
11 changes: 0 additions & 11 deletions Easydict/App/Easydict-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,12 @@
#import "NSString+EZChineseText.h"
#import "EZError.h"
#import "EZConst.h"
#import "EZSettingViewController.h"
#import "EZAboutViewController.h"
#import "EZServiceViewController.h"
#import "EZPrivacyViewController.h"
#import "EZDisableAutoSelectTextViewController.h"

#import "EZMenuItemManager.h"
#import "NSImage+MM.h"
#import "NSColor+MyColors.h"

#import "entry.h"
#import "AppDelegate.h"

#import "EZAppModel.h"
#import "EZLocalStorage.h"

#import "NSString+EZConvenience.h"
#import "EZWindowManager.h"
#import "NSViewController+EZWindow.h"
Expand All @@ -35,4 +25,3 @@
#import "EZDeepLTranslate.h"
#import "EZBingService.h"
#import "NSString+EZUtils.h"

97 changes: 45 additions & 52 deletions Easydict/App/EasydictApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ import SwiftUI
enum EasydictCmpatibilityEntry {
static func main() {
parseArmguments()
if Configuration.shared.enableBetaNewApp {
EasydictApp.main()
} else {
_ = NSApplicationMain(CommandLine.argc, CommandLine.unsafeArgv)
}
// app launch
EasydictApp.main()
}
}

Expand All @@ -31,55 +28,53 @@ struct EasydictApp: App {
// MARK: Internal

var body: some Scene {
if #available(macOS 13, *) {
MenuBarExtra(isInserted: $hideMenuBar.toggledValue) {
MenuItemView()
.environmentObject(languageState)
.environment(\.locale, .init(identifier: I18nHelper.shared.localizeCode))
} label: {
Label {
Text("Easydict")
.openSettingsAccess() // trick way for open setting
.onReceive(NotificationCenter.default.publisher(
for: Notification.Name.openSettings,
object: nil
)) { _ in
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
// calling `openSettings` immediately doesn't work so wait a quick moment
try? openSettings()
}
MenuBarExtra(isInserted: $hideMenuBar.toggledValue) {
MenuItemView()
.environmentObject(languageState)
.environment(\.locale, .init(identifier: I18nHelper.shared.localizeCode))
} label: {
Label {
Text("Easydict")
.openSettingsAccess() // trick way for open setting
.onReceive(NotificationCenter.default.publisher(
for: Notification.Name.openSettings,
object: nil
)) { _ in
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
// calling `openSettings` immediately doesn't work so wait a quick moment
try? openSettings()
}
} icon: {
Image(menuBarIcon.rawValue)
.resizable()
#if DEBUG
.renderingMode(.original)
#else
.renderingMode(.template)
#endif
.scaledToFit()
}
.help("Easydict 🍃")
}
.menuBarExtraStyle(.menu)
.commands {
EasyDictMainMenu() // main menu
// Override About button
CommandGroup(replacing: .appInfo) {
Button {
showAboutWindow()
} label: {
Text("menubar.about")
}
} icon: {
Image(menuBarIcon.rawValue)
.resizable()
#if DEBUG
.renderingMode(.original)
#else
.renderingMode(.template)
#endif
.scaledToFit()
}
.help("Easydict 🍃")
}
.menuBarExtraStyle(.menu)
.commands {
EasyDictMainMenu() // main menu
// Override About button
CommandGroup(replacing: .appInfo) {
Button {
showAboutWindow()
} label: {
Text("menubar.about")
}
}
}

Settings {
SettingView().environmentObject(languageState).environment(
\.locale,
.init(identifier: I18nHelper.shared.localizeCode)
)
}
Settings {
SettingView().environmentObject(languageState).environment(
\.locale,
.init(identifier: I18nHelper.shared.localizeCode)
)
}
}

Expand Down Expand Up @@ -112,9 +107,7 @@ struct EasydictApp: App {
aboutWindow?.titlebarAppearsTransparent = true
aboutWindow?.isReleasedWhenClosed = false
aboutWindow?.center()
if #available(macOS 13, *) {
aboutWindow?.contentView = NSHostingView(rootView: SettingsAboutTab())
}
aboutWindow?.contentView = NSHostingView(rootView: SettingsAboutTab())
aboutWindow?.makeKeyAndOrderFront(nil)
}
}
Expand Down
Loading

0 comments on commit f241cc5

Please sign in to comment.