From 32591608c1f4c80abc5e89fb93f2047168785899 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 24 Jan 2014 05:26:33 -0800 Subject: [PATCH] Separate background and foreground plugin layers. --- LockScreen.mm | 68 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/LockScreen.mm b/LockScreen.mm index 55c8cf7..b845093 100644 --- a/LockScreen.mm +++ b/LockScreen.mm @@ -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) -- 2.45.2