From: Jay Freeman (saurik) Date: Sun, 8 Nov 2009 09:15:13 +0000 (+0000) Subject: Finished the port to 2.2, as well as the Welcome.html splash cydget. X-Git-Tag: v0.9.4000~54 X-Git-Url: https://git.saurik.com/cydget.git/commitdiff_plain/3aa346e50eee394a7d8a9d5862aebb52fe94e758?ds=inline Finished the port to 2.2, as well as the Welcome.html splash cydget. --- diff --git a/CydgetCentral.plist b/CydgetCentral.plist deleted file mode 100644 index d4cead1..0000000 --- a/CydgetCentral.plist +++ /dev/null @@ -1,8 +0,0 @@ -Tagline = "particularly lame example for you to remove"; -Plugin = "WebCycriptLockScreen"; - -Configuration = { - Homepage = "file:///System/Library/LockCydgets/CydgetCentral.cydget/Index.html"; - Cycript = "YES"; - Scrollable = "NO"; -}; diff --git a/CydgetSettings.mm b/CydgetSettings.mm index dbe5ab7..6c7e5c8 100644 --- a/CydgetSettings.mm +++ b/CydgetSettings.mm @@ -95,9 +95,9 @@ static NSString *_plist; self.themes = [_settings objectForKey:@"LockCydgets"]; if (!_themes) { self.themes = [NSMutableArray arrayWithObjects:[NSMutableDictionary dictionaryWithObjectsAndKeys: - @"AwayView", @"Name", [NSNumber numberWithBool:YES], @"Active", nil + @"Welcome", @"Name", [NSNumber numberWithBool:YES], @"Active", nil ], [NSMutableDictionary dictionaryWithObjectsAndKeys: - @"CydgetCentral", @"Name", [NSNumber numberWithBool:YES], @"Active", nil + @"AwayView", @"Name", [NSNumber numberWithBool:YES], @"Active", nil ], nil]; [_settings setObject:_themes forKey:@"LockCydgets"]; diff --git a/Index.html b/Index.html deleted file mode 100644 index 5757782..0000000 --- a/Index.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - -
- - - diff --git a/Tweak.mm b/Tweak.mm index cd25dfd..550510a 100644 --- a/Tweak.mm +++ b/Tweak.mm @@ -48,6 +48,7 @@ MSClassHook(SpringBoard) MSClassHook(SBAwayController) MSClassHook(SBAwayView) +MSClassHook(SBAwayWindow) #define _trace() \ NSLog(@"_trace(%s:%u)@%s %d", __FILE__, __LINE__, __FUNCTION__, active_) @@ -60,6 +61,7 @@ static unsigned lock_; static _H settings_; static _H cydgets_; static size_t active_; +static unsigned online_; @interface CydgetController : NSObject { } @@ -84,13 +86,17 @@ static size_t active_; @implementation NSDictionary (Cydgets) - (void) enableCydget:(SBAwayController *)away { - if (NSString *plugin = [self objectForKey:@"Plugin"]) + if (NSString *plugin = [self objectForKey:@"Plugin"]) { [away enableLockScreenBundleWithName:plugin]; + ++online_; + } } - (void) disableCydget:(SBAwayController *)away { - if (NSString *plugin = [self objectForKey:@"Plugin"]) + if (NSString *plugin = [self objectForKey:@"Plugin"]) { [away disableLockScreenBundleWithName:plugin]; + --online_; + } } @end @@ -102,7 +108,8 @@ MSInstanceMessageHook0(BOOL, SBAwayController, handleMenuButtonTap) { [[cydgets_ objectAtIndex:active_] disableCydget:self]; active_ = (active_ + 1) % [cydgets_ count]; [[cydgets_ objectAtIndex:active_] enableCydget:self]; - } + } else if (lock == 2) + lock_ = 0; return YES; } @@ -115,7 +122,8 @@ MSInstanceMessageHook0(void, SBAwayController, _undimScreen) { } MSInstanceMessageHook0(void, SBAwayController, undimScreen) { - lock_ = menu_ ? 1 : 0; + if (lock_ != 2) + lock_ = menu_ ? 1 : 0; MSOldCall(); } @@ -124,9 +132,18 @@ static void Deactivate_(SBAwayController *self) { active_ = 0; } -MSInstanceMessageHook0(void, SBAwayController, finishedDimmingScreen) { - Deactivate_(self); - MSOldCall(); +#define MSNotificationHook(notification) \ + static void N_mas(); \ + static void burple(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef info) { \ + N_mas(); \ + } \ + static class N_MSq { public: _finline N_MSq() { \ + CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, &burple, CFSTR(notification), NULL, 0); \ + } } n_msq; \ + static void N_mas() + +MSNotificationHook("SBDidTurnOffDisplayNotification") { + Deactivate_([$SBAwayController sharedAwayController]); } MSInstanceMessageHook1(void, SpringBoard, menuButtonUp, GSEventRef, event) { @@ -139,6 +156,14 @@ MSInstanceMessageHook1(void, SBAwayView, addGestureRecognizer, id, recognizer) { // MSOldCall(recognizer); } +MSInstanceMessageHook1(void, SBAwayWindow, sendGSEvent, GSEventRef, event) { +_trace(); + if (online_ != 0) + MSSuperCall(event); + else + MSOldCall(event); +} + #define Cydgets_ @"/System/Library/LockCydgets" static void CydgetSetup() { @@ -146,9 +171,9 @@ static void CydgetSetup() { settings_ = [NSMutableDictionary dictionaryWithContentsOfFile:plist] ?: [NSMutableDictionary dictionary]; NSArray *cydgets([settings_ objectForKey:@"LockCydgets"] ?: [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys: - @"AwayView", @"Name", [NSNumber numberWithBool:YES], @"Active", nil + @"Welcome", @"Name", [NSNumber numberWithBool:YES], @"Active", nil ], [NSDictionary dictionaryWithObjectsAndKeys: - @"CydgetCentral", @"Name", [NSNumber numberWithBool:YES], @"Active", nil + @"AwayView", @"Name", [NSNumber numberWithBool:YES], @"Active", nil ], nil]); cydgets_ = [NSMutableArray arrayWithCapacity:4]; diff --git a/Welcome.html b/Welcome.html new file mode 100644 index 0000000..0863bb7 --- /dev/null +++ b/Welcome.html @@ -0,0 +1,100 @@ + + + +
+

 

