Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/android/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pluginManagement {

plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.11.1" apply false
id("com.android.application") version "8.12.1" apply false
id("org.jetbrains.kotlin.android") version "2.2.20" apply false
}

Expand Down
65 changes: 11 additions & 54 deletions app/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,38 +1,7 @@
PODS:
- DKImagePickerController/Core (4.3.9):
- DKImagePickerController/ImageDataManager
- DKImagePickerController/Resource
- DKImagePickerController/ImageDataManager (4.3.9)
- DKImagePickerController/PhotoGallery (4.3.9):
- DKImagePickerController/Core
- DKPhotoGallery
- DKImagePickerController/Resource (4.3.9)
- DKPhotoGallery (0.0.19):
- DKPhotoGallery/Core (= 0.0.19)
- DKPhotoGallery/Model (= 0.0.19)
- DKPhotoGallery/Preview (= 0.0.19)
- DKPhotoGallery/Resource (= 0.0.19)
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Core (0.0.19):
- DKPhotoGallery/Model
- DKPhotoGallery/Preview
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Model (0.0.19):
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Preview (0.0.19):
- DKPhotoGallery/Model
- DKPhotoGallery/Resource
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Resource (0.0.19):
- SDWebImage
- SwiftyGif
- file_picker (0.0.1):
- DKImagePickerController/PhotoGallery
- file_picker_darwin (1.0.0):
- Flutter
- FlutterMacOS
- Flutter (1.0.0)
- flutter_secure_storage_darwin (10.0.0):
- Flutter
Expand All @@ -48,19 +17,15 @@ PODS:
- FlutterMacOS
- package_info_plus (0.4.5):
- Flutter
- pdfium_flutter (0.1.5):
- pdfium_flutter (0.4.1):
- Flutter
- FlutterMacOS
- SDWebImage (5.21.7):
- SDWebImage/Core (= 5.21.7)
- SDWebImage/Core (5.21.7)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite_darwin (0.0.4):
- Flutter
- FlutterMacOS
- SwiftyGif (5.4.5)
- unrar_file (0.0.1):
- Flutter
- UnrarKit
Expand All @@ -71,7 +36,7 @@ PODS:
- Flutter

DEPENDENCIES:
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- file_picker_darwin (from `.symlinks/plugins/file_picker_darwin/darwin`)
- Flutter (from `Flutter`)
- flutter_secure_storage_darwin (from `.symlinks/plugins/flutter_secure_storage_darwin/darwin`)
- flutter_timezone (from `.symlinks/plugins/flutter_timezone/ios`)
Expand All @@ -87,15 +52,11 @@ DEPENDENCIES:

SPEC REPOS:
trunk:
- DKImagePickerController
- DKPhotoGallery
- SDWebImage
- SwiftyGif
- UnrarKit

EXTERNAL SOURCES:
file_picker:
:path: ".symlinks/plugins/file_picker/ios"
file_picker_darwin:
:path: ".symlinks/plugins/file_picker_darwin/darwin"
Flutter:
:path: Flutter
flutter_secure_storage_darwin:
Expand All @@ -122,21 +83,17 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/url_launcher_ios/ios"

SPEC CHECKSUMS:
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
file_picker: a0560bc09d61de87f12d246fc47d2119e6ef37be
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
flutter_secure_storage_darwin: acdb3f316ed05a3e68f856e0353b133eec373a23
file_picker_darwin: 4c2b9a50ea44cb3b071381ea0cf48591bdd80251
Flutter: 71a624a5bc0c04062bf19101d501e466baf2fb47
flutter_secure_storage_darwin: 46e401699982ee74142909676535e0f6a7321e58
flutter_timezone: 7c838e17ffd4645d261e87037e5bebf6d38fe544
flutter_web_auth_2: 646fc9df97a01c59e5eea99b237da2c6360f8439
integration_test: 4a889634ef21a45d28d50d622cf412dc6d9f586e
mobile_scanner: 9157936403f5a0644ca3779a38ff8404c5434a93
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
pdfium_flutter: e5a6e881af0b182d5b0465ebad23a8a20caa28d4
SDWebImage: e9fc87c1aab89a8ab1bbd74eba378c6f53be8abf
shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb
pdfium_flutter: 40fe1ba3e38784900c4e1dfc5b2bb391beb7b1e6
shared_preferences_foundation: a7c3904f2dedb3701dd1903cb152ef5e7df92422
sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
unrar_file: f681dc2c7ea839fe0e7eccbd08d009d801e171cb
UnrarKit: 62f535c7a34ec52d2514b9b148f33dcfa9a9dc39
url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b
Expand Down
2 changes: 1 addition & 1 deletion app/lib/folders/directory_access_native.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class NativeDirectoryAccess implements DirectoryAccess {
return selected == null ? null : FolderGrant.fromJson(Map<String, dynamic>.from(selected));
}

