+++ /dev/null
-Tagline = "particularly lame example for you to remove";
-Plugin = "WebCycriptLockScreen";
-
-Configuration = {
- Homepage = "file:///System/Library/LockCydgets/CydgetCentral.cydget/Index.html";
- Cycript = "YES";
- Scrollable = "NO";
-};
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"];
+++ /dev/null
-<html><head>
- <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
-<style>
- * {
- border: 0;
- -moz-border-radius: 0;
- -webkit-border-radius: 0;
- box-sizing: border-box;
- -moz-box-sizing: border-box;
- -ms-box-sizing: border-box;
- -webkit-box-sizing: border-box;
- /*font-family: inherit;*/
- font-size: 100%;
- font-style: inherit;
- font-weight: inherit;
- margin: 0;
- outline: 0;
- padding: 0;
- text-decoration: none;
- vertical-align: baseline;
- }
-
- body {
- color: white;
- }
-
- #lcd {
- background: url(cydget://_UIImageWithName/UILCDBackground.png);
- height: 96px;
- width: 320px;
- }
-
- #lcd h1 {
- font-family: "LockClock-Light";
- font-size: 65px;
- left: 1px;
- position: relative;
- text-align: center;
- text-shadow: -0.5px -1px 1px black;
- top: -6px;
- }
-
- #lcd h2 {
- font-family: "Helvetica";
- font-size: 17px;
- position: relative;
- text-align: center;
- text-shadow: -0.5px -1px 1px black;
- top: -16px;
- }
-</style></head><body>
- <!-- XXX: extract this out to some kind of nifty Lock Cydget library -->
- <div id="lcd"><script type="text/javascript">with (Cycript.all) {
- var locale = CFLocaleCopyCurrent();
- var now = CFDateCreate(NULL, CFAbsoluteTimeGetCurrent());
- var formatter = CFDateFormatterCreate(NULL, locale, kCFDateFormatterNoStyle, kCFDateFormatterNoStyle);
- CFRelease(locale);
-
- CFDateFormatterSetFormat(formatter, UIDateFormatStringForFormatType(UINoAMPMTimeFormat));
- var time = CFDateFormatterCreateStringWithDate(NULL, formatter, now);
- document.write('<h1>' + time + '</h1>');
- CFRelease(time);
-
- CFDateFormatterSetFormat(formatter, UIDateFormatStringForFormatType(UIWeekdayNoYearDateFormat));
- var date = CFDateFormatterCreateStringWithDate(NULL, formatter, now);
- document.write('<h2>' + date + '</h2>');
- CFRelease(date);
-
- CFRelease(formatter);
- CFRelease(now);
- }</script></div>
-
- <script type="text/javascript" src="Index.js"></script>
-</body></html>
MSClassHook(SpringBoard)
MSClassHook(SBAwayController)
MSClassHook(SBAwayView)
+MSClassHook(SBAwayWindow)
#define _trace() \
NSLog(@"_trace(%s:%u)@%s %d", __FILE__, __LINE__, __FUNCTION__, active_)
static _H<NSArray> settings_;
static _H<NSArray> cydgets_;
static size_t active_;
+static unsigned online_;
@interface CydgetController : NSObject {
}
@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
[[cydgets_ objectAtIndex:active_] disableCydget:self];
active_ = (active_ + 1) % [cydgets_ count];
[[cydgets_ objectAtIndex:active_] enableCydget:self];
- }
+ } else if (lock == 2)
+ lock_ = 0;
return YES;
}
}
MSInstanceMessageHook0(void, SBAwayController, undimScreen) {
- lock_ = menu_ ? 1 : 0;
+ if (lock_ != 2)
+ lock_ = menu_ ? 1 : 0;
MSOldCall();
}
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) {
// 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() {
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];
--- /dev/null
+<html><head>
+ <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
+<style>
+ * {
+ border: 0;
+ -moz-border-radius: 0;
+ -webkit-border-radius: 0;
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ -ms-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ /*font-family: inherit;*/
+ font-size: 100%;
+ font-style: inherit;
+ font-weight: inherit;
+ margin: 0;
+ outline: 0;
+ padding: 0;
+ text-decoration: none;
+ vertical-align: baseline;
+ }
+
+ body {
+ color: white;
+ }
+
+ #lcd {
+ background: url(cydget://_UIImageWithName/UILCDBackground.png);
+ height: 96px;
+ width: 320px;
+ }
+
+ #lcd h1 {
+ font-family: "LockClock-Light";
+ font-size: 65px;
+ left: 1px;
+ position: relative;
+ text-align: center;
+ text-shadow: -0.5px -1px 1px black;
+ top: -6px;
+ }
+
+ #lcd h2 {
+ font-family: "Helvetica";
+ font-size: 17px;
+ position: relative;
+ text-align: center;
+ text-shadow: -0.5px -1px 1px black;
+ top: -16px;
+ }
+
+ #content {
+ font-family: "Helvetica";
+ }
+
+ #content h3 {
+ font-size: 20px;
+ text-align: center;
+ margin-bottom: 10px;
+ }
+
+ #content p {
+ font-size: 14px;
+ text-align: justify;
+ margin: 10px 12px;
+ }
+
+ sup {
+ font-size: smaller;
+ position: relative;
+ top: -5px;
+ }
+</style></head><body>
+ <div id="lcd">
+ <h1 id="time"> </h1>
+ <h2>Welcome to Cydget!</h2>
+ </div>
+
+ <div id="content">
+ <p>Cydget<sup>tm</sup> 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.</p>
+ <p>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".</p>
+ </div>
+
+ <!-- XXX: extract this out to some kind of nifty Lock Cydget library -->
+ <!-- XXX: this is incredibly indirect. I mean: wth, right? well, Cycript is the slowest thing on this page -->
+ <script type="text/javascript">document.addEventListener("DOMContentLoaded", function() {window.setTimeout(function() {with (Cycript.all) {
+ var locale = CFLocaleCopyCurrent();
+ var now = CFDateCreate(NULL, CFAbsoluteTimeGetCurrent());
+ var formatter = CFDateFormatterCreate(NULL, locale, kCFDateFormatterNoStyle, kCFDateFormatterNoStyle);
+ CFRelease(locale);
+
+ CFDateFormatterSetFormat(formatter, UIDateFormatStringForFormatType(UINoAMPMTimeFormat));
+ var time = CFDateFormatterCreateStringWithDate(NULL, formatter, now);
+ document.getElementById("time").innerHTML = time;
+ CFRelease(time);
+
+ CFRelease(formatter);
+ CFRelease(now);
+ }}, 0)}, false);</script>
+</body></html>
--- /dev/null
+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";
+};
Section: Development
Maintainer: Jay Freeman (saurik) <saurik@saurik.com>
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) <saurik@saurik.com>
Depiction: http://cydia.saurik.com/info/cydget/
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