Open martin-robert-fink opened 3 years ago
don't believe your doing something wrong.
can you provide more context of when this accurse.
what device your using, are you sending attachments, where are the attachments located (application cache/external storage).
are you await
ing the response?
Hi - Thanks for the response. I'm using FlutterMailer to allow users to send feedback and/or request support. I am collecting device/app info, and attaching a few critical files. The app is only running on an iPad. I am awaiting sendFeeback()
. Below is the entire code file:
import 'dart:io';
import 'dart:convert';
import 'package:archive/archive_io.dart';
import 'package:path_provider/path_provider.dart';
import 'package:path/path.dart';
import 'package:get/get.dart';
import 'package:flutter_mailer/flutter_mailer.dart';
import '../global_constants/constants.dart';
import '../controllers/project_controller.dart';
import './package_info.dart';
import './device_info.dart';
Future<String> get emailBody async {
final appInfo = await packageInfo();
final deviceInfo = await iosDeviceInfo();
String body = 'Thank you for taking the time to provide feedback.\n\n';
body = body + 'Type your feedback or support request here: \n\n\n';
body = body + 'Information for troubleshooting: \n';
body = body + 'App Version: ${appInfo[PackageInfoType.version]}\n';
body = body + 'Build: ${appInfo[PackageInfoType.buildNumber]}\n';
body = body + 'OS Version: ${deviceInfo[DeviceInfoType.osVersion]}\n';
body = body + 'Device Type: ${deviceInfo[DeviceInfoType.hardwareType]}\n';
return body;
}
Future<String?> get vcdFile async {
Directory docDirectory = await getApplicationDocumentsDirectory();
var vcdFile = join(docDirectory.path, Constants.vcdZipFileName);
return (File(vcdFile).existsSync()) ? vcdFile : null;
}
Future<String?> get projectFile async {
final _pc = Get.find<ProjectController>();
Directory docDirectory = await getApplicationDocumentsDirectory();
try {
_pc.setupProjectForSaving();
String encoded =
const JsonEncoder.withIndent(' ').convert(_pc.project.toJson());
String compressed =
base64.encode(GZipEncoder().encode(utf8.encode(encoded))!);
var projectFile = join(docDirectory.path, Constants.projectZipFileName);
File(projectFile).writeAsStringSync(compressed, flush: true);
return projectFile;
} catch (_) {
return null;
}
}
Future<List<String>> get _attachments async {
List<String> attachments = [];
final _pc = Get.find<ProjectController>();
if (_pc.isProjectOpen) {
String? project = await projectFile;
if (project != null) attachments = [project];
String? vcd = await vcdFile;
if (attachments.isNotEmpty && vcd != null) attachments.add(vcd);
if (attachments.isEmpty && vcd != null) attachments = [vcd];
return attachments;
}
return <String>[];
}
Future<void> sendFeedback() async {
List<String>? attachments = await _attachments;
final MailOptions mailOptions = MailOptions(
subject: 'Support/Feedback',
body: await emailBody,
recipients: [Constants.feedbackEmailAddress],
attachments: attachments,
isHTML: false);
try {
await FlutterMailer.send(mailOptions);
} catch (_) {}
}
apologies, i cant repreduce the issue. might be an issue with ipads, which i have none.
only reference i can see with a fix is this, https://developer.apple.com/forums/thread/120696
if any one can help a PR would be much appreciated.
On iOS get the error:
[PPT] Error creating the CFMessagePort needed to communicate with PPT.
when usingFlutterEmailSender.send(email)
.The email window comes up as expected. If I send or cancel the email, then I get the following error stream:
Here's the
flutter doctor -v
:is there something I'm doing wrong? Thanks!