mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-10-08 00:51:07 +02:00
feat(library): pause and resume library scans
The scan progress tile offers Pause and Resume. A paused scan releases its foreground service and wake lock, shows a paused notice, and resumes from the next unscanned file.
This commit is contained in:
1 parent
fe36f08918
commit
50f21d9c82
7 files changed
+356
-18
No files matched your search
@@ -539,6 +539,25 @@ class NotificationService {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> showLibraryScanPaused({required int scannedFiles}) async {
|
||||
if (!_isInitialized) await initialize();
|
||||
|
||||
await _showSafely(
|
||||
id: libraryScanId,
|
||||
title: _l10n?.notifLibraryScanPaused ?? 'Library scan paused',
|
||||
body:
|
||||
_l10n?.notifLibraryScanPausedBody(scannedFiles) ??
|
||||
'$scannedFiles files scanned. Resume in Local Library settings to '
|
||||
'continue from here.',
|
||||
details: _details(library: true),
|
||||
);
|
||||
}
|
||||
|
||||
/// Clears a paused-scan notice once the foreground service shows progress.
|
||||
Future<void> cancelLibraryScanNotification() async {
|
||||
await _notifications.cancel(id: libraryScanId);
|
||||
}
|
||||
|
||||
Future<void> showUpdateDownloadProgress({
|
||||
required String version,
|
||||
required int received,
|
||||
|
||||
@@ -2346,6 +2346,15 @@ class PlatformBridge {
|
||||
await _channel.invokeMethod('cancelLibraryScan');
|
||||
}
|
||||
|
||||
/// Holds the running native scan at its next file; it keeps its position.
|
||||
static Future<void> pauseLibraryScan() async {
|
||||
await _channel.invokeMethod('pauseLibraryScan');
|
||||
}
|
||||
|
||||
static Future<void> resumeLibraryScan() async {
|
||||
await _channel.invokeMethod('resumeLibraryScan');
|
||||
}
|
||||
|
||||
static Object? _decodeJsonResult(dynamic result) {
|
||||
if (result is String) {
|
||||
if (result.isEmpty) return null;
|
||||
|
||||
Reference in new issue
Block a user