final selected = await FilePicker.platform.getDirectoryPath(dialogTitle: 'Choose a book folder');
final selected = await FilePicker.getDirectoryPath(dialogTitle: 'Choose a book folder');

if (selected == null) {
return null;
Expand Down
15 changes: 4 additions & 11 deletions app/lib/services/book_download_service_platform_io.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'dart:io';
import 'dart:typed_data';

import 'package:file_picker/file_picker.dart';
Expand All @@ -8,21 +7,15 @@ Future<String?> saveBookFileToDevice({
required String fileName,
required String extension,
}) async {
final path = await FilePicker.platform.saveFile(
final uri = await FilePicker.saveFile(
dialogTitle: 'Download book',
fileName: fileName,
type: FileType.custom,
allowedExtensions: [extension],
bytes: Platform.isAndroid || Platform.isIOS ? bytes : null,
bytes: bytes,
);

if (path == null) {
if (uri == null) {
return null;
}

if (!Platform.isAndroid && !Platform.isIOS) {
await File(path).writeAsBytes(bytes);
}

return path;
return uri.scheme == 'file' ? uri.toFilePath() : uri.toString();
}
35 changes: 11 additions & 24 deletions app/lib/services/support_attachment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,51 +36,38 @@ class SupportAttachment {
}

static Future<List<SupportAttachment>> pick(int remaining) async {
final result = await FilePicker.platform.pickFiles(
final result = await FilePicker.pickFiles(
type: FileType.custom,
allowedExtensions: mediaTypes.keys.toList(),
allowMultiple: true,
allowCompression: false,
withData: false,
withReadStream: true,
);

if (result == null) {
return [];
}

if (result.files.length > remaining) {
if (result.length > remaining) {
throw const FormatException('Attach up to five files.');
}

final attachments = <SupportAttachment>[];

for (final file in result.files) {
for (final file in result) {
final contentType = mediaTypes[file.extension?.toLowerCase()];

if (contentType == null) {
throw const FormatException('Choose a PNG, JPG, GIF, WebP, MP4, MOV, or WebM file.');
}

if (file.size <= 0 || file.size > maxBytes) {
final size = file.lengthSync();

if (size != null && (size <= 0 || size > maxBytes)) {
throw const FormatException('Each attachment must be no larger than 10 MB and cannot be empty.');
}

final builder = BytesBuilder(copy: false);
final stream = file.readStream;

if (stream != null) {
await for (final chunk in stream) {
if (builder.length + chunk.length > maxBytes) {
throw const FormatException('Each attachment must be no larger than 10 MB.');
}

builder.add(chunk);
await for (final chunk in file.readAsByteStream()) {
if (builder.length + chunk.length > maxBytes) {
throw const FormatException('Each attachment must be no larger than 10 MB.');
}
} else if (file.bytes != null) {
builder.add(file.bytes!);
} else {
throw const FormatException('Could not read the selected file.');

builder.add(chunk);
}

if (builder.isEmpty || builder.length > maxBytes) {
Expand Down
12 changes: 6 additions & 6 deletions app/lib/widgets/add_book/book_import_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ class BookImportSheet extends StatefulWidget {
final ScrollController? scrollController;

static Future<List<SelectedBookFile>> defaultPickFiles() async {
final result = await FilePicker.platform.pickFiles(
final result = await FilePicker.pickFiles(
type: FileType.custom,
allowedExtensions: kIsWeb ? bookImportWebExtensions : bookImportNativeExtensions,
allowMultiple: true,
withData: true,
);

if (result == null) {
return const [];
final files = <SelectedBookFile>[];

for (final file in result) {
files.add(SelectedBookFile(name: file.name, bytes: await file.readAsBytes()));
}

return result.files.map((file) => SelectedBookFile(name: file.name, bytes: file.bytes)).toList();
return files;
}

/// Opens the import flow as a root-level modal bottom sheet.
Expand Down
63 changes: 36 additions & 27 deletions app/lib/widgets/book_edit/cover_image_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -314,36 +314,45 @@ class _CoverImagePickerState extends State<CoverImagePicker> {
});

try {
final result = await FilePicker.platform.pickFiles(type: FileType.image, allowMultiple: false, withData: true);

if (result != null && result.files.isNotEmpty) {
final file = result.files.first;

if (file.bytes != null) {
// Check file size (max 5MB)
if (file.bytes!.length > 5 * 1024 * 1024) {
setState(() {
_error = 'Image must be less than 5MB';
_isLoading = false;
});

return;
}

setState(() {
_imageBytes = file.bytes;
_imageUrl = null;
_showUrlInput = false;
_isLoading = false;
});

widget.onFileChanged(file.bytes);
widget.onUrlChanged(null);
final file = await FilePicker.pickFile(type: FileType.image);

if (file == null) {
if (mounted) {
setState(() => _isLoading = false);
}
} else {
setState(() => _isLoading = false);

return;
}

final bytes = await file.readAsBytes();

if (!mounted) {
return;
}

if (bytes.length > 5 * 1024 * 1024) {
setState(() {
_error = 'Image must be less than 5MB';
_isLoading = false;
});

return;
}

setState(() {
_imageBytes = bytes;
_imageUrl = null;
_showUrlInput = false;
_isLoading = false;
});

widget.onFileChanged(bytes);
widget.onUrlChanged(null);
} catch (error) {
if (!mounted) {
return;
}

setState(() {
_error = 'Failed to pick image';
_isLoading = false;
Expand Down
18 changes: 9 additions & 9 deletions app/lib/widgets/profile/account_profile_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -198,28 +198,28 @@ class _AccountProfileFormState extends State<AccountProfileForm> {
});

try {
final result = await FilePicker.platform.pickFiles(
final file = await FilePicker.pickFile(
type: FileType.custom,
allowedExtensions: ['jpg', 'jpeg', 'png'],
allowMultiple: false,
withData: true,
);

if (result == null || !mounted) {
if (file == null || !mounted) {
return;
}

final file = result.files.single;
final size = file.lengthSync();

if (file.size > maxProfilePhotoBytes) {
if (size != null && size > maxProfilePhotoBytes) {
throw const FormatException('Choose a photo smaller than 5 MB.');
}

if (file.bytes == null) {
throw const FormatException('This photo could not be opened. Choose another image.');
final contents = await file.readAsBytes();

if (contents.length > maxProfilePhotoBytes) {
throw const FormatException('Choose a photo smaller than 5 MB.');
}

final bytes = await compute(prepareProfilePhoto, file.bytes!);
final bytes = await compute(prepareProfilePhoto, contents);

if (mounted) {
setState(() => _photoBytes = bytes);
Expand Down
4 changes: 2 additions & 2 deletions app/lib/widgets/statistics/reading_charts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class ReadingActivityBarChart extends StatelessWidget {
enabled: true,
touchTooltipData: BarTouchTooltipData(
getTooltipColor: (group) => colorScheme.inverseSurface,
tooltipRoundedRadius: AppRadius.md,
tooltipBorderRadius: BorderRadius.circular(AppRadius.md),
getTooltipItem: (group, groupIndex, rod, rodIndex) {
final activity = activities[groupIndex];

Expand Down Expand Up @@ -372,7 +372,7 @@ class BooksPerMonthChart extends StatelessWidget {
enabled: true,
touchTooltipData: BarTouchTooltipData(
getTooltipColor: (group) => colorScheme.inverseSurface,
tooltipRoundedRadius: AppRadius.md,
tooltipBorderRadius: BorderRadius.circular(AppRadius.md),
getTooltipItem: (group, groupIndex, rod, rodIndex) {
final stats = displayStats[groupIndex];

Expand Down
1 change: 1 addition & 0 deletions app/linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
jni
)

set(PLUGIN_BUNDLED_LIBRARIES)
Expand Down
2 changes: 1 addition & 1 deletion app/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Foundation

import desktop_drop
import desktop_webview_window
import file_picker
import file_picker_darwin
import flutter_secure_storage_darwin
import flutter_timezone
import flutter_web_auth_2
Expand Down
Loading
Loading