From b4d42eecf378f6a8b39a2179b0fe558bc18b1c51 Mon Sep 17 00:00:00 2001 From: Junyuan Feng Date: Fri, 20 May 2022 19:51:14 +0800 Subject: [PATCH] fix - multi dialog on apt pwd request - update dialog condition error --- ios/Runner.xcodeproj/project.pbxproj | 12 ++++++------ lib/core/update.dart | 9 +++++---- lib/data/provider/apt.dart | 9 +++++++-- lib/data/res/build_data.dart | 8 ++++---- lib/view/page/apt.dart | 6 ++++-- macos/Runner.xcodeproj/project.pbxproj | 12 ++++++------ make.dart | 2 +- 7 files changed, 33 insertions(+), 25 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 15fbd7df..b9c070f3 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -354,7 +354,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 136; + CURRENT_PROJECT_VERSION = 137; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -362,7 +362,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.136; + MARKETING_VERSION = 1.0.137; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -484,7 +484,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 136; + CURRENT_PROJECT_VERSION = 137; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -492,7 +492,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.136; + MARKETING_VERSION = 1.0.137; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -508,7 +508,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 136; + CURRENT_PROJECT_VERSION = 137; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -516,7 +516,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.136; + MARKETING_VERSION = 1.0.137; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/lib/core/update.dart b/lib/core/update.dart index b8e29f95..d6f3790a 100644 --- a/lib/core/update.dart +++ b/lib/core/update.dart @@ -65,10 +65,11 @@ Future doUpdate(BuildContext context, {bool force = false}) async { await RUpgrade.upgradeFromAppStore('1586449703'); } else if (Platform.isMacOS) { await RUpgrade.upgradeFromUrl(update.mac); + } else { + showRoundDialog(context, s.attention, Text(s.platformNotSupportUpdate), [ + TextButton( + onPressed: () => Navigator.of(context).pop(), child: Text(s.ok)) + ]); } - showRoundDialog(context, s.attention, Text(s.platformNotSupportUpdate), [ - TextButton( - onPressed: () => Navigator.of(context).pop(), child: Text(s.ok)) - ]); }); } diff --git a/lib/data/provider/apt.dart b/lib/data/provider/apt.dart index da9d8676..b2ac2f1e 100644 --- a/lib/data/provider/apt.dart +++ b/lib/data/provider/apt.dart @@ -30,6 +30,7 @@ class AptProvider extends BusyProvider { String? updateLog; String lastLog = ''; int triedTimes = 0; + bool isRequestingPwd = false; AptProvider(); @@ -55,6 +56,7 @@ class AptProvider extends BusyProvider { onUpdate = null; onPasswordRequest = null; triedTimes = 0; + isRequestingPwd = false; } Future refreshInstalled() async { @@ -144,19 +146,22 @@ class AptProvider extends BusyProvider { } Future _onPwd(Uint8List e, StreamSink stdin) async { + if (isRequestingPwd) return; + isRequestingPwd = true; final event = e.string; if (event.contains('[sudo] password for ')) { final user = pwdRequestWithUserReg.firstMatch(event)?.group(1); logger.info('sudo password request for $user'); triedTimes++; - final pwd = - await (onPasswordRequest ?? (_) async => '')(triedTimes == 3, user); + final pwd = await (onPasswordRequest ?? (_, __) async => '')( + triedTimes == 3, user); if (pwd.isEmpty) { logger.info('sudo password request cancelled'); return; } stdin.add(Uint8List.fromList(utf8.encode('$pwd\n'))); } + isRequestingPwd = false; } String _wrap(String cmd) => diff --git a/lib/data/res/build_data.dart b/lib/data/res/build_data.dart index 062168cd..7ddbe5dc 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 = 136; + static const int build = 137; static const String engine = - "Flutter 3.0.0 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision ee4e09cce0 (9 days ago) • 2022-05-09 16:45:18 -0700\nEngine • revision d1b9a6938a\nTools • Dart 2.17.0 • DevTools 2.12.2\n"; - static const String buildAt = "2022-05-19 15:59:10.728748"; - static const int modifications = 15; + "Flutter 3.0.0 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision ee4e09cce0 (11 days ago) • 2022-05-09 16:45:18 -0700\nEngine • revision d1b9a6938a\nTools • Dart 2.17.0 • DevTools 2.12.2\n"; + static const String buildAt = "2022-05-20 19:48:33.039675"; + static const int modifications = 7; } diff --git a/lib/view/page/apt.dart b/lib/view/page/apt.dart index a7bc8cb8..c93d3803 100644 --- a/lib/view/page/apt.dart +++ b/lib/view/page/apt.dart @@ -37,7 +37,6 @@ class _AptManagePageState extends State super.didChangeDependencies(); _media = MediaQuery.of(context); s = S.of(context); - _aptProvider.refreshInstalled(); } @override @@ -107,6 +106,7 @@ class _AptManagePageState extends State () => scrollControllerUpdate .jumpTo(scrollControllerUpdate.position.maxScrollExtent), onPwdRequest); + _aptProvider.refreshInstalled(); } @override @@ -141,7 +141,9 @@ class _AptManagePageState extends State } if (apt.updateLog != null && apt.upgradeable == null) { return SizedBox( - height: _media.size.height * 0.7, + height: _media.size.height - + _media.padding.top - + _media.padding.bottom, child: ConstrainedBox( constraints: const BoxConstraints.expand(), child: SingleChildScrollView( diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index 9e7acd3b..d352619c 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -420,14 +420,14 @@ CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 136; + CURRENT_PROJECT_VERSION = 137; DEVELOPMENT_TEAM = BA88US33G6; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 1.0.136; + MARKETING_VERSION = 1.0.137; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; @@ -550,14 +550,14 @@ CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 136; + CURRENT_PROJECT_VERSION = 137; DEVELOPMENT_TEAM = BA88US33G6; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 1.0.136; + MARKETING_VERSION = 1.0.137; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -574,14 +574,14 @@ CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 136; + CURRENT_PROJECT_VERSION = 137; DEVELOPMENT_TEAM = BA88US33G6; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 1.0.136; + MARKETING_VERSION = 1.0.137; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; diff --git a/make.dart b/make.dart index d0e4a6ac..7bed0e0f 100755 --- a/make.dart +++ b/make.dart @@ -116,7 +116,7 @@ Future flutterBuild( '--build-name=1.0.$build', ]); } - print('Building with args: ${args.join(' ')}'); + print('[$buildType]\nBuilding with args: ${args.join(' ')}'); final buildResult = await Process.run('flutter', args, runInShell: true); final exitCode = buildResult.exitCode;