diff --git a/android/app/build.gradle b/android/app/build.gradle
index 8704ad31..55191d7f 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -32,7 +32,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
- compileSdkVersion 33
+ compileSdkVersion 34
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index d23f7a33..4fe2fdbf 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -4,6 +4,8 @@
+
+
+
'[$e](${e.url})').join(' ')}
Future afterFirstLayout(BuildContext context) async {
// Auth required for first launch
_auth();
+
+ if (Stores.setting.autoCheckAppUpdate.fetch()) {
+ doUpdate(context);
+ }
HomeWidgetMC.update();
await GetIt.I.allReady();
await Pros.server.load();
diff --git a/lib/view/page/ssh/page.dart b/lib/view/page/ssh/page.dart
index 7e64bdea..472447ea 100644
--- a/lib/view/page/ssh/page.dart
+++ b/lib/view/page/ssh/page.dart
@@ -4,6 +4,7 @@ import 'dart:convert';
import 'package:dartssh2/dartssh2.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:flutter_background_service/flutter_background_service.dart';
import 'package:provider/provider.dart';
import 'package:toolbox/core/extension/context/common.dart';
import 'package:toolbox/core/extension/context/dialog.dart';
@@ -369,6 +370,8 @@ class _SSHPageState extends State with AutomaticKeepAliveClientMixin {
_listen(session.stdout);
_listen(session.stderr);
+ _initService();
+
if (widget.initCmd != null) {
_terminal.textInput(widget.initCmd!);
_terminal.keyInput(TerminalKey.enter);
@@ -432,4 +435,21 @@ class _SSHPageState extends State with AutomaticKeepAliveClientMixin {
@override
bool get wantKeepAlive => true;
+
+ Future _initService() async {
+ final service = FlutterBackgroundService();
+
+ await service.configure(
+ androidConfiguration: AndroidConfiguration(
+ onStart: _onStart,
+ autoStart: true,
+ isForegroundMode: true,
+ initialNotificationTitle: 'SSH',
+ initialNotificationContent: l10n.bgRun,
+ ),
+ iosConfiguration: IosConfiguration(),
+ );
+ }
}
+
+Future _onStart(ServiceInstance service) async {}
diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj
index 845425bf..9e4162eb 100644
--- a/macos/Runner.xcodeproj/project.pbxproj
+++ b/macos/Runner.xcodeproj/project.pbxproj
@@ -439,7 +439,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 734;
+ CURRENT_PROJECT_VERSION = 736;
DEVELOPMENT_TEAM = BA88US33G6;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "Server Box";
@@ -449,7 +449,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
- MARKETING_VERSION = 1.0.734;
+ MARKETING_VERSION = 1.0.736;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "Server Box";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -574,7 +574,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 734;
+ CURRENT_PROJECT_VERSION = 736;
DEVELOPMENT_TEAM = BA88US33G6;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "Server Box";
@@ -584,7 +584,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
- MARKETING_VERSION = 1.0.734;
+ MARKETING_VERSION = 1.0.736;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "Server Box";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -604,7 +604,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "3rd Party Mac Developer Application";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 734;
+ CURRENT_PROJECT_VERSION = 736;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=macosx*]" = BA88US33G6;
INFOPLIST_FILE = Runner/Info.plist;
@@ -615,7 +615,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
- MARKETING_VERSION = 1.0.734;
+ MARKETING_VERSION = 1.0.736;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "Server Box";
PROVISIONING_PROFILE_SPECIFIER = "";
diff --git a/pubspec.lock b/pubspec.lock
index 2b0778b0..96628ea5 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -344,6 +344,38 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
+ flutter_background_service:
+ dependency: "direct main"
+ description:
+ name: flutter_background_service
+ sha256: "94d9a143852729140e17254a53769383b03738cd92b6e588a8762003e6cd9dd9"
+ url: "https://pub.dev"
+ source: hosted
+ version: "5.0.5"
+ flutter_background_service_android:
+ dependency: transitive
+ description:
+ name: flutter_background_service_android
+ sha256: "30863ebafd8214b8e76d5e5c9f27887dc5cc303fcf3e89f71534f621fc486782"
+ url: "https://pub.dev"
+ source: hosted
+ version: "6.2.2"
+ flutter_background_service_ios:
+ dependency: transitive
+ description:
+ name: flutter_background_service_ios
+ sha256: ab73657535876e16abc89e40f924df3e92ad3dee83f64d187081417e824709ed
+ url: "https://pub.dev"
+ source: hosted
+ version: "5.0.0"
+ flutter_background_service_platform_interface:
+ dependency: transitive
+ description:
+ name: flutter_background_service_platform_interface
+ sha256: cd5720ff5b051d551a4734fae16683aace779bd0425e8d3f15d84a0cdcc2d8d9
+ url: "https://pub.dev"
+ source: hosted
+ version: "5.0.0"
flutter_displaymode:
dependency: "direct main"
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index 7eca44d2..cbf1888f 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -71,6 +71,7 @@ dependencies:
git:
ref: master
url: https://github.com/lollipopkit/dart_computer
+ flutter_background_service: ^5.0.5
dev_dependencies:
flutter_native_splash: ^2.1.6