ssh page: rm appbar

This commit is contained in:
lollipopkit
2023-01-29 15:11:01 +08:00
parent 47861b1e0b
commit 49f9b0b179
11 changed files with 162 additions and 107 deletions

View File

@@ -4,12 +4,14 @@ import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
import 'package:r_upgrade/r_upgrade.dart';
import 'package:toolbox/core/utils.dart';
import 'package:toolbox/data/provider/app.dart';
import 'package:toolbox/data/res/build_data.dart';
import 'package:toolbox/data/service/app.dart';
import 'package:toolbox/generated/l10n.dart';
import 'package:toolbox/locator.dart';
import '../data/model/app/update.dart';
import '../data/provider/app.dart';
import '../data/res/build_data.dart';
import '../data/service/app.dart';
import '../generated/l10n.dart';
import '../locator.dart';
import 'utils.dart';
final _logger = Logger('UPDATE');
@@ -47,29 +49,38 @@ Future<void> doUpdate(BuildContext context, {bool force = false}) async {
_logger.info('Update available: $newest');
if (Platform.isAndroid && !await isFileAvailable(update.android)) {
_logger.warning('Android update file not available');
return;
}
final s = S.of(context);
if (update.min > BuildData.build) {
showRoundDialog(context, s.attention, Text(s.updateTipTooLow(newest)), [
TextButton(
onPressed: () => _doUpdate(update, context, s), child: Text(s.ok))
]);
return;
}
showSnackBarWithAction(
context,
update.min > BuildData.build
? 'Your version is too old. \nPlease update to v1.0.$newest.'
: 'Update: v1.0.$newest available. \n${update.changelog}',
s.update, () async {
'${s.updateTip(newest)} \n${update.changelog}',
s.update,
() => _doUpdate(update, context, s),
);
}
Future<void> _doUpdate(AppUpdate update, BuildContext context, S s) async {
if (Platform.isAndroid) {
await RUpgrade.upgrade(update.android,
fileName: update.android.split('/').last, isAutoRequestInstall: true);
fileName: update.android.split('/').last);
} else if (Platform.isIOS) {
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))
]);
}
});
}

View File

@@ -53,11 +53,16 @@ class MessageLookup extends MessageLookupByLibrary {
static String m14(server) => "Are you sure to delete server [${server}]?";
static String m15(build) => "Found: v1.0.${build}, click to update";
static String m15(newest) => "Update: v1.0.${newest}";
static String m16(build) => "Current: v1.0.${build}";
static String m16(newest) =>
"Current version is too low, please update to v1.0.${newest}";
static String m17(build) => "Current: v1.0.${build}, is up to date";
static String m17(build) => "Found: v1.0.${build}, click to update";
static String m18(build) => "Current: v1.0.${build}";
static String m19(build) => "Current: v1.0.${build}, is up to date";
final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
@@ -247,12 +252,14 @@ class MessageLookup extends MessageLookupByLibrary {
"You set to 0, will not update automatically.\nCan\'t calculate CPU status."),
"updateServerStatusInterval": MessageLookupByLibrary.simpleMessage(
"Server status update interval"),
"updateTip": m15,
"updateTipTooLow": m16,
"upsideDown": MessageLookupByLibrary.simpleMessage("Upside Down"),
"urlOrJson": MessageLookupByLibrary.simpleMessage("URL or JSON"),
"user": MessageLookupByLibrary.simpleMessage("User"),
"versionHaveUpdate": m15,
"versionUnknownUpdate": m16,
"versionUpdated": m17,
"versionHaveUpdate": m17,
"versionUnknownUpdate": m18,
"versionUpdated": m19,
"waitConnection": MessageLookupByLibrary.simpleMessage(
"Please wait for the connection to be established."),
"willTakEeffectImmediately":

View File

@@ -52,11 +52,15 @@ class MessageLookup extends MessageLookupByLibrary {
static String m14(server) => "你确定要删除服务器 [${server}] 吗?";
static String m15(build) => "找到新版本v1.0.${build}, 点击更新";
static String m15(newest) => "新版本: v1.0.${newest}";
static String m16(build) => "当前v1.0.${build}";
static String m16(newest) => "当前版本过低,请升级至 v1.0.${newest}";
static String m17(build) => "当前v1.0.${build}, 已是最新版本";
static String m17(build) => "找到新版本v1.0.${build}, 点击更新";
static String m18(build) => "当前v1.0.${build}";
static String m19(build) => "当前v1.0.${build}, 已是最新版本";
final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
@@ -214,12 +218,14 @@ class MessageLookup extends MessageLookupByLibrary {
"你设置为0服务器状态不会自动刷新。\n且不能计算CPU使用情况。"),
"updateServerStatusInterval":
MessageLookupByLibrary.simpleMessage("服务器状态刷新间隔"),
"updateTip": m15,
"updateTipTooLow": m16,
"upsideDown": MessageLookupByLibrary.simpleMessage("上下交换"),
"urlOrJson": MessageLookupByLibrary.simpleMessage("链接或JSON"),
"user": MessageLookupByLibrary.simpleMessage("用户"),
"versionHaveUpdate": m15,
"versionUnknownUpdate": m16,
"versionUpdated": m17,
"versionHaveUpdate": m17,
"versionUnknownUpdate": m18,
"versionUpdated": m19,
"waitConnection": MessageLookupByLibrary.simpleMessage("请等待连接建立"),
"willTakEeffectImmediately":
MessageLookupByLibrary.simpleMessage("更改将会立即生效")

View File

@@ -1530,6 +1530,26 @@ class S {
args: [url],
);
}
/// `Update: v1.0.{newest}`
String updateTip(Object newest) {
return Intl.message(
'Update: v1.0.$newest',
name: 'updateTip',
desc: '',
args: [newest],
);
}
/// `Current version is too low, please update to v1.0.{newest}`
String updateTipTooLow(Object newest) {
return Intl.message(
'Current version is too low, please update to v1.0.$newest',
name: 'updateTipTooLow',
desc: '',
args: [newest],
);
}
}
class AppLocalizationDelegate extends LocalizationsDelegate<S> {

View File

@@ -146,5 +146,7 @@
"showDistLogo": "Show distribution logo",
"onServerDetailPage": "On server detail page",
"addOne": "Add one",
"sshTip": "This function is now in the experimental stage. \nPlease report bugs on {url} or join our development."
"sshTip": "This function is now in the experimental stage. \nPlease report bugs on {url} or join our development.",
"updateTip": "Update: v1.0.{newest}",
"updateTipTooLow": "Current version is too low, please update to v1.0.{newest}"
}

