Bring the 3D Touch tick sound for Apps from iOS 13 to iOS 12 and lower
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

82 linhas
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. }