Skip to content

Commit

Permalink
Dropped indexing in spotlight migration because the option is switched
Browse files Browse the repository at this point in the history
  • Loading branch information
charliescheer committed Apr 17, 2024
1 parent d570f24 commit 2e2f0e8
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions Simplenote/SimplenoteAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
[self cleanupTags];
[self startListeningForThemeNotifications];

[self indexSpotlightItemsIfNeeded];

[SPTracker trackApplicationLaunched];
}

Expand Down Expand Up @@ -573,37 +571,4 @@ - (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)window
return [[self managedObjectContext] undoManager];
}


#pragma mark ================================================================================
#pragma mark Spotlight
#pragma mark ================================================================================

- (void)indexSpotlightItemsIfNeeded
{
// This process should be executed *just once*, and only if the user is already logged in (AKA "Upgrade")
NSString *kSpotlightDidRunKey = @"SpotlightDidRunKey";
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

if ([defaults boolForKey:kSpotlightDidRunKey] == true) {
return;
}

[defaults setBool:true forKey:kSpotlightDidRunKey];
[defaults synchronize];

if (self.simperium.user.authenticated == false) {
return;
}

[self indexSpotlightItems];
}

- (void)indexSpotlightItems
{
NSManagedObjectContext *context = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];
[context setParentContext:self.simperium.managedObjectContext];

[[CSSearchableIndex defaultSearchableIndex] indexSpotlightItemsIn:context];
}

@end

0 comments on commit 2e2f0e8

Please sign in to comment.