Skip to content

Commit

Permalink
fix: add disable app by dragging lag issue
Browse files Browse the repository at this point in the history
  • Loading branch information
phlpsong committed Jan 23, 2024
1 parent 18ae512 commit 9791e5e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 7 additions & 0 deletions Easydict/Feature/EventMonitor/EZEventMonitor.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,15 @@ - (EZTriggerType)getAppSelectTextActionType:(NSString *)appBundleID
wechat.appBundleID = @"com.tencent.xinWeChat";
wechat.triggerType = EZTriggerTypeDoubleClick | EZTriggerTypeTripleClick;

// https://github.com/tisfeng/Easydict/issues/346
// Add Easydict self as block app
EZAppModel *selfApp = [[EZAppModel alloc] init];
selfApp.appBundleID = [[NSBundle mainBundle] bundleIdentifier];
selfApp.triggerType = EZTriggerTypeNone;

NSArray *defaultAppModels = @[
wechat,
selfApp
];

return defaultAppModels;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,6 @@ - (void)selectApp {
NSArray<UTType *> *allowedTypes = @[ UTTypeApplication ];
[openPanel setAllowedContentTypes:allowedTypes];

// ???: Since [auto select] will cause lag when dragging select apps, I don't know why 😰
Configuration.shared.disabledAutoSelect = YES;

NSModalResponse result = [openPanel runModal];
if (result == NSModalResponseOK) {
NSLog(@"selected URLs: %@", openPanel.URLs);
Expand All @@ -267,8 +264,6 @@ - (void)selectApp {

[self.tableView reloadData];
}

Configuration.shared.disabledAutoSelect = NO;
}

- (NSArray<EZAppModel *> *)appModelsFromBundleIDDict:(NSDictionary<NSString *, NSNumber *> *)appBundleIDDict {
Expand Down

0 comments on commit 9791e5e

Please sign in to comment.