summaryrefslogtreecommitdiff
path: root/CyteKit/WebViewController.mm
diff options
context:
space:
mode:
Diffstat (limited to 'CyteKit/WebViewController.mm')
-rw-r--r--CyteKit/WebViewController.mm28
1 files changed, 28 insertions, 0 deletions
diff --git a/CyteKit/WebViewController.mm b/CyteKit/WebViewController.mm
index 20838bf..40b1200 100644
--- a/CyteKit/WebViewController.mm
+++ b/CyteKit/WebViewController.mm
@@ -19,6 +19,8 @@ extern NSString * const kCAFilterNearest;
#include <dlfcn.h>
#include <objc/runtime.h>
+#include "Substrate.hpp"
+
#define ForSaurik 0
#define DefaultTimeout_ 120.0
@@ -1297,3 +1299,29 @@ float CYScrollViewDecelerationRateNormal;
}
@end
+
+MSClassHook(WAKWindow)
+
+static CGSize $WAKWindow$screenSize(WAKWindow *self, SEL _cmd) {
+ CGSize size([[UIScreen mainScreen] bounds].size);
+ /*if ([$WAKWindow respondsToSelector:@selector(hasLandscapeOrientation)])
+ if ([$WAKWindow hasLandscapeOrientation])
+ std::swap(size.width, size.height);*/
+ return size;
+}
+
+static struct WAKWindow$screenSize { WAKWindow$screenSize() {
+ if ($WAKWindow != NULL)
+ if (Method method = class_getInstanceMethod($WAKWindow, @selector(screenSize)))
+ method_setImplementation(method, (IMP) &$WAKWindow$screenSize);
+} } WAKWindow$screenSize;;
+
+MSClassHook(NSUserDefaults)
+
+MSHook(id, NSUserDefaults$objectForKey$, NSUserDefaults *self, SEL _cmd, NSString *key) {
+ if ([key respondsToSelector:@selector(isEqualToString:)] && [key isEqualToString:@"WebKitLocalStorageDatabasePathPreferenceKey"])
+ return [NSString stringWithFormat:@"%@/%@/%@", NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject, NSBundle.mainBundle.bundleIdentifier, @"LocalStorage"];
+ return _NSUserDefaults$objectForKey$(self, _cmd, key);
+}
+
+CYHook(NSUserDefaults, objectForKey$, objectForKey:)