Bring the 3D Touch tick sound for Apps from iOS 13 to iOS 12 and lower
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Tweak.x 1.4KB

4 år sedan
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. }