Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if iOS has access to a mailing app #15

Open
KipCrossing opened this issue Feb 9, 2021 · 1 comment
Open

Check if iOS has access to a mailing app #15

KipCrossing opened this issue Feb 9, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@KipCrossing
Copy link
Member

final bool canSend = await FlutterMailer.canSendMail();

  if(!canSend && Platform.isIOS) {
    final url = 'mailto:?body=$body&subject=$subject';
    if (await canLaunch(url)) {
      await launch(url);
    } else {
      print("FlutterMailer");
      createAlertDialog(BuildContext context) {
        return showDialog(context: context, builder: (context) {
          return AlertDialog(
            title: Text('Delete all samples'),
            content: Text('Are you sure you want to delete?'),
            actions: [
              MaterialButton(
                child: Text('Ok'),
                onPressed: () {
                  // Navigator.of(context).pop(SampleList());
                },
              ),

            ],
          );
        });
      }
      throw 'Could not launch $url';
    }
  }
@KipCrossing
Copy link
Member Author

Something like this but this is not perfect. May need to pass the context to the mailer functions of pass back a response.

@KipCrossing KipCrossing added this to To do in Soil LogR Tasks Mar 9, 2021
@KipCrossing KipCrossing added this to the Release 0.3.1 milestone Mar 11, 2021
@KipCrossing KipCrossing added the enhancement New feature or request label Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

2 participants