Permalink
Browse files

Changed file caches lifetime.

  • Loading branch information...
1 parent 3286bf4 commit 6b8ee268d68fef521dd5e5d70a1b683314731ff0 @kishikawakatsumi committed Sep 29, 2012
@@ -21,7 +21,6 @@
087F5B401612E6AB004BF7D9 /* AFURLConnectionOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 087F5B351612E6AB004BF7D9 /* AFURLConnectionOperation.m */; };
087F5B411612E6AB004BF7D9 /* AFXMLRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 087F5B371612E6AB004BF7D9 /* AFXMLRequestOperation.m */; };
087F5B421612E6AB004BF7D9 /* UIImageView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 087F5B391612E6AB004BF7D9 /* UIImageView+AFNetworking.m */; };
- 140EC7F51613CD9C00E43307 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 140EC7F41613CD9C00E43307 /* Settings.bundle */; };
1414DF531613D43000161754 /* Icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 1414DF4D1613D43000161754 /* Icon-72.png */; };
1414DF541613D43000161754 /* Icon-72@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1414DF4E1613D43000161754 /* Icon-72@2x.png */; };
1414DF551613D43000161754 /* Icon-Small-50.png in Resources */ = {isa = PBXBuildFile; fileRef = 1414DF4F1613D43000161754 /* Icon-Small-50.png */; };
@@ -84,7 +83,6 @@
087F5B371612E6AB004BF7D9 /* AFXMLRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFXMLRequestOperation.m; path = Vendor/AFNetworking/AFXMLRequestOperation.m; sourceTree = SOURCE_ROOT; };
087F5B381612E6AB004BF7D9 /* UIImageView+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIImageView+AFNetworking.h"; path = "Vendor/AFNetworking/UIImageView+AFNetworking.h"; sourceTree = SOURCE_ROOT; };
087F5B391612E6AB004BF7D9 /* UIImageView+AFNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIImageView+AFNetworking.m"; path = "Vendor/AFNetworking/UIImageView+AFNetworking.m"; sourceTree = SOURCE_ROOT; };
- 140EC7F41613CD9C00E43307 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
1414DF4D1613D43000161754 /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72.png"; sourceTree = "<group>"; };
1414DF4E1613D43000161754 /* Icon-72@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72@2x.png"; sourceTree = "<group>"; };
1414DF4F1613D43000161754 /* Icon-Small-50.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-Small-50.png"; sourceTree = "<group>"; };
@@ -279,7 +277,6 @@
149A404F160F91540058468B /* ClassicMap-Info.plist */,
149A4050160F91540058468B /* InfoPlist.strings */,
14EAE10516122C6C0026BD7C /* Localizable.strings */,
- 140EC7F41613CD9C00E43307 /* Settings.bundle */,
144CEC2316135F4400E1E8C0 /* Images */,
);
name = "Supporting Files";
@@ -349,7 +346,6 @@
144CEC2016135F3B00E1E8C0 /* Icon.png in Resources */,
144CEC2116135F3B00E1E8C0 /* Icon@2x.png in Resources */,
144CEC251613635400E1E8C0 /* LoadingTile@2x.png in Resources */,
- 140EC7F51613CD9C00E43307 /* Settings.bundle in Resources */,
1414DF531613D43000161754 /* Icon-72.png in Resources */,
1414DF541613D43000161754 /* Icon-72@2x.png in Resources */,
1414DF551613D43000161754 /* Icon-Small-50.png in Resources */,
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>Title</key>
- <string>ClassicMap</string>
- <key>StringsTable</key>
- <string>Root</string>
- <key>PreferenceSpecifiers</key>
- <array>
- <dict>
- <key>Type</key>
- <string>PSGroupSpecifier</string>
- <key>Title</key>
- <string>Cache</string>
- </dict>
- <dict>
- <key>Type</key>
- <string>PSToggleSwitchSpecifier</string>
- <key>Title</key>
- <string>Clear Caches on Launch</string>
- <key>Key</key>
- <string>clearAllFileCachesOnLaunch</string>
- <key>DefaultValue</key>
- <false/>
- </dict>
- </array>
-</dict>
-</plist>
@@ -1,3 +0,0 @@
-"ClassicMap" = "ClassicMap";
-"Caches" = "Caches";
-"Clear Caches on Launch" = "Clear Caches on Launch";
@@ -1,3 +0,0 @@
-"ClassicMap" = "復刻版マップ";
-"Caches" = "キャッシュ";
-"Clear Caches on Launch" = "キャッシュをクリア";
@@ -15,16 +15,8 @@ @implementation WMAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES];
- [self registerDefaultsFromSettingsBundle];
- NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
- BOOL clearAllFileCachesOnLaunch = [defs boolForKey:@"clearAllFileCachesOnLaunch"];
- if (clearAllFileCachesOnLaunch) {
- NSLog(@"%@", @"clear caches");
- [[WMImageCache sharedInstance] deleteAllCacheFiles];
- [defs setBool:NO forKey:@"clearAllFileCachesOnLaunch"];
- [defs synchronize];
- }
+ [[WMImageCache sharedInstance] deleteAllCacheFiles];
return YES;
}
@@ -34,33 +26,8 @@ - (void)applicationDidEnterBackground:(UIApplication *)application
[[WMImageCache sharedInstance] purgeMemoryCache];
}
-- (void)registerDefaultsFromSettingsBundle
-{
- NSUserDefaults * defs = [NSUserDefaults standardUserDefaults];
- [defs synchronize];
-
- NSString *settingsBundle = [[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"bundle"];
- if (!settingsBundle) {
- return;
- }
-
- NSDictionary *settings = [NSDictionary dictionaryWithContentsOfFile:[settingsBundle stringByAppendingPathComponent:@"Root.plist"]];
- NSArray *preferences = [settings objectForKey:@"PreferenceSpecifiers"];
- NSMutableDictionary *defaultsToRegister = [[NSMutableDictionary alloc] initWithCapacity:[preferences count]];
-
- for (NSDictionary *prefSpecification in preferences) {
- NSString *key = [prefSpecification objectForKey:@"Key"];
- if (key) {
- id currentObject = [defs objectForKey:key];
- if (!currentObject) {
- id objectToSet = [prefSpecification objectForKey:@"DefaultValue"];
- [defaultsToRegister setObject:objectToSet forKey:key];
- }
- }
- }
-
- [defs registerDefaults:defaultsToRegister];
- [defs synchronize];
+- (void)applicationWillTerminate:(UIApplication *)application {
+ [[WMImageCache sharedInstance] deleteAllCacheFiles];
}
@end

0 comments on commit 6b8ee26

Please sign in to comment.