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.

52 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/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. %end
  25. %ctor {
  26. pfs = [[HBPreferences alloc] initWithIdentifier:@"me.shymemoriees.tickpreferences"];
  27. [pfs registerBool:&enabled default:YES forKey:@"Enabled"];
  28. [pfs registerObject:&loudnessLevel default:@"0" forKey:@"Loudness"];
  29. if(enabled)
  30. %init(Tick);
  31. }