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

Fix tips view blank #499

Merged
merged 33 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
91ad693
Revert "Revert "Feautre tips view (#418)" (#477)"
AkaShark Apr 1, 2024
4169f64
fix: https://github.com/tisfeng/Easydict/issues/452 blank for tips view
AkaShark Apr 7, 2024
dbddef5
feat: add type of tips cell
AkaShark Apr 7, 2024
e1fa270
feat: support tips cell update cell type
AkaShark Apr 8, 2024
33ac9af
fix: when selection translation the text is empty set special tips c…
AkaShark Apr 8, 2024
1680110
Merge branch 'dev' into fix/tips_view_blank
AkaShark Apr 8, 2024
3e625a4
fix: update show tips status
AkaShark Apr 8, 2024
e9d5f3e
fix: resolve merge dev
AkaShark Apr 8, 2024
4c3be7e
fix: update action type
AkaShark Apr 8, 2024
1b98c97
pref: stash ocr error tips
AkaShark Apr 8, 2024
69e64e5
Merge branch 'dev' into fix/tips_view_blank
AkaShark Apr 8, 2024
b4e1bea
Merge branch 'dev' into fix/tips_view_blank
AkaShark Apr 22, 2024
306b3ad
fix: control show tips code
AkaShark Apr 23, 2024
4aaba31
fix: update view
AkaShark Apr 23, 2024
90edad1
fix: add mini cell height
AkaShark Apr 23, 2024
9003335
Merge branch 'dev' into fix/tips_view_blank
tisfeng Apr 26, 2024
06e0bb1
Merge branch 'dev' into fix/tips_view_blank
AkaShark Apr 28, 2024
d2b74d7
fix: tips cell type
AkaShark Apr 28, 2024
220fc31
Merge branch 'fix/tips_view_blank' of github.com:AkaShark/Easydict in…
AkaShark Apr 28, 2024
17270b7
Merge branch 'dev' into fix/tips_view_blank
AkaShark May 1, 2024
73de70a
Merge branch 'dev' into fix/tips_view_blank
tisfeng May 4, 2024
9c10076
Merge branch 'dev' into fix/tips_view_blank
tisfeng May 14, 2024
a3d58f3
fix: remove unuse code
AkaShark May 15, 2024
84901d5
fix: called showTipsView when showTips == true
AkaShark May 16, 2024
6856129
fix: display when user just want show query window again
AkaShark May 16, 2024
8dcd50f
perf: improve displaying tips view
tisfeng May 17, 2024
88e9b66
perf: do not reload tableView when starting query text
tisfeng May 17, 2024
87aac04
perf: remove unused Localizable.xcstrings
tisfeng May 18, 2024
7d67a66
perf: close tips view when just updating query text
tisfeng May 18, 2024
37a64ee
perf: close tips view when starting OCR image
tisfeng May 18, 2024
9f5bb0e
chore(deps): bump rexml in the bundler group across 1 directory
dependabot[bot] May 16, 2024
c5fca17
perf(UI): add icon for disableTipsView toggle
Jerry23011 May 19, 2024
51889f1
perf(UI): adjust advanced tab height
Jerry23011 May 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions Easydict.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@
9672D7D22B4008B40023B8FB /* MASShortcutBinder+EZMASShortcutBinder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9672D7D12B4008B40023B8FB /* MASShortcutBinder+EZMASShortcutBinder.m */; };
967712EA2B5B913600105E0F /* KeyHolder in Frameworks */ = {isa = PBXBuildFile; productRef = 967712E92B5B913600105E0F /* KeyHolder */; };
967712EE2B5B943400105E0F /* Shortcut.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967712ED2B5B943400105E0F /* Shortcut.swift */; };
96DFEB832B82588000F5C7EF /* EZTableTipsCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 96DFEB822B82588000F5C7EF /* EZTableTipsCell.m */; };
A0B65CA0F31AC8ECFB8347CC /* Pods_EasydictTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 378E73A7EA8FC8FB9C975A63 /* Pods_EasydictTests.framework */; };
B87AC7E36367075BA5D13234 /* Pods_Easydict.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6372B33DFF803C7096A82250 /* Pods_Easydict.framework */; };
C415C0AD2B450D4800A9D231 /* GeminiService.swift in Sources */ = {isa = PBXBuildFile; fileRef = C415C0AC2B450D4800A9D231 /* GeminiService.swift */; };
Expand Down Expand Up @@ -841,6 +842,8 @@
9672D7D02B4008B40023B8FB /* MASShortcutBinder+EZMASShortcutBinder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MASShortcutBinder+EZMASShortcutBinder.h"; sourceTree = "<group>"; };
9672D7D12B4008B40023B8FB /* MASShortcutBinder+EZMASShortcutBinder.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "MASShortcutBinder+EZMASShortcutBinder.m"; sourceTree = "<group>"; };
967712ED2B5B943400105E0F /* Shortcut.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Shortcut.swift; sourceTree = "<group>"; };
96DFEB812B82588000F5C7EF /* EZTableTipsCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EZTableTipsCell.h; sourceTree = "<group>"; };
96DFEB822B82588000F5C7EF /* EZTableTipsCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EZTableTipsCell.m; sourceTree = "<group>"; };
A230E9A2358C7FBC7FB26189 /* Pods-EasydictTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-EasydictTests.debug.xcconfig"; path = "Target Support Files/Pods-EasydictTests/Pods-EasydictTests.debug.xcconfig"; sourceTree = "<group>"; };
C415C0AC2B450D4800A9D231 /* GeminiService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeminiService.swift; sourceTree = "<group>"; };
C490BF712BE910B70021E40A /* AdvancedTabItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AdvancedTabItemView.swift; path = Easydict/Swift/View/AdvancedTabItemView.swift; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -1579,6 +1582,8 @@
children = (
0396D60F292C932F006A11D9 /* EZSelectLanguageCell.h */,
0396D610292C932F006A11D9 /* EZSelectLanguageCell.m */,
96DFEB812B82588000F5C7EF /* EZTableTipsCell.h */,
96DFEB822B82588000F5C7EF /* EZTableTipsCell.m */,
037852B7295D49F900D0E2CF /* EZTableRowView.h */,
037852B8295D49F900D0E2CF /* EZTableRowView.m */,
);
Expand Down Expand Up @@ -3093,6 +3098,7 @@
03B022FE29231FA6001C7E63 /* EZBaseQueryViewController.m in Sources */,
DC6D9C892B3969510055EFFC /* Appearance.swift in Sources */,
0396D611292C932F006A11D9 /* EZSelectLanguageCell.m in Sources */,
96DFEB832B82588000F5C7EF /* EZTableTipsCell.m in Sources */,
036196752A000F5900806370 /* FWEncryptorAES.m in Sources */,
9643D9462B71D103000FBEA6 /* KeyHolderRowView.swift in Sources */,
0399C6A829A74E0F00B4AFCC /* EZQueryResult+EZDeepLTranslateResponse.m in Sources */,
Expand Down
22 changes: 22 additions & 0 deletions Easydict/App/Assets.xcassets/tip_Normal.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"filename" : "tip_Normal.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
213 changes: 213 additions & 0 deletions Easydict/App/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,23 @@
}
}
},
"disable_tips_view" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Disable Tips View"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "关闭提示视图"
}
}
}
},
"disabled_app_list" : {
"comment" : "disabled app list",
"localizations" : {
Expand Down Expand Up @@ -4377,6 +4394,202 @@
}
}
},
"tips_beep" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Why is there a beep when the selected word is empty (such as dragging in a blank area) in some applications?"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "为什么在某些应用取词为空(空白处拖动等)时会出现提示音?"
AkaShark marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
},
"tips_edit_button" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Why does the edit button in the upper right corner flicker when selecting words in some applications?"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "为什么在某些应用取词时,右上角编辑按钮会出现闪烁?"
}
}
}
},
"tips_might_selecting" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Why might selecting an empty word interrupt the music currently playing?"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "为什么取词为空时可能打断当前播放的音乐?"
AkaShark marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
},
"tips_more" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "See More"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "查看更多"
}
}
}
},
"tips_mouse_hover" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Why can't I use mouse hover to select words in some applications?"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "为什么在某些应用中无法使用鼠标划词?"
}
}
}
},
"tips_select_words" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Why can't I select words on some web pages in the browser?"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "为什么浏览器中某些网页无法取词?"
}
}
}
},
"tips_solve" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Solve This"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "如何解决"
}
}
}
},
"tips_still_pop_up" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Why does macOS still pop up asking for permissions even though I have given Easydict the Accessibility/Screen Recording permissions?"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "已经给 Easydict 辅助功能/录屏权限 macOS 仍然弹窗要求给予权限?"
}
}
}
},
"tips_text_empty" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Why is the text empty when I select words in some applications?"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "为什么在某些应用中取词文本为空?"
}
}
}
},
"tips_title" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Tips"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "提示"
}
}
}
},
"tips_word_selection_OCR" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Why do word selection and OCR need to enable system-related permissions?"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "为什么取词和 OCR 需要开启系统相关权限?"
}
}
}
},
"Tisfeng" : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : ""
}
}
}
},
"toggle_languages" : {
"localizations" : {
"en" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ extension Defaults.Keys {
Key("EZConfiguration_kEnableBetaNewAppKey", default: false)
}
}

static var disableTipsView = Key<Bool>("disableTipsViewKey", default: false)
}

