Skip to content

Commit

Permalink
Merge branch 'dev' into fix-updater
Browse files Browse the repository at this point in the history
  • Loading branch information
tisfeng authored Jan 26, 2024
2 parents a06a42c + b6974d1 commit 99009f9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ - (void)viewDidLoad {
}

- (void)setup {
self.appModelList = [[EZLocalStorage.shared selectTextTypeAppModelList] mutableCopy];
[self setupAppModelList];

[self.titleTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.inset(kMargin + 5); // ???: Why is the actual inset is 18?
Expand All @@ -78,6 +78,18 @@ - (void)setup {
}];
}

- (void)setupAppModelList {
self.appModelList = [[NSMutableArray alloc] init];
NSArray<EZAppModel *> *allAppModelList = [EZLocalStorage.shared selectTextTypeAppModelList];
NSWorkspace* workspace = [NSWorkspace sharedWorkspace];
for (EZAppModel *appModel in allAppModelList) {
NSURL *appURL = [workspace URLForApplicationWithBundleIdentifier:appModel.appBundleID];
if (appURL) {
[self.appModelList addObject:appModel];
}
}
}


#pragma mark - Getter && Setter

Expand Down
7 changes: 6 additions & 1 deletion Easydict/NewApp/View/SettingView/Tabs/DisabledAppTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ private class DisabledAppViewModel: ObservableObject {
}

func fetchDisabledApps() {
appModelList = EZLocalStorage.shared().selectTextTypeAppModelList
let allAppModelList = EZLocalStorage.shared().selectTextTypeAppModelList

appModelList = allAppModelList.compactMap { appModel in
let url = NSWorkspace.shared.urlForApplication(withBundleIdentifier: appModel.appBundleID)
return url == nil ? nil : appModel
}
}

func saveDisabledApps() {
Expand Down

0 comments on commit 99009f9

Please sign in to comment.