From: Ryan Petrich Date: Sun, 26 Sep 2010 08:48:43 +0000 (-0600) Subject: Add External Status API X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/864da84bb150ad532c5f643deb8ce699f9a0f329?hp=1e8e98729797b8f7c4b0720d9bd66eb1c2124695 Add External Status API status stored in the com.saurik.Cydia.status register: 0 = clean, 1 = installing, 2 = installed and requires confirmation to respring/reboot/etc com.saurik.Cydia.status is notify_post'ed when status changes --- diff --git a/Cydia.mm b/Cydia.mm index 2a5b7158..4cb84eb0 100644 --- a/Cydia.mm +++ b/Cydia.mm @@ -116,6 +116,8 @@ extern "C" { #include +#include + #import "UICaboodle/BrowserView.h" #import "UICaboodle/ResetView.h" @@ -257,6 +259,15 @@ static _finline NSString *CydiaURL(NSString *path) { return [[NSString stringWithUTF8String:page] stringByAppendingString:path]; } +static _finline void UpdateExternalStatus(uint64_t newStatus) { + int notify_token; + if (notify_register_check("com.saurik.Cydia.status", ¬ify_token) == NOTIFY_STATUS_OK) { + notify_set_state(notify_token, newStatus); + notify_cancel(notify_token); + } + notify_post("com.saurik.Cydia.status"); +} + /* [NSObject yieldToSelector:(withObject:)] {{{*/ @interface NSObject (Cydia) - (id) yieldToSelector:(SEL)selector withObject:(id)object; @@ -4377,6 +4388,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { - (void) closeButtonPushed { running_ = NO; + UpdateExternalStatus(0); + switch (Finish_) { case 0: [self dismissModalViewControllerAnimated:YES]; @@ -4450,6 +4463,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { system("su -c /usr/bin/uicache mobile"); + UpdateExternalStatus(Finish_ == 0 ? 2 : 0); + [delegate_ setStatusBarShowsProgress:NO]; } @@ -4461,6 +4476,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { } - (void) detachNewThreadSelector:(SEL)selector toTarget:(id)target withObject:(id)object title:(NSString *)title { + UpdateExternalStatus(1); + if (title_ != nil) [title_ release]; if (title == nil)