+

Welcome to Cydget!

+
+ +
+

Cydgettm is a very simple SBAwayViewPlugin multiplexer, allowing both developers and web designers to extend the capabilities of the lock screen by tapping into the existing mechanism Apple is already using for VoiceRecorder and Nike+. The WebCycript Cydget framework is designed to be a powerful replacement for the Lock Widget feature from WinterBoard, which it hereby supercedes.

+

You can switch between Cydgets (your original SpringBoard away view is next in the rotation) using the Home/Menu button, and you can re-order them using Settings under "Cydget".

+
+ + + + + diff --git a/Welcome.plist b/Welcome.plist new file mode 100644 index 0000000..043ab38 --- /dev/null +++ b/Welcome.plist @@ -0,0 +1,8 @@ +Tagline = "a warm welcome to the new cydget experience"; +Plugin = "WebCycriptLockScreen"; + +Configuration = { + Homepage = "file:///System/Library/LockCydgets/Welcome.cydget/Welcome.html"; + Cycript = "YES"; + Scrollable = "NO"; +}; diff --git a/control b/control index e100ed2..a50e0b5 100644 --- a/control +++ b/control @@ -3,10 +3,10 @@ Priority: optional Section: Development Maintainer: Jay Freeman (saurik) Architecture: iphoneos-arm -Version: 0.9.3079-1 +Version: 0.9.3080-1 Description: framework for managing lock screen plugins Name: Cydget -Depends: mobilesubstrate (>= 0.9.2587-1), cycript (>= 0.9.252) +Depends: mobilesubstrate (>= 0.9.2587-1), cycript (>= 0.9.252), firmware (>= 2.2) Replaces: cydialer (<< 0.9.17) Author: Jay Freeman (saurik) Depiction: http://cydia.saurik.com/info/cydget/ diff --git a/makefile b/makefile index 2108060..218a721 100644 --- a/makefile +++ b/makefile @@ -19,9 +19,9 @@ WebCycriptLockScreen: LockScreen.mm makefile $(base)/../mobilesubstrate/substrat ldid -S $@ extra: - mkdir -p package/System/Library/LockCydgets/CydgetCentral.cydget - cp -a Index.{html,js} package/System/Library/LockCydgets/CydgetCentral.cydget - cp -a CydgetCentral.plist package/System/Library/LockCydgets/CydgetCentral.cydget/Info.plist + mkdir -p package/System/Library/LockCydgets/Welcome.cydget + cp -a Welcome.html package/System/Library/LockCydgets/Welcome.cydget + cp -a Welcome.plist package/System/Library/LockCydgets/Welcome.cydget/Info.plist svn export AwayView.cydget package/System/Library/LockCydgets/AwayView.cydget mkdir -p package/System/Library/SpringBoardPlugins/WebCycriptLockScreen.bundle cp -a Info.plist package/System/Library/SpringBoardPlugins/WebCycriptLockScreen.bundle