commit 5ff0bca92bf6c71ac3a301b8fc638308c1c376ca Author: Skitty Date: Sat Feb 15 10:47:23 2020 -0600 Initial release diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..18796dc --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.theos +packages +.DS_Store diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f35a71c --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +INSTALL_TARGET_PROCESSES = SpringBoard +ARCHS = armv7 arm64 arm64e +TARGET = iphone:clang::7.0 + +include $(THEOS)/makefiles/common.mk + +TWEAK_NAME = Stonks + +Stonks_FILES = Tweak.x +Stonks_CFLAGS = -fobjc-arc + +include $(THEOS_MAKE_PATH)/tweak.mk diff --git a/README.md b/README.md new file mode 100644 index 0000000..3592cc9 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# Stonks +Changes all "Stocks" text to "Stonks" system-wide on iOS. \ No newline at end of file diff --git a/Stonks.plist b/Stonks.plist new file mode 100644 index 0000000..e5c60ee --- /dev/null +++ b/Stonks.plist @@ -0,0 +1 @@ +{ Filter = { Bundles = ( "com.apple.UIKit" ); }; } diff --git a/Tweak.x b/Tweak.x new file mode 100644 index 0000000..a183b4f --- /dev/null +++ b/Tweak.x @@ -0,0 +1,81 @@ +// Stonks - Changes all "Stocks" text to "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])]; + return newString; +} +NSAttributedString *attributedStocksToStonks(NSAttributedString *origString) { + NSMutableAttributedString *newString = [origString mutableCopy]; + while ([newString.mutableString containsString:@"Stocks"]) { + NSRange range = [newString.mutableString rangeOfString:@"Stocks"]; + NSMutableAttributedString *replaceString = [[NSMutableAttributedString alloc] initWithString:@"Stonks"]; + [newString enumerateAttributesInRange:range options:0 usingBlock:^(NSDictionary *attrs, NSRange range, BOOL *stop) { + [replaceString addAttributes:attrs range:NSMakeRange(0, replaceString.length)]; + }]; + [newString replaceCharactersInRange:range withAttributedString:replaceString]; + } + return [newString copy]; +} + +// Global text views +%hook UILabel +- (void)setText:(NSString *)text { + if (enabled) { + text = stocksToStonks(text); + } + %orig(text); +} +- (void)setAttributedText:(NSAttributedString *)attributedText { + if (enabled) { + attributedText = attributedStocksToStonks(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 diff --git a/control b/control new file mode 100644 index 0000000..2485aed --- /dev/null +++ b/control @@ -0,0 +1,11 @@ +Package: xyz.skitty.stonks +Name: Stonks +Depends: mobilesubstrate +Version: 1.0 +Architecture: iphoneos-arm +Description: Change all "Stocks" text to "Stonks" +Depiction: https://skitty.xyz/repo/depictions/?p=xyz.skitty.stonks +SileoDepiction: https://skitty.xyz/repo/depictions/?s=xyz.skitty.stonks +Maintainer: Skitty +Author: Skitty +Section: Tweaks