From 8eeb0b013d4af27977ca1a01c1a4d7eef0a8a22b Mon Sep 17 00:00:00 2001 From: juan Date: Fri, 23 May 2025 16:13:17 -0400 Subject: [PATCH] attachment download WIP --- lib/attachamentDownloadStub.dart | 7 +++++++ lib/attachmentDownload.dart | 18 +++--------------- lib/attachmentDownloadAndroid.dart | 7 +++++++ lib/attachmentDownloadWeb.dart | 12 ++++++++++++ 4 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 lib/attachamentDownloadStub.dart create mode 100644 lib/attachmentDownloadAndroid.dart create mode 100644 lib/attachmentDownloadWeb.dart diff --git a/lib/attachamentDownloadStub.dart b/lib/attachamentDownloadStub.dart new file mode 100644 index 0000000..5daf854 --- /dev/null +++ b/lib/attachamentDownloadStub.dart @@ -0,0 +1,7 @@ +import 'structs.dart'; + +class Attachmentdownload { + Future saveFile(AttachmentResponse attachment) async { + print("stub attachment download"); + } +} diff --git a/lib/attachmentDownload.dart b/lib/attachmentDownload.dart index 63364ba..f1f8f86 100644 --- a/lib/attachmentDownload.dart +++ b/lib/attachmentDownload.dart @@ -1,15 +1,3 @@ -import 'dart:html' as html; -import 'package:web/web.dart' as web; -import 'dart:io'; -import 'structs.dart'; -import 'package:file_saver/file_saver.dart'; - -class Attachmentdownload { - Future saveFile(AttachmentResponse attachment) async { - await FileSaver.instance.saveFile( - name: attachment.name.toString().substring(0, attachment.name.toString().lastIndexOf('.')), - bytes: attachment.data, - ext: attachment.name.toString().substring(attachment.name.toString().lastIndexOf('.')+1) - ); - } -} +export 'attachamentDownloadStub.dart' + if (dart.library.io) 'attachmentDownloadAndroid.dart'; + // if (dart.library.js_interop) 'attachmentDownloadWeb.dart'; \ No newline at end of file diff --git a/lib/attachmentDownloadAndroid.dart b/lib/attachmentDownloadAndroid.dart new file mode 100644 index 0000000..603253c --- /dev/null +++ b/lib/attachmentDownloadAndroid.dart @@ -0,0 +1,7 @@ +import 'structs.dart'; + +class Attachmentdownload { + Future saveFile(AttachmentResponse attachment) async { + print("android attachment download"); + } +} diff --git a/lib/attachmentDownloadWeb.dart b/lib/attachmentDownloadWeb.dart new file mode 100644 index 0000000..cb4954c --- /dev/null +++ b/lib/attachmentDownloadWeb.dart @@ -0,0 +1,12 @@ +// import 'structs.dart'; +// import 'package:file_saver/file_saver.dart'; + +// class Attachmentdownload { +// Future saveFile(AttachmentResponse attachment) async { +// await FileSaver.instance.saveFile( +// name: attachment.name.toString().substring(0, attachment.name.toString().lastIndexOf('.')), +// bytes: attachment.data, +// ext: attachment.name.toString().substring(attachment.name.toString().lastIndexOf('.')+1) +// ); +// } +// }