Merge branch 'dev'

This commit is contained in:
lollipopkit
2024-06-06 21:26:03 +08:00
31 changed files with 114 additions and 49 deletions

View File

@@ -206,7 +206,10 @@ class _ContainerPageState extends State<ContainerPage> {
],
),
Text(
'${item.image ?? l10n.unknown} - ${item.running ? l10n.running : l10n.stopped}',
'${item.image ?? l10n.unknown} - ${switch (item) {
final PodmanPs ps => ps.running ? l10n.running : l10n.stopped,
final DockerPs ps => ps.state,
}}',
style: UIs.text13Grey,
),
_buildPsItemStats(item),
@@ -550,7 +553,10 @@ class _ContainerPageState extends State<ContainerPage> {
case ContainerMenu.logs:
AppRoutes.ssh(
spi: widget.spi,
initCmd: 'docker logs -f --tail 100 ${dItem.id}',
initCmd: '${switch (_container.type) {
ContainerType.podman => 'podman',
ContainerType.docker => 'docker',
}} logs -f --tail 100 ${dItem.id}',
).go(context);
break;
case ContainerMenu.terminal:

View File

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

View File

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

View File

@@ -1066,6 +1066,7 @@ class _SettingPageState extends State<SettingPage> {
leading: const Icon(MingCute.more_3_fill),
title: Text(l10n.more),
children: [
_buildBeta(),
_buildWakeLock(),
if (isAndroid || isIOS) _buildCollectUsage(),
_buildCollapseUI(),
@@ -1195,4 +1196,12 @@ class _SettingPageState extends State<SettingPage> {
},
);
}
Widget _buildBeta() {
return ListTile(
title: const Text('Beta Program'),
subtitle: Text(l10n.acceptBeta, style: UIs.textGrey),
trailing: StoreSwitch(prop: _setting.betaTest),
);
}
}

View File

@@ -515,9 +515,9 @@ class _SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin {
_terminalStyle = TerminalStyle.fromTextStyle(textStyle);
}
Future<void> _showHelp() async {
void _showHelp() {
if (!Stores.setting.sshTermHelpShown.fetch()) {
await context.showRoundDialog(
context.showRoundDialog(
title: l10n.doc,
child: Text(l10n.sshTermHelp),
actions: [

View File

@@ -472,19 +472,41 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
void _delete(SftpName file) {
context.pop();
final isDir = file.attr.isDirectory;
final useRmr = Stores.setting.sftpRmrDir.fetch();
var useRmr = Stores.setting.sftpRmrDir.fetch();
final text = () {
if (isDir && !useRmr) {
return l10n.askContinue(
'${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(
child: Text(text),
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: [
TextButton(
onPressed: () => context.pop(),