Skip to content

feat(downloads): auto-restore downloaded tracks on reinstall + audio permission prompt - #363

Merged
X-MAN-TG merged 2 commits into
Clash-Projects:mainfrom
X-MAN-TG:feat/restore-downloads
Oct 20, 2026
Merged

X-MAN-TG merged 2 commits into
Clash-Projects:mainfrom
X-MAN-TG:feat/restore-downloads

Conversation

@X-MAN-TG

Copy link
Copy Markdown
Contributor

When users reinstall the app or clear data, previously downloaded audio files remain in storage (e.g. Music/LastWave), but the local database entries are lost.

This adds automatic background restoration so users don't lose their offline library:

  • Auto-restore scan: On first launch, scans the download directory for existing audio tracks, reads embedded metadata/tags, and restores them directly into the Room database and downloads UI without re-downloading.
  • Runtime audio permission prompt: Requests READ_MEDIA_AUDIO (API 33+) or READ_EXTERNAL_STORAGE (API <= 32) on first launch chained after notification permission if needed.
  • Live background sync: As soon as permission is granted, runs the scan in the background so tracks appear immediately without restarting the app.
  • Graceful fallback: If denied, it leaves the scan flag unset and doesn't re-prompt in the same session. Manual re-scan is also supported in Downloads settings.
  • Includes unit tests for permission mapping and scan deduplication.

@X-MAN-TG
X-MAN-TG merged commit 5503ba3 into Clash-Projects:main Oct 20, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant