Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Improve help and support UX with robust email fallback

ashilknd86d5d60c073
diff --git a/mobile/apps/photos/ios/Podfile.lock b/mobile/apps/photos/ios/Podfile.lock
index d74e766b18..8896f1c714 100644
--- a/mobile/apps/photos/ios/Podfile.lock
+++ b/mobile/apps/photos/ios/Podfile.lock
@@ -215,28 +215,31 @@ PODS:
- sqflite_darwin (0.0.4):
- Flutter
- FlutterMacOS
- - sqlite3 (3.50.4):
- - sqlite3/common (= 3.50.4)
- - sqlite3/common (3.50.4)
- - sqlite3/dbstatvtab (3.50.4):
+ - sqlite3 (3.51.1):
+ - sqlite3/common (= 3.51.1)
+ - sqlite3/common (3.51.1)
+ - sqlite3/dbstatvtab (3.51.1):
- sqlite3/common
- - sqlite3/fts5 (3.50.4):
+ - sqlite3/fts5 (3.51.1):
- sqlite3/common
- - sqlite3/math (3.50.4):
+ - sqlite3/math (3.51.1):
- sqlite3/common
- - sqlite3/perf-threadsafe (3.50.4):
+ - sqlite3/perf-threadsafe (3.51.1):
- sqlite3/common
- - sqlite3/rtree (3.50.4):
+ - sqlite3/rtree (3.51.1):
+ - sqlite3/common
+ - sqlite3/session (3.51.1):
- sqlite3/common
- sqlite3_flutter_libs (0.0.1):
- Flutter
- FlutterMacOS
- - sqlite3 (~> 3.50.1)
+ - sqlite3 (~> 3.51.1)
- sqlite3/dbstatvtab
- sqlite3/fts5
- sqlite3/math
- sqlite3/perf-threadsafe
- sqlite3/rtree
+ - sqlite3/session
- system_info_plus (0.0.1):
- Flutter
- thermal (0.0.1):
@@ -550,8 +553,8 @@ SPEC CHECKSUMS:
share_plus: 50da8cb520a8f0f65671c6c6a99b3617ed10a58a
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0
- sqlite3: 73513155ec6979715d3904ef53a8d68892d4032b
- sqlite3_flutter_libs: e7fc8c9ea2200ff3271f08f127842131746b70e2
+ sqlite3: 8d708bc63e9f4ce48f0ad9d6269e478c5ced1d9b
+ sqlite3_flutter_libs: d13b8b3003f18f596e542bcb9482d105577eff41
system_info_plus: 555ce7047fbbf29154726db942ae785c29211740
thermal: d4c48be750d1ddbab36b0e2dcb2471531bc8df41
ua_client_hints: 92fe0d139619b73ec9fcb46cc7e079a26178f586
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arb
index dd1b087a21..9bf9537e5a 100644
--- a/mobile/apps/photos/lib/l10n/intl_en.arb
+++ b/mobile/apps/photos/lib/l10n/intl_en.arb
@@ -699,6 +699,61 @@
"reportBug": "Report bug",
"suggestFeatures": "Suggest features",
"support": "Support",
+ "helpAndSupport": "Help & Support",
+ "browseHelpPages": "Browse help pages",
+ "searchAndDiscovery": "Search and discovery",
+ "searchAndDiscoveryDesc": "Faces, locations, descriptions, and more",
+ "backupAndSync": "Backup and sync",
+ "backupAndSyncDesc": "Auto-backup, sync status, and uploads",
+ "sharingAndCollaboration": "Sharing and collaboration",
+ "sharingAndCollaborationDesc": "Albums, links, and family plans",
+ "storageAndPlans": "Storage and plans",
+ "storageAndPlansDesc": "Plans, billing, and storage usage",
+ "troubleshooting": "Troubleshooting",
+ "troubleshootingDesc": "Common issues and their solutions",
+ "viewAllHelpTopics": "View all help topics",
+ "getInTouch": "Get in touch",
+ "reportAnIssue": "Report an issue",
+ "askAQuestion": "Ask a question",
+ "requestAFeature": "Request a feature",
+ "subject": "Subject",
+ "description": "Description",
+ "oneLineAboutTheIssue": "One line about the issue",
+ "detailsAboutTheIssue": "Details about the issue",
+ "yourQuestion": "Your question",
+ "anyAdditionalInformation": "Any additional information",
+ "attachLogs": "Attach logs",
+ "attachLogsHelper": "Helps us diagnose the issue faster",
+ "deviceInfoNote": "Device details such as OS version, app version, and device model will be included automatically.",
+ "pleaseEnterASubject": "Please enter a subject",
+ "pleaseEnterADescription": "Please enter a description",
+ "noEmailAppFound": "No email app found",
+ "noEmailAppBody": "Copy your message and send it to {email} from any email service.",
+ "@noEmailAppBody": {
+ "description": "No-mail-app fallback subtitle with the target email address",
+ "placeholders": {
+ "email": {
+ "type": "String",
+ "example": "[email protected]"
+ }
+ }
+ },
+ "message": "Message",
+ "deviceInfo": "Device info",
+ "logs": "Logs",
+ "logsNotCopiedDownloadNote": "Logs are not copied. Download the logs and attach them to your email.",
+ "attachedSize": "Attached ({size})",
+ "@attachedSize": {
+ "description": "Label for attached logs with formatted file size",
+ "placeholders": {
+ "size": {
+ "type": "String",
+ "example": "12.4 KB"
+ }
+ }
+ },
+ "copyAllToClipboard": "Copy all to clipboard",
+ "copied": "Copied",
"appearance": "Appearance",
"theme": "Theme",
"lightTheme": "Light",
diff --git a/mobile/apps/photos/lib/ui/settings/search/settings_search_registry.dart b/mobile/apps/photos/lib/ui/settings/search/settings_search_registry.dart
index e11d9015b7..5413c1d697 100644
--- a/mobile/apps/photos/lib/ui/settings/search/settings_search_registry.dart
+++ b/mobile/apps/photos/lib/ui/settings/search/settings_search_registry.dart
@@ -640,8 +640,8 @@ class SettingsSearchRegistry {
// Help & Support
items.add(
SettingsSearchItem(
- title: l10n.support,
- sectionPath: l10n.support,
+ title: l10n.helpAndSupport,
+ sectionPath: l10n.helpAndSupport,
icon: HugeIcons.strokeRoundedHelpCircle,
routeBuilder: (_) => const HelpSupportPage(),
keywords: ["help", "faq", "contact", "feedback", "bug"],
@@ -650,49 +650,49 @@ class SettingsSearchRegistry {
items.addAll([
SettingsSearchItem(
- title: l10n.help,
- subtitle: l10n.support,
- sectionPath: l10n.support,
+ title: l10n.browseHelpPages,
+ subtitle: l10n.helpAndSupport,
+ sectionPath: l10n.helpAndSupport,
icon: HugeIcons.strokeRoundedHelpCircle,
routeBuilder: (_) => const HelpSupportPage(),
isSubPage: true,
keywords: ["help", "faq", "guide"],
),
SettingsSearchItem(
- title: l10n.reportABug,
- subtitle: l10n.support,
- sectionPath: l10n.support,
+ title: l10n.reportAnIssue,
+ subtitle: l10n.helpAndSupport,
+ sectionPath: l10n.helpAndSupport,
icon: HugeIcons.strokeRoundedBug02,
routeBuilder: (_) => const HelpSupportPage(),
isSubPage: true,
keywords: ["bug", "issue", "crash"],
),
SettingsSearchItem(
- title: l10n.contactSupport,
- subtitle: l10n.support,
- sectionPath: l10n.support,
- icon: HugeIcons.strokeRoundedMail01,
+ title: l10n.askAQuestion,
+ subtitle: l10n.helpAndSupport,
+ sectionPath: l10n.helpAndSupport,
+ icon: HugeIcons.strokeRoundedHelpCircle,
routeBuilder: (_) => const HelpSupportPage(),
isSubPage: true,
keywords: ["contact", "support", "email"],
),
SettingsSearchItem(
- title: l10n.suggestFeatures,
- subtitle: l10n.support,
- sectionPath: l10n.support,
+ title: l10n.requestAFeature,
+ subtitle: l10n.helpAndSupport,
+ sectionPath: l10n.helpAndSupport,
icon: HugeIcons.strokeRoundedIdea01,
routeBuilder: (_) => const HelpSupportPage(),
isSubPage: true,
keywords: ["suggest", "feature request", "feedback"],
),
SettingsSearchItem(
- title: l10n.crashReporting,
- subtitle: l10n.support,
- sectionPath: l10n.support,
- icon: HugeIcons.strokeRoundedAlert02,
+ title: l10n.exportLogs,
+ subtitle: l10n.helpAndSupport,
+ sectionPath: l10n.helpAndSupport,
+ icon: HugeIcons.strokeRoundedDownload04,
routeBuilder: (_) => const HelpSupportPage(),
isSubPage: true,
- keywords: ["crash", "reporting", "diagnostics"],
+ keywords: ["logs", "export", "diagnostics"],
),
]);
diff --git a/mobile/apps/photos/lib/ui/settings/support/ask_question_page.dart b/mobile/apps/photos/lib/ui/settings/support/ask_question_page.dart
new file mode 100644
index 0000000000..2406112413
--- /dev/null
+++ b/mobile/apps/photos/lib/ui/settings/support/ask_question_page.dart
@@ -0,0 +1,155 @@
+import "package:flutter/material.dart";
+import "package:logging/logging.dart";
+import "package:photos/core/constants.dart";
+import "package:photos/generated/l10n.dart";
+import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/components/buttons/button_widget_v2.dart";
+import "package:photos/ui/components/text_input_widget_v2.dart";
+import "package:photos/ui/notification/toast.dart";
+import "package:photos/ui/settings/support/no_mail_app_sheet.dart";
+import "package:photos/utils/email_util.dart";
+
+class AskQuestionPage extends StatefulWidget {
+ const AskQuestionPage({super.key});
+
+ @override
+ State<AskQuestionPage> createState() => _AskQuestionPageState();
+}
+
+class _AskQuestionPageState extends State<AskQuestionPage> {
+ static final _logger = Logger("AskQuestionPage");
+ final _subjectController = TextEditingController();
+ final _descriptionController = TextEditingController();
+ bool _isSending = false;
+
+ @override
+ void dispose() {
+ _subjectController.dispose();
+ _descriptionController.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final l10n = AppLocalizations.of(context);
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+ final isDarkMode = Theme.of(context).brightness == Brightness.dark;
+
+ final pageBackgroundColor =
+ isDarkMode ? const Color(0xFF161616) : const Color(0xFFFAFAFA);
+
+ return Scaffold(
+ backgroundColor: pageBackgroundColor,
+ body: SafeArea(
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const SizedBox(height: 24),
+ GestureDetector(
+ onTap: () => Navigator.of(context).pop(),
+ child: Icon(
+ Icons.arrow_back,
+ color: colorScheme.strokeBase,
+ size: 24,
+ ),
+ ),
+ const SizedBox(height: 24),
+ Text(
+ l10n.askAQuestion,
+ style: textTheme.h3Bold,
+ ),
+ const SizedBox(height: 24),
+ Expanded(
+ child: SingleChildScrollView(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ TextInputWidgetV2(
+ label: l10n.subject,
+ hintText: l10n.yourQuestion,
+ textEditingController: _subjectController,
+ textCapitalization: TextCapitalization.sentences,
+ isClearable: true,
+ maxLines: 1,
+ ),
+ const SizedBox(height: 16),
+ TextInputWidgetV2(
+ label: l10n.description,
+ hintText: l10n.anyAdditionalInformation,
+ textEditingController: _descriptionController,
+ textCapitalization: TextCapitalization.sentences,
+ maxLines: 6,
+ minLines: 6,
+ ),
+ const SizedBox(height: 24),
+ ButtonWidgetV2(
+ buttonType: ButtonTypeV2.primary,
+ labelText: l10n.send,
+ isDisabled: _isSending,
+ shouldSurfaceExecutionStates: false,
+ onTap: _onSend,
+ ),
+ ],
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+
+ Future<void> _onSend() async {
+ if (_isSending) {
+ return;
+ }
+ final l10n = AppLocalizations.of(context);
+ final subject = _subjectController.text.trim();
+ final description = _descriptionController.text.trim();
+ if (subject.isEmpty) {
+ showShortToast(context, l10n.pleaseEnterASubject);
+ return;
+ }
+ if (description.isEmpty) {
+ showShortToast(context, l10n.pleaseEnterADescription);
+ return;
+ }
+
+ setState(() {
+ _isSending = true;
+ });
+
+ final emailSubject = "[Support] $subject";
+ try {
+ final didOpenComposer = await sendComposedEmail(
+ context,
+ to: supportEmail,
+ subject: emailSubject,
+ body: description,
+ );
+ if (!didOpenComposer && mounted) {
+ await showNoMailAppSheet(
+ context,
+ toEmail: supportEmail,
+ subject: emailSubject,
+ message: description,
+ );
+ }
+ } catch (e, s) {
+ _logger.severe("Failed to send question to support", e, s);
+ if (mounted) {
+ showShortToast(context, l10n.somethingWentWrong);
+ }
+ } finally {
+ if (mounted) {
+ setState(() {
+ _isSending = false;
+ });
+ }
+ }
+ }
+}
diff --git a/mobile/apps/photos/lib/ui/settings/support/help_support_page.dart b/mobile/apps/photos/lib/ui/settings/support/help_support_page.dart
index 6d559a6ab9..a3cc6af5e0 100644
--- a/mobile/apps/photos/lib/ui/settings/support/help_support_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/support/help_support_page.dart
@@ -1,22 +1,28 @@
-import "dart:io";
-
import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
+import "package:logging/logging.dart";
import "package:photos/core/constants.dart";
-import "package:photos/core/error-reporting/super_logging.dart";
import "package:photos/generated/l10n.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/common/web_page.dart";
import "package:photos/ui/components/menu_item_widget/menu_item_widget_new.dart";
-import "package:photos/ui/components/toggle_switch_widget.dart";
+import "package:photos/ui/components/menu_section_title.dart";
+import "package:photos/ui/components/settings/settings_grouped_card.dart";
+import "package:photos/ui/notification/toast.dart";
+import "package:photos/ui/settings/support/ask_question_page.dart";
+import "package:photos/ui/settings/support/report_issue_page.dart";
import "package:photos/utils/email_util.dart";
import "package:url_launcher/url_launcher_string.dart";
class HelpSupportPage extends StatelessWidget {
+ static final _logger = Logger("HelpSupportPage");
+ static const _helpUrl = "https://ente.io/help";
+
const HelpSupportPage({super.key});
@override
Widget build(BuildContext context) {
+ final l10n = AppLocalizations.of(context);
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
@@ -24,9 +30,6 @@ class HelpSupportPage extends StatelessWidget {
final pageBackgroundColor =
isDarkMode ? const Color(0xFF161616) : const Color(0xFFFAFAFA);
- final String bugsEmail =
- Platform.isAndroid ? "[email protected]" : "[email protected]";
-
return Scaffold(
backgroundColor: pageBackgroundColor,
body: SafeArea(
@@ -46,97 +49,122 @@ class HelpSupportPage extends StatelessWidget {
),
const SizedBox(height: 24),
Text(
- AppLocalizations.of(context).support,
+ l10n.helpAndSupport,
style: textTheme.h3Bold,
),
const SizedBox(height: 24),
Expanded(
child: SingleChildScrollView(
child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
children: [
- MenuItemWidgetNew(
- title: AppLocalizations.of(context).help,
- leadingIconWidget: _buildIconWidget(
- context,
- HugeIcons.strokeRoundedHelpCircle,
- ),
- trailingIcon: Icons.chevron_right_outlined,
- trailingIconIsMuted: true,
- onTap: () async {
- await Navigator.of(context).push(
- MaterialPageRoute(
- builder: (BuildContext context) {
- return WebPage(
- AppLocalizations.of(context).help,
- "https://ente.io/help",
- );
- },
- ),
- );
- },
+ MenuSectionTitle(title: l10n.browseHelpPages),
+ SettingsGroupedCard(
+ children: [
+ _buildHelpTopicItem(
+ context,
+ title: l10n.searchAndDiscovery,
+ subText: l10n.searchAndDiscoveryDesc,
+ icon: HugeIcons.strokeRoundedSearch01,
+ ),
+ _buildHelpTopicItem(
+ context,
+ title: l10n.backupAndSync,
+ subText: l10n.backupAndSyncDesc,
+ icon: HugeIcons.strokeRoundedCloudUpload,
+ ),
+ _buildHelpTopicItem(
+ context,
+ title: l10n.sharingAndCollaboration,
+ subText: l10n.sharingAndCollaborationDesc,
+ icon: HugeIcons.strokeRoundedShare01,
+ ),
+ _buildHelpTopicItem(
+ context,
+ title: l10n.storageAndPlans,
+ subText: l10n.storageAndPlansDesc,
+ icon: HugeIcons.strokeRoundedHardDrive,
+ ),
+ _buildHelpTopicItem(
+ context,
+ title: l10n.troubleshooting,
+ subText: l10n.troubleshootingDesc,
+ icon: HugeIcons.strokeRoundedWrench01,
+ ),
+ ],
),
- const SizedBox(height: 8),
- MenuItemWidgetNew(
- title: AppLocalizations.of(context).reportABug,
- leadingIconWidget: _buildIconWidget(
- context,
- HugeIcons.strokeRoundedBug02,
- ),
- trailingIcon: Icons.chevron_right_outlined,
- trailingIconIsMuted: true,
+ _SupportLink(
+ label: l10n.viewAllHelpTopics,
onTap: () async {
- await sendLogs(
+ await _openHelpPage(
context,
- AppLocalizations.of(context).reportBug,
- bugsEmail,
+ title: l10n.helpAndSupport,
);
},
),
- const SizedBox(height: 8),
- MenuItemWidgetNew(
- title: AppLocalizations.of(context).contactSupport,
- leadingIconWidget: _buildIconWidget(
- context,
- HugeIcons.strokeRoundedMail01,
- ),
- trailingIcon: Icons.chevron_right_outlined,
- trailingIconIsMuted: true,
- onTap: () async {
- await sendEmail(context, to: supportEmail);
- },
+ const SizedBox(height: 24),
+ MenuSectionTitle(title: l10n.getInTouch),
+ SettingsGroupedCard(
+ children: [
+ MenuItemWidgetNew(
+ title: l10n.reportAnIssue,
+ borderRadius: 0,
+ leadingIconWidget: _buildIconWidget(
+ context,
+ HugeIcons.strokeRoundedBug02,
+ ),
+ trailingIcon: Icons.chevron_right_outlined,
+ trailingIconIsMuted: true,
+ onTap: () async {
+ await Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (context) => const ReportIssuePage(),
+ ),
+ );
+ },
+ ),
+ MenuItemWidgetNew(
+ title: l10n.askAQuestion,
+ borderRadius: 0,
+ leadingIconWidget: _buildIconWidget(
+ context,
+ HugeIcons.strokeRoundedHelpCircle,
+ ),
+ trailingIcon: Icons.chevron_right_outlined,
+ trailingIconIsMuted: true,
+ onTap: () async {
+ await Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (context) => const AskQuestionPage(),
+ ),
+ );
+ },
+ ),
+ MenuItemWidgetNew(
+ title: l10n.requestAFeature,
+ borderRadius: 0,
+ leadingIconWidget: _buildIconWidget(
+ context,
+ HugeIcons.strokeRoundedIdea01,
+ ),
+ trailingIcon: Icons.chevron_right_outlined,
+ trailingIconIsMuted: true,
+ onTap: () async {
+ await launchUrlString(
+ githubDiscussionsUrl,
+ mode: LaunchMode.externalApplication,
+ );
+ },
+ ),
+ ],
),
- const SizedBox(height: 8),
- MenuItemWidgetNew(
- title: AppLocalizations.of(context).suggestFeatures,
- leadingIconWidget: _buildIconWidget(
- context,
- HugeIcons.strokeRoundedIdea01,
- ),
- trailingIcon: Icons.chevron_right_outlined,
- trailingIconIsMuted: true,
+ _SupportLink(
+ label: l10n.exportLogs,
onTap: () async {
- await launchUrlString(
- githubDiscussionsUrl,
- mode: LaunchMode.externalApplication,
- );
+ await _exportLogs(context);
},
),
- const SizedBox(height: 8),
- MenuItemWidgetNew(
- title: AppLocalizations.of(context).crashReporting,
- leadingIconWidget: _buildIconWidget(
- context,
- HugeIcons.strokeRoundedAlert02,
- ),
- trailingWidget: ToggleSwitchWidget(
- value: () => SuperLogging.shouldReportCrashes(),
- onChanged: () async {
- await SuperLogging.setShouldReportCrashes(
- !SuperLogging.shouldReportCrashes(),
- );
- },
- ),
- ),
+ const SizedBox(height: 24),
],
),
),
@@ -148,6 +176,25 @@ class HelpSupportPage extends StatelessWidget {
);
}
+ Widget _buildHelpTopicItem(
+ BuildContext context, {
+ required String title,
+ required String subText,
+ required List<List<dynamic>> icon,
+ }) {
+ return MenuItemWidgetNew(
+ title: title,
+ subText: subText,
+ borderRadius: 0,
+ leadingIconWidget: _buildIconWidget(context, icon),
+ trailingIcon: Icons.chevron_right_outlined,
+ trailingIconIsMuted: true,
+ onTap: () async {
+ await _openHelpPage(context, title: title);
+ },
+ );
+ }
+
Widget _buildIconWidget(BuildContext context, List<List<dynamic>> icon) {
final colorScheme = getEnteColorScheme(context);
return HugeIcon(
@@ -156,4 +203,70 @@ class HelpSupportPage extends StatelessWidget {
size: 20,
);
}
+
+ Future<void> _openHelpPage(
+ BuildContext context, {
+ required String title,
+ }) async {
+ await Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (BuildContext context) {
+ return WebPage(title, _helpUrl);
+ },
+ ),
+ );
+ }
+
+ Future<void> _exportLogs(BuildContext context) async {
+ try {
+ final zipFilePath = await getZippedLogsFile(context);
+ await exportLogs(context, zipFilePath);
+ } catch (e, s) {
+ _logger.severe("Failed to export logs", e, s);
+ if (context.mounted) {
+ showShortToast(
+ context,
+ AppLocalizations.of(context).somethingWentWrong,
+ );
+ }
+ }
+ }
+}
+
+class _SupportLink extends StatelessWidget {
+ final String label;
+ final Future<void> Function() onTap;
+
+ const _SupportLink({
+ required this.label,
+ required this.onTap,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+ return GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: onTap,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 12),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Text(
+ label,
+ style: textTheme.small.copyWith(color: colorScheme.primary500),
+ ),
+ const SizedBox(width: 4),
+ Icon(
+ Icons.chevron_right_outlined,
+ color: colorScheme.primary500,
+ size: 16,
+ ),
+ ],
+ ),
+ ),
+ );
+ }
}
diff --git a/mobile/apps/photos/lib/ui/settings/support/no_mail_app_sheet.dart b/mobile/apps/photos/lib/ui/settings/support/no_mail_app_sheet.dart
new file mode 100644
index 0000000000..55b1f21466
--- /dev/null
+++ b/mobile/apps/photos/lib/ui/settings/support/no_mail_app_sheet.dart
@@ -0,0 +1,226 @@
+import "package:flutter/material.dart";
+import "package:flutter/services.dart";
+import "package:photos/generated/l10n.dart";
+import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/components/base_bottom_sheet.dart";
+import "package:photos/ui/components/buttons/button_widget_v2.dart";
+import "package:photos/ui/notification/toast.dart";
+import "package:photos/utils/email_util.dart";
+
+Future<void> showNoMailAppSheet(
+ BuildContext context, {
+ required String toEmail,
+ required String subject,
+ required String message,
+ String? deviceInfo,
+ String? logsLabel,
+ String? logsFilePath,
+}) async {
+ await showBaseBottomSheet<void>(
+ context,
+ title: AppLocalizations.of(context).noEmailAppFound,
+ headerSpacing: 16,
+ child: NoMailAppSheet(
+ toEmail: toEmail,
+ subject: subject,
+ message: message,
+ deviceInfo: deviceInfo,
+ logsLabel: logsLabel,
+ logsFilePath: logsFilePath,
+ ),
+ );
+}
+
+class NoMailAppSheet extends StatelessWidget {
+ final String toEmail;
+ final String subject;
+ final String message;
+ final String? deviceInfo;
+ final String? logsLabel;
+ final String? logsFilePath;
+
+ const NoMailAppSheet({
+ required this.toEmail,
+ required this.subject,
+ required this.message,
+ this.deviceInfo,
+ this.logsLabel,
+ this.logsFilePath,
+ super.key,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final l10n = AppLocalizations.of(context);
+ final copyFields = <_CopyFieldData>[
+ _CopyFieldData(
+ label: l10n.subject,
+ value: subject,
+ ),
+ _CopyFieldData(
+ label: l10n.message,
+ value: message,
+ ),
+ if (deviceInfo != null && deviceInfo!.trim().isNotEmpty)
+ _CopyFieldData(
+ label: l10n.deviceInfo,
+ value: deviceInfo!,
+ ),
+ if (logsLabel != null && logsLabel!.trim().isNotEmpty)
+ _CopyFieldData(
+ label: l10n.logs,
+ value: logsLabel!,
+ logsFilePath: logsFilePath,
+ note: l10n.logsNotCopiedDownloadNote,
+ ),
+ ];
+
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Text(
+ l10n.noEmailAppBody(email: toEmail),
+ style: getEnteTextTheme(context).smallMuted,
+ ),
+ const SizedBox(height: 16),
+ for (int i = 0; i < copyFields.length; i++) ...[
+ _CopyField(
+ data: copyFields[i],
+ onCopy: () async {
+ await Clipboard.setData(ClipboardData(text: copyFields[i].value));
+ if (context.mounted) {
+ showShortToast(context, l10n.copied);
+ }
+ },
+ onExport: copyFields[i].logsFilePath == null
+ ? null
+ : () async {
+ await exportLogs(context, copyFields[i].logsFilePath!);
+ },
+ ),
+ if (i != copyFields.length - 1) const SizedBox(height: 12),
+ ],
+ const SizedBox(height: 16),
+ ButtonWidgetV2(
+ buttonType: ButtonTypeV2.primary,
+ labelText: l10n.copyAllToClipboard,
+ onTap: () async {
+ await Clipboard.setData(
+ ClipboardData(text: _buildCopyAllPayload(l10n)),
+ );
+ if (context.mounted) {
+ showShortToast(context, l10n.copied);
+ }
+ },
+ ),
+ ],
+ );
+ }
+
+ String _buildCopyAllPayload(AppLocalizations l10n) {
+ final items = <String>[
+ "${l10n.subject}: $subject",
+ "${l10n.message}: $message",
+ if (deviceInfo != null && deviceInfo!.trim().isNotEmpty)
+ "${l10n.deviceInfo}: ${deviceInfo!.trim()}",
+ if (logsLabel != null && logsLabel!.trim().isNotEmpty)
+ "${l10n.logs}: ${logsLabel!.trim()}",
+ ];
+ return items.join("\n\n");
+ }
+}
+
+class _CopyFieldData {
+ final String label;
+ final String value;
+ final String? logsFilePath;
+ final String? note;
+
+ const _CopyFieldData({
+ required this.label,
+ required this.value,
+ this.logsFilePath,
+ this.note,
+ });
+}
+
+class _CopyField extends StatelessWidget {
+ final _CopyFieldData data;
+ final Future<void> Function() onCopy;
+ final Future<void> Function()? onExport;
+
+ const _CopyField({
+ required this.data,
+ required this.onCopy,
+ this.onExport,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+ final isExportAction = onExport != null;
+ final onTap = isExportAction ? onExport! : onCopy;
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Padding(
+ padding: const EdgeInsets.only(left: 4, bottom: 4),
+ child: Text(
+ data.label,
+ style: textTheme.miniMuted,
+ ),
+ ),
+ Container(
+ decoration: BoxDecoration(
+ color: colorScheme.fillFaint,
+ borderRadius: BorderRadius.circular(16),
+ ),
+ padding: const EdgeInsets.fromLTRB(12, 10, 8, 10),
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Expanded(
+ child: Text(
+ data.value,
+ style: textTheme.small,
+ ),
+ ),
+ const SizedBox(width: 8),
+ Material(
+ color: colorScheme.fillMuted,
+ borderRadius: BorderRadius.circular(8),
+ child: InkWell(
+ borderRadius: BorderRadius.circular(8),
+ onTap: onTap,
+ child: SizedBox(
+ width: 32,
+ height: 32,
+ child: Icon(
+ isExportAction
+ ? Icons.download_outlined
+ : Icons.content_copy_outlined,
+ size: 18,
+ color: colorScheme.textMuted,
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ if (data.note != null && data.note!.trim().isNotEmpty) ...[
+ const SizedBox(height: 4),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 4),
+ child: Text(
+ data.note!,
+ style: textTheme.miniMuted,
+ ),
+ ),
+ ],
+ ],
+ );
+ }
+}
diff --git a/mobile/apps/photos/lib/ui/settings/support/report_issue_page.dart b/mobile/apps/photos/lib/ui/settings/support/report_issue_page.dart
new file mode 100644
index 0000000000..bb4fc8f906
--- /dev/null
+++ b/mobile/apps/photos/lib/ui/settings/support/report_issue_page.dart
@@ -0,0 +1,228 @@
+import "dart:io";
+
+import "package:ente_pure_utils/ente_pure_utils.dart";
+import "package:flutter/material.dart";
+import "package:logging/logging.dart";
+import "package:photos/generated/l10n.dart";
+import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/components/buttons/button_widget_v2.dart";
+import "package:photos/ui/components/text_input_widget_v2.dart";
+import "package:photos/ui/components/toggle_switch_widget.dart";
+import "package:photos/ui/notification/toast.dart";
+import "package:photos/ui/settings/support/no_mail_app_sheet.dart";
+import "package:photos/utils/email_util.dart";
+
+class ReportIssuePage extends StatefulWidget {
+ const ReportIssuePage({super.key});
+
+ @override
+ State<ReportIssuePage> createState() => _ReportIssuePageState();
+}
+
+class _ReportIssuePageState extends State<ReportIssuePage> {
+ static final _logger = Logger("ReportIssuePage");
+ final _subjectController = TextEditingController();
+ final _descriptionController = TextEditingController();
+ bool _attachLogs = true;
+ bool _isSending = false;
+
+ @override
+ void dispose() {
+ _subjectController.dispose();
+ _descriptionController.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final l10n = AppLocalizations.of(context);
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+ final isDarkMode = Theme.of(context).brightness == Brightness.dark;
+
+ final pageBackgroundColor =
+ isDarkMode ? const Color(0xFF161616) : const Color(0xFFFAFAFA);
+
+ return Scaffold(
+ backgroundColor: pageBackgroundColor,
+ body: SafeArea(
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const SizedBox(height: 24),
+ GestureDetector(
+ onTap: () => Navigator.of(context).pop(),
+ child: Icon(
+ Icons.arrow_back,
+ color: colorScheme.strokeBase,
+ size: 24,
+ ),
+ ),
+ const SizedBox(height: 24),
+ Text(
+ l10n.reportAnIssue,
+ style: textTheme.h3Bold,
+ ),
+ const SizedBox(height: 24),
+ Expanded(
+ child: SingleChildScrollView(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ TextInputWidgetV2(
+ label: l10n.subject,
+ hintText: l10n.oneLineAboutTheIssue,
+ textEditingController: _subjectController,
+ textCapitalization: TextCapitalization.sentences,
+ isClearable: true,
+ maxLines: 1,
+ ),
+ const SizedBox(height: 16),
+ TextInputWidgetV2(
+ label: l10n.description,
+ hintText: l10n.detailsAboutTheIssue,
+ textEditingController: _descriptionController,
+ textCapitalization: TextCapitalization.sentences,
+ maxLines: 6,
+ minLines: 6,
+ ),
+ const SizedBox(height: 16),
+ Container(
+ decoration: BoxDecoration(
+ color: colorScheme.fill,
+ borderRadius: BorderRadius.circular(20),
+ ),
+ padding: const EdgeInsets.fromLTRB(16, 14, 8, 14),
+ child: Row(
+ children: [
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ l10n.attachLogs,
+ style: textTheme.small,
+ ),
+ const SizedBox(height: 2),
+ Text(
+ l10n.attachLogsHelper,
+ style: textTheme.miniMuted,
+ ),
+ ],
+ ),
+ ),
+ ToggleSwitchWidget(
+ value: () => _attachLogs,
+ onChanged: () async {
+ setState(() {
+ _attachLogs = !_attachLogs;
+ });
+ },
+ ),
+ ],
+ ),
+ ),
+ const SizedBox(height: 8),
+ Text(
+ l10n.deviceInfoNote,
+ style: textTheme.miniMuted,
+ ),
+ const SizedBox(height: 24),
+ ButtonWidgetV2(
+ buttonType: ButtonTypeV2.primary,
+ labelText: l10n.send,
+ isDisabled: _isSending,
+ shouldSurfaceExecutionStates: false,
+ onTap: _onSend,
+ ),
+ ],
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+
+ Future<void> _onSend() async {
+ if (_isSending) {
+ return;
+ }
+ final l10n = AppLocalizations.of(context);
+ final subject = _subjectController.text.trim();
+ final description = _descriptionController.text.trim();
+ if (subject.isEmpty) {
+ showShortToast(context, l10n.pleaseEnterASubject);
+ return;
+ }
+ if (description.isEmpty) {
+ showShortToast(context, l10n.pleaseEnterADescription);
+ return;
+ }
+
+ setState(() {
+ _isSending = true;
+ });
+
+ final bugsEmail =
+ Platform.isAndroid ? "[email protected]" : "[email protected]";
+ String? logsZipFilePath;
+ String? logsLabel;
+
+ try {
+ final deviceInfo = await getSupportDeviceInfo();
+ final body = buildSupportEmailBody(
+ message: description,
+ deviceInfo: deviceInfo,
+ );
+
+ if (_attachLogs) {
+ logsZipFilePath = await getZippedLogsFile(context);
+ final logsSize = await File(logsZipFilePath).length();
+ logsLabel = l10n.attachedSize(size: formatBytes(logsSize));
+ }
+
+ final didOpenComposer = _attachLogs
+ ? await sendLogsWithSubjectAndBody(
+ context,
+ toEmail: bugsEmail,
+ subject: subject,
+ body: body,
+ zipFilePath: logsZipFilePath,
+ )
+ : await sendComposedEmail(
+ context,
+ to: bugsEmail,
+ subject: subject,
+ body: body,
+ );
+
+ if (!didOpenComposer && mounted) {
+ await showNoMailAppSheet(
+ context,
+ toEmail: bugsEmail,
+ subject: subject,
+ message: description,
+ deviceInfo: deviceInfo,
+ logsLabel: logsLabel,
+ logsFilePath: logsZipFilePath,
+ );
+ }
+ } catch (e, s) {
+ _logger.severe("Failed to report issue", e, s);
+ if (mounted) {
+ showShortToast(context, l10n.somethingWentWrong);
+ }
+ } finally {
+ if (mounted) {
+ setState(() {
+ _isSending = false;
+ });
+ }
+ }
+ }
+}
diff --git a/mobile/apps/photos/lib/ui/settings_page.dart b/mobile/apps/photos/lib/ui/settings_page.dart
index 875863dc5b..5de2697c24 100644
--- a/mobile/apps/photos/lib/ui/settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings_page.dart
@@ -663,7 +663,7 @@ class _SettingsBody extends StatelessWidget {
EnteColorScheme colorScheme,
) {
return MenuItemWidgetNew(
- title: AppLocalizations.of(context).support,
+ title: AppLocalizations.of(context).helpAndSupport,
leadingIconWidget: _buildIconWidget(
HugeIcons.strokeRoundedHelpCircle,
colorScheme,
diff --git a/mobile/apps/photos/lib/utils/email_util.dart b/mobile/apps/photos/lib/utils/email_util.dart
index ba4dae8865..35d8a22d20 100644
--- a/mobile/apps/photos/lib/utils/email_util.dart
+++ b/mobile/apps/photos/lib/utils/email_util.dart
@@ -1,6 +1,7 @@
import 'dart:io';
import 'package:archive/archive_io.dart';
+import 'package:device_info_plus/device_info_plus.dart';
import 'package:email_validator/email_validator.dart';
import "package:file_saver/file_saver.dart";
import 'package:flutter/cupertino.dart';
@@ -108,22 +109,36 @@ Future<void> _sendLogs(
String? body,
) async {
final String zipFilePath = await getZippedLogsFile(context);
- final Email email = Email(
- recipients: [toEmail],
- subject: subject ?? '',
- body: body ?? '',
- attachmentPaths: [zipFilePath],
- isHTML: false,
+ final didOpenComposer = await sendLogsWithSubjectAndBody(
+ context,
+ toEmail: toEmail,
+ subject: subject,
+ body: body,
+ zipFilePath: zipFilePath,
);
- try {
- await FlutterEmailSender.send(email);
- } catch (e, s) {
- _logger.severe('email sender failed', e, s);
+ if (!didOpenComposer) {
Navigator.of(context).pop();
await shareLogs(context, toEmail, zipFilePath);
}
}
+Future<bool> sendLogsWithSubjectAndBody(
+ BuildContext context, {
+ required String toEmail,
+ String? subject,
+ String? body,
+ String? zipFilePath,
+}) async {
+ final effectiveZipFilePath = zipFilePath ?? await getZippedLogsFile(context);
+ return sendComposedEmail(
+ context,
+ to: toEmail,
+ subject: subject ?? '',
+ body: body ?? '',
+ attachmentPaths: [effectiveZipFilePath],
+ );
+}
+
Future<void> triggerSendLogs(
String toEmail,
String? subject,
@@ -238,80 +253,144 @@ Future<void> sendEmail(
}) async {
try {
final String clientDebugInfo = await _clientInfo();
- final EmailContent emailContent = EmailContent(
- to: [
- to,
- ],
+ final didOpenComposer = await sendComposedEmail(
+ context,
+ to: to,
subject: subject ?? '[Support]',
body: (body ?? '') + clientDebugInfo,
);
+ if (!didOpenComposer) {
+ _showNoMailAppsDialog(context, to);
+ }
+ } catch (e) {
+ _logger.severe("Failed to send emailContent to $to", e);
+ _showNoMailAppsDialog(context, to);
+ }
+}
+
+Future<bool> sendComposedEmail(
+ BuildContext context, {
+ required String to,
+ required String subject,
+ required String body,
+ List<String>? attachmentPaths,
+}) async {
+ try {
+ final hasAttachment = attachmentPaths != null && attachmentPaths.isNotEmpty;
+ if (hasAttachment) {
+ final email = Email(
+ recipients: [to],
+ subject: subject,
+ body: body,
+ attachmentPaths: attachmentPaths,
+ isHTML: false,
+ );
+ await FlutterEmailSender.send(email);
+ return true;
+ }
+
+ final emailContent = EmailContent(
+ to: [to],
+ subject: subject,
+ body: body,
+ );
+
if (Platform.isAndroid) {
// Special handling due to issue in proton mail android client
// https://github.com/ente-io/photos-app/pull/253
- final Uri params = Uri(
+ final encodedSubject = Uri.encodeComponent(subject);
+ final encodedBody = Uri.encodeComponent(body);
+ final params = Uri(
scheme: 'mailto',
path: to,
- query: 'subject=${emailContent.subject}&body=${emailContent.body}',
+ query: 'subject=$encodedSubject&body=$encodedBody',
);
- if (await canLaunchUrl(params)) {
- await launchUrl(params);
- } else {
- // this will trigger _showNoMailAppsDialog
- throw Exception('Could not launch ${params.toString()}');
+ if (!await canLaunchUrl(params)) {
+ return false;
}
- } else {
- final OpenMailAppResult result =
- await OpenMailApp.composeNewEmailInMailApp(
- nativePickerTitle: 'Select emailContent app',
- emailContent: emailContent,
- );
- if (!result.didOpen && !result.canOpen) {
- _showNoMailAppsDialog(context, to);
- } else if (!result.didOpen && result.canOpen) {
- await showCupertinoModalPopup(
- context: context,
- builder: (_) => CupertinoActionSheet(
- title: Text(AppLocalizations.of(context).selectMailApp + " \n $to"),
- actions: [
- for (var app in result.options)
- CupertinoActionSheetAction(
- child: Text(app.name),
- onPressed: () {
- final content = emailContent;
-
- OpenMailApp.composeNewEmailInSpecificMailApp(
- mailApp: app,
- emailContent: content,
- );
+ await launchUrl(params);
+ return true;
+ }
+ final result = await OpenMailApp.composeNewEmailInMailApp(
+ nativePickerTitle: AppLocalizations.of(context).selectMailApp,
+ emailContent: emailContent,
+ );
+ if (!result.didOpen && !result.canOpen) {
+ return false;
+ }
+ if (!result.didOpen && result.canOpen) {
+ await showCupertinoModalPopup(
+ context: context,
+ builder: (_) => CupertinoActionSheet(
+ title: Text(AppLocalizations.of(context).selectMailApp + " \n $to"),
+ actions: [
+ for (final app in result.options)
+ CupertinoActionSheetAction(
+ child: Text(app.name),
+ onPressed: () async {
+ await OpenMailApp.composeNewEmailInSpecificMailApp(
+ mailApp: app,
+ emailContent: emailContent,
+ );
+ if (context.mounted) {
Navigator.of(context).pop();
- },
- ),
- ],
- cancelButton: CupertinoActionSheetAction(
- child: Text(AppLocalizations.of(context).cancel),
- onPressed: () {
- Navigator.of(context).pop();
- },
- ),
+ }
+ },
+ ),
+ ],
+ cancelButton: CupertinoActionSheetAction(
+ child: Text(AppLocalizations.of(context).cancel),
+ onPressed: () {
+ Navigator.of(context).pop();
+ },
),
- );
- }
+ ),
+ );
}
- } catch (e) {
- _logger.severe("Failed to send emailContent to $to", e);
- _showNoMailAppsDialog(context, to);
+ return true;
+ } catch (e, s) {
+ _logger.severe("Failed to send composed email to $to", e, s);
+ return false;
+ }
+}
+
+Future<String> getSupportDeviceInfo() async {
+ final packageInfo = await PackageInfo.fromPlatform();
+ final platformDeviceInfo = await _getPlatformDeviceInfo();
+ final buffer = StringBuffer()
+ ..writeln(
+ "App version: ${packageInfo.version} (${packageInfo.buildNumber})",
+ )
+ ..writeln("OS version: ${platformDeviceInfo.osVersion}")
+ ..write("Device model: ${platformDeviceInfo.deviceModel}");
+ return buffer.toString();
+}
+
+String buildSupportEmailBody({
+ required String message,
+ String? deviceInfo,
+}) {
+ final trimmedMessage = message.trim();
+ final trimmedDeviceInfo = deviceInfo?.trim();
+ if (trimmedDeviceInfo == null || trimmedDeviceInfo.isEmpty) {
+ return trimmedMessage;
}
+ if (trimmedMessage.isEmpty) {
+ return trimmedDeviceInfo;
+ }
+ return "$trimmedMessage\n\n-------------------\n$trimmedDeviceInfo";
}
Future<String> _clientInfo() async {
final packageInfo = await PackageInfo.fromPlatform();
+ final supportDeviceInfo = await getSupportDeviceInfo();
final String debugInfo =
'\n\n\n\n ------------------- \nFollowing information can '
'help us in debugging if you are facing any issue '
'\nRegistered email: ${Configuration.instance.getEmail()}'
'\nClient: ${packageInfo.packageName}'
- '\nVersion : ${packageInfo.version}';
+ '\n$supportDeviceInfo';
return debugInfo;
}
@@ -324,7 +403,38 @@ void _showNoMailAppsDialog(BuildContext context, String toEmail) {
secondButtonLabel: AppLocalizations.of(context).dismiss,
firstButtonOnTap: () async {
await Clipboard.setData(ClipboardData(text: toEmail));
- showShortToast(context, 'Copied');
+ showShortToast(context, AppLocalizations.of(context).copied);
},
);
}
+
+Future<({String osVersion, String deviceModel})>
+ _getPlatformDeviceInfo() async {
+ try {
+ final deviceInfoPlugin = DeviceInfoPlugin();
+ if (Platform.isAndroid) {
+ final androidInfo = await deviceInfoPlugin.androidInfo;
+ final deviceModel =
+ "${androidInfo.manufacturer} ${androidInfo.model}".trim();
+ final osVersion = "Android ${androidInfo.version.release}";
+ return (
+ osVersion: osVersion,
+ deviceModel: deviceModel.isEmpty ? "Android device" : deviceModel,
+ );
+ }
+ if (Platform.isIOS) {
+ final iosInfo = await deviceInfoPlugin.iosInfo;
+ final machine = iosInfo.utsname.machine.trim();
+ return (
+ osVersion: "iOS ${iosInfo.systemVersion}",
+ deviceModel: machine.isEmpty ? iosInfo.model : machine,
+ );
+ }
+ } catch (e, s) {
+ _logger.severe("Failed to fetch platform device info", e, s);
+ }
+ return (
+ osVersion: Platform.operatingSystem,
+ deviceModel: "Unknown device",
+ );
+}