mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-04-20 02:32:10 +00:00
fix compiling, code format
This commit is contained in:
parent
3383edbb05
commit
163dac3e81
2 changed files with 21 additions and 27 deletions
|
|
@ -1,8 +1,7 @@
|
|||
#import "Tweaks/YouTubeHeader/YTSettingsViewController.h"
|
||||
#import "Tweaks/YouTubeHeader/YTSettingsSectionItem.h"
|
||||
#import "Tweaks/YouTubeHeader/YTSettingsSectionItemManager.h"
|
||||
|
||||
#define LOC(x) [tweakBundle localizedStringForKey:x value:nil table:nil]
|
||||
#import "Header.h"
|
||||
|
||||
@interface YTSettingsSectionItemManager (YouPiP)
|
||||
- (void)updateuYouPlusSectionWithEntry:(id)entry;
|
||||
|
|
@ -24,8 +23,6 @@ extern BOOL castConfirm();
|
|||
extern BOOL ytMiniPlayer();
|
||||
extern BOOL hidePreviousAndNextButton();
|
||||
|
||||
NSBundle *tweakBundle = uYouPlusBundle();
|
||||
|
||||
// Settings
|
||||
%hook YTAppSettingsPresentationData
|
||||
+ (NSArray *)settingsCategoryOrder {
|
||||
|
|
@ -39,8 +36,10 @@ NSBundle *tweakBundle = uYouPlusBundle();
|
|||
%end
|
||||
|
||||
%hook YTSettingsSectionItemManager
|
||||
%new - (void)updateuYouPlusSectionWithEntry:(id)entry {
|
||||
%new
|
||||
- (void)updateuYouPlusSectionWithEntry:(id)entry {
|
||||
YTSettingsViewController *delegate = [self valueForKey:@"_dataDelegate"];
|
||||
NSBundle *tweakBundle = uYouPlusBundle();
|
||||
|
||||
YTSettingsSectionItem *hidePreviousAndNextButton = [[%c(YTSettingsSectionItem) alloc] initWithTitle:LOC(@"HIDE_PREVIOUS_AND_NEXT_BUTTON") titleDescription:LOC(@"HIDE_PREVIOUS_AND_NEXT_BUTTON_DESC")];
|
||||
hidePreviousAndNextButton.hasSwitch = YES;
|
||||
|
|
|
|||
39
uYouPlus.xm
39
uYouPlus.xm
|
|
@ -14,11 +14,19 @@
|
|||
#import "Tweaks/YouTubeHeader/YTCommonColorPalette.h"
|
||||
#import "Tweaks/YouTubeHeader/ASCollectionView.h"
|
||||
|
||||
#define LOC(x) [tweakBundle localizedStringForKey:x value:nil table:nil]
|
||||
|
||||
#define YT_BUNDLE_ID @"com.google.ios.youtube"
|
||||
#define YT_NAME @"YouTube"
|
||||
// Tweak's bundle for Localizations support - @PoomSmart - https://github.com/PoomSmart/YouPiP/commit/aea2473f64c75d73cab713e1e2d5d0a77675024f
|
||||
NSBundle *uYouPlusBundle() {
|
||||
static NSBundle *bundle = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
NSString *tweakBundlePath = [[NSBundle mainBundle] pathForResource:@"uYouPlus" ofType:@"bundle"];
|
||||
bundle = [NSBundle bundleWithPath:tweakBundlePath];
|
||||
});
|
||||
return bundle;
|
||||
}
|
||||
NSBundle *tweakBundle = uYouPlusBundle();
|
||||
|
||||
//
|
||||
BOOL hideHUD() {
|
||||
return [[NSUserDefaults standardUserDefaults] boolForKey:@"hideHUD_enabled"];
|
||||
}
|
||||
|
|
@ -70,17 +78,17 @@ BOOL ytMiniPlayer() {
|
|||
|
||||
// Hide CC / Autoplay switch / Next & Previous button
|
||||
%hook YTMainAppControlsOverlayView
|
||||
- (void)setClosedCaptionsOrSubtitlesButtonAvailable:(BOOL)arg1 { // hide CC?!
|
||||
- (void)setClosedCaptionsOrSubtitlesButtonAvailable:(BOOL)arg1 { // hide CC button
|
||||
if (hideCC()) { return %orig(NO); }
|
||||
else { return %orig; }
|
||||
}
|
||||
- (void)setAutoplaySwitchButtonRenderer:(id)arg1 {
|
||||
- (void)setAutoplaySwitchButtonRenderer:(id)arg1 { // hide Autoplay
|
||||
if (hideAutoplaySwitch()) {}
|
||||
else { return %orig; }
|
||||
}
|
||||
- (void)layoutSubviews {
|
||||
if (hidePreviousAndNextButton()) {
|
||||
%orig;
|
||||
%orig;
|
||||
if (hidePreviousAndNextButton()) { // hide Next & Previous button
|
||||
MSHookIvar<YTMainAppControlsOverlayView *>(self, "_nextButton").hidden = YES;
|
||||
MSHookIvar<YTMainAppControlsOverlayView *>(self, "_previousButton").hidden = YES;
|
||||
}
|
||||
|
|
@ -121,7 +129,6 @@ BOOL ytMiniPlayer() {
|
|||
%hook MDXPlaybackRouteButtonController
|
||||
- (void)didPressButton:(id)arg1 {
|
||||
if (castConfirm()) {
|
||||
NSBundle *tweakBundle = uYouPlusBundle();
|
||||
UIAlertController* alertController = [%c(UIAlertController) alertControllerWithTitle:LOC(@"CASTING")
|
||||
message:LOC(@"MSG_ARE_YOU_SURE")
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
|
@ -151,7 +158,6 @@ BOOL ytMiniPlayer() {
|
|||
}
|
||||
[rootViewController presentViewController:alertController animated:YES completion:nil];
|
||||
} else { return %orig; }
|
||||
|
||||
}
|
||||
%end
|
||||
|
||||
|
|
@ -615,17 +621,6 @@ static void replaceTab(YTIGuideResponse *response) {
|
|||
%end
|
||||
%end
|
||||
|
||||
// Tweak's bundle for Localizations support - @PoomSmart - https://github.com/PoomSmart/YouPiP/commit/aea2473f64c75d73cab713e1e2d5d0a77675024f
|
||||
NSBundle *uYouPlusBundle() {
|
||||
static NSBundle *bundle = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
NSString *tweakBundlePath = [[NSBundle mainBundle] pathForResource:@"uYouPlus" ofType:@"bundle"];
|
||||
bundle = [NSBundle bundleWithPath:tweakBundlePath];
|
||||
});
|
||||
return bundle;
|
||||
}
|
||||
|
||||
# pragma mark - ctor
|
||||
%ctor {
|
||||
%init;
|
||||
|
|
@ -641,4 +636,4 @@ NSBundle *uYouPlusBundle() {
|
|||
if (bigYTMiniPlayer() && (UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPad)) {
|
||||
%init(Main);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue