Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Homer committed Jan 20, 2012
0 parents commit ee0bc1f
Show file tree
Hide file tree
Showing 27 changed files with 1,161 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule "theos"]
path = theos
url = git://github.com/DHowett/theos.git
Empty file added .theos/fakeroot
Empty file.
1 change: 1 addition & 0 deletions .theos/packages/com.whomer.UpdateHideriOS5-0.0.1
@@ -0,0 +1 @@
0.0.1-419
1 change: 1 addition & 0 deletions .theos/packages/com.whomer.UpdateHideriOS5-1.0
@@ -0,0 +1 @@
1.0-86
17 changes: 17 additions & 0 deletions Makefile
@@ -0,0 +1,17 @@
export THEOS_DEVICE_IP=192.168.2.6
include theos/makefiles/common.mk

LIBRARY_NAME = UpdateHideriOS5
UpdateHideriOS5_FILES = Tweak.xm
UpdateHideriOS5_FRAMEWORKS = UIKit
UpdateHideriOS5_LDFLAGS = -lsubstrate
UpdateHideriOS5_INSTALL_PATH = /Library/MobileSubstrate/DynamicLibraries
SUBPROJECTS = Prefs

include $(THEOS_MAKE_PATH)/aggregate.mk
include $(THEOS_MAKE_PATH)/library.mk

after-install::
-install.exec "killall AppStore"
-install.exec "killall Preferences"
-install.exec "killall itunesstored"
12 changes: 12 additions & 0 deletions Prefs/AppCell.h
@@ -0,0 +1,12 @@
#import "Common.h"

@interface AppCell : UITableViewCell
{
UIColor *_topLineColor;
UIColor *_bottomLineColor;
}

@property (nonatomic, retain) UIColor *topLineColor;
@property (nonatomic, retain) UIColor *bottomLineColor;

@end
84 changes: 84 additions & 0 deletions Prefs/AppCell.m
@@ -0,0 +1,84 @@
#import "AppCell.h"

@implementation AppCell

@synthesize topLineColor = _topLineColor;
@synthesize bottomLineColor = _bottomLineColor;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)identifier
{
if ((self = [super initWithStyle:style reuseIdentifier:identifier]))
{
self.selectionStyle = UITableViewCellSelectionStyleNone;

self.imageView.layer.masksToBounds = YES;
self.imageView.layer.cornerRadius = 9.0f;

self.textLabel.font = [UIFont boldSystemFontOfSize:16.0f];
self.textLabel.shadowColor = RGB(206, 206, 208);
self.textLabel.shadowOffset = CGSizeMake(0, 1);

self.detailTextLabel.font = [UIFont boldSystemFontOfSize:12.5f];
self.detailTextLabel.textColor = RGB(58, 58, 58);
self.detailTextLabel.shadowColor = RGB(206, 206, 208);
self.detailTextLabel.shadowOffset = CGSizeMake(0, 1);
}
return self;
}

- (void)dealloc
{
self.topLineColor = nil;
self.bottomLineColor = nil;
[super dealloc];
}

- (void)layoutSubviews
{
[super layoutSubviews];

self.imageView.bounds = CGRectMake(10, 6, 57, 57);
self.imageView.frame = CGRectMake(10, 6, 57, 57);

if (self.imageView.image != nil)
{
CGRect frame = self.textLabel.frame;
frame.origin.x = 77;
self.textLabel.frame = frame;

frame = self.detailTextLabel.frame;
frame.origin.x = 77;
self.detailTextLabel.frame = frame;
}
}

- (void)drawRect:(CGRect)rect
{
[super drawRect:rect];

CGContextRef context = UIGraphicsGetCurrentContext();

CGContextSetFillColorWithColor(context, self.topLineColor.CGColor);
CGContextFillRect(context, CGRectMake(0, 0, 320, 1));

CGContextSetFillColorWithColor(context, self.bottomLineColor.CGColor);
CGContextFillRect(context, CGRectMake(0, self.bounds.size.height - 1, 320, 1));
}

/*- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
{
[super setHighlighted:highlighted animated:animated];
self.textLabel.shadowOffset = CGSizeMake(0, !highlighted);
self.detailTextLabel.shadowOffset = CGSizeMake(0, !highlighted);
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
self.textLabel.shadowOffset = CGSizeMake(0, !selected);
self.detailTextLabel.shadowOffset = CGSizeMake(0, !selected);
}*/

