Skip to content

Commit

Permalink
v1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
niuhuan committed Jul 18, 2022
1 parent abd2d9a commit 627043a
Show file tree
Hide file tree
Showing 15 changed files with 573 additions and 34 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,18 @@ wax

## 请您遵守使用规则

本软件仅供学习交流使用, 本软件或本软件的拓展, 个人或企业不可用于商业用途, 不可上架任何商店
软件副本分发规则

- 本软件仅供学习交流使用, 本软件或本软件的拓展, 个人或企业不可用于商业用途, 不可上架任何商店
- 不要在任何其他 **二次元软件****聊天社区****开发社区** 内, 发布有关本软件的链接或信息
- 不要发送本软件安装包到 **任何社区内** , 不要将APK/IPA/ZIP/DMG发送包括任何聊天软件内的群聊功能。 分享本软件时, 在社区中使用Github中提供的Releases页面的链接, 或使用私聊窗口发送。

拓展包括但是不限于以下内容

- 使用本软件进行继续开发形成的软件。
- 引入本软件部分内容为依赖/参考本软件/使用本软件内代码的同时, 包含本软件内一致内容或功能的软件。
- 直接对本软件进行打包发布

软件副本分发规则

- 不要在任何其他 **二次元软件****聊天社区****开发社区** 内, 发布有关本软件的链接或信息
- 不要发送本软件安装包到 **任何社区内** , 不要将APK/IPA/ZIP/DMG发送包括任何聊天软件内的群聊功能。 分享本软件时, 在社区中使用Github中提供的Releases页面的链接, 或使用私聊窗口发送。
- 作者不对分发软件承担任何后果, 请您遵守当地以及副本接受社区或副本接收人所在地区的法律。
责任声明

- 作者仅分享编程技术, 不分发软件, 不对分发软件承担任何后果。 因传播或下载造成的法律问题或纠纷, 需行为人自行承担, 请您遵守当地法以及副本接受方(社区或人)所在地区的法律。
2 changes: 1 addition & 1 deletion ci/version.code.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.0.5
v1.1.1
11 changes: 6 additions & 5 deletions ci/version.info.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
v0.0.5
v1.0.0

- [x] 安卓可以在设置中开启音量键翻页
- [x] 下载缓存漫画, 多线程
- [x] 发电
- [x] 一次推送了大量代码, 如有BUG请及时反馈

v0.0.4
v0.0.5

- [x] 增加分类筛选项
- [x] 升级flutter版本
- [x] 安卓可以在设置中开启音量键翻页
73 changes: 62 additions & 11 deletions lib/basic/methods.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,12 @@ class Methods {
}

Future<bool> hasDownload($fixnum.Int64 comicId) async {
// todo
return false;
}

Future downloadComic($fixnum.Int64 id) async {
// todo
return BoolValue.fromBuffer(await _flatInvoke(
"hasDownload",
DownloadInfoQuery(
id: comicId,
),
)).value;
}

Future updateViewLog($fixnum.Int64 id, int initRank) async {
Expand All @@ -221,10 +221,61 @@ class Methods {

Future pushToDownloads(List<ComicSimple> list) {
return _flatInvoke(
"pushToDownloads",
PushToDownloads(
host: host,
comics: list,
));
"pushToDownloads",
PushToDownloads(
host: host,
comics: list,
),
);
}

Future<ComicDownloadsRes> downloads() async {
return ComicDownloadsRes.fromBuffer(await _flatInvoke(
"downloads",
Empty(),
));
}

Future<ComicDownloadInfoDto> downloadInfo($fixnum.Int64 id) async {
return ComicDownloadInfoDto.fromBuffer(await _flatInvoke(
"downloadInfo",
DownloadInfoQuery(
id: id,
),
));
}

Future<DownloadComicPages> downloadPages($fixnum.Int64 id) async {
return DownloadComicPages.fromBuffer(await _flatInvoke(
"downloadPages",
DownloadInfoQuery(
id: id,
),
));
}

Future resetDownload() {
return _flatInvoke(
"resetDownload",
Empty(),
);
}

Future setDownloadThread(int count) {
return _flatInvoke(
"setDownloadThread",
IntValue(
value: $fixnum.Int64.fromInts(0, count),
),
);
}

Future<int> getDownloadThread() async {
return IntValue.fromBuffer(await _flatInvoke(
"getDownloadThread",
Empty(),
))
.value
.toInt();
}
}
47 changes: 47 additions & 0 deletions lib/configs/download_thread_count.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/// 多线程下载并发数
import 'package:flutter/material.dart';

