From cf7e94f2c14b3333e91ab9b3ee6f5cb649632f22 Mon Sep 17 00:00:00 2001 From: aricloverEXALT <157071384+aricloverEXALT@users.noreply.github.com> Date: Sun, 12 Jan 2025 12:13:07 -0600 Subject: [PATCH] Update YTPivotBarReorder.m --- Sources/YTPivotBarReorder.m | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/Sources/YTPivotBarReorder.m b/Sources/YTPivotBarReorder.m index a058af3..aa99e71 100644 --- a/Sources/YTPivotBarReorder.m +++ b/Sources/YTPivotBarReorder.m @@ -1,5 +1,10 @@ #import "YTPivotBarReorder.h" #import "uYouPlus.h" +#import +#import +#import +#import +#import @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