Skip to content

Commit

Permalink
Merge branch 'dev' into shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
tisfeng authored Jan 21, 2024
2 parents 8fe2167 + 5384b39 commit af7addf
Show file tree
Hide file tree
Showing 14 changed files with 411 additions and 15 deletions.
23 changes: 20 additions & 3 deletions Easydict.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,10 @@
03FD68BB2B1DC59600FD388E /* CryptoSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 03FD68BA2B1DC59600FD388E /* CryptoSwift */; };
03FD68BE2B1E151A00FD388E /* String+EncryptAES.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03FD68BD2B1E151A00FD388E /* String+EncryptAES.swift */; };
0A057D6D2B499A000025C51D /* ServiceTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A057D6C2B499A000025C51D /* ServiceTab.swift */; };
0A2A05A62B59757100EEA142 /* Bundle+AppInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A2A05A52B59757100EEA142 /* Bundle+AppInfo.swift */; };
0A2BA9602B49A989002872A4 /* Binding+DidSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A2BA95F2B49A989002872A4 /* Binding+DidSet.swift */; };
0A2BA9642B4A3CCD002872A4 /* Notification+Name.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A2BA9632B4A3CCD002872A4 /* Notification+Name.swift */; };
0A8685C82B552A590022534F /* DisabledAppTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A8685C72B552A590022534F /* DisabledAppTab.swift */; };
0AC11B222B4D16A500F07198 /* WindowAccessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AC11B212B4D16A500F07198 /* WindowAccessor.swift */; };
0AC11B242B4E46B300F07198 /* TapHandlerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AC11B232B4E46B300F07198 /* TapHandlerView.swift */; };
17BCAEF72B0DFF9000A7D372 /* EZNiuTransTranslateResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 17BCAEF52B0DFF9000A7D372 /* EZNiuTransTranslateResponse.m */; };
Expand Down Expand Up @@ -708,8 +710,10 @@
03FD68BD2B1E151A00FD388E /* String+EncryptAES.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+EncryptAES.swift"; sourceTree = "<group>"; };
06E15747A7BD34D510ADC6A8 /* Pods-Easydict.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Easydict.debug.xcconfig"; path = "Target Support Files/Pods-Easydict/Pods-Easydict.debug.xcconfig"; sourceTree = "<group>"; };
0A057D6C2B499A000025C51D /* ServiceTab.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServiceTab.swift; sourceTree = "<group>"; };
0A2A05A52B59757100EEA142 /* Bundle+AppInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle+AppInfo.swift"; sourceTree = "<group>"; };
0A2BA95F2B49A989002872A4 /* Binding+DidSet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Binding+DidSet.swift"; sourceTree = "<group>"; };
0A2BA9632B4A3CCD002872A4 /* Notification+Name.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Notification+Name.swift"; sourceTree = "<group>"; };
0A8685C72B552A590022534F /* DisabledAppTab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisabledAppTab.swift; sourceTree = "<group>"; };
0AC11B212B4D16A500F07198 /* WindowAccessor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowAccessor.swift; sourceTree = "<group>"; };
0AC11B232B4E46B300F07198 /* TapHandlerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TapHandlerView.swift; sourceTree = "<group>"; };
17BCAEF32B0DFF9000A7D372 /* EZNiuTransTranslateResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZNiuTransTranslateResponse.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1829,6 +1833,7 @@
03CF88602B137ECB0030C199 /* Swift */ = {
isa = PBXGroup;
children = (
0A2A05A42B59755F00EEA142 /* Bundle */,
0A2BA9622B4A3CBB002872A4 /* Notification */,
0A2BA95E2B49A967002872A4 /* Binding */,
03FD68BC2B1E14B500FD388E /* String */,
Expand Down Expand Up @@ -2009,6 +2014,14 @@
path = String;
sourceTree = "<group>";
};
0A2A05A42B59755F00EEA142 /* Bundle */ = {
isa = PBXGroup;
children = (
0A2A05A52B59757100EEA142 /* Bundle+AppInfo.swift */,
);
path = Bundle;
sourceTree = "<group>";
};
0A2BA95E2B49A967002872A4 /* Binding */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -2087,6 +2100,7 @@
EAED41EA2B54A4900005FE0A /* ServiceConfiguration */,
278540332B3DE04F004E9488 /* GeneralTab.swift */,
0A057D6C2B499A000025C51D /* ServiceTab.swift */,
0A8685C72B552A590022534F /* DisabledAppTab.swift */,
276742042B3DC230002A2C75 /* PrivacyTab.swift */,
276742052B3DC230002A2C75 /* AboutTab.swift */,
);
Expand Down Expand Up @@ -2363,7 +2377,7 @@
buildConfigurationList = C99EEB2C2385796900FEE666 /* Build configuration list for PBXNativeTarget "Easydict" */;
buildPhases = (
21D768ECC6D11E109E6EB73A /* [CP] Check Pods Manifest.lock */,
03B04B582B2D4B8E00E30823 /* ShellScript */,
03B04B582B2D4B8E00E30823 /* Run Script */,
C99EEB142385796700FEE666 /* Sources */,
C99EEB152385796700FEE666 /* Frameworks */,
C99EEB162385796700FEE666 /* Resources */,
Expand Down Expand Up @@ -2524,16 +2538,17 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
03B04B582B2D4B8E00E30823 /* ShellScript */ = {
03B04B582B2D4B8E00E30823 /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
buildActionMask = 12;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Run Script";
outputFileListPaths = (
);
outputPaths = (
Expand Down Expand Up @@ -2698,6 +2713,7 @@
9672D7D22B4008B40023B8FB /* MASShortcutBinder+EZMASShortcutBinder.m in Sources */,
03BDA7BF2A26DA280079D04F /* NSScanner+EscapedScanning.m in Sources */,
03542A4C2937B5F100C34C33 /* EZYoudaoTranslate.m in Sources */,
0A2A05A62B59757100EEA142 /* Bundle+AppInfo.swift in Sources */,
037852B329583F5200D0E2CF /* EZServiceCell.m in Sources */,
03247E362968158B00AFCD67 /* EZScriptExecutor.m in Sources */,
03882F8E29D95044005B5A52 /* ToastWindowController.m in Sources */,
Expand Down Expand Up @@ -2737,6 +2753,7 @@
17BCAEF82B0DFF9000A7D372 /* EZNiuTransTranslate.m in Sources */,
039F5506294B6E29004AB940 /* EZSettingViewController.m in Sources */,
03BD281E29481C0400F5891A /* EZAudioPlayer.m in Sources */,
0A8685C82B552A590022534F /* DisabledAppTab.swift in Sources */,
03E02A2629250D1D00A10260 /* EZEventMonitor.m in Sources */,
03B0233429231FA6001C7E63 /* MMConsoleLogFormatter.m in Sources */,
037852B9295D49F900D0E2CF /* EZTableRowView.m in Sources */,
Expand Down
6 changes: 6 additions & 0 deletions Easydict/App/Assets.xcassets/Colors/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xE9",
"green" : "0xE9",
"red" : "0xEA"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x3A",
"green" : "0x39",
"red" : "0x3B"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xDE",
"green" : "0xDD",
"red" : "0xDE"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x50",
"green" : "0x50",
"red" : "0x50"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
1 change: 1 addition & 0 deletions Easydict/App/Easydict-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#import "entry.h"
#import "AppDelegate.h"
#import "EZConfiguration.h"
#import "EZAppModel.h"
#import "EZLocalStorage.h"

#import "NSString+EZConvenience.h"
Expand Down
20 changes: 20 additions & 0 deletions Easydict/App/Localizable.xcstrings
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"sourceLanguage" : "en",
"strings" : {
"" : {

},
"about" : {
"comment" : "about",
"localizations" : {
Expand Down Expand Up @@ -2415,6 +2418,23 @@
}
}
},
"setting.disabled.import_app_error.message" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Unable to add Application"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "无法添加应用"
}
}
}
},
"setting.general.advance.default_tts_service" : {
"localizations" : {
"en" : {
Expand Down
2 changes: 1 addition & 1 deletion Easydict/Feature/Configuration/EZConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ - (void)setBeta:(BOOL)beta {
[NSUserDefaults mm_write:stringValue forKey:EZBetaFeatureKey];
}
- (BOOL)isBeta {
NSString *stringValue = [NSUserDefaults mm_readString:EZBetaFeatureKey defaultValue:@"0"];
NSString *stringValue = [NSUserDefaults mm_read:EZBetaFeatureKey];
BOOL isBeta = [stringValue boolValue];
return isBeta;
}
Expand Down
23 changes: 23 additions & 0 deletions Easydict/Feature/Utility/Swift/Bundle/Bundle+AppInfo.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// Bundle+AppInfo.swift
// Easydict
//
// Created by phlpsong on 2024/1/18.
// Copyright © 2024 izual. All rights reserved.
//

import Foundation

extension Bundle {
var applicationName: String {
if let displayName: String = object(forInfoDictionaryKey: "CFBundleDisplayName") as? String {
return displayName
} else if let name: String = object(forInfoDictionaryKey: "CFBundleName") as? String {
return name
}
if let executableURL {
return executableURL.deletingLastPathComponent().lastPathComponent
}
return ""
}
}
28 changes: 22 additions & 6 deletions Easydict/NewApp/View/SettingView/SettingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import SwiftUI
enum SettingTab: Int {
case general
case service
case disabled
case privacy
case about
}
Expand All @@ -30,6 +31,10 @@ struct SettingView: View {
.tabItem { Label("service", systemImage: "briefcase") }
.tag(SettingTab.service)

DisabledAppTab()
.tabItem { Label("disabled_app_list", systemImage: "nosign") }
.tag(SettingTab.disabled)

PrivacyTab()
.tabItem { Label("privacy", systemImage: "hand.raised.square") }
.tag(SettingTab.privacy)
Expand All @@ -52,14 +57,25 @@ struct SettingView: View {
func resizeWindowFrame() {
guard let window else { return }

let originalFrame = window.frame
let newSize = switch selection {
case .general, .privacy, .about:
CGSize(width: 500, height: 520)
case .service:
CGSize(width: 800, height: 520)
// Disable zoom button, ref: https://stackoverflow.com/a/66039864/8378840
window.standardWindowButton(.zoomButton)?.isEnabled = false

// Keep the settings page windows all the same width to avoid strange animations.
let maxWidth = 650
let height = switch selection {
case .general:
maxWidth
case .service, .disabled:
500
case .privacy:
320
case .about:
450
}

let newSize = CGSize(width: maxWidth, height: height)

let originalFrame = window.frame
let newY = originalFrame.origin.y + originalFrame.size.height - newSize.height
let newRect = NSRect(origin: CGPoint(x: originalFrame.origin.x, y: newY), size: newSize)

Expand Down
Loading

0 comments on commit af7addf

Please sign in to comment.