Skip to content

Commit 4eca358

Browse files
committed
common refactor
Signed-off-by: 82Flex <[email protected]>
1 parent 73255ff commit 4eca358

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

TrollFools/AppListView.swift

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class App: Identifiable, ObservableObject {
2424
lazy var isSystem: Bool = !isUser
2525
lazy var isFromApple: Bool = id.hasPrefix("com.apple.")
2626
lazy var isFromTroll: Bool = isSystem && !isFromApple
27-
lazy var isRemovableSystem: Bool = isSystem && url.path.contains("/var/containers/Bundle/Application/")
27+
lazy var isRemovable: Bool = url.path.contains("/var/containers/Bundle/Application/")
2828

2929
init(id: String,
3030
name: String,
@@ -64,6 +64,11 @@ final class AppListModel: ObservableObject {
6464
self.allApplications = Self.fetchApplications(&hasTrollRecorder, &unsupportedCount)
6565
}
6666

67+
private static let excludedIdentifiers: Set<String> = [
68+
"com.opa334.Dopamine",
69+
"org.coolstar.SileoStore",
70+
]
71+
6772
private static func fetchApplications(_ hasTrollRecorder: inout Bool, _ unsupportedCount: inout Int) -> [App] {
6873
let allApps: [App] = LSApplicationWorkspace.default()
6974
.allApplications()
@@ -77,9 +82,19 @@ final class AppListModel: ObservableObject {
7782
else {
7883
return nil
7984
}
85+
8086
if id == "wiki.qaq.trapp" {
8187
hasTrollRecorder = true
8288
}
89+
90+
guard !id.hasPrefix("wiki.qaq.") && !id.hasPrefix("com.82flex.") else {
91+
return nil
92+
}
93+
94+
guard !excludedIdentifiers.contains(id) else {
95+
return nil
96+
}
97+
8398
let app = App(
8499
id: id,
85100
name: localizedName,
@@ -88,9 +103,15 @@ final class AppListModel: ObservableObject {
88103
url: url,
89104
version: shortVersionString
90105
)
91-
guard !app.isFromApple || app.isRemovableSystem else {
106+
107+
if app.isUser && app.isFromApple {
92108
return nil
93109
}
110+
111+
guard app.isRemovable else {
112+
return nil
113+
}
114+
94115
return app
95116
}
96117

0 commit comments

Comments
 (0)