Skip to content

Commit

Permalink
opt.: backup page
Browse files Browse the repository at this point in the history
  • Loading branch information
lollipopkit committed Oct 17, 2023
1 parent 8ce2cc5 commit cf231f9
Show file tree
Hide file tree
Showing 12 changed files with 70 additions and 36 deletions.
8 changes: 7 additions & 1 deletion .dart_tool/flutter_gen/gen_l10n/l10n.dart
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,12 @@ abstract class S {
/// **'Made with ❤️ by {myGithub}'**
String madeWithLove(Object myGithub);

/// No description provided for @manual.
///
/// In en, this message translates to:
/// **'Manual'**
String get manual;

/// No description provided for @max.
///
/// In en, this message translates to:
Expand Down Expand Up @@ -1325,7 +1331,7 @@ abstract class S {
/// No description provided for @syncTip.
///
/// In en, this message translates to:
/// **'After auto sync, a restart may be required for some changes to take effect.'**
/// **'A restart may be required for some changes to take effect.'**
String get syncTip;

/// No description provided for @system.
Expand Down
5 changes: 4 additions & 1 deletion .dart_tool/flutter_gen/gen_l10n/l10n_de.dart
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ class SDe extends S {
return 'Erstellt mit ❤️ von $myGithub';
}

@override
String get manual => 'Handbuch';

@override
String get max => 'max';

Expand Down Expand Up @@ -647,7 +650,7 @@ class SDe extends S {
String get suspendTip => 'Die Suspend-Funktion erfordert Root-Rechte und systemd-Unterstützung.';

@override
String get syncTip => 'Nach der automatischen Synchronisierung kann es erforderlich sein, die App neu zu starten, damit bestimmte Änderungen wirksam werden.';
String get syncTip => 'Damit einige Änderungen wirksam werden, kann ein Neustart erforderlich sein.';

@override
String get system => 'Systeme';
Expand Down
5 changes: 4 additions & 1 deletion .dart_tool/flutter_gen/gen_l10n/l10n_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ class SEn extends S {
return 'Made with ❤️ by $myGithub';
}

@override
String get manual => 'Manual';

@override
String get max => 'max';

Expand Down Expand Up @@ -647,7 +650,7 @@ class SEn extends S {
String get suspendTip => 'The suspend function requires root privileges and systemd support.';

@override
String get syncTip => 'After auto sync, a restart may be required for some changes to take effect.';
String get syncTip => 'A restart may be required for some changes to take effect.';

@override
String get system => 'System';
Expand Down
5 changes: 4 additions & 1 deletion .dart_tool/flutter_gen/gen_l10n/l10n_id.dart
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ class SId extends S {
return 'Dibuat dengan ❤️ oleh $myGithub';
}

@override
String get manual => 'Manual';

@override
String get max => 'Max';

Expand Down Expand Up @@ -647,7 +650,7 @@ class SId extends S {
String get suspendTip => 'Fungsi penangguhan memerlukan hak akses root dan dukungan systemd.';

@override
String get syncTip => 'Setelah sinkronisasi otomatis, mungkin perlu memulai ulang aplikasi agar perubahan tertentu dapat diterapkan.';
String get syncTip => 'Pengaktifan ulang mungkin diperlukan agar beberapa perubahan dapat diterapkan.';

@override
String get system => 'Sistem';
Expand Down
10 changes: 8 additions & 2 deletions .dart_tool/flutter_gen/gen_l10n/l10n_zh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ class SZh extends S {
return '用❤️制作 by $myGithub';
}

@override
String get manual => '手动';

@override
String get max => '最大';

Expand Down Expand Up @@ -647,7 +650,7 @@ class SZh extends S {
String get suspendTip => 'suspend 功能需要 root 权限及 systemd 支持。';

@override
String get syncTip => '在自动同步后,可能需要重新启动,某些更改才能生效。';
String get syncTip => '可能需要重新启动,某些更改才能生效。';

@override
String get system => '系统';
Expand Down Expand Up @@ -1136,6 +1139,9 @@ class SZhTw extends SZh {
return '用❤️製作 by $myGithub';
}

@override
String get manual => '手動';

@override
String get max => '最大';

Expand Down Expand Up @@ -1403,7 +1409,7 @@ class SZhTw extends SZh {
String get suspendTip => 'suspend 功能需要 root 權限及 systemd 支持。';

@override
String get syncTip => '在自動同步後,可能需要重新啟動,某些更改才能生效。';
String get syncTip => '可能需要重新啟動,某些更改才能生效。';

@override
String get system => '系統';
Expand Down
8 changes: 8 additions & 0 deletions lib/data/res/ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ class UIs {

static const centerLoading = Center(child: CircularProgressIndicator());

static const centerSizedLoadingSmall = SizedBox(
width: 23,
height: 23,
child: Center(
child: CircularProgressIndicator(),
),
);

static const centerSizedLoading = SizedBox(
width: 77,
height: 77,
Expand Down
3 changes: 2 additions & 1 deletion lib/l10n/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"log": "Log",
"loss": "loss",
"madeWithLove": "Erstellt mit ❤️ von {myGithub}",
"manual": "Handbuch",
"max": "max",
"maxRetryCount": "Anzahl an Verbindungsversuchen",
"maxRetryCountEqual0": "Unbegrenzte Verbindungsversuche zum Server",
Expand Down Expand Up @@ -204,7 +205,7 @@
"success": "Erfolgreich",
"suspend": "Suspend",
"suspendTip": "Die Suspend-Funktion erfordert Root-Rechte und systemd-Unterstützung.",
"syncTip": "Nach der automatischen Synchronisierung kann es erforderlich sein, die App neu zu starten, damit bestimmte Änderungen wirksam werden.",
"syncTip": "Damit einige Änderungen wirksam werden, kann ein Neustart erforderlich sein.",
"system": "Systeme",
"tag": "Tags",
"terminal": "Terminal",
Expand Down
3 changes: 2 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"log": "Log",
"loss": "loss",
"madeWithLove": "Made with ❤️ by {myGithub}",
"manual": "Manual",
"max": "max",
"maxRetryCount": "Number of server reconnection",
"maxRetryCountEqual0": "Will retry again and again.",
Expand Down Expand Up @@ -204,7 +205,7 @@
"success": "Success",
"suspend": "Suspend",
"suspendTip": "The suspend function requires root privileges and systemd support.",
"syncTip": "After auto sync, a restart may be required for some changes to take effect.",
"syncTip": "A restart may be required for some changes to take effect.",
"system": "System",
"tag": "Tags",
"terminal": "Terminal",
Expand Down
3 changes: 2 additions & 1 deletion lib/l10n/app_id.arb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"log": "Catatan",
"loss": "kehilangan",
"madeWithLove": "Dibuat dengan ❤️ oleh {myGithub}",
"manual": "Manual",
"max": "Max",
"maxRetryCount": "Jumlah penyambungan kembali server",
"maxRetryCountEqual0": "Akan mencoba lagi lagi dan lagi.",
Expand Down Expand Up @@ -204,7 +205,7 @@
"success": "Kesuksesan",
"suspend": "Suspend",
"suspendTip": "Fungsi penangguhan memerlukan hak akses root dan dukungan systemd.",
"syncTip": "Setelah sinkronisasi otomatis, mungkin perlu memulai ulang aplikasi agar perubahan tertentu dapat diterapkan.",
"syncTip": "Pengaktifan ulang mungkin diperlukan agar beberapa perubahan dapat diterapkan.",
"system": "Sistem",
"tag": "Tag",
"terminal": "Terminal",
Expand Down
3 changes: 2 additions & 1 deletion lib/l10n/app_zh.arb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"log": "日志",
"loss": "丢包率",
"madeWithLove": "用❤️制作 by {myGithub}",
"manual": "手动",
"max": "最大",
"maxRetryCount": "服务器尝试重连次数",
"maxRetryCountEqual0": "会无限重试",
Expand Down Expand Up @@ -204,7 +205,7 @@
"success": "成功",
"suspend": "挂起",
"suspendTip": "suspend 功能需要 root 权限及 systemd 支持。",
"syncTip": "在自动同步后,可能需要重新启动,某些更改才能生效。",
"syncTip": "可能需要重新启动,某些更改才能生效。",
"system": "系统",
"tag": "标签",
"terminal": "终端",
Expand Down
3 changes: 2 additions & 1 deletion lib/l10n/app_zh_tw.arb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"log": "日誌",
"loss": "丟包率",
"madeWithLove": "用❤️製作 by {myGithub}",
"manual": "手動",
"max": "最大",
"maxRetryCount": "服務器嘗試重連次數",
"maxRetryCountEqual0": "會無限重試",
Expand Down Expand Up @@ -204,7 +205,7 @@
"success": "成功",
"suspend": "挂起",
"suspendTip": "suspend 功能需要 root 權限及 systemd 支持。",
"syncTip": "在自動同步後,可能需要重新啟動,某些更改才能生效。",
"syncTip": "可能需要重新啟動,某些更改才能生效。",
"system": "系統",
"tag": "标签",
"terminal": "终端機",
Expand Down
50 changes: 25 additions & 25 deletions lib/view/page/backup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,30 +52,28 @@ class BackupPage extends StatelessWidget {

Widget _buildManual(BuildContext context) {
return CardX(
ListTile(
ExpandTile(
title: Text(l10n.files),
subtitle: Text(
l10n.backupTip,
style: UIs.textGrey,
),
trailing: SizedBox(
width: 120,
child: Row(
children: [
TextButton(
onPressed: () => _onRestore(context),
child: Text(l10n.restore),
),
TextButton(
onPressed: () async {
await Backup.backup();
await shareFiles([await Paths.bak]);
},
child: Text(l10n.backup),
),
],
initiallyExpanded: true,
children: [
ListTile(
title: Text(l10n.backup),
trailing: const Icon(Icons.save),
subtitle: Text(
l10n.backupTip,
style: UIs.textGrey,
),
onTap: () async {
await Backup.backup();
await shareFiles([await Paths.bak]);
},
),
),
ListTile(
trailing: const Icon(Icons.restore),
title: Text(l10n.restore),
onTap: () => _onRestore(context),
),
],
),
);
}
Expand All @@ -93,7 +91,7 @@ class BackupPage extends StatelessWidget {
ListTile(
title: Text(l10n.auto),
subtitle: const Text(
'Please wait for optimization :)',
'Unavailable, please wait for optimization :)',
style: UIs.textGrey,
),
trailing: StoreSwitch(
Expand All @@ -107,12 +105,12 @@ class BackupPage extends StatelessWidget {
),
),
ListTile(
title: Text('Manual'),
title: Text(l10n.manual),
trailing: ValueBuilder(
listenable: icloudLoading,
build: () {
if (icloudLoading.value) {
return UIs.centerSizedLoading;
return UIs.centerSizedLoadingSmall;
}
return SizedBox(
width: 120,
Expand All @@ -125,6 +123,7 @@ class BackupPage extends StatelessWidget {
for (final file in files) {
await ICloud.download(relativePath: file);
}
icloudLoading.value = false;
},
child: Text(l10n.download),
),
Expand All @@ -136,6 +135,7 @@ class BackupPage extends StatelessWidget {
for (final file in files) {
await ICloud.upload(relativePath: file);
}
icloudLoading.value = false;
},
child: Text(l10n.upload),
),
Expand Down

0 comments on commit cf231f9

Please sign in to comment.