fix compiling, code format
This commit is contained in:
+4
-5
@@ -1,8 +1,7 @@
|
|||||||
#import "Tweaks/YouTubeHeader/YTSettingsViewController.h"
|
#import "Tweaks/YouTubeHeader/YTSettingsViewController.h"
|
||||||
#import "Tweaks/YouTubeHeader/YTSettingsSectionItem.h"
|
#import "Tweaks/YouTubeHeader/YTSettingsSectionItem.h"
|
||||||
#import "Tweaks/YouTubeHeader/YTSettingsSectionItemManager.h"
|
#import "Tweaks/YouTubeHeader/YTSettingsSectionItemManager.h"
|
||||||
|
#import "Header.h"
|
||||||
#define LOC(x) [tweakBundle localizedStringForKey:x value:nil table:nil]
|
|
||||||
|
|
||||||
@interface YTSettingsSectionItemManager (YouPiP)
|
@interface YTSettingsSectionItemManager (YouPiP)
|
||||||
- (void)updateuYouPlusSectionWithEntry:(id)entry;
|
- (void)updateuYouPlusSectionWithEntry:(id)entry;
|
||||||
@@ -24,8 +23,6 @@ extern BOOL castConfirm();
|
|||||||
extern BOOL ytMiniPlayer();
|
extern BOOL ytMiniPlayer();
|
||||||
extern BOOL hidePreviousAndNextButton();
|
extern BOOL hidePreviousAndNextButton();
|
||||||
|
|
||||||
NSBundle *tweakBundle = uYouPlusBundle();
|
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
%hook YTAppSettingsPresentationData
|
%hook YTAppSettingsPresentationData
|
||||||
+ (NSArray *)settingsCategoryOrder {
|
+ (NSArray *)settingsCategoryOrder {
|
||||||
@@ -39,8 +36,10 @@ NSBundle *tweakBundle = uYouPlusBundle();
|
|||||||
%end
|
%end
|
||||||
|
|
||||||
%hook YTSettingsSectionItemManager
|
%hook YTSettingsSectionItemManager
|
||||||
%new - (void)updateuYouPlusSectionWithEntry:(id)entry {
|
%new
|
||||||
|
- (void)updateuYouPlusSectionWithEntry:(id)entry {
|
||||||
YTSettingsViewController *delegate = [self valueForKey:@"_dataDelegate"];
|
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")];
|
YTSettingsSectionItem *hidePreviousAndNextButton = [[%c(YTSettingsSectionItem) alloc] initWithTitle:LOC(@"HIDE_PREVIOUS_AND_NEXT_BUTTON") titleDescription:LOC(@"HIDE_PREVIOUS_AND_NEXT_BUTTON_DESC")];
|
||||||
hidePreviousAndNextButton.hasSwitch = YES;
|
hidePreviousAndNextButton.hasSwitch = YES;
|
||||||
|
|||||||
+16
-21
@@ -14,11 +14,19 @@
|
|||||||
#import "Tweaks/YouTubeHeader/YTCommonColorPalette.h"
|
#import "Tweaks/YouTubeHeader/YTCommonColorPalette.h"
|
||||||
#import "Tweaks/YouTubeHeader/ASCollectionView.h"
|
#import "Tweaks/YouTubeHeader/ASCollectionView.h"
|
||||||
|
|
||||||
#define LOC(x) [tweakBundle localizedStringForKey:x value:nil table:nil]
|
// Tweak's bundle for Localizations support - @PoomSmart - https://github.com/PoomSmart/YouPiP/commit/aea2473f64c75d73cab713e1e2d5d0a77675024f
|
||||||
|
NSBundle *uYouPlusBundle() {
|
||||||
#define YT_BUNDLE_ID @"com.google.ios.youtube"
|
static NSBundle *bundle = nil;
|
||||||
#define YT_NAME @"YouTube"
|
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() {
|
BOOL hideHUD() {
|
||||||
return [[NSUserDefaults standardUserDefaults] boolForKey:@"hideHUD_enabled"];
|
return [[NSUserDefaults standardUserDefaults] boolForKey:@"hideHUD_enabled"];
|
||||||
}
|
}
|
||||||
@@ -70,17 +78,17 @@ BOOL ytMiniPlayer() {
|
|||||||
|
|
||||||
// Hide CC / Autoplay switch / Next & Previous button
|
// Hide CC / Autoplay switch / Next & Previous button
|
||||||
%hook YTMainAppControlsOverlayView
|
%hook YTMainAppControlsOverlayView
|
||||||
- (void)setClosedCaptionsOrSubtitlesButtonAvailable:(BOOL)arg1 { // hide CC?!
|
- (void)setClosedCaptionsOrSubtitlesButtonAvailable:(BOOL)arg1 { // hide CC button
|
||||||
if (hideCC()) { return %orig(NO); }
|
if (hideCC()) { return %orig(NO); }
|
||||||
else { return %orig; }
|
else { return %orig; }
|
||||||
}
|
}
|
||||||
- (void)setAutoplaySwitchButtonRenderer:(id)arg1 {
|
- (void)setAutoplaySwitchButtonRenderer:(id)arg1 { // hide Autoplay
|
||||||
if (hideAutoplaySwitch()) {}
|
if (hideAutoplaySwitch()) {}
|
||||||
else { return %orig; }
|
else { return %orig; }
|
||||||
}
|
}
|
||||||
- (void)layoutSubviews {
|
- (void)layoutSubviews {
|
||||||
if (hidePreviousAndNextButton()) {
|
%orig;
|
||||||
%orig;
|
if (hidePreviousAndNextButton()) { // hide Next & Previous button
|
||||||
MSHookIvar<YTMainAppControlsOverlayView *>(self, "_nextButton").hidden = YES;
|
MSHookIvar<YTMainAppControlsOverlayView *>(self, "_nextButton").hidden = YES;
|
||||||
MSHookIvar<YTMainAppControlsOverlayView *>(self, "_previousButton").hidden = YES;
|
MSHookIvar<YTMainAppControlsOverlayView *>(self, "_previousButton").hidden = YES;
|
||||||
}
|
}
|
||||||
@@ -121,7 +129,6 @@ BOOL ytMiniPlayer() {
|
|||||||
%hook MDXPlaybackRouteButtonController
|
%hook MDXPlaybackRouteButtonController
|
||||||
- (void)didPressButton:(id)arg1 {
|
- (void)didPressButton:(id)arg1 {
|
||||||
if (castConfirm()) {
|
if (castConfirm()) {
|
||||||
NSBundle *tweakBundle = uYouPlusBundle();
|
|
||||||
UIAlertController* alertController = [%c(UIAlertController) alertControllerWithTitle:LOC(@"CASTING")
|
UIAlertController* alertController = [%c(UIAlertController) alertControllerWithTitle:LOC(@"CASTING")
|
||||||
message:LOC(@"MSG_ARE_YOU_SURE")
|
message:LOC(@"MSG_ARE_YOU_SURE")
|
||||||
preferredStyle:UIAlertControllerStyleAlert];
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
@@ -151,7 +158,6 @@ BOOL ytMiniPlayer() {
|
|||||||
}
|
}
|
||||||
[rootViewController presentViewController:alertController animated:YES completion:nil];
|
[rootViewController presentViewController:alertController animated:YES completion:nil];
|
||||||
} else { return %orig; }
|
} else { return %orig; }
|
||||||
|
|
||||||
}
|
}
|
||||||
%end
|
%end
|
||||||
|
|
||||||
@@ -615,17 +621,6 @@ static void replaceTab(YTIGuideResponse *response) {
|
|||||||
%end
|
%end
|
||||||
%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
|
# pragma mark - ctor
|
||||||
%ctor {
|
%ctor {
|
||||||
%init;
|
%init;
|
||||||
|
|||||||
Reference in New Issue
Block a user