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.

82 Zeilen
1.4KB

  1. #import "Tick.h"
  2. void playSound() {
  3. int loudness = [loudnessLevel intValue];
  4. SystemSoundID sound = 0;
  5. AudioServicesDisposeSystemSoundID(sound);
  6. if (loudness == 0) {
  7. AudioServicesCreateSystemSoundID((CFURLRef) CFBridgingRetain([NSURL fileURLWithPath:@"/Library/Application Support/Tick/tick.caf"]), &sound);
  8. } else if (loudness == 1) {
  9. AudioServicesCreateSystemSoundID((CFURLRef) CFBridgingRetain([NSURL fileURLWithPath:@"/Library/Application Support/Tick/tick2.caf"]), &sound);
  10. } else if (loudness == 2) {
  11. AudioServicesCreateSystemSoundID((CFURLRef) CFBridgingRetain([NSURL fileURLWithPath:@"/Library/Application Support/Tick/tick3.caf"]), &sound);
  12. }
  13. AudioServicesPlaySystemSound((SystemSoundID)sound);
  14. }
  15. %group Tick
  16. %hook SBUIIconForceTouchViewController
  17. -(BOOL)presentAnimated:(BOOL)arg1 withCompletionHandler:(/*^block*/id)arg2 {
  18. if (enabled) {
  19. playSound();
  20. }
  21. return %orig;
  22. }
  23. %end
  24. %hook SBIconController
  25. -(void)_forceTouchControllerWillPresent:(id)arg1 {
  26. %orig;
  27. if (enabled) {
  28. playSound();
  29. }
  30. }
  31. %end
  32. %hook SBIconController
  33. -(void)_iconForceTouchControllerWillPresent:(id)arg1 {
  34. %orig;
  35. if (enabled) {
  36. playSound();
  37. }
  38. }
  39. %end
  40. %end
  41. %ctor {
  42. pfs = [[HBPreferences alloc] initWithIdentifier:@"me.shymemoriees.tickpreferences"];
  43. [pfs registerBool:&enabled default:YES forKey:@"Enabled"];
  44. [pfs registerObject:&loudnessLevel default:@"0" forKey:@"Loudness"];
  45. if(enabled)
  46. %init(Tick);
  47. }