|
|
@@ -1,20 +1,19 @@ |
|
|
|
// Stonks - Changes all "Stocks" text to "Stonks" |
|
|
|
// By Skitty |
|
|
|
// GetFree - Changes the App Store's "GET" text to "Free" |
|
|
|
// By mac-user669 |
|
|
|
|
|
|
|
// Based off Stonks by Skitty |
|
|
|
|
|
|
|
static BOOL enabled = YES; |
|
|
|
|
|
|
|
NSString *stocksToStonks(NSString *origString) { |
|
|
|
NSString *newString = [origString stringByReplacingOccurrencesOfString:@"Stocks" withString:@"Stonks"]; |
|
|
|
newString = [newString stringByReplacingOccurrencesOfString:@"stocks" withString:@"stonks"]; |
|
|
|
newString = [newString stringByReplacingOccurrencesOfString:@"STOCKS" withString:@"STONKS"]; |
|
|
|
newString = [newString stringByReplacingOccurrencesOfString:@"stocks" withString:@"stonks" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [newString length])]; |
|
|
|
NSString *GetToFree(NSString *origString) { |
|
|
|
NSString *newString = [origString stringByReplacingOccurrencesOfString:@"GET" withString:@"Free"]; |
|
|
|
return newString; |
|
|
|
} |
|
|
|
NSAttributedString *attributedStocksToStonks(NSAttributedString *origString) { |
|
|
|
NSAttributedString *attributedGetToFree(NSAttributedString *origString) { |
|
|
|
NSMutableAttributedString *newString = [origString mutableCopy]; |
|
|
|
while ([newString.mutableString containsString:@"Stocks"]) { |
|
|
|
NSRange range = [newString.mutableString rangeOfString:@"Stocks"]; |
|
|
|
NSMutableAttributedString *replaceString = [[NSMutableAttributedString alloc] initWithString:@"Stonks"]; |
|
|
|
while ([newString.mutableString containsString:@"GET"]) { |
|
|
|
NSRange range = [newString.mutableString rangeOfString:@"GET"]; |
|
|
|
NSMutableAttributedString *replaceString = [[NSMutableAttributedString alloc] initWithString:@"Free"]; |
|
|
|
[newString enumerateAttributesInRange:range options:0 usingBlock:^(NSDictionary<NSAttributedStringKey, id> *attrs, NSRange range, BOOL *stop) { |
|
|
|
[replaceString addAttributes:attrs range:NSMakeRange(0, replaceString.length)]; |
|
|
|
}]; |
|
|
@@ -23,59 +22,18 @@ NSAttributedString *attributedStocksToStonks(NSAttributedString *origString) { |
|
|
|
return [newString copy]; |
|
|
|
} |
|
|
|
|
|
|
|
// Global text views |
|
|
|
// Actual hook |
|
|
|
%hook UILabel |
|
|
|
- (void)setText:(NSString *)text { |
|
|
|
if (enabled) { |
|
|
|
text = stocksToStonks(text); |
|
|
|
text = GetToFree(text); |
|
|
|
} |
|
|
|
%orig(text); |
|
|
|
} |
|
|
|
- (void)setAttributedText:(NSAttributedString *)attributedText { |
|
|
|
if (enabled) { |
|
|
|
attributedText = attributedStocksToStonks(attributedText); |
|
|
|
attributedText = attributedGetToFree(attributedText); |
|
|
|
} |
|
|
|
%orig(attributedText); |
|
|
|
} |
|
|
|
%end |
|
|
|
|
|
|
|
%hook UITextView |
|
|
|
- (void)setText:(NSString *)text { |
|
|
|
if (enabled) { |
|
|
|
text = stocksToStonks(text); |
|
|
|
} |
|
|
|
%orig(text); |
|
|
|
} |
|
|
|
- (void)setAttributedText:(NSAttributedString *)attributedText { |
|
|
|
if (enabled) { |
|
|
|
attributedText = attributedStocksToStonks(attributedText); |
|
|
|
} |
|
|
|
%orig(attributedText); |
|
|
|
} |
|
|
|
%end |
|
|
|
|
|
|
|
// App names |
|
|
|
%hook SBApplication |
|
|
|
- (void)setDisplayName:(id)name { |
|
|
|
if (enabled){ |
|
|
|
name = stocksToStonks(name); |
|
|
|
} |
|
|
|
%orig(name); |
|
|
|
} |
|
|
|
- (id)displayName { |
|
|
|
return stocksToStonks(%orig); |
|
|
|
} |
|
|
|
%end |
|
|
|
|
|
|
|
// Folder names |
|
|
|
%hook SBFolder |
|
|
|
- (void)setDisplayName:(id)name { |
|
|
|
if (enabled){ |
|
|
|
name = stocksToStonks(name); |
|
|
|
} |
|
|
|
%orig(name); |
|
|
|
} |
|
|
|
- (id)displayName { |
|
|
|
return stocksToStonks(%orig); |
|
|
|
} |
|
|
|
%end |