View File

@@ -146,5 +146,7 @@
"showDistLogo": "显示发行版 Logo",
"onServerDetailPage": "在服务器详情页",
"addOne": "前去新增",
"sshTip": "该功能目前处于测试阶段,请在 {url} 反馈问题,或者加入我们开发。"
"sshTip": "该功能目前处于测试阶段,请在 {url} 反馈问题,或者加入我们开发。",
"updateTip": "新版本: v1.0.{newest}",
"updateTipTooLow": "当前版本过低,请升级至 v1.0.{newest}"
}

View File

@@ -174,9 +174,8 @@ class _PkgManagePageState extends State<PkgManagePage>
}
return ListView(
padding: const EdgeInsets.all(13),
children: [
_buildUpdatePanel(apt)
].map((e) => RoundRectCard(e)).toList(),
children:
[_buildUpdatePanel(apt)].map((e) => RoundRectCard(e)).toList(),
);
}),
);
@@ -207,9 +206,7 @@ class _PkgManagePageState extends State<PkgManagePage>
onPressed: () {
apt.upgrade();
}),
...apt.upgradeable!
.map((e) => _buildUpdateItem(e, apt))
.toList()
...apt.upgradeable!.map((e) => _buildUpdateItem(e, apt)).toList()
]
: [
SingleChildScrollView(

View File

@@ -95,6 +95,7 @@ class _SSHPageState extends State<SSHPage> {
terminal,
keyboardType: TextInputType.visiblePassword,
theme: termTheme,
onSecondaryTapUp: (p0, p1) {},
keyboardAppearance: isDark ? Brightness.dark : Brightness.light,
),
),

View File

@@ -26,7 +26,7 @@
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
E3D733E2A8794200D26EFCCF /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7ADDB81DD1CCC4A9ED73177B /* Pods_Runner.framework */; };
4C070605ECAE15AF72815802 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E2CB2EC868EDACCBD0199581 /* Pods_Runner.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -67,12 +67,12 @@
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
6B35024F2A8A5A7961F90167 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
6F4CBCB4E20C50200E1C67AD /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
7ADDB81DD1CCC4A9ED73177B /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
93BF56BCB6A779C1799D1A42 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
A3006D048053A6426855B015 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
BC4454F0DC2BCE8F9B14AD95 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
E2CB2EC868EDACCBD0199581 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
EF544CC0E8F5001B58CA124F /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -80,7 +80,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
E3D733E2A8794200D26EFCCF /* Pods_Runner.framework in Frameworks */,
4C070605ECAE15AF72815802 /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -105,7 +105,7 @@
33CEB47122A05771004F2AC0 /* Flutter */,
33CC10EE2044A3C60003C045 /* Products */,
D73912EC22F37F3D000D13A0 /* Frameworks */,
B9C356C33EBFDC4109524AEE /* Pods */,
3B06CFC5C95E07DA79CF798C /* Pods */,
);
sourceTree = "<group>";
};
@@ -152,12 +152,12 @@
path = Runner;
sourceTree = "<group>";
};
B9C356C33EBFDC4109524AEE /* Pods */ = {
3B06CFC5C95E07DA79CF798C /* Pods */ = {
isa = PBXGroup;
children = (
6B35024F2A8A5A7961F90167 /* Pods-Runner.debug.xcconfig */,
A3006D048053A6426855B015 /* Pods-Runner.release.xcconfig */,
6F4CBCB4E20C50200E1C67AD /* Pods-Runner.profile.xcconfig */,
93BF56BCB6A779C1799D1A42 /* Pods-Runner.debug.xcconfig */,
BC4454F0DC2BCE8F9B14AD95 /* Pods-Runner.release.xcconfig */,
EF544CC0E8F5001B58CA124F /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
path = Pods;
@@ -166,7 +166,7 @@
D73912EC22F37F3D000D13A0 /* Frameworks */ = {
isa = PBXGroup;
children = (
7ADDB81DD1CCC4A9ED73177B /* Pods_Runner.framework */,
E2CB2EC868EDACCBD0199581 /* Pods_Runner.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -178,13 +178,13 @@
isa = PBXNativeTarget;
buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
6380F17CF8505331723EA2D3 /* [CP] Check Pods Manifest.lock */,
AE558C9DE21E3C54833AFCE4 /* [CP] Check Pods Manifest.lock */,
33CC10E92044A3C60003C045 /* Sources */,
33CC10EA2044A3C60003C045 /* Frameworks */,
33CC10EB2044A3C60003C045 /* Resources */,
33CC110E2044A8840003C045 /* Bundle Framework */,
3399D490228B24CF009A79C7 /* ShellScript */,
3A1CB36BB218FE124CA9BC01 /* [CP] Embed Pods Frameworks */,
DFE8A6B34CDBFF27DB607EA9 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@@ -292,24 +292,7 @@
shellPath = /bin/sh;
shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
};
3A1CB36BB218FE124CA9BC01 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
6380F17CF8505331723EA2D3 /* [CP] Check Pods Manifest.lock */ = {
AE558C9DE21E3C54833AFCE4 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -331,6 +314,23 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
DFE8A6B34CDBFF27DB607EA9 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */

View File

@@ -29,10 +29,10 @@ packages:
dependency: transitive
description:
name: archive
sha256: ed7cc591a948744994714375caf9a2ce89e1d82e8243997c8a2994d57181c212
sha256: d6347d54a2d8028e0437e3c099f66fdb8ae02c4720c1e7534c9f24c10351f85d
url: "https://pub.dev"
source: hosted
version: "3.3.5"
version: "3.3.6"
args:
dependency: transitive
description:
@@ -470,6 +470,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.17.0"
intl_utils:
dependency: "direct dev"
description:
name: intl_utils
sha256: "413699c0f7a1123a9306c1f2f5ea8662677d25bdebf22ba4f3960e0069be3be2"
url: "https://pub.dev"
source: hosted
version: "2.8.1"
io:
dependency: transitive
description:
@@ -506,10 +514,10 @@ packages:
dependency: "direct main"
description:
name: logging
sha256: c0bbfe94d46aedf9b8b3e695cf3bd48c8e14b35e3b2c639e0aa7755d589ba946
sha256: "04094f2eb032cbb06c6f6e8d3607edcfcb0455e2bb6cbc010cb01171dcb64e6d"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
version: "1.1.1"
matcher:
dependency: transitive
description:
@@ -722,10 +730,10 @@ packages:
dependency: "direct main"
description:
name: r_upgrade
sha256: be460ed1d2bf3b444a731aa2eeb38751faaef91097fed4bf9d138d3214b98999
sha256: "5a597989ca065a47d62a992b23de068a118f1616a49bfa2518d552466c4ddc7b"
url: "https://pub.dev"
source: hosted
version: "0.3.8+2"
version: "0.4.1"
share_plus:
dependency: "direct main"
description:

View File

@@ -47,7 +47,7 @@ dependencies:
url: https://github.com/lollipopkit/circle_chart
ref: main
# path: ../circle_chart
r_upgrade: ^0.3.6
r_upgrade: ^0.4.1
path_provider: ^2.0.9
easy_isolate: ^1.3.0
share_plus: ^6.3.0
@@ -59,6 +59,7 @@ dev_dependencies:
flutter_native_splash: ^2.1.6
hive_generator: ^2.0.0
build_runner: ^2.3.2
intl_utils: ^2.8.1
flutter_test:
sdk: flutter