Bring the 3D Touch tick sound for Apps from iOS 13 to iOS 12 and lower
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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; @class UIPreviewInteractionController;
  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$_forceTouchControllerWillPresent$)(_LOGOS_SELF_TYPE_NORMAL SBIconController* _LOGOS_SELF_CONST, SEL, id); static void _logos_method$Tick$SBIconController$_forceTouchControllerWillPresent$(_LOGOS_SELF_TYPE_NORMAL SBIconController* _LOGOS_SELF_CONST, SEL, 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); static void (*_logos_orig$Tick$UIPreviewInteractionController$previewInteraction$didUpdatePreviewTransition$ended$)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, id, double, BOOL); static void _logos_method$Tick$UIPreviewInteractionController$previewInteraction$didUpdatePreviewTransition$ended$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, id, double, BOOL); static void (*_logos_orig$Tick$UIPreviewInteractionController$setPreviewInteraction$)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, UIPreviewInteraction *); static void _logos_method$Tick$UIPreviewInteractionController$setPreviewInteraction$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, UIPreviewInteraction *); static void (*_logos_orig$Tick$UIPreviewInteractionController$setPresentingViewController$)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, UIViewController *); static void _logos_method$Tick$UIPreviewInteractionController$setPresentingViewController$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, UIViewController *); static BOOL (*_logos_orig$Tick$UIPreviewInteractionController$_usesPreviewInteraction)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL); static BOOL _logos_method$Tick$UIPreviewInteractionController$_usesPreviewInteraction(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL); static void (*_logos_orig$Tick$UIPreviewInteractionController$setCurrentPreviewViewController$)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, UIViewController *); static void _logos_method$Tick$UIPreviewInteractionController$setCurrentPreviewViewController$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, UIViewController *); static BOOL (*_logos_orig$Tick$UIPreviewInteractionController$_usesPreviewPresentationController)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL); static BOOL _logos_method$Tick$UIPreviewInteractionController$_usesPreviewPresentationController(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL); static void (*_logos_orig$Tick$UIPreviewInteractionController$setWindowForPreviewPresentation$)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, UIWindow *); static void _logos_method$Tick$UIPreviewInteractionController$setWindowForPreviewPresentation$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, UIWindow *); static BOOL (*_logos_orig$Tick$UIPreviewInteractionController$startInteractivePreviewAtLocation$inView$)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, CGPoint, id); static BOOL _logos_method$Tick$UIPreviewInteractionController$startInteractivePreviewAtLocation$inView$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, CGPoint, id); static void (*_logos_orig$Tick$UIPreviewInteractionController$commitInteractivePreview)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL); static void _logos_method$Tick$UIPreviewInteractionController$commitInteractivePreview(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL); static void (*_logos_orig$Tick$UIPreviewInteractionController$forcePresentationController$didSelectMenuItem$)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, id, id); static void _logos_method$Tick$UIPreviewInteractionController$forcePresentationController$didSelectMenuItem$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, id, id); static void (*_logos_orig$Tick$UIPreviewInteractionController$forcePresentationControllerWantsToCommit$)(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST, SEL, id); static void _logos_method$Tick$UIPreviewInteractionController$forcePresentationControllerWantsToCommit$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _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$_forceTouchControllerWillPresent$(_LOGOS_SELF_TYPE_NORMAL SBIconController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, id arg1) {
  45. _logos_orig$Tick$SBIconController$_forceTouchControllerWillPresent$(self, _cmd, arg1);
  46. if (enabled) {
  47. playSound();
  48. }
  49. }
  50. static void _logos_method$Tick$SBIconController$_iconForceTouchControllerWillPresent$(_LOGOS_SELF_TYPE_NORMAL SBIconController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, id arg1) {
  51. _logos_orig$Tick$SBIconController$_iconForceTouchControllerWillPresent$(self, _cmd, arg1);
  52. if (enabled) {
  53. playSound();
  54. }
  55. }
  56. static void _logos_method$Tick$UIPreviewInteractionController$previewInteraction$didUpdatePreviewTransition$ended$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, id arg1, double arg2, BOOL arg3) {
  57. _logos_orig$Tick$UIPreviewInteractionController$previewInteraction$didUpdatePreviewTransition$ended$(self, _cmd, arg1, arg2, arg3);
  58. if (enabled) {
  59. playSound();
  60. }
  61. }
  62. static void _logos_method$Tick$UIPreviewInteractionController$setPreviewInteraction$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, UIPreviewInteraction * arg1) {
  63. _logos_orig$Tick$UIPreviewInteractionController$setPreviewInteraction$(self, _cmd, arg1);
  64. if (enabled) {
  65. playSound();
  66. }
  67. }
  68. static void _logos_method$Tick$UIPreviewInteractionController$setPresentingViewController$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, UIViewController * arg1) {
  69. _logos_orig$Tick$UIPreviewInteractionController$setPresentingViewController$(self, _cmd, arg1);
  70. if (enabled) {
  71. playSound();
  72. }
  73. }
  74. static BOOL _logos_method$Tick$UIPreviewInteractionController$_usesPreviewInteraction(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd) {
  75. if (enabled) {
  76. playSound();
  77. }
  78. return _logos_orig$Tick$UIPreviewInteractionController$_usesPreviewInteraction(self, _cmd);
  79. }
  80. static void _logos_method$Tick$UIPreviewInteractionController$setCurrentPreviewViewController$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, UIViewController * arg1) {
  81. _logos_orig$Tick$UIPreviewInteractionController$setCurrentPreviewViewController$(self, _cmd, arg1);
  82. if (enabled) {
  83. playSound();
  84. }
  85. }
  86. static BOOL _logos_method$Tick$UIPreviewInteractionController$_usesPreviewPresentationController(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd) {
  87. if (enabled) {
  88. playSound();
  89. }
  90. return _logos_orig$Tick$UIPreviewInteractionController$_usesPreviewPresentationController(self, _cmd);
  91. }
  92. static void _logos_method$Tick$UIPreviewInteractionController$setWindowForPreviewPresentation$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, UIWindow * arg1) {
  93. _logos_orig$Tick$UIPreviewInteractionController$setWindowForPreviewPresentation$(self, _cmd, arg1);
  94. if (enabled) {
  95. playSound();
  96. }
  97. }
  98. static BOOL _logos_method$Tick$UIPreviewInteractionController$startInteractivePreviewAtLocation$inView$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, CGPoint arg1, id arg2) {
  99. if (enabled) {
  100. playSound();
  101. }
  102. return _logos_orig$Tick$UIPreviewInteractionController$startInteractivePreviewAtLocation$inView$(self, _cmd, arg1, arg2);
  103. }
  104. static void _logos_method$Tick$UIPreviewInteractionController$commitInteractivePreview(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd) {
  105. _logos_orig$Tick$UIPreviewInteractionController$commitInteractivePreview(self, _cmd);
  106. if (enabled) {
  107. playSound();
  108. }
  109. }
  110. static void _logos_method$Tick$UIPreviewInteractionController$forcePresentationController$didSelectMenuItem$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, id arg1, id arg2) {
  111. _logos_orig$Tick$UIPreviewInteractionController$forcePresentationController$didSelectMenuItem$(self, _cmd, arg1, arg2);
  112. if (enabled) {
  113. playSound();
  114. }
  115. }
  116. static void _logos_method$Tick$UIPreviewInteractionController$forcePresentationControllerWantsToCommit$(_LOGOS_SELF_TYPE_NORMAL UIPreviewInteractionController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, id arg1) {
  117. _logos_orig$Tick$UIPreviewInteractionController$forcePresentationControllerWantsToCommit$(self, _cmd, arg1);
  118. if (enabled) {
  119. playSound();
  120. }
  121. }
  122. static __attribute__((constructor)) void _logosLocalCtor_f01702de(int __unused argc, char __unused **argv, char __unused **envp) {
  123. pfs = [[HBPreferences alloc] initWithIdentifier:@"me.shymemoriees.tickpreferences"];
  124. [pfs registerBool:&enabled default:YES forKey:@"Enabled"];
  125. [pfs registerObject:&loudnessLevel default:@"0" forKey:@"Loudness"];
  126. if(enabled)
  127. {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(_forceTouchControllerWillPresent:), (IMP)&_logos_method$Tick$SBIconController$_forceTouchControllerWillPresent$, (IMP*)&_logos_orig$Tick$SBIconController$_forceTouchControllerWillPresent$);MSHookMessageEx(_logos_class$Tick$SBIconController, @selector(_iconForceTouchControllerWillPresent:), (IMP)&_logos_method$Tick$SBIconController$_iconForceTouchControllerWillPresent$, (IMP*)&_logos_orig$Tick$SBIconController$_iconForceTouchControllerWillPresent$);Class _logos_class$Tick$UIPreviewInteractionController = objc_getClass("UIPreviewInteractionController"); MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(previewInteraction:didUpdatePreviewTransition:ended:), (IMP)&_logos_method$Tick$UIPreviewInteractionController$previewInteraction$didUpdatePreviewTransition$ended$, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$previewInteraction$didUpdatePreviewTransition$ended$);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(setPreviewInteraction:), (IMP)&_logos_method$Tick$UIPreviewInteractionController$setPreviewInteraction$, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$setPreviewInteraction$);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(setPresentingViewController:), (IMP)&_logos_method$Tick$UIPreviewInteractionController$setPresentingViewController$, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$setPresentingViewController$);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(_usesPreviewInteraction), (IMP)&_logos_method$Tick$UIPreviewInteractionController$_usesPreviewInteraction, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$_usesPreviewInteraction);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(setCurrentPreviewViewController:), (IMP)&_logos_method$Tick$UIPreviewInteractionController$setCurrentPreviewViewController$, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$setCurrentPreviewViewController$);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(_usesPreviewPresentationController), (IMP)&_logos_method$Tick$UIPreviewInteractionController$_usesPreviewPresentationController, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$_usesPreviewPresentationController);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(setWindowForPreviewPresentation:), (IMP)&_logos_method$Tick$UIPreviewInteractionController$setWindowForPreviewPresentation$, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$setWindowForPreviewPresentation$);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(startInteractivePreviewAtLocation:inView:), (IMP)&_logos_method$Tick$UIPreviewInteractionController$startInteractivePreviewAtLocation$inView$, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$startInteractivePreviewAtLocation$inView$);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(commitInteractivePreview), (IMP)&_logos_method$Tick$UIPreviewInteractionController$commitInteractivePreview, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$commitInteractivePreview);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(forcePresentationController:didSelectMenuItem:), (IMP)&_logos_method$Tick$UIPreviewInteractionController$forcePresentationController$didSelectMenuItem$, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$forcePresentationController$didSelectMenuItem$);MSHookMessageEx(_logos_class$Tick$UIPreviewInteractionController, @selector(forcePresentationControllerWantsToCommit:), (IMP)&_logos_method$Tick$UIPreviewInteractionController$forcePresentationControllerWantsToCommit$, (IMP*)&_logos_orig$Tick$UIPreviewInteractionController$forcePresentationControllerWantsToCommit$);}
  128. }