-
-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Moving email and newsletter up in contact page (#5111)
Co-authored-by: Gabriel Moraes <[email protected]>
- Loading branch information
Showing
1 changed file
with
43 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,49 @@ class UserPreferencesConnect extends AbstractUserPreferences { | |
|
||
@override | ||
List<UserPreferencesItem> getChildren() => <UserPreferencesItem>[ | ||
_getListTile( | ||
title: appLocalizations.contact_title_newsletter, | ||
url: 'https://link.openfoodfacts.org/newsletter-en', | ||
leadingIconData: CupertinoIcons.news_solid, | ||
), | ||
_getListTile( | ||
title: appLocalizations.support_via_email, | ||
leadingIconData: Icons.drafts, | ||
onTap: () async { | ||
final bool? includeLogs = await showDialog<bool>( | ||
context: context, | ||
builder: (BuildContext context) { | ||
return SmoothAlertDialog( | ||
title: appLocalizations | ||
.support_via_email_include_logs_dialog_title, | ||
body: Text( | ||
appLocalizations | ||
.support_via_email_include_logs_dialog_body, | ||
), | ||
close: true, | ||
positiveAction: SmoothActionButton( | ||
text: appLocalizations.yes, | ||
onPressed: () => Navigator.of(context).pop(true)), | ||
negativeAction: SmoothActionButton( | ||
text: appLocalizations.no, | ||
onPressed: () => Navigator.of(context).pop(false)), | ||
); | ||
}); | ||
|
||
if (includeLogs == null) { | ||
return; | ||
} | ||
|
||
await _sendEmail( | ||
body: await _emailBody, | ||
subject: | ||
'${appLocalizations.help_with_openfoodfacts} (Help with Open Food Facts)', | ||
recipient: '[email protected]', | ||
attachmentPaths: includeLogs == true ? Logs.logFilesPaths : null, | ||
); | ||
}, | ||
), | ||
_getDivider(), | ||
_getListTile( | ||
title: appLocalizations.instagram, | ||
url: appLocalizations.instagram_link, | ||
|
@@ -126,49 +169,6 @@ class UserPreferencesConnect extends AbstractUserPreferences { | |
: '[email protected]', | ||
), | ||
), | ||
_getDivider(), | ||
_getListTile( | ||
title: appLocalizations.contact_title_newsletter, | ||
url: 'https://link.openfoodfacts.org/newsletter-en', | ||
leadingIconData: CupertinoIcons.news_solid, | ||
), | ||
_getListTile( | ||
title: appLocalizations.support_via_email, | ||
leadingIconData: Icons.drafts, | ||
onTap: () async { | ||
final bool? includeLogs = await showDialog<bool>( | ||
context: context, | ||
builder: (BuildContext context) { | ||
return SmoothAlertDialog( | ||
title: appLocalizations | ||
.support_via_email_include_logs_dialog_title, | ||
body: Text( | ||
appLocalizations | ||
.support_via_email_include_logs_dialog_body, | ||
), | ||
close: true, | ||
positiveAction: SmoothActionButton( | ||
text: appLocalizations.yes, | ||
onPressed: () => Navigator.of(context).pop(true)), | ||
negativeAction: SmoothActionButton( | ||
text: appLocalizations.no, | ||
onPressed: () => Navigator.of(context).pop(false)), | ||
); | ||
}); | ||
|
||
if (includeLogs == null) { | ||
return; | ||
} | ||
|
||
await _sendEmail( | ||
body: await _emailBody, | ||
subject: | ||
'${appLocalizations.help_with_openfoodfacts} (Help with Open Food Facts)', | ||
recipient: '[email protected]', | ||
attachmentPaths: includeLogs == true ? Logs.logFilesPaths : null, | ||
); | ||
}, | ||
), | ||
]; | ||
|
||
Future<String> get _emailBody async { | ||
|