Bring the 3D Touch tick sound for Apps from iOS 13 to iOS 12 and lower
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.

5 jaren geleden
5 jaren geleden
5 jaren geleden
5 jaren geleden
5 jaren geleden
5 jaren geleden
5 jaren geleden
5 jaren geleden
5 jaren geleden
5 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #line 1 "Tweak.x"
  2. #import "Tick.h"
  3. void playSound() {
  4. int loudness = [loudnessLevel intValue];
  5. SystemSoundID sound = 0;
  6. AudioServicesDisposeSystemSoundID(sound);
  7. if (loudness == 0) {
  8. AudioServicesCreateSystemSoundID((CFURLRef) CFBridgingRetain([NSURL fileURLWithPath:@"/Library/Application Support/Tick/tick.caf"]), &sound);
  9. } else if (loudness == 1) {
  10. AudioServicesCreateSystemSoundID((CFURLRef) CFBridgingRetain([NSURL fileURLWithPath:@"/Library/Application Support/Tick/tick2.caf"]), &sound);
  11. } else if (loudness == 2) {
  12. AudioServicesCreateSystemSoundID((CFURLRef) CFBridgingRetain([NSURL fileURLWithPath:@"/Library/Application Support/Tick/tick3.caf"]), &sound);
  13. }
  14. AudioServicesPlaySystemSound((SystemSoundID)sound);
  15. }
  16. #include <substrate.h>
  17. #if defined(__clang__)
  18. #if __has_feature(objc_arc)
  19. #define _LOGOS_SELF_TYPE_NORMAL __unsafe_unretained
  20. #define _LOGOS_SELF_TYPE_INIT __attribute__((ns_consumed))
  21. #define _LOGOS_SELF_CONST const
  22. #define _LOGOS_RETURN_RETAINED __attribute__((ns_returns_retained))
  23. #else
  24. #define _LOGOS_SELF_TYPE_NORMAL
  25. #define _LOGOS_SELF_TYPE_INIT
  26. #define _LOGOS_SELF_CONST
  27. #define _LOGOS_RETURN_RETAINED
  28. #endif
  29. #else
  30. #define _LOGOS_SELF_TYPE_NORMAL
  31. #define _LOGOS_SELF_TYPE_INIT
  32. #define _LOGOS_SELF_CONST
  33. #define _LOGOS_RETURN_RETAINED
  34. #endif
  35. @class SBIconController; @class SBUIIconForceTouchViewController;
  36. #line 25 "Tweak.x"
  37. static BOOL (*_logos_orig$Tick$SBUIIconForceTouchViewController$presentAnimated$withCompletionHandler$)(_LOGOS_SELF_TYPE_NORMAL SBUIIconForceTouchViewController* _LOGOS_SELF_CONST, SEL, BOOL, id); static BOOL _logos_method$Tick$SBUIIconForceTouchViewController$presentAnimated$withCompletionHandler$(_LOGOS_SELF_TYPE_NORMAL SBUIIconForceTouchViewController* _LOGOS_SELF_CONST, SEL, BOOL, id); static void (*_logos_orig$Tick$SBIconController$_iconForceTouchControllerWillPresent$)(_LOGOS_SELF_TYPE_NORMAL SBIconController* _LOGOS_SELF_CONST, SEL, id); static void _logos_method$Tick$SBIconController$_iconForceTouchControllerWillPresent$(_LOGOS_SELF_TYPE_NORMAL SBIconController* _LOGOS_SELF_CONST, SEL, id);
  38. static BOOL _logos_method$Tick$SBUIIconForceTouchViewController$presentAnimated$withCompletionHandler$(_LOGOS_SELF_TYPE_NORMAL SBUIIconForceTouchViewController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, BOOL arg1, id arg2) {
  39. if (enabled) {
  40. playSound();
  41. }
  42. return _logos_orig$Tick$SBUIIconForceTouchViewController$presentAnimated$withCompletionHandler$(self, _cmd, arg1, arg2);
  43. }
  44. static void _logos_method$Tick$SBIconController$_iconForceTouchControllerWillPresent$(_LOGOS_SELF_TYPE_NORMAL SBIconController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, id arg1) {
  45. _logos_orig$Tick$SBIconController$_iconForceTouchControllerWillPresent$(self, _cmd, arg1);
  46. if (enabled) {
  47. playSound();
  48. }
  49. }
  50. static __attribute__((constructor)) void _logosLocalCtor_f1ee81aa(int __unused argc, char __unused **argv, char __unused **envp) {
  51. pfs = [[HBPreferences alloc] initWithIdentifier:@"me.shymemoriees.tickpreferences"];
  52. [pfs registerBool:&enabled default:YES forKey:@"Enabled"];
  53. [pfs registerObject:&loudnessLevel default:@"0" forKey:@"Loudness"];
  54. if(enabled)
  55. {Class _logos_class$Tick$SBUIIconForceTouchViewController = objc_getClass("SBUIIconForceTouchViewController"); MSHookMessageEx(_logos_class$Tick$SBUIIconForceTouchViewController, @selector(presentAnimated:withCompletionHandler:), (IMP)&_logos_method$Tick$SBUIIconForceTouchViewController$presentAnimated$withCompletionHandler$, (IMP*)&_logos_orig$Tick$SBUIIconForceTouchViewController$presentAnimated$withCompletionHandler$);Class _logos_class$Tick$SBIconController = objc_getClass("SBIconController"); MSHookMessageEx(_logos_class$Tick$SBIconController, @selector(_iconForceTouchControllerWillPresent:), (IMP)&_logos_method$Tick$SBIconController$_iconForceTouchControllerWillPresent$, (IMP*)&_logos_orig$Tick$SBIconController$_iconForceTouchControllerWillPresent$);}
  56. }