Replaced 'Contact support' dialog with a new 'Report a bug' dialog

This commit is contained in:
ashilkn 2023-01-07 15:11:26 +05:30
parent b7610e4508
commit 872fc4afe1

View file

@ -12,8 +12,10 @@ import 'package:package_info_plus/package_info_plus.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:photos/core/configuration.dart'; import 'package:photos/core/configuration.dart';
import 'package:photos/core/error-reporting/super_logging.dart'; import 'package:photos/core/error-reporting/super_logging.dart';
import 'package:photos/ente_theme_data.dart';
import 'package:photos/ui/common/dialogs.dart'; import 'package:photos/ui/common/dialogs.dart';
import 'package:photos/ui/components/button_widget.dart';
import 'package:photos/ui/components/dialog_widget.dart';
import 'package:photos/ui/components/models/button_type.dart';
import 'package:photos/ui/tools/debug/log_file_viewer.dart'; import 'package:photos/ui/tools/debug/log_file_viewer.dart';
import 'package:photos/utils/dialog_util.dart'; import 'package:photos/utils/dialog_util.dart';
import 'package:photos/utils/toast_util.dart'; import 'package:photos/utils/toast_util.dart';
@ -37,90 +39,51 @@ Future<void> sendLogs(
String? subject, String? subject,
String? body, String? body,
}) async { }) async {
final List<Widget> actions = [ showDialogWidget(
TextButton( context: context,
child: Row( title: "Report a bug",
mainAxisAlignment: MainAxisAlignment.start, icon: Icons.bug_report_outlined,
children: [ body:
Icon(
Icons.feed_outlined,
color: Theme.of(context).iconTheme.color!.withOpacity(0.85),
),
const Padding(padding: EdgeInsets.all(4)),
Text(
"View logs",
style: TextStyle(
color: Theme.of(context)
.colorScheme
.defaultTextColor
.withOpacity(0.85),
),
),
],
),
onPressed: () async {
showDialog(
context: context,
builder: (BuildContext context) {
return LogFileViewer(SuperLogging.logFile!);
},
barrierColor: Colors.black87,
barrierDismissible: false,
);
},
),
TextButton(
child: Text(
title,
style: TextStyle(
color: Theme.of(context).colorScheme.greenAlternative,
),
),
onPressed: () async {
Navigator.of(context, rootNavigator: true).pop('dialog');
await _sendLogs(context, toEmail, subject, body);
if (postShare != null) {
postShare();
}
},
),
];
final List<Widget> content = [];
content.addAll(
[
const Text(
"This will send across logs to help us debug your issue. Please note that file names will be included to help track issues with specific files.", "This will send across logs to help us debug your issue. Please note that file names will be included to help track issues with specific files.",
style: TextStyle( buttons: [
height: 1.5, ButtonWidget(
fontSize: 16, isInAlert: true,
), buttonType: ButtonType.neutral,
labelText: "Report a bug",
buttonAction: ButtonAction.first,
shouldSurfaceExecutionStates: false,
onTap: () async {
await _sendLogs(context, toEmail, subject, body);
if (postShare != null) {
postShare();
}
},
), ),
const Padding(padding: EdgeInsets.all(12)), //isInAlert is false here as we don't want to the dialog to dismiss
Row( //on pressing this button
mainAxisAlignment: MainAxisAlignment.spaceBetween, ButtonWidget(
children: actions, buttonType: ButtonType.secondary,
labelText: "View logs",
buttonAction: ButtonAction.second,
onTap: () async {
showDialog(
context: context,
builder: (BuildContext context) {
return LogFileViewer(SuperLogging.logFile!);
},
barrierColor: Colors.black87,
barrierDismissible: false,
);
},
),
const ButtonWidget(
isInAlert: true,
buttonType: ButtonType.secondary,
labelText: "Cancel",
buttonAction: ButtonAction.cancel,
), ),
], ],
); );
final confirmation = AlertDialog(
title: Text(
title,
style: const TextStyle(
fontSize: 18,
),
),
content: SingleChildScrollView(
child: ListBody(
children: content,
),
),
);
showDialog(
context: context,
builder: (_) {
return confirmation;
},
);
} }
Future<void> _sendLogs( Future<void> _sendLogs(