diff options
-rw-r--r-- | MobileCydia.mm | 11 | ||||
-rw-r--r-- | UICaboodle/BrowserView.h | 1 | ||||
-rw-r--r-- | UICaboodle/BrowserView.mm | 18 |
3 files changed, 21 insertions, 9 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index c9114ef..c0c9705 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -4101,6 +4101,8 @@ static NSString *Warning_; return @"substitutePackageNames"; else if (selector == @selector(scrollToBottom:)) return @"scrollToBottom"; + else if (selector == @selector(setAllowsNavigationAction:)) + return @"setAllowsNavigationAction"; else if (selector == @selector(setButtonImage:withStyle:toFunction:)) return @"setButtonImage"; else if (selector == @selector(setButtonTitle:withStyle:toFunction:)) @@ -4288,6 +4290,10 @@ static NSString *Warning_; [indirect_ setButtonTitle:button withStyle:style toFunction:function]; } +- (void) setAllowsNavigationAction:(NSString *)value { + [indirect_ performSelectorOnMainThread:@selector(setAllowsNavigationActionByNumber:) withObject:value waitUntilDone:NO]; +} + - (void) setHidesBackButton:(NSString *)value { [indirect_ performSelectorOnMainThread:@selector(setHidesBackButtonByNumber:) withObject:value waitUntilDone:NO]; } @@ -5889,11 +5895,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { return [NSURL URLWithString:[NSString stringWithFormat:@"cydia://package/%@", (id) name_]]; } -- (bool) _allowNavigationAction { - // XXX: damn it... I really want this. - return true; -} - /* XXX: this is not safe at all... localization of /fail/ */ - (void) _clickButtonWithName:(NSString *)name { if ([name isEqualToString:UCLocalize("CLEAR")]) diff --git a/UICaboodle/BrowserView.h b/UICaboodle/BrowserView.h index 41b3d9d..03355c2 100644 --- a/UICaboodle/BrowserView.h +++ b/UICaboodle/BrowserView.h @@ -93,6 +93,7 @@ bool visible_; bool hidesNavigationBar_; + bool allowsNavigationAction_; } + (void) _initialize; diff --git a/UICaboodle/BrowserView.mm b/UICaboodle/BrowserView.mm index 29fbde6..cb16f00 100644 --- a/UICaboodle/BrowserView.mm +++ b/UICaboodle/BrowserView.mm @@ -637,8 +637,16 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se return true; } -- (bool) _allowNavigationAction { - return true; +- (bool) allowsNavigationAction { + return allowsNavigationAction_; +} + +- (void) setAllowsNavigationAction:(bool)value { + allowsNavigationAction_ = value; +} + +- (void) setAllowsNavigationActionByNumber:(NSNumber *)value { + [self setAllowsNavigationAction:[value boolValue]]; } - (void) _didFailWithError:(NSError *)error forFrame:(WebFrame *)frame { @@ -707,10 +715,12 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se if ([frame parentFrame] == nil) { if (!error_) { - if ([self _allowNavigationAction]) + NSURL *url(request == nil ? nil : [request URL]); + + if (request_ == nil || [self allowsNavigationAction] || [[request_ URL] isEqual:url]) request_ = request; else { - if ([request URL] != nil) + if (url != nil) [self pushRequest:request asPop:NO]; [listener ignore]; } |