--- /dev/null
+sysroot
+Cydia
+_
+*.deb
#define USE_SYSTEM_MALLOC 1
/* #include Directives {{{ */
-#import "UICaboodle/UCPlatform.h"
-#import "UICaboodle/UCLocalize.h"
+#include "UICaboodle/UCPlatform.h"
+#include "UICaboodle/UCLocalize.h"
#include <objc/objc.h>
#include <objc/runtime.h>
#include <CoreGraphics/CoreGraphics.h>
-#include <GraphicsServices/GraphicsServices.h>
#include <Foundation/Foundation.h>
#if 0
#include <CoreFoundation/CFPriv.h>
#include <CoreFoundation/CFUniChar.h>
-#import <UIKit/UIKit.h>
+#include <UIKit/UIKit.h>
+#include "iPhonePrivate.h"
+
+#include <IOKit/IOKitLib.h>
#include <WebCore/WebCoreThread.h>
-#import <WebKit/WebDefaultUIKitDelegate.h>
#include <algorithm>
#include <iomanip>
#include <sys/param.h>
#include <sys/mount.h>
+#include <fcntl.h>
#include <notify.h>
#include <dlfcn.h>
#include <ext/hash_map>
-#include <notify.h>
-
-#import "UICaboodle/BrowserView.h"
-#import "UICaboodle/ResetView.h"
+#include "UICaboodle/BrowserView.h"
+#include "UICaboodle/ResetView.h"
-#import "substrate.h"
+#include "substrate.h"
// Apple's sample Reachability code, ASPL licensed.
-#import "Reachability.h"
-/* }}} */
-
-/* Header Fixes and Updates {{{ */
-typedef enum {
- UIModalPresentationFullScreen = 0,
- UIModalPresentationPageSheet,
- UIModalPresentationFormSheet,
- UIModalPresentationCurrentContext,
-} UIModalPresentationStyle;
-
-@interface UIAlertView (Private)
-- (void)setNumberOfRows:(int)rows;
-- (void)setContext:(id)context;
-- (id)context;
-@end
-
-@interface UIViewController (UIKit)
-- (id)navigationItem;
-- (id)navigationController;
-- (id)tabBarItem;
-@end
-
-@interface UITabBarController : UIViewController {
- id _tabBar;
- id _containerView;
- id _viewControllerTransitionView;
- id _viewControllers;
- id _tabBarItemsToViewControllers;
- id _selectedViewController;
- id _moreNavigationController;
- id _customizableViewControllers;
- id _delegate;
- id _selectedViewControllerDuringWillAppear;
- id _transientViewController;
- unsigned int isShowingMoreItem:1;
- unsigned int needsToRebuildItems:1;
- unsigned int isBarHidden:1;
- unsigned int editButtonOnLeft:1;
-}
-@end
+#include "Reachability.h"
/* }}} */
/* Profiler {{{ */
return length;
}
-@interface NSString (UIKit)
-- (NSString *) stringByAddingPercentEscapes;
-@end
-
/* Cydia NSString Additions {{{ */
@interface NSString (Cydia)
+ (NSString *) stringWithUTF8BytesNoCopy:(const char *)bytes length:(int)length;
- (void) installPackage:(Package *)package;
- (void) installPackages:(NSArray *)packages;
- (void) removePackage:(Package *)package;
+- (void) beginUpdate;
+- (BOOL) updating;
- (void) distUpgrade;
- (void) updateData;
- (void) syncData;
- (void) showSettings;
- (UIProgressHUD *) addProgressHUD;
- (void) removeProgressHUD:(UIProgressHUD *)hud;
-- (UIViewController *) pageForPackage:(NSString *)name;
+- (UCViewController *) pageForPackage:(NSString *)name;
- (PackageController *) packageController;
@end
/* }}} */
@end
/* }}} */
/* Delegate Helpers {{{ */
-@implementation NSObject(ProgressDelegate)
+@implementation NSObject (ProgressDelegate)
- (void) _setProgressErrorPackage:(NSArray *)args {
[self performSelector:@selector(setProgressError:forPackage:)
- (void) setProgressError:(NSString *)error forPackage:(NSString *)id {
Package *package = id == nil ? nil : [[Database sharedInstance] packageWithName:id];
// XXX: holy typecast batman!
- [self setProgressError:error withTitle:(package == nil ? id : [package name])];
+ [(id<ProgressDelegate>)self setProgressError:error withTitle:(package == nil ? id : [package name])];
}
@end
[database_ setDelegate:self];
delegate_ = delegate;
- [[self view] setBackgroundColor:(CGColor *)[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]];
+ [[self view] setBackgroundColor:[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]];
progress_ = [[UIProgressBar alloc] init];
[progress_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin)];
- (void) viewWillAppear:(BOOL)animated {
[super viewDidAppear:animated];
[[self navigationItem] setHidesBackButton:YES];
- [[[self navigationController] navigationBar] setBarStyle:1];
+ [[[self navigationController] navigationBar] setBarStyle:UIBarStyleBlack];
[self positionViews];
}
/* }}} */
/* Cell Content View {{{ */
+@protocol ContentDelegate
+- (void) drawContentRect:(CGRect)rect;
+@end
+
@interface ContentView : UIView {
- _transient id delegate_;
+ _transient id<ContentDelegate> delegate_;
}
@end
} return self;
}
-- (void) setDelegate:(id)delegate {
+- (void) setDelegate:(id<ContentDelegate>)delegate {
delegate_ = delegate;
}
@end
/* }}} */
/* Package Cell {{{ */
-@interface PackageCell : UITableViewCell {
+@interface PackageCell : UITableViewCell <
+ ContentDelegate
+> {
UIImage *icon_;
NSString *name_;
NSString *description_;
@end
/* }}} */
/* Section Cell {{{ */
-@interface SectionCell : UITableViewCell {
+@interface SectionCell : UITableViewCell <
+ ContentDelegate
+> {
NSString *basic_;
NSString *section_;
NSString *name_;
BOOL editing_;
}
-- (id) init;
- (void) setSection:(Section *)section editing:(BOOL)editing;
@end
[switch_ setOn:(isSectionVisible(basic_) ? 1 : 0) animated:NO];
}
- [self setAccessoryType:editing ? 0 : 1 /*UITableViewCellAccessoryDisclosureIndicator*/];
+ [self setAccessoryType:editing ? UITableViewCellAccessoryNone : UITableViewCellAccessoryDisclosureIndicator];
[content_ setNeedsDisplay];
}
/* }}} */
/* File Table {{{ */
-@interface FileTable : CYViewController {
+@interface FileTable : CYViewController <
+ UITableViewDataSource,
+ UITableViewDelegate
+> {
_transient Database *database_;
Package *package_;
NSString *name_;
[cell setFont:[UIFont systemFontOfSize:16]];
}
[cell setText:[files_ objectAtIndex:indexPath.row]];
- [cell setSelectionStyle:0 /*UITableViewCellSelectionStyleNone*/];
+ [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
return cell;
}
}
[sheet dismissWithClickedButtonIndex:-1 animated:YES];
- } else {
- [super alertSheet:sheet clickedButtonAtIndex:button];
}
}
@end
/* }}} */
/* Package Table {{{ */
-@interface PackageTable : UIView {
+@interface PackageTable : UIView <
+ UITableViewDataSource,
+ UITableViewDelegate
+> {
_transient Database *database_;
NSMutableArray *packages_;
NSMutableArray *sections_;
}
- (UITableViewCell *) tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)path {
- PackageCell *cell([table dequeueReusableCellWithIdentifier:@"Package"]);
+ PackageCell *cell((PackageCell *) [table dequeueReusableCellWithIdentifier:@"Package"]);
if (cell == nil)
cell = [[[PackageCell alloc] init] autorelease];
[cell setPackage:[self packageAtIndexPath:path]];
@end
/* }}} */
/* Source Cell {{{ */
-@interface SourceCell : UITableViewCell {
+@interface SourceCell : UITableViewCell <
+ ContentDelegate
+> {
UIImage *icon_;
NSString *origin_;
NSString *description_;
@end
/* }}} */
/* Source Table {{{ */
-@interface SourceTable : CYViewController {
+@interface SourceTable : CYViewController <
+ UITableViewDataSource,
+ UITableViewDelegate
+> {
_transient Database *database_;
UITableView *list_;
NSMutableArray *sources_;
- (id) initWithDatabase:(Database *)database;
+- (void) updateButtonsForEditingStatus:(BOOL)editing animated:(BOOL)animated;
+
@end
@implementation SourceTable
return cell;
}
-- (int) tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath {
- return 1; //UITableViewCellAccessoryDisclosureIndicator?
+- (UITableViewCellAccessoryType) tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath {
+ return UITableViewCellAccessoryDisclosureIndicator;
}
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- (id) initWithDatabase:(Database *)database;
+- (void) updateRoleButton;
+- (void) queueStatusDidChange;
+
@end
@implementation InstalledController
@interface ManageController : CYBrowserController {
}
+- (void) queueStatusDidChange;
@end
@implementation ManageController
[self setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
[self setTintColor:[UIColor colorWithRed:0.23 green:0.23 blue:0.23 alpha:1]];
- [self setBarStyle:1];
+ [self setBarStyle:UIBarStyleBlack];
- int barstyle([self _barStyle:NO]);
- bool ugly(barstyle == 0);
+ UIBarStyle barstyle([self _barStyle:NO]);
+ bool ugly(barstyle == UIBarStyleDefault);
UIProgressIndicatorStyle style = ugly ?
UIProgressIndicatorStyleMediumBrown :
@end
/* }}} */
+@class CYNavigationController;
+
/* Cydia Tab Bar Controller {{{ */
@interface CYTabBarController : UITabBarController {
Database *database_;
- (void) reloadData {
size_t count([[self viewControllers] count]);
for (size_t i(0); i != count; ++i) {
- UIViewController *page([[self viewControllers] objectAtIndex:(count - i - 1)]);
+ CYNavigationController *page([[self viewControllers] objectAtIndex:(count - i - 1)]);
[page reloadData];
}
}
/* }}} */
/* Cydia Navigation Controller {{{ */
-@interface CYNavigationController : UINavigationController <
- ProgressDelegate
-> {
+@interface CYNavigationController : UINavigationController {
_transient Database *database_;
id delegate_;
}
- (void) reloadData {
size_t count([[self viewControllers] count]);
for (size_t i(0); i != count; ++i) {
- UIViewController *page([[self viewControllers] objectAtIndex:(count - i - 1)]);
+ CYViewController *page([[self viewControllers] objectAtIndex:(count - i - 1)]);
[page reloadData];
}
}
/* }}} */
/* Sections Controller {{{ */
-@interface SectionsController : CYViewController {
+@interface SectionsController : CYViewController <
+ UITableViewDataSource,
+ UITableViewDelegate
+> {
_transient Database *database_;
NSMutableArray *sections_;
NSMutableArray *filtered_;
- (void) reloadData;
- (void) resetView;
+- (void) editButtonClicked;
+
@end
@implementation SectionsController
@end
/* }}} */
/* Changes Controller {{{ */
-@interface ChangesController : CYViewController {
+@interface ChangesController : CYViewController <
+ UITableViewDataSource,
+ UITableViewDelegate
+> {
_transient Database *database_;
NSMutableArray *packages_;
NSMutableArray *sections_;
}
- (UITableViewCell *) tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)path {
- PackageCell *cell([table dequeueReusableCellWithIdentifier:@"Package"]);
+ PackageCell *cell((PackageCell *) [table dequeueReusableCellWithIdentifier:@"Package"]);
if (cell == nil)
cell = [[[PackageCell alloc] init] autorelease];
[cell setPackage:[self packageAtIndexPath:path]];
}
- (void) refreshButtonClicked {
- [[UIApplication sharedApplication] beginUpdate];
+ [delegate_ beginUpdate];
[[self navigationItem] setLeftBarButtonItem:nil];
}
target:self
action:@selector(refreshButtonClicked)
];
- if (![[UIApplication sharedApplication] updating]) [[self navigationItem] setLeftBarButtonItem:leftItem];
+ if (![delegate_ updating]) [[self navigationItem] setLeftBarButtonItem:leftItem];
[leftItem release];
}
@end
/* }}} */
/* Search Controller {{{ */
-@interface SearchController : FilteredPackageController {
- id search_;
+@interface SearchController : FilteredPackageController <
+ UISearchBarDelegate
+> {
+ UISearchBar *search_;
}
- (id) initWithDatabase:(Database *)database;
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
if (!search_) {
- search_ = [[objc_getClass("UISearchBar") alloc] initWithFrame:CGRectMake(0, 0, [[self view] bounds].size.width, 44.0f)];
+ search_ = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, [[self view] bounds].size.width, 44.0f)];
[search_ layoutSubviews];
[search_ setPlaceholder:UCLocalize("SEARCH_EX")];
UITextField *textField = [search_ searchField];
@end
/* }}} */
/* Settings Controller {{{ */
-@interface SettingsController : CYViewController {
+@interface SettingsController : CYViewController <
+ UITableViewDataSource,
+ UITableViewDelegate
+> {
_transient Database *database_;
NSString *name_;
Package *package_;
@end
/* }}} */
/* Role Controller {{{ */
-@interface RoleController : CYViewController {
+@interface RoleController : CYViewController <
+ UITableViewDataSource,
+ UITableViewDelegate
+> {
_transient Database *database_;
id roledelegate_;
UITableView *table_;
UISegmentedControl *segment_;
UIView *container_;
}
+
+- (void) showDoneButton;
+- (void) resizeSegmentedControl;
+
@end
@implementation RoleController
bool dropped_;
bool updating_;
id updatedelegate_;
- UIViewController *root_;
+ UITabBarController *root_;
}
+- (void) setTabBarController:(UITabBarController *)controller;
+
+- (void) dropBar:(BOOL)animated;
+- (void) beginUpdate;
+- (void) raiseBar:(BOOL)animated;
+
@end
@implementation CYContainer
return YES; /* XXX: return YES; */
}
-- (void) setRootController:(UIViewController *)controller {
+- (void) setTabBarController:(UITabBarController *)controller {
root_ = controller;
[[self view] addSubview:[root_ view]];
}
bool loaded_;
}
-- (UIViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class;
-- (void) setPage:(UIViewController *)page;
+- (UCViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class;
+- (void) setPage:(UCViewController *)page;
@end
if (tag_ != 4 && search_ != nil)
[search_ reloadData];
- [[tabbar_ selectedViewController] reloadData];
+ [(CYNavigationController *)[tabbar_ selectedViewController] reloadData];
}
- (int)indexOfTabWithTag:(int)tag {
[self complete];
}
-- (void) setPage:(UIViewController *)page {
+- (void) setPage:(UCViewController *)page {
[page setDelegate:self];
- UINavigationController *navController = [tabbar_ selectedViewController];
+ CYNavigationController *navController = (CYNavigationController *) [tabbar_ selectedViewController];
[navController setViewControllers:[NSArray arrayWithObject:page] animated:NO];
- for (UIViewController *page in [tabbar_ viewControllers]) {
+ for (CYNavigationController *page in [tabbar_ viewControllers]) {
if (page != navController) [page setViewControllers:nil];
}
}
-- (UIViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class {
+- (UCViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class {
CYBrowserController *browser = [[[_class alloc] init] autorelease];
[browser loadURL:url];
return browser;
- (void) tabBarController:(id)tabBarController didSelectViewController:(UIViewController *)viewController {
int tag = [[viewController tabBarItem] tag];
if (tag == tag_) {
- [[tabbar_ selectedViewController] popToRootViewControllerAnimated:YES];
+ [(CYNavigationController *)[tabbar_ selectedViewController] popToRootViewControllerAnimated:YES];
return;
} else if (tag_ == 1) {
[[self sectionsController] resetView];
Queuing_ = true;
[[[[tabbar_ viewControllers] objectAtIndex:[self indexOfTabWithTag:kManageTag] != -1 ? [self indexOfTabWithTag:kManageTag] : [self indexOfTabWithTag:kInstalledTag]] tabBarItem] setBadgeValue:UCLocalize("Q_D")];
- [[tabbar_ selectedViewController] reloadData];
+ [(CYNavigationController *)[tabbar_ selectedViewController] reloadData];
[queueDelegate_ queueStatusDidChange];
}
[window_ setUserInteractionEnabled:YES];
}
-- (UIViewController *) pageForPackage:(NSString *)name {
+- (UCViewController *) pageForPackage:(NSString *)name {
if (Package *package = [database_ packageWithName:name]) {
PackageController *view([self packageController]);
[view setPackage:package];
}
}
-- (UIViewController *) pageForURL:(NSURL *)url hasTag:(int *)tag {
+- (UCViewController *) pageForURL:(NSURL *)url hasTag:(int *)tag {
if (tag != NULL)
*tag = -1;
- (void) applicationOpenURL:(NSURL *)url {
[super applicationOpenURL:url];
int tag;
- if (UIViewController *page = [self pageForURL:url hasTag:&tag]) {
+ if (UCViewController *page = [self pageForURL:url hasTag:&tag]) {
[self setPage:page];
tag_ = tag;
[tabbar_ setSelectedViewController:(tag_ == -1 ? nil : [[tabbar_ viewControllers] objectAtIndex:tag_])];
[items insertObject:[[[UITabBarItem alloc] initWithTitle:UCLocalize("MANAGE") image:[UIImage applicationImageNamed:@"manage.png"] tag:kManageTag] autorelease] atIndex:3];
}
- for (int i = 0; i < [items count]; i++) {
+ for (size_t i(0); i != [items count]; i++)
[[controllers objectAtIndex:i] setTabBarItem:[items objectAtIndex:i]];
- }
tabbar_ = [[CYTabBarController alloc] initWithDatabase:database_];
[tabbar_ setViewControllers:controllers];
container_ = [[CYContainer alloc] initWithDatabase:database_];
[container_ setUpdateDelegate:self];
- [container_ setRootController:tabbar_];
+ [container_ setTabBarController:tabbar_];
[window_ addSubview:[container_ view]];
[[tabbar_ view] setFrame:CGRectMake(0, -20.0f, [window_ bounds].size.width, [window_ bounds].size.height)];
+++ /dev/null
-/*
-
- File: Reachability.m
- Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
-
- Version: 2.2
-
- Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
- ("Apple") in consideration of your agreement to the following terms, and your
- use, installation, modification or redistribution of this Apple software
- constitutes acceptance of these terms. If you do not agree with these terms,
- please do not use, install, modify or redistribute this Apple software.
-
- In consideration of your agreement to abide by the following terms, and subject
- to these terms, Apple grants you a personal, non-exclusive license, under
- Apple's copyrights in this original Apple software (the "Apple Software"), to
- use, reproduce, modify and redistribute the Apple Software, with or without
- modifications, in source and/or binary forms; provided that if you redistribute
- the Apple Software in its entirety and without modifications, you must retain
- this notice and the following text and disclaimers in all such redistributions
- of the Apple Software.
- Neither the name, trademarks, service marks or logos of Apple Inc. may be used
- to endorse or promote products derived from the Apple Software without specific
- prior written permission from Apple. Except as expressly stated in this notice,
- no other rights or licenses, express or implied, are granted by Apple herein,
- including but not limited to any patent rights that may be infringed by your
- derivative works or by other works in which the Apple Software may be
- incorporated.
-
- The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
- WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
- WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
- COMBINATION WITH YOUR PRODUCTS.
-
- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
- DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
- CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
- APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- Copyright (C) 2010 Apple Inc. All Rights Reserved.
-
-*/
-
-#import <sys/socket.h>
-#import <netinet/in.h>
-#import <netinet6/in6.h>
-#import <arpa/inet.h>
-#import <ifaddrs.h>
-#import <netdb.h>
-
-#import <CoreFoundation/CoreFoundation.h>
-
-#import "Reachability.h"
-
-#define kShouldPrintReachabilityFlags 1
-
-static void PrintReachabilityFlags(SCNetworkReachabilityFlags flags, const char* comment)
-{
-#if kShouldPrintReachabilityFlags
-
- NSLog(@"Reachability Flag Status: %c%c %c%c%c%c%c%c%c %s\n",
- (flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-',
- (flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-',
-
- (flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-',
- (flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-',
- (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-',
- (flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
- (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-',
- (flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-',
- (flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-',
- comment
- );
-#endif
-}
-
-
-@implementation Reachability
-static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
-{
- #pragma unused (target, flags)
- NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback");
- NSCAssert([(NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCallback");
-
- //We're on the main RunLoop, so an NSAutoreleasePool is not necessary, but is added defensively
- // in case someon uses the Reachablity object in a different thread.
- NSAutoreleasePool* myPool = [[NSAutoreleasePool alloc] init];
-
- Reachability* noteObject = (Reachability*) info;
- // Post a notification to notify the client that the network reachability changed.
- [[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotification object: noteObject];
-
- [myPool release];
-}
-
-- (BOOL) startNotifier
-{
- BOOL retVal = NO;
- SCNetworkReachabilityContext context = {0, self, NULL, NULL, NULL};
- if(SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context))
- {
- if(SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode))
- {
- retVal = YES;
- }
- }
- return retVal;
-}
-
-- (void) stopNotifier
-{
- if(reachabilityRef!= NULL)
- {
- SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
- }
-}
-
-- (void) dealloc
-{
- [self stopNotifier];
- if(reachabilityRef!= NULL)
- {
- CFRelease(reachabilityRef);
- }
- [super dealloc];
-}
-
-+ (Reachability*) reachabilityWithHostName: (NSString*) hostName;
-{
- Reachability* retVal = NULL;
- SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]);
- if(reachability!= NULL)
- {
- retVal= [[[self alloc] init] autorelease];
- if(retVal!= NULL)
- {
- retVal->reachabilityRef = reachability;
- retVal->localWiFiRef = NO;
- }
- }
- return retVal;
-}
-
-+ (Reachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
-{
- SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress);
- Reachability* retVal = NULL;
- if(reachability!= NULL)
- {
- retVal= [[[self alloc] init] autorelease];
- if(retVal!= NULL)
- {
- retVal->reachabilityRef = reachability;
- retVal->localWiFiRef = NO;
- }
- }
- return retVal;
-}
-
-+ (Reachability*) reachabilityForInternetConnection;
-{
- struct sockaddr_in zeroAddress;
- bzero(&zeroAddress, sizeof(zeroAddress));
- zeroAddress.sin_len = sizeof(zeroAddress);
- zeroAddress.sin_family = AF_INET;
- return [self reachabilityWithAddress: &zeroAddress];
-}
-
-+ (Reachability*) reachabilityForLocalWiFi;
-{
- struct sockaddr_in localWifiAddress;
- bzero(&localWifiAddress, sizeof(localWifiAddress));
- localWifiAddress.sin_len = sizeof(localWifiAddress);
- localWifiAddress.sin_family = AF_INET;
- // IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
- localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
- Reachability* retVal = [self reachabilityWithAddress: &localWifiAddress];
- if(retVal!= NULL)
- {
- retVal->localWiFiRef = YES;
- }
- return retVal;
-}
-
-#pragma mark Network Flag Handling
-
-- (NetworkStatus) localWiFiStatusForFlags: (SCNetworkReachabilityFlags) flags
-{
- PrintReachabilityFlags(flags, "localWiFiStatusForFlags");
-
- BOOL retVal = NotReachable;
- if((flags & kSCNetworkReachabilityFlagsReachable) && (flags & kSCNetworkReachabilityFlagsIsDirect))
- {
- retVal = ReachableViaWiFi;
- }
- return retVal;
-}
-
-- (NetworkStatus) networkStatusForFlags: (SCNetworkReachabilityFlags) flags
-{
- PrintReachabilityFlags(flags, "networkStatusForFlags");
- if ((flags & kSCNetworkReachabilityFlagsReachable) == 0)
- {
- // if target host is not reachable
- return NotReachable;
- }
-
- BOOL retVal = NotReachable;
-
- if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0)
- {
- // if target host is reachable and no connection is required
- // then we'll assume (for now) that your on Wi-Fi
- retVal = ReachableViaWiFi;
- }
-
-
- if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) ||
- (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0))
- {
- // ... and the connection is on-demand (or on-traffic) if the
- // calling application is using the CFSocketStream or higher APIs
-
- if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0)
- {
- // ... and no [user] intervention is needed
- retVal = ReachableViaWiFi;
- }
- }
-
- if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN)
- {
- // ... but WWAN connections are OK if the calling application
- // is using the CFNetwork (CFSocketStream?) APIs.
- retVal = ReachableViaWWAN;
- }
- return retVal;
-}
-
-- (BOOL) connectionRequired;
-{
- NSAssert(reachabilityRef != NULL, @"connectionRequired called with NULL reachabilityRef");
- SCNetworkReachabilityFlags flags;
- if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
- {
- return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
- }
- return NO;
-}
-
-- (NetworkStatus) currentReachabilityStatus
-{
- NSAssert(reachabilityRef != NULL, @"currentNetworkStatus called with NULL reachabilityRef");
- NetworkStatus retVal = NotReachable;
- SCNetworkReachabilityFlags flags;
- if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
- {
- if(localWiFiRef)
- {
- retVal = [self localWiFiStatusForFlags: flags];
- }
- else
- {
- retVal = [self networkStatusForFlags: flags];
- }
- }
- return retVal;
-}
-@end
--- /dev/null
+/*
+
+ File: Reachability.m
+ Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
+
+ Version: 2.2
+
+ Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
+ ("Apple") in consideration of your agreement to the following terms, and your
+ use, installation, modification or redistribution of this Apple software
+ constitutes acceptance of these terms. If you do not agree with these terms,
+ please do not use, install, modify or redistribute this Apple software.
+
+ In consideration of your agreement to abide by the following terms, and subject
+ to these terms, Apple grants you a personal, non-exclusive license, under
+ Apple's copyrights in this original Apple software (the "Apple Software"), to
+ use, reproduce, modify and redistribute the Apple Software, with or without
+ modifications, in source and/or binary forms; provided that if you redistribute
+ the Apple Software in its entirety and without modifications, you must retain
+ this notice and the following text and disclaimers in all such redistributions
+ of the Apple Software.
+ Neither the name, trademarks, service marks or logos of Apple Inc. may be used
+ to endorse or promote products derived from the Apple Software without specific
+ prior written permission from Apple. Except as expressly stated in this notice,
+ no other rights or licenses, express or implied, are granted by Apple herein,
+ including but not limited to any patent rights that may be infringed by your
+ derivative works or by other works in which the Apple Software may be
+ incorporated.
+
+ The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
+ WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+ WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
+ COMBINATION WITH YOUR PRODUCTS.
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
+ DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
+ CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+ APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ Copyright (C) 2010 Apple Inc. All Rights Reserved.
+
+*/
+
+#import <sys/socket.h>
+#import <netinet/in.h>
+#import <netinet6/in6.h>
+#import <arpa/inet.h>
+#import <ifaddrs.h>
+#import <netdb.h>
+
+#import <CoreFoundation/CoreFoundation.h>
+
+#import "Reachability.h"
+
+#define kShouldPrintReachabilityFlags 1
+
+static void PrintReachabilityFlags(SCNetworkReachabilityFlags flags, const char* comment)
+{
+#if kShouldPrintReachabilityFlags
+
+ NSLog(@"Reachability Flag Status: %c%c %c%c%c%c%c%c%c %s\n",
+ (flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-',
+ (flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-',
+
+ (flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-',
+ (flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-',
+ (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-',
+ (flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
+ (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-',
+ (flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-',
+ (flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-',
+ comment
+ );
+#endif
+}
+
+
+@implementation Reachability
+static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
+{
+ #pragma unused (target, flags)
+ NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback");
+ NSCAssert([(NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCallback");
+
+ //We're on the main RunLoop, so an NSAutoreleasePool is not necessary, but is added defensively
+ // in case someon uses the Reachablity object in a different thread.
+ NSAutoreleasePool* myPool = [[NSAutoreleasePool alloc] init];
+
+ Reachability* noteObject = (Reachability*) info;
+ // Post a notification to notify the client that the network reachability changed.
+ [[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotification object: noteObject];
+
+ [myPool release];
+}
+
+- (BOOL) startNotifier
+{
+ BOOL retVal = NO;
+ SCNetworkReachabilityContext context = {0, self, NULL, NULL, NULL};
+ if(SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context))
+ {
+ if(SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode))
+ {
+ retVal = YES;
+ }
+ }
+ return retVal;
+}
+
+- (void) stopNotifier
+{
+ if(reachabilityRef!= NULL)
+ {
+ SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
+ }
+}
+
+- (void) dealloc
+{
+ [self stopNotifier];
+ if(reachabilityRef!= NULL)
+ {
+ CFRelease(reachabilityRef);
+ }
+ [super dealloc];
+}
+
++ (Reachability*) reachabilityWithHostName: (NSString*) hostName;
+{
+ Reachability* retVal = NULL;
+ SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]);
+ if(reachability!= NULL)
+ {
+ retVal= [[[self alloc] init] autorelease];
+ if(retVal!= NULL)
+ {
+ retVal->reachabilityRef = reachability;
+ retVal->localWiFiRef = NO;
+ }
+ }
+ return retVal;
+}
+
++ (Reachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
+{
+ SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress);
+ Reachability* retVal = NULL;
+ if(reachability!= NULL)
+ {
+ retVal= [[[self alloc] init] autorelease];
+ if(retVal!= NULL)
+ {
+ retVal->reachabilityRef = reachability;
+ retVal->localWiFiRef = NO;
+ }
+ }
+ return retVal;
+}
+
++ (Reachability*) reachabilityForInternetConnection;
+{
+ struct sockaddr_in zeroAddress;
+ bzero(&zeroAddress, sizeof(zeroAddress));
+ zeroAddress.sin_len = sizeof(zeroAddress);
+ zeroAddress.sin_family = AF_INET;
+ return [self reachabilityWithAddress: &zeroAddress];
+}
+
++ (Reachability*) reachabilityForLocalWiFi;
+{
+ struct sockaddr_in localWifiAddress;
+ bzero(&localWifiAddress, sizeof(localWifiAddress));
+ localWifiAddress.sin_len = sizeof(localWifiAddress);
+ localWifiAddress.sin_family = AF_INET;
+ // IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
+ localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
+ Reachability* retVal = [self reachabilityWithAddress: &localWifiAddress];
+ if(retVal!= NULL)
+ {
+ retVal->localWiFiRef = YES;
+ }
+ return retVal;
+}
+
+#pragma mark Network Flag Handling
+
+- (NetworkStatus) localWiFiStatusForFlags: (SCNetworkReachabilityFlags) flags
+{
+ PrintReachabilityFlags(flags, "localWiFiStatusForFlags");
+
+ NetworkStatus retVal = NotReachable;
+ if((flags & kSCNetworkReachabilityFlagsReachable) && (flags & kSCNetworkReachabilityFlagsIsDirect))
+ {
+ retVal = ReachableViaWiFi;
+ }
+ return retVal;
+}
+
+- (NetworkStatus) networkStatusForFlags: (SCNetworkReachabilityFlags) flags
+{
+ PrintReachabilityFlags(flags, "networkStatusForFlags");
+ if ((flags & kSCNetworkReachabilityFlagsReachable) == 0)
+ {
+ // if target host is not reachable
+ return NotReachable;
+ }
+
+ NetworkStatus retVal = NotReachable;
+
+ if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0)
+ {
+ // if target host is reachable and no connection is required
+ // then we'll assume (for now) that your on Wi-Fi
+ retVal = ReachableViaWiFi;
+ }
+
+
+ if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) ||
+ (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0))
+ {
+ // ... and the connection is on-demand (or on-traffic) if the
+ // calling application is using the CFSocketStream or higher APIs
+
+ if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0)
+ {
+ // ... and no [user] intervention is needed
+ retVal = ReachableViaWiFi;
+ }
+ }
+
+ if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN)
+ {
+ // ... but WWAN connections are OK if the calling application
+ // is using the CFNetwork (CFSocketStream?) APIs.
+ retVal = ReachableViaWWAN;
+ }
+ return retVal;
+}
+
+- (BOOL) connectionRequired;
+{
+ NSAssert(reachabilityRef != NULL, @"connectionRequired called with NULL reachabilityRef");
+ SCNetworkReachabilityFlags flags;
+ if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
+ {
+ return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
+ }
+ return NO;
+}
+
+- (NetworkStatus) currentReachabilityStatus
+{
+ NSAssert(reachabilityRef != NULL, @"currentNetworkStatus called with NULL reachabilityRef");
+ NetworkStatus retVal = NotReachable;
+ SCNetworkReachabilityFlags flags;
+ if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
+ {
+ if(localWiFiRef)
+ {
+ retVal = [self localWiFiStatusForFlags: flags];
+ }
+ else
+ {
+ retVal = [self networkStatusForFlags: flags];
+ }
+ }
+ return retVal;
+}
+@end
#import "ResetView.h"
-#include <WebKit/DOMCSSPrimitiveValue.h>
-#include <WebKit/DOMCSSStyleDeclaration.h>
-#include <WebKit/DOMDocument.h>
-#include <WebKit/DOMHTMLBodyElement.h>
#include <WebKit/DOMNodeList.h>
-#include <WebKit/DOMRGBColor.h>
-
#include <WebKit/WebFrame.h>
-#include <WebKit/WebPolicyDelegate.h>
-#include <WebKit/WebPreferences.h>
#include <WebKit/WebScriptObject.h>
-
-#import <WebKit/WebView.h>
-#import <WebKit/WebView-WebPrivate.h>
-
-#include <WebCore/Page.h>
-#include <WebCore/Settings.h>
+#include <WebKit/WebView.h>
#import <JavaScriptCore/JavaScriptCore.h>
- (UCViewController *) pageForURL:(NSURL *)url hasTag:(int *)tag;
@end
-@interface BrowserController : UCViewController {
+@interface BrowserController : UCViewController <
+ HookProtocol
+> {
UIScroller *scroller_;
UIWebDocumentView *document_;
UIProgressIndicator *indicator_;
- (bool) promptForSensitive:(NSString *)name;
- (bool) allowSensitiveRequests;
+- (void) alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)button;
+- (void) applyRightButton;
+
+- (void) _startLoading;
+- (void) close;
+
@end
\ No newline at end of file
+#include <UIKit/UIKit.h>
+#include "iPhonePrivate.h"
+
+#include "UCPlatform.h"
+
#include <UICaboodle/BrowserView.h>
#include <UICaboodle/UCLocalize.h>
-#import <QuartzCore/CALayer.h>
+//#include <QuartzCore/CALayer.h>
// XXX: fix the minimum requirement
extern NSString * const kCAFilterNearest;
#include <WebCore/WebCoreThread.h>
-#include <WebKit/WebPreferences-WebPrivate.h>
+
+#include <WebKit/WebPolicyDelegate.h>
+#include <WebKit/WebPreferences.h>
+
+#include <WebKit/DOMCSSPrimitiveValue.h>
+#include <WebKit/DOMCSSStyleDeclaration.h>
+#include <WebKit/DOMDocument.h>
+#include <WebKit/DOMHTMLBodyElement.h>
+#include <WebKit/DOMRGBColor.h>
+
+//#include <WebCore/Page.h>
+//#include <WebCore/Settings.h>
#include "substrate.h"
static Class $UIFormAssistant;
static Class $UIWebBrowserView;
-@interface NSString (UIKit)
-- (NSString *) stringByAddingPercentEscapes;
-@end
-
/* Indirect Delegate {{{ */
-@interface IndirectDelegate : NSObject {
+@interface IndirectDelegate : NSObject <
+ HookProtocol
+> {
_transient volatile id delegate_;
}
return nil;
}
+- (void) didDismissModalViewController {
+ if (delegate_ != nil)
+ return [delegate_ didDismissModalViewController];
+}
+
- (IMP) methodForSelector:(SEL)sel {
if (IMP method = [super methodForSelector:sel])
return method;
/* }}} */
@interface WebView (UICaboodle)
-- (void) setScriptDebugDelegate:(id)delegate;
++ (BOOL) _canHandleRequest:(NSURLRequest *)request;
- (void) _setFormDelegate:(id)delegate;
+- (void) _setLayoutInterval:(float)interval;
+- (void) setScriptDebugDelegate:(id)delegate;
- (void) _setUIKitDelegate:(id)delegate;
+- (void) _setUsesLoaderCache:(BOOL)uses;
- (void) setWebMailDelegate:(id)delegate;
-- (void) _setLayoutInterval:(float)interval;
+@end
+
+@interface WebPreferences (Apple)
++ (void) _setInitialDefaultTextEncodingToSystemEncoding;
+- (void) _setLayoutInterval:(NSInteger)interval;
+- (void) setOfflineWebApplicationCacheEnabled:(BOOL)enabled;
@end
@implementation WebScriptObject (UICaboodle)
if ([scroller_ respondsToSelector:@selector(setScrollerIndicatorSubrect:)])
[scroller_ setScrollerIndicatorSubrect:subrect];
- [document_ setValue:[NSValue valueWithSize:NSMakeSize(subrect.size.width, subrect.size.height)] forGestureAttribute:UIGestureAttributeVisibleSize];
+ [document_ setValue:[NSValue valueWithSize:CGSizeMake(subrect.size.width, subrect.size.height)] forGestureAttribute:UIGestureAttributeVisibleSize];
CGSize size(size_);
size.height += extra;
}
- (void) _openMailToURL:(NSURL *)url {
- [UIApp openURL:url];// asPanel:YES];
+ [[UIApplication sharedApplication] openURL:url];// asPanel:YES];
}
- (void) webView:(WebView *)sender willBeginEditingFormElement:(id)element {
WebView *webview([document_ webView]);
if (frame == [webview mainFrame])
- [UIApp openURL:[request URL]];
+ [[UIApplication sharedApplication] openURL:[request URL]];
}
}
)) {
url = open;
open:
- [UIApp openURL:url];
+ [[UIApplication sharedApplication] openURL:url];
goto ignore;
}
[self _startLoading];
}
-- (UINavigationButtonStyle) rightButtonStyle {
+- (UIBarButtonItemStyle) rightButtonStyle {
if (style_ == nil) normal:
- return UINavigationButtonStyleNormal;
+ return UIBarButtonItemStylePlain;
else if ([style_ isEqualToString:@"Normal"])
- return UINavigationButtonStyleNormal;
- else if ([style_ isEqualToString:@"Back"])
- return UINavigationButtonStyleBack;
+ return UIBarButtonItemStylePlain;
else if ([style_ isEqualToString:@"Highlighted"])
- return UINavigationButtonStyleHighlighted;
- else if ([style_ isEqualToString:@"Destructive"])
- return UINavigationButtonStyleDestructive;
+ return UIBarButtonItemStyleDone;
else goto normal;
}
WebView *webview([document_ webView]);
WebFrame *frame([webview mainFrame]);
+ WebPreferences *preferences([webview preferences]);
+
+ bool maybe([preferences javaScriptCanOpenWindowsAutomatically]);
+ [preferences setJavaScriptCanOpenWindowsAutomatically:NO];
- id _private(MSHookIvar<id>(webview, "_private"));
+ /*id _private(MSHookIvar<id>(webview, "_private"));
WebCore::Page *page(_private == nil ? NULL : MSHookIvar<WebCore::Page *>(_private, "page"));
WebCore::Settings *settings(page == NULL ? NULL : page->settings());
else {
no = settings->JavaScriptCanOpenWindowsAutomatically();
settings->setJavaScriptCanOpenWindowsAutomatically(true);
- }
+ }*/
if (UIWindow *window = [[self view] window])
if (UIResponder *responder = [window firstResponder])
JSGlobalContextRef context([frame globalContext]);
JSObjectCallAsFunction(context, object, NULL, 0, NULL, NULL);
- if (settings != NULL)
- settings->setJavaScriptCanOpenWindowsAutomatically(no);
+ /*if (settings != NULL)
+ settings->setJavaScriptCanOpenWindowsAutomatically(no);*/
+
+ [preferences setJavaScriptCanOpenWindowsAutomatically:maybe];
WebThreadUnlock();
}
#import <UIKit/UIKit.h>
+@protocol HookProtocol
+- (void) didDismissModalViewController;
+@end
+
@interface UCNavigationController : UINavigationController {
- id hook_;
+ id<HookProtocol> hook_;
}
-- (void) setHook:(id)hook;
+- (void) setHook:(id<HookProtocol>)hook;
@end
#import "RVBook.h"
-#import <UIKit/UINavigationBar.h>
-#import <UIKit/UINavigationItem.h>
-
-#import <UIKit/UITransitionView.h>
-
-#import <UIKit/UIView-Geometry.h>
-#import <UIKit/UIView-Hierarchy.h>
+#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CoreGraphics/CGGeometry.h>
id delegate_;
}
- (void)setDelegate:(id)delegate;
+- (void) reloadData;
@end
- (void) clearView;
@end
-@interface UITable (RVBook)
-- (void) resetViewAnimated:(BOOL)animated;
-- (void) clearView;
-@end
-
@interface UITableView (RVBook)
- (void) resetViewAnimated:(BOOL)animated;
- (void) clearView;
@end
-
-@interface UISectionList (RVBook)
-- (void) resetViewAnimated:(BOOL)animated;
-- (void) clearView;
-@end
@end
-@implementation UITable (RVBook)
-
-- (void) resetViewAnimated:(BOOL)animated {
- [self selectRow:-1 byExtendingSelection:NO withFade:animated];
-}
-
-- (void) clearView {
- [self clearAllData];
-}
-
-@end
-
@implementation UITableView (RVBook)
- (void) resetViewAnimated:(BOOL)animated {
}
@end
-
-@implementation UISectionList (RVBook)
-
-- (void) resetViewAnimated:(BOOL)animated {
- [[self table] resetViewAnimated:animated];
-}
-
-- (void) clearView {
- [[self table] clearView];
-}
-
-@end
--- /dev/null
+0) use a Mac (I'm sorry, I really am)
+1) install Cydia Substrate (in beta)
+2) install Fink (the only sane choice)
+3) activate Fink (. /sw/bin/init.sh)
+4) fink install bash ldid wget
--- /dev/null
+#ifndef CYDIA_UIKITPRIVATE_H
+
+#include <GraphicsServices/GraphicsServices.h>
+
+typedef enum {
+ UIGestureAttributeMinDegrees, /*float*/
+ UIGestureAttributeMaxDegrees, /*float*/
+ UIGestureAttributeMinScale, /*float*/
+ UIGestureAttributeMaxScale, /*float*/
+ UIGestureAttributeIsZoomRubberBandEnabled, /*BOOL*/
+ UIGestureAttributeZoomsFromCurrentToMinOrMax, /*BOOL*/
+ UIGestureAttributeVisibleSize, /*CGSize*/
+ UIGestureAttributeUpdatesScroller, /*BOOL*/
+} UIGestureAttribute;
+
+typedef enum {
+ UINavigationButtonStyleNormal,
+ UINavigationButtonStyleBack,
+ UINavigationButtonStyleHighlighted,
+ UINavigationButtonStyleDestructive
+} UINavigationButtonStyle;
+
+typedef enum {
+ UIProgressIndicatorStyleLargeWhite,
+ UIProgressIndicatorStyleMediumWhite,
+ UIProgressIndicatorStyleMediumBrown,
+ UIProgressIndicatorStyleSmallWhite,
+ UIProgressIndicatorStyleSmallBlack,
+ UIProgressIndicatorStyleTinyWhite,
+} UIProgressIndicatorStyle;
+
+
+@class WebView;
+
+
+@interface NSString (Apple)
+- (void) drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(UIFont *)font ellipsis:(BOOL)ellipsis;
+- (NSString *) stringByAddingPercentEscapes;
+- (NSString *) stringByReplacingCharacter:(UniChar)from withCharacter:(UniChar)to;
+@end
+
+@interface NSURL (Apple)
+- (BOOL) isGoogleMapsURL;
+- (BOOL) isSpringboardHandledURL;
+// XXX: make this an enum
+- (NSURL *) itmsURL:(NSInteger *)store;
+- (NSURL *) mapsURL;
+- (NSURL *) phobosURL;
+- (NSURL *) youTubeURL;
+@end
+
+@interface NSValue (Apple)
++ (NSValue *) valueWithSize:(CGSize)size;
+@end
+
+
+@interface UIActionSheet (Apple)
+- (NSString *) context;
+@end
+
+@interface UIAlertView (Apple)
+- (void) addTextFieldWithValue:(NSString *)value label:(NSString *)label;
+- (id) buttons;
+- (NSString *) context;
+- (void) setContext:(NSString *)context;
+- (void) setNumberOfRows:(int)rows;
+- (void) setRunsModal:(BOOL)modal;
+- (UITextField *) textField;
+- (UITextField *) textFieldAtIndex:(NSUInteger)index;
+- (void) _updateFrameForDisplay;
+@end
+
+@interface UIApplication (Apple)
+- (void) applicationSuspend:(GSEventRef)event;
+- (void) _animateSuspension:(BOOL)suspend duration:(double)duration startTime:(double)start scale:(float)scale;
+- (void) applicationOpenURL:(NSURL *)url;
+- (void) applicationWillResignActive:(UIApplication *)application;
+- (void) applicationWillSuspend;
+- (void) launchApplicationWithIdentifier:(NSString *)identifier suspended:(BOOL)suspended;
+- (void) removeApplicationBadge;
+- (void) setApplicationBadge:(NSString *)badge;
+- (void) setApplicationBadgeString:(NSString *)badge;
+- (void) setStatusBarShowsProgress:(BOOL)shows;
+- (void) _setSuspended:(BOOL)suspended;
+- (void) terminateWithSuccess;
+@end
+
+@interface UIBarButtonItem (Apple)
+- (UIView *) view;
+@end
+
+@interface UIColor (Apple)
++ (UIColor *) pinStripeColor;
+@end
+
+@interface UIControl (Apple)
+- (void) addTarget:(id)target action:(SEL)action forEvents:(NSInteger)events;
+@end
+
+@interface UIDevice (Apple)
+- (BOOL) isWildcat;
+@end
+
+@interface UIImage (Apple)
++ (UIImage *) applicationImageNamed:(NSString *)name;
++ (UIImage *) imageAtPath:(NSString *)path;
+@end
+
+@interface UINavigationBar (Apple)
++ (CGSize) defaultSize;
+- (UIBarStyle) _barStyle:(BOOL)style;
+@end
+
+@interface UISearchBar (Apple)
+- (UITextField *) searchField;
+@end
+
+@interface UITabBarItem (Apple)
+- (void) setAnimatedBadge:(BOOL)animated;
+@end
+
+@interface UITableViewCell (Apple)
+- (float) selectionPercent;
+@end
+
+@interface UITextField (Apple)
+- (UITextInputTraits *) textInputTraits;
+@end
+
+@interface UITextView (Apple)
+- (UIFont *) font;
+- (void) setAllowsRubberBanding:(BOOL)rubberbanding;
+- (void) setFont:(UIFont *)font;
+- (void) setMarginTop:(int)margin;
+- (void) setTextColor:(UIColor *)color;
+@end
+
+@interface UIView (Apple)
+- (void) setEnabledGestures:(NSInteger)gestures;
+- (void) setGestureDelegate:(id)delegate;
+- (void) setNeedsDisplayOnBoundsChange:(BOOL)needs;
+- (void) setValue:(NSValue *)value forGestureAttribute:(NSInteger)attribute;
+- (void) setZoomScale:(float)scale duration:(double)duration;
+- (void) _setZoomScale:(float)scale duration:(double)duration;
+@end
+
+@interface UIViewController (Apple)
+- (void) _updateLayoutForStatusBarAndInterfaceOrientation;
+@end
+
+@interface UIWindow (Apple)
+- (UIResponder *) firstResponder;
+- (void) makeKey:(UIApplication *)application;
+- (void) orderFront:(UIApplication *)application;
+@end
+
+
+@interface UIFormAssistant : UIView
++ (UIFormAssistant *) sharedFormAssistant;
+- (CGRect) peripheralFrame;
+@end
+
+@interface UIKeyboard : UIView
++ (void) initImplementationNow;
+@end
+
+@interface UIProgressBar : UIView
++ (CGSize) defaultSize;
+- (void) setProgress:(float)progress;
+- (void) setStyle:(NSInteger)style;
+@end
+
+@interface UIProgressHUD : UIView
+- (id) initWithWindow:(UIWindow *)window;
+- (void) setText:(NSString *)text;
+- (void) show:(BOOL)show;
+@end
+
+@interface UIProgressIndicator : UIView
++ (CGSize) defaultSizeForStyle:(NSUInteger)style;
+- (NSUInteger) activityIndicatorViewStyle;
+- (void) setStyle:(UIProgressIndicatorStyle)style;
+- (void) startAnimation;
+@end
+
+@interface UIScroller : UIView
+- (CGSize) contentSize;
+- (BOOL) releaseRubberBandIfNecessary;
+- (void) scrollPointVisibleAtTopLeft:(CGPoint)point;
+- (void) scrollRectToVisible:(CGRect)rect animated:(BOOL)animated;
+- (void) setAdjustForContentSizeChange:(BOOL)adjust;
+- (void) setAllowsRubberBanding:(BOOL)allows;
+- (void) setBounces:(BOOL)bounces;
+- (void) setClipsSubviews:(BOOL)clips;
+- (void) setContentSize:(CGSize)size;
+- (void) setDelegate:(id)delegate;
+- (void) setDirectionalScrolling:(BOOL)directional;
+- (void) setEventMode:(NSInteger)mode;
+- (void) setFixedBackgroundPattern:(BOOL)fixed;
+- (void) setOffset:(CGPoint)offset;
+- (void) setScrollHysteresis:(float)hysteresis;
+- (void) setScrollerIndicatorSubrect:(CGRect)rect;
+- (void) setScrollingEnabled:(BOOL)enabled;
+- (void) setShowBackgroundShadow:(BOOL)shows;
+- (void) setThumbDetectionEnabled:(BOOL)enabled;
+@end
+
+@interface UITextLabel : UIView
+- (void) setCentersHorizontally:(BOOL)centers;
+- (void) setColor:(UIColor *)color;
+- (void) setFont:(UIFont *)font;
+- (void) setText:(NSString *)text;
+@end
+
+@interface UIWebDocumentView : UIView
+- (CGRect) documentBounds;
+- (void) enableReachability;
+- (void) loadRequest:(NSURLRequest *)request;
+- (void) redrawScaledDocument;
+- (UIScroller *) _scroller;
+- (void) setAllowsImageSheet:(BOOL)allows;
+- (void) setAllowsMessaging:(BOOL)allows;
+- (void) setAutoresizes:(BOOL)autoresizes;
+- (void) setContentsPosition:(NSInteger)position;
+- (void) setDataDetectorTypes:(NSUInteger)types;
+- (void) setDelegate:(id)delegate;
+- (void) setDetectsPhoneNumbers:(BOOL)detects;
+- (void) _setDocumentType:(NSInteger)type;
+- (void) setDrawsGrid:(BOOL)draws;
+- (void) setFormEditingDelegate:(id)delegate;
+- (void) setInitialScale:(float)scale forDocumentTypes:(NSInteger)types;
+- (void) setInteractionDelegate:(id)delegate;
+- (void) setLogsTilingChanges:(BOOL)logs;
+- (void) setMinimumScale:(float)scale forDocumentTypes:(NSInteger)types;
+- (void) setMinimumSize:(CGSize)size;
+- (void) setMaximumScale:(float)scale forDocumentTypes:(NSInteger)tpyes;
+- (void) setSmoothsFonts:(BOOL)smooths;
+- (void) setTileMinificationFilter:(NSString *)filter;
+- (void) setTileSize:(CGSize)size;
+- (void) setTilingEnabled:(BOOL)enabled;
+- (void) setViewportSize:(CGSize)size forDocumentTypes:(NSInteger)types;
+- (void) setZoomsFocusedFormControl:(BOOL)zooms;
+- (void) useSelectionAssistantWithMode:(NSInteger)mode;
+- (WebView *) webView;
+- (void) webView:(WebView *)view attachRootLayer:(id)layer;
+- (void) webView:(WebView *)view didCommitLoadForFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view didFailLoadWithError:(id)error forFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view didFinishDocumentLoadForFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view didFinishLoadForFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view didFirstLayoutInFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view didFirstVisuallyNonEmptyLayoutInFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view didHideFullScreenForPlugInView:(id)plugin;
+- (void) webView:(WebView *)view didObserveDeferredContentChange:(NSInteger)change forFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view didReceiveDocTypeForFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view didReceiveMessage:(id)message;
+- (void) webView:(WebView *)view didReceiveViewportArguments:(id)arguments forFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view formStateDidBlurNode:(id)state;
+- (void) webView:(WebView *)view formStateDidFocusNode:(id)state;
+- (void) webView:(WebView *)view needsScrollNotifications:(id)notifications forFrame:(WebFrame *)frame;
+- (id) webView:(WebView *)view plugInViewWithArguments:(id)arguments fromPlugInPackage:(id)package;
+- (void) webView:(WebView *)view restoreStateFromHistoryItem:(id)item forFrame:(WebFrame *)frame force:(BOOL)force;
+- (void) webView:(WebView *)view saveStateToHistoryItem:(id)item forFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view willAddPlugInView:(id)plugin;
+- (void) webView:(WebView *)view willCloseFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view willShowFullScreenForPlugInView:(id)plugin;
+- (BOOL) webView:(WebView *)view shouldScrollToPoint:(CGPoint)point forFrame:(WebFrame *)frame;
+- (void) webViewDidLayout:(WebView *)view;
+- (void) webViewDidPreventDefaultForEvent:(WebView *)view;
+- (void) webViewFormEditedStatusHasChanged:(WebView *)changed;
+@end
+
+
+@interface UINavigationButton : UIButton
+- (id) initWithTitle:(NSString *)title style:(UINavigationButtonStyle)style;
+- (void) setBarStyle:(UIBarStyle)style;
+@end
+
+@interface UIPushButton : UIControl
+- (id) backgroundForState:(NSUInteger)state;
+- (void) setAutosizesToFit:(BOOL)autosizes;
+- (void) setBackground:(id)background forState:(NSUInteger)state;
+- (void) setDrawsShadow:(BOOL)draws;
+- (void) setStretchBackground:(BOOL)stretch;
+- (void) setTitle:(NSString *)title;
+- (void) setTitleFont:(UIFont *)font;
+@end
+
+@interface UIThreePartButton : UIPushButton
+@end
+
+
+@interface WebDefaultUIKitDelegate : NSObject
++ (WebDefaultUIKitDelegate *) sharedUIKitDelegate;
+@end
+
+
+extern "C" CFStringRef const kGSDisplayIdentifiersCapability;
+
+extern "C" float const UIWebViewGrowsAndShrinksToFitHeight;
+extern "C" float const UIWebViewScalesToFitScale;
+
+
+extern "C" UIImage *_UIImageWithName(NSString *name);
+extern "C" void UISetColor(CGColorRef color);
+
+
+#endif//CYDIA_UIKITPRIVATE_H
-ifndef PKG_TARG
-target :=
-else
-target := $(PKG_TARG)-
-endif
+ios := 3.2
+
+flags :=
+link :=
+
+#dpkg := /Library/Cydia/bin/dpkg-deb -Zlzma
+dpkg := dpkg-deb
+
+flags += -F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$(ios).sdk/System/Library/PrivateFrameworks
+flags += -I. -isystem sysroot/usr/include -Lsysroot/usr/lib
+flags += -Wall -Werror -Wno-deprecated-declarations
+flags += -fmessage-length=0
+flags += -g0 -O2
+flags += -fobjc-call-cxx-cdtors -fobjc-exceptions
+
+link += -framework CoreFoundation
+link += -framework CoreGraphics
+link += -framework Foundation
+link += -framework GraphicsServices
+link += -framework IOKit
+link += -framework JavaScriptCore
+link += -framework QuartzCore
+link += -framework SystemConfiguration
+link += -framework UIKit
+link += -framework WebCore
+link += -framework WebKit
+
+link += -lapr-1
+link += -lapt-pkg
+link += -lpcre
+
+link += -multiply_defined suppress
all: Cydia
clean:
rm -f Cydia
-Cydia: Cydia.mm UICaboodle/*.mm ../mobilesubstrate/*.h #makefile
- $(target)g++ -march=armv6 -mcpu=arm1176jzf-s -mthumb -I. -I../mobilesubstrate -fobjc-call-cxx-cdtors -g0 -O2 -Wall -Werror -o $@ $(filter %.mm,$^) -framework UIKit -framework IOKit -framework CoreFoundation -framework Foundation -framework CoreGraphics -framework GraphicsServices -framework QuartzCore -framework JavaScriptCore -framework WebCore -framework WebKit -lobjc -lapt-pkg -lpcre -fobjc-exceptions -F"$${PKG_ROOT}"/System/Library/PrivateFrameworks -multiply_defined suppress -lapr-1
-
-sign: Cydia
- CODESIGN_ALLOCATE=$$(which "$(target)codesign_allocate") ldid -Slaunch.xml Cydia
+Cydia: Cydia.mm Reachability.mm UICaboodle/*.mm
+ cycc -r4.2 -i$(ios) -o$@ -- $(filter %.mm,$^) $(flags) $(link)
-package: sign
+package: Cydia
rm -rf _
mkdir -p _/var/lib/cydia
mkdir -p _/usr/libexec
- svn export Library _/usr/libexec/cydia
- cp -a /apl/tel/dest/iphoneos-arm/coreutils/usr/bin/du _/usr/libexec/cydia
+ cp -a Library _/usr/libexec/cydia
+ # XXX: fix du
+ #cp -a /apl/tel/dest/iphoneos-arm/coreutils/usr/bin/du _/usr/libexec/cydia
mkdir -p _/System/Library
- svn export LaunchDaemons _/System/Library/LaunchDaemons
+ cp -a LaunchDaemons _/System/Library/LaunchDaemons
mkdir -p _/Applications
- svn export Cydia.app _/Applications/Cydia.app
+ cp -a Cydia.app _/Applications/Cydia.app
cp -a Cydia _/Applications/Cydia.app/Cydia_
chmod 6755 _/Applications/Cydia.app/Cydia_
mkdir -p _/System/Library/PreferenceBundles
- svn export CydiaSettings.bundle _/System/Library/PreferenceBundles/CydiaSettings.bundle
+ cp -a CydiaSettings.bundle _/System/Library/PreferenceBundles/CydiaSettings.bundle
mkdir -p _/DEBIAN
echo "$$(cat control)"$$'\nInstalled-Size: '"$$(du -s _ | cut -f 1)" > _/DEBIAN/control
- dpkg-deb -Zlzma -b _ $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb
+ $(dpkg) -b _ $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb
.PHONY: all clean sign
--- /dev/null
+#!/usr/bin/env bash
+
+if [[ ${BASH_VERSION} != 4* ]]; then
+ echo "bash 4.0 required" 1>&2
+ exit 1
+fi
+
+shopt -s extglob
+shopt -s nullglob
+
+PATH=/Library/Cydia/bin:$PATH
+
+rm -rf sysroot
+mkdir sysroot
+cd sysroot
+
+repository=http://apt.saurik.com/
+distribution=tangelo
+component=main
+architecture=iphoneos-arm
+
+wget -qO- "${repository}dists/${distribution}/${component}/binary-${architecture}/Packages.bz2" | bzcat | {
+ regex='^([^ \t]*): *(.*)'
+ declare -A fields
+
+ while IFS= read -r line; do
+ if [[ ${line} == '' ]]; then
+ package=${fields[package]}
+ if [[ ${package} == *(apr|apr-lib|apt7|apt7-lib|mobilesubstrate|pcre) ]]; then
+ filename=${fields[filename]}
+ wget -O "${package}.deb" "${repository}${filename}"
+ dpkg-deb -x "${package}.deb" .
+ fi
+
+ unset fields
+ declare -A fields
+ elif [[ ${line} =~ ${regex} ]]; then
+ name=${BASH_REMATCH[1],,}
+ value=${BASH_REMATCH[2]}
+ fields[${name}]=${value}
+ fi
+ done
+}
+
+rm -f *.deb
+
+mkdir -p usr/include
+cd usr/include
+
+mkdir CoreFoundation
+wget -O CoreFoundation/CFBundlePriv.h "http://www.opensource.apple.com/source/CF/CF-550/CFBundlePriv.h?txt"
+wget -O CoreFoundation/CFPriv.h "http://www.opensource.apple.com/source/CF/CF-550/CFPriv.h?txt"
+wget -O CoreFoundation/CFUniChar.h "http://www.opensource.apple.com/source/CF/CF-550/CFUniChar.h?txt"
+
+if true; then
+ mkdir -p WebCore
+ wget -O WebCore/WebCoreThread.h 'http://www.opensource.apple.com/source/WebCore/WebCore-658.28/wak/WebCoreThread.h?txt'
+else
+ wget -O WebCore.tgz http://www.opensource.apple.com/tarballs/WebCore/WebCore-658.28.tar.gz
+ tar -zx --transform 's@^[^/]*/@WebCore.d/@' -f WebCore.tgz
+
+ mkdir WebCore
+ cp -a WebCore.d/{*,rendering/style,platform/graphics/transforms}/*.h WebCore
+ cp -a WebCore.d/platform/{animation,graphics,network,text}/*.h WebCore
+ cp -a WebCore.d/{accessibility,platform{,/{graphics,network,text}}}/{cf,mac,iphone}/*.h WebCore
+ cp -a WebCore.d/bridge/objc/*.h WebCore
+
+ wget -O JavaScriptCore.tgz http://www.opensource.apple.com/tarballs/JavaScriptCore/JavaScriptCore-554.1.tar.gz
+ #tar -zx --transform 's@^[^/]*/API/@JavaScriptCore/@' -f JavaScriptCore.tgz $(tar -ztf JavaScriptCore.tgz | grep '/API/[^/]*.h$')
+ tar -zx \
+ --transform 's@^[^/]*/@@' \
+ --transform 's@^icu/@@' \
+ -f JavaScriptCore.tgz $(tar -ztf JavaScriptCore.tgz | sed -e '
+ /\/icu\/unicode\/.*\.h$/ p;
+ /\/profiler\/.*\.h$/ p;
+ /\/runtime\/.*\.h$/ p;
+ /\/wtf\/.*\.h$/ p;
+ d;
+ ')
+fi
+
+for framework in ApplicationServices CoreServices IOKit IOSurface JavaScriptCore QuartzCore WebKit; do
+ ln -s /System/Library/Frameworks/"${framework}".framework/Headers "${framework}"
+done
+
+for framework in /System/Library/Frameworks/CoreServices.framework/Frameworks/*.framework; do
+ name=${framework}
+ name=${name%.framework}
+ name=${name##*/}
+ ln -s "${framework}/Headers" "${name}"
+done
+
+mkdir -p Cocoa
+cat >Cocoa/Cocoa.h <<EOF
+#define NSImage UIImage
+#define NSView UIView
+#define NSWindow UIWindow
+
+#define NSPoint CGPoint
+#define NSRect CGRect
+
+#define NSPasteboard UIPasteboard
+#define NSSelectionAffinity int
+@protocol NSUserInterfaceValidations;
+EOF
+
+mkdir -p GraphicsServices
+cat >GraphicsServices/GraphicsServices.h <<EOF
+typedef struct __GSEvent *GSEventRef;
+typedef struct __GSFont *GSFontRef;
+EOF