From 1eb0c5545ce83b3f796e8a066c08d8a6c5055c0c Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 11 Aug 2008 11:02:51 +0000 Subject: [PATCH] Themes, automagic SpringBoard, and source data fixes. --- Cydia.app/package.html | 3 ++- Cydia.app/package.js | 16 ++++++++++++---- Cydia.mm | 42 ++++++++++++++++++++++++++++++++---------- 3 files changed, 46 insertions(+), 15 deletions(-) diff --git a/Cydia.app/package.html b/Cydia.app/package.html index 5a94df95..1331c7d7 100644 --- a/Cydia.app/package.html +++ b/Cydia.app/package.html @@ -75,7 +75,8 @@
- +
+
diff --git a/Cydia.app/package.js b/Cydia.app/package.js index 60bf483d..45390065 100644 --- a/Cydia.app/package.js +++ b/Cydia.app/package.js @@ -16,7 +16,8 @@ "address": "saurik@saurik.com" }, "source": { - "name": "Telesphoreo Tangelo" + "name": "Telesphoreo Tangelo", + "description": "Distribution of Unix Software for the iPhone" } };*/ @@ -79,7 +80,7 @@ $(function () { $("#maintainer-link").href("mailto:" + maintainer.address + "?subject=" + regarding); } - var sponsor = package.maintainer; + var sponsor = package.sponsor; if (sponsor == null) $(".sponsor").remove(); else { @@ -90,6 +91,13 @@ $(function () { var source = package.source; if (source == null) $(".source").remove(); - else - $("#origin").html(source.name); + else { + $("#source-name").html(source.name); + + var description = source.description; + if (description == null) + $(".source-description").remove(); + else + $("#source-description").html(description); + } }); diff --git a/Cydia.mm b/Cydia.mm index 2e1b5b81..c8d57c41 100644 --- a/Cydia.mm +++ b/Cydia.mm @@ -74,12 +74,15 @@ #include #include #include +#include #include +#include #include #include #include #include +#include extern "C" { #include @@ -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(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(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"); -- 2.45.2