ssh page: rm appbar
This commit is contained in:
@@ -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 {
|
||||
if (Platform.isAndroid) {
|
||||
await RUpgrade.upgrade(update.android,
|
||||
fileName: update.android.split('/').last, isAutoRequestInstall: true);
|
||||
} 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))
|
||||
]);
|
||||
}
|
||||
});
|
||||
context,
|
||||
'${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);
|
||||
} else if (Platform.isIOS) {
|
||||
await RUpgrade.upgradeFromAppStore('1586449703');
|
||||
} else {
|
||||
showRoundDialog(context, s.attention, Text(s.platformNotSupportUpdate), [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(), child: Text(s.ok))
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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":
|
||||
|
||||
@@ -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("更改将会立即生效")
|
||||
|
||||
@@ -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> {
|
||||
|
||||
@@ -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}"
|
||||
}
|
||||
@@ -146,5 +146,7 @@
|
||||
"showDistLogo": "显示发行版 Logo",
|
||||
"onServerDetailPage": "在服务器详情页",
|
||||
"addOne": "前去新增",
|
||||
"sshTip": "该功能目前处于测试阶段,请在 {url} 反馈问题,或者加入我们开发。"
|
||||
"sshTip": "该功能目前处于测试阶段,请在 {url} 反馈问题,或者加入我们开发。",
|
||||
"updateTip": "新版本: v1.0.{newest}",
|
||||
"updateTipTooLow": "当前版本过低,请升级至 v1.0.{newest}"
|
||||
}
|
||||
@@ -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(),
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -193,32 +192,30 @@ class _PkgManagePageState extends State<PkgManagePage>
|
||||
);
|
||||
}
|
||||
return ExpansionTile(
|
||||
title: Text(_s.foundNUpdate(apt.upgradeable!.length)),
|
||||
subtitle: Text(
|
||||
apt.upgradeable!.map((e) => e.package).join(', '),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: grey,
|
||||
),
|
||||
children: apt.upgradeLog == null
|
||||
? [
|
||||
TextButton(
|
||||
child: Text(_s.updateAll),
|
||||
onPressed: () {
|
||||
apt.upgrade();
|
||||
}),
|
||||
...apt.upgradeable!
|
||||
.map((e) => _buildUpdateItem(e, apt))
|
||||
.toList()
|
||||
]
|
||||
: [
|
||||
SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(18),
|
||||
controller: _scrollController,
|
||||
child: Text(apt.upgradeLog!),
|
||||
)
|
||||
],
|
||||
);
|
||||
title: Text(_s.foundNUpdate(apt.upgradeable!.length)),
|
||||
subtitle: Text(
|
||||
apt.upgradeable!.map((e) => e.package).join(', '),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: grey,
|
||||
),
|
||||
children: apt.upgradeLog == null
|
||||
? [
|
||||
TextButton(
|
||||
child: Text(_s.updateAll),
|
||||
onPressed: () {
|
||||
apt.upgrade();
|
||||
}),
|
||||
...apt.upgradeable!.map((e) => _buildUpdateItem(e, apt)).toList()
|
||||
]
|
||||
: [
|
||||
SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(18),
|
||||
controller: _scrollController,
|
||||
child: Text(apt.upgradeLog!),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildUpdateItem(UpgradePkgInfo info, PkgProvider apt) {
|
||||
|
||||
@@ -95,6 +95,7 @@ class _SSHPageState extends State<SSHPage> {
|
||||
terminal,
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
theme: termTheme,
|
||||
onSecondaryTapUp: (p0, p1) {},
|
||||
keyboardAppearance: isDark ? Brightness.dark : Brightness.light,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user