-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathNCNotificationListCollectionView.xm
107 lines (94 loc) · 2.34 KB
/
NCNotificationListCollectionView.xm
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
@interface NCNotificationListCollectionView : UICollectionView
@end
static BOOL bypassHandler = NO;
%hook NSAssertionHandler
-(void)handleFailureInMethod:(SEL)arg1 object:(id)arg2 file:(id)arg3 lineNumber:(NSInteger)arg4 description:(id)arg5 {
if (bypassHandler) {
HBLogInfo(@"Failure With Description: %@", arg5);
return;
} else {
%orig;
}
}
%end
%hook NCNotificationListCollectionView
-(void)insertItemsAtIndexPaths:(NSArray<NSIndexPath *> *)paths {
// HBLogInfo(@"Inserting Index Paths");
[self reloadData];
return;
// if (paths) {
// for (NSIndexPath *path in paths) {
// // HBLogInfo(@"Inserting Index Path: %@", path);
// }
// }
// %orig;
}
-(void)deleteItemsAtIndexPaths:(NSArray<NSIndexPath *> *)paths {
// HBLogInfo(@"Deleting Index Paths");
[self reloadData];
return;
// if (paths) {
// for (NSIndexPath *path in paths) {
// // HBLogInfo(@"Inserting Index Path: %@", path);
// }
// }
// %orig;
}
-(void)reloadItemsAtIndexPaths:(NSArray<NSIndexPath *> *)paths {
// HBLogInfo(@"Reloading Index Paths");
// if (paths) {
// for (NSIndexPath *path in paths) {
// // HBLogInfo(@"Inserting Index Path: %@", path);
// }
// }
[self reloadData];
return;
//%orig;
}
- (void)reloadData {
[self.collectionViewLayout invalidateLayout];
[self setNeedsLayout];
%orig;
//[self setCollectionViewLayout:self.collectionViewLayout animated:false];
// [self.collectionViewLayout invalidateLayout];
[self layoutIfNeeded];
//[self layoutSubviews];
//[self.collectionViewLayout invalidateLayout];
// [self layoutIfNeeded]
// [self.collectionViewLayout prepareLayout];
// [self setNeedsLayout];
// [self layoutIfNeeded];
}
- (void)performBatchUpdates:(void (^)(void))updates completion:(void (^)(BOOL finished))completion {
if (!updates && !completion) {
[self reloadData];
return;
}
[self reloadData];
if (completion) {
completion(YES);
}
return;
}
- (void)layoutSubviews {
bypassHandler = YES;
%orig;
bypassHandler = NO;
}
- (void)moveItemAtIndexPath:(NSIndexPath *)prevPath toIndexPath:(NSIndexPath *)newPath {
[self reloadData];
return;
}
-(void)reloadSections:(NSArray<NSIndexPath *> *)sections {
[self reloadData];
return;
}
- (void)deleteSections:(NSArray<NSIndexPath *> *)sections {
[self reloadData];
return;
}
- (void)insertSections:(NSArray<NSIndexPath *> *)sections {
[self reloadData];
return;
}
%end