diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 84026ca9..deff9f54 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -690,7 +690,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 888; + CURRENT_PROJECT_VERSION = 891; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -700,7 +700,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.888; + MARKETING_VERSION = 1.0.891; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -826,7 +826,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 888; + CURRENT_PROJECT_VERSION = 891; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -836,7 +836,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.888; + MARKETING_VERSION = 1.0.891; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -854,7 +854,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 888; + CURRENT_PROJECT_VERSION = 891; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -864,7 +864,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.888; + MARKETING_VERSION = 1.0.891; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -885,7 +885,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 888; + CURRENT_PROJECT_VERSION = 891; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -898,7 +898,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.888; + MARKETING_VERSION = 1.0.891; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; @@ -924,7 +924,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 888; + CURRENT_PROJECT_VERSION = 891; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -937,7 +937,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.888; + MARKETING_VERSION = 1.0.891; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -960,7 +960,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 888; + CURRENT_PROJECT_VERSION = 891; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -973,7 +973,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.888; + MARKETING_VERSION = 1.0.891; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -996,7 +996,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 888; + CURRENT_PROJECT_VERSION = 891; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_PREVIEWS = YES; @@ -1008,7 +1008,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.888; + MARKETING_VERSION = 1.0.891; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; @@ -1037,7 +1037,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 888; + CURRENT_PROJECT_VERSION = 891; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_PREVIEWS = YES; @@ -1049,7 +1049,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.888; + MARKETING_VERSION = 1.0.891; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_NAME = ServerBox; @@ -1075,7 +1075,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 888; + CURRENT_PROJECT_VERSION = 891; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_PREVIEWS = YES; @@ -1087,7 +1087,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.888; + MARKETING_VERSION = 1.0.891; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_NAME = ServerBox; diff --git a/lib/core/update.dart b/lib/core/update.dart index 96f16602..4566ba1c 100644 --- a/lib/core/update.dart +++ b/lib/core/update.dart @@ -1,9 +1,6 @@ -import 'dart:io'; import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; -import 'package:r_upgrade/r_upgrade.dart'; -import 'package:toolbox/core/extension/context/common.dart'; import 'package:toolbox/core/extension/context/dialog.dart'; import 'package:toolbox/core/extension/context/locale.dart'; import 'package:toolbox/core/extension/context/snackbar.dart'; @@ -13,10 +10,7 @@ import 'package:toolbox/core/utils/ui.dart'; import 'package:toolbox/data/model/app/update.dart'; import 'package:toolbox/data/res/build_data.dart'; import 'package:toolbox/data/res/logger.dart'; -import 'package:toolbox/data/res/path.dart'; import 'package:toolbox/data/res/provider.dart'; -import 'package:toolbox/data/res/store.dart'; -import 'package:toolbox/data/res/ui.dart'; import 'package:toolbox/data/service/app.dart'; import 'package:toolbox/locator.dart'; @@ -25,17 +19,15 @@ Future isFileAvailable(String url) async { final resp = await Dio().head(url); return resp.statusCode == 200; } catch (e) { - Loggers.app.warning('HEAD update file failed', e); + Loggers.app.warning('HEAD update file failed', e); return false; } } Future doUpdate(BuildContext context, {bool force = false}) async { - await _rmDownloadApks(); - final update = await locator().getUpdate(); - final newest = update.build.last.current; + final newest = update.build.last.current; if (newest == null) { Loggers.app.warning('Update not available on ${OS.type}'); return; @@ -81,81 +73,10 @@ Future doUpdate(BuildContext context, {bool force = false}) async { Future _doUpdate(AppUpdate update, BuildContext context) async { final url = update.url.current; if (url == null) { - Loggers.app.warning('Update url not is null'); + Loggers.app.warning('Update url is null'); + context.showSnackBar(l10n.failed); return; } - if (isAndroid) { - final useBrowser = await _openUrlUpdate(context); - final _ = switch (useBrowser) { - 1 => await RUpgrade.upgrade(url, fileName: url.split('/').last), - 2 => await openUrl(url), - _ => null, - }; - } else if (isIOS) { - await RUpgrade.upgradeFromAppStore('1586449703'); - } else { - await openUrl(url); - } -} - -Future _openUrlUpdate(BuildContext context) async { - final inAppUpdate = Stores.setting.inAppUpdate; - final val = inAppUpdate.fetch(); - if (val == 0) { - var remember = true; - final selection = await context.showRoundDialog( - title: Text(l10n.attention), - child: StatefulBuilder(builder: (_, setState) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text(l10n.inAppUpdate, style: UIs.text15Bold), - CheckboxListTile( - contentPadding: EdgeInsets.zero, - value: remember, - onChanged: (v) => setState(() => remember = v ?? true), - title: Text(l10n.rememberChoice), - ), - ], - ); - }), - actions: [ - TextButton( - onPressed: () => context.pop(0), - child: Text(l10n.cancel), - ), - TextButton( - onPressed: () { - if (remember) { - inAppUpdate.put(1); - } - context.pop(1); - }, - child: const Text('App'), - ), - TextButton( - onPressed: () { - if (remember) { - inAppUpdate.put(2); - } - context.pop(2); - }, - child: Text(l10n.browser), - ), - ], - ); - return selection; - } - return val; -} - -// rmdir Download -Future _rmDownloadApks() async { - if (!isAndroid) return; - final dlDir = Directory(await Paths.dl); - if (await dlDir.exists()) { - await dlDir.delete(recursive: true); - } + await openUrl(url); } diff --git a/lib/data/res/build_data.dart b/lib/data/res/build_data.dart index e594ae5e..a94b6f6f 100644 --- a/lib/data/res/build_data.dart +++ b/lib/data/res/build_data.dart @@ -2,9 +2,9 @@ class BuildData { static const String name = "ServerBox"; - static const int build = 888; + static const int build = 891; static const String engine = "3.19.6"; - static const String buildAt = "2024-05-09 23:31:53"; - static const int modifications = 2; + static const String buildAt = "2024-05-10 11:30:47"; + static const int modifications = 3; static const int script = 46; } diff --git a/lib/data/store/setting.dart b/lib/data/store/setting.dart index 25050828..a9541337 100644 --- a/lib/data/store/setting.dart +++ b/lib/data/store/setting.dart @@ -260,11 +260,6 @@ class SettingStore extends PersistentStore { late final displayCpuIndex = property('displayCpuIndex', true); - /// Some Android device are unable display the download progress notification, - /// open url in external browser. - /// 0 -> unset, 1 -> true, 2 -> false - late final inAppUpdate = property('inAppUpdate', 0); - late final editorSoftWrap = property('editorSoftWrap', isIOS); late final sshTermHelpShown = property('sshTermHelpShown', false); diff --git a/lib/view/page/server/detail/view.dart b/lib/view/page/server/detail/view.dart index 02a22fd6..8e293ab9 100644 --- a/lib/view/page/server/detail/view.dart +++ b/lib/view/page/server/detail/view.dart @@ -104,48 +104,47 @@ class _ServerDetailPageState extends State final buildFuncs = !Stores.setting.moveOutServerTabFuncBtns.fetch(); final logoUrl = si.spi.custom?.logoUrl; final buildLogo = logoUrl != null; - final moreLen = () { - var len = 0; - if (buildLogo) len++; - if (buildFuncs) len++; - return len; - }(); + final children = [ + if (buildLogo) + _buildLogo(logoUrl, si.status.more[StatusCmdType.sys]?.dist), + if (buildFuncs) ServerFuncBtns(spi: widget.spi), + ]; + for (final card in _cardsOrder) { + final buildFunc = _cardBuildMap[card]; + if (buildFunc != null) { + children.add(buildFunc(si.status)); + } + } return Scaffold( - appBar: CustomAppBar( - title: Text(si.spi.name, style: UIs.text18), - actions: [ - IconButton( - icon: const Icon(Icons.edit), - onPressed: () async { - final delete = await AppRoute.serverEdit(spi: si.spi).go(context); - if (delete == true) { - context.pop(); - } - }, - ) - ], - ), - body: ListView.builder( + appBar: _buildAppBar(si), + body: ListView( padding: EdgeInsets.only( left: 13, right: 13, bottom: _media.padding.bottom + 77, ), - itemCount: _cardsOrder.length + moreLen, - itemBuilder: (context, index) { - index -= moreLen; - if (index == -2 && buildLogo) { - return _buildLogo(logoUrl, si.status.more[StatusCmdType.sys]?.dist); - } - if (index == -1 && buildFuncs) { - return ServerFuncBtns(spi: widget.spi); - } - return _cardBuildMap[_cardsOrder[index]]?.call(si.status); - }, + children: children, ), ); } + CustomAppBar _buildAppBar(Server si) { + return CustomAppBar( + title: Text(si.spi.name, style: UIs.text18), + actions: [ + IconButton( + icon: const Icon(Icons.edit), + onPressed: () async { + final delete = await AppRoute.serverEdit(spi: si.spi).go(context); + if (delete == true) { + context.pop(); + } + }, + ) + ], + ); + } + Widget _buildLogo(String logoUrl, Dist? dist) { if (dist != null) { logoUrl = logoUrl.replaceFirst('{DIST}', dist.name); diff --git a/lib/view/widget/auto_hide.dart b/lib/view/widget/auto_hide.dart index dac2ec6a..366af15e 100644 --- a/lib/view/widget/auto_hide.dart +++ b/lib/view/widget/auto_hide.dart @@ -43,9 +43,10 @@ final class _AutoHideState extends State { _timer = Timer.periodic(const Duration(seconds: 3), (_) { if (_isScrolling) return; if (!_visible) return; - if (!widget.controller.positions.any((e) => e.maxScrollExtent >= 0)) { - return; - } + final canScroll = + widget.controller.positions.any((e) => e.maxScrollExtent >= 0); + if (!canScroll) return; + setState(() { _visible = false; }); diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index ab335a80..c2c97069 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -471,7 +471,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 888; + CURRENT_PROJECT_VERSION = 891; DEVELOPMENT_TEAM = BA88US33G6; INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "Server Box"; @@ -481,7 +481,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 1.0.888; + MARKETING_VERSION = 1.0.891; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "Server Box"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -608,7 +608,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 888; + CURRENT_PROJECT_VERSION = 891; DEVELOPMENT_TEAM = BA88US33G6; INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "Server Box"; @@ -618,7 +618,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 1.0.888; + MARKETING_VERSION = 1.0.891; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "Server Box"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -638,7 +638,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "3rd Party Mac Developer Application"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 888; + CURRENT_PROJECT_VERSION = 891; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=macosx*]" = BA88US33G6; INFOPLIST_FILE = Runner/Info.plist; @@ -649,7 +649,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 1.0.888; + MARKETING_VERSION = 1.0.891; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "Server Box"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/pubspec.lock b/pubspec.lock index 33941be1..e4fc5cd6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1008,14 +1008,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.2.1" - r_upgrade: - dependency: "direct main" - description: - name: r_upgrade - sha256: be460ed1d2bf3b444a731aa2eeb38751faaef91097fed4bf9d138d3214b98999 - url: "https://pub.dev" - source: hosted - version: "0.3.8+2" screen_retriever: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index ff500bb3..0cec0057 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -32,8 +32,6 @@ dependencies: ref: main # path: ../circle_chart - # TODO: Update this :) - r_upgrade: 0.3.8+2 path_provider: ^2.0.9 easy_isolate: ^1.3.0 share_plus: ^8.0.3