fix macos minisized after checking permission

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-08-13 17:50:19 +08:00
parent ea12eccc90
commit ae640dda56
2 changed files with 12 additions and 7 deletions

View File

@ -222,7 +222,7 @@ class MyTheme {
//tooltip //tooltip
static TooltipThemeData tooltipTheme() { static TooltipThemeData tooltipTheme() {
return TooltipThemeData( return TooltipThemeData(
waitDuration: Duration(seconds: 1, milliseconds: 500), waitDuration: Duration(seconds: 1, milliseconds: 500),
); );
} }
@ -1554,7 +1554,7 @@ Future<bool> restoreWindowPosition(WindowType type,
bool isRemotePeerPos = false; bool isRemotePeerPos = false;
String? pos; String? pos;
// No need to check mainGetLocalBoolOptionSync(kOptionOpenNewConnInTabs) // No need to check mainGetLocalBoolOptionSync(kOptionOpenNewConnInTabs)
// Though "open in tabs" is true and the new window restore peer position, it's ok. // Though "open in tabs" is true and the new window restore peer position, it's ok.
if (type == WindowType.RemoteDesktop && windowId != null && peerId != null) { if (type == WindowType.RemoteDesktop && windowId != null && peerId != null) {
// If the restore position is called by main window, and the peer id is not null // If the restore position is called by main window, and the peer id is not null
// then we may need to get the position by reading the peer config. // then we may need to get the position by reading the peer config.
@ -2281,10 +2281,18 @@ void onCopyFingerprint(String value) {
} }
} }
Future<bool> callMainCheckSuperUserPermission() async {
bool checked = await bind.mainCheckSuperUserPermission();
if (Platform.isMacOS) {
await windowManager.show();
}
return checked;
}
Future<void> start_service(bool is_start) async { Future<void> start_service(bool is_start) async {
bool checked = !bind.mainIsInstalled() || bool checked = !bind.mainIsInstalled() ||
!Platform.isMacOS || !Platform.isMacOS ||
await bind.mainCheckSuperUserPermission(); await callMainCheckSuperUserPermission();
if (checked) { if (checked) {
bind.mainSetOption(key: "stop-service", value: is_start ? "" : "Y"); bind.mainSetOption(key: "stop-service", value: is_start ? "" : "Y");
} }

View File

@ -1832,13 +1832,10 @@ Widget _lock(
Text(translate(label)).marginOnly(left: 5), Text(translate(label)).marginOnly(left: 5),
]).marginSymmetric(vertical: 2)), ]).marginSymmetric(vertical: 2)),
onPressed: () async { onPressed: () async {
bool checked = await bind.mainCheckSuperUserPermission(); bool checked = await callMainCheckSuperUserPermission();
if (checked) { if (checked) {
onUnlock(); onUnlock();
} }
if (Platform.isMacOS) {
await windowManager.show();
}
}, },
).marginSymmetric(horizontal: 2, vertical: 4), ).marginSymmetric(horizontal: 2, vertical: 4),
).marginOnly(left: _kCardLeftMargin), ).marginOnly(left: _kCardLeftMargin),