From f504c4908c52ad2224c2f099d0034b400354a636 Mon Sep 17 00:00:00 2001 From: Iulian Ciorascu Date: Sat, 11 Feb 2023 00:55:23 +0100 Subject: [PATCH] Removed the IOS guard for the Download feature. Enabled the UISupportsDocumentBrowser IOS option so that the App Documents are visible for other apps. --- ios/Runner/Info.plist | 4 +++- .../view/widgets/document_download_button.dart | 15 +++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index a837d1a..367aa2e 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -66,6 +66,8 @@ CADisableMinimumFrameDurationOnPhone UIApplicationSupportsIndirectInputEvents - + + UISupportsDocumentBrowser + diff --git a/lib/features/document_details/view/widgets/document_download_button.dart b/lib/features/document_details/view/widgets/document_download_button.dart index 0e6845d..498d390 100644 --- a/lib/features/document_details/view/widgets/document_download_button.dart +++ b/lib/features/document_details/view/widgets/document_download_button.dart @@ -37,20 +37,19 @@ class _DocumentDownloadButtonState extends State { width: 16, ) : const Icon(Icons.download), - onPressed: Platform.isAndroid && widget.document != null && widget.enabled + onPressed: widget.document != null && widget.enabled ? () => _onDownload(widget.document!) : null, ).paddedOnly(right: 4); } Future _onDownload(DocumentModel document) async { - if (!Platform.isAndroid) { - showSnackBar( - context, "This feature is currently only supported on Android!"); - return; - } - if (true) { - // should check for android versions < 30 + // if (!Platform.isAndroid) { + // showSnackBar( + // context, "This feature is currently only supported on Android!"); + // return; + // } + if (Platform.isAndroid && androidInfo!.version.sdkInt! < 30) { final isGranted = await askForPermission(Permission.storage); if (!isGranted) { return;