mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-04-21 03:32:08 +00:00
Better Implementation uYou Adblock Workaround LITE
This commit is contained in:
parent
1583e8c556
commit
ab878e50a9
1 changed files with 13 additions and 13 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
#import "uYouPlus.h"
|
#import "uYouPlus.h"
|
||||||
#import "RootOptionsController.h"
|
|
||||||
|
|
||||||
// Tweak's bundle for Localizations support - @PoomSmart - https://github.com/PoomSmart/YouPiP/commit/aea2473f64c75d73cab713e1e2d5d0a77675024f
|
// Tweak's bundle for Localizations support - @PoomSmart - https://github.com/PoomSmart/YouPiP/commit/aea2473f64c75d73cab713e1e2d5d0a77675024f
|
||||||
NSBundle *uYouPlusBundle() {
|
NSBundle *uYouPlusBundle() {
|
||||||
|
|
@ -90,29 +89,23 @@ static int contrastMode() {
|
||||||
%group uYouAdBlockingWorkaroundLite
|
%group uYouAdBlockingWorkaroundLite
|
||||||
%hook YTReelInfinitePlaybackDataSource
|
%hook YTReelInfinitePlaybackDataSource
|
||||||
- (void)setReels:(NSMutableOrderedSet <YTReelModel *> *)reels {
|
- (void)setReels:(NSMutableOrderedSet <YTReelModel *> *)reels {
|
||||||
if ([NSUserDefaults.standardUserDefaults boolForKey:@"removeYouTubeAds"]) {
|
[reels removeObjectsAtIndexes:[reels indexesOfObjectsPassingTest:^BOOL(YTReelModel *obj, NSUInteger idx, BOOL *stop) {
|
||||||
[reels removeObjectsAtIndexes:[reels indexesOfObjectsPassingTest:^BOOL(YTReelModel *obj, NSUInteger idx, BOOL *stop) {
|
return [obj respondsToSelector:@selector(videoType)] ? obj.videoType == 3 : NO;
|
||||||
return [obj respondsToSelector:@selector(videoType)] ? obj.videoType == 3 : NO;
|
}]];
|
||||||
}]];
|
|
||||||
}
|
|
||||||
%orig;
|
%orig;
|
||||||
}
|
}
|
||||||
%end
|
%end
|
||||||
|
|
||||||
%hook YTAdsInnerTubeContextDecorator
|
%hook YTAdsInnerTubeContextDecorator
|
||||||
- (void)decorateContext:(id)context {
|
- (void)decorateContext:(id)context {}
|
||||||
if ([NSUserDefaults.standardUserDefaults boolForKey:@"removeYouTubeAds"]) {}
|
|
||||||
}
|
|
||||||
%end
|
%end
|
||||||
|
|
||||||
%hook YTAccountScopedAdsInnerTubeContextDecorator
|
%hook YTAccountScopedAdsInnerTubeContextDecorator
|
||||||
- (void)decorateContext:(id)context {
|
- (void)decorateContext:(id)context {}
|
||||||
if ([NSUserDefaults.standardUserDefaults boolForKey:@"removeYouTubeAds"]) {}
|
|
||||||
}
|
|
||||||
%end
|
%end
|
||||||
%end
|
%end
|
||||||
|
|
||||||
// uYou AdBlocking Workaround - @PoomSmart
|
// uYou AdBlocking Workaround (for uYou Option) - @PoomSmart
|
||||||
%group uYouAdBlockingWorkaround
|
%group uYouAdBlockingWorkaround
|
||||||
// Workaround: uYou 3.0.3 Adblock fix - @PoomSmart
|
// Workaround: uYou 3.0.3 Adblock fix - @PoomSmart
|
||||||
%hook YTReelInfinitePlaybackDataSource
|
%hook YTReelInfinitePlaybackDataSource
|
||||||
|
|
@ -1660,6 +1653,9 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *ide
|
||||||
if (IS_ENABLED(@"disablePullToFull_enabled")) {
|
if (IS_ENABLED(@"disablePullToFull_enabled")) {
|
||||||
%init(gDisablePullToFull);
|
%init(gDisablePullToFull);
|
||||||
}
|
}
|
||||||
|
if (IS_ENABLED(@"uYouAdBlockingWorkaroundLite_enabled")) {
|
||||||
|
%init(uYouAdBlockingWorkaroundLite);
|
||||||
|
}
|
||||||
if (IS_ENABLED(@"uYouAdBlockingWorkaround_enabled")) {
|
if (IS_ENABLED(@"uYouAdBlockingWorkaround_enabled")) {
|
||||||
%init(uYouAdBlockingWorkaround);
|
%init(uYouAdBlockingWorkaround);
|
||||||
}
|
}
|
||||||
|
|
@ -1706,6 +1702,10 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *ide
|
||||||
if (![allKeys containsObject:@"YouPiPEnabled"]) {
|
if (![allKeys containsObject:@"YouPiPEnabled"]) {
|
||||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"YouPiPEnabled"];
|
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"YouPiPEnabled"];
|
||||||
}
|
}
|
||||||
|
if (![allKeys containsObject:@"uYouAdBlockingWorkaroundLite_enabled"]) {
|
||||||
|
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"uYouAdBlockingWorkaroundLite_enabled"];
|
||||||
|
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"removeYouTubeAds"];
|
||||||
|
}
|
||||||
if (![allKeys containsObject:@"uYouAdBlockingWorkaround_enabled"]) {
|
if (![allKeys containsObject:@"uYouAdBlockingWorkaround_enabled"]) {
|
||||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"uYouAdBlockingWorkaround_enabled"];
|
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"uYouAdBlockingWorkaround_enabled"];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue