attachment download WIP
This commit is contained in:
		
							parent
							
								
									04a871a293
								
							
						
					
					
						commit
						8eeb0b013d
					
				
					 4 changed files with 29 additions and 15 deletions
				
			
		
							
								
								
									
										7
									
								
								lib/attachamentDownloadStub.dart
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								lib/attachamentDownloadStub.dart
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
import 'structs.dart';
 | 
			
		||||
 | 
			
		||||
class Attachmentdownload {
 | 
			
		||||
  Future<void> saveFile(AttachmentResponse attachment) async {
 | 
			
		||||
    print("stub attachment download");
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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<void> 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';
 | 
			
		||||
							
								
								
									
										7
									
								
								lib/attachmentDownloadAndroid.dart
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								lib/attachmentDownloadAndroid.dart
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
import 'structs.dart';
 | 
			
		||||
 | 
			
		||||
class Attachmentdownload {
 | 
			
		||||
  Future<void> saveFile(AttachmentResponse attachment) async {
 | 
			
		||||
    print("android attachment download");
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										12
									
								
								lib/attachmentDownloadWeb.dart
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								lib/attachmentDownloadWeb.dart
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
// import 'structs.dart';
 | 
			
		||||
// import 'package:file_saver/file_saver.dart';
 | 
			
		||||
 | 
			
		||||
// class Attachmentdownload {
 | 
			
		||||
//   Future<void> 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)
 | 
			
		||||
//     );
 | 
			
		||||
//   }
 | 
			
		||||
// }
 | 
			
		||||
		Loading…
	
	Add table
		
		Reference in a new issue