@@ -23,7 +23,7 @@ final class App: Identifiable, ObservableObject {
2323 lazy var isUser : Bool = type == " User "
2424 lazy var isSystem : Bool = !isUser
2525 lazy var isFromApple : Bool = id. hasPrefix ( " com.apple. " )
26- lazy var isFromTrollStore : Bool = isSystem && !isFromApple
26+ lazy var isFromTroll : Bool = isSystem && !isFromApple
2727 lazy var isRemovableSystem : Bool = isSystem && url. path. contains ( " /var/containers/Bundle/Application/ " )
2828
2929 init ( id: String ,
@@ -52,23 +52,19 @@ final class App: Identifiable, ObservableObject {
5252final class AppListModel : ObservableObject {
5353 static let shared = AppListModel ( )
5454
55- @Published var userApps : [ App ]
55+ @Published var allApplications : [ App ] = [ ]
5656 @Published var hasTrollRecorder : Bool = false
5757 @Published var unsupportedCount : Int = 0
5858
5959 private init ( ) {
60- var hasTrollRecorder = false
61- var unsupportedCount = 0
62- self . userApps = Self . getUserApps ( & hasTrollRecorder, & unsupportedCount)
63- self . hasTrollRecorder = hasTrollRecorder
64- self . unsupportedCount = unsupportedCount
60+ refresh ( )
6561 }
6662
6763 func refresh( ) {
68- self . userApps = Self . getUserApps ( & hasTrollRecorder, & unsupportedCount)
64+ self . allApplications = Self . fetchApplications ( & hasTrollRecorder, & unsupportedCount)
6965 }
7066
71- private static func getUserApps ( _ hasTrollRecorder: inout Bool , _ unsupportedCount: inout Int ) -> [ App ] {
67+ private static func fetchApplications ( _ hasTrollRecorder: inout Bool , _ unsupportedCount: inout Int ) -> [ App ] {
7268 let allApps : [ App ] = LSApplicationWorkspace . default ( )
7369 . allApplications ( )
7470 . compactMap {
@@ -97,10 +93,13 @@ final class AppListModel: ObservableObject {
9793 }
9894 return app
9995 }
96+
10097 let filteredApps = allApps
10198 . filter { $0. isSystem || Injector . isEligibleBundle ( $0. url) }
10299 . sorted { $0. name. localizedCaseInsensitiveCompare ( $1. name) == . orderedAscending }
100+
103101 unsupportedCount = allApps. count - filteredApps. count
102+
104103 return filteredApps
105104 }
106105}
@@ -216,10 +215,10 @@ struct AppListView: View {
216215
217216 var filteredApps : [ App ] {
218217 if showPatchedOnly {
219- ( isSearching ? searchResults : vm. userApps )
218+ ( isSearching ? searchResults : vm. allApplications )
220219 . filter { $0. isInjected }
221220 } else {
222- isSearching ? searchResults : vm. userApps
221+ isSearching ? searchResults : vm. allApplications
223222 }
224223 }
225224
@@ -366,7 +365,7 @@ struct AppListView: View {
366365 }
367366
368367 func fetchSearchResults( for query: String ) {
369- searchResults = vm. userApps . filter { app in
368+ searchResults = vm. allApplications . filter { app in
370369 app. name. localizedCaseInsensitiveContains ( query) ||
371370 app. id. localizedCaseInsensitiveContains ( query)
372371 }
0 commit comments