mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-08 20:14:51 +08:00
improve anti goods dyn
Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -43,9 +43,22 @@ class DynamicsDataModel {
|
|||||||
);
|
);
|
||||||
static bool enableFilter = banWordForDyn.pattern.isNotEmpty;
|
static bool enableFilter = banWordForDyn.pattern.isNotEmpty;
|
||||||
|
|
||||||
|
static const kAdditionalGoodsType = 'ADDITIONAL_TYPE_GOODS';
|
||||||
|
static const kRichTextGoodsType = 'RICH_TEXT_NODE_TYPE_GOODS';
|
||||||
|
static bool hasGoods(DynamicItemModel? item) {
|
||||||
|
if (item?.modules.moduleDynamic case final moduleDynamic?) {
|
||||||
|
return moduleDynamic.additional?.type == kAdditionalGoodsType ||
|
||||||
|
(moduleDynamic.major?.opus?.summary?.richTextNodes?.any(
|
||||||
|
(e) => e.type == kRichTextGoodsType,
|
||||||
|
) ??
|
||||||
|
false);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
DynamicsDataModel.fromJson(
|
DynamicsDataModel.fromJson(
|
||||||
Map<String, dynamic> json, {
|
Map<String, dynamic> json, {
|
||||||
DynamicsTabType type = DynamicsTabType.all,
|
DynamicsTabType type = .all,
|
||||||
Set<int>? tempBannedList,
|
Set<int>? tempBannedList,
|
||||||
}) {
|
}) {
|
||||||
hasMore = json['has_more'];
|
hasMore = json['has_more'];
|
||||||
@@ -53,14 +66,10 @@ class DynamicsDataModel {
|
|||||||
List? list = json['items'] as List?;
|
List? list = json['items'] as List?;
|
||||||
if (list != null && list.isNotEmpty) {
|
if (list != null && list.isNotEmpty) {
|
||||||
items = <DynamicItemModel>[];
|
items = <DynamicItemModel>[];
|
||||||
late final filterBan =
|
late final filterBan = type != .up && tempBannedList?.isNotEmpty == true;
|
||||||
type != DynamicsTabType.up && tempBannedList?.isNotEmpty == true;
|
|
||||||
for (final e in list) {
|
for (final e in list) {
|
||||||
DynamicItemModel item = DynamicItemModel.fromJson(e);
|
DynamicItemModel item = DynamicItemModel.fromJson(e);
|
||||||
if ((item.orig?.modules.moduleDynamic?.additional?.type ==
|
if (hasGoods(item.orig) || hasGoods(item)) {
|
||||||
'ADDITIONAL_TYPE_GOODS' ||
|
|
||||||
item.modules.moduleDynamic?.additional?.type ==
|
|
||||||
'ADDITIONAL_TYPE_GOODS')) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (enableFilter) {
|
if (enableFilter) {
|
||||||
|
|||||||
Reference in New Issue
Block a user