summaryrefslogtreecommitdiff
path: root/Cydia.mm
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2008-08-11 11:02:51 +0000
committerJay Freeman (saurik) <saurik@saurik.com>2010-09-30 07:08:17 +0000
commitdddbc481e8debaf3fd2fe1b41fc4ce30cb29a2b6 (patch)
tree7bdedf86a782e80bb84450e8002dbe81263dd05f /Cydia.mm
parentdc6e62a40e4a0af61c0d57d7732ba59d2329d7c0 (diff)
Themes, automagic SpringBoard, and source data fixes.
Diffstat (limited to 'Cydia.mm')
-rw-r--r--Cydia.mm42
1 files changed, 32 insertions, 10 deletions
diff --git a/Cydia.mm b/Cydia.mm
index 2e1b5b8..c8d57c4 100644
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -74,12 +74,15 @@
#include <apt-pkg/debmetaindex.h>
#include <apt-pkg/error.h>
#include <apt-pkg/init.h>
+#include <apt-pkg/mmap.h>
#include <apt-pkg/pkgrecords.h>
+#include <apt-pkg/sha1.h>
#include <apt-pkg/sourcelist.h>
#include <apt-pkg/sptr.h>
#include <sys/sysctl.h>
#include <notify.h>
+#include <dlfcn.h>
extern "C" {
#include <mach-o/nlist.h>
@@ -151,8 +154,9 @@ extern "C" {
#ifdef __OBJC2__
typedef enum {
+ kUIProgressIndicatorStyleLargeWhite = 0,
kUIProgressIndicatorStyleMediumWhite = 1,
- kUIProgressIndicatorStyleSmallWhite = 0,
+ kUIProgressIndicatorStyleSmallWhite = 3,
kUIProgressIndicatorStyleSmallBlack = 4
} UIProgressIndicatorStyle;
#else
@@ -2281,8 +2285,6 @@ void AddTextView(NSMutableDictionary *fields, NSMutableArray *packages, NSString
CGRect bounds = [overlay_ bounds];
navbar_ = [[UINavigationBar alloc] initWithFrame:navrect];
- if (Advanced_)
- [navbar_ setBarStyle:1];
[navbar_ setDelegate:self];
UINavigationItem *navitem = [[[UINavigationItem alloc] initWithTitle:@"Confirm"] autorelease];
@@ -2438,6 +2440,7 @@ void AddTextView(NSMutableDictionary *fields, NSMutableArray *packages, NSString
UIPushButton *close_;
id delegate_;
BOOL running_;
+ SHA1SumValue springlist_;
}
- (void) transitionViewDidComplete:(UITransitionView*)view fromView:(UIView*)from toView:(UIView*)to;
@@ -2642,6 +2645,15 @@ void AddTextView(NSMutableDictionary *fields, NSMutableArray *packages, NSString
[progress_ removeFromSuperview];
[status_ removeFromSuperview];
+ {
+ FileFd file("/System/Library/LaunchDaemons/com.apple.SpringBoard.plist", FileFd::ReadOnly);
+ MMap mmap(file, MMap::ReadOnly);
+ SHA1Summation sha1;
+ sha1.Add(reinterpret_cast<uint8_t *>(mmap.Data()), mmap.Size());
+ if (!(springlist_ == sha1.Result()))
+ Finish_ = 3;
+ }
+
switch (Finish_) {
case 0: [close_ setTitle:@"Return to Cydia"]; break;
case 1: [close_ setTitle:@"Close Cydia (Restart)"]; break;
@@ -2685,6 +2697,14 @@ void AddTextView(NSMutableDictionary *fields, NSMutableArray *packages, NSString
[delegate_ setStatusBarShowsProgress:YES];
running_ = YES;
+ {
+ FileFd file("/System/Library/LaunchDaemons/com.apple.SpringBoard.plist", FileFd::ReadOnly);
+ MMap mmap(file, MMap::ReadOnly);
+ SHA1Summation sha1;
+ sha1.Add(reinterpret_cast<uint8_t *>(mmap.Data()), mmap.Size());
+ springlist_ = sha1.Result();
+ }
+
[transition_ transition:6 toView:overlay_];
[NSThread
@@ -5183,17 +5203,16 @@ void AddTextView(NSMutableDictionary *fields, NSMutableArray *packages, NSString
if ((self = [super initWithFrame:frame]) != nil) {
database_ = database;
- if (Advanced_)
- [navbar_ setBarStyle:1];
-
CGRect ovrrect = [navbar_ bounds];
ovrrect.size.height = ([UINavigationBar defaultSizeWithPrompt].height - [UINavigationBar defaultSize].height);
overlay_ = [[UIView alloc] initWithFrame:ovrrect];
- UIProgressIndicatorStyle style = Advanced_ ?
- kUIProgressIndicatorStyleSmallWhite :
- kUIProgressIndicatorStyleSmallBlack;
+ bool ugly = [navbar_ _barStyle:NO] == 0;
+
+ UIProgressIndicatorStyle style = ugly ?
+ kUIProgressIndicatorStyleSmallBlack :
+ kUIProgressIndicatorStyleSmallWhite;
CGSize indsize = [UIProgressIndicator defaultSizeForStyle:style];
unsigned indoffset = (ovrrect.size.height - indsize.height) / 2;
@@ -5217,7 +5236,7 @@ void AddTextView(NSMutableDictionary *fields, NSMutableArray *packages, NSString
prompt_ = [[UITextLabel alloc] initWithFrame:prmrect];
- [prompt_ setColor:(Advanced_ ? White_ : Blueish_)];
+ [prompt_ setColor:(ugly ? Blueish_ : White_)];
[prompt_ setBackgroundColor:Clear_];
[prompt_ setFont:font];
@@ -6151,6 +6170,9 @@ int main(int argc, char *argv[]) {
[Metadata_ setObject:Sources_ forKey:@"Sources"];
}
+ if (access("/Library/MobileSubstrate/MobileSubstrate.dylib", F_OK) == 0)
+ dlopen("/Library/MobileSubstrate/MobileSubstrate.dylib", RTLD_LAZY | RTLD_GLOBAL);
+
if (access("/User", F_OK) != 0)
system("/usr/libexec/cydia/firmware.sh");