folders actions #5
					 1 changed files with 28 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -122,8 +122,8 @@ class ApiService {
 | 
			
		|||
        if (response.statusCode == 200) {
 | 
			
		||||
          content += response.body;
 | 
			
		||||
          try {
 | 
			
		||||
            List<AttachmentInfo> attachments = await getAttachmentsInfo(
 | 
			
		||||
                emailFolder, id);
 | 
			
		||||
            List<AttachmentInfo> attachments =
 | 
			
		||||
                await getAttachmentsInfo(emailFolder, id);
 | 
			
		||||
            for (var attachment in attachments) {
 | 
			
		||||
              //TODO: for each attachment creaate at the bottom a widget for each individual one
 | 
			
		||||
              threadAttachments
 | 
			
		||||
| 
						 | 
				
			
			@ -164,6 +164,31 @@ class ApiService {
 | 
			
		|||
 | 
			
		||||
    Map<String, String> requestBody = {'name': folderName};
 | 
			
		||||
 | 
			
		||||
    try {
 | 
			
		||||
      var response = await http.post(
 | 
			
		||||
        url,
 | 
			
		||||
        headers: {
 | 
			
		||||
          'Content-Type': 'application/json',
 | 
			
		||||
        },
 | 
			
		||||
        body: jsonEncode(requestBody),
 | 
			
		||||
      );
 | 
			
		||||
      if (response.statusCode == 200) {
 | 
			
		||||
        print('response body: ${response.body}');
 | 
			
		||||
      } else {
 | 
			
		||||
        print('Error: ${response.statusCode}, response body: ${response.body}');
 | 
			
		||||
      } 
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      print('error making post req: $e');
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Future<void> renameFolder(String oldFolder, String newFolder) async {
 | 
			
		||||
    var url = Uri.http('$ip:$port', 'rename_folder');
 | 
			
		||||
    Map<String, String> requestBody = {
 | 
			
		||||
      'old_name': oldFolder,
 | 
			
		||||
      'new_name': newFolder,
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    try {
 | 
			
		||||
      var response = await http.post(
 | 
			
		||||
        url,
 | 
			
		||||
| 
						 | 
				
			
			@ -268,7 +293,6 @@ class ApiService {
 | 
			
		|||
    //leads to problems as for a) the html is added one right after the other in one iframe, b)
 | 
			
		||||
    // if it was multiple iframes then the scrolling to jump would not work as expected
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    print("marker called");
 | 
			
		||||
    // JavaScript code embedded as a string
 | 
			
		||||
    String jsCode = '''
 | 
			
		||||
| 
						 | 
				
			
			@ -379,7 +403,7 @@ class _EmailViewState extends State<EmailView> {
 | 
			
		|||
    String currentContent = widget.emailContent;
 | 
			
		||||
    viewTypeId = "iframe-${DateTime.now().millisecondsSinceEpoch}";
 | 
			
		||||
    _registerViewFactory(currentContent);
 | 
			
		||||
    _markerPositionsFuture = ApiService().getMarkerPosition(); 
 | 
			
		||||
    _markerPositionsFuture = ApiService().getMarkerPosition();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void _registerViewFactory(String currentContent) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue