feat: merge danmaku

Closes #150

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-13 14:20:16 +08:00
parent 9bf9f8595b
commit b77d28e285
5 changed files with 35 additions and 2 deletions

View File

@@ -88,3 +88,12 @@ extension BuildContextExt on BuildContext {
);
}
}
extension Unique<E, Id> on List<E> {
List<E> unique([Id Function(E element)? id, bool inplace = true]) {
final ids = <dynamic>{};
var list = inplace ? this : List<E>.from(this);
list.retainWhere((x) => ids.add(id != null ? id(x) : x as Id));
return list;
}
}

View File

@@ -339,6 +339,9 @@ class GStorage {
static bool get showVipDanmaku =>
GStorage.setting.get(SettingBoxKey.showVipDanmaku, defaultValue: true);
static bool get mergeDanmaku =>
GStorage.setting.get(SettingBoxKey.mergeDanmaku, defaultValue: false);
static List<double> get dynamicDetailRatio => List<double>.from(setting
.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]));
@@ -558,6 +561,7 @@ class SettingBoxKey {
refreshDragPercentage = 'refreshDragPercentage',
refreshDisplacement = 'refreshDisplacement',
showVipDanmaku = 'showVipDanmaku',
mergeDanmaku = 'mergeDanmaku',
// Sponsor Block
enableSponsorBlock = 'enableSponsorBlock',