summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cydia.mm27
1 files changed, 27 insertions, 0 deletions
diff --git a/Cydia.mm b/Cydia.mm
index 38ba04e..b546ec9 100644
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -8518,6 +8518,26 @@ MSHook(void, UIWebDocumentView$_setUIKitDelegate$, UIWebDocumentView *self, SEL
return _UIWebDocumentView$_setUIKitDelegate$(self, _cmd, delegate);
}
+static NSNumber *shouldPlayKeyboardSounds;
+
+Class $UIHardware;
+
+MSHook(void, UIHardware$_playSystemSound$, Class self, SEL _cmd, int soundIndex) {
+ switch (soundIndex) {
+ case 1104: // Keyboard Button Clicked
+ case 1105: // Keyboard Delete Repeated
+ if (!shouldPlayKeyboardSounds) {
+ NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.apple.preferences.sounds.plist"];
+ shouldPlayKeyboardSounds = [[dict objectForKey:@"keyboard"] ?: (id)kCFBooleanTrue retain];
+ [dict release];
+ }
+ if (![shouldPlayKeyboardSounds boolValue])
+ break;
+ default:
+ _UIHardware$_playSystemSound$(self, _cmd, soundIndex);
+ }
+}
+
int main(int argc, char *argv[]) { _pooled
_trace();
@@ -8539,6 +8559,13 @@ int main(int argc, char *argv[]) { _pooled
_UIWebDocumentView$_setUIKitDelegate$ = reinterpret_cast<void (*)(UIWebDocumentView *, SEL, id)>(method_getImplementation(UIWebDocumentView$_setUIKitDelegate$));
method_setImplementation(UIWebDocumentView$_setUIKitDelegate$, reinterpret_cast<IMP>(&$UIWebDocumentView$_setUIKitDelegate$));
}
+
+ $UIHardware = objc_getClass("UIHardware");
+ Method UIHardware$_playSystemSound$(class_getClassMethod($UIHardware, @selector(_playSystemSound:)));
+ if (UIHardware$_playSystemSound$ != NULL) {
+ _UIHardware$_playSystemSound$ = reinterpret_cast<void (*)(Class, SEL, int)>(method_getImplementation(UIHardware$_playSystemSound$));
+ method_setImplementation(UIHardware$_playSystemSound$, reinterpret_cast<IMP>(&$UIHardware$_playSystemSound$));
+ }
/* }}} */
/* Set Locale {{{ */
Locale_ = CFLocaleCopyCurrent();