基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。
feat: better timeline fliter (#1982)
keyboard2005ad15ed9537ba
diff --git a/lib/hive_registrar.g.dart b/lib/hive_registrar.g.dartindex 96dd3665..a88e9f80 100644--- a/lib/hive_registrar.g.dart+++ b/lib/hive_registrar.g.dart@@ -2,7 +2,7 @@// Do not modify// Check in to version control-import 'package:hive_ce/hive.dart';+import 'package:hive_ce/hive_ce.dart';import 'package:kazumi/modules/bangumi/bangumi_item.dart';import 'package:kazumi/modules/bangumi/bangumi_tag.dart';import 'package:kazumi/modules/collect/collect_change_module.dart';diff --git a/lib/pages/timeline/timeline_controller.dart b/lib/pages/timeline/timeline_controller.dartindex 52f8da2e..5e452c4e 100644--- a/lib/pages/timeline/timeline_controller.dart+++ b/lib/pages/timeline/timeline_controller.dart@@ -32,6 +32,9 @@ abstract class _TimelineController with Store {@observablelate bool notShowWatchedBangumis = _collectRepository.getTimelineNotShowWatchedBangumis();+ @observable+ late bool onlyShowWatchingBangumis = _collectRepository.getTimelineOnlyShowWatchingBangumis();+int sortType = 1;late DateTime selectedDate;@@ -136,4 +139,14 @@ abstract class _TimelineController with Store {Set<int> loadWatchedBangumiIds() {return _collectRepository.getBangumiIdsByType(CollectType.watched);}++ @action+ Future<void> setOnlyShowWatchingBangumis(bool value) async {+ onlyShowWatchingBangumis = value;+ await _collectRepository.updateTimelineOnlyShowWatchingBangumis(value);+ }++ Set<int> loadWatchingBangumiIds() {+ return _collectRepository.getBangumiIdsByType(CollectType.watching);+ }}diff --git a/lib/pages/timeline/timeline_controller.g.dart b/lib/pages/timeline/timeline_controller.g.dartindex 90b6d615..4e506af2 100644--- a/lib/pages/timeline/timeline_controller.g.dart+++ b/lib/pages/timeline/timeline_controller.g.dart@@ -119,6 +119,29 @@ mixin _$TimelineController on _TimelineController, Store {});}+ late final _$onlyShowWatchingBangumisAtom = Atom(+ name: '_TimelineController.onlyShowWatchingBangumis', context: context);++ @override+ bool get onlyShowWatchingBangumis {+ _$onlyShowWatchingBangumisAtom.reportRead();+ return super.onlyShowWatchingBangumis;+ }++ bool _onlyShowWatchingBangumisIsInitialized = false;++ @override+ set onlyShowWatchingBangumis(bool value) {+ _$onlyShowWatchingBangumisAtom.reportWrite(+ value,+ _onlyShowWatchingBangumisIsInitialized+ ? super.onlyShowWatchingBangumis+ : null, () {+ super.onlyShowWatchingBangumis = value;+ _onlyShowWatchingBangumisIsInitialized = true;+ });+ }+late final _$setNotShowAbandonedBangumisAsyncAction = AsyncAction('_TimelineController.setNotShowAbandonedBangumis',context: context);@@ -139,6 +162,16 @@ mixin _$TimelineController on _TimelineController, Store {.run(() => super.setNotShowWatchedBangumis(value));}+ late final _$setOnlyShowWatchingBangumisAsyncAction = AsyncAction(+ '_TimelineController.setOnlyShowWatchingBangumis',+ context: context);++ @override+ Future<void> setOnlyShowWatchingBangumis(bool value) {+ return _$setOnlyShowWatchingBangumisAsyncAction+ .run(() => super.setOnlyShowWatchingBangumis(value));+ }+@overrideString toString() {return '''@@ -147,7 +180,8 @@ seasonString: ${seasonString},isLoading: ${isLoading},isTimeOut: ${isTimeOut},notShowAbandonedBangumis: ${notShowAbandonedBangumis},-notShowWatchedBangumis: ${notShowWatchedBangumis}+notShowWatchedBangumis: ${notShowWatchedBangumis},+onlyShowWatchingBangumis: ${onlyShowWatchingBangumis}''';}}diff --git a/lib/pages/timeline/timeline_page.dart b/lib/pages/timeline/timeline_page.dartindex 1e926e5a..6a8a3886 100644--- a/lib/pages/timeline/timeline_page.dart+++ b/lib/pages/timeline/timeline_page.dart@@ -364,6 +364,23 @@ class _TimelinePageState extends State<TimelinePage>),),),+ Observer(+ builder: (context) => InkWell(+ onTap: () {+ timelineController.setOnlyShowWatchingBangumis(+ !timelineController.onlyShowWatchingBangumis);+ },+ child: ListTile(+ title: const Text('只显示在看的番剧'),+ trailing: Switch(+ value: timelineController.onlyShowWatchingBangumis,+ onChanged: (value) {+ timelineController.setOnlyShowWatchingBangumis(value);+ },+ ),+ ),+ ),+ ),],);}@@ -463,7 +480,7 @@ class _TimelinePageState extends State<TimelinePage>constraints: BoxConstraints(maxHeight: (MediaQuery.sizeOf(context).height >=LayoutBreakpoint.compact['height']!)- ? MediaQuery.of(context).size.height * 1 / 4+ ? MediaQuery.of(context).size.height * 1 / 3: MediaQuery.of(context).size.height,maxWidth: (MediaQuery.sizeOf(context).width >=LayoutBreakpoint.medium['width']!)@@ -541,6 +558,13 @@ class _TimelinePageState extends State<TimelinePage>.toList();}+ if (timelineController.onlyShowWatchingBangumis) {+ final watchingBangumiIds = timelineController.loadWatchingBangumiIds();+ filteredList = filteredList+ .where((item) => watchingBangumiIds.contains(item.id))+ .toList();+ }+gridViewList.add(CustomScrollView(slivers: [diff --git a/lib/repositories/collect_repository.dart b/lib/repositories/collect_repository.dartindex dd5a4ecd..4e0862ed 100644--- a/lib/repositories/collect_repository.dart+++ b/lib/repositories/collect_repository.dart@@ -46,6 +46,12 @@ abstract class ICollectRepository {/// 更新时间表页"不显示已看过番剧"设置Future<void> updateTimelineNotShowWatchedBangumis(bool value);+ /// 获取时间表页"只显示在看的番剧"设置+ bool getTimelineOnlyShowWatchingBangumis();++ /// 更新时间表页"只显示在看的番剧"设置+ Future<void> updateTimelineOnlyShowWatchingBangumis(bool value);+// ========== 其他设置 ==========/// 获取隐私模式设置@@ -219,6 +225,37 @@ class CollectRepository implements ICollectRepository {}}+ @override+ bool getTimelineOnlyShowWatchingBangumis() {+ try {+ final value = _settingBox.get(+ SettingBoxKey.timelineOnlyShowWatchingBangumis,+ defaultValue: false,+ );+ return value is bool ? value : false;+ } catch (e, stackTrace) {+ KazumiLogger().e(+ 'GStorage: get timeline only show watching bangumis setting failed, using default false',+ error: e,+ stackTrace: stackTrace,+ );+ return false;+ }+ }++ @override+ Future<void> updateTimelineOnlyShowWatchingBangumis(bool value) async {+ try {+ await _settingBox.put(SettingBoxKey.timelineOnlyShowWatchingBangumis, value);+ } catch (e, stackTrace) {+ KazumiLogger().e(+ 'GStorage: update timeline only show watching bangumis setting failed. value=$value',+ error: e,+ stackTrace: stackTrace,+ );+ }+ }+// ========== 其他设置实现 ==========@overridediff --git a/lib/utils/storage.dart b/lib/utils/storage.dartindex c62829b1..6c3e9294 100644--- a/lib/utils/storage.dart+++ b/lib/utils/storage.dart@@ -331,6 +331,7 @@ class SettingBoxKey {searchNotShowAbandonedBangumis = 'searchNotShowAbandonedBangumis',timelineNotShowAbandonedBangumis = 'timelineNotShowAbandonedBangumis',timelineNotShowWatchedBangumis = 'timelineNotShowWatchedBangumis',+ timelineOnlyShowWatchingBangumis = 'timelineOnlyShowWatchingBangumis',useSystemFont = 'useSystemFont',forceAdBlocker = 'forceAdBlocker',backgroundPlayback = 'backgroundPlayback',