mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-21 22:58:49 +00:00
fix IOS log saving error
This commit is contained in:
parent
1b1172e876
commit
a84b7e7c28
1 changed files with 24 additions and 7 deletions
|
@ -25,6 +25,8 @@ import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||||
import 'package:stackwallet/widgets/stack_text_field.dart';
|
import 'package:stackwallet/widgets/stack_text_field.dart';
|
||||||
import 'package:stackwallet/widgets/textfield_icon_button.dart';
|
import 'package:stackwallet/widgets/textfield_icon_button.dart';
|
||||||
|
|
||||||
|
import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/helpers/stack_file_system.dart';
|
||||||
|
|
||||||
class DebugView extends ConsumerStatefulWidget {
|
class DebugView extends ConsumerStatefulWidget {
|
||||||
const DebugView({Key? key}) : super(key: key);
|
const DebugView({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@ -283,6 +285,8 @@ class _DebugViewState extends ConsumerState<DebugView> {
|
||||||
BlueTextButton(
|
BlueTextButton(
|
||||||
text: "Save logs to file",
|
text: "Save logs to file",
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
|
final systemfile = StackFileSystem();
|
||||||
|
await systemfile.prepareStorage();
|
||||||
Directory rootPath =
|
Directory rootPath =
|
||||||
(await getApplicationDocumentsDirectory());
|
(await getApplicationDocumentsDirectory());
|
||||||
|
|
||||||
|
@ -309,8 +313,9 @@ class _DebugViewState extends ConsumerState<DebugView> {
|
||||||
} else {
|
} else {
|
||||||
path = await FilePicker.platform
|
path = await FilePicker.platform
|
||||||
.getDirectoryPath(
|
.getDirectoryPath(
|
||||||
dialogTitle: "Choose Backup location",
|
dialogTitle: "Choose Log Save Location",
|
||||||
initialDirectory: dir.path,
|
initialDirectory:
|
||||||
|
systemfile.startPath!.path,
|
||||||
lockParentWindow: true,
|
lockParentWindow: true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -332,9 +337,17 @@ class _DebugViewState extends ConsumerState<DebugView> {
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
final filename = await ref
|
bool logssaved = true;
|
||||||
.read(debugServiceProvider)
|
var filename;
|
||||||
.exportToFile(path, eventBus);
|
try {
|
||||||
|
filename = await ref
|
||||||
|
.read(debugServiceProvider)
|
||||||
|
.exportToFile(path, eventBus);
|
||||||
|
} catch (e, s) {
|
||||||
|
logssaved = false;
|
||||||
|
Logging.instance
|
||||||
|
.log("$e $s", level: LogLevel.Error);
|
||||||
|
}
|
||||||
|
|
||||||
shouldPop = true;
|
shouldPop = true;
|
||||||
|
|
||||||
|
@ -346,7 +359,9 @@ class _DebugViewState extends ConsumerState<DebugView> {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => StackOkDialog(
|
builder: (context) => StackOkDialog(
|
||||||
title: "Logs saved to",
|
title: logssaved
|
||||||
|
? "Logs saved to"
|
||||||
|
: "Error Saving Logs",
|
||||||
message: "${path!}/$filename",
|
message: "${path!}/$filename",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -356,7 +371,9 @@ class _DebugViewState extends ConsumerState<DebugView> {
|
||||||
showFloatingFlushBar(
|
showFloatingFlushBar(
|
||||||
type: FlushBarType.info,
|
type: FlushBarType.info,
|
||||||
context: context,
|
context: context,
|
||||||
message: 'Logs file saved',
|
message: logssaved
|
||||||
|
? 'Logs file saved'
|
||||||
|
: "Error Saving Logs",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue