Bring the 3D Touch tick sound for Apps from iOS 13 to iOS 12 and lower
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

67 lines
1.2KB

  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/Tick/tick.caf"]), &sound);
  8. } else if (loudness == 1) {
  9. AudioServicesCreateSystemSoundID((CFURLRef) CFBridgingRetain([NSURL fileURLWithPath:@"/Library/Tick/tick2.caf"]), &sound);
  10. } else if (loudness == 2) {
  11. AudioServicesCreateSystemSoundID((CFURLRef) CFBridgingRetain([NSURL fileURLWithPath:@"/Library/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. %end
  33. %ctor {
  34. pfs = [[HBPreferences alloc] initWithIdentifier:@"me.shymemoriees.tickpreferences"];
  35. [pfs registerBool:&enabled default:YES forKey:@"Enabled"];
  36. [pfs registerObject:&loudnessLevel default:@"0" forKey:@"Loudness"];
  37. if(enabled)
  38. %init(Tick);
  39. }