]> git.saurik.com Git - cydget.git/commitdiff
Separate background and foreground plugin layers.
authorJay Freeman (saurik) <saurik@saurik.com>
Fri, 24 Jan 2014 13:26:33 +0000 (05:26 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Fri, 24 Jan 2014 13:26:33 +0000 (05:26 -0800)
LockScreen.mm

index 55c8cf7a6f7e4b3ae4fb7068afa91c6933b55a9d..b845093a7cd5a94529354aaec76446d73009f1fa 100644 (file)
@@ -356,7 +356,7 @@ MSInstanceMessageHook0(BOOL, NSURL, isSpringboardHandledURL) {
     [self loadURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy];
 }
 
-- (id) init {
+- (id) initWithURL:(NSURL *)url {
     CGRect frame = [[UIScreen mainScreen] bounds];
     if (kCFCoreFoundationVersionNumber < 800)
         frame.size.height -= 20; //[[[$SBStatusBarController sharedStatusBarController] statusBarView] frame].size.height;
@@ -444,13 +444,11 @@ MSInstanceMessageHook0(BOOL, NSURL, isSpringboardHandledURL) {
         [webview_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
 
         NSDictionary *configuration([$CydgetController currentConfiguration]);
-
         cycript_ = [configuration objectForKey:@"CycriptURLs"];
 
         [scroller_ setScrollingEnabled:[[configuration objectForKey:@"Scrollable"] boolValue]];
 
-        NSString *homepage([configuration objectForKey:@"Homepage"]);
-        [self loadURL:[NSURL URLWithString:homepage]];
+        [self loadURL:url];
     } return self;
 }
 
@@ -473,6 +471,8 @@ MSInstanceMessageHook0(BOOL, NSURL, isSpringboardHandledURL) {
 @end
 
 @interface WebCycriptLockScreenController : SBAwayViewPluginController {
+    NSDictionary *configuration_;
+    WebCydgetLockScreenView *background_;
 }
 
 @end
@@ -1122,18 +1122,67 @@ static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIW
     return [[[self alloc] init] autorelease];
 }
 
+- (void) dealloc {
+    [configuration_ release];
+    [background_ release];
+    [super dealloc];
+}
+
+- (id) init {
+    if ((self = [super init]) != nil) {
+        configuration_ = [[$CydgetController currentConfiguration] retain];
+    } return self;
+}
+
 - (void) loadView {
-    [self setView:[[[WebCydgetLockScreenView alloc] init] autorelease]];
+    if (NSString *homepage = [configuration_ objectForKey:@"Homepage"])
+        [self setView:[[[WebCydgetLockScreenView alloc] initWithURL:[NSURL URLWithString:homepage]] autorelease]];
+
+    if (NSString *background = [configuration_ objectForKey:@"Background"])
+        background_ = [[WebCydgetLockScreenView alloc] initWithURL:[NSURL URLWithString:background]];
+}
+
+- (void) purgeView {
+    [background_ removeFromSuperview];
+    [background_ release];
+    background_ = nil;
+    [super purgeView];
+}
+
+- (UIView *) backgroundView {
+    return background_;
 }
 
 - (BOOL) showAwayItems {
     return YES;
 }
 
+- (BOOL) showDateView {
+    return [configuration_ objectForKey:@"Homepage"] == nil;
+}
+
+/*- (BOOL) showHeaderView {
+    return YES;
+}*/
+
+- (NSUInteger) presentationStyle {
+    return 1;
+}
+
+- (NSUInteger) overlayStyle {
+    if ([configuration_ objectForKey:@"Background"] == nil)
+        return 1;
+    return 4;
+}
+
 - (BOOL) viewWantsFullscreenLayout {
     return kCFCoreFoundationVersionNumber >= 800;
 }
 
+/*- (BOOL) viewWantsOverlayLayout {
+    return kCFCoreFoundationVersionNumber >= 800;
+}*/
+
 - (BOOL) shouldDisableOnUnlock {
     return YES;
 }
@@ -1142,6 +1191,15 @@ static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIW
     return YES;
 }
 
+/*- (BOOL) wantsSwipeGestureRecognizer {
+    return YES;
+}
+
+- (BOOL) handleGesture:(int)arg1 fingerCount:(NSUInteger)fingers {
+    return NO;
+    return YES;
+}*/
+
 @end
 
 MSClassHook(WebView)