new: PlatformType
This commit is contained in:
@@ -939,6 +939,12 @@ abstract class S {
|
|||||||
/// **'Stop'**
|
/// **'Stop'**
|
||||||
String get stop;
|
String get stop;
|
||||||
|
|
||||||
|
/// No description provided for @success.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Success'**
|
||||||
|
String get success;
|
||||||
|
|
||||||
/// No description provided for @sureDelete.
|
/// No description provided for @sureDelete.
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
|
|||||||
@@ -457,6 +457,9 @@ class SEn extends S {
|
|||||||
@override
|
@override
|
||||||
String get stop => 'Stop';
|
String get stop => 'Stop';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get success => 'Success';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String sureDelete(Object name) {
|
String sureDelete(Object name) {
|
||||||
return 'Are you sure to delete [$name]?';
|
return 'Are you sure to delete [$name]?';
|
||||||
|
|||||||
@@ -457,6 +457,9 @@ class SZh extends S {
|
|||||||
@override
|
@override
|
||||||
String get stop => '停止';
|
String get stop => '停止';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get success => '成功';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String sureDelete(Object name) {
|
String sureDelete(Object name) {
|
||||||
return '确定删除[$name]?';
|
return '确定删除[$name]?';
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -359,7 +359,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 228;
|
CURRENT_PROJECT_VERSION = 231;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -367,7 +367,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.228;
|
MARKETING_VERSION = 1.0.231;
|
||||||
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";
|
||||||
@@ -490,7 +490,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 228;
|
CURRENT_PROJECT_VERSION = 231;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -498,7 +498,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.228;
|
MARKETING_VERSION = 1.0.231;
|
||||||
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";
|
||||||
@@ -515,7 +515,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 228;
|
CURRENT_PROJECT_VERSION = 231;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -523,7 +523,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.228;
|
MARKETING_VERSION = 1.0.231;
|
||||||
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";
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
24
lib/app.dart
24
lib/app.dart
@@ -21,18 +21,11 @@ class MyApp extends StatelessWidget {
|
|||||||
valueListenable: _setting.primaryColor.listenable(),
|
valueListenable: _setting.primaryColor.listenable(),
|
||||||
builder: (_, colorValue, __) {
|
builder: (_, colorValue, __) {
|
||||||
primaryColor = Color(colorValue);
|
primaryColor = Color(colorValue);
|
||||||
return ValueListenableBuilder<int>(
|
|
||||||
valueListenable: _setting.themeMode.listenable(),
|
|
||||||
builder: (_, mode, __) => _buildApp(mode),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildApp(int nightMode) {
|
|
||||||
final textStyle = TextStyle(color: primaryColor);
|
final textStyle = TextStyle(color: primaryColor);
|
||||||
final materialColor = primaryColor.materialStateColor;
|
final materialColor = primaryColor.materialStateColor;
|
||||||
final materialColorAlpha = primaryColor.withOpacity(0.7).materialStateColor;
|
final materialColorAlpha =
|
||||||
|
primaryColor.withOpacity(0.7).materialStateColor;
|
||||||
final fabTheme =
|
final fabTheme =
|
||||||
FloatingActionButtonThemeData(backgroundColor: primaryColor);
|
FloatingActionButtonThemeData(backgroundColor: primaryColor);
|
||||||
final switchTheme = SwitchThemeData(
|
final switchTheme = SwitchThemeData(
|
||||||
@@ -50,9 +43,11 @@ class MyApp extends StatelessWidget {
|
|||||||
final radioTheme = RadioThemeData(
|
final radioTheme = RadioThemeData(
|
||||||
fillColor: materialColor,
|
fillColor: materialColor,
|
||||||
);
|
);
|
||||||
final ok = nightMode >= 0 && nightMode <= ThemeMode.values.length - 1;
|
return ValueListenableBuilder<int>(
|
||||||
final themeMode = ok ? ThemeMode.values[nightMode] : ThemeMode.system;
|
valueListenable: _setting.themeMode.listenable(),
|
||||||
|
builder: (_, tMode, __) {
|
||||||
|
final ok = tMode >= 0 && tMode <= ThemeMode.values.length - 1;
|
||||||
|
final themeMode = ok ? ThemeMode.values[tMode] : ThemeMode.system;
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
localizationsDelegates: S.localizationsDelegates,
|
localizationsDelegates: S.localizationsDelegates,
|
||||||
@@ -85,8 +80,11 @@ class MyApp extends StatelessWidget {
|
|||||||
accentColor: primaryColor,
|
accentColor: primaryColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
themeAnimationDuration: const Duration(milliseconds: 237),
|
|
||||||
home: const MyHomePage(),
|
home: const MyHomePage(),
|
||||||
);
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import 'package:countly_flutter/countly_flutter.dart';
|
|||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:toolbox/core/build_mode.dart';
|
import 'package:toolbox/core/build_mode.dart';
|
||||||
|
|
||||||
|
import 'utils/platform.dart';
|
||||||
|
|
||||||
class Analysis {
|
class Analysis {
|
||||||
static const _url = 'https://countly.xuty.cc';
|
static const _url = 'https://countly.xuty.cc';
|
||||||
static const _key = '80372a2a66424b32d0ac8991bfa1ef058bd36b1f';
|
static const _key = '80372a2a66424b32d0ac8991bfa1ef058bd36b1f';
|
||||||
@@ -16,7 +18,7 @@ class Analysis {
|
|||||||
if (!BuildMode.isRelease) {
|
if (!BuildMode.isRelease) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Platform.isAndroid || Platform.isIOS) {
|
if (isAndroid || isIOS) {
|
||||||
_enabled = true;
|
_enabled = true;
|
||||||
final config = CountlyConfig(_url, _key)
|
final config = CountlyConfig(_url, _key)
|
||||||
.setLoggingEnabled(false)
|
.setLoggingEnabled(false)
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
@@ -11,6 +9,7 @@ import '../data/provider/app.dart';
|
|||||||
import '../data/res/build_data.dart';
|
import '../data/res/build_data.dart';
|
||||||
import '../data/service/app.dart';
|
import '../data/service/app.dart';
|
||||||
import '../locator.dart';
|
import '../locator.dart';
|
||||||
|
import 'utils/platform.dart';
|
||||||
import 'utils/ui.dart';
|
import 'utils/ui.dart';
|
||||||
|
|
||||||
final _logger = Logger('UPDATE');
|
final _logger = Logger('UPDATE');
|
||||||
@@ -31,11 +30,11 @@ Future<void> doUpdate(BuildContext context, {bool force = false}) async {
|
|||||||
locator<AppProvider>().setNewestBuild(update.newest);
|
locator<AppProvider>().setNewestBuild(update.newest);
|
||||||
|
|
||||||
final newest = () {
|
final newest = () {
|
||||||
if (Platform.isAndroid) {
|
if (isAndroid) {
|
||||||
return update.androidbuild;
|
return update.androidbuild;
|
||||||
} else if (Platform.isIOS) {
|
} else if (isIOS) {
|
||||||
return update.iosbuild;
|
return update.iosbuild;
|
||||||
} else if (Platform.isMacOS) {
|
} else if (isMacOS) {
|
||||||
return update.macbuild;
|
return update.macbuild;
|
||||||
}
|
}
|
||||||
return update.newest;
|
return update.newest;
|
||||||
@@ -48,7 +47,7 @@ Future<void> doUpdate(BuildContext context, {bool force = false}) async {
|
|||||||
}
|
}
|
||||||
_logger.info('Update available: $newest');
|
_logger.info('Update available: $newest');
|
||||||
|
|
||||||
if (Platform.isAndroid && !await isFileAvailable(update.android)) {
|
if (isAndroid && !await isFileAvailable(update.android)) {
|
||||||
_logger.warning('Android update file not available');
|
_logger.warning('Android update file not available');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -79,13 +78,13 @@ Future<void> doUpdate(BuildContext context, {bool force = false}) async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _doUpdate(AppUpdate update, BuildContext context, S s) async {
|
Future<void> _doUpdate(AppUpdate update, BuildContext context, S s) async {
|
||||||
if (Platform.isAndroid) {
|
if (isAndroid) {
|
||||||
await RUpgrade.upgrade(
|
await RUpgrade.upgrade(
|
||||||
update.android,
|
update.android,
|
||||||
fileName: update.android.split('/').last,
|
fileName: update.android.split('/').last,
|
||||||
isAutoRequestInstall: true,
|
isAutoRequestInstall: true,
|
||||||
);
|
);
|
||||||
} else if (Platform.isIOS) {
|
} else if (isIOS) {
|
||||||
await RUpgrade.upgradeFromAppStore('1586449703');
|
await RUpgrade.upgradeFromAppStore('1586449703');
|
||||||
} else {
|
} else {
|
||||||
showRoundDialog(context, s.attention, Text(s.platformNotSupportUpdate), [
|
showRoundDialog(context, s.attention, Text(s.platformNotSupportUpdate), [
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|||||||
import 'package:plain_notification_token/plain_notification_token.dart';
|
import 'package:plain_notification_token/plain_notification_token.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
|
import 'platform.dart';
|
||||||
|
|
||||||
Future<bool> shareFiles(BuildContext context, List<String> filePaths) async {
|
Future<bool> shareFiles(BuildContext context, List<String> filePaths) async {
|
||||||
for (final filePath in filePaths) {
|
for (final filePath in filePaths) {
|
||||||
if (!await File(filePath).exists()) {
|
if (!await File(filePath).exists()) {
|
||||||
@@ -34,14 +36,14 @@ Future<String?> pickOneFile() async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<String?> getToken() async {
|
Future<String?> getToken() async {
|
||||||
|
if (isIOS) {
|
||||||
final plainNotificationToken = PlainNotificationToken();
|
final plainNotificationToken = PlainNotificationToken();
|
||||||
if (Platform.isIOS) {
|
|
||||||
plainNotificationToken.requestPermission();
|
plainNotificationToken.requestPermission();
|
||||||
|
|
||||||
// If you want to wait until Permission dialog close,
|
// If you want to wait until Permission dialog close,
|
||||||
// you need wait changing setting registered.
|
// you need wait changing setting registered.
|
||||||
await plainNotificationToken.onIosSettingsRegistered.first;
|
await plainNotificationToken.onIosSettingsRegistered.first;
|
||||||
}
|
|
||||||
|
|
||||||
return await plainNotificationToken.getToken();
|
return await plainNotificationToken.getToken();
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|||||||
44
lib/core/utils/platform.dart
Normal file
44
lib/core/utils/platform.dart
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
|
enum PlatformType {
|
||||||
|
android,
|
||||||
|
ios,
|
||||||
|
linux,
|
||||||
|
macos,
|
||||||
|
windows,
|
||||||
|
web,
|
||||||
|
}
|
||||||
|
|
||||||
|
final _p = () {
|
||||||
|
if (kIsWeb) {
|
||||||
|
return PlatformType.web;
|
||||||
|
}
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
return PlatformType.android;
|
||||||
|
}
|
||||||
|
if (Platform.isIOS) {
|
||||||
|
return PlatformType.ios;
|
||||||
|
}
|
||||||
|
if (Platform.isLinux) {
|
||||||
|
return PlatformType.linux;
|
||||||
|
}
|
||||||
|
if (Platform.isMacOS) {
|
||||||
|
return PlatformType.macos;
|
||||||
|
}
|
||||||
|
if (Platform.isWindows) {
|
||||||
|
return PlatformType.windows;
|
||||||
|
}
|
||||||
|
return PlatformType.web;
|
||||||
|
}();
|
||||||
|
|
||||||
|
PlatformType get platform => _p;
|
||||||
|
|
||||||
|
bool get isAndroid => _p == PlatformType.android;
|
||||||
|
bool get isIOS => _p == PlatformType.ios;
|
||||||
|
bool get isLinux => _p == PlatformType.linux;
|
||||||
|
bool get isMacOS => _p == PlatformType.macos;
|
||||||
|
bool get isWindows => _p == PlatformType.windows;
|
||||||
|
bool get isWeb => _p == PlatformType.web;
|
||||||
|
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
@@ -8,6 +6,7 @@ import 'package:url_launcher/url_launcher.dart';
|
|||||||
|
|
||||||
import '../../view/widget/card_dialog.dart';
|
import '../../view/widget/card_dialog.dart';
|
||||||
import '../persistant_store.dart';
|
import '../persistant_store.dart';
|
||||||
|
import 'platform.dart';
|
||||||
|
|
||||||
bool isDarkMode(BuildContext context) =>
|
bool isDarkMode(BuildContext context) =>
|
||||||
Theme.of(context).brightness == Brightness.dark;
|
Theme.of(context).brightness == Brightness.dark;
|
||||||
@@ -62,7 +61,7 @@ Widget buildSwitch(BuildContext context, StoreProperty<bool> prop,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setTransparentNavigationBar(BuildContext context) {
|
void setTransparentNavigationBar(BuildContext context) {
|
||||||
if (Platform.isAndroid) {
|
if (isAndroid) {
|
||||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||||
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
||||||
systemNavigationBarColor: Colors.transparent,
|
systemNavigationBarColor: Colors.transparent,
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
class BuildData {
|
class BuildData {
|
||||||
static const String name = "ServerBox";
|
static const String name = "ServerBox";
|
||||||
static const int build = 228;
|
static const int build = 231;
|
||||||
static const String engine =
|
static const String engine = "Flutter 3.7.6 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 12cb4eb7a0 (11 days ago) • 2023-03-01 10:29:26 -0800\nEngine • revision ada363ee93\nTools • Dart 2.19.3 • DevTools 2.20.1\n";
|
||||||
"Flutter 3.7.3 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 9944297138 (2 weeks ago) • 2023-02-08 15:46:04 -0800\nEngine • revision 248290d6d5\nTools • Dart 2.19.2 • DevTools 2.20.1\n";
|
static const String buildAt = "2023-03-13 11:33:00.843861";
|
||||||
static const String buildAt = "2023-02-25 20:13:29.020860";
|
static const int modifications = 13;
|
||||||
static const int modifications = 2;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,29 @@
|
|||||||
const seperator = 'A====A';
|
import 'build_data.dart';
|
||||||
const shellCmd = "export LANG=en_US.utf-8 \necho '$seperator' \n"
|
|
||||||
"cat /proc/net/dev && date +%s \necho $seperator \n"
|
const seperator = 'SrvBox';
|
||||||
"cat /etc/os-release | grep PRETTY_NAME \necho $seperator \n"
|
|
||||||
"cat /proc/stat | grep cpu \necho $seperator \n"
|
|
||||||
"uptime \necho $seperator \n"
|
|
||||||
"cat /proc/net/snmp \necho $seperator \n"
|
|
||||||
"df -h \necho $seperator \n"
|
|
||||||
"cat /proc/meminfo \necho $seperator \n"
|
|
||||||
"cat /sys/class/thermal/thermal_zone*/type \necho $seperator \n"
|
|
||||||
"cat /sys/class/thermal/thermal_zone*/temp";
|
|
||||||
const shellPath = '.serverbox.sh';
|
const shellPath = '.serverbox.sh';
|
||||||
|
|
||||||
|
const shellCmd = """
|
||||||
|
# Script for app `${BuildData.name}`
|
||||||
|
# Delete this file while app is running will cause app crash
|
||||||
|
|
||||||
|
export LANG=en_US.utf-8
|
||||||
|
echo $seperator
|
||||||
|
cat /proc/net/dev && date +%s
|
||||||
|
echo $seperator
|
||||||
|
cat /etc/os-release | grep PRETTY_NAME
|
||||||
|
echo $seperator
|
||||||
|
cat /proc/stat | grep cpu
|
||||||
|
echo $seperator
|
||||||
|
uptime
|
||||||
|
echo $seperator
|
||||||
|
cat /proc/net/snmp
|
||||||
|
echo $seperator
|
||||||
|
df -h
|
||||||
|
echo $seperator
|
||||||
|
cat /proc/meminfo
|
||||||
|
echo $seperator
|
||||||
|
cat /sys/class/thermal/thermal_zone*/type
|
||||||
|
echo $seperator
|
||||||
|
cat /sys/class/thermal/thermal_zone*/temp
|
||||||
|
""";
|
||||||
|
|||||||
@@ -140,6 +140,7 @@
|
|||||||
"sshTip": "This function is now in the experimental stage.\n\nPlease report bugs on {url} or join our development.",
|
"sshTip": "This function is now in the experimental stage.\n\nPlease report bugs on {url} or join our development.",
|
||||||
"start": "Start",
|
"start": "Start",
|
||||||
"stop": "Stop",
|
"stop": "Stop",
|
||||||
|
"success": "Success",
|
||||||
"sureDelete": "Are you sure to delete [{name}]?",
|
"sureDelete": "Are you sure to delete [{name}]?",
|
||||||
"sureNoPwd": "Are you sure to use no password?",
|
"sureNoPwd": "Are you sure to use no password?",
|
||||||
"sureToDeleteServer": "Are you sure to delete server [{server}]?",
|
"sureToDeleteServer": "Are you sure to delete server [{server}]?",
|
||||||
|
|||||||
@@ -140,6 +140,7 @@
|
|||||||
"sshTip": "该功能目前处于测试阶段。\n\n请在 {url} 反馈问题,或者加入我们开发。",
|
"sshTip": "该功能目前处于测试阶段。\n\n请在 {url} 反馈问题,或者加入我们开发。",
|
||||||
"start": "开始",
|
"start": "开始",
|
||||||
"stop": "停止",
|
"stop": "停止",
|
||||||
|
"success": "成功",
|
||||||
"sureDelete": "确定删除[{name}]?",
|
"sureDelete": "确定删除[{name}]?",
|
||||||
"sureNoPwd": "确认使用无密码?",
|
"sureNoPwd": "确认使用无密码?",
|
||||||
"sureToDeleteServer": "你确定要删除服务器 [{server}] 吗?",
|
"sureToDeleteServer": "你确定要删除服务器 [{server}] 吗?",
|
||||||
|
|||||||
@@ -416,6 +416,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_pushToken != null) {
|
if (_pushToken != null) {
|
||||||
copy(_pushToken!);
|
copy(_pushToken!);
|
||||||
|
showSnackBar(context, Text(_s.success));
|
||||||
} else {
|
} else {
|
||||||
showSnackBar(context, Text(_s.getPushTokenFailed));
|
showSnackBar(context, Text(_s.getPushTokenFailed));
|
||||||
}
|
}
|
||||||
@@ -424,15 +425,26 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
subtitle: FutureBuilder<String?>(
|
subtitle: FutureBuilder<String?>(
|
||||||
future: getToken(),
|
future: getToken(),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.hasData) {
|
switch (snapshot.connectionState) {
|
||||||
|
case ConnectionState.none:
|
||||||
|
case ConnectionState.waiting:
|
||||||
|
return const Text('Getting Token...');
|
||||||
|
default:
|
||||||
|
var text = _pushToken;
|
||||||
|
if (snapshot.hasError) {
|
||||||
|
text = 'Error: ${snapshot.error}';
|
||||||
|
}
|
||||||
_pushToken = snapshot.data;
|
_pushToken = snapshot.data;
|
||||||
|
if (_pushToken == null) {
|
||||||
|
text = 'Null token';
|
||||||
}
|
}
|
||||||
return Text(
|
return Text(
|
||||||
_pushToken ?? 'Getting Token...',
|
text!,
|
||||||
style: grey,
|
style: grey,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:dartssh2/dartssh2.dart';
|
import 'package:dartssh2/dartssh2.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
@@ -9,6 +8,7 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:xterm/xterm.dart' hide TerminalColors;
|
import 'package:xterm/xterm.dart' hide TerminalColors;
|
||||||
|
|
||||||
|
import '../../core/utils/platform.dart';
|
||||||
import '../../data/model/ssh/terminal_color.dart';
|
import '../../data/model/ssh/terminal_color.dart';
|
||||||
import '../../core/utils/misc.dart';
|
import '../../core/utils/misc.dart';
|
||||||
import '../../core/utils/ui.dart';
|
import '../../core/utils/ui.dart';
|
||||||
@@ -111,7 +111,7 @@ class _SSHPageState extends State<SSHPage> {
|
|||||||
body: _buildBody(termTheme.toTerminalTheme(_termColors)),
|
body: _buildBody(termTheme.toTerminalTheme(_termColors)),
|
||||||
bottomNavigationBar: _buildBottom(termTheme.background),
|
bottomNavigationBar: _buildBottom(termTheme.background),
|
||||||
);
|
);
|
||||||
if (Platform.isIOS) {
|
if (isIOS) {
|
||||||
child = AnnotatedRegion(
|
child = AnnotatedRegion(
|
||||||
value: _isDark ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark,
|
value: _isDark ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark,
|
||||||
child: child,
|
child: child,
|
||||||
@@ -131,7 +131,7 @@ class _SSHPageState extends State<SSHPage> {
|
|||||||
controller: _terminalController,
|
controller: _terminalController,
|
||||||
keyboardType: TextInputType.visiblePassword,
|
keyboardType: TextInputType.visiblePassword,
|
||||||
theme: termTheme,
|
theme: termTheme,
|
||||||
deleteDetection: Platform.isIOS,
|
deleteDetection: isIOS,
|
||||||
onTapUp: _onTapUp,
|
onTapUp: _onTapUp,
|
||||||
autoFocus: true,
|
autoFocus: true,
|
||||||
keyboardAppearance: _isDark ? Brightness.dark : Brightness.light,
|
keyboardAppearance: _isDark ? Brightness.dark : Brightness.light,
|
||||||
|
|||||||
Reference in New Issue
Block a user