Revision: 27806
          http://sourceforge.net/p/bibdesk/svn/27806
Author:   hofman
Date:     2022-08-16 16:13:13 +0000 (Tue, 16 Aug 2022)
Log Message:
-----------
Enable icon database on 10.12-. Use age limit from WebHistory for age of saved 
icon database.

Modified Paths:
--------------
    trunk/bibdesk/BDSKWebIconDatabase.m

Modified: trunk/bibdesk/BDSKWebIconDatabase.m
===================================================================
--- trunk/bibdesk/BDSKWebIconDatabase.m 2022-08-16 09:02:23 UTC (rev 27805)
+++ trunk/bibdesk/BDSKWebIconDatabase.m 2022-08-16 16:13:13 UTC (rev 27806)
@@ -41,6 +41,7 @@
 #import "NSString_BDSKExtensions.h"
 #import "BDSKBookmark.h"
 #import "BDSKBookmarkController.h"
+#import <WebKit/WebKit.h>
 
 #define ICONS_KEY       @"icons"
 #define PAGES_KEY       @"pages"
@@ -58,8 +59,6 @@
 @implementation BDSKWebIconDatabase
 
 + (BDSKWebIconDatabase *)sharedDatabase {
-    if (RUNNING_BEFORE(10_13))
-        return nil;
     static BDSKWebIconDatabase *sharedDatabase = nil;
     if (sharedDatabase == nil)
         sharedDatabase = [[self alloc] init];
@@ -69,11 +68,10 @@
 - (id)init {
     self = [super init];
     if (self) {
-        NSURL *dbURL = [self webIconDatabaseURL];
-        NSData *dbData = [NSData dataWithContentsOfURL:dbURL options:0 
error:NULL];
+        NSData *data = [NSData dataWithContentsOfURL:[self webIconDatabaseURL] 
options:0 error:NULL];
         NSDictionary *dict = nil;
-        if (dbData) {
-            dict = [NSPropertyListSerialization propertyListWithData:dbData  
options:NSPropertyListMutableContainers format:NULL error:NULL];
+        if (data) {
+            dict = [NSPropertyListSerialization propertyListWithData:data  
options:NSPropertyListMutableContainers format:NULL error:NULL];
             if ([[dict objectForKey:VERSION_KEY] integerValue] > VERSION)
                 dict == nil;
         }
@@ -177,10 +175,9 @@
 - (void)handleApplicationWillTerminate:(NSNotification *)notification {
     if ([recentIcons count] == 0)
         return;
-    NSURL *dbURL = [self webIconDatabaseURL];
-    NSDictionary *dict = [self dictionaryWithLimit:7.0 * 86400.0];
+    NSDictionary *dict = [self dictionaryWithLimit:([[WebHistory 
optionalSharedHistory] historyAgeInDaysLimit] ?: 7) * 86400.0];
     NSData *data = [NSPropertyListSerialization dataWithPropertyList:dict 
format:NSPropertyListBinaryFormat_v1_0 options:0 error:NULL];
-    [data writeToURL:dbURL atomically:YES];
+    [data writeToURL:[self webIconDatabaseURL] atomically:YES];
 }
 
 @end

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to