Skip to content

Commit

Permalink
v1.1.1
Browse files Browse the repository at this point in the history
Add option to enable constraints for all videos (experimental)

Update bug report URL

Other minor changes
  • Loading branch information
therealFoxster committed Dec 4, 2023
1 parent 9f241e4 commit 7cd1bf9
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
22 changes: 19 additions & 3 deletions Settings.x
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ static const NSInteger sectionId = 517; // DontEatMyContent's section ID (just a
}
selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger sectionItemIndex) {
__block YTSettingsViewController *settingsViewController = [self valueForKey:@"_settingsViewControllerDelegate"];

// Create rows
NSMutableArray *rows = [NSMutableArray array];

float currentConstant = 20.0;
float storedConstant = [[NSUserDefaults standardUserDefaults] floatForKey:SAFE_AREA_CONSTANT_KEY];
UInt8 index = 0, selectedIndex = 0;
Expand All @@ -107,7 +108,7 @@ static const NSInteger sectionId = 517; // DontEatMyContent's section ID (just a
[[NSUserDefaults standardUserDefaults] setFloat:currentConstant forKey:SAFE_AREA_CONSTANT_KEY];
constant = currentConstant;
[settingsViewController reloadData]; // Refresh section's detail text (constant)
DEMC_showSnackBar(LOCALIZED_STRING(@"SAFE_AREA_CONST_MESSAGE"));
DEMC_showSnackBar(LOCALIZED_STRING(@"CHANGES_SAVED_DISMISS_VIDEO"));
return YES;
}
]];
Expand Down Expand Up @@ -141,13 +142,28 @@ static const NSInteger sectionId = 517; // DontEatMyContent's section ID (just a
];
if (IS_TWEAK_ENABLED) [sectionItems addObject:colorViews];

// Enable for all videos
YTSettingsSectionItem *enableForAllVideos = [%c(YTSettingsSectionItem) switchItemWithTitle:LOCALIZED_STRING(@"ENABLE_FOR_ALL_VIDEOS")
titleDescription:LOCALIZED_STRING(@"ENABLE_FOR_ALL_VIDEOS_DESC")
accessibilityIdentifier:nil
switchOn:IS_ENABLE_FOR_ALL_VIDEOS_ENABLED
switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) {
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:ENABLE_FOR_ALL_VIDEOS_KEY];
DEMC_showSnackBar(LOCALIZED_STRING(@"CHANGES_SAVED"));
return YES;
}
settingItemId:0
];
if (IS_TWEAK_ENABLED) [sectionItems addObject:enableForAllVideos];

// Report an issue
YTSettingsSectionItem *reportIssue = [%c(YTSettingsSectionItem) itemWithTitle:LOCALIZED_STRING(@"REPORT_ISSUE")
titleDescription:nil
accessibilityIdentifier:nil
detailTextBlock:nil
selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger sectionItemIndex) {
return [%c(YTUIUtils) openURL:[NSURL URLWithString:@"https://github.com/therealFoxster/DontEatMyContent/issues/new"]];
NSString *url = [NSString stringWithFormat:@"https://github.com/therealFoxster/DontEatMyContent/issues/new/?title=[v%@] %@", VERSION, LOCALIZED_STRING(@"ADD_TITLE")];
return [%c(YTUIUtils) openURL:[NSURL URLWithString:[url stringByReplacingOccurrencesOfString:@" " withString:@"%20"]]];
}
];
[sectionItems addObject:reportIssue];
Expand Down
6 changes: 5 additions & 1 deletion Tweak.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
#import <UIKit/UIKit.h>

#define DEMC @"DontEatMyContent"
#define VERSION @"1.1.0"
#define VERSION @"1.1.1"

// Keys
#define ENABLED_KEY @"DEMC_enabled"
#define COLOR_VIEWS_ENABLED_KEY @"DEMC_colorViewsEnabled"
#define SAFE_AREA_CONSTANT_KEY @"DEMC_safeAreaConstant"
#define DISABLE_AMBIENT_MODE_KEY @"DEMC_disableAmbientMode"
#define LIMIT_ZOOM_TO_FILL_KEY @"DEMC_limitZoomToFill"
#define ENABLE_FOR_ALL_VIDEOS_KEY @"DEMC_enableForAllVideos"

#define DEFAULT_CONSTANT 22.0
#define IS_TWEAK_ENABLED [[NSUserDefaults standardUserDefaults] boolForKey:ENABLED_KEY]
#define IS_COLOR_VIEWS_ENABLED [[NSUserDefaults standardUserDefaults] boolForKey:COLOR_VIEWS_ENABLED_KEY]
#define IS_DISABLE_AMBIENT_MODE_ENABLED [[NSUserDefaults standardUserDefaults] boolForKey:DISABLE_AMBIENT_MODE_KEY]
#define IS_LIMIT_ZOOM_TO_FILL_ENABLED [[NSUserDefaults standardUserDefaults] boolForKey:LIMIT_ZOOM_TO_FILL_KEY]
#define IS_ENABLE_FOR_ALL_VIDEOS_ENABLED [[NSUserDefaults standardUserDefaults] boolForKey:ENABLE_FOR_ALL_VIDEOS_KEY]
#define LOCALIZED_STRING(s) [bundle localizedStringForKey:s value:nil table:nil]

@interface YTPlayerViewController : UIViewController
Expand Down Expand Up @@ -90,6 +92,8 @@
headerHidden:(BOOL)headerHidden;
- (void)pushViewController:(UIViewController *)viewController;
- (void)reloadData;
- (id)accountID;
- (id)initWithAccountID:(id)accountID parentResponder:(id)parentResponder;
@end

// Alert
Expand Down
10 changes: 5 additions & 5 deletions Tweak.x
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ NSBundle *DEMC_getTweakBundle();
playerView.backgroundColor = [UIColor blackColor];;
renderingViewContainer.backgroundColor = [UIColor blackColor];
renderingView.backgroundColor = [UIColor blackColor];
} else {
playerView.backgroundColor = [UIColor blackColor];
renderingViewContainer.backgroundColor = nil;
renderingView.backgroundColor = nil;
}

if (IS_TWEAK_ENABLED) {
Expand All @@ -51,10 +55,6 @@ NSBundle *DEMC_getTweakBundle();
playerView.backgroundColor = [UIColor blueColor];
renderingViewContainer.backgroundColor = [UIColor greenColor];
renderingView.backgroundColor = [UIColor redColor];
} else if (!IS_DISABLE_AMBIENT_MODE_ENABLED) {
playerView.backgroundColor = [UIColor blackColor];
renderingViewContainer.backgroundColor = nil;
renderingView.backgroundColor = nil;
}

YTMainAppVideoPlayerOverlayViewController *activeVideoPlayerOverlay = [self activeVideoPlayerOverlay];
Expand Down Expand Up @@ -183,7 +183,7 @@ NSBundle *DEMC_getTweakBundle();

static void DEMC_activateConstraints() {
if (!IS_TWEAK_ENABLED) return;
if (videoAspectRatio < THRESHOLD) {
if (videoAspectRatio < THRESHOLD && !IS_ENABLE_FOR_ALL_VIDEOS_ENABLED) {
DEMC_deactivateConstraints();
return;
}
Expand Down
2 changes: 1 addition & 1 deletion control
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: me.foxster.donteatmycontent
Name: DontEatMyContent
Version: 1.1.0
Version: 1.1.1
Architecture: iphoneos-arm
Description: Prevent the notch/Dynamic Island from munching on 2:1 video content in YouTube
Maintainer: Foxster
Expand Down

0 comments on commit 7cd1bf9

Please sign in to comment.