forked from dayanch96/YTLite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
1,496 additions
and
1,109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.