Skip to content

Fix allowed directory handling and add smart view#490

Merged
theovilardo merged 9 commits intomasterfrom
codex/fix-allowed-directories-functionality
Dec 11, 2025
Merged

Fix allowed directory handling and add smart view#490
theovilardo merged 9 commits intomasterfrom
codex/fix-allowed-directories-functionality

Conversation

@theovilardo
Copy link
Copy Markdown
Owner

Summary

  • reorder setup flow so storage permissions are granted before folder selection
  • add Smart View toggle and hierarchical allowed-directory handling in the folder picker
  • enforce allowed-directory filtering across the library and default to the Music folder only

Testing

  • ./gradlew :app:testDebugUnitTest --console=plain (fails: Android SDK not available in environment)

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 101 to +107
val allowedDirs = userPreferencesRepository.allowedDirectoriesFlow.first()
if (allowedDirs.isEmpty()) {
val allAudioDirs = musicRepository.getAllUniqueAudioDirectories().toSet()
userPreferencesRepository.updateAllowedDirectories(allAudioDirs)
val musicDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC)
val defaultAllowed = if (musicDir.exists()) {
runCatching { musicDir.canonicalPath }.getOrDefault(musicDir.absolutePath)
} else null
userPreferencesRepository.updateAllowedDirectories(defaultAllowed?.let { setOf(it) } ?: emptySet())
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Defaulting to empty allowed dirs bricks library when Music folder absent

If the device doesn’t have a DIRECTORY_MUSIC folder (common when music lives on SD cards or custom storage), loadMusicDirectories sets the allowed directory set to emptySet() (lines 101‑107). Because MusicRepositoryImpl.filterAllowed now always drops all songs whenever the allowed set is empty (lines 107‑115 in that file), completing setup after skipping folder selection leaves the library permanently empty even though audio files exist elsewhere. There’s no fallback to the previously detected audio folders (the old auto-populate was removed), so users without a Music folder must manually dig into settings to add directories or the app shows no content.

Useful? React with 👍 / 👎.

@theovilardo theovilardo merged commit d66c1d1 into master Dec 11, 2025
@lostf1sh lostf1sh deleted the codex/fix-allowed-directories-functionality branch January 16, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant