Skip to content

Commit

Permalink
3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dayanch96 committed Mar 6, 2024
1 parent bde14ad commit 5bce5a7
Show file tree
Hide file tree
Showing 24 changed files with 1,496 additions and 1,109 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ endif
DEBUG=0
FINALPACKAGE=1
ARCHS = arm64
PACKAGE_VERSION = 2.7
PACKAGE_VERSION = 3.0
TARGET := iphone:clang:latest:13.0

include $(THEOS)/makefiles/common.mk

TWEAK_NAME = YTLite
$(TWEAK_NAME)_FRAMEWORKS = UIKit Foundation SystemConfiguration
$(TWEAK_NAME)_CFLAGS = -fobjc-arc -DTWEAK_VERSION=$(PACKAGE_VERSION)
$(TWEAK_NAME)_FILES = $(wildcard *.x *.m)
$(TWEAK_NAME)_FILES = $(wildcard *.x Utils/*.m)

include $(THEOS_MAKE_PATH)/tweak.mk
663 changes: 360 additions & 303 deletions Settings.x

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions Utils/NSBundle+YTLite.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#import <Foundation/Foundation.h>
#import <rootless.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSBundle (YTLite)

// Returns YTLite default bundle. Supports rootless if defined in compilation parameters
@property (class, nonatomic, readonly) NSBundle *ytl_defaultBundle;

@end

NS_ASSUME_NONNULL_END
19 changes: 19 additions & 0 deletions Utils/NSBundle+YTLite.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#import "NSBundle+YTLite.h"

@implementation NSBundle (YTLite)

+ (NSBundle *)ytl_defaultBundle {
static NSBundle *bundle = nil;
static dispatch_once_t onceToken;

dispatch_once(&onceToken, ^{
NSString *tweakBundlePath = [[NSBundle mainBundle] pathForResource:@"YTLite" ofType:@"bundle"];
NSString *rootlessBundlePath = ROOT_PATH_NS("/Library/Application Support/YTLite.bundle");

bundle = [NSBundle bundleWithPath:tweakBundlePath ?: rootlessBundlePath];
});

return bundle;
}

@end
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions Utils/YTLUserDefaults.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface YTLUserDefaults : NSUserDefaults

@property (class, readonly, strong) YTLUserDefaults *standardUserDefaults;

- (void)reset;

+ (void)resetUserDefaults;

@end

NS_ASSUME_NONNULL_END
40 changes: 40 additions & 0 deletions Utils/YTLUserDefaults.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#import "YTLUserDefaults.h"

@implementation YTLUserDefaults

static NSString *const kDefaultsSuiteName = @"com.dvntm.ytlite";

+ (YTLUserDefaults *)standardUserDefaults {
static dispatch_once_t onceToken;
static YTLUserDefaults *defaults = nil;

dispatch_once(&onceToken, ^{
defaults = [[self alloc] initWithSuiteName:kDefaultsSuiteName];
[defaults registerDefaults];
});

return defaults;
}

- (void)reset {
[self removePersistentDomainForName:kDefaultsSuiteName];
}

- (void)registerDefaults {
[self registerDefaults:@{
@"noAds": @YES,
@"backgroundPlayback": @YES,
@"removeUploads": @YES,
@"speedIndex": @1,
@"autoSpeedIndex": @3,
@"wiFiQualityIndex": @0,
@"cellQualityIndex": @0,
@"pivotIndex": @0
}];
}

+ (void)resetUserDefaults {
[[self standardUserDefaults] reset];
}

@end
Loading

0 comments on commit 5bce5a7

Please sign in to comment.