-
Notifications
You must be signed in to change notification settings - Fork 3
/
Tweak.m
36 lines (31 loc) · 1.19 KB
/
Tweak.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#import "Tweak.h"
#pragma mark - Hooks
%hook YTAsyncCollectionView
- (id)cellForItemAtIndexPath:(NSIndexPath *)indexPath {
UICollectionViewCell *cell = %orig;
if ([cell isKindOfClass:NSClassFromString(@"_ASCollectionViewCell")]) {
_ASCollectionViewCell *cell = %orig;
if ([cell respondsToSelector:@selector(node)]) {
if ([[[cell node] accessibilityIdentifier] isEqualToString:@"eml.shorts-shelf"]) {
[self removeShortsCellAtIndexPath:indexPath];
}
}
} else if ([cell isKindOfClass:NSClassFromString(@"YTReelShelfCell")]) {
[self removeShortsCellAtIndexPath:indexPath];
}
return %orig;
}
%new
- (void)removeShortsCellAtIndexPath:(NSIndexPath *)indexPath {
[self performBatchUpdates:^{
[self deleteItemsAtIndexPaths:[NSArray arrayWithObject:indexPath]];
} completion:nil];
}
%end
#pragma mark - ctor
%ctor {
@autoreleasepool {
if (![[NSFileManager defaultManager] fileExistsAtPath:@"/var/lib/dpkg/info/com.miro.ytnoshorts.list"]) return;
[[NSBundle bundleWithPath:[NSString stringWithFormat:@"%@/Frameworks/Module_Framework.framework", [[NSBundle mainBundle] bundlePath]]] load];
}
}