From 3ad1e7a196132ef7f22e3a8cc8959f2853ece4c0 Mon Sep 17 00:00:00 2001 From: lollipopkit Date: Sat, 30 Mar 2024 17:34:02 +0800 Subject: [PATCH] new: `customCmds` tips --- ios/Runner.xcodeproj/project.pbxproj | 36 ++++++++++++------------- lib/core/utils/platform/auth.dart | 1 + lib/data/model/server/server.ext.dart | 2 +- lib/data/res/build_data.dart | 6 ++--- lib/l10n/app_de.arb | 2 ++ lib/l10n/app_en.arb | 2 ++ lib/l10n/app_es.arb | 2 ++ lib/l10n/app_fr.arb | 2 ++ lib/l10n/app_id.arb | 2 ++ lib/l10n/app_ja.arb | 2 ++ lib/l10n/app_pt.arb | 2 ++ lib/l10n/app_ru.arb | 2 ++ lib/l10n/app_zh.arb | 2 ++ lib/l10n/app_zh_tw.arb | 2 ++ lib/view/page/backup.dart | 9 ++----- lib/view/page/home.dart | 17 +++++------- lib/view/page/server/edit.dart | 37 ++++++++++++++++++-------- lib/view/page/snippet/edit.dart | 3 ++- lib/view/widget/markdown.dart | 37 ++++++++++++++++++++++++++ macos/Runner.xcodeproj/project.pbxproj | 12 ++++----- 20 files changed, 123 insertions(+), 57 deletions(-) create mode 100644 lib/view/widget/markdown.dart diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 304b7eec..0d763706 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -660,7 +660,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 827; + CURRENT_PROJECT_VERSION = 829; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -670,7 +670,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.827; + MARKETING_VERSION = 1.0.829; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -796,7 +796,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 827; + CURRENT_PROJECT_VERSION = 829; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -806,7 +806,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.827; + MARKETING_VERSION = 1.0.829; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -824,7 +824,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 827; + CURRENT_PROJECT_VERSION = 829; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -834,7 +834,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.827; + MARKETING_VERSION = 1.0.829; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -855,7 +855,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 827; + CURRENT_PROJECT_VERSION = 829; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -868,7 +868,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.827; + MARKETING_VERSION = 1.0.829; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; @@ -894,7 +894,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 827; + CURRENT_PROJECT_VERSION = 829; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -907,7 +907,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.827; + MARKETING_VERSION = 1.0.829; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -930,7 +930,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 827; + CURRENT_PROJECT_VERSION = 829; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -943,7 +943,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.827; + MARKETING_VERSION = 1.0.829; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -966,7 +966,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 827; + CURRENT_PROJECT_VERSION = 829; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_PREVIEWS = YES; @@ -978,7 +978,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.827; + MARKETING_VERSION = 1.0.829; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; @@ -1007,7 +1007,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 827; + CURRENT_PROJECT_VERSION = 829; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_PREVIEWS = YES; @@ -1019,7 +1019,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.827; + MARKETING_VERSION = 1.0.829; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_NAME = ServerBox; @@ -1045,7 +1045,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 827; + CURRENT_PROJECT_VERSION = 829; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_PREVIEWS = YES; @@ -1057,7 +1057,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.827; + MARKETING_VERSION = 1.0.829; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_NAME = ServerBox; diff --git a/lib/core/utils/platform/auth.dart b/lib/core/utils/platform/auth.dart index 2fdc0fec..29b702f4 100644 --- a/lib/core/utils/platform/auth.dart +++ b/lib/core/utils/platform/auth.dart @@ -61,6 +61,7 @@ abstract final class BioAuth { localizedReason: l10n.authRequired, options: const AuthenticationOptions( biometricOnly: true, + stickyAuth: true, ), authMessages: [ AndroidAuthMessages( diff --git a/lib/data/model/server/server.ext.dart b/lib/data/model/server/server.ext.dart index d1372390..b049eeaa 100644 --- a/lib/data/model/server/server.ext.dart +++ b/lib/data/model/server/server.ext.dart @@ -6,7 +6,7 @@ extension ServerX on Server { case ServerState.disconnected: return l10n.disconnected; case ServerState.finished: - final cmdTemp = status.customCmds['temperature']; + final cmdTemp = status.customCmds['server_card_top_right']; final temp = status.temps.first; final sensorTemp = SensorItem.findPreferTempVal(status.sensors); final temperatureVal = () { diff --git a/lib/data/res/build_data.dart b/lib/data/res/build_data.dart index 84831cc9..e05052cf 100644 --- a/lib/data/res/build_data.dart +++ b/lib/data/res/build_data.dart @@ -2,9 +2,9 @@ class BuildData { static const String name = "ServerBox"; - static const int build = 827; + static const int build = 829; static const String engine = "3.19.4"; - static const String buildAt = "2024-03-27 09:52:08"; - static const int modifications = 7; + static const String buildAt = "2024-03-30 12:01:58"; + static const int modifications = 5; static const int script = 42; } diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index aabd9f51..fe3fcd6f 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -56,6 +56,7 @@ "createFolder": "Ordner erstellen", "cursorType": "Cursor-Typ", "customCmd": "Benutzerdefinierte Befehle", + "customCmdDocUrl": "https://github.com/lollipopkit/flutter_server_box/wiki#custom-commands", "customCmdHint": "\"Befehlsname\": \"Befehl\"", "dark": "Dunkel", "day": "Tag", @@ -72,6 +73,7 @@ "diskIgnorePath": "Pfad für Datenträger ignorieren", "displayName": "Name anzeigen", "dl2Local": "Datei \"{fileName}\" herunterladen?", + "doc": "Dokumentation", "dockerEditHost": "DOCKER_HOST bearbeiten", "dockerEmptyRunningItems": "Es gibt keine laufenden Container.\nDas könnte daran liegen:\n- Der Docker-Installationsbenutzer ist nicht mit dem in der App konfigurierten Benutzernamen identisch.\n- Die Umgebungsvariable DOCKER_HOST wurde nicht korrekt gelesen. Sie können sie ermitteln, indem Sie `echo $DOCKER_HOST` im Terminal ausführen.", "dockerImagesFmt": "{count} Image(s)", diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index f084892b..64b02e1c 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -56,6 +56,7 @@ "createFolder": "Create folder", "cursorType": "Cursor type", "customCmd": "Custom commands", + "customCmdDocUrl": "https://github.com/lollipopkit/flutter_server_box/wiki#custom-commands", "customCmdHint": "\"Command Name\": \"Command\"", "dark": "Dark", "day": "Day", @@ -72,6 +73,7 @@ "diskIgnorePath": "Ignore path for disk", "displayName": "Display name", "dl2Local": "Download {fileName} to local?", + "doc": "Documentation", "dockerEditHost": "Edit DOCKER_HOST", "dockerEmptyRunningItems": "There are no running containers.\nThis could be because:\n- The Docker installation user is not the same as the username configured within the App.\n- The environment variable DOCKER_HOST was not read correctly. You can get it by running `echo $DOCKER_HOST` in the terminal.", "dockerImagesFmt": "{count} images", diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index bd098aac..848a5395 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -56,6 +56,7 @@ "createFolder": "Crear carpeta", "cursorType": "Tipo de cursor", "customCmd": "Comandos personalizados", + "customCmdDocUrl": "https://github.com/lollipopkit/flutter_server_box/wiki#custom-commands", "customCmdHint": "\"Nombre del comando\": \"Comando\"", "dark": "Oscuro", "day": "Día", @@ -72,6 +73,7 @@ "diskIgnorePath": "Rutas de disco ignoradas", "displayName": "Nombre a mostrar", "dl2Local": "¿Descargar {fileName} a local?", + "doc": "Documentación", "dockerEditHost": "Editar DOCKER_HOST", "dockerEmptyRunningItems": "No hay contenedores en ejecución.\nEsto podría deberse a que:\n- El usuario con el que se instaló Docker es diferente al configurado en la app\n- La variable de entorno DOCKER_HOST no se ha leído correctamente. Puedes obtenerla ejecutando `echo $DOCKER_HOST` en el terminal.", "dockerImagesFmt": "Total de {count} imágenes", diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index eb3b29d9..6ada68a1 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -56,6 +56,7 @@ "createFolder": "Créer un dossier", "cursorType": "Type de curseur", "customCmd": "Commandes personnalisées", + "customCmdDocUrl": "https://github.com/lollipopkit/flutter_server_box/wiki#custom-commands", "customCmdHint": "\"Nom de la commande\": \"Commande\"", "dark": "Sombre", "day": "Jour", @@ -72,6 +73,7 @@ "diskIgnorePath": "Ignorer le chemin pour le disque", "displayName": "Nom affiché", "dl2Local": "Télécharger {fileName} en local?", + "doc": "Documentation", "dockerEditHost": "Modifier DOCKER_HOST", "dockerEmptyRunningItems": "Il n'y a pas de conteneurs en cours d'exécution.\nCela peut être dû au fait que :\n- L'utilisateur de l'installation Docker n'est pas le même que le nom d'utilisateur configuré dans l'App.\n- La variable d'environnement DOCKER_HOST n'a pas été lue correctement. Vous pouvez l'obtenir en exécutant `echo $DOCKER_HOST` dans le terminal.", "dockerImagesFmt": "{count} images", diff --git a/lib/l10n/app_id.arb b/lib/l10n/app_id.arb index 82b5d322..310fe383 100644 --- a/lib/l10n/app_id.arb +++ b/lib/l10n/app_id.arb @@ -56,6 +56,7 @@ "createFolder": "Membuat folder", "cursorType": "Jenis kursor", "customCmd": "Perintah kustom", + "customCmdDocUrl": "https://github.com/lollipopkit/flutter_server_box/wiki#custom-commands", "customCmdHint": "\"Nama Perintah\": \"Perintah\"", "dark": "Gelap", "day": "Hari", @@ -72,6 +73,7 @@ "diskIgnorePath": "Abaikan jalan untuk disk", "displayName": "Nama tampilan", "dl2Local": "Unduh {fileName} ke lokal?", + "doc": "Dokumentasi", "dockerEditHost": "Edit Docker_host", "dockerEmptyRunningItems": "Tidak ada wadah yang sedang berjalan.\nHal ini dapat terjadi karena:\n- Pengguna instalasi Docker tidak sama dengan nama pengguna yang dikonfigurasi di dalam Aplikasi.\n- Variabel lingkungan DOCKER_HOST tidak terbaca dengan benar. Anda bisa mendapatkannya dengan menjalankan `echo $DOCKER_HOST` di terminal.", "dockerImagesFmt": "{count} gambar", diff --git a/lib/l10n/app_ja.arb b/lib/l10n/app_ja.arb index 176a8887..ae81dd69 100644 --- a/lib/l10n/app_ja.arb +++ b/lib/l10n/app_ja.arb @@ -56,6 +56,7 @@ "createFolder": "フォルダーを作成", "cursorType": "カーソルタイプ", "customCmd": "カスタムコマンド", + "customCmdDocUrl": "https://github.com/lollipopkit/flutter_server_box/wiki#custom-commands", "customCmdHint": "\"コマンド名\": \"コマンド\"", "dark": "ダーク", "day": "日", @@ -72,6 +73,7 @@ "diskIgnorePath": "無視されたディスクパス", "displayName": "表示名", "dl2Local": "{fileName}をローカルにダウンロードしますか?", + "doc": "ドキュメント", "dockerEditHost": "DOCKER_HOSTを編集", "dockerEmptyRunningItems": "実行中のコンテナがありません。\nこれは次の理由による可能性があります:\n- Dockerのインストールユーザーとアプリ内の設定されたユーザー名が異なる\n- 環境変数DOCKER_HOSTが正しく読み込まれていない。ターミナルで`echo $DOCKER_HOST`を実行して取得できます。", "dockerImagesFmt": "合計{count}イメージ", diff --git a/lib/l10n/app_pt.arb b/lib/l10n/app_pt.arb index ca6ad543..5a1f8078 100644 --- a/lib/l10n/app_pt.arb +++ b/lib/l10n/app_pt.arb @@ -56,6 +56,7 @@ "createFolder": "Criar pasta", "cursorType": "Tipo de cursor", "customCmd": "Comandos personalizados", + "customCmdDocUrl": "https://github.com/lollipopkit/flutter_server_box/wiki#custom-commands", "customCmdHint": "\"Nome do comando\": \"Comando\"", "dark": "Escuro", "day": "Dia", @@ -72,6 +73,7 @@ "diskIgnorePath": "Caminhos de disco ignorados", "displayName": "Nome de exibição", "dl2Local": "Baixar {fileName} para o local?", + "doc": "Documentação", "dockerEditHost": "Editar DOCKER_HOST", "dockerEmptyRunningItems": "Não há contêineres em execução.\nIsso pode ser porque:\n- O usuário que instalou o Docker difere do usuário configurado no app\n- A variável de ambiente DOCKER_HOST não foi lida corretamente. Você pode verificar isso executando `echo $DOCKER_HOST` no terminal.", "dockerImagesFmt": "Total de {count} imagens", diff --git a/lib/l10n/app_ru.arb b/lib/l10n/app_ru.arb index 33f4ad6c..920708af 100644 --- a/lib/l10n/app_ru.arb +++ b/lib/l10n/app_ru.arb @@ -56,6 +56,7 @@ "createFolder": "создать папку", "cursorType": "Тип курсора", "customCmd": "Пользовательские команды", + "customCmdDocUrl": "https://github.com/lollipopkit/flutter_server_box/wiki#custom-commands", "customCmdHint": "\"Имя команды\": \"Команда\"", "dark": "темная", "day": "День", @@ -72,6 +73,7 @@ "diskIgnorePath": "путь игнорирования диска", "displayName": "отображаемое имя", "dl2Local": "Загрузить {fileName} на локальный диск?", + "doc": "Документация", "dockerEditHost": "редактировать DOCKER_HOST", "dockerEmptyRunningItems": "Нет запущенных контейнеров.\nЭто может быть из-за:\n- пользователя Docker, отличного от пользователя, настроенного в приложении\n- переменной окружения DOCKER_HOST, которая не была правильно считана. Вы можете выполнить `echo $DOCKER_HOST` в терминале, чтобы увидеть ее значение.", "dockerImagesFmt": "Всего {count} образов", diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index 2e158471..9efe68fe 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -56,6 +56,7 @@ "createFolder": "创建文件夹", "cursorType": "光标类型", "customCmd": "自定义命令", + "customCmdDocUrl": "https://github.com/lollipopkit/flutter_server_box/wiki/主页#自定义命令", "customCmdHint": "\"命令名称\": \"命令\"", "dark": "暗", "day": "天", @@ -72,6 +73,7 @@ "diskIgnorePath": "忽略的磁盘路径", "displayName": "显示名称", "dl2Local": "下载 {fileName} 到本地?", + "doc": "文档", "dockerEditHost": "编辑 DOCKER_HOST", "dockerEmptyRunningItems": "没有正在运行的容器。\n这可能是因为:\n- Docker 安装用户与 App 内配置的用户名不同\n- 环境变量 DOCKER_HOST 没有被正确读取。你可以通过在终端内运行 `echo $DOCKER_HOST` 来获取。", "dockerImagesFmt": "共 {count} 个镜像", diff --git a/lib/l10n/app_zh_tw.arb b/lib/l10n/app_zh_tw.arb index 65557582..68a2e58c 100644 --- a/lib/l10n/app_zh_tw.arb +++ b/lib/l10n/app_zh_tw.arb @@ -56,6 +56,7 @@ "createFolder": "創建文件夾", "cursorType": "光標類型", "customCmd": "自定義命令", + "customCmdDocUrl": "https://github.com/lollipopkit/flutter_server_box/wiki/主页#自定义命令", "customCmdHint": "\"命令名稱\": \"命令\"", "dark": "暗", "day": "日", @@ -72,6 +73,7 @@ "diskIgnorePath": "忽略的磁盤路徑", "displayName": "顯示名稱", "dl2Local": "下載 {fileName} 到本地?", + "doc": "文檔", "dockerEditHost": "編輯 DOCKER_HOST", "dockerEmptyRunningItems": "沒有正在運行的容器。\n這可能是因為:\n- Docker 安裝使用者與 App 內配置的使用者名稱不同\n- 環境變量 DOCKER_HOST 沒有被正確讀取。你可以通過在終端內運行 `echo $DOCKER_HOST` 來獲取。", "dockerImagesFmt": "共 {count} 個鏡像", diff --git a/lib/view/page/backup.dart b/lib/view/page/backup.dart index 3d8d0c35..b7416804 100644 --- a/lib/view/page/backup.dart +++ b/lib/view/page/backup.dart @@ -14,10 +14,8 @@ import 'package:toolbox/core/utils/sync/icloud.dart'; import 'package:toolbox/core/utils/platform/base.dart'; import 'package:toolbox/core/utils/share.dart'; import 'package:toolbox/core/utils/sync/webdav.dart'; -import 'package:toolbox/core/utils/ui.dart'; import 'package:toolbox/data/model/app/backup.dart'; import 'package:toolbox/data/model/server/server_private_info.dart'; -import 'package:toolbox/data/res/color.dart'; import 'package:toolbox/data/res/logger.dart'; import 'package:toolbox/data/res/path.dart'; import 'package:toolbox/data/res/store.dart'; @@ -27,6 +25,7 @@ import 'package:toolbox/view/widget/appbar.dart'; import 'package:toolbox/view/widget/expand_tile.dart'; import 'package:toolbox/view/widget/cardx.dart'; import 'package:toolbox/view/widget/input_field.dart'; +import 'package:toolbox/view/widget/markdown.dart'; import 'package:toolbox/view/widget/store_switch.dart'; class BackupPage extends StatelessWidget { @@ -225,15 +224,11 @@ class BackupPage extends StatelessWidget { return CardX( child: ListTile( title: Text(l10n.bulkImportServers), - subtitle: MarkdownBody( + subtitle: SimpleMarkdown( data: l10n.bulkImportServersTip(Urls.appWiki), styleSheet: MarkdownStyleSheet( p: UIs.textGrey, - a: TextStyle(color: primaryColor), ), - onTapLink: (text, href, title) { - if (href != null) openUrl(href); - }, ), leading: const Icon(Icons.import_export), onTap: () => _onBulkImportServers(context), diff --git a/lib/view/page/home.dart b/lib/view/page/home.dart index 3360585c..6a098c38 100644 --- a/lib/view/page/home.dart +++ b/lib/view/page/home.dart @@ -3,7 +3,6 @@ import 'dart:convert'; import 'package:after_layout/after_layout.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; -import 'package:flutter_markdown/flutter_markdown.dart'; import 'package:get_it/get_it.dart'; import 'package:toolbox/core/channel/bg_run.dart'; import 'package:toolbox/core/channel/home_widget.dart'; @@ -13,11 +12,11 @@ import 'package:toolbox/core/persistant_store.dart'; import 'package:toolbox/core/update.dart'; import 'package:toolbox/core/utils/platform/auth.dart'; import 'package:toolbox/core/utils/platform/base.dart'; -import 'package:toolbox/data/res/color.dart'; import 'package:toolbox/data/res/github_id.dart'; import 'package:toolbox/data/res/logger.dart'; import 'package:toolbox/data/res/provider.dart'; import 'package:toolbox/data/res/store.dart'; +import 'package:toolbox/view/widget/markdown.dart'; import '../../core/route.dart'; import '../../core/utils/ui.dart'; @@ -47,6 +46,7 @@ class _HomePageState extends State final _selectIndex = ValueNotifier(0); bool _switchingPage = false; + bool _shouldAuth = false; @override void initState() { @@ -82,13 +82,16 @@ class _HomePageState extends State switch (state) { case AppLifecycleState.resumed: + if (_shouldAuth) { + BioAuth.go().then((_) => _shouldAuth = false); + } if (!Pros.server.isAutoRefreshOn) { Pros.server.startAutoRefresh(); } HomeWidgetMC.update(); break; case AppLifecycleState.paused: - BioAuth.go(); + _shouldAuth = true; // Keep running in background on Android device if (isAndroid && Stores.setting.bgRun.fetch()) { // Keep this if statement single @@ -271,13 +274,7 @@ class _HomePageState extends State return SingleChildScrollView( child: SizedBox( width: MediaQuery.of(context).size.width * 0.8, - child: MarkdownBody( - styleSheet: MarkdownStyleSheet(a: TextStyle(color: primaryColor)), - onTapLink: (text, href, title) { - if (href != null) { - openUrl(href); - } - }, + child: SimpleMarkdown( data: ''' ${l10n.madeWithLove('[lollipopkit](${Urls.myGithub})')} diff --git a/lib/view/page/server/edit.dart b/lib/view/page/server/edit.dart index 597e5b28..e52cc952 100644 --- a/lib/view/page/server/edit.dart +++ b/lib/view/page/server/edit.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'package:flutter/material.dart'; +import 'package:icons_plus/icons_plus.dart'; import 'package:provider/provider.dart'; import 'package:toolbox/core/extension/context/common.dart'; import 'package:toolbox/core/extension/context/dialog.dart'; @@ -8,6 +9,7 @@ import 'package:toolbox/core/extension/context/locale.dart'; import 'package:toolbox/core/extension/context/snackbar.dart'; import 'package:toolbox/core/extension/stringx.dart'; import 'package:toolbox/core/extension/widget.dart'; +import 'package:toolbox/core/utils/ui.dart'; import 'package:toolbox/data/model/app/shell_func.dart'; import 'package:toolbox/data/model/server/custom.dart'; import 'package:toolbox/data/res/provider.dart'; @@ -198,7 +200,7 @@ class _ServerEditPageState extends State { onSubmitted: (_) => _focusScope.requestFocus(_ipFocus), hint: l10n.exampleName, label: l10n.name, - icon: Icons.info, + icon: BoxIcons.bx_rename, obscureText: false, autoCorrect: true, suggestiion: true, @@ -209,7 +211,7 @@ class _ServerEditPageState extends State { onSubmitted: (_) => _focusScope.requestFocus(_portFocus), node: _ipFocus, label: l10n.host, - icon: Icons.computer, + icon: BoxIcons.bx_server, hint: 'example.com', ), Input( @@ -218,7 +220,7 @@ class _ServerEditPageState extends State { node: _portFocus, onSubmitted: (_) => _focusScope.requestFocus(_usernameFocus), label: l10n.port, - icon: Icons.format_list_numbered, + icon: Bootstrap.number_123, hint: '22', ), Input( @@ -235,7 +237,7 @@ class _ServerEditPageState extends State { type: TextInputType.url, node: _alterUrlFocus, label: l10n.alterUrl, - icon: Icons.computer, + icon: MingCute.link_line, hint: 'user@ip:port', ), TagEditor( @@ -361,10 +363,12 @@ class _ServerEditPageState extends State { Input( controller: _pveAddrCtrl, type: TextInputType.url, + icon: MingCute.web_line, label: l10n.addr, hint: 'https://example.com:8006', ), ListTile( + leading: const Icon(MingCute.certificate_line), title: Text(l10n.ignoreCert), subtitle: Text(l10n.pveIgnoreCertTip, style: UIs.text12Grey), trailing: ListenableBuilder( @@ -382,13 +386,24 @@ class _ServerEditPageState extends State { } Widget _buildCustomCmd() { - return Input( - controller: _customCmdCtrl, - type: TextInputType.text, - maxLines: 3, - label: l10n.customCmd, - icon: Icons.code, - hint: '{${l10n.customCmdHint}}', + return ExpandTile( + title: Text(l10n.customCmd), + children: [ + Input( + controller: _customCmdCtrl, + type: TextInputType.text, + maxLines: 3, + label: 'Json', + icon: Icons.code, + hint: '{${l10n.customCmdHint}}', + ), + ListTile( + leading: const Icon(MingCute.doc_line), + title: Text(l10n.doc), + trailing: const Icon(Icons.open_in_new, size: 17), + onTap: () => openUrl(l10n.customCmdDocUrl), + ).card, + ], ); } diff --git a/lib/view/page/snippet/edit.dart b/lib/view/page/snippet/edit.dart index 6c60ad43..385c39bf 100644 --- a/lib/view/page/snippet/edit.dart +++ b/lib/view/page/snippet/edit.dart @@ -8,6 +8,7 @@ import 'package:toolbox/core/extension/context/snackbar.dart'; import 'package:toolbox/data/res/provider.dart'; import 'package:toolbox/view/widget/cardx.dart'; import 'package:toolbox/view/widget/input_field.dart'; +import 'package:toolbox/view/widget/markdown.dart'; import '../../../data/model/server/snippet.dart'; import '../../../data/res/ui.dart'; @@ -196,7 +197,7 @@ class _SnippetEditPageState extends State return CardX( child: Padding( padding: const EdgeInsets.all(13), - child: MarkdownBody( + child: SimpleMarkdown( data: ''' 📌 ${l10n.supportFmtArgs} diff --git a/lib/view/widget/markdown.dart b/lib/view/widget/markdown.dart new file mode 100644 index 00000000..df7442f6 --- /dev/null +++ b/lib/view/widget/markdown.dart @@ -0,0 +1,37 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_markdown/flutter_markdown.dart'; +import 'package:toolbox/core/extension/context/locale.dart'; +import 'package:toolbox/core/extension/context/snackbar.dart'; +import 'package:toolbox/core/utils/ui.dart'; +import 'package:toolbox/data/res/color.dart'; + +final class SimpleMarkdown extends StatelessWidget { + const SimpleMarkdown({ + super.key, + required this.data, + this.styleSheet, + }); + + final String data; + final MarkdownStyleSheet? styleSheet; + + @override + Widget build(BuildContext context) { + return MarkdownBody( + data: data, + onTapLink: (text, href, title) { + if (href != null && href.isNotEmpty) { + openUrl(href); + return; + } + context.showSnackBar(l10n.failed); + }, + styleSheet: styleSheet?.copyWith( + a: TextStyle(color: primaryColor), + ) ?? + MarkdownStyleSheet( + a: TextStyle(color: primaryColor), + ), + ); + } +} diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index ffe70994..5a668914 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -471,7 +471,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 827; + CURRENT_PROJECT_VERSION = 829; DEVELOPMENT_TEAM = BA88US33G6; INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "Server Box"; @@ -481,7 +481,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 1.0.827; + MARKETING_VERSION = 1.0.829; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "Server Box"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -608,7 +608,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 827; + CURRENT_PROJECT_VERSION = 829; DEVELOPMENT_TEAM = BA88US33G6; INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "Server Box"; @@ -618,7 +618,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 1.0.827; + MARKETING_VERSION = 1.0.829; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "Server Box"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -638,7 +638,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "3rd Party Mac Developer Application"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 827; + CURRENT_PROJECT_VERSION = 829; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=macosx*]" = BA88US33G6; INFOPLIST_FILE = Runner/Info.plist; @@ -649,7 +649,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 1.0.827; + MARKETING_VERSION = 1.0.829; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "Server Box"; PROVISIONING_PROFILE_SPECIFIER = "";