]> git.saurik.com Git - cydget.git/commitdiff
Use the new @media to rethink how legacy works.
authorJay Freeman (saurik) <saurik@saurik.com>
Fri, 24 Jan 2014 23:38:06 +0000 (15:38 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Fri, 24 Jan 2014 23:48:50 +0000 (15:48 -0800)
LockScreen.mm
PhotoExamplePlus.cydget/Info.plist
PhotoExamplePlus.cydget/foreground.html
Welcome.cydget/Info.plist
Welcome.cydget/Welcome.html

index 5429de0126923a20e5e72379cf3cadac66571d55..002b518222a2f650516255457713c61a8a3b5f3a 100644 (file)
@@ -521,6 +521,9 @@ MSInstanceMessageHook0(BOOL, NSURL, isSpringboardHandledURL) {
 
 @interface WebCycriptLockScreenController : SBAwayViewPluginController {
     NSDictionary *configuration_;
 
 @interface WebCycriptLockScreenController : SBAwayViewPluginController {
     NSDictionary *configuration_;
+    bool legacy_;
+    bool media_;
+    bool items_;
     WebCydgetLockScreenView *background_;
     WebCydgetLockScreenView *foreground_;
 }
     WebCydgetLockScreenView *background_;
     WebCydgetLockScreenView *foreground_;
 }
@@ -1239,6 +1242,9 @@ static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIW
 - (id) init {
     if ((self = [super init]) != nil) {
         configuration_ = [[$CydgetController currentConfiguration] retain];
 - (id) init {
     if ((self = [super init]) != nil) {
         configuration_ = [[$CydgetController currentConfiguration] retain];
+        legacy_ = [configuration_ objectForKey:@"Background"] == nil;
+        media_ = [[configuration_ objectForKey:@"MediaControls"] boolValue];
+        items_ = [[configuration_ objectForKey:@"NotificationList"] boolValue];
     } return self;
 }
 
     } return self;
 }
 
@@ -1251,9 +1257,6 @@ static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIW
     if (NSString *homepage = [configuration_ objectForKey:@"Homepage"]) {
         foreground_ = [[WebCydgetLockScreenView alloc] initWithURL:[NSURL URLWithString:homepage relativeToURL:base]];
         [self setView:foreground_];
     if (NSString *homepage = [configuration_ objectForKey:@"Homepage"]) {
         foreground_ = [[WebCydgetLockScreenView alloc] initWithURL:[NSURL URLWithString:homepage relativeToURL:base]];
         [self setView:foreground_];
-    } else if (kCFCoreFoundationVersionNumber < 800 && background_ != nil) {
-        [self setView:[background_ autorelease]];
-        background_ = nil;
     }
 }
 
     }
 }
 
@@ -1283,50 +1286,55 @@ static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIW
 - (BOOL) updateHidden {
     if (foreground_ == nil)
         return true;
 - (BOOL) updateHidden {
     if (foreground_ == nil)
         return true;
-    SBLockScreenViewController *controller([[$SBLockScreenManager sharedInstance] lockScreenViewController]);
-    SBLockScreenView *view([controller lockScreenView]);
-    bool media(view != nil && ![view mediaControlsHidden]);
+    bool media(CYHaveMediaControls());
     [foreground_ setHidden:media];
     return media;
 }
 
 - (BOOL) showDateView {
     [foreground_ setHidden:media];
     return media;
 }
 
 - (BOOL) showDateView {
-    bool homepage([configuration_ objectForKey:@"Homepage"] != nil);
     if (kCFCoreFoundationVersionNumber < 800)
     if (kCFCoreFoundationVersionNumber < 800)
-        return !homepage;
-    else if (!homepage)
+        return false;
+    [self updateStyles];
+    if (!legacy_ && foreground_ == nil)
+        return true;
+    if (!items_ && CYHaveNotificationList())
         return true;
         return true;
-    return [self updateHidden];
+    return false;
 }
 
 - (BOOL) allowsLockScreenMediaControls {
     if (kCFCoreFoundationVersionNumber < 800)
         return true;
 }
 
 - (BOOL) allowsLockScreenMediaControls {
     if (kCFCoreFoundationVersionNumber < 800)
         return true;
-    if (background_ == nil)
-        return false;
-    [self updateHidden];
-    return true;
+    return media_;
 }
 
 /*- (BOOL) showHeaderView {
     return YES;
 }*/
 
 }
 
 /*- (BOOL) showHeaderView {
     return YES;
 }*/
 
-// 1-3
+// 0: view is rendered above head
+// 1: view moves as one with head
+// 2: view moves up and down only
+// 3: view simply never does move
 - (NSUInteger) presentationStyle {
     return 1;
 }
 
 - (NSUInteger) presentationStyle {
     return 1;
 }
 
-// 1-5
+// 1: light blur
+// 2: heavy blur
+// 3: just black
+// 4: legibility
+// 5: no overlay
 - (NSUInteger) overlayStyle {
 - (NSUInteger) overlayStyle {
-    if ([configuration_ objectForKey:@"Background"] == nil)
-        return 1;
-    return 4;
+    return legacy_ ? 1 : 4;
 }
 
 }
 
-// 1-[2/3?]
+// 1: blur -> view -> list
+// 2: view -> blur -> list
+// 3: view. unblur below?!
+// 4: blur -> list -> view
 - (NSUInteger) notificationBehavior {
 - (NSUInteger) notificationBehavior {
-    return 1;
+    return items_ ? 1 : 2;
 }
 
 - (BOOL) viewWantsFullscreenLayout {
 }
 
 - (BOOL) viewWantsFullscreenLayout {
@@ -1360,7 +1368,7 @@ static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIW
     if (kCFCoreFoundationVersionNumber >= 800) {
         SBLockScreenViewController *controller([[$SBLockScreenManager sharedInstance] lockScreenViewController]);
         [controller _setMediaControlsVisible:![controller isShowingMediaControls]];
     if (kCFCoreFoundationVersionNumber >= 800) {
         SBLockScreenViewController *controller([[$SBLockScreenManager sharedInstance] lockScreenViewController]);
         [controller _setMediaControlsVisible:![controller isShowingMediaControls]];
-        [self updateHidden];
+        [self updateStyles];
     }
 
     return [super handleMenuButtonDoubleTap];
     }
 
     return [super handleMenuButtonDoubleTap];
index 18ad3e768a62ce1ca6286a4964584642a579aba4..098f2af6f942666192b0db9c01daabf2487f6236 100644 (file)
@@ -11,4 +11,6 @@ CYConfiguration = {
     CycriptURLs = "^file:///System/Library/LockCydgets/PhotoExamplePlus\\.cydget/.*\\.html$";
 
     Scrollable = "NO";
     CycriptURLs = "^file:///System/Library/LockCydgets/PhotoExamplePlus\\.cydget/.*\\.html$";
 
     Scrollable = "NO";
+    MediaControls = YES;
+    NotificationList = YES;
 };
 };
index 0933d7240df622616e1ee636d525ec446176c785..bd9fdaaa5d112cb3d0e49f08dd9fd0efd612c699 100644 (file)
             top: -8px;
         }
     }
             top: -8px;
         }
     }
+
+    @media (cydget-media-controls) {
+        #lcd {
+            opacity: 0;
+        }
+    }
 </style></head><body>
     <div id="lcd"><script type="text/javascript">
         var locale = CFLocaleCopyCurrent();
 </style></head><body>
     <div id="lcd"><script type="text/javascript">
         var locale = CFLocaleCopyCurrent();
index 436e7901fcbc95afce293f643be44107eca10102..705f4e33e018a5e0eab2908c64a0947a63ae0d9e 100644 (file)
@@ -5,4 +5,6 @@ CYConfiguration = {
     Homepage = "Welcome.html";
     CycriptURLs = "^file:///System/Library/LockCydgets/Welcome\\.cydget/Welcome\\.html$";
     Scrollable = "NO";
     Homepage = "Welcome.html";
     CycriptURLs = "^file:///System/Library/LockCydgets/Welcome\\.cydget/Welcome\\.html$";
     Scrollable = "NO";
+    MediaControls = YES;
+    NotificationList = YES;
 };
 };
index 1b804ac919632f1ebea1b8a2f92f9c8d47d6c141..531127b51dd427bf270ca18034f94c550cacc1b4 100644 (file)
@@ -1,5 +1,9 @@
 <html><head>
     <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
 <html><head>
     <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
+<style>
+    bob { color: red; }
+</style>
+
 <style>
     * {
         border: 0;
 <style>
     * {
         border: 0;
         text-shadow: -0.5px -1px 1px black;
     }
 
         text-shadow: -0.5px -1px 1px black;
     }
 
+    @media (fuck: landscape) {
+        footer { color: black; }
+    }
+
     @media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
         #lcd {
             height: 96px;
     @media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
         #lcd {
             height: 96px;
         position: relative;
         top: -5px;
     }
         position: relative;
         top: -5px;
     }
+
+    @media (cydget-media-controls) {
+        #lcd {
+            opacity: 0;
+        }
+    }
+
+    @media (cydget-notification-list) {
+        #content {
+            opacity: 0;
+        }
+    }
 </style></head><body>
     <script type="text/javascript">
         if (kCFCoreFoundationVersionNumber > 800)
 </style></head><body>
     <script type="text/javascript">
         if (kCFCoreFoundationVersionNumber > 800)
-            document.write('<div style="height: 24px"></div>');
+            document.write('<div style="height: 60px"></div>');
         else
             document.write('<style type="text/css"> #lcd { background: url(cydget://_UIImageWithName/UILCDBackground.png); } </style>');
     </script>
         else
             document.write('<style type="text/css"> #lcd { background: url(cydget://_UIImageWithName/UILCDBackground.png); } </style>');
     </script>