fix & opt

- fix duplicated ssh connecting
- opt backup page ui
This commit is contained in:
Junyuan Feng
2022-05-23 10:35:42 +08:00
parent 0fdc1b784b
commit 330ff9a621
10 changed files with 57 additions and 33 deletions

View File

@@ -354,7 +354,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 138; CURRENT_PROJECT_VERSION = 140;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@@ -362,7 +362,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.138; MARKETING_VERSION = 1.0.140;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -484,7 +484,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 138; CURRENT_PROJECT_VERSION = 140;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@@ -492,7 +492,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.138; MARKETING_VERSION = 1.0.140;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -508,7 +508,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 138; CURRENT_PROJECT_VERSION = 140;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@@ -516,7 +516,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.138; MARKETING_VERSION = 1.0.140;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

View File

@@ -165,8 +165,7 @@ class ServerProvider extends BusyProvider {
Future<void> _getData(ServerPrivateInfo spi) async { Future<void> _getData(ServerPrivateInfo spi) async {
final idx = _servers.indexWhere((element) => element.info == spi); final idx = _servers.indexWhere((element) => element.info == spi);
final state = _servers[idx].connectionState; final state = _servers[idx].connectionState;
if (_servers[idx].client == null || if (state == ServerConnectionState.failed ||
state == ServerConnectionState.failed ||
state == ServerConnectionState.disconnected) { state == ServerConnectionState.disconnected) {
_servers[idx].connectionState = ServerConnectionState.connecting; _servers[idx].connectionState = ServerConnectionState.connecting;
notifyListeners(); notifyListeners();

View File

@@ -2,9 +2,9 @@
class BuildData { class BuildData {
static const String name = "ServerBox"; static const String name = "ServerBox";
static const int build = 138; static const int build = 140;
static const String engine = static const String engine =
"Flutter 3.0.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision fb57da5f94 (2 days ago) • 2022-05-19 15:50:29 -0700\nEngine • revision caaafc5604\nTools • Dart 2.17.1 • DevTools 2.12.2\n"; "Flutter 3.0.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision fb57da5f94 (2 days ago) • 2022-05-19 15:50:29 -0700\nEngine • revision caaafc5604\nTools • Dart 2.17.1 • DevTools 2.12.2\n";
static const String buildAt = "2022-05-21 20:15:15.896932"; static const String buildAt = "2022-05-22 13:26:17.235297";
static const int modifications = 6; static const int modifications = 3;
} }

View File

@@ -171,6 +171,7 @@ class MessageLookup extends MessageLookupByLibrary {
"pwd": MessageLookupByLibrary.simpleMessage("Password"), "pwd": MessageLookupByLibrary.simpleMessage("Password"),
"rename": MessageLookupByLibrary.simpleMessage("Rename"), "rename": MessageLookupByLibrary.simpleMessage("Rename"),
"reportBugsOnGithubIssue": m9, "reportBugsOnGithubIssue": m9,
"restore": MessageLookupByLibrary.simpleMessage("Restore"),
"restoreSuccess": MessageLookupByLibrary.simpleMessage( "restoreSuccess": MessageLookupByLibrary.simpleMessage(
"Restore success. Restart app to apply."), "Restore success. Restart app to apply."),
"restoreSureWithDate": m10, "restoreSureWithDate": m10,

View File

@@ -68,7 +68,7 @@ class MessageLookup extends MessageLookupByLibrary {
"backDir": MessageLookupByLibrary.simpleMessage("返回上一级"), "backDir": MessageLookupByLibrary.simpleMessage("返回上一级"),
"backup": MessageLookupByLibrary.simpleMessage("备份"), "backup": MessageLookupByLibrary.simpleMessage("备份"),
"backupTip": MessageLookupByLibrary.simpleMessage( "backupTip": MessageLookupByLibrary.simpleMessage(
"导出的数据仅进行了简单加密,请妥善保管。\n恢复的数据(除了设置)不会覆盖现有数据。"), "导出的数据仅进行了简单加密,请妥善保管。\n除了设置项,恢复的数据不会覆盖现有数据。"),
"backupVersionNotMatch": "backupVersionNotMatch":
MessageLookupByLibrary.simpleMessage("备份版本不匹配,无法恢复"), MessageLookupByLibrary.simpleMessage("备份版本不匹配,无法恢复"),
"cancel": MessageLookupByLibrary.simpleMessage("取消"), "cancel": MessageLookupByLibrary.simpleMessage("取消"),
@@ -150,6 +150,7 @@ class MessageLookup extends MessageLookupByLibrary {
"pwd": MessageLookupByLibrary.simpleMessage("密码"), "pwd": MessageLookupByLibrary.simpleMessage("密码"),
"rename": MessageLookupByLibrary.simpleMessage("重命名"), "rename": MessageLookupByLibrary.simpleMessage("重命名"),
"reportBugsOnGithubIssue": m9, "reportBugsOnGithubIssue": m9,
"restore": MessageLookupByLibrary.simpleMessage("恢复"),
"restoreSuccess": "restoreSuccess":
MessageLookupByLibrary.simpleMessage("恢复成功需要重启App来应用更改"), MessageLookupByLibrary.simpleMessage("恢复成功需要重启App来应用更改"),
"restoreSureWithDate": m10, "restoreSureWithDate": m10,

View File

@@ -1251,6 +1251,16 @@ class S {
); );
} }
/// `Restore`
String get restore {
return Intl.message(
'Restore',
name: 'restore',
desc: '',
args: [],
);
}
/// `Are you sure to restore from {date} ?` /// `Are you sure to restore from {date} ?`
String restoreSureWithDate(Object date) { String restoreSureWithDate(Object date) {
return Intl.message( return Intl.message(

View File

@@ -119,6 +119,7 @@
"pingNoServer": "No server to ping.\nPlease add a server in server tab.", "pingNoServer": "No server to ping.\nPlease add a server in server tab.",
"backupTip": "The exported data is simply encrypted. \nPlease keep it safe.\nRestoring will not overwrite existing data (except setting).", "backupTip": "The exported data is simply encrypted. \nPlease keep it safe.\nRestoring will not overwrite existing data (except setting).",
"backup": "Backup", "backup": "Backup",
"restore": "Restore",
"restoreSureWithDate": "Are you sure to restore from {date} ?", "restoreSureWithDate": "Are you sure to restore from {date} ?",
"backupVersionNotMatch": "Backup version is not match.", "backupVersionNotMatch": "Backup version is not match.",
"invalidJson": "Invalid JSON", "invalidJson": "Invalid JSON",

View File

@@ -117,8 +117,9 @@
"noInterface": "没有可用的接口", "noInterface": "没有可用的接口",
"lastTry": "最后尝试", "lastTry": "最后尝试",
"pingNoServer": "没有服务器可用于Ping\n请在服务器tab添加服务器后再试", "pingNoServer": "没有服务器可用于Ping\n请在服务器tab添加服务器后再试",
"backupTip": "导出的数据仅进行了简单加密,请妥善保管。\n恢复的数据(除了设置)不会覆盖现有数据。", "backupTip": "导出的数据仅进行了简单加密,请妥善保管。\n除了设置项,恢复的数据不会覆盖现有数据。",
"backup": "备份", "backup": "备份",
"restore": "恢复",
"restoreSureWithDate": "确定恢复 {date} 的备份吗?", "restoreSureWithDate": "确定恢复 {date} 的备份吗?",
"backupVersionNotMatch": "备份版本不匹配,无法恢复", "backupVersionNotMatch": "备份版本不匹配,无法恢复",
"invalidJson": "无效的json存在格式问题", "invalidJson": "无效的json存在格式问题",

View File

@@ -4,8 +4,10 @@ import 'dart:convert';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:toolbox/core/extension/colorx.dart';
import 'package:toolbox/core/utils.dart'; import 'package:toolbox/core/utils.dart';
import 'package:toolbox/data/model/app/backup.dart'; import 'package:toolbox/data/model/app/backup.dart';
import 'package:toolbox/data/res/color.dart';
import 'package:toolbox/data/res/font_style.dart'; import 'package:toolbox/data/res/font_style.dart';
import 'package:toolbox/data/store/private_key.dart'; import 'package:toolbox/data/store/private_key.dart';
import 'package:toolbox/data/store/server.dart'; import 'package:toolbox/data/store/server.dart';
@@ -13,7 +15,6 @@ import 'package:toolbox/data/store/setting.dart';
import 'package:toolbox/data/store/snippet.dart'; import 'package:toolbox/data/store/snippet.dart';
import 'package:toolbox/generated/l10n.dart'; import 'package:toolbox/generated/l10n.dart';
import 'package:toolbox/locator.dart'; import 'package:toolbox/locator.dart';
import 'package:toolbox/view/widget/round_rect_card.dart';
const backupFormatVersion = 1; const backupFormatVersion = 1;
@@ -46,11 +47,14 @@ class BackupPage extends StatelessWidget {
), ),
), ),
const SizedBox( const SizedBox(
height: 77, height: 107,
), ),
_buildCard(s.import, Icons.download, media, _buildCard(s.restore, Icons.download, media,
() => _showImportDialog(context, s)), () => _showImportDialog(context, s)),
_buildCard(s.export, Icons.file_upload, media, const SizedBox(height: 7),
const Divider(),
const SizedBox(height: 7),
_buildCard(s.backup, Icons.file_upload, media,
() => _showExportDialog(context, s)) () => _showExportDialog(context, s))
], ],
)), )),
@@ -59,20 +63,27 @@ class BackupPage extends StatelessWidget {
Widget _buildCard(String text, IconData icon, MediaQueryData media, Widget _buildCard(String text, IconData icon, MediaQueryData media,
FutureOr Function() onTap) { FutureOr Function() onTap) {
return RoundRectCard(InkWell( final priColor = primaryColor;
onTap: onTap, final textColor = priColor.isBrightColor ? Colors.black : Colors.white;
child: SizedBox( return GestureDetector(
width: media.size.width * 0.77, onTap: onTap,
height: media.size.height * 0.17, child: Container(
child: Column( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(37),
color: priColor
),
width: 87,
height: 37,
child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Icon(icon, size: media.size.height * 0.05), Icon(icon, color: textColor,),
const SizedBox(height: 10), const SizedBox(width: 7),
Text(text, style: TextStyle(fontSize: media.size.height * 0.02)), Text(text, style: TextStyle(color: textColor)),
], ],
), ),
))); ),
);
} }
Future<void> _showExportDialog(BuildContext context, S s) async { Future<void> _showExportDialog(BuildContext context, S s) async {

View File

@@ -420,14 +420,14 @@
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 138; CURRENT_PROJECT_VERSION = 140;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MARKETING_VERSION = 1.0.138; MARKETING_VERSION = 1.0.140;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
@@ -550,14 +550,14 @@
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 138; CURRENT_PROJECT_VERSION = 140;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MARKETING_VERSION = 1.0.138; MARKETING_VERSION = 1.0.140;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -574,14 +574,14 @@
CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 138; CURRENT_PROJECT_VERSION = 140;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MARKETING_VERSION = 1.0.138; MARKETING_VERSION = 1.0.140;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;