Skip to content

Commit

Permalink
add disabled app list tab (#340)
Browse files Browse the repository at this point in the history
* feat: add disabled app tab

* fix: refactor app list issues

* fix: refactor disabled app tab

* fix: remove list row bg color

* fix: bundle application name issue

* fix: update code for review comments

* fix: update app item view model

* fix: remove item view model

* fix: refactor disable app item view

* perf: adjust add & minus bg color

* perf: add a border for list

* perf: adjust custom color name

* perf: show minus image color according to enable state

* perf: adjust disabled tab UI

* fix: add disabled title horizontal padding

* fix: code refactor

* fix: disabled environment

* fix: disable issue

---------

Co-authored-by: tisfeng <[email protected]>
  • Loading branch information
phlpsong and tisfeng authored Jan 20, 2024
1 parent 25b651c commit 1f6fdc2
Show file tree
Hide file tree
Showing 11 changed files with 385 additions and 6 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 @@ -704,8 +706,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 @@ -1821,6 +1825,7 @@
03CF88602B137ECB0030C199 /* Swift */ = {
isa = PBXGroup;
children = (
0A2A05A42B59755F00EEA142 /* Bundle */,
0A2BA9622B4A3CBB002872A4 /* Notification */,
0A2BA95E2B49A967002872A4 /* Binding */,
03FD68BC2B1E14B500FD388E /* String */,
Expand Down Expand Up @@ -2001,6 +2006,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 @@ -2077,6 +2090,7 @@
EAED41EA2B54A4900005FE0A /* ServiceConfiguration */,
278540332B3DE04F004E9488 /* GeneralTab.swift */,
0A057D6C2B499A000025C51D /* ServiceTab.swift */,
0A8685C72B552A590022534F /* DisabledAppTab.swift */,
276742042B3DC230002A2C75 /* PrivacyTab.swift */,
276742052B3DC230002A2C75 /* AboutTab.swift */,
);
Expand Down Expand Up @@ -2320,7 +2334,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 @@ -2479,16 +2493,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 @@ -2652,6 +2667,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 @@ -2691,6 +2707,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
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 ""
}
}
9 changes: 7 additions & 2 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 @@ -51,7 +56,7 @@ struct SettingView: View {

func resizeWindowFrame() {
guard let window else { return }

// Disable zoom button, ref: https://stackoverflow.com/a/66039864/8378840
window.standardWindowButton(.zoomButton)?.isEnabled = false

Expand All @@ -60,7 +65,7 @@ struct SettingView: View {
let height = switch selection {
case .general:
maxWidth
case .service:
case .service, .disabled:
500
case .privacy:
320
Expand Down
Loading

0 comments on commit 1f6fdc2

Please sign in to comment.