Skip to content

Commit 7a7da9d

Browse files
committed
Added native heic support for Piwigo 14
1 parent 89ee0dc commit 7a7da9d

4 files changed

Lines changed: 14 additions & 8 deletions

File tree

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ if (keystorePropertiesFile.exists()) {
3232
}
3333

3434
android {
35-
compileSdkVersion 33
35+
compileSdkVersion 34
3636

3737
compileOptions {
3838
// Flag to enable support for the new language APIs
@@ -55,7 +55,7 @@ android {
5555
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
5656
applicationId "com.piwigo.piwigo_ng"
5757
minSdkVersion 21
58-
targetSdkVersion 33
58+
targetSdkVersion 34
5959
versionCode flutterVersionCode.toInteger()
6060
versionName flutterVersionName
6161
}

lib/services/preferences_service.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ class Preferences {
6262
static const String isAdminKey = 'IS_USER_ADMIN';
6363
static const String uploadChunkSizeKey = 'UPLOAD_FORM_CHUNK_SIZE';
6464
static const String fileTypesKey = 'FILE_TYPES';
65+
static List<String> get getAvailableFileTypes {
66+
return appPreferences.getString(fileTypesKey)?.split(',') ?? [];
67+
}
6568

6669
// ------------ Settings ------------
6770

lib/utils/image_actions.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,19 @@ Future<List<XFile>?> onPickFiles() async {
107107

108108
Future<List<XFile>?> onPickImages() async {
109109
try {
110-
List<XFile> files = await _picker.pickMultipleMedia(
110+
List<XFile> pickedFiles = await _picker.pickMultipleMedia(
111111
imageQuality: (Preferences.getUploadQuality * 100).round(),
112112
requestFullMetadata: !Preferences.getRemoveMetadata,
113113
);
114-
for (var file in files) {
115-
if (file.name.endsWith('.heic')) {
114+
List<XFile> files = [];
115+
for (var file in pickedFiles) {
116+
if (Preferences.getAvailableFileTypes
117+
.contains(file.name.split('.').last)) {
118+
files.add(file);
119+
} else if (file.name.endsWith('.heic')) {
116120
String? jpgPath = await HeicToJpg.convert(file.path);
117121
if (jpgPath != null) {
118-
files[files.indexWhere((f) => f == file)] = XFile(jpgPath);
122+
files.add(XFile(jpgPath));
119123
}
120124
}
121125
}

lib/views/settings/settings_page.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,7 @@ class _SettingsPageState extends State<SettingsPage> {
230230
],
231231
);
232232
Widget get _supportedFilesSection {
233-
String fileTypes =
234-
appPreferences.getString('FILE_TYPES')?.replaceAll(',', ', ') ?? '';
233+
String fileTypes = Preferences.getAvailableFileTypes.join(', ') ?? '';
235234
return SettingsSection(
236235
color: Colors.transparent,
237236
children: [

0 commit comments

Comments
 (0)