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

Feautre tips view #418

Merged
merged 37 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
77cb335
feat: add tips cell
AkaShark Feb 19, 2024
def5b76
Merge branch 'dev' into feautre_tips_view
AkaShark Feb 19, 2024
2e5d583
feat: add Empty string checker
AkaShark Feb 19, 2024
318faeb
feat: add tips cell UI
AkaShark Feb 20, 2024
d1a12ae
pref: finish UI
AkaShark Feb 21, 2024
a380433
fix: UI
AkaShark Feb 21, 2024
ef5ee71
fix: update table row number
AkaShark Feb 21, 2024
3e99537
pref: update UI
AkaShark Feb 21, 2024
ad5dcc8
feat: solve btn click more btn click
AkaShark Feb 21, 2024
a582f58
Merge branch 'dev' into feautre_tips_view
AkaShark Feb 22, 2024
d592723
fix: replace hoverButton with linkButton
AkaShark Feb 22, 2024
f56785c
Merge branch 'feautre_tips_view' of github.com:AkaShark/Easydict into…
AkaShark Feb 22, 2024
35275d0
pref: pref UI
AkaShark Feb 22, 2024
c704722
fix: query text empty tableview hight error
AkaShark Feb 22, 2024
1722719
fix: get current localized language
AkaShark Feb 22, 2024
d168d02
Merge branch 'dev' into feautre_tips_view
tisfeng Feb 23, 2024
7b4128d
fix: remove unused code
AkaShark Feb 24, 2024
f206d7f
chore: extract func for check is tips cell
AkaShark Feb 24, 2024
0e28158
Merge branch 'dev' into feautre_tips_view
tisfeng Feb 25, 2024
e5b8307
Merge branch 'dev' into feautre_tips_view
tisfeng Feb 25, 2024
bb043b9
Merge branch 'dev' into feautre_tips_view
AkaShark Feb 26, 2024
f984ef4
Merge branch 'dev' into feautre_tips_view
tisfeng Feb 27, 2024
c9c2fec
Merge branch 'dev' into feautre_tips_view
tisfeng Feb 29, 2024
5257c8d
fix: use isUserChineseFirstLanguage to check if user system language …
tisfeng Feb 29, 2024
af95e3a
perf: do not show tips view when inputing translate
tisfeng Feb 29, 2024
388d56b
style: formate code
tisfeng Feb 29, 2024
5fc46c6
fix: fix query window height
AkaShark Mar 5, 2024
58a7d92
feat: add toggle for tips view
AkaShark Mar 5, 2024
7737bbe
Merge branch 'dev' into feautre_tips_view
tisfeng Mar 5, 2024
7834f26
Merge branch 'dev' into feautre_tips_view
tisfeng Mar 5, 2024
32303d8
fix: review comment
AkaShark Mar 5, 2024
b59b0fd
Merge branch 'feautre_tips_view' of github.com:AkaShark/Easydict into…
AkaShark Mar 5, 2024
4fc52ba
chore: update selection translation action type
AkaShark Mar 6, 2024
38342b1
Merge branch 'dev' into feautre_tips_view
tisfeng Mar 7, 2024
21a29c7
Update Easydict/App/Localizable.xcstrings
AkaShark Mar 8, 2024
d1dae4d
Merge branch 'dev' into feautre_tips_view
AkaShark Mar 10, 2024
0a6d636
Merge branch 'dev' into feautre_tips_view
tisfeng Mar 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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 @@ -287,6 +287,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 @@ -811,6 +812,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>"; };
C4DD01E82B12B3C80025EE8E /* TencentService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TencentService.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1478,6 +1481,8 @@
children = (
0396D60F292C932F006A11D9 /* EZSelectLanguageCell.h */,
0396D610292C932F006A11D9 /* EZSelectLanguageCell.m */,
96DFEB812B82588000F5C7EF /* EZTableTipsCell.h */,
96DFEB822B82588000F5C7EF /* EZTableTipsCell.m */,
037852B7295D49F900D0E2CF /* EZTableRowView.h */,
037852B8295D49F900D0E2CF /* EZTableRowView.m */,
);
Expand Down Expand Up @@ -2941,6 +2946,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" : "tip_Normal@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
186 changes: 186 additions & 0 deletions Easydict/App/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -4070,6 +4070,192 @@
}
}
},
"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" : "为什么在某些应用取词为空(空白处拖动等)时会出现提示音?"
}
}
}
},
"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" : "为什么取词为空时可能打断当前播放的音乐?"
}
}
}
},
"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" : {
Expand Down
3 changes: 3 additions & 0 deletions Easydict/Feature/Service/Language/EZLanguageManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ NS_ASSUME_NONNULL_BEGIN
/// Get language flag image, Chinese -> 🇨🇳, English -> 🇬🇧.
- (NSString *)languageFlagEmoji:(EZLanguage)language;

/// Get current system language
- (NSString *)ezCurrentLanguage;

@end

NS_ASSUME_NONNULL_END
4 changes: 4 additions & 0 deletions Easydict/Feature/Service/Language/EZLanguageManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -371,4 +371,8 @@ - (NSString *)showingLanguageNameWithFlag:(EZLanguage)language {
return [NSString stringWithFormat:@"%@ %@", flagEmoji, languageName];
}

- (NSString *)ezCurrentLanguage {
return [NSLocale currentLocale].currencyCode;
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,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
13 changes: 13 additions & 0 deletions Easydict/Feature/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
25 changes: 25 additions & 0 deletions Easydict/Feature/ViewController/Cell/EZTableTipsCell.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// EZTableTipsCell.h
// Easydict
//
// Created by Sharker on 2024/2/18.
// Copyright © 2024 izual. All rights reserved.
//

#import <Cocoa/Cocoa.h>

NS_ASSUME_NONNULL_BEGIN

typedef void(^tipsButtonClick)(NSString *url);

@interface EZTableTipsCell : NSTableRowView

@property (nonatomic, copy) tipsButtonClick moreBtnClick;

@property (nonatomic, copy) tipsButtonClick solveBtnClick;

- (CGFloat)cellHeight;

@end

NS_ASSUME_NONNULL_END
Loading