66BOOL noads;
77BOOL canSaveVideo;
88BOOL hideNewsFeedComposer;
9+ BOOL hideNewsFeedRoom;
910BOOL hideNewsFeedStories;
1011
1112static void reloadPrefs () {
@@ -14,6 +15,7 @@ static void reloadPrefs() {
1415 noads = [[settings objectForKey: @" noads" ] ?: @(YES ) boolValue ];
1516 canSaveVideo = [[settings objectForKey: @" canSaveVideo" ] ?: @(YES ) boolValue ];
1617 hideNewsFeedComposer = [[settings objectForKey: @" hideNewsFeedComposer" ] ?: @(NO ) boolValue ];
18+ hideNewsFeedRoom = [[settings objectForKey: @" hideNewsFeedRoom" ] ?: @(NO ) boolValue ];
1719 hideNewsFeedStories = [[settings objectForKey: @" hideNewsFeedStories" ] ?: @(NO ) boolValue ];
1820}
1921
@@ -33,20 +35,15 @@ static void reloadPrefs() {
3335 %end
3436%end
3537
36- %group HideNewsFeedStories
38+ %group HideNewsFeedChatRoomStories
3739 %hook FBComponentCollectionViewDataSource
3840 - (id )collectionView:(id )arg1 cellForItemAtIndexPath:(NSIndexPath *)arg2 {
3941 id orig = %orig ;
4042 if (![arg1 isKindOfClass: %c (FBNewsFeedCollectionView)]) {
4143 return orig;
4244 }
4345
44- int storySectionNumber = 1 ;
45- if (hideNewsFeedComposer) {
46- storySectionNumber = 0 ;
47- }
48-
49- if (arg2.section == storySectionNumber) {
46+ if ([self shouldHideSectionNumber: arg2.section]) {
5047 [orig setHidden: YES ];
5148 } else {
5249 [orig setHidden: NO ];
@@ -60,17 +57,26 @@ static void reloadPrefs() {
6057 return orig;
6158 }
6259
63- int storySectionNumber = 1 ;
64- if (hideNewsFeedComposer) {
65- storySectionNumber = 0 ;
66- }
67-
68- if (arg3.section == storySectionNumber) {
60+ if ([self shouldHideSectionNumber: arg3.section]) {
6961 orig.height = 1 ;
7062 orig.width = 1 ;
7163 }
7264 return orig;
7365 }
66+
67+ %new
68+ - (BOOL )shouldHideSectionNumber:(int )sectionNumber {
69+ if (hideNewsFeedComposer) {
70+ if (sectionNumber == 0 ) {
71+ return TRUE ;
72+ }
73+ } else {
74+ if (sectionNumber == 1 ) {
75+ return TRUE ;
76+ }
77+ }
78+ return FALSE ;
79+ }
7480 %end
7581%end
7682
@@ -164,8 +170,8 @@ static void reloadPrefs() {
164170 %init (HideNewsFeedComposer);
165171 }
166172
167- if (hideNewsFeedStories) {
168- %init (HideNewsFeedStories );
173+ if (hideNewsFeedRoom || hideNewsFeedStories) {
174+ %init (HideNewsFeedChatRoomStories );
169175 }
170176}
171177
0 commit comments