extension Defaults.Keys {
Expand Down
2 changes: 2 additions & 0 deletions Easydict/Swift/Feature/Configuration/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ class Configuration: NSObject {

@DefaultsWrapper(.selectQueryTextWhenWindowActivate) var selectQueryTextWhenWindowActivate: Bool

@DefaultsWrapper(.disableTipsView) var disableTipsView: Bool

var disabledAutoSelect: Bool = false

var isRecordingSelectTextShortcutKey: Bool = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ struct AdvancedTab: View {
subtitleText: "enable_beta_new_app_info"
)
}
Toggle(isOn: $disableTipsView) {
Jerry23011 marked this conversation as resolved.
Show resolved Hide resolved
Text("disable_tips_view")
}
}
}
.formStyle(.grouped)
Expand All @@ -58,6 +61,7 @@ struct AdvancedTab: View {
@Default(.defaultTTSServiceType) private var defaultTTSServiceType
@Default(.enableBetaFeature) private var enableBetaFeature
@Default(.enableBetaNewApp) private var enableBetaNewApp
@Default(.disableTipsView) private var disableTipsView
}

@available(macOS 13, *)
Expand Down
5 changes: 5 additions & 0 deletions Easydict/objc/Utility/EZCategory/NSString/NSString+EZUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ static NSArray *const EZDashCharacterList = @[ @"—", @"-", @"–" ];

