feat: background download service + queue persistence (v1.6.1)

- Add foreground service for background downloads with wake lock
- Persist download queue to SharedPreferences for app restart recovery
- Fix share intent causing app restart (singleTask + onNewIntent)
- Fix back button clearing state during loading
- Upgrade Kotlin to 2.3.0 for share_plus 12.0.1 compatibility
- Add WAKE_LOCK permission for foreground service
This commit is contained in:
zarzet committed 2026-01-02 18:14:19 +07:00
1 parent 39ddb7a14f
commit 2043370b6c
13 files changed
+311 -49

No files matched your search

+8 -2
View File
@@ -150,8 +150,9 @@ class _MainShellState extends ConsumerState<MainShell> {
return;
}
// If on Search tab and has text in search bar or has content, clear it
if (_currentIndex == 0 && (trackState.hasSearchText || trackState.hasContent || trackState.isLoading)) {
// If on Search tab and has text in search bar or has content (but not loading), clear it
// Don't clear while loading - this prevents clearing during share intent processing
if (_currentIndex == 0 && !trackState.isLoading && (trackState.hasSearchText || trackState.hasContent)) {
ref.read(trackProvider.notifier).clear();
return;
}
@@ -162,6 +163,11 @@ class _MainShellState extends ConsumerState<MainShell> {
return;
}
// If loading, ignore back press
if (trackState.isLoading) {
return;
}
// Already at root, show exit dialog
final shouldPop = await _showExitDialog();
if (shouldPop && context.mounted) {
+5 -3
View File
@@ -938,9 +938,11 @@ class _TrackMetadataScreenState extends ConsumerState<TrackMetadataScreen> {
return;
}
await Share.shareXFiles(
[XFile(item.filePath)],
text: '${item.trackName} - ${item.artistName}',
await SharePlus.instance.share(
ShareParams(
files: [XFile(item.filePath)],
text: '${item.trackName} - ${item.artistName}',
),
);
}