Update YTPivotBarReorder.m

This commit is contained in:
aricloverEXALT 2025-01-12 12:13:07 -06:00 committed by GitHub
parent d89facc306
commit cf7e94f2c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,10 @@
#import "YTPivotBarReorder.h"
#import "uYouPlus.h"
#import <YouTubeHeader/YTIGuideResponse.h>
#import <YouTubeHeader/YTIGuideResponseSupportedRenderers.h>
#import <YouTubeHeader/YTIPivotBarRenderer.h>
#import <YouTubeHeader/YTIPivotBarSupportedRenderers.h>
#import <YouTubeHeader/YTIPivotBarItemRenderer.h>
@interface YTPivotBarReorder ()
@ -28,7 +33,25 @@
[self.collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"Cell"];
[self.view addSubview:self.collectionView];
self.pivotBarItems = [@[@"Home", @"Shorts", @"Subscriptions", @"Notifications", @"Library"] mutableCopy];
[self loadActivePivotTabs];
}
- (void)loadActivePivotTabs {
// Assuming we have a method to get the YTIGuideResponse
YTIGuideResponse *guideResponse = [self getGuideResponse];
NSMutableArray *activeTabs = [NSMutableArray array];
for (YTIGuideResponseSupportedRenderers *guideRenderers in [guideResponse itemsArray]) {
YTIPivotBarRenderer *pivotBarRenderer = [guideRenderers pivotBarRenderer];
for (YTIPivotBarSupportedRenderers *renderer in [pivotBarRenderer itemsArray]) {
YTIPivotBarItemRenderer *itemRenderer = [renderer pivotBarItemRenderer];
NSString *title = [[itemRenderer title] string];
[activeTabs addObject:title];
}
}
self.pivotBarItems = activeTabs;
[self.collectionView reloadData];
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
@ -70,4 +93,10 @@
}
}
- (YTIGuideResponse *)getGuideResponse {
// Implement method to get the YTIGuideResponse
// For now, returning nil
return nil;
}
@end