Skip to content

Commit ccafe0b

Browse files
refactor: Add comments to app filtering logic in MainViewModel
This commit adds comments to the app filtering logic within `MainViewModel` to improve code clarity. The new comments explain the purpose of three specific checks: - Skipping the launcher's own package. - Preventing duplicate app entries. - Filtering apps based on whether they are hidden or regular, according to user-defined settings.
1 parent 03286a3 commit ccafe0b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/src/main/java/com/github/droidworksstudio/mlauncher/MainViewModel.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,14 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
582582
.mapNotNull { info ->
583583
val pkg = info.applicationInfo.packageName
584584
val cls = info.componentName.className
585+
586+
// Skip your own app
585587
if (pkg == BuildConfig.APPLICATION_ID) return@mapNotNull null
588+
586589
val key = appKey(pkg, cls, profile.hashCode())
587590
if (!seenAppKeys.add(key)) return@mapNotNull null
591+
592+
// Skip hidden / regular apps based on toggles
588593
if ((isHidden(pkg, key) && !includeHiddenApps) || (!isHidden(pkg, key) && !includeRegularApps))
589594
return@mapNotNull null
590595

0 commit comments

Comments
 (0)