Merge pull request #11 from arichorn/main

Re-added YTSpeed Tweak
This commit is contained in:
Balackburn
2023-07-19 07:53:02 +02:00
committed by GitHub
4 changed files with 101 additions and 66 deletions

View File

@@ -1,7 +1,7 @@
## YTLite with more features! ## YTLite with more features!
![IMAGE_CERCUBEPLUS_PREVIEW](https://gcdnb.pbrd.co/images/UW3YDgjfwfle.png) ![IMAGE_YTLITEPLUS_PREVIEW](https://gcdnb.pbrd.co/images/UW3YDgjfwfle.png)
@@ -61,7 +61,7 @@ Special thanks to these developer(s) for maintaining and improving YTLitePlus (@
</td> </td>
<table id='credit'> <table id='credit'>
Special thanks to all the developers who have contributed to CercubePlus/YTLitePlus! Special thanks to all the developers who have contributed to uYouPlus/YTLitePlus!
(YTLite is an original tweak by dayanch96 @dayanch96) (YTLite is an original tweak by dayanch96 @dayanch96)
<tr> <tr>
@@ -232,32 +232,28 @@ any many more...
[View source online](https://therealfoxster.github.io/altsource-viewer/app.html?source=https://raw.githubusercontent.com/Balackburn/YTLitePlusAltstore/main/apps.json&id=com.google.ios.youtube) [View source online](https://therealfoxster.github.io/altsource-viewer/app.html?source=https://raw.githubusercontent.com/Balackburn/YTLitePlusAltstore/main/apps.json&id=com.google.ios.youtube)
- Version info: _(May 9 2023)_ - Version info: _(Jul 18 2023)_
<details> <details>
<summary>Expand!</summary> <summary>Expand!</summary>
| **Tweaks/App** | **Developer** | **Version** | **Open source** | | **Tweaks/App** | **Developer** | **Version** | **Open source** |
| - | - | :-: | :-: | | - | - | :-: | :-: |
| **YouTube** | Google Inc | 18.21.3 | ✖︎ | | **YouTube** | Google Inc | 18.28.3 | ✖︎ |
| **YTLite** | Majd Alfhaily | 5.3.11 | ✖︎ | | **YTLite** | Dayanch96 | 2.3 | ✖︎ |
| **Open in YouTube** | [CokePokes](https://github.com/CokePokes/) | 1.2 | ✖︎ | | **Open in YouTube** | [CokePokes](https://github.com/CokePokes/) | 1.2 | ✖︎ |
| **YTNoShorts** | [MiRO92](https://twitter.com/miro92) | 1.0.2 | [✔︎](https://github.com/MiRO92/YTNoShorts) | | **iSponsorBlock** | [Galactic-Dev](https://github.com/Galactic-Dev) | 1.2 | [✔︎](https://github.com/Galactic-Dev/iSponsorBlock) |
| **iSponsorBlock** | [Galactic-Dev](https://github.com/Galactic-Dev) | 1.0-15 | [✔︎](https://github.com/Galactic-Dev/iSponsorBlock) |
| **BigYTMiniPlayer** | [Galactic-Dev](https://github.com/Galactic-Dev) | 1.0-1 | [✔︎](https://github.com/Galactic-Dev/BigYTMiniPlayer) | | **BigYTMiniPlayer** | [Galactic-Dev](https://github.com/Galactic-Dev) | 1.0-1 | [✔︎](https://github.com/Galactic-Dev/BigYTMiniPlayer) |
| **YTMiniplayerEnabler** | [level3tjg](https://twitter.com/level3tjg) | 0.0.2 | [✔︎](https://github.com/level3tjg/YTMiniplayerEnabler) |
| **DontEatMyContent** | [therealFoxster](https://github.com/therealFoxster) | 1.0.6 | [✔︎](https://github.com/therealFoxster/DontEatMyContent) | | **DontEatMyContent** | [therealFoxster](https://github.com/therealFoxster) | 1.0.6 | [✔︎](https://github.com/therealFoxster/DontEatMyContent) |
| **LowContrastMode** | arichorn | 1.2.3 | [✔︎](https://github.com/arichorn/LowContrastMode) | | **LowContrastMode** | arichorn | 1.3.0 | [✔︎](https://github.com/arichorn/LowContrastMode) |
| **YTUHD** | PoomSmart | 1.4.0 | [✔︎](https://github.com/PoomSmart/YTUHD) | | **YTUHD** | PoomSmart | 1.4.0 | [✔︎](https://github.com/PoomSmart/YTUHD) |
| **YouPiP** | PoomSmart | 1.7.19-2 | [✔︎](https://github.com/PoomSmart/YouPiP) | | **YouPiP** | PoomSmart | 1.7.20 | [✔︎](https://github.com/PoomSmart/YouPiP) |
| **YouMute** | PoomSmart | 1.1.1-1 | [✔︎](https://github.com/PoomSmart/YouMute) | | **YTVideoOverlay** | PoomSmart | 1.1.0 | [✔︎](https://github.com/PoomSmart/YTVideoOverlay) |
| **YouQuality** | PoomSmart | 1.1.2 | [✔︎](https://github.com/PoomSmart/YouQuality) |
| **YouMute** | PoomSmart | 1.2.1 | [✔︎](https://github.com/PoomSmart/YouMute) |
| **YTABConfig** | PoomSmart | 1.5.0-1 | [✔︎](https://github.com/PoomSmart/YTABConfig) | | **YTABConfig** | PoomSmart | 1.5.0-1 | [✔︎](https://github.com/PoomSmart/YTABConfig) |
| **YTNoCommunityPosts** | [michael-winay](https://github.com/michael-winay) | 0.0.1 | [✔︎](https://github.com/michael-winay/YTNoCommunityPosts) |
| **IAmYouTube** | PoomSmart | 1.2.0 | [✔︎](https://github.com/PoomSmart/IAmYouTube) |
| **YTReExplore** | PoomSmart | 1.0.2 | [✔︎](https://github.com/PoomSmart/YTReExplore) |
| **YTNoPaidPromo** | PoomSmart | 1.0.0 | [✔︎](https://github.com/PoomSmart/YTNoPaidPromo) |
| **YTAutoFullScreen** | PoomSmart | 1.0.3 | [✔︎](https://github.com/PoomSmart/YTAutoFullScreen) |
| **Return YouTube Dislike** | PoomSmart | 1.11.3 | [✔︎](https://github.com/PoomSmart/Return-YouTube-Dislikes) | | **Return YouTube Dislike** | PoomSmart | 1.11.3 | [✔︎](https://github.com/PoomSmart/Return-YouTube-Dislikes) |
| **YTNoCommunityPosts** | [michael-winay](https://github.com/michael-winay) | 0.0.1 | [✔︎](https://github.com/michael-winay/YTNoCommunityPosts) |
</details> </details>

View File

@@ -156,29 +156,25 @@ static BOOL pinkContrastMode() {
%orig(textColor); %orig(textColor);
} }
%end %end
/* disabled the code to stop crashing /* disabled the code, not sure if this will work
%hook _ASDisplayView %hook _ASDisplayView
- (void)didMoveToWindow { - (void)didMoveToWindow {
%orig; %orig;
UILabel *label = [self findLabelInSubviews:self.subviews]; if ([self isKindOfClass:NSClassFromString(@"ASDisplayNode")]) {
if (label) { UILabel *titleLabel = [self valueForKey:@"accessibilityLabel"];
[self customizeLabel:label]; UIView *superview = [self valueForKey:@"superview"];
} if ([titleLabel isKindOfClass:[UILabel class]]) {
} titleLabel.textColor = [UIColor whiteColor];
- (UILabel *)findLabelInSubviews:(NSArray *)subviews { }
for (UIView *subview in subviews) { if ([superview isKindOfClass:[UIView class]]) {
if ([subview isKindOfClass:[UILabel class]]) { for (UIView *subview in superview.subviews) {
return (UILabel *)subview; if ([subview isKindOfClass:[UILabel class]]) {
} UILabel *textView = (UILabel *)subview;
UILabel *label = [self findLabelInSubviews:subview.subviews]; textView.textColor = [UIColor whiteColor];
if (label) { }
return label; }
} }
} }
return nil;
}
- (void)customizeLabel:(UILabel *)label {
label.textColor = [UIColor whiteColor];
} }
%end %end
*/ */

View File

@@ -18,7 +18,7 @@ static int colorContrastMode() {
static int appVersionSpoofer() { static int appVersionSpoofer() {
return [[NSUserDefaults standardUserDefaults] integerForKey:@"versionSpoofer"]; return [[NSUserDefaults standardUserDefaults] integerForKey:@"versionSpoofer"];
} }
static const NSInteger YTLitePlusSection = 500; static const NSInteger YTLitePlusSection = 788;
@interface YTSettingsSectionItemManager (YTLitePlus) @interface YTSettingsSectionItemManager (YTLitePlus)
- (void)updateYTLitePlusSectionWithEntry:(id)entry; - (void)updateYTLitePlusSectionWithEntry:(id)entry;
@@ -64,35 +64,6 @@ extern NSBundle *YTLitePlusBundle();
}]; }];
[sectionItems addObject:main]; [sectionItems addObject:main];
# pragma mark - VideoPlayer
YTSettingsSectionItem *videoPlayerGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"VIDEO_PLAYER_OPTIONS") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) {
NSArray <YTSettingsSectionItem *> *rows = @[
[YTSettingsSectionItemClass switchItemWithTitle:LOC(@"YT_MINIPLAYER")
titleDescription:LOC(@"YT_MINIPLAYER_DESC")
accessibilityIdentifier:nil
switchOn:IsEnabled(@"ytMiniPlayer_enabled")
switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) {
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"ytMiniPlayer_enabled"];
return YES;
}
settingItemId:0],
[YTSettingsSectionItemClass switchItemWithTitle:LOC(@"STOCK_VOLUME_HUD")
titleDescription:LOC(@"STOCK_VOLUME_HUD_DESC")
accessibilityIdentifier:nil
switchOn:IsEnabled(@"stockVolumeHUD_enabled")
switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) {
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"stockVolumeHUD_enabled"];
return YES;
}
settingItemId:0]
];
YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"VIDEO_PLAYER_OPTIONS") pickerSectionTitle:nil rows:rows selectedItemIndex:NSNotFound parentResponder:[self parentResponder]];
[settingsViewController pushViewController:picker];
return YES;
}];
[sectionItems addObject:videoPlayerGroup];
# pragma mark - Video Controls Overlay Options # pragma mark - Video Controls Overlay Options
YTSettingsSectionItem *videoControlOverlayGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"VIDEO_CONTROLS_OVERLAY_OPTIONS") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { YTSettingsSectionItem *videoControlOverlayGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"VIDEO_CONTROLS_OVERLAY_OPTIONS") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) {
NSArray <YTSettingsSectionItem *> *rows = @[ NSArray <YTSettingsSectionItem *> *rows = @[
@@ -430,6 +401,16 @@ extern NSBundle *YTLitePlusBundle();
} }
settingItemId:0], settingItemId:0],
[YTSettingsSectionItemClass switchItemWithTitle:LOC(@"STOCK_VOLUME_HUD")
titleDescription:LOC(@"STOCK_VOLUME_HUD_DESC")
accessibilityIdentifier:nil
switchOn:IsEnabled(@"stockVolumeHUD_enabled")
switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) {
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"stockVolumeHUD_enabled"];
return YES;
}
settingItemId:0],
[YTSettingsSectionItemClass switchItemWithTitle:LOC(@"HIDE_CAST_BUTTON") [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"HIDE_CAST_BUTTON")
titleDescription:LOC(@"HIDE_CAST_BUTTON_DESC") titleDescription:LOC(@"HIDE_CAST_BUTTON_DESC")
accessibilityIdentifier:nil accessibilityIdentifier:nil
@@ -459,7 +440,17 @@ extern NSBundle *YTLitePlusBundle();
return YES; return YES;
} }
settingItemId:0], settingItemId:0],
[YTSettingsSectionItemClass switchItemWithTitle:LOC(@"YT_SPEED")
titleDescription:LOC(@"YT_SPEED_DESC")
accessibilityIdentifier:nil
switchOn:IsEnabled(@"ytSpeed_enabled")
switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) {
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"ytSpeed_enabled"];
return YES;
}
settingItemId:0],
[YTSettingsSectionItemClass switchItemWithTitle:LOC(@"ENABLE_FLEX") [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"ENABLE_FLEX")
titleDescription:LOC(@"ENABLE_FLEX_DESC") titleDescription:LOC(@"ENABLE_FLEX_DESC")
accessibilityIdentifier:nil accessibilityIdentifier:nil

View File

@@ -270,6 +270,55 @@ static BOOL IsEnabled(NSString *key) {
%end %end
%end %end
// YTSpeed - https://github.com/Lyvendia/YTSpeed (Only works on YouTube v16.05.7-v18.18.2)
%group gYTSpeed
%hook YTVarispeedSwitchController
- (id)init {
id result = %orig;
const int size = 17;
float speeds[] = {0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.5, 3.75, 4.0, 5.0};
id varispeedSwitchControllerOptions[size];
for (int i = 0; i < size; ++i) {
id title = [NSString stringWithFormat:@"%.2fx", speeds[i]];
varispeedSwitchControllerOptions[i] = [[%c(YTVarispeedSwitchControllerOption) alloc] initWithTitle:title rate:speeds[i]];
}
NSUInteger count = sizeof(varispeedSwitchControllerOptions) / sizeof(id);
NSArray *varispeedArray = [NSArray arrayWithObjects:varispeedSwitchControllerOptions count:count];
MSHookIvar<NSArray *>(self, "_options") = varispeedArray;
return result;
}
%end
%hook MLHAMQueuePlayer
- (void)setRate:(float)rate {
MSHookIvar<float>(self, "_rate") = rate;
MSHookIvar<float>(self, "_preferredRate") = rate;
id player = MSHookIvar<HAMPlayerInternal *>(self, "_player");
[player setRate: rate];
id stickySettings = MSHookIvar<MLPlayerStickySettings *>(self, "_stickySettings");
[stickySettings setRate: rate];
[self.playerEventCenter broadcastRateChange: rate];
YTSingleVideoController *singleVideoController = self.delegate;
[singleVideoController playerRateDidChange: rate];
}
%end
%hook YTPlayerViewController
%property (nonatomic, assign) float playbackRate;
- (void)singleVideo:(id)video playbackRateDidChange:(float)rate {
%orig;
}
%end
%end
// YTStockVolumeHUD - https://github.com/lilacvibes/YTStockVolumeHUD // YTStockVolumeHUD - https://github.com/lilacvibes/YTStockVolumeHUD
%group gStockVolumeHUD %group gStockVolumeHUD
%hook YTVolumeBarView %hook YTVolumeBarView
@@ -366,6 +415,9 @@ static BOOL IsEnabled(NSString *key) {
if (IsEnabled(@"ytNoModernUI_enabled")) { if (IsEnabled(@"ytNoModernUI_enabled")) {
%init(gYTNoModernUI); %init(gYTNoModernUI);
} }
if (IsEnabled(@"ytSpeed_enabled")) {
%init(gYTSpeed);
}
if (IsEnabled(@"stockVolumeHUD_enabled")) { if (IsEnabled(@"stockVolumeHUD_enabled")) {
%init(gStockVolumeHUD); %init(gStockVolumeHUD);
} }