Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions AwemeHeaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -1469,3 +1469,16 @@ typedef NS_ENUM(NSUInteger, DYEdgeMode) {

@interface AWEDPlayerProgressContainerView : UIView
@end

// 精选标签
@interface AWETemplateStaticLabelInfoModel : NSObject
@property (nonatomic, copy) NSArray *containers;
@end

// 好友推荐
@interface AFDFriendRecommendTagView : UIView
@end

// 顶栏选中指示线
@interface AWEFeedMultiTabSelectedContainerView : UIView
@end
245 changes: 170 additions & 75 deletions DYYY.xm
Original file line number Diff line number Diff line change
Expand Up @@ -3690,13 +3690,10 @@ static NSHashTable *processedParentViews = nil;
// 隐藏顶栏关注下的提示线
%hook AWEFeedMultiTabSelectedContainerView

- (void)setHidden:(BOOL)hidden {
BOOL forceHide = DYYYGetBool(@"DYYYHideTopBarLine");

if (forceHide) {
%orig(YES);
} else {
%orig(hidden);
- (void)layoutSubviews {
%orig;
if (DYYYGetBool(@"DYYYHideTopBarLine")) {
self.hidden = YES;
}
}

Expand Down Expand Up @@ -3787,15 +3784,25 @@ static NSHashTable *processedParentViews = nil;
%end

// 隐藏关注直播
%hook AWEConcernSkylightCapsuleView
- (void)setHidden:(BOOL)hidden {
if (DYYYGetBool(@"DYYYHideConcernCapsuleView")) {
%orig(YES);
return;
}
%hook AWELiveSkylightViewModel

%orig(hidden);
- (id)dataSource {
BOOL DYYYHideConcernCapsuleView = DYYYGetBool(@"DYYYHideConcernCapsuleView");
if (DYYYHideConcernCapsuleView) {
return nil;
}
return %orig;
}

- (void)setDataSource:(id)dataSource {
BOOL DYYYHideConcernCapsuleView = DYYYGetBool(@"DYYYHideConcernCapsuleView");
if (DYYYHideConcernCapsuleView) {
%orig(nil);
return;
}
%orig;
}

%end

%hook AWELiveAutoEnterStyleAView
Expand Down Expand Up @@ -3843,17 +3850,22 @@ static NSHashTable *processedParentViews = nil;

%end

// 隐藏话题
%hook AWEPlayInteractionTemplateButtonGroup
- (void)layoutSubviews {
if (DYYYGetBool(@"DYYYHideTemplateGroup")) {
UIView *parentView = self.superview;
if (parentView) {
[parentView removeFromSuperview];
}
return;
}
%orig;
// 屏蔽模板按钮组件(底部互动)- hook button 方法返回 nil
%hook AWEPlayInteractionTemplateButton
- (id)button {
BOOL DYYYHideBottomInteraction = DYYYGetBool(@"DYYYHideBottomInteraction");
if (DYYYHideBottomInteraction) {
return nil;
}
return %orig;
}

- (void)setButton:(id)button {
BOOL DYYYHideBottomInteraction = DYYYGetBool(@"DYYYHideBottomInteraction");
if (DYYYHideBottomInteraction) {
return; // 不设置按钮
}
%orig;
}
%end

Expand Down Expand Up @@ -3945,15 +3957,13 @@ static NSHashTable *processedParentViews = nil;

// 隐藏首页直播胶囊
%hook AWEHPTopTabItemBadgeContentView

- (void)layoutSubviews {
%orig;
if (DYYYGetBool(@"DYYYHideLiveCapsuleView")) {
if (DYYYGetBool(@"DYYYHideConcernCapsuleView")) {
self.hidden = YES;
return;
}
%orig;
}

%end

// 隐藏群商店
Expand Down Expand Up @@ -4075,19 +4085,6 @@ static NSHashTable *processedParentViews = nil;

%end

// 隐藏顶栏红点
%hook AWEHPTopTabItemBadgeContentView
- (id)showBadgeWithBadgeStyle:(NSUInteger)style badgeConfig:(id)config count:(NSInteger)count text:(id)text {
BOOL hideEnabled = DYYYGetBool(@"DYYYHideTopBarBadge");

if (hideEnabled) {
return nil;
} else {
return %orig(style, config, count, text);
}
}
%end

// 隐藏直播退出清屏、投屏按钮
%hook IESLiveButton

Expand Down Expand Up @@ -4328,6 +4325,77 @@ static NSHashTable *processedParentViews = nil;
}
%end

// 推荐页过滤视频发布时间(数组级别过滤,属性已完整初始化)
%hook AWEHotListDataController

- (id)transferAwemeListIfNeededWithArray:(id)arg1 isInitFetch:(BOOL)arg2 {
NSArray *orig = %orig;
if (!orig || orig.count == 0) return orig;

// --- 配置读取 ---
NSInteger daysThreshold = DYYYGetInteger(@"DYYYFilterTimeLimit");
BOOL skipLive = DYYYGetBool(@"DYYYSkipLive"); // 读取直播过滤开关
NSInteger minLikesThreshold = DYYYGetInteger(@"DYYYFilterLowLikes"); // 读取低赞过滤阈值 (例如: 1000)

NSTimeInterval now = [[NSDate date] timeIntervalSince1970];
NSTimeInterval thresholdInSeconds = daysThreshold * 86400.0;

NSMutableArray *filtered = [NSMutableArray arrayWithCapacity:orig.count];

for (id obj in orig) {
if (![obj isKindOfClass:%c(AWEAwemeModel)]) {
[filtered addObject:obj];
continue;
}

AWEAwemeModel *m = (AWEAwemeModel *)obj;

// 1. 广告白名单
// 使用 respondsToSelector 确保安全,防止属性变更
if ([m respondsToSelector:@selector(isAds)] && m.isAds) {
[filtered addObject:obj];
continue;
}

// 2. 直播过滤逻辑 (仅依赖 cellRoom)
if (skipLive && [m respondsToSelector:@selector(cellRoom)] && m.cellRoom != nil) {
continue; // 命中直播过滤,跳过
}

// 3. 时间限制过滤
if (daysThreshold > 0 && [m respondsToSelector:@selector(createTime)]) {
NSTimeInterval vTs = [m.createTime doubleValue];
if (vTs > 1e12) vTs /= 1000.0; // 毫秒转秒

if (vTs > 0 && (now - vTs) > thresholdInSeconds) {
continue; // 超过设定时限,跳过
}
}

// 4. 低赞过滤逻辑
if (minLikesThreshold > 0) {
NSInteger diggCount = 0;
// 抖音的点赞数通常在 statistics 模型中的 diggCount 属性里
if ([m respondsToSelector:@selector(statistics)]) {
id stats = [m valueForKey:@"statistics"];
if (stats && [stats respondsToSelector:@selector(diggCount)]) {
diggCount = [[stats valueForKey:@"diggCount"] integerValue];
}
}

if (diggCount < minLikesThreshold) {
continue; // 点赞数低于设定的阈值,跳过
}
}

[filtered addObject:obj];
}

return [filtered copy];
}

%end

%hook AWEAwemeModel

- (id)initWithDictionary:(id)arg1 error:(id *)arg2 {
Expand All @@ -4340,7 +4408,6 @@ static NSHashTable *processedParentViews = nil;
%new
- (BOOL)contentFilter {
BOOL noAds = DYYYGetBool(@"DYYYNoAds");
BOOL skipLive = DYYYGetBool(@"DYYYSkipLive");
BOOL skipAllLive = DYYYGetBool(@"DYYYSkipAllLive");
BOOL skipHotSpot = DYYYGetBool(@"DYYYSkipHotSpot");
BOOL skipPhoto = DYYYGetBool(@"DYYYSkipPhoto");
Expand All @@ -4349,7 +4416,6 @@ static NSHashTable *processedParentViews = nil;

BOOL shouldFilterAds = noAds && (self.isAds);
BOOL shouldFilterHotSpot = skipHotSpot && self.hotSpotLynxCardModel;
BOOL shouldFilterRecLive = skipLive && (self.cellRoom != nil);
BOOL shouldFilterAllLive = skipAllLive && [self.videoFeedTag isEqualToString:@"直播中"];
BOOL shouldskipPhoto = skipPhoto && (self.awemeType == 68) && [self.referString isEqualToString:@"homepage_hot"];
BOOL shouldskipPhotoText = skipPhotoText && self.isNewTextMode && [self.referString isEqualToString:@"homepage_hot"];
Expand Down Expand Up @@ -4404,18 +4470,6 @@ static NSHashTable *processedParentViews = nil;

// 只有当shareRecExtra不为空时才过滤点赞量低的视频和关键词
if ([self.referString isEqualToString:@"homepage_hot"]) {
NSInteger filterLowLikesThreshold = DYYYGetInteger(@"DYYYFilterLowLikes");
// 过滤低点赞量视频
if (filterLowLikesThreshold > 0) {
AWESearchAwemeExtraModel *searchExtraModel = [self searchExtraModel];
if (!searchExtraModel) {
AWEAwemeStatisticsModel *statistics = self.statistics;
if (statistics && statistics.diggCount) {
shouldFilterLowLikes = statistics.diggCount.integerValue < filterLowLikesThreshold;
}
}
}

// 过滤包含特定关键词的视频
if (keywordsList.count > 0) {
// 检查视频标题
Expand Down Expand Up @@ -4443,21 +4497,9 @@ static NSHashTable *processedParentViews = nil;
}
}
}

// 过滤视频发布时间
long long currentTimestamp = (long long)[[NSDate date] timeIntervalSince1970];
NSInteger daysThreshold = DYYYGetInteger(@"DYYYFilterTimeLimit");
if (daysThreshold > 0) {
NSTimeInterval videoTimestamp = [self.createTime doubleValue];
if (videoTimestamp > 0) {
NSTimeInterval threshold = daysThreshold * 86400.0;
NSTimeInterval current = (NSTimeInterval)currentTimestamp;
NSTimeInterval timeDifference = current - videoTimestamp;
shouldFilterTime = (timeDifference > threshold);
}
}
}


// 检查是否为HDR视频
if (filterHDR && self.video && self.video.bitrateModels) {
for (id bitrateModel in self.video.bitrateModels) {
Expand All @@ -4471,7 +4513,7 @@ static NSHashTable *processedParentViews = nil;
}
}
}
return shouldFilterAds || shouldFilterRecLive || shouldFilterAllLive || shouldFilterHotSpot || shouldskipPhoto || shouldskipPhotoText || shouldFilterHDR || shouldFilterLowLikes || shouldFilterKeywords || shouldFilterProp ||
return shouldFilterAds || shouldFilterAllLive || shouldFilterHotSpot || shouldskipPhoto || shouldskipPhotoText || shouldFilterHDR || shouldFilterKeywords || shouldFilterProp ||
shouldFilterTime || shouldFilterUser;
}

Expand All @@ -4482,6 +4524,14 @@ static NSHashTable *processedParentViews = nil;
return %orig;
}

- (void)setEcommerceBelowLabel:(id)label {
if (DYYYGetBool(@"DYYYHideHisShop")) {
%orig(nil);
return;
}
%orig;
}

- (void)setDescriptionString:(NSString *)desc {
NSString *labelStyle = [[NSUserDefaults standardUserDefaults] objectForKey:@"DYYYLabelStyle"];
BOOL hideLabel = [labelStyle isEqualToString:@"文案标签隐藏"];
Expand Down Expand Up @@ -4831,6 +4881,20 @@ static NSHashTable *processedParentViews = nil;


//以下部分为新增
// 屏蔽头像直播
%hook AWEUserModel

- (NSNumber *)roomID {
BOOL DYYYHideAvatarLive = DYYYGetBool(@"DYYYHideAvatarLive");
if (DYYYHideAvatarLive) {
return @(0);
}
return %orig;
}

%end


// 屏蔽头像光圈
%hook AWEUserModel

Expand Down Expand Up @@ -4912,20 +4976,18 @@ static NSHashTable *processedParentViews = nil;

%end

// 屏蔽互动贴纸(复用挑战贴纸开关)
// 屏蔽互动贴纸
%hook AWEInteractionEditTagStickerModel

- (id)editTagInfo {
BOOL DYYYHideChallengeStickers = DYYYGetBool(@"DYYYHideChallengeStickers");
if (DYYYHideChallengeStickers) {
if (DYYYGetBool(@"DYYYHideEditTag")) {
return nil;
}
return %orig;
}

- (void)setEditTagInfo:(id)info {
BOOL DYYYHideChallengeStickers = DYYYGetBool(@"DYYYHideChallengeStickers");
if (DYYYHideChallengeStickers) {
if (DYYYGetBool(@"DYYYHideEditTag")) {
%orig(nil);
return;
}
Expand Down Expand Up @@ -5020,6 +5082,39 @@ static NSHashTable *processedParentViews = nil;

%end

// 屏蔽精选标签
%hook AWETemplateStaticLabelInfoModel

- (NSArray *)containers {
if (DYYYGetBool(@"DYYYHideTemplateLabel")) {
return @[];
}
return %orig;
}

- (void)setContainers:(NSArray *)containers {
if (DYYYGetBool(@"DYYYHideTemplateLabel")) {
%orig(@[]);
return;
}
%orig;
}

%end

// 隐藏好友推荐
%hook AFDFriendRecommendTagView

- (void)layoutSubviews {
if (DYYYGetBool(@"DYYYHideFriendRecommend")) {
self.hidden = YES;
return;
}
%orig;
}

%end

// 屏蔽汽水音乐锚点 - hook AWERelatedMusicAnchorModel
%hook AWERelatedMusicAnchorModel

Expand Down
Loading