v2.1.5: Fix progress bar and incomplete downloads

- Fix progress bar jumping from 1% to 100% (threshold-based updates)
- Fix incomplete downloads with temp file + size validation
- Applies to Tidal, Qobuz, and Amazon services
This commit is contained in:
zarzet committed 2026-01-07 23:15:48 +07:00
1 parent d4274e8ca8
commit 53a1da6249
8 files changed
+211 -56

No files matched your search

+2 -2
View File
@@ -1,8 +1,8 @@
/// App version and info constants
/// Update version here only - all other files will reference this
class AppInfo {
static const String version = '2.1.5-preview';
static const String buildNumber = '42';
static const String version = '2.1.5';
static const String buildNumber = '43';
static const String fullVersion = '$version+$buildNumber';
+23
View File
@@ -5,6 +5,8 @@ import 'package:spotiflac_android/models/settings.dart';
import 'package:spotiflac_android/services/platform_bridge.dart';
const _settingsKey = 'app_settings';
const _migrationVersionKey = 'settings_migration_version';
const _currentMigrationVersion = 1; // Increment this when adding new migrations
class SettingsNotifier extends Notifier<AppSettings> {
@override
@@ -18,11 +20,32 @@ class SettingsNotifier extends Notifier<AppSettings> {
final json = prefs.getString(_settingsKey);
if (json != null) {
state = AppSettings.fromJson(jsonDecode(json));
// Run migrations if needed
await _runMigrations(prefs);
// Apply Spotify credentials to Go backend on load
_applySpotifyCredentials();
}
}
/// Run one-time migrations for settings
Future<void> _runMigrations(SharedPreferences prefs) async {
final lastMigration = prefs.getInt(_migrationVersionKey) ?? 0;
if (lastMigration < 1) {
// Migration 1: Set metadataSource to 'deezer' for existing users
// This ensures users updating from older versions get Deezer as default
state = state.copyWith(metadataSource: 'deezer');
await _saveSettings();
}
// Save current migration version
if (lastMigration < _currentMigrationVersion) {
await prefs.setInt(_migrationVersionKey, _currentMigrationVersion);
}
}
Future<void> _saveSettings() async {
final prefs = await SharedPreferences.getInstance();
await prefs.setString(_settingsKey, jsonEncode(state.toJson()));