Attach action to report bug on long press (#995)

This commit is contained in:
Vishnu Mohandas 2023-04-17 12:55:20 +05:30 committed by GitHub
commit 5717473e20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View file

@ -32,7 +32,7 @@ class EnteApp extends StatefulWidget {
}) : super(key: key);
static void setLocale(BuildContext context, Locale newLocale) {
_EnteAppState state = context.findAncestorStateOfType<_EnteAppState>()!;
final state = context.findAncestorStateOfType<_EnteAppState>()!;
state.setLocale(newLocale);
}

View file

@ -31,6 +31,7 @@ class MenuItemWidget extends StatefulWidget {
final double trailingExtraMargin;
final FutureVoidCallback? onTap;
final VoidCallback? onDoubleTap;
final VoidCallback? onLongPress;
final Color? menuItemColor;
final bool alignCaptionedTextToLeft;
@ -74,6 +75,7 @@ class MenuItemWidget extends StatefulWidget {
this.trailingExtraMargin = 0.0,
this.onTap,
this.onDoubleTap,
this.onLongPress,
this.menuItemColor,
this.alignCaptionedTextToLeft = false,
this.singleBorderRadius = 4.0,
@ -144,6 +146,7 @@ class _MenuItemWidgetState extends State<MenuItemWidget> {
: GestureDetector(
onTap: _onTap,
onDoubleTap: widget.onDoubleTap,
onLongPress: widget.onLongPress,
onTapDown: _onTapDown,
onTapUp: _onTapUp,
onTapCancel: _onCancel,
@ -260,7 +263,9 @@ class _MenuItemWidgetState extends State<MenuItemWidget> {
}
bool hasPassedGestureCallbacks() {
return widget.onDoubleTap != null || widget.onTap != null;
return widget.onDoubleTap != null ||
widget.onTap != null ||
widget.onLongPress != null;
}
void _onTapUp(details) {

View file

@ -83,7 +83,7 @@ class SupportSectionWidget extends StatelessWidget {
onTap: () async {
await sendLogs(context, S.of(context).reportBug, bugsEmail);
},
onDoubleTap: () async {
onLongPress: () async {
final zipFilePath = await getZippedLogsFile(context);
await shareLogs(context, bugsEmail, zipFilePath);
},