mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-30 22:25:54 +00:00
Don't ask android where to save
This commit is contained in:
parent
c803519a42
commit
8243eb1a86
7 changed files with 300 additions and 226 deletions
|
@ -303,13 +303,17 @@ class _DebugViewState extends ConsumerState<DebugView> {
|
||||||
Logging.instance
|
Logging.instance
|
||||||
.log("$e\n$s", level: LogLevel.Error);
|
.log("$e\n$s", level: LogLevel.Error);
|
||||||
}
|
}
|
||||||
|
String? path;
|
||||||
final String? path =
|
if (Platform.isAndroid) {
|
||||||
await FilePicker.platform.getDirectoryPath(
|
path = dir.path;
|
||||||
dialogTitle: "Choose Backup location",
|
} else {
|
||||||
initialDirectory: dir.path,
|
path = await FilePicker.platform
|
||||||
lockParentWindow: true,
|
.getDirectoryPath(
|
||||||
);
|
dialogTitle: "Choose Backup location",
|
||||||
|
initialDirectory: dir.path,
|
||||||
|
lockParentWindow: true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
final eventBus = EventBus();
|
final eventBus = EventBus();
|
||||||
|
@ -328,7 +332,7 @@ class _DebugViewState extends ConsumerState<DebugView> {
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
await ref
|
final filename = await ref
|
||||||
.read(debugServiceProvider)
|
.read(debugServiceProvider)
|
||||||
.exportToFile(path, eventBus);
|
.exportToFile(path, eventBus);
|
||||||
|
|
||||||
|
@ -336,10 +340,26 @@ class _DebugViewState extends ConsumerState<DebugView> {
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
unawaited(showFloatingFlushBar(
|
|
||||||
type: FlushBarType.info,
|
if (Platform.isAndroid) {
|
||||||
context: context,
|
unawaited(
|
||||||
message: 'Logs file saved'));
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => StackOkDialog(
|
||||||
|
title: "Logs saved to",
|
||||||
|
message: "${path!}/$filename",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
unawaited(
|
||||||
|
showFloatingFlushBar(
|
||||||
|
type: FlushBarType.info,
|
||||||
|
context: context,
|
||||||
|
message: 'Logs file saved',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -82,6 +82,17 @@ class _EnableAutoBackupViewState extends ConsumerState<CreateAutoBackupView> {
|
||||||
passwordFocusNode = FocusNode();
|
passwordFocusNode = FocusNode();
|
||||||
passwordRepeatFocusNode = FocusNode();
|
passwordRepeatFocusNode = FocusNode();
|
||||||
|
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||||
|
final dir = await stackFileSystem.prepareStorage();
|
||||||
|
if (mounted) {
|
||||||
|
setState(() {
|
||||||
|
fileLocationController.text = dir.path;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,64 +144,70 @@ class _EnableAutoBackupViewState extends ConsumerState<CreateAutoBackupView> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
TextField(
|
if (!Platform.isAndroid)
|
||||||
onTap: () async {
|
TextField(
|
||||||
try {
|
onTap: Platform.isAndroid
|
||||||
await stackFileSystem.prepareStorage();
|
? null
|
||||||
|
: () async {
|
||||||
|
try {
|
||||||
|
await stackFileSystem.prepareStorage();
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
await stackFileSystem.pickDir(context);
|
await stackFileSystem.pickDir(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
fileLocationController.text =
|
fileLocationController.text =
|
||||||
stackFileSystem.dirPath ?? "";
|
stackFileSystem.dirPath ?? "";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
Logging.instance.log("$e\n$s", level: LogLevel.Error);
|
Logging.instance
|
||||||
}
|
.log("$e\n$s", level: LogLevel.Error);
|
||||||
},
|
}
|
||||||
controller: fileLocationController,
|
},
|
||||||
style: STextStyles.field(context),
|
controller: fileLocationController,
|
||||||
decoration: InputDecoration(
|
style: STextStyles.field(context),
|
||||||
hintText: "Save to...",
|
decoration: InputDecoration(
|
||||||
suffixIcon: UnconstrainedBox(
|
hintText: "Save to...",
|
||||||
child: Row(
|
hintStyle: STextStyles.fieldLabel(context),
|
||||||
children: [
|
suffixIcon: UnconstrainedBox(
|
||||||
const SizedBox(
|
child: Row(
|
||||||
width: 16,
|
children: [
|
||||||
),
|
const SizedBox(
|
||||||
SvgPicture.asset(
|
width: 16,
|
||||||
Assets.svg.folder,
|
),
|
||||||
color: Theme.of(context)
|
SvgPicture.asset(
|
||||||
.extension<StackColors>()!
|
Assets.svg.folder,
|
||||||
.textDark3,
|
color: Theme.of(context)
|
||||||
width: 16,
|
.extension<StackColors>()!
|
||||||
height: 16,
|
.textDark3,
|
||||||
),
|
width: 16,
|
||||||
const SizedBox(
|
height: 16,
|
||||||
width: 12,
|
),
|
||||||
),
|
const SizedBox(
|
||||||
],
|
width: 12,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
key: const Key(
|
||||||
|
"createBackupSaveToFileLocationTextFieldKey"),
|
||||||
|
readOnly: true,
|
||||||
|
toolbarOptions: const ToolbarOptions(
|
||||||
|
copy: true,
|
||||||
|
cut: false,
|
||||||
|
paste: false,
|
||||||
|
selectAll: false,
|
||||||
|
),
|
||||||
|
onChanged: (newValue) {},
|
||||||
),
|
),
|
||||||
key: const Key(
|
if (!Platform.isAndroid)
|
||||||
"createBackupSaveToFileLocationTextFieldKey"),
|
const SizedBox(
|
||||||
readOnly: true,
|
height: 10,
|
||||||
toolbarOptions: const ToolbarOptions(
|
|
||||||
copy: true,
|
|
||||||
cut: false,
|
|
||||||
paste: false,
|
|
||||||
selectAll: false,
|
|
||||||
),
|
),
|
||||||
onChanged: (newValue) {},
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
ClipRRect(
|
ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(
|
borderRadius: BorderRadius.circular(
|
||||||
Constants.size.circularBorderRadius,
|
Constants.size.circularBorderRadius,
|
||||||
|
@ -593,8 +610,15 @@ class _EnableAutoBackupViewState extends ConsumerState<CreateAutoBackupView> {
|
||||||
await showDialog<dynamic>(
|
await showDialog<dynamic>(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
builder: (_) => const StackOkDialog(
|
builder: (_) => Platform.isAndroid
|
||||||
title: "Stack Auto Backup enabled!"),
|
? StackOkDialog(
|
||||||
|
title:
|
||||||
|
"Stack Auto Backup enabled and saved to:",
|
||||||
|
message: fileToSave,
|
||||||
|
)
|
||||||
|
: const StackOkDialog(
|
||||||
|
title:
|
||||||
|
"Stack Auto Backup enabled!"),
|
||||||
);
|
);
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
passwordController.text = "";
|
passwordController.text = "";
|
||||||
|
|
|
@ -64,6 +64,17 @@ class _RestoreFromFileViewState extends State<CreateBackupView> {
|
||||||
passwordFocusNode = FocusNode();
|
passwordFocusNode = FocusNode();
|
||||||
passwordRepeatFocusNode = FocusNode();
|
passwordRepeatFocusNode = FocusNode();
|
||||||
|
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||||
|
final dir = await stackFileSystem.prepareStorage();
|
||||||
|
if (mounted) {
|
||||||
|
setState(() {
|
||||||
|
fileLocationController.text = dir.path;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,88 +124,78 @@ class _RestoreFromFileViewState extends State<CreateBackupView> {
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
Consumer(builder: (context, ref, __) {
|
if (!Platform.isAndroid)
|
||||||
return Container(
|
Consumer(builder: (context, ref, __) {
|
||||||
color: Colors.transparent,
|
return Container(
|
||||||
child: TextField(
|
color: Colors.transparent,
|
||||||
onTap: () async {
|
child: TextField(
|
||||||
try {
|
onTap: Platform.isAndroid
|
||||||
await stackFileSystem.prepareStorage();
|
? null
|
||||||
// ref
|
: () async {
|
||||||
// .read(
|
try {
|
||||||
// shouldShowLockscreenOnResumeStateProvider
|
await stackFileSystem.prepareStorage();
|
||||||
// .state)
|
|
||||||
// .state = false;
|
|
||||||
if (mounted) {
|
|
||||||
await stackFileSystem.pickDir(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Future<void>.delayed(
|
if (mounted) {
|
||||||
// const Duration(seconds: 2),
|
await stackFileSystem
|
||||||
// () => ref
|
.pickDir(context);
|
||||||
// .read(
|
}
|
||||||
// shouldShowLockscreenOnResumeStateProvider
|
|
||||||
// .state)
|
|
||||||
// .state = true,
|
|
||||||
// );
|
|
||||||
|
|
||||||
setState(() {
|
if (mounted) {
|
||||||
fileLocationController.text =
|
setState(() {
|
||||||
stackFileSystem.dirPath ?? "";
|
fileLocationController.text =
|
||||||
});
|
stackFileSystem.dirPath ?? "";
|
||||||
} catch (e, s) {
|
});
|
||||||
// ref
|
}
|
||||||
// .read(
|
} catch (e, s) {
|
||||||
// shouldShowLockscreenOnResumeStateProvider
|
Logging.instance.log("$e\n$s",
|
||||||
// .state)
|
level: LogLevel.Error);
|
||||||
// .state = true;
|
}
|
||||||
Logging.instance
|
},
|
||||||
.log("$e\n$s", level: LogLevel.Error);
|
controller: fileLocationController,
|
||||||
}
|
style: STextStyles.field(context),
|
||||||
},
|
decoration: InputDecoration(
|
||||||
controller: fileLocationController,
|
hintText: "Save to...",
|
||||||
style: STextStyles.field(context),
|
hintStyle: STextStyles.fieldLabel(context),
|
||||||
decoration: InputDecoration(
|
suffixIcon: UnconstrainedBox(
|
||||||
hintText: "Save to...",
|
child: Row(
|
||||||
suffixIcon: UnconstrainedBox(
|
children: [
|
||||||
child: Row(
|
const SizedBox(
|
||||||
children: [
|
width: 16,
|
||||||
const SizedBox(
|
),
|
||||||
width: 16,
|
SvgPicture.asset(
|
||||||
),
|
Assets.svg.folder,
|
||||||
SvgPicture.asset(
|
color: Theme.of(context)
|
||||||
Assets.svg.folder,
|
.extension<StackColors>()!
|
||||||
color: Theme.of(context)
|
.textDark3,
|
||||||
.extension<StackColors>()!
|
width: 16,
|
||||||
.textDark3,
|
height: 16,
|
||||||
width: 16,
|
),
|
||||||
height: 16,
|
const SizedBox(
|
||||||
),
|
width: 12,
|
||||||
const SizedBox(
|
),
|
||||||
width: 12,
|
],
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
key: const Key(
|
||||||
|
"createBackupSaveToFileLocationTextFieldKey"),
|
||||||
|
readOnly: true,
|
||||||
|
toolbarOptions: const ToolbarOptions(
|
||||||
|
copy: true,
|
||||||
|
cut: false,
|
||||||
|
paste: false,
|
||||||
|
selectAll: false,
|
||||||
|
),
|
||||||
|
onChanged: (newValue) {
|
||||||
|
// ref.read(addressEntryDataProvider(widget.id)).address = newValue;
|
||||||
|
},
|
||||||
),
|
),
|
||||||
key: const Key(
|
);
|
||||||
"createBackupSaveToFileLocationTextFieldKey"),
|
}),
|
||||||
readOnly: true,
|
if (!Platform.isAndroid)
|
||||||
toolbarOptions: const ToolbarOptions(
|
const SizedBox(
|
||||||
copy: true,
|
height: 8,
|
||||||
cut: false,
|
),
|
||||||
paste: false,
|
|
||||||
selectAll: false,
|
|
||||||
),
|
|
||||||
onChanged: (newValue) {
|
|
||||||
// ref.read(addressEntryDataProvider(widget.id)).address = newValue;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
const SizedBox(
|
|
||||||
height: 8,
|
|
||||||
),
|
|
||||||
ClipRRect(
|
ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(
|
borderRadius: BorderRadius.circular(
|
||||||
Constants.size.circularBorderRadius,
|
Constants.size.circularBorderRadius,
|
||||||
|
@ -315,8 +316,12 @@ class _RestoreFromFileViewState extends State<CreateBackupView> {
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.accentColorRed
|
.accentColorRed
|
||||||
: passwordStrength < 1
|
: passwordStrength < 1
|
||||||
? Theme.of(context).extension<StackColors>()!.accentColorYellow
|
? Theme.of(context)
|
||||||
: Theme.of(context).extension<StackColors>()!.accentColorGreen,
|
.extension<StackColors>()!
|
||||||
|
.accentColorYellow
|
||||||
|
: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.accentColorGreen,
|
||||||
backgroundColor: Theme.of(context)
|
backgroundColor: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.buttonBackSecondary,
|
.buttonBackSecondary,
|
||||||
|
@ -389,8 +394,12 @@ class _RestoreFromFileViewState extends State<CreateBackupView> {
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
TextButton(
|
TextButton(
|
||||||
style: shouldEnableCreate
|
style: shouldEnableCreate
|
||||||
? Theme.of(context) .extension<StackColors>()!.getPrimaryEnabledButtonColor(context)
|
? Theme.of(context)
|
||||||
: Theme.of(context) .extension<StackColors>()!.getPrimaryDisabledButtonColor(context),
|
.extension<StackColors>()!
|
||||||
|
.getPrimaryEnabledButtonColor(context)
|
||||||
|
: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.getPrimaryDisabledButtonColor(context),
|
||||||
onPressed: !shouldEnableCreate
|
onPressed: !shouldEnableCreate
|
||||||
? null
|
? null
|
||||||
: () async {
|
: () async {
|
||||||
|
@ -468,8 +477,14 @@ class _RestoreFromFileViewState extends State<CreateBackupView> {
|
||||||
await showDialog<dynamic>(
|
await showDialog<dynamic>(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
builder: (_) => const StackOkDialog(
|
builder: (_) => Platform.isAndroid
|
||||||
title: "Backup creation succeeded"),
|
? StackOkDialog(
|
||||||
|
title: "Backup saved to:",
|
||||||
|
message: fileToSave,
|
||||||
|
)
|
||||||
|
: const StackOkDialog(
|
||||||
|
title:
|
||||||
|
"Backup creation succeeded"),
|
||||||
);
|
);
|
||||||
passwordController.text = "";
|
passwordController.text = "";
|
||||||
passwordRepeatController.text = "";
|
passwordRepeatController.text = "";
|
||||||
|
|
|
@ -84,6 +84,17 @@ class _EditAutoBackupViewState extends ConsumerState<EditAutoBackupView> {
|
||||||
passwordFocusNode = FocusNode();
|
passwordFocusNode = FocusNode();
|
||||||
passwordRepeatFocusNode = FocusNode();
|
passwordRepeatFocusNode = FocusNode();
|
||||||
|
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||||
|
final dir = await stackFileSystem.prepareStorage();
|
||||||
|
if (mounted) {
|
||||||
|
setState(() {
|
||||||
|
fileLocationController.text = dir.path;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,64 +146,70 @@ class _EditAutoBackupViewState extends ConsumerState<EditAutoBackupView> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
TextField(
|
if (!Platform.isAndroid)
|
||||||
onTap: () async {
|
TextField(
|
||||||
try {
|
onTap: Platform.isAndroid
|
||||||
await stackFileSystem.prepareStorage();
|
? null
|
||||||
|
: () async {
|
||||||
|
try {
|
||||||
|
await stackFileSystem.prepareStorage();
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
await stackFileSystem.pickDir(context);
|
await stackFileSystem.pickDir(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
fileLocationController.text =
|
fileLocationController.text =
|
||||||
stackFileSystem.dirPath ?? "";
|
stackFileSystem.dirPath ?? "";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
Logging.instance.log("$e\n$s", level: LogLevel.Error);
|
Logging.instance
|
||||||
}
|
.log("$e\n$s", level: LogLevel.Error);
|
||||||
},
|
}
|
||||||
controller: fileLocationController,
|
},
|
||||||
style: STextStyles.field(context),
|
controller: fileLocationController,
|
||||||
decoration: InputDecoration(
|
style: STextStyles.field(context),
|
||||||
hintText: "Save to...",
|
decoration: InputDecoration(
|
||||||
suffixIcon: UnconstrainedBox(
|
hintText: "Save to...",
|
||||||
child: Row(
|
hintStyle: STextStyles.fieldLabel(context),
|
||||||
children: [
|
suffixIcon: UnconstrainedBox(
|
||||||
const SizedBox(
|
child: Row(
|
||||||
width: 16,
|
children: [
|
||||||
),
|
const SizedBox(
|
||||||
SvgPicture.asset(
|
width: 16,
|
||||||
Assets.svg.folder,
|
),
|
||||||
color: Theme.of(context)
|
SvgPicture.asset(
|
||||||
.extension<StackColors>()!
|
Assets.svg.folder,
|
||||||
.textDark3,
|
color: Theme.of(context)
|
||||||
width: 16,
|
.extension<StackColors>()!
|
||||||
height: 16,
|
.textDark3,
|
||||||
),
|
width: 16,
|
||||||
const SizedBox(
|
height: 16,
|
||||||
width: 12,
|
),
|
||||||
),
|
const SizedBox(
|
||||||
],
|
width: 12,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
key: const Key(
|
||||||
|
"createBackupSaveToFileLocationTextFieldKey"),
|
||||||
|
readOnly: true,
|
||||||
|
toolbarOptions: const ToolbarOptions(
|
||||||
|
copy: true,
|
||||||
|
cut: false,
|
||||||
|
paste: false,
|
||||||
|
selectAll: false,
|
||||||
|
),
|
||||||
|
onChanged: (newValue) {},
|
||||||
),
|
),
|
||||||
key: const Key(
|
if (!Platform.isAndroid)
|
||||||
"createBackupSaveToFileLocationTextFieldKey"),
|
const SizedBox(
|
||||||
readOnly: true,
|
height: 10,
|
||||||
toolbarOptions: const ToolbarOptions(
|
|
||||||
copy: true,
|
|
||||||
cut: false,
|
|
||||||
paste: false,
|
|
||||||
selectAll: false,
|
|
||||||
),
|
),
|
||||||
onChanged: (newValue) {},
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
ClipRRect(
|
ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(
|
borderRadius: BorderRadius.circular(
|
||||||
Constants.size.circularBorderRadius,
|
Constants.size.circularBorderRadius,
|
||||||
|
@ -594,8 +611,14 @@ class _EditAutoBackupViewState extends ConsumerState<EditAutoBackupView> {
|
||||||
await showDialog<dynamic>(
|
await showDialog<dynamic>(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
builder: (_) => const StackOkDialog(
|
builder: (_) => Platform.isAndroid
|
||||||
title: "Stack Auto Backup saved"),
|
? StackOkDialog(
|
||||||
|
title:
|
||||||
|
"Stack Auto Backup saved to:",
|
||||||
|
message: fileToSave,
|
||||||
|
)
|
||||||
|
: const StackOkDialog(
|
||||||
|
title: "Stack Auto Backup saved"),
|
||||||
);
|
);
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
passwordController.text = "";
|
passwordController.text = "";
|
||||||
|
|
|
@ -13,7 +13,7 @@ class StackFileSystem {
|
||||||
|
|
||||||
final bool isDesktop = !(Platform.isAndroid || Platform.isIOS);
|
final bool isDesktop = !(Platform.isAndroid || Platform.isIOS);
|
||||||
|
|
||||||
Future<void> prepareStorage() async {
|
Future<Directory> prepareStorage() async {
|
||||||
rootPath = (await getApplicationDocumentsDirectory());
|
rootPath = (await getApplicationDocumentsDirectory());
|
||||||
debugPrint(rootPath!.absolute.toString());
|
debugPrint(rootPath!.absolute.toString());
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
|
@ -47,6 +47,7 @@ class StackFileSystem {
|
||||||
debugPrint("$e $s");
|
debugPrint("$e $s");
|
||||||
}
|
}
|
||||||
startPath = sampleFolder;
|
startPath = sampleFolder;
|
||||||
|
return sampleFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> pickDir(BuildContext context) async {
|
Future<void> pickDir(BuildContext context) async {
|
||||||
|
|
|
@ -99,29 +99,17 @@ class _RestoreFromFileViewState extends ConsumerState<RestoreFromFileView> {
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
try {
|
try {
|
||||||
await stackFileSystem.prepareStorage();
|
await stackFileSystem.prepareStorage();
|
||||||
// ref
|
if (mounted) {
|
||||||
// .read(shouldShowLockscreenOnResumeStateProvider
|
await stackFileSystem.openFile(context);
|
||||||
// .state)
|
}
|
||||||
// .state = false;
|
|
||||||
await stackFileSystem.openFile(context);
|
|
||||||
|
|
||||||
// Future<void>.delayed(
|
if (mounted) {
|
||||||
// const Duration(seconds: 2),
|
setState(() {
|
||||||
// () => ref
|
fileLocationController.text =
|
||||||
// .read(
|
stackFileSystem.filePath ?? "";
|
||||||
// shouldShowLockscreenOnResumeStateProvider
|
});
|
||||||
// .state)
|
}
|
||||||
// .state = true,
|
|
||||||
// );
|
|
||||||
|
|
||||||
fileLocationController.text =
|
|
||||||
stackFileSystem.filePath ?? "";
|
|
||||||
setState(() {});
|
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
// ref
|
|
||||||
// .read(shouldShowLockscreenOnResumeStateProvider
|
|
||||||
// .state)
|
|
||||||
// .state = true;
|
|
||||||
Logging.instance
|
Logging.instance
|
||||||
.log("$e\n$s", level: LogLevel.Error);
|
.log("$e\n$s", level: LogLevel.Error);
|
||||||
}
|
}
|
||||||
|
@ -130,6 +118,7 @@ class _RestoreFromFileViewState extends ConsumerState<RestoreFromFileView> {
|
||||||
style: STextStyles.field(context),
|
style: STextStyles.field(context),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Choose file...",
|
hintText: "Choose file...",
|
||||||
|
hintStyle: STextStyles.fieldLabel(context),
|
||||||
suffixIcon: UnconstrainedBox(
|
suffixIcon: UnconstrainedBox(
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
|
|
@ -75,7 +75,8 @@ class DebugService extends ChangeNotifier {
|
||||||
level: LogLevel.Info);
|
level: LogLevel.Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> exportToFile(String directory, EventBus eventBus) async {
|
/// returns the filename of the saved logs file
|
||||||
|
Future<String> exportToFile(String directory, EventBus eventBus) async {
|
||||||
final now = DateTime.now();
|
final now = DateTime.now();
|
||||||
final filename =
|
final filename =
|
||||||
"Stack_Wallet_logs_${now.year}_${now.month}_${now.day}_${now.hour}_${now.minute}_${now.second}.txt";
|
"Stack_Wallet_logs_${now.year}_${now.month}_${now.day}_${now.hour}_${now.minute}_${now.second}.txt";
|
||||||
|
@ -99,5 +100,6 @@ class DebugService extends ChangeNotifier {
|
||||||
await sink.close();
|
await sink.close();
|
||||||
|
|
||||||
eventBus.fire(1.0);
|
eventBus.fire(1.0);
|
||||||
|
return filename;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue