Skip to content

Commit

Permalink
Upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
niuhuan committed Jul 15, 2022
1 parent 13ae8b4 commit 65ba425
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 76 deletions.
3 changes: 1 addition & 2 deletions ci/cmd/send_to_community/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ci/version.code.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.0.4
v0.0.5
8 changes: 7 additions & 1 deletion ci/version.info.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
- [x] 增加分类
v0.0.5

- [x] 安卓可以在设置中开启音量键翻页

v0.0.4

- [x] 增加分类筛选项
- [x] 升级flutter版本
44 changes: 44 additions & 0 deletions lib/configs/volume_controller.dart
Original file line number Diff line number Diff line change
@@ -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<void> initVolumeController() async {
volumeController = (await methods.loadProperty(k: _propertyName)) == "true";
}

Future<void> _chooseVolumeController(BuildContext context) async {
String? result = await chooseListDialog<String>(
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();
}
4 changes: 2 additions & 2 deletions lib/screens/comic_reader_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -120,8 +121,6 @@ class _ComicReaderScreenState extends State<ComicReaderScreen> {
// 仅最后一次监听生效
// event可能为DOWN/UP

const _listVolume = false;

var _volumeListenCount = 0;

void _onVolumeEvent(dynamic args) {
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions lib/screens/init_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -37,6 +38,7 @@ class _InitScreenState extends State<InitScreen> {
await initPagerControllerMode();
await initPagerViewMode();
await initHost();
await initVolumeController();
autoCheckNewVersion();
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (BuildContext context) => const AppScreen()),
Expand Down
6 changes: 6 additions & 0 deletions lib/screens/settings_screen.dart
Original file line number Diff line number Diff line change
@@ -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);

Expand All @@ -18,6 +21,9 @@ class SettingsScreen extends StatelessWidget {
lightThemeSetting(),
darkThemeSetting(),
const Divider(),
const Divider(),
volumeControllerSetting(),
const Divider(),
],
),
);
Expand Down
Loading

0 comments on commit 65ba425

Please sign in to comment.