From 65ba42579304913a20b282697b90af3efce98e57 Mon Sep 17 00:00:00 2001 From: niuhuan Date: Fri, 15 Jul 2022 10:02:17 +0800 Subject: [PATCH] Upgrade --- ci/cmd/send_to_community/main.go | 3 +- ci/version.code.txt | 2 +- ci/version.info.txt | 8 +- lib/configs/volume_controller.dart | 44 +++++++++ lib/screens/comic_reader_screen.dart | 4 +- lib/screens/init_screen.dart | 2 + lib/screens/settings_screen.dart | 6 ++ pubspec.lock | 140 +++++++++++++-------------- 8 files changed, 133 insertions(+), 76 deletions(-) create mode 100644 lib/configs/volume_controller.dart diff --git a/ci/cmd/send_to_community/main.go b/ci/cmd/send_to_community/main.go index c1e27c8..2f798cd 100644 --- a/ci/cmd/send_to_community/main.go +++ b/ci/cmd/send_to_community/main.go @@ -8,7 +8,6 @@ import ( "github.com/andersfylling/disgord" tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5" "io/ioutil" - "log" "os" "strings" ) @@ -59,7 +58,7 @@ func main() { func sendMessageToTg(token string, ids []int64, message string) { bot, err := tgbotapi.NewBotAPI(token) if err != nil { - log.Panic(err) + fmt.Sprintf("tgbotapi error : %v (error : %v)", err.Error()) } for _, id := range ids { msg := tgbotapi.NewMessage(id, message) diff --git a/ci/version.code.txt b/ci/version.code.txt index a92e827..837042c 100644 --- a/ci/version.code.txt +++ b/ci/version.code.txt @@ -1 +1 @@ -v0.0.4 \ No newline at end of file +v0.0.5 \ No newline at end of file diff --git a/ci/version.info.txt b/ci/version.info.txt index 85f967b..efd8dda 100644 --- a/ci/version.info.txt +++ b/ci/version.info.txt @@ -1,2 +1,8 @@ -- [x] 增加分类 +v0.0.5 + +- [x] 安卓可以在设置中开启音量键翻页 + +v0.0.4 + +- [x] 增加分类筛选项 - [x] 升级flutter版本 diff --git a/lib/configs/volume_controller.dart b/lib/configs/volume_controller.dart new file mode 100644 index 0000000..6e269b4 --- /dev/null +++ b/lib/configs/volume_controller.dart @@ -0,0 +1,44 @@ +/// 音量键翻页 + +import 'dart:io'; + +import 'package:flutter/material.dart'; + +import '../basic/commons.dart'; +import '../basic/methods.dart'; + +const _propertyName = "volumeController"; +late bool volumeController; + +Future initVolumeController() async { + volumeController = (await methods.loadProperty(k: _propertyName)) == "true"; +} + +Future _chooseVolumeController(BuildContext context) async { + String? result = await chooseListDialog( + context, + title: "音量键控制翻页", + values: ["是", "否"], + ); + if (result != null) { + var target = result == "是"; + await methods.saveProperty(k: _propertyName, v: "$target"); + volumeController = target; + } +} + +Widget volumeControllerSetting() { + if (Platform.isAndroid) { + return StatefulBuilder(builder: + (BuildContext context, void Function(void Function()) setState) { + return ListTile( + title: const Text("阅读器音量键翻页"), + subtitle: Text(volumeController ? "是" : "否"), + onTap: () async { + await _chooseVolumeController(context); + setState(() {}); + }); + }); + } + return Container(); +} diff --git a/lib/screens/comic_reader_screen.dart b/lib/screens/comic_reader_screen.dart index 3d60587..8aadc4c 100644 --- a/lib/screens/comic_reader_screen.dart +++ b/lib/screens/comic_reader_screen.dart @@ -12,6 +12,7 @@ import '../../configs/reader_controller_type.dart'; import '../../configs/reader_direction.dart'; import '../../configs/reader_slider_position.dart'; import '../../configs/reader_type.dart'; +import '../configs/volume_controller.dart'; import './components/content_error.dart'; import './components/content_loading.dart'; import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; @@ -120,8 +121,6 @@ class _ComicReaderScreenState extends State { // 仅最后一次监听生效 // event可能为DOWN/UP -const _listVolume = false; - var _volumeListenCount = 0; void _onVolumeEvent(dynamic args) { @@ -220,6 +219,7 @@ abstract class _ComicReaderState extends State<_ComicReader> { _needJumpTo(int pageIndex, bool animation); + late final bool _listVolume = volumeController; late bool _fullScreen; late int _current; late int _slider; diff --git a/lib/screens/init_screen.dart b/lib/screens/init_screen.dart index 6575edc..25b4470 100644 --- a/lib/screens/init_screen.dart +++ b/lib/screens/init_screen.dart @@ -13,6 +13,7 @@ import '../configs/reader_slider_position.dart'; import '../configs/reader_type.dart'; import '../configs/themes.dart'; import '../configs/versions.dart'; +import '../configs/volume_controller.dart'; import 'app_screen.dart'; class InitScreen extends StatefulWidget { @@ -37,6 +38,7 @@ class _InitScreenState extends State { await initPagerControllerMode(); await initPagerViewMode(); await initHost(); + await initVolumeController(); autoCheckNewVersion(); Navigator.of(context).pushReplacement( MaterialPageRoute(builder: (BuildContext context) => const AppScreen()), diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index 2067671..b7411b0 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -1,6 +1,9 @@ import 'package:flutter/material.dart'; import 'package:wax/configs/themes.dart'; import 'package:wax/configs/versions.dart'; + +import '../configs/volume_controller.dart'; + class SettingsScreen extends StatelessWidget { const SettingsScreen({Key? key}) : super(key: key); @@ -18,6 +21,9 @@ class SettingsScreen extends StatelessWidget { lightThemeSetting(), darkThemeSetting(), const Divider(), + const Divider(), + volumeControllerSetting(), + const Divider(), ], ), ); diff --git a/pubspec.lock b/pubspec.lock index 558f7da..c26bfe7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,98 +5,98 @@ packages: dependency: "direct main" description: name: another_xlider - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1+2" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.8.2" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.1" clipboard: dependency: "direct main" description: name: clipboard - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.3" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.16.0" convert: dependency: "direct main" description: name: convert - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "3.0.1" + version: "3.0.2" crypto: dependency: "direct main" description: name: crypto - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.2" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.4" + version: "1.0.5" event: dependency: "direct main" description: name: event - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.2" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.3.0" fixnum: dependency: transitive description: name: fixnum - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" flutter: @@ -108,14 +108,14 @@ packages: dependency: "direct main" description: name: flutter_colorpicker - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.3" flutter_lints: dependency: "direct dev" description: name: flutter_lints - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.4" flutter_localizations: @@ -127,23 +127,23 @@ packages: dependency: "direct main" description: name: flutter_search_bar - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.0-dev.1" flutter_styled_toast: dependency: "direct main" description: name: flutter_styled_toast - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" flutter_svg: dependency: "direct main" description: name: flutter_svg - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.3" + version: "1.1.1+1" flutter_test: dependency: "direct dev" description: flutter @@ -158,147 +158,147 @@ packages: dependency: transitive description: name: intl - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.17.0" js: dependency: transitive description: name: js - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.6.4" lints: dependency: transitive description: name: lints - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.12.11" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.4" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.7.0" modal_bottom_sheet: dependency: "direct main" description: name: modal_bottom_sheet - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.1" + version: "2.1.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.8.1" path_drawing: dependency: transitive description: name: path_drawing - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" path_parsing: dependency: transitive description: name: path_parsing - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" pedantic: dependency: transitive description: name: pedantic - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.11.1" permission_handler: dependency: "direct main" description: name: permission_handler - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "9.2.0" permission_handler_android: dependency: transitive description: name: permission_handler_android - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "9.0.2+1" permission_handler_apple: dependency: transitive description: name: permission_handler_apple - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "9.0.4" permission_handler_platform_interface: dependency: transitive description: name: permission_handler_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.7.0" permission_handler_windows: dependency: transitive description: name: permission_handler_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.0" petitparser: dependency: transitive description: name: petitparser - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "4.4.0" + version: "5.0.0" photo_view: dependency: "direct main" description: name: photo_view - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.13.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.2" protobuf: dependency: "direct main" description: name: protobuf - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.1" + version: "2.1.0" scrollable_positioned_list: dependency: "direct main" description: name: scrollable_positioned_list - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.2.3" sky_engine: @@ -310,121 +310,121 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.8.2" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.9" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.0" + version: "1.3.1" url_launcher: dependency: "direct main" description: name: url_launcher - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "6.1.2" + version: "6.1.5" url_launcher_android: dependency: transitive description: name: url_launcher_android - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.0.17" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "6.0.17" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.1" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.1" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.5" + version: "2.1.0" url_launcher_web: dependency: transitive description: name: url_launcher_web - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.11" + version: "2.0.12" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.0.1" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.2" xml: dependency: transitive description: name: xml - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "5.3.1" + version: "6.1.0" sdks: - dart: ">=2.17.0-0 <3.0.0" - flutter: ">=2.10.0" + dart: ">=2.17.0 <3.0.0" + flutter: ">=3.0.0"