OLED keyboard (by @ichitaso), code cleanup

This commit is contained in:
qnblackcat
2022-05-08 11:08:24 +07:00
parent 5b920d7353
commit 274abee25d
2 changed files with 235 additions and 301 deletions
+12 -3
View File
@@ -26,11 +26,20 @@
@interface YTShareMainView : UIView @interface YTShareMainView : UIView
@end @end
@interface UICollectionViewControllerWrapperView : UIView
@end
@interface ASScrollView : UIView @interface ASScrollView : UIView
@end @end
@interface ASCollectionView : UIView @interface ASCollectionView : UIView
@end
@interface UIKeyboardLayoutStar : UIView
@end
@interface UIKeyboardDockView : UIView
@end
@interface UICandidateViewController : UIViewController
@end
@interface UIPredictionViewController : UIViewController
@end @end
+223 -298
View File
@@ -46,12 +46,10 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
%hook YTMainAppControlsOverlayView %hook YTMainAppControlsOverlayView
- (void)layoutSubviews { - (void)layoutSubviews {
%orig; %orig;
if (hideAutoplaySwitch()) { if (hideAutoplaySwitch())
MSHookIvar<UIView *>(self, "_autonavSwitch").hidden = YES; MSHookIvar<UIView *>(self, "_autonavSwitch").hidden = YES;
} if (hideCC())
if (hideCC()) {
MSHookIvar<UIView *>(self, "_closedCaptionsOrSubtitlesButton").hidden = YES; MSHookIvar<UIView *>(self, "_closedCaptionsOrSubtitlesButton").hidden = YES;
}
} }
%end %end
@@ -79,7 +77,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
// YTNoHoverCards: https://github.com/level3tjg/YTNoHoverCards // YTNoHoverCards: https://github.com/level3tjg/YTNoHoverCards
%hook YTCreatorEndscreenView %hook YTCreatorEndscreenView
- (void)setHidden:(BOOL)hidden { - (void)setHidden:(BOOL)hidden {
if (!noHoverCard()) if (noHoverCard())
hidden = YES; hidden = YES;
%orig; %orig;
} }
@@ -87,7 +85,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
//YTCastConfirm: https://github.com/JamieBerghmans/YTCastConfirm //YTCastConfirm: https://github.com/JamieBerghmans/YTCastConfirm
%hook MDXPlaybackRouteButtonController %hook MDXPlaybackRouteButtonController
-(void)didPressButton:(id)arg1 { - (void)didPressButton:(id)arg1 {
if (castConfirm()) { if (castConfirm()) {
UIAlertController* alertController = [%c(UIAlertController) alertControllerWithTitle:@"Casting" UIAlertController* alertController = [%c(UIAlertController) alertControllerWithTitle:@"Casting"
message:@"Are you sure you want to start casting?" message:@"Are you sure you want to start casting?"
@@ -145,6 +143,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
%hook YTColdConfig %hook YTColdConfig
- (BOOL)shouldUseAppThemeSetting { return YES; } - (BOOL)shouldUseAppThemeSetting { return YES; }
- (BOOL)respectDeviceCaptionSetting { return NO; } - (BOOL)respectDeviceCaptionSetting { return NO; }
- (BOOL)isEnhancedSearchBarEnabled { return YES; }
%end %end
// OLED // OLED
@@ -152,7 +151,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
// Thanks sinfool for his flex patch which brings OLED Dark mode for YouTube - "Color Customizer (YouTube) OLED" // Thanks sinfool for his flex patch which brings OLED Dark mode for YouTube - "Color Customizer (YouTube) OLED"
%group gOLED %group gOLED
%hook UIView %hook UIView
-(void)setBackgroundColor:(id)arg1 { - (void)setBackgroundColor:(id)arg1 {
if ([self.nextResponder isKindOfClass:%c(DownloadedVC)]) //uYou if ([self.nextResponder isKindOfClass:%c(DownloadedVC)]) //uYou
arg1 = oledColor; arg1 = oledColor;
if ([self.nextResponder isKindOfClass:%c(DownloadsPagerVC)]) //uYou if ([self.nextResponder isKindOfClass:%c(DownloadsPagerVC)]) //uYou
@@ -205,15 +204,27 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
arg1 = oledColor; arg1 = oledColor;
%orig; %orig;
} }
//- (void)didMoveToWindow { %end
// %orig;
// if ([self.nextResponder isKindOfClass:%c(YTALDialog)]) // Connected apps %hook YTLightweightQTMButton
// self.backgroundColor = oledColor; - (void)setBackgroundColor:(id)arg1 {
//} if ([self.nextResponder isKindOfClass:%c(YTShareMainView)])
arg1 = oledColor;
%orig;
}
- (void)setCustomTitleColor:(id)arg1 { %orig([UIColor whiteColor]); }
%end
%hook NIAttributedLabel
- (void)setBackgroundColor:(id)arg1 {
if ([self.nextResponder isKindOfClass:%c(UIScrollView)])
arg1 = oledColor;
%orig;
}
%end %end
%hook UIControl // this sucks I know :/ %hook UIControl // this sucks I know :/
-(void)setBackgroundColor:(id)arg1 { - (void)setBackgroundColor:(id)arg1 {
if ([self.nextResponder isKindOfClass:%c(YTShareMainView)]) if ([self.nextResponder isKindOfClass:%c(YTShareMainView)])
arg1 = oledColor; arg1 = oledColor;
%orig; %orig;
@@ -221,7 +232,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
%end %end
%hook YTAsyncCollectionView %hook YTAsyncCollectionView
-(void)setBackgroundColor:(id)arg1 { - (void)setBackgroundColor:(id)arg1 {
if([self.nextResponder isKindOfClass:%c(YTRelatedVideosCollectionViewController)]) { if([self.nextResponder isKindOfClass:%c(YTRelatedVideosCollectionViewController)]) {
arg1 = [oledColor colorWithAlphaComponent:0.0]; arg1 = [oledColor colorWithAlphaComponent:0.0];
} else if([self.nextResponder isKindOfClass:%c(YTFullscreenMetadataHighlightsCollectionViewController)]) { } else if([self.nextResponder isKindOfClass:%c(YTFullscreenMetadataHighlightsCollectionViewController)]) {
@@ -233,343 +244,257 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
} }
%end %end
%hook YTDialogContainerScrollView
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTTopAlignedView
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
-(void)didMoveToWindow { // Dune - https://github.com/Skittyblock/Dune/blob/9b1df9790230115b7553cc9dbadf36889018d7f9/Tweak.xm#L70
%orig;
MSHookIvar<UIView *>(self, "_contentView").backgroundColor = oledColor;
}
%end
%hook MDXQueueView // Cast queue
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTChannelProfileEditorView
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTChannelSubMenuView //
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTChannelListSubMenuView // sub -
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTCommentView
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTCreateCommentAccessoryView
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTCreateCommentTextView
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
-(void)setTextColor:(id)arg1 {
arg1 = [UIColor whiteColor];
%orig;
}
%end
%hook YCHLiveChatActionPanelView
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTEmojiTextView
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTShareTitleView // Share sheet
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTNavigationBar
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
-(void)setBarTintColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTPrivacyTosFooterView
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTWatchMiniBarView %hook YTWatchMiniBarView
-(void)setBackgroundColor:(id)arg1 { - (void)setBackgroundColor:(id)arg1 {
arg1 = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.9]; arg1 = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.9];
%orig; %orig;
} }
%end %end
%hook YTPlaylistMiniBarView %hook YTPlaylistMiniBarView
-(void)setBackgroundColor:(id)arg1 { - (void)setBackgroundColor:(id)arg1 {
arg1 = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.9]; arg1 = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.9];
%orig; %orig;
} }
%end %end
%hook _LNPopupBarContentView // uYou player %hook _LNPopupBarContentView // uYou player
-(void)setBackgroundColor:(id)arg1 { - (void)setBackgroundColor:(id)arg1 {
arg1 = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.9]; arg1 = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.9];
%orig; %orig;
} }
%end %end
%hook YTEngagementPanelHeaderView %hook YTTopAlignedView
-(void)setBackgroundColor:(id)arg1 { - (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
arg1 = oledColor; - (void)didMoveToWindow { // Dune - https://github.com/Skittyblock/Dune/blob/9b1df9790230115b7553cc9dbadf36889018d7f9/Tweak.xm#L70
%orig; MSHookIvar<UIView *>(self, "_contentView").backgroundColor = oledColor;
} %orig;
%end
%hook YTChannelMobileHeaderView
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTInlineSignInView
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTHeaderView //Stt bar
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTTabTitlesView // Tab bar - mychannel
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTSettingsCell // Settings
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook GOODialogView // 3 dots menu
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTCollectionView //sharesheet
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook ASWAppSwitchingSheetHeaderView
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook ASWAppSwitchingSheetFooterView
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTCollectionSeparatorView
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
- (void)didMoveToWindow {}
%end
%hook YTLightweightQTMButton
-(void)setBackgroundColor:(id)arg1 {
if([self.nextResponder isKindOfClass:%c(YTShareMainView)]) {
arg1 = oledColor;
%orig;
}
}
-(void)setCustomTitleColor:(id)arg1 {
arg1 = [UIColor whiteColor];
%orig;
}
%end
%hook YTShareBusyView // sharesheet load
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTPageView
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTWatchView
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTSearchBarView
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTSearchSuggestionCollectionViewCell
-(void)updateColors {}
%end
%hook UISearchBarBackground
-(void)setBarTintColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook YTMealBarPromoView
-(void)setBackgroundColor:(id)arg1 { // Offline
arg1 = oledColor;
%orig;
}
%end
%hook NIAttributedLabel
-(void)setBackgroundColor:(id)arg1 {
if ([self.nextResponder isKindOfClass:%c(UIScrollView)])
arg1 = oledColor;
%orig;
} }
%end %end
%hook ASScrollView // Explore %hook ASScrollView // Explore
-(void)didMoveToWindow { - (void)didMoveToWindow {
self.backgroundColor = oledColor; self.backgroundColor = oledColor;
%orig; %orig;
} }
%end %end
%hook ASCollectionView // your videos %hook ASCollectionView // your videos
-(void)didMoveToWindow { - (void)didMoveToWindow {
self.backgroundColor = oledColor; self.backgroundColor = oledColor;
%orig; %orig;
} }
%end %end
// OLED keyboard by @ichitaso <3 - http://gist.github.com/ichitaso/935100fd53a26f18a9060f7195a1be0e
%hook UIPredictionViewController
- (void)loadView {
%orig;
[self.view setBackgroundColor:oledColor];
}
%end
%hook UICandidateViewController
- (void)loadView {
%orig;
[self.view setBackgroundColor:oledColor];
}
%end
%hook UIKeyboardDockView
- (void)didMoveToWindow {
self.backgroundColor = oledColor;
%orig;
}
%end
%hook UIKeyboardLayoutStar
- (void)didMoveToWindow {
self.backgroundColor = oledColor;
%orig;
}
%end
%hook UIKBRenderConfig // Prediction text color
- (void)setLightKeyboard:(BOOL)arg1 { %orig(NO); }
%end
//
%hook YTDialogContainerScrollView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook MDXQueueView // Cast queue
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTChannelProfileEditorView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTChannelSubMenuView //
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTChannelListSubMenuView // sub -
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTCommentView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTCreateCommentAccessoryView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTCreateCommentTextView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
- (void)setTextColor:(id)arg1 { %orig([UIColor whiteColor]); }
%end
%hook YCHLiveChatActionPanelView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTEmojiTextView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTShareTitleView // Share sheet
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTNavigationBar
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
- (void)setBarTintColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTPrivacyTosFooterView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTEngagementPanelHeaderView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTChannelMobileHeaderView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTInlineSignInView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTHeaderView //Stt bar
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTTabTitlesView // Tab bar - mychannel
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTSettingsCell // Settings
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTHorizontalCardListView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTShortsGalleryHeaderView // upload videos heaer (gallery)
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook GOODialogView // 3 dots menu
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTCollectionView //sharesheet
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook ASWAppSwitchingSheetHeaderView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook ASWAppSwitchingSheetFooterView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTCollectionSeparatorView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
- (void)didMoveToWindow {}
%end
%hook YTShareBusyView // sharesheet load
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTPageView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTWatchView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTSearchBarView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTSearchBoxView
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTSearchSuggestionCollectionViewCell
- (void)updateColors {}
%end
%hook UISearchBarBackground
- (void)setBarTintColor:(id)arg1 { %orig(oledColor); }
%end
%hook YTMealBarPromoView // Offline
- (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
%end
//// ////
/* /*
%hook UICollectionView %hook UICollectionView
-(void)setBackgroundColor:(id)arg1 { - (void)setBackgroundColor:(id)arg1 {
if ([self.nextResponder isKindOfClass:%c(UICollectionViewControllerWrapperView)]) if ([self.nextResponder isKindOfClass:%c(UICollectionViewControllerWrapperView)])
arg1 = oledColor; arg1 = oledColor;
%orig; %orig;
} }
%end %end
%hook YTShortsGalleryHeaderView // upload videos heaer (gallery)
-(void)setBackgroundColor:(id)arg1 {
arg1 = oledColor;
%orig;
}
%end
%hook _ASDisplayView // edit your videos %hook _ASDisplayView // edit your videos
-(void)layoutSubviews { - (void)layoutSubviews {
if ([self.nextResponder isKindOfClass:%c(ELMView)]) if ([self.nextResponder isKindOfClass:%c(ELMView)])
self.backgroundColor = oledColor; self.backgroundColor = oledColor;
} }
%end %end
%hook YTChannelProfileDescriptionEditorView // edit profile Description %hook YTChannelProfileDescriptionEditorView // edit profile Description
-(void)setBackgroundColor:(id)arg1 { - (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
arg1 = oledColor;
%orig;
}
%end %end
%hook YTChannelProfileNameEditorView // edit profile Name %hook YTChannelProfileNameEditorView // edit profile Name
-(void)setBackgroundColor:(id)arg1 { - (void)setBackgroundColor:(id)arg1 { %orig(oledColor); }
arg1 = oledColor;
%orig;
}
%end %end
hook GOOTextField hook GOOTextField
-(void)setBackgroundColor:(id)arg1 { // edit profile Description - (void)setBackgroundColor:(id)arg1 { // edit profile Description
arg1 = oledColor; arg1 = oledColor;
%orig; %orig;
} }
%end %end
%hook GOOMultilineTextField// %hook GOOMultilineTextField//
-(void)setBackgroundColor:(id)arg1 { // edit profile Name - (void)setBackgroundColor:(id)arg1 { // edit profile Name
arg1 = oledColor; arg1 = oledColor;
%orig; %orig;
} }
@@ -614,20 +539,20 @@ static void replaceTab(YTIGuideResponse *response) {
// BigYTMiniPlayer: https://github.com/Galactic-Dev/BigYTMiniPlayer // BigYTMiniPlayer: https://github.com/Galactic-Dev/BigYTMiniPlayer
%group Main %group Main
%hook YTWatchMiniBarView %hook YTWatchMiniBarView
-(void)setWatchMiniPlayerLayout:(int)arg1 { - (void)setWatchMiniPlayerLayout:(int)arg1 {
%orig(1); %orig(1);
} }
-(int)watchMiniPlayerLayout { - (int)watchMiniPlayerLayout {
return 1; return 1;
} }
-(void)layoutSubviews { - (void)layoutSubviews {
%orig; %orig;
self.frame = CGRectMake(([UIScreen mainScreen].bounds.size.width - self.frame.size.width), self.frame.origin.y, self.frame.size.width, self.frame.size.height); self.frame = CGRectMake(([UIScreen mainScreen].bounds.size.width - self.frame.size.width), self.frame.origin.y, self.frame.size.width, self.frame.size.height);
} }
%end %end
%hook YTMainAppVideoPlayerOverlayView %hook YTMainAppVideoPlayerOverlayView
-(BOOL)isUserInteractionEnabled { - (BOOL)isUserInteractionEnabled {
if([[self _viewControllerForAncestor].parentViewController.parentViewController isKindOfClass:%c(YTWatchMiniBarViewController)]) { if([[self _viewControllerForAncestor].parentViewController.parentViewController isKindOfClass:%c(YTWatchMiniBarViewController)]) {
return NO; return NO;
} }