opt.: sftp del dir

This commit is contained in:
lollipopkit
2024-06-05 18:48:44 +08:00
parent 8a9ade355c
commit 40ce37d230
3 changed files with 30 additions and 8 deletions

View File

@@ -341,7 +341,7 @@ ${GithubIds.participants.map((e) => '[$e](${e.url})').join(' ')}
if (Stores.setting.autoCheckAppUpdate.fetch()) { if (Stores.setting.autoCheckAppUpdate.fetch()) {
AppUpdateIface.doUpdate( AppUpdateIface.doUpdate(
build: BuildData.build, build: BuildData.build,
url: '${Urls.cdnBase}/update.json', url: Urls.updateCfg,
context: context, context: context,
); );
} }

View File

@@ -94,7 +94,7 @@ final class _WearHomeState extends State<WearHome> with AfterLayoutMixin {
if (Stores.setting.autoCheckAppUpdate.fetch()) { if (Stores.setting.autoCheckAppUpdate.fetch()) {
AppUpdateIface.doUpdate( AppUpdateIface.doUpdate(
build: BuildData.build, build: BuildData.build,
url: '${Urls.cdnBase}/update.json', url: Urls.updateCfg,
context: context, context: context,
); );
} }

View File

@@ -472,19 +472,41 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
void _delete(SftpName file) { void _delete(SftpName file) {
context.pop(); context.pop();
final isDir = file.attr.isDirectory; final isDir = file.attr.isDirectory;
final useRmr = Stores.setting.sftpRmrDir.fetch(); var useRmr = Stores.setting.sftpRmrDir.fetch();
final text = () { final text = () {
if (isDir && !useRmr) { if (isDir && !useRmr) {
return l10n.askContinue( return l10n.askContinue('${l10n.delete} ${file.filename}');
'${l10n.dirEmpty}\n${l10n.delete} '
'${file.filename}',
);
} }
return l10n.askContinue('${l10n.delete} ${file.filename}'); return l10n.askContinue('${l10n.delete} ${file.filename}');
}(); }();
// Most users don't know that SFTP can't delete a directory which is not
// empty, so we provide a checkbox to let user choose to use `rm -r` or not
context.showRoundDialog( context.showRoundDialog(
child: Text(text),
title: l10n.attention, title: l10n.attention,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ListTile(
title: Text(text),
),
if (!useRmr)
StatefulBuilder(
builder: (_, setState) {
return CheckboxListTile(
title: Text(l10n.sftpRmrDirSummary),
value: useRmr,
onChanged: (val) {
setState(() {
useRmr = val ?? false;
});
},
);
},
),
],
),
actions: [ actions: [
TextButton( TextButton(
onPressed: () => context.pop(), onPressed: () => context.pop(),