add copy bugs to clipboard feature

This commit is contained in:
Marco 2022-10-25 12:56:34 -06:00
parent 592aeef5b1
commit 7a9f2f9ed3
6 changed files with 93 additions and 13 deletions

View file

@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.7.20'
repositories {
google()
jcenter()

View file

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip

View file

@ -1,11 +1,15 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:event_bus/event_bus.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:path_provider/path_provider.dart';
import 'package:stackwallet/models/isar/models/log.dart';
import 'package:stackwallet/notifications/show_flush_bar.dart';
@ -24,9 +28,14 @@ import 'package:stackwallet/widgets/rounded_container.dart';
import 'package:stackwallet/widgets/stack_dialog.dart';
import 'package:stackwallet/widgets/stack_text_field.dart';
import 'package:stackwallet/widgets/textfield_icon_button.dart';
import 'package:flutter_libepiccash/git_versions.dart' as EPIC_VERSIONS;
import 'package:flutter_libmonero/git_versions.dart' as MONERO_VERSIONS;
import 'package:lelantus/git_versions.dart' as FIRO_VERSIONS;
import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/helpers/stack_file_system.dart';
import 'package:stackwallet/utilities/clipboard_interface.dart';
class DebugView extends ConsumerStatefulWidget {
const DebugView({Key? key}) : super(key: key);
@ -270,17 +279,71 @@ class _DebugViewState extends ConsumerState<DebugView> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// BlueTextButton(
// text: ref.watch(debugServiceProvider
// .select((value) => value.isPaused))
// ? "Unpause"
// : "Pause",
// onTap: () {
// ref
// .read(debugServiceProvider)
// .togglePauseUiUpdates();
// },
// ),
BlueTextButton(
text: "Save Debug Info to clipboard",
onTap: () async {
try {
final packageInfo =
await PackageInfo.fromPlatform();
final version = packageInfo.version;
final build = packageInfo.buildNumber;
final signature = packageInfo.buildSignature;
final appName = packageInfo.appName;
String firoCommit =
FIRO_VERSIONS.getPluginVersion();
String epicCashCommit =
EPIC_VERSIONS.getPluginVersion();
String moneroCommit =
MONERO_VERSIONS.getPluginVersion();
DeviceInfoPlugin deviceInfoPlugin =
DeviceInfoPlugin();
final deviceInfo =
await deviceInfoPlugin.deviceInfo;
var deviceInfoMap = deviceInfo.toMap();
deviceInfoMap.remove("systemFeatures");
final logs = filtered(
ref.watch(debugServiceProvider.select(
(value) => value.recentLogs)),
_searchTerm)
.reversed
.toList(growable: false);
List errorLogs = [];
for (var log in logs) {
if (log.logLevel == LogLevel.Error ||
log.logLevel == LogLevel.Fatal) {
errorLogs.add(
"${log.logLevel}: ${log.message}");
}
}
final finalDebugMap = {
"version": version,
"build": build,
"signature": signature,
"appName": appName,
"firoCommit": firoCommit,
"epicCashCommit": epicCashCommit,
"moneroCommit": moneroCommit,
"deviceInfoMap": deviceInfoMap,
"errorLogs": errorLogs,
};
Logging.instance.log(
json.encode(finalDebugMap),
level: LogLevel.Info,
printFullLength: true);
const ClipboardInterface clipboard =
ClipboardWrapper();
await clipboard.setData(
ClipboardData(
text: json.encode(finalDebugMap)),
);
} catch (e, s) {
Logging.instance
.log("$e $s", level: LogLevel.Error);
}
},
),
const Spacer(),
BlueTextButton(
text: "Save logs to file",

View file

@ -6,6 +6,7 @@ import FlutterMacOS
import Foundation
import connectivity_plus_macos
import device_info_plus
import devicelocale
import flutter_libepiccash
import flutter_local_notifications
@ -22,6 +23,7 @@ import window_size
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
DevicelocalePlugin.register(with: registry.registrar(forPlugin: "DevicelocalePlugin"))
FlutterLibepiccashPlugin.register(with: registry.registrar(forPlugin: "FlutterLibepiccashPlugin"))
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))

View file

@ -373,6 +373,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.2"
device_info_plus:
dependency: "direct main"
description:
name: device_info_plus
url: "https://pub.dartlang.org"
source: hosted
version: "7.0.1"
device_info_plus_platform_interface:
dependency: transitive
description:
name: device_info_plus_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.1"
devicelocale:
dependency: "direct main"
description:

View file

@ -115,6 +115,7 @@ dependencies:
wakelock: ^0.6.2
intl: ^0.17.0
devicelocale: ^0.5.0
device_info_plus: ^7.0.1
keyboard_dismisser: ^3.0.0
another_flushbar: ^1.10.28
tuple: ^2.0.0