From fedd38feb88ac93531aad19ab217e7d61b17f7b9 Mon Sep 17 00:00:00 2001
From: "Jay Freeman (saurik)" <saurik@saurik.com>
Date: Wed, 29 Oct 2014 11:23:11 -0700
Subject: [PATCH] Reload the appcache if suspended over ten minutes.

---
 CyteKit/WebViewController.h | 1 +
 MobileCydia.mm              | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/CyteKit/WebViewController.h b/CyteKit/WebViewController.h
index a159f37e..96186c16 100644
--- a/CyteKit/WebViewController.h
+++ b/CyteKit/WebViewController.h
@@ -103,6 +103,7 @@
 - (id) initWithWidth:(float)width ofClass:(Class)_class;
 
 - (void) callFunction:(WebScriptObject *)function;
+- (void) reloadURLWithCache:(BOOL)cache;
 
 - (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame;
 - (NSURLRequest *) webView:(WebView *)view resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source;
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 823d9bd1..4e627343 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -8930,6 +8930,7 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi
     _H<UIWindow> window_;
     _H<CydiaTabBarController> tabbar_;
     _H<CyteTabBarController> emulated_;
+    _H<AppCacheController> appcache_;
 
     _H<NSMutableArray> essential_;
     _H<NSMutableArray> broken_;
@@ -9738,6 +9739,7 @@ _end
         return;
 
     [tabbar_ beginUpdate];
+    [appcache_ reloadURLWithCache:YES];
 }
 
 - (void) setConfigurationData:(NSString *)data {
@@ -9884,7 +9886,8 @@ _trace();
     broken_ = [NSMutableArray arrayWithCapacity:4];
 
     // XXX: I really need this thing... like, seriously... I'm sorry
-    [[[AppCacheController alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/appcache/", UI_]]] reloadData];
+    appcache_ = [[[AppCacheController alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/appcache/", UI_]]] autorelease];
+    [appcache_ reloadData];
 
     window_ = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
     [window_ orderFront:self];
-- 
2.47.2