@end
16 changes: 16 additions & 0 deletions Prefs/Common.h
@@ -0,0 +1,16 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <CoreGraphics/CoreGraphics.h>
#import <QuartzCore/QuartzCore.h>
#import <objc/runtime.h>

#define RGB(r, g, b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0]

#define APP_STORE_UI_FRAMEWORK [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/AppStoreUI.framework"]
#define ITUNES_STORE_UI_FRAMEWORK [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/iTunesStoreUI.framework"]
#define CHATKIT_FRAMEWORK [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/ChatKit.framework"]

#define LOADING_STRING NSLocalizedStringFromTableInBundle(@"LOADING", @"Localizable", ITUNES_STORE_UI_FRAMEWORK, @"")
#define VERSION_FORMAT_STRING NSLocalizedStringFromTableInBundle(@"VERSION_FORMAT", @"Localizable", APP_STORE_UI_FRAMEWORK, @"")
#define NO_UPDATES_STRING NSLocalizedStringFromTableInBundle(@"NO_UPDATES", @"Localizable", APP_STORE_UI_FRAMEWORK, @"")
#define HIDE_STRING NSLocalizedStringFromTableInBundle(@"HIDE_DETAILS", @"ChatKit", CHATKIT_FRAMEWORK, @"")
28 changes: 28 additions & 0 deletions Prefs/IconImageDownloader.h
@@ -0,0 +1,28 @@
#import "Common.h"

@protocol IconImageDownloaderDelegate;

@interface IconImageDownloader : NSObject
{
NSMutableData *_imgData;
NSURLConnection *_urlConnection;
NSIndexPath *_indexPath;
id <IconImageDownloaderDelegate> _delegate;
}

- (id)initWithURL:(NSURL *)url;
- (void)start;
- (void)cancel;

@property (nonatomic, retain) NSMutableData *imgData;
@property (nonatomic, retain) NSURLConnection *urlConnection;
@property (nonatomic, assign) id <IconImageDownloaderDelegate> delegate;
@property (nonatomic, retain) NSIndexPath *indexPath;

@end

@protocol IconImageDownloaderDelegate
- (void)iconImageDownloader:(IconImageDownloader *)downloader didFinishLoadingImage:(UIImage *)image;
- (void)iconImageDownloader:(IconImageDownloader *)downloader didFailWithError:(NSError *)error;
@end

63 changes: 63 additions & 0 deletions Prefs/IconImageDownloader.m
@@ -0,0 +1,63 @@
#import "IconImageDownloader.h"

@implementation IconImageDownloader

@synthesize imgData =_imgData;
@synthesize urlConnection = _urlConnection;
@synthesize delegate = _delegate;
@synthesize indexPath = _indexPath;

- (id)initWithURL:(NSURL *)url
{
if ((self = [super init]))
{
self.imgData = [NSMutableData data];
NSURLConnection *con = [[NSURLConnection alloc] initWithRequest:[NSURLRequest requestWithURL:url] delegate:self startImmediately:NO];
self.urlConnection = con;
[con release];
}
return self;
}

- (void)dealloc
{
[_urlConnection release];
[_imgData release];
[_indexPath release];
[super dealloc];
}

- (void)start
{
[self.urlConnection start];
}

- (void)cancel
{
[self.urlConnection cancel];
self.imgData = nil;
self.urlConnection = nil;
self.indexPath = nil;
}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[self.imgData appendData:data];
}

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
self.urlConnection = nil;
self.imgData = nil;
[self.delegate iconImageDownloader:self didFailWithError:error];
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
UIImage *image = [[UIImage alloc] initWithData:self.imgData];
self.imgData = nil;
self.urlConnection = nil;
[self.delegate iconImageDownloader:self didFinishLoadingImage:[image autorelease]];
}

@end
20 changes: 20 additions & 0 deletions Prefs/LoadingCell.h
@@ -0,0 +1,20 @@
#import "Common.h"

@interface SULoadingView : UIView

- (void)setStyle:(int)style;
@property (nonatomic, retain) UIColor *textShadowColor;

@end

@interface LoadingCell : UITableViewCell
{
SULoadingView *_loadingView;
BOOL _loading;
}

@property (nonatomic, assign, getter=isLoading) BOOL loading;

- (void)_setScreenWidth:(CGFloat)width;

