Bring the 3D Touch tick sound for Apps from iOS 13 to iOS 12 and lower
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

79 lines
2.9KB

  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 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);
  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 __attribute__((constructor)) void _logosLocalCtor_36835025(int __unused argc, char __unused **argv, char __unused **envp) {
  45. pfs = [[HBPreferences alloc] initWithIdentifier:@"me.shymemoriees.tickpreferences"];
  46. [pfs registerBool:&enabled default:YES forKey:@"Enabled"];
  47. [pfs registerObject:&loudnessLevel default:@"0" forKey:@"Loudness"];
  48. if(enabled)
  49. {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$);}
  50. }