diff --git a/lib/main.dart b/lib/main.dart index fb084e3c..6bfb8d67 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -118,7 +118,7 @@ class _MyAppState extends ConsumerState { routerDelegate: router.routerDelegate, routeInformationProvider: router.routeInformationProvider, title: 'MangaYomi', - scrollBehavior: AllowDesktopScrollBehavior(), + scrollBehavior: AllowScrollBehavior(), ); } @@ -233,10 +233,21 @@ class _MyAppState extends ConsumerState { } } -class AllowDesktopScrollBehavior extends MaterialScrollBehavior { +class AllowScrollBehavior extends MaterialScrollBehavior { + // This allows the scrollable widgets to be scrolled with touch, mouse, stylus, + // inverted stylus, trackpad, and unknown pointer devices. + // This is useful for accessibility purposes, such as when using VoiceAccess, + // which sends pointer events with unknown type when scrolling scrollables. + // This is also useful for desktop platforms, where touch, stylus, and trackpad + // interactions are common, and we want to ensure a consistent scrolling experience + // across all devices. @override Set get dragDevices => { PointerDeviceKind.touch, PointerDeviceKind.mouse, + PointerDeviceKind.stylus, + PointerDeviceKind.invertedStylus, + PointerDeviceKind.trackpad, + PointerDeviceKind.unknown, }; } diff --git a/lib/modules/more/data_and_storage/providers/restore.dart b/lib/modules/more/data_and_storage/providers/restore.dart index 4978c514..e18da597 100644 --- a/lib/modules/more/data_and_storage/providers/restore.dart +++ b/lib/modules/more/data_and_storage/providers/restore.dart @@ -63,6 +63,8 @@ void doRestore(Ref ref, {required String path, required BuildContext context}) { } } catch (e, s) { botToast('$e\n$s'); + } finally { + inputStream.close(); } } @@ -380,13 +382,10 @@ void restoreKotatsuBackup(Ref ref, Archive archive) { @riverpod void restoreTachiBkBackup(Ref ref, String path, BackupType bkType) { - final content = GZipDecoder().decodeBytes( - InputFileStream(path).toUint8List(), - ); - final backup = BackupMihon.create(); - backup.mergeFromCodedBufferReader( - CodedBufferReader(content, sizeLimit: 250 << 20), - ); + final inputStream = InputFileStream(path); + final content = GZipDecoder().decodeBytes(inputStream.toUint8List()); + inputStream.close(); + final backup = BackupMihon.fromBuffer(content); List cats = []; isar.writeTxnSync(() { isar.categorys.clearSync();