@end
57 changes: 57 additions & 0 deletions Prefs/LoadingCell.m
@@ -0,0 +1,57 @@
#import "LoadingCell.h"

@implementation LoadingCell

@synthesize loading = _loading;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)identifier
{
if ((self = [super initWithStyle:style reuseIdentifier:identifier]))
{
_loading = NO;
self.selectionStyle = UITableViewCellSelectionStyleNone;

self.textLabel.font = [UIFont boldSystemFontOfSize:15.0f];
self.textLabel.textColor = RGB(47, 52, 60);
self.textLabel.textAlignment = UITextAlignmentCenter;
self.textLabel.shadowColor = RGB(206, 206, 208);
self.textLabel.shadowOffset = CGSizeMake(0, 1);

_loadingView = [[objc_getClass("SULoadingView") alloc] initWithFrame:CGRectZero];
[_loadingView setStyle:0];
[_loadingView sizeToFit];
_loadingView.frame = CGRectMake((self.frame.size.width - _loadingView.frame.size.width) / 2, (69 - _loadingView.frame.size.height) / 2, _loadingView.frame.size.width, _loadingView.frame.size.height);
_loadingView.textShadowColor = RGB(206, 206, 208);
}
return self;
}

// Not sure how to get screen width for iPad at this point so this hacky thing will do for now
- (void)_setScreenWidth:(CGFloat)width
{
CGRect frame = _loadingView.frame;
_loadingView.frame = CGRectMake((width - frame.size.width) / 2, (69 - frame.size.height) / 2, frame.size.width, frame.size.height);
}

- (void)setLoading:(BOOL)loading
{
if (loading == _loading)
return;

_loading = loading;

self.textLabel.text = nil;

if (loading)
[[self contentView] addSubview:_loadingView];
else
[_loadingView removeFromSuperview];
}

- (void)dealloc
{
[_loadingView release];
[super dealloc];
}

@end
14 changes: 14 additions & 0 deletions Prefs/Makefile
@@ -0,0 +1,14 @@
include theos/makefiles/common.mk

BUNDLE_NAME = UpdateHideriOS5Prefs
UpdateHideriOS5Prefs_FILES = AppCell.m LoadingCell.m IconImageDownloader.m Update.m UpdateHideriOS5Prefs.mm
UpdateHideriOS5Prefs_INSTALL_PATH = /Library/PreferenceBundles
UpdateHideriOS5Prefs_FRAMEWORKS = UIKit CoreGraphics QuartzCore
UpdateHideriOS5Prefs_PRIVATE_FRAMEWORKS = Preferences StoreServices iTunesStore iTunesStoreUI
DEBUG = 1

include $(THEOS_MAKE_PATH)/bundle.mk

internal-stage::
$(ECHO_NOTHING)mkdir -p $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences$(ECHO_END)

48 changes: 48 additions & 0 deletions Prefs/PSViewController.h
@@ -0,0 +1,48 @@
/*
* Generated by class-dump 3.3.3 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2010 by Steve Nygard.
*/

#import <UIKit/UIKit.h>

@class PSRootController, PSSpecifier;

@interface PSViewController : UIViewController
{
UIViewController *_parentController;
PSRootController *_rootController;
PSSpecifier *_specifier;
}

- (id)init;
- (void)setParentController:(id)arg1;
- (id)parentController;
- (void)setRootController:(id)arg1;
- (id)rootController;
- (void)dealloc;
- (void)setSpecifier:(id)arg1;
- (id)specifier;
- (void)setPreferenceValue:(id)arg1 specifier:(id)arg2;
- (id)readPreferenceValue:(id)arg1;
- (void)willResignActive;
- (void)willBecomeActive;
- (void)suspend;
- (void)didLock;
- (void)willUnlock;
- (void)didUnlock;
- (void)didWake;
- (void)pushController:(id)arg1;
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)arg1;
- (void)handleURL:(id)arg1;
- (id)methodSignatureForSelector:(SEL)arg1;
- (void)forwardInvocation:(id)arg1;
- (void)popupViewWillDisappear;
- (void)popupViewDidDisappear;
- (void)formSheetViewWillDisappear;
- (void)formSheetViewDidDisappear;
- (BOOL)canBeShownFromSuspendedState;
- (void)statusBarWillAnimateByHeight:(float)arg1;

@end

0 comments on commit ee0bc1f

Please sign in to comment.