#include <UIKit/UIKit.h>
#include "CyteKit/Application.h"
+#include "CyteKit/URLCache.h"
#include "iPhonePrivate.h"
#include <Menes/ObjectHandle.h>
if ([self respondsToSelector:@selector(setApplicationSupportsShakeToEdit:)])
[self setApplicationSupportsShakeToEdit:NO];
+
+ [NSURLCache setSharedURLCache:[[[CyteURLCache alloc]
+ initWithMemoryCapacity:524288
+ diskCapacity:10485760
+ diskPath:[NSString stringWithFormat:@"%@/%@/%@", NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject, NSBundle.mainBundle.bundleIdentifier, @"SDURLCache"]
+ ] autorelease]];
}
@end
--- /dev/null
+/* Cydia - iPhone UIKit Front-End for Debian APT
+ * Copyright (C) 2008-2015 Jay Freeman (saurik)
+*/
+
+/* GNU General Public License, Version 3 {{{ */
+/*
+ * Cydia is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * Cydia is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Cydia. If not, see <http://www.gnu.org/licenses/>.
+**/
+/* }}} */
+
+#ifndef CyteKit_CyteKit_H
+#define CyteKit_CyteKit_H
+
+#include "CyteKit/Application.h"
+#include "CyteKit/NavigationController.h"
+#include "CyteKit/RegEx.hpp"
+#include "CyteKit/TableViewCell.h"
+#include "CyteKit/TabBarController.h"
+#include "CyteKit/URLCache.h"
+#include "CyteKit/WebViewController.h"
+#include "CyteKit/WebViewTableViewCell.h"
+
+#include "CyteKit/countByEnumeratingWithState.h"
+#include "CyteKit/stringWithUTF8Bytes.h"
+#include "CyteKit/webScriptObjectInContext.h"
+
+#endif//CyteKit_CyteKit_H
+++ /dev/null
-/* Cydia - iPhone UIKit Front-End for Debian APT
- * Copyright (C) 2008-2015 Jay Freeman (saurik)
-*/
-
-/* GNU General Public License, Version 3 {{{ */
-/*
- * Cydia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation, either version 3 of the License,
- * or (at your option) any later version.
- *
- * Cydia is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Cydia. If not, see <http://www.gnu.org/licenses/>.
-**/
-/* }}} */
-
-#ifndef CyteKit_WebScriptObject_Cyte_H
-#define CyteKit_WebScriptObject_Cyte_H
-
-#include "iPhonePrivate.h"
-
-@interface WebScriptObject (Cyte)
-- (NSUInteger) count;
-- (NSUInteger) countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)objects count:(NSUInteger)count;
-- (id) objectAtIndex:(unsigned)index;
-@end
-
-#endif//CyteKit_WebScriptObject_Cyte_H
+++ /dev/null
-/* Cydia - iPhone UIKit Front-End for Debian APT
- * Copyright (C) 2008-2015 Jay Freeman (saurik)
-*/
-
-/* GNU General Public License, Version 3 {{{ */
-/*
- * Cydia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation, either version 3 of the License,
- * or (at your option) any later version.
- *
- * Cydia is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Cydia. If not, see <http://www.gnu.org/licenses/>.
-**/
-/* }}} */
-
-#include "CyteKit/UCPlatform.h"
-
-#include "CyteKit/WebScriptObject-Cyte.h"
-
-#include "iPhonePrivate.h"
-
-@implementation WebScriptObject (Cyte)
-
-- (NSUInteger) count {
- id length([self valueForKey:@"length"]);
- if ([length respondsToSelector:@selector(intValue)])
- return [length intValue];
- else
- return 0;
-}
-
-- (id) objectAtIndex:(unsigned)index {
- return [self webScriptValueAtIndex:index];
-}
-
-- (NSUInteger) countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)objects count:(NSUInteger)count {
- size_t length([self count] - state->state);
- if (length <= 0)
- return 0;
- else if (length > count)
- length = count;
- for (size_t i(0); i != length; ++i)
- objects[i] = [self objectAtIndex:state->state++];
- state->itemsPtr = objects;
- state->mutationsPtr = (unsigned long *) self;
- return length;
-}
-
-@end
class_addMethod($UIWebViewWebViewDelegate, @selector(_clearUIWebView), (IMP) &$UIWebViewWebViewDelegate$_clearUIWebView, "v8@0:4");
}
}
+
+@implementation UIWebDocumentView (Cydia)
+
+- (void) _setScrollerOffset:(CGPoint)offset {
+ UIScroller *scroller([self _scroller]);
+
+ CGSize size([scroller contentSize]);
+ CGSize bounds([scroller bounds].size);
+
+ CGPoint max;
+ max.x = size.width - bounds.width;
+ max.y = size.height - bounds.height;
+
+ // wtf Apple?!
+ if (max.x < 0)
+ max.x = 0;
+ if (max.y < 0)
+ max.y = 0;
+
+ offset.x = offset.x < 0 ? 0 : offset.x > max.x ? max.x : offset.x;
+ offset.y = offset.y < 0 ? 0 : offset.y > max.y ? max.y : offset.y;
+
+ [scroller setOffset:offset];
+}
+
+@end
#include <dlfcn.h>
#include <objc/runtime.h>
+#include "Substrate.hpp"
+
#define ForSaurik 0
#define DefaultTimeout_ 120.0
}
@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:)
--- /dev/null
+/* Cydia - iPhone UIKit Front-End for Debian APT
+ * Copyright (C) 2008-2015 Jay Freeman (saurik)
+*/
+
+/* GNU General Public License, Version 3 {{{ */
+/*
+ * Cydia is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * Cydia is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Cydia. If not, see <http://www.gnu.org/licenses/>.
+**/
+/* }}} */
+
+#ifndef CyteKit_countByEnumeratingWithState_H
+#define CyteKit_countByEnumeratingWithState_H
+
+#include "iPhonePrivate.h"
+
+@interface DOMNodeList (Cyte)
+// XXX? - (NSUInteger) count;
+- (NSUInteger) countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)objects count:(NSUInteger)count;
+// XXX? - (id) objectAtIndex:(unsigned)index;
+@end
+
+@interface WebScriptObject (Cyte)
+- (NSUInteger) count;
+- (NSUInteger) countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)objects count:(NSUInteger)count;
+- (id) objectAtIndex:(unsigned)index;
+@end
+
+#endif//CyteKit_countByEnumeratingWithState_H
--- /dev/null
+/* Cydia - iPhone UIKit Front-End for Debian APT
+ * Copyright (C) 2008-2015 Jay Freeman (saurik)
+*/
+
+/* GNU General Public License, Version 3 {{{ */
+/*
+ * Cydia is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * Cydia is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Cydia. If not, see <http://www.gnu.org/licenses/>.
+**/
+/* }}} */
+
+#include "CyteKit/UCPlatform.h"
+
+#include "CyteKit/countByEnumeratingWithState.h"
+
+#include <objc/runtime.h>
+
+#include "iPhonePrivate.h"
+
+static NSUInteger DOMNodeList$countByEnumeratingWithState$objects$count$(DOMNodeList *self, SEL sel, NSFastEnumerationState *state, id *objects, NSUInteger count) {
+ size_t length([self length] - state->state);
+ if (length <= 0)
+ return 0;
+ else if (length > count)
+ length = count;
+ for (size_t i(0); i != length; ++i)
+ objects[i] = [self item:state->state++];
+ state->itemsPtr = objects;
+ state->mutationsPtr = (unsigned long *) self;
+ return length;
+}
+
+static struct DOMNodeList$countByEnumeratingWithState { DOMNodeList$countByEnumeratingWithState() {
+ class_addMethod(objc_getClass("DOMNodeList"), @selector(countByEnumeratingWithState:objects:count:), (IMP) &DOMNodeList$countByEnumeratingWithState$objects$count$, "I20@0:4^{NSFastEnumerationState}8^@12I16");
+} } DOMNodeList$countByEnumeratingWithState;
+
+@implementation WebScriptObject (Cyte)
+
+- (NSUInteger) count {
+ id length([self valueForKey:@"length"]);
+ if ([length respondsToSelector:@selector(intValue)])
+ return [length intValue];
+ else
+ return 0;
+}
+
+- (id) objectAtIndex:(unsigned)index {
+ return [self webScriptValueAtIndex:index];
+}
+
+- (NSUInteger) countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)objects count:(NSUInteger)count {
+ size_t length([self count] - state->state);
+ if (length <= 0)
+ return 0;
+ else if (length > count)
+ length = count;
+ for (size_t i(0); i != length; ++i)
+ objects[i] = [self objectAtIndex:state->state++];
+ state->itemsPtr = objects;
+ state->mutationsPtr = (unsigned long *) self;
+ return length;
+}
+
+@end
--- /dev/null
+/* Cydia - iPhone UIKit Front-End for Debian APT
+ * Copyright (C) 2008-2015 Jay Freeman (saurik)
+*/
+
+/* GNU General Public License, Version 3 {{{ */
+/*
+ * Cydia is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * Cydia is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Cydia. If not, see <http://www.gnu.org/licenses/>.
+**/
+/* }}} */
+
+#ifndef CyteKit_webScriptObjectInContext_H
+#define CyteKit_webScriptObjectInContext_H
+
+#include "iPhonePrivate.h"
+
+@interface NSObject (CydiaScript)
+- (id) Cydia$webScriptObjectInContext:(WebScriptObject *)context;
+@end
+
+#endif//CyteKit_webScriptObjectInContext_H
--- /dev/null
+/* Cydia - iPhone UIKit Front-End for Debian APT
+ * Copyright (C) 2008-2015 Jay Freeman (saurik)
+*/
+
+/* GNU General Public License, Version 3 {{{ */
+/*
+ * Cydia is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * Cydia is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Cydia. If not, see <http://www.gnu.org/licenses/>.
+**/
+/* }}} */
+
+#include "CyteKit/UCPlatform.h"
+
+#include "CyteKit/webScriptObjectInContext.h"
+
+#include "iPhonePrivate.h"
+
+@implementation NSObject (CydiaScript)
+
+- (id) Cydia$webScriptObjectInContext:(WebScriptObject *)context {
+ return self;
+}
+
+@end
+
+@implementation NSArray (CydiaScript)
+
+- (id) Cydia$webScriptObjectInContext:(WebScriptObject *)context {
+ WebScriptObject *object([context evaluateWebScript:@"[]"]);
+ for (size_t i(0), e([self count]); i != e; ++i)
+ [object setWebScriptValueAtIndex:i value:[[self objectAtIndex:i] Cydia$webScriptObjectInContext:context]];
+ return object;
+}
+
+@end
+
+@implementation NSDictionary (CydiaScript)
+
+- (id) Cydia$webScriptObjectInContext:(WebScriptObject *)context {
+ WebScriptObject *object([context evaluateWebScript:@"({})"]);
+ for (id i in self)
+ [object setValue:[[self objectForKey:i] Cydia$webScriptObjectInContext:context] forKey:i];
+ return object;
+}
+
+@end
#include "Substrate.hpp"
#include "Menes/Menes.h"
-#include "CyteKit/Application.h"
-#include "CyteKit/NavigationController.h"
-#include "CyteKit/RegEx.hpp"
-#include "CyteKit/TableViewCell.h"
-#include "CyteKit/TabBarController.h"
-#include "CyteKit/URLCache.h"
-#include "CyteKit/WebScriptObject-Cyte.h"
-#include "CyteKit/WebViewController.h"
-#include "CyteKit/WebViewTableViewCell.h"
-#include "CyteKit/stringWithUTF8Bytes.h"
+#include "CyteKit/CyteKit.h"
#include "Cydia/MIMEAddress.h"
#include "Cydia/LoadingViewController.h"
/* }}} */
-/* Apple Bug Fixes {{{ */
-@implementation UIWebDocumentView (Cydia)
-
-- (void) _setScrollerOffset:(CGPoint)offset {
- UIScroller *scroller([self _scroller]);
-
- CGSize size([scroller contentSize]);
- CGSize bounds([scroller bounds].size);
-
- CGPoint max;
- max.x = size.width - bounds.width;
- max.y = size.height - bounds.height;
-
- // wtf Apple?!
- if (max.x < 0)
- max.x = 0;
- if (max.y < 0)
- max.y = 0;
-
- offset.x = offset.x < 0 ? 0 : offset.x > max.x ? max.x : offset.x;
- offset.y = offset.y < 0 ? 0 : offset.y > max.y ? max.y : offset.y;
-
- [scroller setOffset:offset];
-}
-
-@end
-/* }}} */
-
-NSUInteger DOMNodeList$countByEnumeratingWithState$objects$count$(DOMNodeList *self, SEL sel, NSFastEnumerationState *state, id *objects, NSUInteger count) {
- size_t length([self length] - state->state);
- if (length <= 0)
- return 0;
- else if (length > count)
- length = count;
- for (size_t i(0); i != length; ++i)
- objects[i] = [self item:state->state++];
- state->itemsPtr = objects;
- state->mutationsPtr = (unsigned long *) self;
- return length;
-}
-
/* Cydia NSString Additions {{{ */
@interface NSString (Cydia)
- (NSComparisonResult) compareByPath:(NSString *)other;
@end
/* }}} */
-// CydiaScript {{{
-@interface NSObject (CydiaScript)
-- (id) Cydia$webScriptObjectInContext:(WebScriptObject *)context;
-@end
-
-@implementation NSObject (CydiaScript)
-
-- (id) Cydia$webScriptObjectInContext:(WebScriptObject *)context {
- return self;
-}
-
-@end
-
-@implementation NSArray (CydiaScript)
-
-- (id) Cydia$webScriptObjectInContext:(WebScriptObject *)context {
- WebScriptObject *object([context evaluateWebScript:@"[]"]);
- for (size_t i(0), e([self count]); i != e; ++i)
- [object setWebScriptValueAtIndex:i value:[[self objectAtIndex:i] Cydia$webScriptObjectInContext:context]];
- return object;
-}
-
-@end
-
-@implementation NSDictionary (CydiaScript)
-
-- (id) Cydia$webScriptObjectInContext:(WebScriptObject *)context {
- WebScriptObject *object([context evaluateWebScript:@"({})"]);
- for (id i in self)
- [object setValue:[[self objectForKey:i] Cydia$webScriptObjectInContext:context] forKey:i];
- return object;
-}
-
-@end
-// }}}
-
/* Confirmation Controller {{{ */
bool DepSubstrate(const pkgCache::VerIterator &iterator) {
if (!iterator.end())
[BridgedHosts_ addObject:[[NSURL URLWithString:CydiaURL(@"")] host]];
}
- [NSURLCache setSharedURLCache:[[[CyteURLCache alloc]
- initWithMemoryCapacity:524288
- diskCapacity:10485760
- diskPath:Cache("SDURLCache")
- ] autorelease]];
-
[CydiaWebViewController _initialize];
[NSURLProtocol registerClass:[CydiaURLProtocol class]];
return object;
}*/
-Class $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;
-}
-
-Class $NSUserDefaults;
-
-MSHook(id, NSUserDefaults$objectForKey$, NSUserDefaults *self, SEL _cmd, NSString *key) {
- if ([key respondsToSelector:@selector(isEqualToString:)] && [key isEqualToString:@"WebKitLocalStorageDatabasePathPreferenceKey"])
- return Cache("LocalStorage");
- return _NSUserDefaults$objectForKey$(self, _cmd, key);
-}
-
static NSMutableDictionary *AutoreleaseDeepMutableCopyOfDictionary(CFTypeRef type) {
if (type == NULL)
return nil;
PackageName = reinterpret_cast<CYString &(*)(Package *, SEL)>(method_getImplementation(class_getInstanceMethod([Package class], @selector(cyname))));
- /* Library Hacks {{{ */
- class_addMethod(objc_getClass("DOMNodeList"), @selector(countByEnumeratingWithState:objects:count:), (IMP) &DOMNodeList$countByEnumeratingWithState$objects$count$, "I20@0:4^{NSFastEnumerationState}8^@12I16");
-
- $WAKWindow = objc_getClass("WAKWindow");
- if ($WAKWindow != NULL)
- if (Method method = class_getInstanceMethod($WAKWindow, @selector(screenSize)))
- method_setImplementation(method, (IMP) &$WAKWindow$screenSize);
-
- $NSUserDefaults = objc_getClass("NSUserDefaults");
- Method NSUserDefaults$objectForKey$(class_getInstanceMethod($NSUserDefaults, @selector(objectForKey:)));
- if (NSUserDefaults$objectForKey$ != NULL) {
- _NSUserDefaults$objectForKey$ = reinterpret_cast<id (*)(NSUserDefaults *, SEL, NSString *)>(method_getImplementation(NSUserDefaults$objectForKey$));
- method_setImplementation(NSUserDefaults$objectForKey$, reinterpret_cast<IMP>(&$NSUserDefaults$objectForKey$));
- }
- /* }}} */
/* Set Locale {{{ */
Locale_ = CFLocaleCopyCurrent();
Languages_ = [NSLocale preferredLanguages];