From 8ed6a3869e917777ffab4803cf1dea4d51fc742a Mon Sep 17 00:00:00 2001 From: lollipopkit Date: Thu, 9 May 2024 13:39:11 +0800 Subject: [PATCH] opt.: server tab if landscape & ignore stderr --- ios/Runner.xcodeproj/project.pbxproj | 36 ++++++------- lib/app.dart | 2 +- lib/data/model/app/shell_func.dart | 2 + lib/data/res/build_data.dart | 6 +-- lib/view/page/home/appbar.dart | 25 +++++---- lib/view/page/home/home.dart | 75 ++++++++++++++------------ macos/Runner.xcodeproj/project.pbxproj | 12 ++--- 7 files changed, 87 insertions(+), 71 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index e572f141..24f11f45 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -690,7 +690,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 878; + CURRENT_PROJECT_VERSION = 880; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -700,7 +700,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.878; + MARKETING_VERSION = 1.0.880; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -826,7 +826,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 878; + CURRENT_PROJECT_VERSION = 880; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -836,7 +836,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.878; + MARKETING_VERSION = 1.0.880; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -854,7 +854,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 878; + CURRENT_PROJECT_VERSION = 880; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -864,7 +864,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.878; + MARKETING_VERSION = 1.0.880; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -885,7 +885,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 878; + CURRENT_PROJECT_VERSION = 880; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -898,7 +898,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.878; + MARKETING_VERSION = 1.0.880; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; @@ -924,7 +924,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 878; + CURRENT_PROJECT_VERSION = 880; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -937,7 +937,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.878; + MARKETING_VERSION = 1.0.880; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -960,7 +960,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 878; + CURRENT_PROJECT_VERSION = 880; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -973,7 +973,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.878; + MARKETING_VERSION = 1.0.880; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -996,7 +996,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 878; + CURRENT_PROJECT_VERSION = 880; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_PREVIEWS = YES; @@ -1008,7 +1008,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.878; + MARKETING_VERSION = 1.0.880; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; @@ -1037,7 +1037,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 878; + CURRENT_PROJECT_VERSION = 880; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_PREVIEWS = YES; @@ -1049,7 +1049,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.878; + MARKETING_VERSION = 1.0.880; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_NAME = ServerBox; @@ -1075,7 +1075,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 878; + CURRENT_PROJECT_VERSION = 880; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_PREVIEWS = YES; @@ -1087,7 +1087,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.878; + MARKETING_VERSION = 1.0.880; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_NAME = ServerBox; diff --git a/lib/app.dart b/lib/app.dart index ead54f14..b2db5c4f 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -78,7 +78,7 @@ class MyApp extends StatelessWidget { home: Stores.setting.fullScreen.fetch() ? OrientationBuilder( builder: (_, ori) { - return HomePage(landscape: ori == Orientation.landscape); + return HomePage(fullScreen: ori == Orientation.landscape); }, ) : const HomePage(), diff --git a/lib/data/model/app/shell_func.dart b/lib/data/model/app/shell_func.dart index 4fe19766..64df28ea 100644 --- a/lib/data/model/app/shell_func.dart +++ b/lib/data/model/app/shell_func.dart @@ -148,6 +148,8 @@ isBusybox=\$(ls -l /bin/sh | grep "busybox") userId=\$(id -u) +exec 2>/dev/null + '''); // Write each func for (final func in values) { diff --git a/lib/data/res/build_data.dart b/lib/data/res/build_data.dart index b7b2c403..8f9238b4 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 = 878; + static const int build = 880; static const String engine = "3.19.6"; - static const String buildAt = "2024-05-07 15:22:39"; - static const int modifications = 2; + static const String buildAt = "2024-05-09 13:38:11"; + static const int modifications = 7; static const int script = 45; } diff --git a/lib/view/page/home/appbar.dart b/lib/view/page/home/appbar.dart index 07c0893d..7f3c0d6c 100644 --- a/lib/view/page/home/appbar.dart +++ b/lib/view/page/home/appbar.dart @@ -2,9 +2,11 @@ part of 'home.dart'; final class _AppBar extends CustomAppBar { final ValueNotifier selectIndex; + final ValueNotifier landscape; const _AppBar({ required this.selectIndex, + required this.landscape, super.title, super.actions, super.centerTitle, @@ -12,16 +14,21 @@ final class _AppBar extends CustomAppBar { @override Widget build(BuildContext context) { + final placeholder = SizedBox( + height: CustomAppBar.barHeight ?? 0 + MediaQuery.of(context).padding.top, + ); return ValBuilder( - listenable: selectIndex, - builder: (idx) { - if (idx == AppTab.ssh.index) { - return SizedBox( - height: CustomAppBar.barHeight ?? - 0 + MediaQuery.of(context).padding.top, - ); - } - return super.build(context); + listenable: landscape, + builder: (ls) { + if (ls) return placeholder; + + return ValBuilder( + listenable: selectIndex, + builder: (idx) { + if (idx == AppTab.ssh.index) return placeholder; + return super.build(context); + }, + ); }, ); } diff --git a/lib/view/page/home/home.dart b/lib/view/page/home/home.dart index 1bda878e..ee634728 100644 --- a/lib/view/page/home/home.dart +++ b/lib/view/page/home/home.dart @@ -38,9 +38,9 @@ import 'package:wakelock_plus/wakelock_plus.dart'; part 'appbar.dart'; class HomePage extends StatefulWidget { - final bool landscape; + final bool fullScreen; - const HomePage({super.key, this.landscape = false}); + const HomePage({super.key, this.fullScreen = false}); @override State createState() => _HomePageState(); @@ -54,6 +54,7 @@ class _HomePageState extends State late final PageController _pageController; final _selectIndex = ValueNotifier(0); + final _isLandscape = ValueNotifier(false); bool _switchingPage = false; bool _shouldAuth = false; @@ -78,6 +79,8 @@ class _HomePageState extends State void didChangeDependencies() { super.didChangeDependencies(); l10n = S.of(context)!; + _isLandscape.value = + MediaQuery.of(context).orientation == Orientation.landscape; } @override @@ -127,34 +130,32 @@ class _HomePageState extends State super.build(context); Pros.app.ctx = context; - final appBar = widget.landscape - ? null - : _AppBar( - selectIndex: _selectIndex, - centerTitle: false, - title: const Text(BuildData.name), - actions: [ - ValBuilder( - listenable: - Stores.setting.serverStatusUpdateInterval.listenable(), - builder: (interval) { - if (interval != 0) return UIs.placeholder; - return IconButton( - icon: const Icon(Icons.refresh), - tooltip: 'Refresh', - onPressed: () async { - await Pros.server.refresh(); - }, - ); - }, - ), - IconButton( - icon: const Icon(Icons.developer_mode, size: 21), - tooltip: l10n.debug, - onPressed: () => AppRoute.debug().go(context), - ), - ], - ); + final appBar = _AppBar( + selectIndex: _selectIndex, + landscape: _isLandscape, + centerTitle: false, + title: const Text(BuildData.name), + actions: [ + ValBuilder( + listenable: Stores.setting.serverStatusUpdateInterval.listenable(), + builder: (interval) { + if (interval != 0) return UIs.placeholder; + return IconButton( + icon: const Icon(Icons.refresh), + tooltip: 'Refresh', + onPressed: () async { + await Pros.server.refresh(); + }, + ); + }, + ), + IconButton( + icon: const Icon(Icons.developer_mode, size: 21), + tooltip: l10n.debug, + onPressed: () => AppRoute.debug().go(context), + ), + ], + ); return Scaffold( drawer: _buildDrawer(), appBar: appBar, @@ -169,11 +170,17 @@ class _HomePageState extends State } }, ), - bottomNavigationBar: widget.landscape + bottomNavigationBar: widget.fullScreen ? null - : ListenableBuilder( - listenable: _selectIndex, - builder: (_, __) => _buildBottomBar(), + : ValBuilder( + listenable: _isLandscape, + builder: (ls) { + if (ls) return const SizedBox(); + return ListenableBuilder( + listenable: _selectIndex, + builder: (_, __) => _buildBottomBar(), + ); + }, ), ); } diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index bdb60557..9ae062d6 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 = 878; + CURRENT_PROJECT_VERSION = 880; 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.878; + MARKETING_VERSION = 1.0.880; 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 = 878; + CURRENT_PROJECT_VERSION = 880; 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.878; + MARKETING_VERSION = 1.0.880; 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 = 878; + CURRENT_PROJECT_VERSION = 880; 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.878; + MARKETING_VERSION = 1.0.880; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "Server Box"; PROVISIONING_PROFILE_SPECIFIER = "";