mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.: only req noti perm on Android
This commit is contained in:
@@ -58,8 +58,8 @@ Especially thanks to <a href="https://github.com/TerminalStudio/dartssh2">dartss
|
|||||||
## ⬇️ Download
|
## ⬇️ Download
|
||||||
Platform | Support | Sign
|
Platform | Support | Sign
|
||||||
--- | --- | ---
|
--- | --- | ---
|
||||||
[iOS](https://apps.apple.com/app/id1586449703) / [Android](https://res.lolli.tech/serverbox/latest.apk) / [macOS](https://apps.apple.com/app/id1586449703) | Full | My own certificate
|
[iOS](https://apps.apple.com/app/id1586449703) / [Android](https://cdn.lolli.tech/serverbox/latest.apk) / [macOS](https://apps.apple.com/app/id1586449703) | Full | My own certificate
|
||||||
[Linux](https://res.lolli.tech/serverbox/latest.AppImage) / [Windows](https://res.lolli.tech/serverbox/latest.win.zip) | Not tested | Flutter default certificate
|
[Linux](https://cdn.lolli.tech/serverbox/latest.AppImage) / [Windows](https://cdn.lolli.tech/serverbox/latest.win.zip) | Not tested | Flutter default certificate
|
||||||
|
|
||||||
|
|
||||||
## 🆘 Help
|
## 🆘 Help
|
||||||
|
|||||||
@@ -58,8 +58,8 @@
|
|||||||
## ⬇️ 下载
|
## ⬇️ 下载
|
||||||
平台 | 支持 | 签名
|
平台 | 支持 | 签名
|
||||||
:-: | :-: | :-:
|
:-: | :-: | :-:
|
||||||
[iOS](https://apps.apple.com/app/id1586449703) / [Android](https://res.lolli.tech/serverbox/latest.apk) / [macOS](https://apps.apple.com/app/id1586449703) | 完整 | 个人可信签名
|
[iOS](https://apps.apple.com/app/id1586449703) / [Android](https://cdn.lolli.tech/serverbox/latest.apk) / [macOS](https://apps.apple.com/app/id1586449703) | 完整 | 个人可信签名
|
||||||
[Linux](https://res.lolli.tech/serverbox/latest.AppImage) / [Windows](https://res.lolli.tech/serverbox/latest.win.zip) | 未测试 | Flutter 默认签名
|
[Linux](https://cdn.lolli.tech/serverbox/latest.AppImage) / [Windows](https://cdn.lolli.tech/serverbox/latest.win.zip) | 未测试 | Flutter 默认签名
|
||||||
|
|
||||||
|
|
||||||
## 🆘 帮助
|
## 🆘 帮助
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import 'package:toolbox/data/res/build_data.dart';
|
|||||||
import 'package:toolbox/data/res/color.dart';
|
import 'package:toolbox/data/res/color.dart';
|
||||||
import 'package:toolbox/data/res/rebuild.dart';
|
import 'package:toolbox/data/res/rebuild.dart';
|
||||||
import 'package:toolbox/data/res/store.dart';
|
import 'package:toolbox/data/res/store.dart';
|
||||||
import 'package:toolbox/view/page/home.dart';
|
import 'package:toolbox/view/page/home/home.dart';
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
const MyApp({super.key});
|
const MyApp({super.key});
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import 'package:toolbox/data/model/server/private_key_info.dart';
|
|||||||
import 'package:toolbox/data/model/server/server_private_info.dart';
|
import 'package:toolbox/data/model/server/server_private_info.dart';
|
||||||
import 'package:toolbox/view/page/backup.dart';
|
import 'package:toolbox/view/page/backup.dart';
|
||||||
import 'package:toolbox/view/page/container.dart';
|
import 'package:toolbox/view/page/container.dart';
|
||||||
import 'package:toolbox/view/page/home.dart';
|
import 'package:toolbox/view/page/home/home.dart';
|
||||||
import 'package:toolbox/view/page/iperf.dart';
|
import 'package:toolbox/view/page/iperf.dart';
|
||||||
import 'package:toolbox/view/page/ping.dart';
|
import 'package:toolbox/view/page/ping.dart';
|
||||||
import 'package:toolbox/view/page/private_key/edit.dart';
|
import 'package:toolbox/view/page/private_key/edit.dart';
|
||||||
|
|||||||
@@ -10,4 +10,4 @@ abstract final class PermUtils {
|
|||||||
return result.isGranted;
|
return result.isGranted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -269,4 +269,4 @@ extension StatusCmdTypeX on StatusCmdType {
|
|||||||
StatusCmdType.battery => l10n.battery,
|
StatusCmdType.battery => l10n.battery,
|
||||||
final val => val.name,
|
final val => val.name,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
28
lib/view/page/home/appbar.dart
Normal file
28
lib/view/page/home/appbar.dart
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
part of 'home.dart';
|
||||||
|
|
||||||
|
final class _AppBar extends CustomAppBar {
|
||||||
|
final ValueNotifier<int> selectIndex;
|
||||||
|
|
||||||
|
const _AppBar({
|
||||||
|
required this.selectIndex,
|
||||||
|
super.title,
|
||||||
|
super.actions,
|
||||||
|
super.centerTitle,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ValueListenableBuilder(
|
||||||
|
valueListenable: selectIndex,
|
||||||
|
builder: (_, idx, __) {
|
||||||
|
if (idx == AppTab.ssh.index) {
|
||||||
|
return SizedBox(
|
||||||
|
height: CustomAppBar.barHeight ??
|
||||||
|
0 + MediaQuery.of(context).padding.top,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return super.build(context);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,26 +11,28 @@ import 'package:toolbox/core/extension/context/common.dart';
|
|||||||
import 'package:toolbox/core/extension/context/dialog.dart';
|
import 'package:toolbox/core/extension/context/dialog.dart';
|
||||||
import 'package:toolbox/core/extension/context/locale.dart';
|
import 'package:toolbox/core/extension/context/locale.dart';
|
||||||
import 'package:toolbox/core/persistant_store.dart';
|
import 'package:toolbox/core/persistant_store.dart';
|
||||||
|
import 'package:toolbox/core/route.dart';
|
||||||
import 'package:toolbox/core/update.dart';
|
import 'package:toolbox/core/update.dart';
|
||||||
import 'package:toolbox/core/utils/platform/auth.dart';
|
import 'package:toolbox/core/utils/platform/auth.dart';
|
||||||
import 'package:toolbox/core/utils/platform/base.dart';
|
import 'package:toolbox/core/utils/platform/base.dart';
|
||||||
import 'package:toolbox/core/utils/platform/perm.dart';
|
import 'package:toolbox/core/utils/platform/perm.dart';
|
||||||
|
import 'package:toolbox/core/utils/ui.dart';
|
||||||
|
import 'package:toolbox/data/model/app/github_id.dart';
|
||||||
|
import 'package:toolbox/data/model/app/tab.dart';
|
||||||
|
import 'package:toolbox/data/res/build_data.dart';
|
||||||
import 'package:toolbox/data/res/github_id.dart';
|
import 'package:toolbox/data/res/github_id.dart';
|
||||||
import 'package:toolbox/data/res/logger.dart';
|
import 'package:toolbox/data/res/logger.dart';
|
||||||
|
import 'package:toolbox/data/res/misc.dart';
|
||||||
import 'package:toolbox/data/res/provider.dart';
|
import 'package:toolbox/data/res/provider.dart';
|
||||||
import 'package:toolbox/data/res/store.dart';
|
import 'package:toolbox/data/res/store.dart';
|
||||||
|
import 'package:toolbox/data/res/ui.dart';
|
||||||
|
import 'package:toolbox/data/res/url.dart';
|
||||||
|
import 'package:toolbox/view/widget/appbar.dart';
|
||||||
|
import 'package:toolbox/view/widget/cardx.dart';
|
||||||
import 'package:toolbox/view/widget/markdown.dart';
|
import 'package:toolbox/view/widget/markdown.dart';
|
||||||
|
|
||||||
import '../../core/route.dart';
|
|
||||||
import '../../core/utils/ui.dart';
|
part 'appbar.dart';
|
||||||
import '../../data/model/app/github_id.dart';
|
|
||||||
import '../../data/model/app/tab.dart';
|
|
||||||
import '../../data/res/build_data.dart';
|
|
||||||
import '../../data/res/misc.dart';
|
|
||||||
import '../../data/res/ui.dart';
|
|
||||||
import '../../data/res/url.dart';
|
|
||||||
import '../widget/appbar.dart';
|
|
||||||
import '../widget/cardx.dart';
|
|
||||||
|
|
||||||
class HomePage extends StatefulWidget {
|
class HomePage extends StatefulWidget {
|
||||||
const HomePage({super.key});
|
const HomePage({super.key});
|
||||||
@@ -318,25 +320,7 @@ ${GithubIds.participants.map((e) => '[$e](${e.url})').join(' ')}
|
|||||||
// Auth required for first launch
|
// Auth required for first launch
|
||||||
BioAuth.go();
|
BioAuth.go();
|
||||||
|
|
||||||
PermUtils.request(Permission.notification).then((suc) {
|
_reqNotiPerm();
|
||||||
if (!suc) {
|
|
||||||
final noNotiPerm = Stores.setting.noNotiPerm;
|
|
||||||
if (noNotiPerm.fetch()) return;
|
|
||||||
context.showRoundDialog(
|
|
||||||
title: Text(l10n.error),
|
|
||||||
child: Text(l10n.noNotiPerm),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
noNotiPerm.put(true);
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
child: Text(l10n.ok),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (Stores.setting.autoCheckAppUpdate.fetch()) {
|
if (Stores.setting.autoCheckAppUpdate.fetch()) {
|
||||||
doUpdate(context);
|
doUpdate(context);
|
||||||
@@ -347,6 +331,27 @@ ${GithubIds.participants.map((e) => '[$e](${e.url})').join(' ')}
|
|||||||
await Pros.server.refresh();
|
await Pros.server.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _reqNotiPerm() async {
|
||||||
|
final suc = await PermUtils.request(Permission.notification);
|
||||||
|
if (!suc) {
|
||||||
|
final noNotiPerm = Stores.setting.noNotiPerm;
|
||||||
|
if (noNotiPerm.fetch()) return;
|
||||||
|
context.showRoundDialog(
|
||||||
|
title: Text(l10n.error),
|
||||||
|
child: Text(l10n.noNotiPerm),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
noNotiPerm.put(true);
|
||||||
|
context.pop();
|
||||||
|
},
|
||||||
|
child: Text(l10n.ok),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _onLongPressSetting() async {
|
Future<void> _onLongPressSetting() async {
|
||||||
final map = Stores.setting.box.toJson(includeInternal: false);
|
final map = Stores.setting.box.toJson(includeInternal: false);
|
||||||
final keys = map.keys;
|
final keys = map.keys;
|
||||||
@@ -378,30 +383,3 @@ ${GithubIds.participants.map((e) => '[$e](${e.url})').join(' ')}
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final class _AppBar extends CustomAppBar {
|
|
||||||
final ValueNotifier<int> selectIndex;
|
|
||||||
|
|
||||||
const _AppBar({
|
|
||||||
required this.selectIndex,
|
|
||||||
super.title,
|
|
||||||
super.actions,
|
|
||||||
super.centerTitle,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return ValueListenableBuilder(
|
|
||||||
valueListenable: selectIndex,
|
|
||||||
builder: (_, idx, __) {
|
|
||||||
if (idx == AppTab.ssh.index) {
|
|
||||||
return SizedBox(
|
|
||||||
height: CustomAppBar.barHeight ??
|
|
||||||
0 + MediaQuery.of(context).padding.top,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return super.build(context);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -280,7 +280,8 @@ Future<void> _onPkg(BuildContext context, ServerPrivateInfo spi) async {
|
|||||||
final gotoUpgrade = await context.showRoundDialog<bool>(
|
final gotoUpgrade = await context.showRoundDialog<bool>(
|
||||||
title: Text(l10n.attention),
|
title: Text(l10n.attention),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Text('${l10n.pkgUpgradeTip}\n${l10n.foundNUpdate(upgradeable.length)}\n\n$upgradeCmd'),
|
child: Text(
|
||||||
|
'${l10n.pkgUpgradeTip}\n${l10n.foundNUpdate(upgradeable.length)}\n\n$upgradeCmd'),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
CountDownBtn(
|
CountDownBtn(
|
||||||
|
|||||||
Reference in New Issue
Block a user