- (NSString *)removeAlphabetAndNumbers;

#pragma mark - Check Empty String
#ifndef EZ_isEmptyString
FOUNDATION_EXPORT BOOL EZ_isEmptyString(id param);
#endif

@end

NS_ASSUME_NONNULL_END
17 changes: 15 additions & 2 deletions Easydict/objc/Utility/EZCategory/NSString/NSString+EZUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@
@"「" : @"」",
};

BOOL EZ_isEmptyString(id param) {
if (!param) {
return YES;
}
if ([param isKindOfClass:[NSString class]]) {
NSString *str = param;
return (str.length == 0);
}
NSCAssert(NO, @"isEmptyString: param %@ is not NSString", param);
return YES;
}


@implementation NSString (EZUtils)

/// Check if it is a single letter of the alphabet, like 'a', 'A'
Expand Down Expand Up @@ -224,7 +237,7 @@ - (BOOL)isEnglishWordWithLanguage:(EZLanguage)language {
}

- (NLLanguage)detectText {
NLTagger *tagger = [[NLTagger alloc] initWithTagSchemes:@[NLTagSchemeLanguage]];
NLTagger *tagger = [[NLTagger alloc] initWithTagSchemes:@[ NLTagSchemeLanguage ]];
tagger.string = self;
NLLanguage language = [tagger dominantLanguage];
return language;
Expand Down Expand Up @@ -466,7 +479,7 @@ - (NSString *)suffixQuote {
}
return quotes;
}


- (NSString *)tryToRemovePrefixQuote {
NSString *prefixQuote = [self prefixQuote];
Expand Down