--- /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_Application_H
+#define CyteKit_Application_H
+
+#include <UIKit/UIKit.h>
+
+@interface CyteApplication : UIApplication
+
+- (void) applicationDidFinishLaunching:(id)unused;
+
+@end
+
+#endif//CyteKit_Application_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 <Foundation/Foundation.h>
+#include <UIKit/UIKit.h>
+
+#include "iPhonePrivate.h"
+#include <Menes/ObjectHandle.h>
+
+@implementation CyteApplication : UIApplication {
+}
+
+- (void) _sendMemoryWarningNotification {
+ if (kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber_iPhoneOS_3_0) // XXX: maybe 4_0?
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"UIApplicationMemoryWarningNotification" object:[UIApplication sharedApplication]];
+ else
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"UIApplicationDidReceiveMemoryWarningNotification" object:[UIApplication sharedApplication]];
+}
+
+- (void) _sendMemoryWarningNotifications {
+ while (true) {
+ [self performSelectorOnMainThread:@selector(_sendMemoryWarningNotification) withObject:nil waitUntilDone:NO];
+ sleep(2);
+ //usleep(2000000);
+ }
+}
+
+- (void) applicationDidReceiveMemoryWarning:(UIApplication *)application {
+ NSLog(@"--");
+ [[NSURLCache sharedURLCache] removeAllCachedResponses];
+}
+
+- (void) applicationDidFinishLaunching:(id)unused {
+ //[NSThread detachNewThreadSelector:@selector(_sendMemoryWarningNotifications) toTarget:self withObject:nil];
+
+ if ([self respondsToSelector:@selector(setApplicationSupportsShakeToEdit:)])
+ [self setApplicationSupportsShakeToEdit:NO];
+}
+
+@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_NavigationController_H
+#define CyteKit_NavigationController_H
+
+#include <UIKit/UIKit.h>
+
+@interface UINavigationController (Cydia)
+
+- (NSArray *) navigationURLCollection;
+- (void) unloadData;
+
+@end
+
+#endif//CyteKit_NavigationController_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 <Foundation/Foundation.h>
+#include <UIKit/UIKit.h>
+
+#include "CyteKit/NavigationController.h"
+#include "CyteKit/ViewController.h"
+
+#include "iPhonePrivate.h"
+#include <Menes/ObjectHandle.h>
+
+@implementation UINavigationController (Cydia)
+
+- (NSArray *) navigationURLCollection {
+ NSMutableArray *stack([NSMutableArray array]);
+
+ for (CyteViewController *controller in [self viewControllers]) {
+ NSString *url = [[controller navigationURL] absoluteString];
+ if (url != nil)
+ [stack addObject:url];
+ }
+
+ return stack;
+}
+
+- (void) reloadData {
+ [super reloadData];
+
+ UIViewController *visible([self visibleViewController]);
+ if (visible != nil)
+ [visible reloadData];
+
+ // on the iPad, this view controller is ALSO visible. :(
+ extern bool IsWildcat_;
+ if (IsWildcat_)
+ if (UIViewController *modal = [self modalViewController])
+ if ([modal modalPresentationStyle] == UIModalPresentationFormSheet)
+ if (UIViewController *top = [self topViewController])
+ if (top != visible)
+ [top reloadData];
+}
+
+- (void) unloadData {
+ for (CyteViewController *page in [self viewControllers])
+ [page unloadData];
+
+ [super unloadData];
+}
+
+@end
@interface CyteTabBarController : UITabBarController
+- (NSArray *) navigationURLCollection;
- (UIViewController *) unselectedViewController;
- (void) setUnselectedViewController:(UIViewController *)transient;
_H<UIViewController> remembered_;
}
+- (NSArray *) navigationURLCollection {
+ NSMutableArray *items([NSMutableArray array]);
+
+ // XXX: Should this deal with transient view controllers?
+ for (id navigation in [self viewControllers]) {
+ NSArray *stack = [navigation performSelector:@selector(navigationURLCollection)];
+ if (stack != nil)
+ [items addObject:stack];
+ }
+
+ return items;
+}
+
- (void) didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
#include <UIKit/UIKit.h>
@interface UIViewController (Cydia)
-- (BOOL) hasLoaded;
-- (void) reloadData;
-- (void) unloadData;
-- (UIViewController *) parentOrPresentingViewController;
-@end
-@interface CyteViewController : UIViewController
+// Override this in subclasses if you manage the "has seen first load" state yourself.
+- (BOOL) hasLoaded;
// The default implementation of this method is essentially a no-op,
// but calling the superclass implementation is *required*.
- (void) unloadData;
+- (UIViewController *) parentOrPresentingViewController;
+
// This URL is used to save the state of the view controller. Return
// nil if you cannot or should not save the URL for this page.
- (NSURL *) navigationURL;
+@end
+
+@interface CyteViewController : UIViewController
+
// By default, this delegate is unused. However, it's provided here in case
// you need some kind of delegate in a subclass.
- (void) setDelegate:(id)delegate;
- (id) delegate;
-// Override this in subclasses if you manage the "has seen first load" state yourself.
-- (BOOL) hasLoaded;
-
// This is called when the view managed by the view controller is released.
// That is not always when the controller itself is released: it also can
// happen when more memory is needed by the system or whenever the controller
return nil;
}
+- (NSURL *) navigationURL {
+ return nil;
+}
+
@end
@implementation CyteViewController {
[super unloadData];
}
-- (NSURL *) navigationURL {
- return nil;
-}
-
- (void) setPageColor:(UIColor *)color {
if (color == nil)
color = [UIColor groupTableViewBackgroundColor];
#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"
@end
/* }}} */
-/* Cydia Navigation Controller Interface {{{ */
-@interface UINavigationController (Cydia)
-
-- (NSArray *) navigationURLCollection;
-- (void) unloadData;
-
-@end
-/* }}} */
-
/* Cydia Tab Bar Controller {{{ */
@interface CydiaTabBarController : CyteTabBarController <
UITabBarControllerDelegate,
_transient NSObject<CydiaDelegate> *updatedelegate_;
}
-- (NSArray *) navigationURLCollection;
- (void) beginUpdate;
- (BOOL) updating;
@implementation CydiaTabBarController
-- (NSArray *) navigationURLCollection {
- NSMutableArray *items([NSMutableArray array]);
-
- // XXX: Should this deal with transient view controllers?
- for (id navigation in [self viewControllers]) {
- NSArray *stack = [navigation performSelector:@selector(navigationURLCollection)];
- if (stack != nil)
- [items addObject:stack];
- }
-
- return items;
-}
-
- (id) initWithDatabase:(Database *)database {
if ((self = [super init]) != nil) {
database_ = database;
@end
/* }}} */
-/* Cydia Navigation Controller Implementation {{{ */
-@implementation UINavigationController (Cydia)
-
-- (NSArray *) navigationURLCollection {
- NSMutableArray *stack([NSMutableArray array]);
-
- for (CyteViewController *controller in [self viewControllers]) {
- NSString *url = [[controller navigationURL] absoluteString];
- if (url != nil)
- [stack addObject:url];
- }
-
- return stack;
-}
-
-- (void) reloadData {
- [super reloadData];
-
- UIViewController *visible([self visibleViewController]);
- if (visible != nil)
- [visible reloadData];
-
- // on the iPad, this view controller is ALSO visible. :(
- if (IsWildcat_)
- if (UIViewController *modal = [self modalViewController])
- if ([modal modalPresentationStyle] == UIModalPresentationFormSheet)
- if (UIViewController *top = [self topViewController])
- if (top != visible)
- [top reloadData];
-}
-
-- (void) unloadData {
- for (CyteViewController *page in [self viewControllers])
- [page unloadData];
-
- [super unloadData];
-}
-
-@end
-/* }}} */
-
/* Cydia:// Protocol {{{ */
@interface CydiaURLProtocol : NSURLProtocol {
}
@end
-@interface Cydia : UIApplication <
+@interface Cydia : CyteApplication <
ConfirmationControllerDelegate,
DatabaseDelegate,
CydiaDelegate
[tabbar_ setUpdateDelegate:self];
}
-- (void) _sendMemoryWarningNotification {
- if (kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber_iPhoneOS_3_0) // XXX: maybe 4_0?
- [[NSNotificationCenter defaultCenter] postNotificationName:@"UIApplicationMemoryWarningNotification" object:[UIApplication sharedApplication]];
- else
- [[NSNotificationCenter defaultCenter] postNotificationName:@"UIApplicationDidReceiveMemoryWarningNotification" object:[UIApplication sharedApplication]];
-}
-
-- (void) _sendMemoryWarningNotifications {
- while (true) {
- [self performSelectorOnMainThread:@selector(_sendMemoryWarningNotification) withObject:nil waitUntilDone:NO];
- sleep(2);
- //usleep(2000000);
- }
-}
-
-- (void) applicationDidReceiveMemoryWarning:(UIApplication *)application {
- NSLog(@"--");
- [[NSURLCache sharedURLCache] removeAllCachedResponses];
-}
-
- (void) applicationDidFinishLaunching:(id)unused {
- //[NSThread detachNewThreadSelector:@selector(_sendMemoryWarningNotifications) toTarget:self withObject:nil];
-
+ [super applicationDidFinishLaunching:unused];
_trace();
- if ([self respondsToSelector:@selector(setApplicationSupportsShakeToEdit:)])
- [self setApplicationSupportsShakeToEdit:NO];
@synchronized (HostConfig_) {
[BridgedHosts_ addObject:[[NSURL URLWithString:CydiaURL(@"")] host]];