mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 17:28:40 +00:00
share debug log
This commit is contained in:
parent
b92d5de4b1
commit
d3104897f7
3 changed files with 37 additions and 6 deletions
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:share_plus/share_plus.dart';
|
||||||
import 'package:twonly/src/utils/misc.dart';
|
import 'package:twonly/src/utils/misc.dart';
|
||||||
|
|
||||||
class DiagnosticsView extends StatefulWidget {
|
class DiagnosticsView extends StatefulWidget {
|
||||||
|
|
@ -52,14 +53,27 @@ class _DiagnosticsViewState extends State<DiagnosticsView> {
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
Clipboard.setData(ClipboardData(text: logText));
|
final directory =
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
await getApplicationSupportDirectory();
|
||||||
const SnackBar(
|
final logFile = XFile('${directory.path}/app.log');
|
||||||
content: Text('Log copied to clipboard!')),
|
|
||||||
|
final params = ShareParams(
|
||||||
|
text: 'Debug log',
|
||||||
|
files: [logFile],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final result = await SharePlus.instance.share(params);
|
||||||
|
|
||||||
|
if (result.status != ShareResultStatus.success) {
|
||||||
|
Clipboard.setData(ClipboardData(text: logText));
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(
|
||||||
|
content: Text('Log copied to clipboard!')),
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: const Text('Copy All Text'),
|
child: const Text('Share debug log'),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: _scrollToBottom,
|
onPressed: _scrollToBottom,
|
||||||
|
|
|
||||||
16
pubspec.lock
16
pubspec.lock
|
|
@ -1396,6 +1396,22 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.0"
|
version: "3.0.0"
|
||||||
|
share_plus:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: share_plus
|
||||||
|
sha256: b2961506569e28948d75ec346c28775bb111986bb69dc6a20754a457e3d97fa0
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "11.0.0"
|
||||||
|
share_plus_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: share_plus_platform_interface
|
||||||
|
sha256: "1032d392bc5d2095a77447a805aa3f804d2ae6a4d5eef5e6ebb3bd94c1bc19ef"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.0.0"
|
||||||
shared_preferences:
|
shared_preferences:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ dependencies:
|
||||||
get: ^4.7.2
|
get: ^4.7.2
|
||||||
video_player: ^2.9.5
|
video_player: ^2.9.5
|
||||||
video_compress: ^3.1.4
|
video_compress: ^3.1.4
|
||||||
|
share_plus: ^11.0.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue