Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
fix: Launch email app if not logged in IOS
Browse files Browse the repository at this point in the history
  • Loading branch information
reasje committed Oct 19, 2023
1 parent 16bb77b commit 6a4a74d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
3 changes: 2 additions & 1 deletion assets/flutter_i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,5 +299,6 @@
"removing_account": "Removing account",
"removing_account_warning": "Are you sure you want to remove this account?",
"remove": "Remove",
"duplicate_account_import_notice": "The account you are trying to import is a duplicate"
"duplicate_account_import_notice": "The account you are trying to import is a duplicate",
"unable_to_launch_email_app": "Unable to launch email app"
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,25 @@ abstract class RecoveryPhraseBasePresenter<T extends RecoveryPhraseBaseState>
);

try {
MailerResponse sendResult = await FlutterMailer.send(email);
// only [ios] can return sent | saved | cancelled
// [android] will return android there is no way of knowing on android
// if the intent was sent saved or even cancelled.
if (MailerResponse.cancelled != sendResult) {
nextProcess(settingsFlow, res['phrases']);
bool canSend = await FlutterMailer.canSendMail();

if (Platform.isIOS && !canSend) {
await Utils.launchEmailApp();
} else {
MailerResponse sendResult = await FlutterMailer.send(email);
// only [ios] can return sent | saved | cancelled
// [android] will return android there is no way of knowing on android
// if the intent was sent saved or even cancelled.
if (MailerResponse.cancelled != sendResult) {
nextProcess(settingsFlow, res['phrases']);
}
}
} catch (e, s) {
addError(e, s);
if (e == 'unable_to_launch_email_app') {
addError(translate('unable_to_launch_email_app'));
} else {
addError(e, s);
}
}
}
}

0 comments on commit 6a4a74d

Please sign in to comment.