Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refresh the contents of our URLs on launch.

  • Loading branch information...
commit 4aa588f1b48e9b5b019e1488ffaa6eea97079990 1 parent bca75ad
@beelsebob authored
Showing with 70 additions and 32 deletions.
  1. +38 −30 Stash/STAAppDelegate.m
  2. +32 −2 Stash/en.lproj/MainMenu.xib
View
68 Stash/STAAppDelegate.m
@@ -294,6 +294,7 @@ - (void)readExistingIndexes
- (void)refreshExistingBookmarksWithContinuation:(void(^)(void))cont
{
NSArray *documentationBookmarks = [[NSUserDefaults standardUserDefaults] arrayForKey:STADocumentationBookmarksKey];
+ NSMutableArray *bookmarkURLs = [NSMutableArray arrayWithCapacity:[documentationBookmarks count]];
for (NSData *bookmark in documentationBookmarks)
{
BOOL stale = NO;
@@ -304,8 +305,9 @@ - (void)refreshExistingBookmarksWithContinuation:(void(^)(void))cont
bookmarkDataIsStale:&stale
error:&err];
[url startAccessingSecurityScopedResource];
+ [bookmarkURLs addObject:url];
}
- cont();
+ [self indexDocsetsWithPermissionInRoots:bookmarkURLs withContinuation:cont];
}
- (void)indexDocsetsInRoots:(NSArray *)roots withContinuation:(void(^)(void))cont
@@ -372,38 +374,44 @@ - (void)indexDocsetsWithPermissionInRoots:(NSArray *)roots withContinuation:(voi
{
NSString *docsetCachePath = [[[self pathForArchive] stringByAppendingPathComponent:[docsetURL lastPathComponent]] stringByAppendingPathExtension:@"stashidx"];
- STADocSet *docset = [STADocSet docSetWithURL:docsetURL
- cachePath:docsetCachePath
- onceIndexed:^(STADocSet *idx)
- {
- [NSKeyedArchiver archiveRootObject:idx toFile:docsetCachePath];
- dispatch_sync(_docsetArrayEditingQueue, ^()
- {
- [_indexingDocsets removeObjectIdenticalTo:idx];
- [_docsets addObject:idx];
- dispatch_async(dispatch_get_main_queue(), ^()
- {
- [[self indexingDocsetsView] reloadData];
- });
- if (finishedSearchingForDocsets && [_indexingDocsets count] == 0)
+ NSDictionary *attrs = [[NSFileManager defaultManager] attributesOfFileSystemForPath:docsetCachePath error:&err];
+ NSDictionary *docsetAttrs = [docsetURL resourceValuesForKeys:@[NSURLContentModificationDateKey] error:&err];
+ if (nil == attrs ||
+ [(NSDate *)docsetAttrs[NSURLContentModificationDateKey] compare:attrs[NSFileModificationDate]] == NSOrderedDescending)
+ {
+ STADocSet *docset = [STADocSet docSetWithURL:docsetURL
+ cachePath:docsetCachePath
+ onceIndexed:^(STADocSet *idx)
+ {
+ [NSKeyedArchiver archiveRootObject:idx toFile:docsetCachePath];
+ dispatch_sync(_docsetArrayEditingQueue, ^()
{
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), cont);
- }
- });
- }];
- dispatch_sync(_docsetArrayEditingQueue, ^()
- {
- if ([_docsets indexOfObjectIdenticalTo:docset] == NSNotFound)
+ [_indexingDocsets removeObjectIdenticalTo:idx];
+ [_docsets addObject:idx];
+ dispatch_async(dispatch_get_main_queue(), ^()
+ {
+ [[self indexingDocsetsView] reloadData];
+ });
+ if (finishedSearchingForDocsets && [_indexingDocsets count] == 0)
+ {
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), cont);
+ }
+ });
+ }];
+ dispatch_sync(_docsetArrayEditingQueue, ^()
{
- [_indexingDocsets addObject:docset];
- }
- });
- if (nil != docset)
- {
- [[self preferencesController] registerDocset:docset];
- if (![[[self preferencesController] enabledDocsets] containsObject:docset])
+ if ([_docsets indexOfObjectIdenticalTo:docset] == NSNotFound)
+ {
+ [_indexingDocsets addObject:docset];
+ }
+ });
+ if (nil != docset)
{
- [docset unload];
+ [[self preferencesController] registerDocset:docset];
+ if (![[[self preferencesController] enabledDocsets] containsObject:docset])
+ {
+ [docset unload];
+ }
}
}
}
View
34 Stash/en.lproj/MainMenu.xib
@@ -1310,14 +1310,14 @@
<object class="NSWindowTemplate" id="972006081">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{335, 390}, {973, 637}}</string>
+ <string key="NSWindowRect">{{143, 157}, {973, 637}}</string>
<int key="NSWTFlags">1954021376</int>
<string key="NSWindowTitle">Stash</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
<nil key="NSUserInterfaceItemIdentifier"/>
<object class="NSView" key="NSWindowView" id="439893737">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="NSSplitView" id="489345035">
@@ -1333,6 +1333,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{20, 552}, {150, 38}}</string>
<reference key="NSSuperview" ref="286431488"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="975610457"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -1504,6 +1505,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</set>
<string key="NSFrame">{{0, 543}, {229, 1}}</string>
<reference key="NSSuperview" ref="286431488"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="731999841"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -1536,6 +1538,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</set>
<string key="NSFrame">{{0, 598}, {229, 1}}</string>
<reference key="NSSuperview" ref="286431488"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="502976946"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -1565,6 +1568,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">4352</int>
<string key="NSFrameSize">{229, 544}</string>
<reference key="NSSuperview" ref="302682592"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="105211210"/>
<string key="NSReuseIdentifierKey">_NS:13</string>
<bool key="NSEnabled">YES</bool>
@@ -1666,6 +1670,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</array>
<string key="NSFrameSize">{229, 544}</string>
<reference key="NSSuperview" ref="975610457"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="196006355"/>
<string key="NSReuseIdentifierKey">_NS:11</string>
<reference key="NSDocView" ref="196006355"/>
@@ -1680,6 +1685,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{224, 17}, {15, 102}}</string>
<reference key="NSSuperview" ref="975610457"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="492191537"/>
<string key="NSReuseIdentifierKey">_NS:58</string>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
@@ -1692,6 +1698,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{1, 119}, {223, 15}}</string>
<reference key="NSSuperview" ref="975610457"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="901925895"/>
<string key="NSReuseIdentifierKey">_NS:60</string>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
@@ -1703,6 +1710,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</array>
<string key="NSFrameSize">{229, 544}</string>
<reference key="NSSuperview" ref="286431488"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="302682592"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<int key="NSsFlags">133680</int>
@@ -1719,6 +1727,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{20, 607}, {189, 22}}</string>
<reference key="NSSuperview" ref="286431488"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="532254332"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -1778,6 +1787,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</array>
<string key="NSFrameSize">{229, 637}</string>
<reference key="NSSuperview" ref="489345035"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="220182933"/>
<string key="NSReuseIdentifierKey">_NS:11</string>
<string key="NSClassName">NSView</string>
@@ -1800,6 +1810,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<array class="NSMutableArray" key="NSSubviews"/>
<string key="NSFrameSize">{300, 170}</string>
<reference key="NSSuperview" ref="628516069"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="771101011"/>
<string key="NSReuseIdentifierKey">_NS:13</string>
<bool key="NSEnabled">YES</bool>
@@ -1901,6 +1912,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</array>
<string key="NSFrameSize">{300, 170}</string>
<reference key="NSSuperview" ref="109727746"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="457607115"/>
<string key="NSReuseIdentifierKey">_NS:11</string>
<reference key="NSDocView" ref="457607115"/>
@@ -1915,6 +1927,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-100, -100}, {15, 102}}</string>
<reference key="NSSuperview" ref="109727746"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="834214383"/>
<string key="NSReuseIdentifierKey">_NS:58</string>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
@@ -1927,6 +1940,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-100, -100}, {287, 16}}</string>
<reference key="NSSuperview" ref="109727746"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="628516069"/>
<string key="NSReuseIdentifierKey">_NS:60</string>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
@@ -1938,6 +1952,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</array>
<string key="NSFrame">{{226, 233}, {300, 170}}</string>
<reference key="NSSuperview" ref="731999841"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="628516069"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<int key="NSsFlags">154112</int>
@@ -1962,6 +1977,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</set>
<string key="NSFrame">{{88, 599}, {1, 39}}</string>
<reference key="NSSuperview" ref="731999841"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="845344041"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -1991,6 +2007,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</set>
<string key="NSFrame">{{44, 599}, {1, 39}}</string>
<reference key="NSSuperview" ref="731999841"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="169262692"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -2020,6 +2037,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</set>
<string key="NSFrame">{{0, 598}, {743, 1}}</string>
<reference key="NSSuperview" ref="731999841"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="247659310"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -2041,6 +2059,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{106, 609}, {531, 19}}</string>
<reference key="NSSuperview" ref="731999841"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="15757357"/>
<string key="NSReuseIdentifierKey">_NS:1505</string>
<bool key="NSEnabled">YES</bool>
@@ -2065,6 +2084,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{44, 597}, {44, 42}}</string>
<reference key="NSSuperview" ref="731999841"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="109727746"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -2093,6 +2113,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{-1, 597}, {45, 42}}</string>
<reference key="NSSuperview" ref="731999841"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="601319216"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -2138,6 +2159,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</set>
<string key="NSFrameSize">{743, 598}</string>
<reference key="NSSuperview" ref="731999841"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<string key="NSHuggingPriority">{250, 250}</string>
@@ -2171,6 +2193,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</set>
<string key="NSFrameSize">{743, 1}</string>
<reference key="NSSuperview" ref="247659310"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="842032640"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -2192,6 +2215,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{693, 3}, {45, 19}}</string>
<reference key="NSSuperview" ref="247659310"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="705202067"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -2220,6 +2244,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{477, 3}, {208, 19}}</string>
<reference key="NSSuperview" ref="247659310"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="985949831"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -2274,6 +2299,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</array>
<string key="NSFrame">{{-1, 573}, {744, 25}}</string>
<reference key="NSSuperview" ref="731999841"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="533767610"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<string key="NSClassName">NSView</string>
@@ -2281,6 +2307,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</array>
<string key="NSFrame">{{230, 0}, {743, 637}}</string>
<reference key="NSSuperview" ref="489345035"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1004830245"/>
<string key="NSReuseIdentifierKey">_NS:13</string>
<string key="NSClassName">NSView</string>
@@ -2288,6 +2315,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</array>
<string key="NSFrameSize">{973, 637}</string>
<reference key="NSSuperview" ref="439893737"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="286431488"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSIsVertical">YES</bool>
@@ -2295,6 +2323,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
</array>
<string key="NSFrameSize">{973, 637}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="489345035"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
Please sign in to comment.
Something went wrong with that request. Please try again.