Skip to content

Commit 934a727

Browse files
committed
Fixed auto upload frequency bug
1 parent 2102dcf commit 934a727

3 files changed

Lines changed: 15 additions & 11 deletions

File tree

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ subprojects {
2424
project.evaluationDependsOn(':app')
2525
}
2626

27-
task clean(type: Delete) {
27+
tasks.register("clean", Delete) {
2828
delete rootProject.buildDir
2929
}

lib/services/preferences_service.dart

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dart:convert';
22

3+
import 'package:flutter/material.dart';
34
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
45
import 'package:piwigo_ng/models/album_model.dart';
56
import 'package:piwigo_ng/models/status_model.dart';
@@ -246,13 +247,17 @@ class AutoUploadPreferences {
246247
static const String destinationKey = 'AUTO_UPLOAD_DESTINATION';
247248

248249
static AlbumModel? get getDestination {
249-
String? albumJson = appPreferences.getString(destinationKey);
250-
if (albumJson == null) return null;
251-
return AlbumModel.fromJson(json.decode(albumJson));
250+
try {
251+
String? albumJson = appPreferences.getString(destinationKey);
252+
if (albumJson == null) return null;
253+
return AlbumModel.fromJson(json.decode(albumJson));
254+
} on Error catch (e) {
255+
debugPrint("$e\n${e.stackTrace}");
256+
return null;
257+
}
252258
}
253259

254260
static Future<bool> setDestination(AlbumModel album) async {
255-
print(json.encode(album.toJson()));
256261
return appPreferences.setString(
257262
destinationKey, json.encode(album.toJson()));
258263
}
@@ -266,7 +271,7 @@ class AutoUploadPreferences {
266271
}
267272

268273
static Future<bool> setFrequency(Duration duration) async {
269-
return appPreferences.setInt(destinationKey, duration.inHours);
274+
return appPreferences.setInt(frequencyKey, duration.inHours);
270275
}
271276

272277
static const String notificationKey = 'AUTO_UPLOAD_NOTIFICATION';

pubspec.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ dependencies:
3232
flutter_speed_dial: ^6.1.0+1 # Speed dial
3333
pull_to_refresh: ^2.0.0 # Top and bottom refresh gestures
3434
photo_view: ^0.14.0 # Zoom on fullscreen photos
35-
extended_text: ^10.0.1 # Text overflow on left side
35+
extended_text: ^11.0.0 # Text overflow on left side
3636

3737
# Storage
38-
package_info_plus: ^1.4.2 # Get project info (version)
38+
package_info_plus: ^3.1.2 # Get project info (version)
3939
path_provider: ^2.0.11 # Get application documents
4040
shared_preferences: ^2.0.15 # Base local storage
4141
flutter_secure_storage: ^6.0.0 # Local storage secured for logins
@@ -52,17 +52,16 @@ dependencies:
5252
# Utils
5353
mime_type: ^1.0.0 # Check mime type of files (differentiate photos from videos)
5454
video_player: ^2.4.7 # Read video files in fullscreen mode
55-
chewie: ^1.4.0 # Video player with options
55+
chewie: ^1.5.0 # Video player with options
5656
flutter_image_compress: ^1.1.3 # Remove metadata
5757
permission_handler: ^10.2.0 # Check and asks for permissions
5858
share_plus: ^4.4.0 # Share files
5959
flutter_cache_manager: ^3.3.0 # Handles network image cache
60-
heic_to_jpg: ^0.1.3 # Converts heic files to jpg
6160

6261
# Translations
6362
flutter_localizations:
6463
sdk: flutter
65-
intl: ^0.17.0 # Used for translations
64+
intl: ^0.18.0 # Used for translations
6665
html_unescape: ^2.0.0
6766

6867
dev_dependencies:

0 commit comments

Comments
 (0)