]> git.saurik.com Git - cydget.git/commitdiff
Finished the port to 2.2, as well as the Welcome.html splash cydget.
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 8 Nov 2009 09:15:13 +0000 (09:15 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 8 Nov 2009 09:15:13 +0000 (09:15 +0000)
CydgetCentral.plist [deleted file]
CydgetSettings.mm
Index.html [deleted file]
Tweak.mm
Welcome.html [new file with mode: 0644]
Welcome.plist [new file with mode: 0644]
control
makefile

diff --git a/CydgetCentral.plist b/CydgetCentral.plist
deleted file mode 100644 (file)
index d4cead1..0000000
+++ /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";
-};
index dbe5ab74fef996f801c8add6d67be439edbc7310..6c7e5c8e08771fe13fa11e7ca6c7af7e0caea3d0 100644 (file)
@@ -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 (file)
index 5757782..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-<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>
index cd25dfd6d10f64f5a46903614bddcd45d4cfe52b..550510ae21604fee150309b6f617f829074b848c 100644 (file)
--- 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<NSArray> settings_;
 static _H<NSArray> 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 (file)
index 0000000..0863bb7
--- /dev/null
@@ -0,0 +1,100 @@
+<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">&nbsp;</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>
diff --git a/Welcome.plist b/Welcome.plist
new file mode 100644 (file)
index 0000000..043ab38
--- /dev/null
@@ -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 e100ed2e6b97be17fbb5286e46f66bc0db19336b..a50e0b5dc97d20f4608951a8b94a2ff4e7490b13 100644 (file)
--- a/control
+++ b/control
@@ -3,10 +3,10 @@ Priority: optional
 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/
index 21080603334523207fe4f6afd70efaac34aed968..218a72115077dc25ef565f3526f9311b39ba0109 100644 (file)
--- 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