]> git.saurik.com Git - cydia.git/blobdiff - CyteKit/Application.mm
Do not crash if Safari's Info.plist can't be read.
[cydia.git] / CyteKit / Application.mm
index d1d614220009014407cb4d4f9bba635fa0aea50c..025cbd797c23d76a920a79e11052ce8ff2d0974b 100644 (file)
 #include <Foundation/Foundation.h>
 #include <UIKit/UIKit.h>
 
 #include <Foundation/Foundation.h>
 #include <UIKit/UIKit.h>
 
+#include "CyteKit/Application.h"
+#include "CyteKit/URLCache.h"
+
 #include "iPhonePrivate.h"
 #include <Menes/ObjectHandle.h>
 
 #include "iPhonePrivate.h"
 #include <Menes/ObjectHandle.h>
 
-@implementation CyteApplication : UIApplication {
+@implementation CyteApplication {
+    unsigned activity_;
 }
 
 - (void) _sendMemoryWarningNotification {
 }
 
 - (void) _sendMemoryWarningNotification {
 
     if ([self respondsToSelector:@selector(setApplicationSupportsShakeToEdit:)])
         [self setApplicationSupportsShakeToEdit:NO];
 
     if ([self respondsToSelector:@selector(setApplicationSupportsShakeToEdit:)])
         [self setApplicationSupportsShakeToEdit:NO];
+
+    [NSURLCache setSharedURLCache:[[[CyteURLCache alloc]
+        initWithMemoryCapacity:524288
+        diskCapacity:10485760
+        diskPath:[NSString stringWithFormat:@"%@/%@/%@", NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject, NSBundle.mainBundle.bundleIdentifier, @"SDURLCache"]
+    ] autorelease]];
+}
+
+- (void) retainNetworkActivityIndicator {
+    if (activity_++ == 0)
+        [self setNetworkActivityIndicatorVisible:YES];
+
+#if TraceLogging
+    NSLog(@"retainNetworkActivityIndicator->%d", activity_);
+#endif
+}
+
+- (void) releaseNetworkActivityIndicator {
+    if (--activity_ == 0)
+        [self setNetworkActivityIndicatorVisible:NO];
+
+#if TraceLogging
+    NSLog(@"releaseNetworkActivityIndicator->%d", activity_);
+#endif
 }
 
 @end
 }
 
 @end