From 411bef9320fae39c28a655d26dedff7f0b120888 Mon Sep 17 00:00:00 2001 From: lollipopkit Date: Wed, 2 Aug 2023 19:33:52 +0800 Subject: [PATCH] fix: LocalStoragePage.initDir --- ios/Runner.xcodeproj/project.pbxproj | 24 +++--- lib/data/res/build_data.dart | 6 +- lib/view/page/setting.dart | 110 +++++++++++++------------ lib/view/page/storage/local.dart | 15 ++-- macos/Runner.xcodeproj/project.pbxproj | 12 +-- 5 files changed, 86 insertions(+), 81 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 0e1526bf..7f08f890 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -470,7 +470,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 397; + CURRENT_PROJECT_VERSION = 402; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -478,7 +478,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.397; + MARKETING_VERSION = 1.0.402; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -602,7 +602,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 397; + CURRENT_PROJECT_VERSION = 402; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -610,7 +610,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.397; + MARKETING_VERSION = 1.0.402; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -628,7 +628,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 397; + CURRENT_PROJECT_VERSION = 402; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -636,7 +636,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.397; + MARKETING_VERSION = 1.0.402; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -657,7 +657,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 397; + CURRENT_PROJECT_VERSION = 402; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -670,7 +670,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.397; + MARKETING_VERSION = 1.0.402; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; @@ -696,7 +696,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 397; + CURRENT_PROJECT_VERSION = 402; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -709,7 +709,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.397; + MARKETING_VERSION = 1.0.402; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -732,7 +732,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 397; + CURRENT_PROJECT_VERSION = 402; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -745,7 +745,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.397; + MARKETING_VERSION = 1.0.402; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/lib/data/res/build_data.dart b/lib/data/res/build_data.dart index f2b39237..14a64546 100644 --- a/lib/data/res/build_data.dart +++ b/lib/data/res/build_data.dart @@ -2,8 +2,8 @@ class BuildData { static const String name = "ServerBox"; - static const int build = 400; + static const int build = 402; static const String engine = "3.10.6"; - static const String buildAt = "2023-07-31 14:06:15.008140"; - static const int modifications = 9; + static const String buildAt = "2023-08-01 18:49:37.034380"; + static const int modifications = 4; } diff --git a/lib/view/page/setting.dart b/lib/view/page/setting.dart index e653e3fe..e96369f1 100644 --- a/lib/view/page/setting.dart +++ b/lib/view/page/setting.dart @@ -26,6 +26,7 @@ import '../../data/res/build_data.dart'; import '../../data/res/color.dart'; import '../../data/res/path.dart'; import '../../data/res/ui.dart'; +import '../../data/store/server.dart'; import '../../data/store/setting.dart'; import '../../locator.dart'; import '../widget/future_widget.dart'; @@ -329,25 +330,25 @@ class _SettingPageState extends State { _startPageKey.currentState?.showButtonMenu(); }, trailing: ValueBuilder( - listenable: _launchPageIdx, - build: () => PopupMenuButton( - key: _startPageKey, - itemBuilder: (BuildContext context) => items, - initialValue: _launchPageIdx.value, - onSelected: (int idx) { - _launchPageIdx.value = idx; - _setting.launchPage.put(_launchPageIdx.value); - }, - child: ConstrainedBox( - constraints: - BoxConstraints(maxWidth: _media.size.width * 0.35), - child: Text( - tabTitleName(context, AppTab.values[_launchPageIdx.value]), - textAlign: TextAlign.right, - style: textSize15, - ), - ), - )), + listenable: _launchPageIdx, + build: () => PopupMenuButton( + key: _startPageKey, + itemBuilder: (BuildContext context) => items, + initialValue: _launchPageIdx.value, + onSelected: (int idx) { + _launchPageIdx.value = idx; + _setting.launchPage.put(_launchPageIdx.value); + }, + child: ConstrainedBox( + constraints: BoxConstraints(maxWidth: _media.size.width * 0.35), + child: Text( + tabTitleName(context, AppTab.values[_launchPageIdx.value]), + textAlign: TextAlign.right, + style: textSize15, + ), + ), + ), + ), ); } @@ -643,21 +644,22 @@ class _SettingPageState extends State { _localeKey.currentState?.showButtonMenu(); }, trailing: ValueBuilder( - listenable: _localeCode, - build: () => PopupMenuButton( - key: _localeKey, - itemBuilder: (BuildContext context) => items, - initialValue: _localeCode.value, - onSelected: (String idx) { - _localeCode.value = idx; - _setting.locale.put(idx); - _showRestartSnackbar(); - }, - child: Text( - _s.languageName, - style: textSize15, - ), - )), + listenable: _localeCode, + build: () => PopupMenuButton( + key: _localeKey, + itemBuilder: (BuildContext context) => items, + initialValue: _localeCode.value, + onSelected: (String idx) { + _localeCode.value = idx; + _setting.locale.put(idx); + _showRestartSnackbar(); + }, + child: Text( + _s.languageName, + style: textSize15, + ), + ), + ), ); } @@ -946,28 +948,30 @@ class _SettingPageState extends State { title: Text(_s.deleteServers), trailing: const Icon(Icons.delete_forever), onTap: () async { - final all = _serverProvider.servers.keys.map( - (e) => TextButton( - onPressed: () => showRoundDialog( - context: context, - title: Text(_s.attention), - child: Text(_s.sureDelete(e)), - actions: [ - TextButton( - onPressed: () => _serverProvider.delServer(e), - child: Text(_s.ok), - ) - ], - ), - child: Text(e), - ), - ); + final all = locator().box.keys.map( + (e) => TextButton( + onPressed: () => showRoundDialog( + context: context, + title: Text(_s.attention), + child: Text(_s.sureDelete(e)), + actions: [ + TextButton( + onPressed: () => _serverProvider.delServer(e), + child: Text(_s.ok), + ) + ], + ), + child: Text(e), + ), + ); showRoundDialog>( context: context, title: Text(_s.choose), - child: Column( - mainAxisSize: MainAxisSize.min, - children: all.toList(), + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: all.toList(), + ), ), ); }, diff --git a/lib/view/page/storage/local.dart b/lib/view/page/storage/local.dart index 0a233a76..ed53001e 100644 --- a/lib/view/page/storage/local.dart +++ b/lib/view/page/storage/local.dart @@ -42,13 +42,14 @@ class _LocalStoragePageState extends State { @override void initState() { super.initState(); - sftpDir.then((dir) { - _path = PathWithPrefix(dir.path); - if (widget.initDir != null) { - _path!.update(widget.initDir!.replaceFirst('${dir.path}/', '')); - } - setState(() {}); - }); + if (widget.initDir != null) { + _path = PathWithPrefix(widget.initDir!); + } else { + sftpDir.then((dir) { + _path = PathWithPrefix(dir.path); + }); + } + setState(() {}); } @override diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index 908a3146..1ca5633f 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -475,9 +475,9 @@ baseConfigurationReference = C1C758C41C4E208965A68933 /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 400; + CURRENT_PROJECT_VERSION = 402; GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0.400; + MARKETING_VERSION = 1.0.402; PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -490,9 +490,9 @@ baseConfigurationReference = 15AF97DF993E8968098D6EBE /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 400; + CURRENT_PROJECT_VERSION = 402; GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0.400; + MARKETING_VERSION = 1.0.402; PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -505,9 +505,9 @@ baseConfigurationReference = 7CFA7DE7FABA75685DFB6948 /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 400; + CURRENT_PROJECT_VERSION = 402; GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0.400; + MARKETING_VERSION = 1.0.402; PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0;