- multi dialog on apt pwd request
- update dialog condition error
This commit is contained in:
Junyuan Feng
2022-05-20 19:51:14 +08:00
parent 0533766c1c
commit b4d42eecf3
7 changed files with 33 additions and 25 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 = 136; CURRENT_PROJECT_VERSION = 137;
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.136; MARKETING_VERSION = 1.0.137;
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 = 136; CURRENT_PROJECT_VERSION = 137;
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.136; MARKETING_VERSION = 1.0.137;
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 = 136; CURRENT_PROJECT_VERSION = 137;
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.136; MARKETING_VERSION = 1.0.137;
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

@@ -65,10 +65,11 @@ Future<void> doUpdate(BuildContext context, {bool force = false}) async {
await RUpgrade.upgradeFromAppStore('1586449703'); await RUpgrade.upgradeFromAppStore('1586449703');
} else if (Platform.isMacOS) { } else if (Platform.isMacOS) {
await RUpgrade.upgradeFromUrl(update.mac); 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))
]);
}); });
} }

View File

@@ -30,6 +30,7 @@ class AptProvider extends BusyProvider {
String? updateLog; String? updateLog;
String lastLog = ''; String lastLog = '';
int triedTimes = 0; int triedTimes = 0;
bool isRequestingPwd = false;
AptProvider(); AptProvider();
@@ -55,6 +56,7 @@ class AptProvider extends BusyProvider {
onUpdate = null; onUpdate = null;
onPasswordRequest = null; onPasswordRequest = null;
triedTimes = 0; triedTimes = 0;
isRequestingPwd = false;
} }
Future<void> refreshInstalled() async { Future<void> refreshInstalled() async {
@@ -144,19 +146,22 @@ class AptProvider extends BusyProvider {
} }
Future<void> _onPwd(Uint8List e, StreamSink<Uint8List> stdin) async { Future<void> _onPwd(Uint8List e, StreamSink<Uint8List> stdin) async {
if (isRequestingPwd) return;
isRequestingPwd = true;
final event = e.string; final event = e.string;
if (event.contains('[sudo] password for ')) { if (event.contains('[sudo] password for ')) {
final user = pwdRequestWithUserReg.firstMatch(event)?.group(1); final user = pwdRequestWithUserReg.firstMatch(event)?.group(1);
logger.info('sudo password request for $user'); logger.info('sudo password request for $user');
triedTimes++; triedTimes++;
final pwd = final pwd = await (onPasswordRequest ?? (_, __) async => '')(
await (onPasswordRequest ?? (_) async => '')(triedTimes == 3, user); triedTimes == 3, user);
if (pwd.isEmpty) { if (pwd.isEmpty) {
logger.info('sudo password request cancelled'); logger.info('sudo password request cancelled');
return; return;
} }
stdin.add(Uint8List.fromList(utf8.encode('$pwd\n'))); stdin.add(Uint8List.fromList(utf8.encode('$pwd\n')));
} }
isRequestingPwd = false;
} }
String _wrap(String cmd) => String _wrap(String cmd) =>

View File

@@ -2,9 +2,9 @@
class BuildData { class BuildData {
static const String name = "ServerBox"; static const String name = "ServerBox";
static const int build = 136; static const int build = 137;
static const String engine = 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"; "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-19 15:59:10.728748"; static const String buildAt = "2022-05-20 19:48:33.039675";
static const int modifications = 15; static const int modifications = 7;
} }

View File

@@ -37,7 +37,6 @@ class _AptManagePageState extends State<AptManagePage>
super.didChangeDependencies(); super.didChangeDependencies();
_media = MediaQuery.of(context); _media = MediaQuery.of(context);
s = S.of(context); s = S.of(context);
_aptProvider.refreshInstalled();
} }
@override @override
@@ -107,6 +106,7 @@ class _AptManagePageState extends State<AptManagePage>
() => scrollControllerUpdate () => scrollControllerUpdate
.jumpTo(scrollControllerUpdate.position.maxScrollExtent), .jumpTo(scrollControllerUpdate.position.maxScrollExtent),
onPwdRequest); onPwdRequest);
_aptProvider.refreshInstalled();
} }
@override @override
@@ -141,7 +141,9 @@ class _AptManagePageState extends State<AptManagePage>
} }
if (apt.updateLog != null && apt.upgradeable == null) { if (apt.updateLog != null && apt.upgradeable == null) {
return SizedBox( return SizedBox(
height: _media.size.height * 0.7, height: _media.size.height -
_media.padding.top -
_media.padding.bottom,
child: ConstrainedBox( child: ConstrainedBox(
constraints: const BoxConstraints.expand(), constraints: const BoxConstraints.expand(),
child: SingleChildScrollView( child: SingleChildScrollView(

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 = 136; CURRENT_PROJECT_VERSION = 137;
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.136; MARKETING_VERSION = 1.0.137;
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 = 136; CURRENT_PROJECT_VERSION = 137;
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.136; MARKETING_VERSION = 1.0.137;
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 = 136; CURRENT_PROJECT_VERSION = 137;
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.136; MARKETING_VERSION = 1.0.137;
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;

View File

@@ -116,7 +116,7 @@ Future<void> flutterBuild(
'--build-name=1.0.$build', '--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 buildResult = await Process.run('flutter', args, runInShell: true);
final exitCode = buildResult.exitCode; final exitCode = buildResult.exitCode;