Removed the IOS guard for the Download feature.

Enabled the UISupportsDocumentBrowser IOS option so that the App Documents are visible for other apps.
This commit is contained in:
Iulian Ciorascu
2023-02-11 00:55:23 +01:00
parent d7cbe40395
commit f504c4908c
2 changed files with 10 additions and 9 deletions

View File

@@ -67,5 +67,7 @@
<true/> <true/>
<key>UIApplicationSupportsIndirectInputEvents</key> <key>UIApplicationSupportsIndirectInputEvents</key>
<true/> <true/>
<key>UISupportsDocumentBrowser</key>
<true/>
</dict> </dict>
</plist> </plist>

View File

@@ -37,20 +37,19 @@ class _DocumentDownloadButtonState extends State<DocumentDownloadButton> {
width: 16, width: 16,
) )
: const Icon(Icons.download), : const Icon(Icons.download),
onPressed: Platform.isAndroid && widget.document != null && widget.enabled onPressed: widget.document != null && widget.enabled
? () => _onDownload(widget.document!) ? () => _onDownload(widget.document!)
: null, : null,
).paddedOnly(right: 4); ).paddedOnly(right: 4);
} }
Future<void> _onDownload(DocumentModel document) async { Future<void> _onDownload(DocumentModel document) async {
if (!Platform.isAndroid) { // if (!Platform.isAndroid) {
showSnackBar( // showSnackBar(
context, "This feature is currently only supported on Android!"); // context, "This feature is currently only supported on Android!");
return; // return;
} // }
if (true) { if (Platform.isAndroid && androidInfo!.version.sdkInt! < 30) {
// should check for android versions < 30
final isGranted = await askForPermission(Permission.storage); final isGranted = await askForPermission(Permission.storage);
if (!isGranted) { if (!isGranted) {
return; return;