import '../basic/commons.dart';
import '../basic/methods.dart';
import 'is_pro.dart';

late int _downloadThreadCount;
int get downloadThreadCount => _downloadThreadCount;
const _values = [1, 2, 3, 4, 5];

Future initDownloadThreadCount() async {
_downloadThreadCount = await methods.getDownloadThread();
}

Widget downloadThreadCountSetting() {
return StatefulBuilder(
builder: (BuildContext context, void Function(void Function()) setState) {
return ListTile(
title: Text(
"下载线程数" + (!isPro ? "(发电)" : ""),
style: TextStyle(
color: !isPro ? Colors.grey : null,
),
),
subtitle: Text("$_downloadThreadCount"),
onTap: () async {
await chooseDownloadThread(context);
setState(() {});
},
);
},
);
}

Future chooseDownloadThread(BuildContext context) async {
if (!isPro) {
defaultToast(context, "先发电才能使用多线程嗷");
return;
}
int? value = await chooseListDialog(context,title: "选择下载线程数", values:_values,);
if (value != null) {
await methods.setDownloadThread(value);
_downloadThreadCount = value;
}
}
10 changes: 10 additions & 0 deletions lib/screens/browser_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:flutter_search_bar/flutter_search_bar.dart';
import 'package:wax/basic/methods.dart';
import 'package:wax/configs/host.dart';
import 'package:wax/protos/properties.pb.dart';
import 'package:wax/screens/downloads_screen.dart';
import 'package:wax/screens/pro_screen.dart';
import 'package:wax/screens/search_screen.dart';

Expand Down Expand Up @@ -65,6 +66,15 @@ class _BrowserScreenState extends State<BrowserScreen>
title: Text(_title()),
actions: [
...alwaysInActions(),
IconButton(
onPressed: () {
Navigator.of(context)
.push(MaterialPageRoute(builder: (BuildContext context) {
return const DownloadsScreen();
}));
},
icon: const Icon(Icons.download),
),
proAction(),
_searchBar.getSearchAction(context),
chooseCateAction(context),
Expand Down
6 changes: 4 additions & 2 deletions lib/screens/comic_info_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,19 @@ class _ComicInfoScreenState extends State<ComicInfoScreen> {
icon: const Icon(Icons.download_done),
);
} else {
// todo reload
return IconButton(
onPressed: () async {
var confirm =
await confirmDialog(context, "下载", "下载这个漫画吗?");
if (confirm) {
await methods.downloadComic(widget.comicSimple.id);
await methods.pushToDownloads([
widget.comicSimple,
]);
setState(() {
_hasDownloadFuture =
methods.hasDownload(widget.comicSimple.id);
});
defaultToast(context, "已加入下载队列");
}
},
icon: const Icon(Icons.download),
Expand Down
88 changes: 88 additions & 0 deletions lib/screens/components/download_info_card.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import 'package:flutter/material.dart';
import 'package:wax/protos/properties.pb.dart';

import '../../basic/commons.dart';
import 'images.dart';

// todo 加载本地cover
// todo 显示下载状态和进度
class DownloadInfoCard extends StatelessWidget {
final bool link;
final ComicDownloadDto comic;

const DownloadInfoCard(
this.comic, {
this.link = false,
Key? key,
}) : super(key: key);

@override
Widget build(BuildContext context) {
const titleStyle = TextStyle(fontWeight: FontWeight.bold);
final authorStyle = TextStyle(
fontSize: 13,
color: Colors.pink.shade300,
);
return Container(
padding: const EdgeInsets.only(top: 5, bottom: 5, left: 10, right: 10),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Theme.of(context).dividerColor,
),
),
),
child: Row(
children: [
Card(
child: ComicImage(
url: comic.cover,
width: 100 * coverWidth / coverHeight,
height: 100,
),
),
Container(width: 10),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
link
? GestureDetector(
onLongPress: () {
confirmCopy(context, comic.title);
},
child: Text(comic.title, style: titleStyle),
)
: Text(comic.title, style: titleStyle),
Container(height: 4),
Row(children: [
Text(
comic.deleting
? "删除中"
: comic.status == 2
? "下载失败"
: comic.status == 1
? "下载成功"
: "下载中",
style: TextStyle(
color: comic.deleting
? Colors.red
: comic.status == 2
? Colors.red
: comic.status == 1
? Colors.green
: Colors.blue,
),
),
Container(width: 14),
Text("${comic.pageDown} / ${comic.pageCount}"),
]),
Container(height: 4),
],
),
),
],
),
);
}
}
Loading

0 comments on commit 627043a

Please sign in to comment.