Skip to content

Commit 5bce5a7

Browse files
committed
3.0
1 parent bde14ad commit 5bce5a7

24 files changed

Lines changed: 1496 additions & 1109 deletions

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ endif
55
DEBUG=0
66
FINALPACKAGE=1
77
ARCHS = arm64
8-
PACKAGE_VERSION = 2.7
8+
PACKAGE_VERSION = 3.0
99
TARGET := iphone:clang:latest:13.0
1010

1111
include $(THEOS)/makefiles/common.mk
1212

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

1818
include $(THEOS_MAKE_PATH)/tweak.mk

Settings.x

Lines changed: 360 additions & 303 deletions
Large diffs are not rendered by default.

Utils/NSBundle+YTLite.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#import <Foundation/Foundation.h>
2+
#import <rootless.h>
3+
4+
NS_ASSUME_NONNULL_BEGIN
5+
6+
@interface NSBundle (YTLite)
7+
8+
// Returns YTLite default bundle. Supports rootless if defined in compilation parameters
9+
@property (class, nonatomic, readonly) NSBundle *ytl_defaultBundle;
10+
11+
@end
12+
13+
NS_ASSUME_NONNULL_END

Utils/NSBundle+YTLite.m

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#import "NSBundle+YTLite.h"
2+
3+
@implementation NSBundle (YTLite)
4+
5+
+ (NSBundle *)ytl_defaultBundle {
6+
static NSBundle *bundle = nil;
7+
static dispatch_once_t onceToken;
8+
9+
dispatch_once(&onceToken, ^{
10+
NSString *tweakBundlePath = [[NSBundle mainBundle] pathForResource:@"YTLite" ofType:@"bundle"];
11+
NSString *rootlessBundlePath = ROOT_PATH_NS("/Library/Application Support/YTLite.bundle");
12+
13+
bundle = [NSBundle bundleWithPath:tweakBundlePath ?: rootlessBundlePath];
14+
});
15+
16+
return bundle;
17+
}
18+
19+
@end
File renamed without changes.
File renamed without changes.

Utils/YTLUserDefaults.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#import <Foundation/Foundation.h>
2+
3+
NS_ASSUME_NONNULL_BEGIN
4+
5+
@interface YTLUserDefaults : NSUserDefaults
6+
7+
@property (class, readonly, strong) YTLUserDefaults *standardUserDefaults;
8+
9+
- (void)reset;
10+
11+
+ (void)resetUserDefaults;
12+
13+
@end
14+
15+
NS_ASSUME_NONNULL_END

Utils/YTLUserDefaults.m

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#import "YTLUserDefaults.h"
2+
3+
@implementation YTLUserDefaults
4+
5+
static NSString *const kDefaultsSuiteName = @"com.dvntm.ytlite";
6+
7+
+ (YTLUserDefaults *)standardUserDefaults {
8+
static dispatch_once_t onceToken;
9+
static YTLUserDefaults *defaults = nil;
10+
11+
dispatch_once(&onceToken, ^{
12+
defaults = [[self alloc] initWithSuiteName:kDefaultsSuiteName];
13+
[defaults registerDefaults];
14+
});
15+
16+
return defaults;
17+
}
18+
19+
- (void)reset {
20+
[self removePersistentDomainForName:kDefaultsSuiteName];
21+
}
22+
23+
- (void)registerDefaults {
24+
[self registerDefaults:@{
25+
@"noAds": @YES,
26+
@"backgroundPlayback": @YES,
27+
@"removeUploads": @YES,
28+
@"speedIndex": @1,
29+
@"autoSpeedIndex": @3,
30+
@"wiFiQualityIndex": @0,
31+
@"cellQualityIndex": @0,
32+
@"pivotIndex": @0
33+
}];
34+
}
35+
36+
+ (void)resetUserDefaults {
37+
[[self standardUserDefaults] reset];
38+
}
39+
40+
@end

0 commit comments

Comments
 (0)