Changes the App Store's "GET" text to "Free"
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Tweak.x 2.3KB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // Stonks - Changes all "Stocks" text to "Stonks"
  2. // By Skitty
  3. static BOOL enabled = YES;
  4. NSString *stocksToStonks(NSString *origString) {
  5. NSString *newString = [origString stringByReplacingOccurrencesOfString:@"Stocks" withString:@"Stonks"];
  6. newString = [newString stringByReplacingOccurrencesOfString:@"stocks" withString:@"stonks"];
  7. newString = [newString stringByReplacingOccurrencesOfString:@"STOCKS" withString:@"STONKS"];
  8. newString = [newString stringByReplacingOccurrencesOfString:@"stocks" withString:@"stonks" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [newString length])];
  9. return newString;
  10. }
  11. NSAttributedString *attributedStocksToStonks(NSAttributedString *origString) {
  12. NSMutableAttributedString *newString = [origString mutableCopy];
  13. while ([newString.mutableString containsString:@"Stocks"]) {
  14. NSRange range = [newString.mutableString rangeOfString:@"Stocks"];
  15. NSMutableAttributedString *replaceString = [[NSMutableAttributedString alloc] initWithString:@"Stonks"];
  16. [newString enumerateAttributesInRange:range options:0 usingBlock:^(NSDictionary<NSAttributedStringKey, id> *attrs, NSRange range, BOOL *stop) {
  17. [replaceString addAttributes:attrs range:NSMakeRange(0, replaceString.length)];
  18. }];
  19. [newString replaceCharactersInRange:range withAttributedString:replaceString];
  20. }
  21. return [newString copy];
  22. }
  23. // Global text views
  24. %hook UILabel
  25. - (void)setText:(NSString *)text {
  26. if (enabled) {
  27. text = stocksToStonks(text);
  28. }
  29. %orig(text);
  30. }
  31. - (void)setAttributedText:(NSAttributedString *)attributedText {
  32. if (enabled) {
  33. attributedText = attributedStocksToStonks(attributedText);
  34. }
  35. %orig(attributedText);
  36. }
  37. %end
  38. %hook UITextView
  39. - (void)setText:(NSString *)text {
  40. if (enabled) {
  41. text = stocksToStonks(text);
  42. }
  43. %orig(text);
  44. }
  45. - (void)setAttributedText:(NSAttributedString *)attributedText {
  46. if (enabled) {
  47. attributedText = attributedStocksToStonks(attributedText);
  48. }
  49. %orig(attributedText);
  50. }
  51. %end
  52. // App names
  53. %hook SBApplication
  54. - (void)setDisplayName:(id)name {
  55. if (enabled){
  56. name = stocksToStonks(name);
  57. }
  58. %orig(name);
  59. }
  60. - (id)displayName {
  61. return stocksToStonks(%orig);
  62. }
  63. %end
  64. // Folder names
  65. %hook SBFolder
  66. - (void)setDisplayName:(id)name {
  67. if (enabled){
  68. name = stocksToStonks(name);
  69. }
  70. %orig(name);
  71. }
  72. - (id)displayName {
  73. return stocksToStonks(%orig);
  74. }
  75. %end